* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, sans-serif;
    background: #ffffff;
    color: #172033;
    line-height: 1.6;
}

button,
select,
input {
    font: inherit;
}



/* VERSION BAR */
.version-bar {
    width: 100%;
    padding: 13px 20px;
    text-align: center;
    background: #172033;
    color: #ffd83d;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1px;
    border-bottom: 2px solid #ffd83d;
    position: relative;
    z-index: 1001;
}

.version-bar span {
    display: inline-block;
}

button {
    cursor: pointer;
}


/* HEADER */

.header {
    height: 78px;
    padding: 12px 6%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: white;
    border-bottom: 1px solid #eee;

    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand,
.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffd83d;
    color: #172033;

    border-radius: 13px;

    font-weight: 900;
}

.brand h1 {
    font-size: 18px;
}

.brand p {
    color: #7a8190;
    font-size: 11px;
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: #4d5667;
    font-size: 13px;
    font-weight: 700;
}

nav a:hover {
    color: #d09b00;
}

.icon-btn {
    border: none;
    background: #172033;
    color: white;

    width: 42px;
    height: 42px;

    border-radius: 10px;
}


/* HERO */

.hero {
    min-height: 570px;

    padding: 80px 8%;

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 60px;

    background:
        radial-gradient(
            circle at 80% 25%,
            #fff0a0,
            transparent 28%
        ),
        linear-gradient(
            135deg,
            #fffdf1,
            #fff
        );
}

.hero-text {
    max-width: 680px;
}

.badge {
    display: inline-block;

    padding: 8px 15px;

    border-radius: 30px;

    background: #fff1a8;
    color: #806100;

    font-size: 12px;
    font-weight: 800;

    margin-bottom: 20px;
}

.hero h2 {
    font-size: clamp(42px, 6vw, 70px);
    line-height: 1.05;
    margin-bottom: 25px;
}

.hero h2 span {
    color: #d7a100;
    display: block;
}

.hero-text > p {
    max-width: 600px;
    color: #697080;
    font-size: 17px;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
    border-radius: 10px;

    padding: 13px 19px;

    font-weight: 800;

    border: none;

    text-decoration: none;
}

.primary-btn {
    background: #ffd83d;
    color: #171717;
}

.secondary-btn {
    background: white;
    color: #172033;
    border: 1px solid #ddd;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

.hero-card {
    width: 360px;
    min-height: 390px;

    padding: 35px 30px;

    border-radius: 28px;

    background: #172033;
    color: white;

    text-align: center;

    box-shadow:
        0 25px 70px rgba(20, 30, 50, .2);
}

.math-symbol {
    width: 100px;
    height: 100px;

    margin: 20px auto;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 25px;

    background: #ffd83d;
    color: #172033;

    font-size: 50px;
    font-weight: 900;
}

.hero-card h3 {
    font-size: 23px;
}

.hero-card p {
    color: #b8bfca;
    margin: 10px 0 25px;
}

.mini-formula {
    background: rgba(255, 255, 255, .08);

    padding: 12px;

    margin-top: 10px;

    border-radius: 9px;

    color: #ffe77c;
}


/* STATS */

.stats {
    width: 86%;

    margin: -35px auto 0;

    display: grid;
    grid-template-columns: repeat(4, 1fr);

    background: white;

    border-radius: 17px;

    box-shadow:
        0 12px 40px rgba(0, 0, 0, .08);

    position: relative;
    z-index: 10;
}

.stats > div {
    text-align: center;
    padding: 23px;

    border-right: 1px solid #eee;
}

.stats > div:last-child {
    border-right: none;
}

.stats strong {
    display: block;
    color: #d19d00;
    font-size: 27px;
}

.stats span {
    color: #737b8a;
    font-size: 13px;
}


/* SECTIONS */

.section {
    padding: 90px 7%;
}

.section-heading {
    margin-bottom: 40px;
}

.section-heading.center {
    text-align: center;
}

.section-heading > span {
    color: #bd8f00;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 2px;
}

.section-heading h2 {
    font-size: 35px;
    margin-top: 7px;
}

.section-heading p {
    color: #747b89;
}


/* CLASS */

.class-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.class-card {
    border: none;

    min-height: 230px;

    padding: 30px;

    border-radius: 22px;

    display: flex;
    align-items: flex-start;

    gap: 25px;

    text-align: left;

    transition: .2s;
}

.class-card:hover {
    transform: translateY(-5px);
}

.class9 {
    background: #fff5c7;
}

.class10 {
    background: #edf2ff;
}

.class-number {
    min-width: 82px;
    height: 82px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: white;

    border-radius: 20px;

    font-size: 32px;
    font-weight: 900;

    box-shadow:
        0 8px 20px rgba(0, 0, 0, .07);
}

.class-card small {
    color: #777;
    font-size: 10px;
    font-weight: 900;
}

.class-card h3 {
    font-size: 23px;
    margin: 3px 0;
}

.class-card p {
    color: #687080;
}


/* CHAPTERS */

.chapter-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.chapter-card {
    padding: 24px;

    background: white;

    border: 1px solid #eee;

    border-radius: 17px;

    transition: .2s;
}

.chapter-card:hover {
    transform: translateY(-4px);

    border-color: #ffd83d;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, .07);
}

.chapter-number {
    color: #c99b00;
    font-weight: 900;
    font-size: 12px;
}

.chapter-card h3 {
    margin: 7px 0;
    font-size: 19px;
}

.chapter-card p {
    color: #727b89;
    font-size: 13px;
    min-height: 50px;
}

.chapter-progress {
    margin-top: 10px;
    color: #4f5868;
    font-size: 12px;
    font-weight: 700;
}

.chapter-card button {
    margin-top: 15px;

    border: none;

    padding: 10px 13px;

    border-radius: 8px;

    background: #fff0a0;

    font-weight: 800;
}

.chapter-card.completed {
    border-color: #69b37a;
}

.empty-state {
    grid-column: 1 / -1;

    padding: 70px 20px;

    text-align: center;

    border: 2px dashed #ddd;

    border-radius: 20px;
}

.empty-state div {
    font-size: 50px;
}

.empty-state h3 {
    margin: 10px;
}


/* FORMULA */

.dark-section {
    padding: 90px 7%;

    background: #172033;
    color: white;
}

.light h2 {
    color: white;
}

.light p {
    color: #aeb6c5;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.formula-box {
    padding: 24px;

    border-radius: 15px;

    background: rgba(255, 255, 255, .07);

    border: 1px solid rgba(255, 255, 255, .09);

    transition: .2s;
}

.formula-box:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, .1);
}

.formula-box span {
    color: #ffd83d;

    font-size: 11px;
    font-weight: 900;
}

.formula-box h3 {
    margin-top: 10px;
}


/* QUIZ */

.quiz-card {
    max-width: 800px;

    margin: auto;

    padding: 35px;

    background: white;

    border: 1px solid #eee;

    border-radius: 20px;

    box-shadow:
        0 15px 40px rgba(0, 0, 0, .06);
}

.quiz-header {
    display: flex;
    justify-content: space-between;

    color: #777f8d;
}

.progress {
    height: 7px;

    margin: 15px 0 30px;

    background: #eee;

    border-radius: 20px;

    overflow: hidden;
}

#quizProgress {
    height: 100%;
    width: 10%;
    background: #ffd83d;
}

.quiz-card h3 {
    margin-bottom: 25px;
}

.answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.answer {
    padding: 15px;

    border: 1px solid #ddd;

    background: white;

    border-radius: 10px;

    text-align: left;

    font-weight: 700;
}

.answer:hover {
    background: #fffbea;
    border-color: #ffd83d;
}

.answer.correct {
    background: #dff7e4;
    border-color: #49a55e;
}

.answer.wrong {
    background: #ffe1e1;
    border-color: #d95353;
}

.full {
    width: 100%;
    margin-top: 20px;
}


/* PRACTICE */

.practice {
    margin: 30px 7%;

    padding: 50px;

    border-radius: 25px;

    background: #fff2a8;

    display: flex;

    justify-content: space-between;

    align-items: center;
}

.practice > div:first-child {
    max-width: 700px;
}

.practice > div:first-child > span {
    color: #9b7700;
    font-size: 11px;
    font-weight: 900;
}

.practice h2 {
    font-size: 34px;
}

.practice p {
    color: #67604b;
}

.practice-icon {
    font-size: 110px;
    opacity: .35;
}


/* FOOTER */

footer {
    background: #121927;
    color: white;

    padding: 60px 7% 25px;
}

.footer-main {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 50px;

    padding-bottom: 40px;
}

.footer-main p {
    color: #aab1be;
    font-size: 13px;
}

.footer-main a {
    display: block;

    text-decoration: none;

    color: #aab1be;

    margin-bottom: 9px;

    font-size: 13px;
}

.footer-main a:hover {
    color: #ffd83d;
}

.copyright {
    padding-top: 22px;

    border-top: 1px solid rgba(255, 255, 255, .08);

    text-align: center;

    color: #838b99;

    font-size: 12px;
}

.credits {
    margin-top: 10px;

    display: flex;

    justify-content: center;

    gap: 10px;
}

.credits strong {
    color: #ffd83d;
}


/* MODAL */

.modal {
    position: fixed;

    inset: 0;

    background: rgba(8, 13, 24, .85);

    z-index: 5000;

    display: none;

    padding: 20px;
}

.modal.show {
    display: block;
}

.lesson-window {
    width: 100%;
    height: 100%;

    max-width: 1450px;

    margin: auto;

    background: white;

    border-radius: 18px;

    overflow: hidden;

    display: flex;

    flex-direction: column;
}

.lesson-header {
    min-height: 80px;

    padding: 15px 25px;

    display: flex;

    justify-content: space-between;

    align-items: center;

    border-bottom: 1px solid #eee;
}

.lesson-header small {
    color: #c09200;

    font-size: 11px;

    font-weight: 900;
}

.lesson-header h2 {
    font-size: 21px;
}

.close-btn {
    width: 42px;
    height: 42px;

    border: none;

    background: #f0f0f0;

    border-radius: 10px;

    font-size: 25px;
}

.lesson-progress-area {
    padding: 10px 25px;

    display: flex;

    align-items: center;

    gap: 15px;
}

.lesson-progress {
    flex: 1;

    height: 7px;

    background: #eee;

    border-radius: 20px;

    overflow: hidden;
}

#lessonProgressBar {
    height: 100%;

    width: 0%;

    background: #ffd83d;

    transition: .3s;
}

#lessonProgressText {
    font-size: 12px;
    font-weight: 700;
}

.lesson-body {
    flex: 1;

    min-height: 0;

    display: flex;
}

.part-list {
    width: 260px;

    overflow-y: auto;

    background: #f8f9fb;

    border-right: 1px solid #eee;

    padding: 15px;
}

.part-button {
    width: 100%;

    padding: 11px;

    margin-bottom: 7px;

    border: none;

    border-radius: 8px;

    background: white;

    text-align: left;

    font-size: 12px;

    font-weight: 700;
}

.part-button.active {
    background: #172033;
    color: white;
}

.part-button.done {
    border-left: 4px solid #4da968;
}

.lesson-content {
    flex: 1;

    overflow-y: auto;

    padding: 40px 55px;

    max-width: 1000px;
}

.part-label {
    display: flex;

    justify-content: space-between;

    margin-bottom: 15px;
}

#partNumber {
    color: #bd8f00;

    font-size: 12px;

    font-weight: 900;
}

#partStatus {
    padding: 5px 9px;

    border-radius: 20px;

    background: #fff2a8;

    font-size: 10px;

    font-weight: 800;
}

.lesson-content h1 {
    font-size: 35px;

    margin-bottom: 25px;
}

.explanation {
    color: #454d5b;

    font-size: 16px;

    line-height: 1.8;
}

.definition {
    margin: 20px 0;

    padding: 20px;

    background: #fff8d7;

    border-left: 5px solid #ffd83d;

    border-radius: 8px;
}

.definition strong {
    display: block;

    color: #927000;

    margin-bottom: 7px;
}

.example {
    margin: 20px 0;

    padding: 20px;

    background: #eef4ff;

    border-left: 5px solid #5578d6;

    border-radius: 8px;
}

.formula-content {
    margin: 20px 0;

    padding: 20px;

    background: #172033;

    color: #ffd83d;

    border-radius: 10px;

    font-size: 18px;

    font-weight: 800;
}

.steps {
    margin: 20px 0;

    padding: 20px;

    background: #f5f5f5;

    border-radius: 10px;
}

.steps li {
    margin-bottom: 8px;
}

.practice-question {
    margin-top: 25px;

    padding: 20px;

    border: 1px solid #ddd;

    border-radius: 10px;
}

.lesson-actions {
    margin-top: 40px;

    display: flex;

    justify-content: space-between;

    gap: 10px;

    flex-wrap: wrap;
}


/* DARK MODE */

body.dark {
    background: #0f1420;
    color: #f2f3f5;
}

body.dark .header,
body.dark .chapter-card,
body.dark .quiz-card,
body.dark .lesson-window,
body.dark .answer,
body.dark .secondary-btn,
body.dark .video-card {
    background: #181f2d;
    color: white;
}

body.dark .brand p,
body.dark .section-heading p,
body.dark .chapter-card p,
body.dark .answer,
body.dark .video-card p {
    color: #b7becb;
}

body.dark .part-list {
    background: #111722;
}

body.dark .part-button {
    background: #1b2332;
    color: white;
}

body.dark .lesson-content {
    background: #181f2d;
}

body.dark .explanation {
    color: #d1d5dc;
}

body.dark .steps {
    background: #222b3b;
}

body.dark .modal {
    background: rgba(0, 0, 0, .9);
}


/* RESPONSIVE */

@media (max-width: 1050px) {

    nav {
        display: none;
    }

    .hero {
        padding: 60px 6%;
    }

    .chapter-container,
    .formula-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lesson-content {
        padding: 30px;
    }
}


@media (max-width: 750px) {

    .header {
        padding: 10px 4%;
    }

    .brand h1 {
        font-size: 15px;
    }

    .brand p {
        display: none;
    }

    .hero {
        flex-direction: column;

        text-align: center;

        padding: 55px 5%;
    }

    .hero-card {
        width: 100%;
        max-width: 380px;
    }

    .stats {
        width: 90%;
        grid-template-columns: 1fr 1fr;
    }

    .stats > div {
        border-bottom: 1px solid #eee;
    }

    .class-grid,
    .chapter-container,
    .formula-grid,
    .video-grid {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 60px 5%;
    }

    .practice {
        margin: 25px 5%;
        padding: 35px 25px;
    }

    .practice-icon {
        display: none;
    }

    .footer-main {
        grid-template-columns: 1fr;
    }

    .credits {
        flex-direction: column;
    }

    .lesson-body {
        display: block;
    }

    .part-list {
        width: 100%;
        height: 110px;

        display: flex;

        overflow-x: auto;

        border-right: none;
        border-bottom: 1px solid #eee;
    }

    .part-button {
        min-width: 100px;
        height: 45px;
        margin-right: 7px;
    }

    .lesson-content {
        height: calc(100% - 110px);
        padding: 25px 20px;
    }

    .lesson-content h1 {
        font-size: 27px;
    }

    .answers {
        grid-template-columns: 1fr;
    }

    .lesson-actions {
        flex-direction: column;
    }

    .lesson-actions button {
        width: 100%;
    }
}

/* =========================================================
   FINAL RESPONSIVE UPGRADE
   Desktop + Laptop + Tablet + Mobile
   Keeps the existing design and functionality unchanged.
   ========================================================= */

/* Prevent unwanted horizontal scrolling on every device */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

img,
video,
iframe,
canvas {
    max-width: 100%;
}

/* Make the learning modal use the complete viewport */
.modal {
    padding: 0 !important;
    width: 100vw;
    height: 100dvh;
}

.lesson-window {
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    border-radius: 0;
}

/* Large laptop / desktop */
@media (min-width: 1051px) {
    .hero,
    .section,
    .practice,
    .footer-main {
        width: 100%;
    }

    .lesson-content {
        min-width: 0;
    }
}

/* Tablet */
@media (max-width: 1050px) {
    .header {
        width: 100%;
    }

    .hero {
        width: 100%;
        padding-left: 5%;
        padding-right: 5%;
    }

    .hero-text {
        min-width: 0;
    }

    .lesson-window {
        border-radius: 0;
    }
}

/* Mobile */
@media (max-width: 750px) {
    * {
        max-width: 100%;
    }

    body {
        font-size: 15px;
    }

    .header {
        width: 100%;
        min-height: 64px;
        height: auto;
        padding: 9px 4%;
        gap: 10px;
    }

    .brand {
        min-width: 0;
        flex: 1;
    }

    .logo {
        flex-shrink: 0;
        width: 42px;
        height: 42px;
    }

    .brand h1 {
        font-size: 14px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .icon-btn {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
    }

    .hero {
        width: 100%;
        min-height: auto;
        padding: 45px 5% 55px;
        gap: 35px;
    }

    .hero h2 {
        font-size: clamp(34px, 11vw, 52px);
    }

    .hero-text > p {
        font-size: 15px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .primary-btn,
    .secondary-btn {
        width: 100%;
        min-height: 48px;
    }

    .hero-card {
        width: 100%;
        max-width: 100%;
        min-height: auto;
        padding: 28px 20px;
    }

    .stats {
        width: 92%;
        margin-top: -20px;
    }

    .stats > div {
        padding: 18px 10px;
    }

    .section {
        width: 100%;
        padding: 55px 5%;
    }

    .section-heading h2 {
        font-size: 29px;
    }

    .class-card {
        width: 100%;
        min-height: 0;
        padding: 22px;
        gap: 16px;
    }

    .class-number {
        min-width: 65px;
        width: 65px;
        height: 65px;
        font-size: 26px;
    }

    .class-card h3 {
        font-size: 19px;
    }

    .chapter-card {
        width: 100%;
        padding: 20px;
    }

    /* Full-screen lesson on phone */
    .modal {
        padding: 0 !important;
    }

    .lesson-window {
        width: 100vw;
        height: 100dvh;
        min-height: 100dvh;
        border-radius: 0;
    }

    .lesson-header {
        min-height: 64px;
        padding: 10px 12px;
        gap: 10px;
    }

    .lesson-header h2 {
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 90px);
    }

    .close-btn {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
    }

    .lesson-progress-area {
        padding: 8px 12px;
        gap: 8px;
    }

    .lesson-progress-area span {
        font-size: 10px;
        white-space: nowrap;
    }

    .lesson-body {
        min-height: 0;
        flex: 1;
    }

    .part-list {
        flex-shrink: 0;
    }

    .lesson-content {
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 20px 15px;
    }

    .lesson-content h1 {
        font-size: 24px;
        line-height: 1.2;
    }

    .lesson-content h2 {
        font-size: 20px;
    }

    .lesson-content h3 {
        font-size: 18px;
    }

    .lesson-content p,
    .lesson-content li {
        font-size: 14px;
        overflow-wrap: anywhere;
    }

    .lesson-content pre,
    .lesson-content code {
        max-width: 100%;
        overflow-x: auto;
    }

    .answers {
        width: 100%;
    }

    .answer {
        width: 100%;
        min-height: 48px;
    }

    .lesson-actions {
        width: 100%;
        gap: 10px;
    }

    .lesson-actions button {
        min-height: 48px;
    }

    .practice {
        width: 90%;
        margin-left: 5%;
        margin-right: 5%;
    }

    .footer-main {
        width: 100%;
    }
}

/* Very small phones */
@media (max-width: 390px) {
    .hero h2 {
        font-size: 32px;
    }

    .hero-card {
        padding: 22px 15px;
    }

    .section-heading h2 {
        font-size: 26px;
    }

    .class-card {
        padding: 18px;
    }

    .class-number {
        min-width: 58px;
        width: 58px;
        height: 58px;
        font-size: 23px;
    }

    .lesson-header h2 {
        font-size: 15px;
    }

    .lesson-content {
        padding: 18px 12px;
    }
}