/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', 'Malgun Gothic', 'Apple Gothic', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
}

/* Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.quiz-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.level-selector, .chapter-selector {
    text-align: center;
    margin-bottom: 30px;
}

.level-selector h2, .chapter-selector h2 {
    margin-bottom: 20px;
    color: #4a5568;
    font-size: 1.5rem;
}

.level-buttons, .chapter-buttons, .mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
}

.level-btn, .chapter-btn, .mode-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #e2e8f0;
    color: #4a5568;
}

.level-btn:hover, .chapter-btn:hover, .mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.level-btn.active, .chapter-btn.active, .mode-btn.active {
    background: #667eea;
    color: white;
}

.quiz-area {
    margin-top: 30px;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.quiz-header h3 {
    color: #4a5568;
    font-size: 1.8rem;
}

.progress {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
}

.question-container {
    margin-bottom: 30px;
}

#question-text {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 25px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

#answer-area {
    margin-bottom: 20px;
}

.blank-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.blank-input:focus {
    outline: none;
    border-color: #667eea;
}

.ox-options {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.ox-btn {
    padding: 15px 40px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ox-btn:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.ox-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.quiz-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn.primary {
    background: #667eea;
    color: white;
}

.btn.primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.btn.secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn.secondary:hover {
    background: #cbd5e0;
}

.score-display {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
}

.result-area {
    text-align: center;
    margin-top: 30px;
}

.result-area h2 {
    color: #4a5568;
    margin-bottom: 20px;
}

#final-score {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 20px;
}

#correct-answers {
    background: #f7fafc;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.correct-answer {
    padding: 10px;
    margin: 5px 0;
    background: #c6f6d5;
    border-radius: 8px;
    border-left: 4px solid #38a169;
}

.incorrect-answer {
    padding: 10px;
    margin: 5px 0;
    background: #fed7d7;
    border-radius: 8px;
    border-left: 4px solid #e53e3e;
}

.feedback {
    margin-top: 15px;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
}

.feedback.correct {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #38a169;
}

.feedback.incorrect {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #e53e3e;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .quiz-container {
        padding: 20px;
    }
    
    .level-buttons, .chapter-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .ox-options {
        flex-direction: column;
        align-items: center;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .mode-buttons {
        flex-direction: column;
        align-items: center;
    }
}

.mode-selector {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.mode-selector h3 {
    margin-bottom: 15px;
    color: #4a5568;
    font-size: 1.3rem;
}

#hint-area {
    margin-top: 20px;
    text-align: center;
}

#hint-btn {
    background: #f39c12;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#hint-btn:hover {
    background: #e67e22;
    transform: translateY(-2px);
}

#hint-text {
    margin-top: 15px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    color: #856404;
    font-weight: 600;
    line-height: 1.6;
}

/* ========================================
   Interactive Elements
======================================== */

/* Button Styles */
.btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 8px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn.primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.btn.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn.success {
    background: linear-gradient(135deg, #4CAF50 0%, #81C784 100%);
}

/* Form Elements */
.answer-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin: 15px 0;
    transition: border-color 0.3s ease;
}

.answer-input:focus {
    outline: none;
    border-color: #667eea;
}

/* OX Quiz Buttons */
.ox-btn {
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 24px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    color: #333;
    min-width: 120px;
}

.ox-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: scale(1.05);
}

.ox-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.ox-btn.selected:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
}

/* Feedback Messages */
.feedback {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    font-weight: bold;
}

.feedback.correct {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.feedback.incorrect {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* ========================================
   Responsive Design
======================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .btn {
        display: block;
        width: 100%;
        margin: 10px 0;
    }

    .ox-btn {
        flex: 1 1 100%;
        margin: 5px 0;
    }

    .level-btn, .mode-btn, .chapter-btn {
        display: block;
        width: 100%;
        margin: 10px 0;
    }
}
