/* Quiz Modal Overlay */
#quiz-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Modal Content */
.quiz-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

/* Close Button - 모달 외부 우상단 */
.quiz-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #fff;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    z-index: 10002;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.quiz-modal-close:hover {
    background: #f5f5f5;
    color: #333;
    transform: scale(1.1);
}

/* Modal Body */
.quiz-modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

/* Loading */
.quiz-loading {
    text-align: center;
    padding: 80px 20px;
    color: #888;
    font-size: 15px;
}

.quiz-loading::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #e0e0e0;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Quiz Header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.quiz-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
    letter-spacing: -0.3px;
}

.quiz-status {
    display: flex;
    gap: 16px;
    align-items: center;
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    font-weight: 700;
    color: #e53935;
    background: #ffebee;
    padding: 6px 12px;
    border-radius: 20px;
}

.quiz-timer::before {
    content: '⏱';
    font-size: 14px;
}

.quiz-count {
    font-size: 14px;
    color: #666;
    font-weight: 600;
    background: #f5f5f5;
    padding: 6px 12px;
    border-radius: 20px;
}

/* Quiz Question */
.quiz-question {
    font-size: 17px;
    margin-bottom: 24px;
    line-height: 1.7;
    color: #1a1a1a;
    font-weight: 600;
    white-space: pre-wrap;
}

.quiz-points {
    display: inline-block;
    font-size: 13px;
    color: #2196f3;
    font-weight: 600;
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Quiz Options */
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    padding: 16px 20px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    background: #fafafa;
    color: #333;
    line-height: 1.5;
}

.quiz-option:hover {
    background: #fff;
    border-color: #c0c0c0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.quiz-option.selected {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
    font-weight: 600;
}

.quiz-option.correct {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #4caf50;
    color: #2e7d32;
    font-weight: 600;
}

.quiz-option.incorrect {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #e53935;
    color: #c62828;
    font-weight: 600;
}

/* Result Message */
.quiz-result-message {
    padding: 16px 20px;
    border-radius: 12px;
    margin-top: 20px;
    font-weight: 700;
    text-align: center;
    font-size: 16px;
    display: none;
}

.quiz-result-message.success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
}

.quiz-result-message.error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
}

/* Explanation Box */
.quiz-explanation-box {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #2196f3;
    display: none;
}

.explanation-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: #1a1a1a;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.explanation-title::before {
    content: '💡';
    font-size: 16px;
}

.explanation-text {
    color: #555;
    line-height: 1.7;
    font-size: 14px;
    white-space: pre-wrap;
}

/* Quiz Footer */
.quiz-footer {
    margin-top: 28px;
    text-align: center;
}

/* Buttons */
.quiz-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 14px 48px;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.quiz-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.quiz-btn:active {
    transform: translateY(0);
}

.quiz-btn-close {
    background: linear-gradient(135deg, #757575 0%, #616161 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.quiz-btn-close:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Participated / Login Required Message */
.quiz-participated {
    text-align: center;
    padding: 60px 20px;
}

.participated-title {
    font-size: 20px;
    color: #1a1a1a;
    margin-bottom: 12px;
    font-weight: 700;
}

.participated-desc {
    color: #888;
    font-size: 15px;
    line-height: 1.6;
}

/* Final Result */
.quiz-final-result {
    text-align: center;
    padding: 50px 20px;
}

.final-score {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    line-height: 1.3;
    padding-bottom: 10px;
}

.final-desc {
    color: #666;
    font-size: 16px;
    margin-bottom: 32px;
    line-height: 1.6;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .quiz-modal-content {
        width: 94%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .quiz-modal-close {
        top: -10px;
        right: -10px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .quiz-modal-body {
        padding: 20px;
    }

    .quiz-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .quiz-title {
        font-size: 18px;
    }

    .quiz-question {
        font-size: 15px;
    }

    .quiz-option {
        padding: 14px 16px;
        font-size: 14px;
    }

    .quiz-btn {
        padding: 12px 36px;
        font-size: 15px;
    }

    .final-score {
        font-size: 42px;
    }
}

/* Scrollbar Styling */
.quiz-modal-body::-webkit-scrollbar {
    width: 6px;
}

.quiz-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.quiz-modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.quiz-modal-body::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
