:root {
    --ink: #15201d;
    --muted: #64716d;
    --paper: #f7f5ef;
    --card: #ffffff;
    --green-950: #102923;
    --green-900: #173a32;
    --green-700: #286756;
    --green-500: #3b8b72;
    --lime: #d9e7a7;
    --gold: #e7b95f;
    --red: #b84b45;
    --red-soft: #fff0ed;
    --green-soft: #edf7f1;
    --line: #dce2de;
    --shadow: 0 18px 50px rgba(16, 41, 35, .11);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid rgba(59, 139, 114, .3);
    outline-offset: 2px;
}
a { color: inherit; }
.access-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.catalog-hero { min-height: 260px; margin-bottom: 32px; }
.catalog-grid .mode-card { min-height: 250px; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }
.loading-screen {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 16px;
    color: var(--green-900);
}
.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: var(--green-950);
    background: var(--lime);
    font-weight: 900;
    letter-spacing: -.04em;
}
.topbar {
    height: 72px;
    padding: 0 clamp(18px, 4vw, 56px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
    color: white;
    background: rgba(16, 41, 35, .96);
    backdrop-filter: blur(16px);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 800;
}
.brand .brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 14px; }
.brand small { display: block; color: #aec5bd; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.user-menu { display: flex; align-items: center; gap: 12px; }
.user-email { color: #d9e5e1; font-size: 13px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.icon-btn, .ghost-btn {
    border: 1px solid rgba(255,255,255,.22);
    background: transparent;
    color: inherit;
    border-radius: 12px;
    min-height: 42px;
    padding: 0 14px;
    font-weight: 700;
}
.main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 46px 0 70px; }
.hero {
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    gap: 28px;
    align-items: stretch;
    margin-bottom: 30px;
}
.hero-copy {
    min-height: 310px;
    border-radius: 28px;
    padding: clamp(30px, 5vw, 58px);
    color: white;
    background:
        radial-gradient(circle at 85% 15%, rgba(217,231,167,.18), transparent 30%),
        linear-gradient(135deg, var(--green-950), #1d4f42);
    position: relative;
    overflow: hidden;
}
.eyebrow {
    margin: 0 0 15px;
    color: var(--green-500);
    font-size: 12px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.hero-copy .eyebrow { color: var(--lime); }
h1, h2, h3, p { margin-top: 0; }
h1 {
    max-width: 720px;
    margin-bottom: 18px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(38px, 5.4vw, 66px);
    font-weight: 500;
    line-height: .98;
    letter-spacing: -.04em;
}
.hero-copy > p:not(.eyebrow) { max-width: 620px; color: #d6e3df; font-size: 17px; line-height: 1.6; }
.official-pill {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.1);
    color: #e7f0ed;
    font-size: 12px;
    font-weight: 700;
}
.official-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
.readiness-card {
    border-radius: 28px;
    padding: 30px;
    background: var(--card);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.score-ring {
    width: 150px;
    height: 150px;
    margin: 6px auto 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--green-500) calc(var(--score, 0) * 1%), #e6ebe8 0);
    position: relative;
}
.score-ring::after { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: white; }
.score-ring span { position: relative; z-index: 1; text-align: center; font-size: 34px; font-weight: 900; letter-spacing: -.05em; }
.score-ring span small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.readiness-card p { color: var(--muted); line-height: 1.5; text-align: center; }
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
    padding-top: 22px;
}
.stat { text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat strong { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 11px; }
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin: 42px 0 18px;
}
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(27px, 3vw, 38px); font-weight: 500; letter-spacing: -.03em; }
.section-heading p { margin: 0; color: var(--muted); }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.mode-card {
    min-height: 280px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 9px 30px rgba(16,41,35,.06);
}
.mode-card.featured { border: 0; color: white; background: var(--green-900); }
.mode-number { color: var(--green-500); font-size: 13px; font-weight: 900; letter-spacing: .12em; }
.featured .mode-number { color: var(--lime); }
.mode-card h3 { margin: 30px 0 12px; font-family: Georgia, serif; font-size: 31px; font-weight: 500; }
.mode-card p { color: var(--muted); line-height: 1.55; }
.featured p { color: #c6d8d2; }
.mode-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.tag { padding: 7px 10px; border-radius: 9px; background: #eef2ef; color: #53605c; font-size: 12px; font-weight: 750; }
.featured .tag { background: rgba(255,255,255,.1); color: white; }
.primary-btn {
    min-height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 13px;
    background: var(--green-700);
    color: white;
    font-weight: 850;
    box-shadow: 0 7px 18px rgba(40,103,86,.18);
}
.featured .primary-btn { margin-top: auto; background: var(--lime); color: var(--green-950); }
.secondary-btn {
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: white;
    color: var(--ink);
    font-weight: 800;
}
.practice-form { margin-top: auto; display: grid; grid-template-columns: 1fr 100px; gap: 10px; }
.practice-form button { grid-column: 1 / -1; }
.field {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: white;
    color: var(--ink);
    padding: 0 14px;
}
.themes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.theme-card {
    padding: 18px;
    min-height: 138px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(255,255,255,.65);
}
.theme-card strong { display: block; color: var(--green-700); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.theme-card p { margin: 9px 0 13px; font-size: 13px; line-height: 1.4; }
.mini-progress { height: 6px; border-radius: 999px; background: #dfe5e1; overflow: hidden; }
.mini-progress span { display: block; height: 100%; background: var(--green-500); border-radius: inherit; }
.history-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}
.history-row {
    display: grid;
    grid-template-columns: 1.2fr .8fr .7fr .7fr 42px;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 17px 20px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    text-align: left;
}
.history-row:last-child { border-bottom: 0; }
.history-row:hover { background: #f8faf8; }
.history-row small { color: var(--muted); }
.status { justify-self: start; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; }
.status.pass { color: #24614d; background: var(--green-soft); }
.status.fail { color: #9c3e39; background: var(--red-soft); }
.empty-state { padding: 34px; text-align: center; color: var(--muted); }
.site-footer { margin-top: 60px; padding-top: 25px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.site-footer a { color: var(--green-700); font-weight: 700; }

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    background: var(--green-950);
}
.login-story {
    padding: clamp(38px, 7vw, 90px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
    background:
        radial-gradient(circle at 10% 90%, rgba(217,231,167,.14), transparent 32%),
        linear-gradient(145deg, #0f2721, #1e4d41);
}
.login-story h1 { max-width: 720px; margin-top: 70px; }
.login-story > div > p { max-width: 600px; color: #cadbd6; font-size: 17px; line-height: 1.6; }
.exam-facts { display: flex; gap: 32px; flex-wrap: wrap; }
.exam-facts strong { display: block; color: var(--lime); font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.exam-facts span { color: #b8ccc6; font-size: 12px; }
.login-panel {
    padding: 30px;
    display: grid;
    place-items: center;
    background: var(--paper);
}
.login-card { width: min(470px, 100%); padding: clamp(28px, 6vw, 48px); border-radius: 28px; background: white; box-shadow: var(--shadow); }
.login-card h2 { margin-bottom: 12px; font-family: Georgia, serif; font-size: 36px; font-weight: 500; letter-spacing: -.03em; }
.login-card > p { color: var(--muted); line-height: 1.55; }
.login-form { margin-top: 30px; }
.login-form label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 800; }
.login-form .field { min-height: 56px; }
.login-form .primary-btn { width: 100%; min-height: 56px; margin-top: 12px; }
.privacy-note { margin: 18px 0 0 !important; font-size: 11px; line-height: 1.55 !important; }
.error-text { min-height: 20px; margin: 8px 0 0; color: var(--red); font-size: 12px; }

.exam-shell { min-height: 100vh; background: #f3f2ec; }
.exam-topbar { position: sticky; top: 0; z-index: 30; background: white; border-bottom: 1px solid var(--line); }
.exam-topbar-inner {
    min-height: 72px;
    width: min(1240px, calc(100% - 34px));
    margin: auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
}
.exam-title strong { display: block; }
.exam-title span { color: var(--muted); font-size: 12px; }
.timer {
    min-width: 104px;
    padding: 10px 14px;
    border-radius: 13px;
    background: var(--green-950);
    color: white;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 20px;
    font-weight: 850;
}
.timer.warning { color: #2c2411; background: var(--gold); }
.exit-btn { justify-self: end; color: var(--muted); border-color: var(--line); }
.progress-track { height: 4px; background: #e2e7e4; }
.progress-track span { display: block; height: 100%; background: var(--green-500); transition: width .25s; }
.exam-layout {
    width: min(1240px, calc(100% - 34px));
    margin: 0 auto;
    padding: 36px 0 46px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 285px;
    gap: 24px;
}
.question-card { min-height: 590px; padding: clamp(24px, 4vw, 46px); border-radius: 24px; background: white; box-shadow: 0 10px 35px rgba(16,41,35,.06); }
.question-kicker { display: flex; justify-content: space-between; gap: 15px; color: var(--green-700); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.flag-btn { border: 0; background: transparent; color: var(--muted); font-weight: 750; }
.flag-btn.active { color: #9a6b17; }
.question-card h1 { margin: 34px 0 32px; font-family: Georgia, serif; font-size: clamp(25px, 3.2vw, 39px); line-height: 1.2; letter-spacing: -.025em; }
.answers { display: grid; gap: 12px; }
.answer {
    width: 100%;
    min-height: 70px;
    padding: 15px 18px;
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: white;
    color: var(--ink);
    text-align: left;
    line-height: 1.45;
    transition: border-color .18s, background .18s, transform .18s;
}
.answer:hover { border-color: var(--green-500); transform: translateY(-1px); }
.answer.selected { border-color: var(--green-500); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green-500); }
.answer.reading { cursor: default; }
.answer.reading:hover { border-color: var(--line); transform: none; }
.answer.reading-correct {
    border-color: var(--green-500);
    background: var(--green-soft);
    box-shadow: inset 0 0 0 1px var(--green-500);
    color: #205c48;
    font-weight: 750;
}
.answer-key { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-weight: 850; }
.answer.selected .answer-key { border-color: var(--green-700); background: var(--green-700); color: white; }
.answer.reading-correct .answer-key { border-color: var(--green-700); background: var(--green-700); color: white; }
.question-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; }
.question-actions .primary-btn, .question-actions .secondary-btn { min-width: 126px; }
.question-nav { position: sticky; top: 108px; align-self: start; padding: 22px; border-radius: 20px; background: white; }
.question-nav h3 { margin-bottom: 4px; font-size: 15px; }
.question-nav > p { color: var(--muted); font-size: 12px; }
.question-dots {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 390px;
    margin: 20px 0;
    padding-right: 3px;
    overflow-y: auto;
}
.question-dot { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); font-size: 12px; font-weight: 800; }
.question-dot.current { border-color: var(--green-900); box-shadow: inset 0 0 0 2px var(--green-900); }
.question-dot.answered { background: var(--green-soft); color: var(--green-700); border-color: #b8ddce; }
.question-dot.flagged::after { content: "•"; color: #b9801d; }
.submit-btn { width: 100%; }
.nav-legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 10px; }
.nav-legend i { width: 8px; height: 8px; display: inline-block; border-radius: 3px; background: var(--line); }
.nav-legend i.done { background: #8dc9b2; }
.nav-legend i.flag { background: var(--gold); }

.result-hero {
    padding: 42px clamp(22px, 5vw, 60px);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 30px;
    align-items: center;
    border-radius: 26px;
    color: white;
    background: var(--green-950);
}
.result-score { font-family: Georgia, serif; font-size: clamp(54px, 8vw, 84px); line-height: 1; }
.result-score small { display: block; color: #aec6be; font-family: Inter, sans-serif; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.result-hero h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 48px); }
.result-hero p { margin: 0; color: #c6d7d1; }
.result-badge { padding: 10px 15px; border-radius: 999px; background: var(--lime); color: var(--green-950); font-weight: 900; }
.result-badge.fail { background: #ffd1c9; color: #7e2b27; }
.result-toolbar { margin: 26px 0 18px; display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); font-weight: 750; }
.filter-btn.active { background: var(--green-900); color: white; border-color: var(--green-900); }
.review-list { display: grid; gap: 14px; }
.review-item { padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.review-item.wrong { border-left: 5px solid var(--red); }
.review-item.right { border-left: 5px solid var(--green-500); }
.review-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.review-item h3 { margin: 14px 0 18px; font-size: 17px; line-height: 1.45; }
.review-answer { padding: 11px 13px; margin-top: 7px; border-radius: 10px; background: #f5f6f4; font-size: 13px; line-height: 1.4; }
.review-answer.correct { color: #205c48; background: var(--green-soft); font-weight: 750; }
.review-answer.selected-wrong { color: #913933; background: var(--red-soft); }
.source-note { margin: 13px 0 0; color: var(--muted); font-size: 11px; }
.source-note a { color: var(--green-700); }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translateX(-50%); padding: 13px 18px; border-radius: 12px; background: #17211e; color: white; box-shadow: var(--shadow); font-size: 13px; }

@media (max-width: 900px) {
    .hero, .login-page { grid-template-columns: 1fr; }
    .login-story { min-height: 52vh; }
    .login-story h1 { margin-top: 45px; }
    .mode-grid { grid-template-columns: 1fr; }
    .themes-grid { grid-template-columns: repeat(2, 1fr); }
    .exam-layout { grid-template-columns: 1fr; }
    .question-nav { position: static; }
    .result-hero { grid-template-columns: auto 1fr; }
    .result-badge { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 640px) {
    .topbar { height: 64px; }
    .brand small, .user-email { display: none; }
    .main { width: min(100% - 24px, 1180px); padding-top: 20px; }
    .hero-copy, .readiness-card { border-radius: 21px; }
    .hero-copy { min-height: auto; padding: 30px 24px; }
    .hero-copy h1 { font-size: 39px; }
    .readiness-card { padding: 23px; }
    .themes-grid { grid-template-columns: 1fr; }
    .history-row { grid-template-columns: 1fr auto; padding: 16px; }
    .history-row > *:nth-child(2), .history-row > *:nth-child(4) { display: none; }
    .history-row > *:last-child { display: none; }
    .section-heading { align-items: start; flex-direction: column; }
    .login-story { min-height: 54vh; padding: 30px 24px; }
    .login-story h1 { margin-top: 50px; font-size: 42px; }
    .login-panel { padding: 18px; }
    .login-card { padding: 28px 22px; border-radius: 22px; }
    .exam-topbar-inner { width: calc(100% - 24px); grid-template-columns: 1fr auto; min-height: 64px; }
    .exam-title span { display: none; }
    .timer { min-width: 88px; font-size: 17px; }
    .exit-btn { display: none; }
    .exam-layout { width: calc(100% - 20px); padding: 12px 0 108px; }
    .question-card { min-height: auto; padding: 23px 18px; border-radius: 18px; }
    .question-card h1 { margin: 26px 0 24px; font-size: 25px; }
    .answer { min-height: 64px; padding: 12px; grid-template-columns: 32px 1fr; }
    .question-actions { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); }
    .question-actions button { flex: 1; min-width: 0 !important; }
    .question-nav { display: none; }
    .result-hero { padding: 28px 22px; gap: 18px; }
    .result-score { font-size: 55px; }
    .result-hero h1 { font-size: 30px; }
    .result-toolbar .secondary-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
