@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;1,400&display=swap');

:root {
    --bg-dark: #f4f0e7;
    --bg-card: #fffdf8;
    --border-color: #c5cdbd;
    --text-primary: #1c2e23;
    --text-secondary: #56634e;
    --accent: #526b44;
    --accent-soft: #e7eddc;
    --correct-bg: #e5efdf;
    --correct-border: #557746;
    --correct-text: #294921;
    --wrong-bg: #f5e8e0;
    --wrong-border: #a14c32;
    --wrong-text: #82341e;
}

* { box-sizing: border-box; }

body, html, button, input {
    font-family: 'Montserrat', sans-serif;
}

body, html, #root {
    height: 100dvh;
}

button {
    font: inherit;
}

button:focus-visible, a:focus-visible, input:focus-visible {
    outline: 3px solid #9c7433;
    outline-offset: 4px;
}

.header {
    padding: 16px max(24px, calc((100vw - 1160px) / 2));
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: #fffdf8;
}

.headerLeft { flex-wrap: wrap; gap: 8px; }
.headerRight {
    flex-wrap: wrap;
    margin-right: calc(var(--shared-auth-width, 0px) + 104px);
}
.logoText, .pageTitle, .resultTitle {
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
    letter-spacing: -.025em;
}
.logoText { font-size: 22px; }
.logoEmoji, .mascot, .profileAvatar { animation: none; }
.statPill, .homeLinkBtn { background: var(--bg-dark); border-radius: 3px; }
.homeLinkBtn { margin-left: 0; min-height: 36px; }
.statPill { min-height: 36px; }

.lessonsWrap {
    min-height: 0;
    padding: 32px max(24px, calc((100vw - 1160px) / 2)) 100px;
}

.academyHero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    align-items: center;
    gap: 3rem;
    padding: clamp(28px, 4vw, 56px);
    margin-bottom: 3rem;
    color: #f4f0e7;
    background: #1c2e23;
}

.academyHero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, #1c2e23f5, #1c2e23b8), url('wall_hops.jpg') center / cover;
}

.academyEyebrow {
    font-size: .62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .18em;
    margin: 0 0 1.5rem;
}

.academyHero .academyEyebrow { color: #dfb975; }
.academyHero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 3.7vw, 3.8rem);
    font-weight: 400;
    letter-spacing: -.035em;
    line-height: 1.15;
    margin: 0 0 1.5rem;
}
.academyHero h1 em { display: block; color: #dfb975; }
.academyDescription {
    max-width: 450px;
    font-size: .82rem;
    line-height: 1.9;
    color: #e0e6d9;
    margin-bottom: 1.75rem;
}
.academyStart {
    padding: 1rem 1.3rem;
    min-height: 48px;
    background: #dfb975;
    color: #1c2e23;
    border: 1px solid #dfb975;
    border-radius: 2px;
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
}
.academyStart:hover { background: #edcd97; }
.academyJourney { border-left: 1px solid #a3b09866; padding-left: 2rem; }
.academyFraction { font-family: 'Playfair Display', serif; font-size: 3.5rem; margin: 0; }
.academyFraction span { font-size: 1.35rem; color: #b9c7ad; }
.academyJourneyLabel { font-size: .7rem; color: #d0dbc6; line-height: 1.6; }
.academyJourney progress { width: 100%; height: 6px; margin: .7rem 0 1.75rem; accent-color: #dfb975; }
.academyJourney .academyEyebrow { margin-bottom: .75rem; }
.academyJourney h2 { font-size: 1rem; font-weight: 500; line-height: 1.6; margin: 0; }

.sectionLabel { margin-bottom: 1.5rem; font-size: .7rem; }
.lessonPath { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.connector { display: none; }
.lessonCard {
    height: 100%;
    min-height: 120px;
    width: 100%;
    border-radius: 3px;
    padding: 22px;
    text-align: left;
    font: inherit;
}
.lessonCard:disabled { cursor: not-allowed; }
.lessonTitle { font-size: .94rem; line-height: 1.5; }
.lessonDesc { margin-top: .4rem; font-size: .74rem; }
.lessonIcon { border-radius: 3px; }
.lessonCard.card-hover:hover { transform: none; box-shadow: 0 6px 20px #1c2e2310; }

.bottomNav { background: #fffdf8; border-color: var(--border-color); }
.bottomTab { color: var(--text-secondary); }
.bottomTab.active { color: #2c492d; }
.lessonTopBar {
    flex-shrink: 0;
    padding: 18px max(24px, calc((100vw - 820px) / 2));
    background: #fffdf8;
}
.closeBtn { min-width: 44px; min-height: 44px; border: 1px solid var(--border-color); border-radius: 2px; }
.progressBarBg { background: #dfe5d5; }
.questionWrap { width: 100%; max-width: 868px; margin-inline: auto; padding: 2rem 24px; }
.qEmoji { font-size: 2.2rem; margin-bottom: 1.25rem; }
.qCount { font-size: .75rem; color: var(--text-secondary); margin-bottom: 1rem; }
.qText {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    line-height: 1.3;
    letter-spacing: -.025em;
    margin: 0 0 2rem;
}
.choicesGrid { gap: 12px; }
.choiceBtn, .tfBtn {
    min-height: 70px;
    padding: 18px 22px;
    border-radius: 3px;
    font-size: .9rem;
    line-height: 1.6;
    font-family: inherit;
}
.choiceBtn:disabled, .tfBtn:disabled { cursor: default; }
.answerState { display: block; font-size: .7rem; margin-top: .35rem; font-weight: 700; }
.explainBox { border-radius: 3px; padding: 20px; margin-top: 1.5rem; }
.explainText { color: var(--text-primary); font-size: .85rem; line-height: 1.85; }
.lessonBottom { flex-shrink: 0; background: #fffdf8; padding: 16px max(24px, calc((100vw - 820px) / 2)); }
.confirmBtn, .continueBtn {
    background: #26392f;
    border-radius: 3px;
    font-family: inherit;
    box-shadow: none;
    font-size: .83rem;
    min-height: 52px;
}
.confirmBtn:disabled { opacity: .6; }
.academyReviewMode { text-align: center; font-size: .75rem; margin: 1rem 0 0; color: #526b44; }
.resultWrap { width: 100%; max-width: 760px; margin: auto; padding: 2rem 24px; justify-content: flex-start; min-height: 0; }
.resultWrap > * { flex-shrink: 0; }
.resultTitle { font-weight: 400; font-size: clamp(2rem, 4vw, 3rem); margin: 0; }
.resultStat, .achievementUnlock, .profileHeader, .profileStatCard, .achievementCard, .leaderRow { border-radius: 3px; }
.resultStat { background: var(--bg-card); border-color: var(--border-color); }
.resultStatVal { color: #526b44; }
.resultSub { color: var(--text-secondary); }
.academyReview { width: 100%; padding: 1.5rem; margin: 1.5rem 0; background: #e8eddf; border: 1px solid var(--border-color); }
.academyReview h2 { font-family: 'Playfair Display', serif; font-size: 1.65rem; font-weight: 400; margin: 0 0 .75rem; }
.academyReview p { font-size: .8rem; line-height: 1.8; margin-bottom: 1.5rem; }
.profileWrap, .leaderboardWrap { width: 100%; max-width: 900px; margin-inline: auto; }
.savePseudoBtn {
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 7px 12px;
    background: var(--bg-dark);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 900px) {
    .header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand brand"
            "stats stats";
        gap: 7px 10px;
        padding: 10px 12px 8px;
    }
    .headerLeft {
        grid-area: brand;
        min-width: 0;
        justify-content: flex-start;
        gap: 8px;
    }
    .headerRight {
        grid-area: stats;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin: 0;
    }
    .statPill {
        justify-content: center;
        min-height: 32px;
        padding: 4px 7px;
        border-radius: 10px;
    }
    .logoWrap { min-width: 0; }
    .logoText {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 17px;
    }
    .logoEmoji { font-size: 22px; }
    .homeLinkBtn { margin-left: 0; padding: 5px 8px; font-size: 11px; }
    .academyHero { grid-template-columns: 1fr; gap: 2rem; padding: 28px 24px; }
    .academyJourney { border-left: 0; border-top: 1px solid #a3b09866; padding: 1.5rem 0 0; }
    .academyFraction { font-size: 2.5rem; }
    .lessonsWrap { padding: 20px 18px 100px; }
    .lessonPath { grid-template-columns: 1fr; }
    .lessonCard { padding: 18px 14px; gap: 12px; }
    .lessonTopBar { padding: 10px 18px; }
    .questionWrap { padding: 1.5rem 18px; }
    .lessonBottom { padding: 12px 18px max(12px, env(safe-area-inset-bottom)); }
    .choicesGrid { grid-template-columns: 1fr; }
    .choiceBtn, .tfBtn { padding: 14px; min-height: 62px; font-size: .83rem; }
    .resultStatsRow { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 420px) {
    #langSwitcher {
        top: 44px !important;
        right: 12px !important;
    }
    #shared-auth {
        top: 8px !important;
        right: 12px !important;
    }
    .header {
        grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr) 75px;
        grid-template-areas:
            "brand brand brand brand"
            "home stats-xp stats-lives language-space";
        gap: 6px;
        padding: 8px 12px 7px;
    }
    .headerLeft {
        display: contents;
    }
    .headerRight {
        display: contents;
    }
    .logoWrap {
        grid-area: brand;
    }
    .homeLinkBtn {
        grid-area: home;
    }
    .logoText {
        font-size: 16px;
    }
    .homeLinkBtn {
        flex: 0 0 auto;
        min-height: 32px;
        padding: 4px 7px;
        border-radius: 9px;
    }
    .homeLinkBtn span:last-child {
        display: none;
    }
    .headerRight {
        width: auto;
    }
    .headerRight .statPill:first-child {
        grid-area: stats-xp;
    }
    .headerRight .statPill:last-child {
        grid-area: stats-lives;
    }
    .headerRight .statPill {
        width: auto;
        min-height: 30px;
        border-radius: 9px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

}

body.quiz-lesson-active > #langSwitcher,
body.quiz-lesson-active > #shared-auth {
    display: none !important;
}
