* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Class Selection */
.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.class-btn {
    background: white;
    border: none;
    padding: 30px 20px;
    border-radius: 12px;
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.class-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    background: #667eea;
    color: white;
}

.class-btn:active {
    transform: translateY(-2px);
}

/* Chapter Selection */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.chapter-btn {
    background: white;
    border: none;
    padding: 25px 20px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.chapter-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    background: #764ba2;
    color: white;
}

/* Buttons */
.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: white;
    color: #667eea;
}

.primary-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: #667eea;
    color: white;
}

h2 {
    color: white;
    font-size: 2em;
    margin-bottom: 20px;
}

#selectedClass, #selectedChapter {
    color: #ffd700;
}

/* Mode Selection */
.mode-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.mode-card {
    background: white;
    padding: 40px 30px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mode-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.mode-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.mode-card h3 {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 10px;
}

.mode-card p {
    color: #666;
    font-size: 1em;
}

/* Study Notes */
.notes-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.notes-content {
    color: #333;
    line-height: 1.8;
    font-size: 1.1em;
}

.notes-content h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
}

.notes-content p {
    margin-bottom: 15px;
}

.notes-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

/* Quiz */
.quiz-header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.quiz-header h2 {
    color: #667eea;
    margin: 0;
    font-size: 1.5em;
}

.quiz-progress {
    color: #666;
    font-size: 1.1em;
    font-weight: 600;
}

.quiz-container {
    margin-bottom: 20px;
}

.question-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.question-text {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 25px;
    font-weight: 600;
    line-height: 1.6;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: #f5f5f5;
    border: 2px solid #ddd;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.option-btn:hover:not(:disabled) {
    background: #e8e8e8;
    border-color: #667eea;
    transform: translateX(5px);
}

.option-btn.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
    font-weight: 600;
}

.option-btn.wrong {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.option-btn:disabled {
    cursor: not-allowed;
}

.answer-feedback {
    margin-top: 20px;
    padding: 20px;
    background: #f0f8ff;
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

.answer-feedback.hidden {
    display: none;
}

.correct-answer-text {
    color: #28a745;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.explanation-text {
    color: #555;
    line-height: 1.6;
}

.quiz-controls {
    text-align: center;
}

/* Results */
.results-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.score-display {
    margin-bottom: 30px;
}

.score-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.score-circle span {
    color: white;
    font-size: 3em;
    font-weight: bold;
}

.score-text {
    color: #333;
    font-size: 1.3em;
}

.score-text span {
    color: #667eea;
    font-weight: bold;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .class-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }

    .class-btn {
        padding: 20px 15px;
        font-size: 1em;
    }

    .chapter-grid {
        grid-template-columns: 1fr;
    }

    .mode-container {
        grid-template-columns: 1fr;
    }

    h2 {
        font-size: 1.5em;
    }

    .question-text {
        font-size: 1.1em;
    }

    .option-btn {
        font-size: 1em;
        padding: 12px 15px;
    }

    .quiz-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .score-circle {
        width: 150px;
        height: 150px;
    }

    .score-circle span {
        font-size: 2.5em;
    }

    .results-actions {
        flex-direction: column;
    }

    .primary-btn, .secondary-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header {
        padding: 15px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .notes-container {
        padding: 20px;
    }

    .question-card {
        padding: 20px;
    }

    .results-container {
        padding: 25px;
    }
}