* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --english-primary: #FF6B6B;
    --english-light: #FFE5E5;
    --math-primary: #4ECDC4;
    --math-light: #E0F7F6;
    --social-primary: #FFD93D;
    --social-light: #FFF9E6;
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --white: #FFFFFF;
    --shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* HEADER & FOOTER */
.header {
    background: linear-gradient(135deg, #FF6B9D 0%, #C06C84 100%);
    color: var(--white);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.6s ease-out;
}

.header-content p {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.95;
}

.tagline {
    animation: slideDown 0.8s ease-out;
}

.back-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid var(--white);
    color: var(--white);
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) translateX(-3px);
}

.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    text-align: center;
    padding: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.quiz-info {
    font-size: 0.9rem;
    opacity: 0.95;
    margin-top: 10px;
}

/* PAGES */
.page {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.6s ease-out;
}

.page.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* CONTAINER */
.container {
    flex: 1;
    max-width: 1200px;
    margin: 30px auto;
    width: 100%;
    padding: 0 20px;
}

/* HOME PAGE */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.subject-card {
    background: var(--white);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

.subject-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, currentColor, transparent);
}

.subject-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.english-card {
    border-top: 5px solid var(--english-primary);
    background: linear-gradient(135deg, var(--white) 0%, var(--english-light) 100%);
}

.math-card {
    border-top: 5px solid var(--math-primary);
    background: linear-gradient(135deg, var(--white) 0%, var(--math-light) 100%);
}

.social-card {
    border-top: 5px solid var(--social-primary);
    background: linear-gradient(135deg, var(--white) 0%, var(--social-light) 100%);
}

.card-header {
    text-align: center;
    margin-bottom: 20px;
}

.subject-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

.card-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
}

.progress-section {
    margin: 20px 0;
}

.progress-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 8px;
}

.progress-bar {
    background: #E0E0E0;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, #4ECDC4, #44A08D);
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease-out;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 8px;
    font-size: 0.95rem;
}

.start-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: var(--white);
    transition: var(--transition);
    margin-top: 15px;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.start-btn:active {
    transform: scale(0.95);
}

/* CHAPTERS LIST */
.chapters-list {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.chapter-item {
    background: var(--white);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    animation: slideUp 0.6s ease-out;
    border-left: 5px solid;
    display: flex;
    align-items: center;
    gap: 20px;
}

.chapter-item:hover {
    transform: translateX(10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.chapter-item.english {
    border-left-color: var(--english-primary);
    background: linear-gradient(135deg, var(--white) 0%, var(--english-light) 100%);
}

.chapter-item.mathematics {
    border-left-color: var(--math-primary);
    background: linear-gradient(135deg, var(--white) 0%, var(--math-light) 100%);
}

.chapter-item.socialscience {
    border-left-color: var(--social-primary);
    background: linear-gradient(135deg, var(--white) 0%, var(--social-light) 100%);
}

.chapter-icon {
    font-size: 2.5rem;
    min-width: 60px;
}

.chapter-info h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.chapter-info p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* READING PAGE */
.reading-container {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.reading-content {
    animation: slideUp 0.6s ease-out;
    line-height: 1.8;
}

.reading-content h1 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 2rem;
}

.reading-content h2 {
    color: var(--text-dark);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.5rem;
    border-bottom: 3px solid var(--warning);
    padding-bottom: 10px;
}

.reading-content h3 {
    color: var(--text-dark);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.reading-content p {
    margin-bottom: 15px;
    font-size: 1.05rem;
    text-align: justify;
    color: var(--text-dark);
}

.reading-content ul, .reading-content ol {
    margin-left: 30px;
    margin-bottom: 15px;
}

.reading-content li {
    margin-bottom: 10px;
    font-size: 1.05rem;
    color: var(--text-dark);
}

.reading-content .highlight {
    background: var(--warning);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--white);
    font-weight: 600;
}

.reading-content .example {
    background: #F0F0F0;
    padding: 15px;
    border-left: 4px solid var(--info);
    border-radius: 5px;
    margin: 15px 0;
    font-style: italic;
}

/* BUTTONS */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--text-light);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--text-dark);
    transform: translateY(-3px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #219E62);
    color: var(--white);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.4);
}

.bottom-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 30px;
}

.bottom-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* QUIZ PAGE */
.quiz-container {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.quiz-progress {
    margin-bottom: 30px;
}

.quiz-progress .progress-bar {
    height: 25px;
    margin-bottom: 10px;
}

.question-container {
    animation: slideUp 0.6s ease-out;
    margin-bottom: 30px;
}

.question-container h2 {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 25px;
    line-height: 1.6;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option {
    background: var(--white);
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    padding: 15px 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.option::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #E0E0E0;
    border-radius: 50%;
    transition: var(--transition);
}

.option:hover {
    border-color: var(--text-light);
    background: #F9F9F9;
    transform: translateX(5px);
}

.option.selected {
    border-color: var(--warning);
    background: rgba(243, 156, 18, 0.1);
}

.option.selected::before {
    border-color: var(--warning);
    background: var(--warning);
}

.option.correct {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.1);
}

.option.correct::before {
    border-color: var(--success);
    background: var(--success);
    content: '✓';
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.option.wrong {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

.option.wrong::before {
    border-color: var(--danger);
    background: var(--danger);
    content: '✗';
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.quiz-navigation {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

.quiz-navigation .btn {
    flex: 1;
    min-width: 130px;
}

#prevBtn:disabled, #nextBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* RESULTS PAGE */
.results-container {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.results-summary {
    text-align: center;
    margin-bottom: 40px;
    animation: slideUp 0.6s ease-out;
}

.score-circle {
    display: inline-block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--white);
    margin-bottom: 30px;
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
    animation: pulse 2s infinite;
}

.score-circle span {
    font-size: 4rem;
    font-weight: 800;
}

.score-circle p {
    font-size: 1.5rem;
    font-weight: 600;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat {
    background: var(--white);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 3px solid #E0E0E0;
    transition: var(--transition);
}

.stat:hover {
    transform: translateY(-5px);
}

.stat.correct {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1), transparent);
}

.stat.wrong {
    border-color: var(--danger);
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), transparent);
}

.stat.percentage {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), transparent);
}

.stat h3 {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.stat p {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
}

.results-review {
    margin-top: 40px;
    border-top: 3px solid #E0E0E0;
    padding-top: 30px;
}

.results-review h2 {
    margin-bottom: 25px;
    color: var(--text-dark);
    font-size: 1.5rem;
}

.review-item {
    background: #F9F9F9;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 5px solid #E0E0E0;
    animation: slideUp 0.6s ease-out;
}

.review-item.correct {
    border-left-color: var(--success);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.05), transparent);
}

.review-item.wrong {
    border-left-color: var(--danger);
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.05), transparent);
}

.review-question {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.review-answer {
    margin: 10px 0;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.95rem;
}

.review-your-answer {
    background: #FFF5E1;
    color: var(--text-dark);
    border-left: 3px solid var(--warning);
    padding-left: 10px;
}

.review-correct-answer {
    background: #E8F8F5;
    color: var(--success);
    border-left: 3px solid var(--success);
    padding-left: 10px;
    font-weight: 600;
}

.review-wrong-answer {
    background: #FADBD8;
    color: var(--danger);
    border-left: 3px solid var(--danger);
    padding-left: 10px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .subject-card {
        padding: 20px;
    }

    .subject-icon {
        font-size: 2.5rem;
    }

    .score-circle {
        width: 150px;
        height: 150px;
    }

    .score-circle span {
        font-size: 3rem;
    }

    .result-stats {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .stat p {
        font-size: 2rem;
    }

    .reading-container {
        padding: 20px;
    }

    .reading-content h1 {
        font-size: 1.5rem;
    }

    .reading-content h2 {
        font-size: 1.2rem;
    }

    .quiz-container {
        padding: 20px;
    }

    .bottom-actions {
        flex-direction: column;
    }

    .bottom-actions .btn {
        width: 100%;
        min-width: unset;
    }

    .quiz-navigation {
        flex-direction: column;
    }

    .quiz-navigation .btn {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }

    .header {
        padding: 15px;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .container {
        padding: 0 10px;
        margin: 20px auto;
    }

    .subject-card {
        padding: 15px;
    }

    .card-header h2 {
        font-size: 1.5rem;
    }

    .subject-icon {
        font-size: 2rem;
    }

    .back-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .chapter-icon {
        font-size: 2rem;
        min-width: 50px;
    }

    .chapter-info h3 {
        font-size: 1.1rem;
    }

    .reading-container, .quiz-container, .results-container {
        padding: 15px;
        border-radius: 10px;
    }

    .reading-content h1 {
        font-size: 1.3rem;
    }

    .reading-content h2 {
        font-size: 1.1rem;
    }

    .reading-content p {
        font-size: 1rem;
    }

    .question-container h2 {
        font-size: 1.2rem;
    }

    .option {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .option::before {
        width: 20px;
        height: 20px;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-circle span {
        font-size: 2.5rem;
    }

    .score-circle p {
        font-size: 1.2rem;
    }

    .stat p {
        font-size: 1.8rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ANIMATIONS */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.option {
    animation: slideInLeft 0.4s ease-out forwards;
}

.option:nth-child(2) {
    animation-delay: 0.1s;
}

.option:nth-child(3) {
    animation-delay: 0.2s;
}

.option:nth-child(4) {
    animation-delay: 0.3s;
}

/* UTILITY CLASSES */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}
