:root {
    color-scheme: light;
    --ink: #17152b;
    --muted: #68677b;
    --surface: #ffffff;
    --surface-soft: #f5f4fb;
    --surface-tint: #eeebff;
    --line: #dedbea;
    --brand: #5f3fe6;
    --brand-dark: #21145f;
    --brand-soft: #ebe7ff;
    --teal: #168b7d;
    --teal-soft: #dcf6f1;
    --amber: #9a5a00;
    --amber-soft: #fff0cf;
    --danger: #a62a43;
    --danger-soft: #fde7eb;
    --shadow: 0 22px 70px rgba(32, 20, 95, .13);
    --radius: 22px;
    --content: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--surface);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.site-header, .app-header {
    align-items: center;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid rgba(222,219,234,.8);
    display: flex;
    height: 76px;
    justify-content: space-between;
    padding: 0 max(24px, calc((100vw - var(--content)) / 2));
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(16px);
}
.brand {
    align-items: center;
    display: inline-flex;
    font-size: 1.2rem;
    font-weight: 820;
    gap: 10px;
    letter-spacing: -.02em;
    text-decoration: none;
}
.brand-mark {
    align-items: center;
    background: linear-gradient(145deg, var(--brand), var(--brand-dark));
    border-radius: 12px 12px 4px 12px;
    color: white;
    display: inline-flex;
    font-size: 1rem;
    font-weight: 900;
    height: 38px;
    justify-content: center;
    transform: rotate(-3deg);
    width: 38px;
}
.brand-button { background: transparent; border: 0; color: inherit; cursor: pointer; padding: 0; }
.public-nav { display: flex; gap: 32px; }
.public-nav a { color: var(--muted); font-size: .93rem; font-weight: 650; text-decoration: none; }
.public-nav a:hover { color: var(--brand); }
.header-actions, .hero-actions, .app-account, .toolbar { align-items: center; display: flex; gap: 12px; }

.button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 750;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, .option-button:focus-visible {
    outline: 3px solid rgba(95,63,230,.28);
    outline-offset: 2px;
}
.button-primary { background: var(--brand); box-shadow: 0 9px 25px rgba(95,63,230,.22); color: white; }
.button-primary:hover { background: #5032d4; }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--brand-dark); }
.button-ghost { background: transparent; color: var(--brand-dark); }
.button-light { background: white; color: var(--brand-dark); }
.button-large { min-height: 52px; padding: 13px 23px; }
.button-full { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .58; transform: none; }

.section { margin: 0 auto; max-width: var(--content); padding: 104px 24px; }
.hero {
    align-items: center;
    display: grid;
    gap: 72px;
    grid-template-columns: 1.08fr .92fr;
    min-height: 680px;
    padding-top: 82px;
}
.eyebrow {
    color: var(--brand);
    font-size: .76rem;
    font-weight: 850;
    letter-spacing: .13em;
    margin: 0 0 14px;
    text-transform: uppercase;
}
.hero h1 {
    font-size: clamp(3rem, 6vw, 5.4rem);
    letter-spacing: -.065em;
    line-height: .98;
    margin: 0;
}
.hero h1 span { color: var(--brand); }
.hero-text { color: var(--muted); font-size: 1.18rem; margin: 28px 0; max-width: 640px; }
.free-access-note {
    background: var(--teal-soft);
    border: 1px solid rgba(16, 129, 108, .2);
    border-radius: 12px;
    color: #086957;
    display: inline-block;
    font-size: .88rem;
    font-weight: 750;
    margin: 22px 0 0;
    padding: 10px 14px;
}
.supporting-copy { color: var(--muted); font-size: .9rem; margin-top: 24px; }

.level-preview {
    background: linear-gradient(160deg, #27205f, #16122e);
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 30px;
    box-shadow: var(--shadow);
    color: white;
    padding: 28px;
    transform: rotate(1deg);
}
.preview-heading, .level-card, .next-card, .map-title, .skill-row {
    align-items: center;
    display: flex;
    justify-content: space-between;
}
.preview-heading { margin-bottom: 22px; }
.preview-heading > div { display: grid; }
.preview-label, .preview-heading span, .score span { color: #b8b2db; font-size: .76rem; }
.status-dot {
    background: rgba(74,211,175,.14);
    border: 1px solid rgba(74,211,175,.24);
    border-radius: 999px;
    color: #87e7ce !important;
    padding: 5px 10px;
}
.level-card {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 18px;
    margin: 12px 0;
    padding: 19px;
}
.level-card > div:first-child, .score { display: grid; }
.level-card span { color: #c7c2e3; font-size: .82rem; }
.level-card strong { font-size: 1.08rem; }
.score { text-align: right; }
.score strong { color: #8ce6d0; font-size: 1.35rem; }
.muted-card { opacity: .72; }
.next-card {
    background: white;
    border-radius: 18px;
    color: var(--ink);
    gap: 12px;
    margin-top: 22px;
    padding: 17px;
}
.next-card > div { display: grid; flex: 1; }
.next-card small { color: var(--muted); }
.next-card > span:last-child { color: var(--brand); font-size: .85rem; font-weight: 800; }
.mini-icon {
    align-items: center;
    background: var(--brand-soft);
    border-radius: 11px;
    color: var(--brand);
    display: flex;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.value-strip {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 25px 32px;
}
.value-strip div { display: grid; padding: 4px 22px; }
.value-strip div + div { border-left: 1px solid var(--line); }
.value-strip strong { font-size: .94rem; }
.value-strip span { color: var(--muted); font-size: .8rem; }

.section-heading { margin: 0 auto 48px; max-width: 720px; text-align: center; }
.section-heading.compact { margin-bottom: 34px; }
.section-heading h2, .map-copy h2, .final-cta h2 {
    font-size: clamp(2rem, 4vw, 3.3rem);
    letter-spacing: -.045em;
    line-height: 1.08;
    margin: 0 0 18px;
}
.section-heading p:not(.eyebrow), .map-copy > p:not(.eyebrow) { color: var(--muted); }
.feature-section { padding-top: 130px; }
.feature-grid { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.feature-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 250px;
    padding: 29px;
}
.feature-card > span { color: var(--brand); font-size: .78rem; font-weight: 850; }
.feature-card h3 { font-size: 1.3rem; letter-spacing: -.025em; margin: 52px 0 10px; }
.feature-card p { color: var(--muted); margin: 0; }

.map-showcase {
    align-items: center;
    display: grid;
    gap: 78px;
    grid-template-columns: .9fr 1.1fr;
}
.check-list { list-style: none; margin: 30px 0 0; padding: 0; }
.check-list li { margin: 12px 0; padding-left: 28px; position: relative; }
.check-list li::before { color: var(--teal); content: "✓"; font-weight: 900; left: 0; position: absolute; }
.map-panel {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 28px;
}
.map-title { border-bottom: 1px solid var(--line); margin-bottom: 22px; padding-bottom: 18px; }
.map-title span { color: var(--muted); font-size: .8rem; }
.map-group h3 { color: var(--muted); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.skill-row { background: var(--surface); border-radius: 12px; margin: 9px 0; padding: 13px 15px; }
.pill, .tag {
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    padding: 5px 9px;
}
.mastered { background: var(--teal-soft); color: var(--teal); }
.learning { background: var(--brand-soft); color: var(--brand); }
.review { background: var(--amber-soft); color: var(--amber); }
.locked { background: #e7e6eb; color: #666473; }

.trust-section { background: var(--brand-dark); border-radius: 30px; color: white; padding: 72px; }
.trust-section .eyebrow { color: #9ce8d6; }
.trust-grid { display: grid; gap: 32px; grid-template-columns: repeat(3, 1fr); }
.trust-grid p { color: #cac6df; }
.legal-note { border-top: 1px solid rgba(255,255,255,.15); color: #b7b2d0; font-size: .78rem; margin: 36px 0 0; padding-top: 24px; }
.final-cta {
    align-items: center;
    background: linear-gradient(120deg, var(--brand), #4323bd);
    border-radius: 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    margin-bottom: 104px;
    padding: 64px;
}
.final-cta .eyebrow { color: #c9f1e8; }
.final-cta h2 { margin: 0; }
.site-footer {
    align-items: center;
    border-top: 1px solid var(--line);
    color: var(--muted);
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr 2fr 1fr;
    margin: 0 auto;
    max-width: var(--content);
    padding: 36px 24px;
}
.site-footer p { font-size: .78rem; margin: 0; }
.site-footer p:last-child { text-align: right; }

.auth-dialog {
    background: transparent;
    border: 0;
    max-width: 480px;
    padding: 18px;
    width: calc(100% - 24px);
}
.auth-dialog::backdrop { background: rgba(16,12,42,.68); backdrop-filter: blur(5px); }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow);
    padding: 38px;
    position: relative;
}
.dialog-close {
    background: var(--surface-soft);
    border: 0;
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    font-size: 1.35rem;
    height: 38px;
    position: absolute;
    right: 18px;
    top: 18px;
    width: 38px;
}
.auth-brand { margin-bottom: 28px; }
.auth-card h2 { font-size: 2rem; letter-spacing: -.04em; margin: 0; }
.auth-subtitle { color: var(--muted); margin: 8px 0 25px; }
.field { display: grid; gap: 7px; margin: 15px 0; }
.field label { font-size: .84rem; font-weight: 720; }
.field input, .field select, select.input {
    background: var(--surface);
    border: 1px solid #c9c5d6;
    border-radius: 11px;
    color: var(--ink);
    min-height: 48px;
    padding: 10px 13px;
    width: 100%;
}
.field small, .privacy-copy { color: var(--muted); font-size: .72rem; }
.form-error {
    background: var(--danger-soft);
    border-radius: 10px;
    color: var(--danger);
    font-size: .82rem;
    padding: 10px 12px;
}
.auth-toggle {
    background: transparent;
    border: 0;
    color: var(--brand);
    cursor: pointer;
    font-weight: 750;
    margin-top: 18px;
    width: 100%;
}
.privacy-copy { margin: 22px 0 0; text-align: center; }

.app-shell { background: var(--surface-soft); min-height: 100vh; }
.app-header { position: sticky; }
.app-account span { color: var(--muted); font-size: .85rem; }
.demo-banner {
    background: var(--amber-soft);
    color: #6c450c;
    font-size: .76rem;
    padding: 8px 24px;
    text-align: center;
}
.app-main { margin: 0 auto; max-width: 1060px; padding: 48px 24px 96px; }
.app-page-head {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 30px;
}
.app-page-head h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.05em; line-height: 1; margin: 5px 0; }
.app-page-head p { color: var(--muted); margin: 0; }
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 28px rgba(29,20,75,.05);
    padding: 25px;
}
.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.student-card, .subject-card, .plan-item {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}
.student-card + .student-card, .plan-item + .plan-item { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.student-avatar {
    align-items: center;
    background: var(--brand-soft);
    border-radius: 14px;
    color: var(--brand);
    display: flex;
    font-size: 1.15rem;
    font-weight: 850;
    height: 50px;
    justify-content: center;
    width: 50px;
}
.student-info { display: grid; flex: 1; }
.student-info span, .subject-card p, .meta { color: var(--muted); font-size: .8rem; }
.form-grid { align-items: end; display: grid; gap: 14px; grid-template-columns: 1fr 1fr auto; }
.form-grid .field { margin: 0; }
.section-stack { display: grid; gap: 22px; }
.subject-card { align-items: flex-start; min-height: 190px; flex-direction: column; }
.subject-card h2 { margin: 0; }
.subject-card p { flex: 1; margin: 8px 0; }
.subject-card .diagnostic-progress { color: var(--ink); font-size: .78rem; line-height: 1.45; }
.subject-actions { display: flex; flex-wrap: wrap; gap: 9px; width: 100%; }

.loading-card, .empty-state, .error-state { padding: 70px 24px; text-align: center; }
.spinner {
    animation: spin .8s linear infinite;
    border: 3px solid var(--brand-soft);
    border-radius: 50%;
    border-top-color: var(--brand);
    display: inline-block;
    height: 34px;
    width: 34px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-track { background: var(--line); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg, var(--brand), #8a72f0); height: 100%; }
.question-card { margin: 0 auto; max-width: 760px; }
.question-number { color: var(--muted); font-size: .78rem; font-weight: 750; }
.question-card h2 { font-size: clamp(1.4rem, 4vw, 2.05rem); letter-spacing: -.025em; margin: 24px 0; }
.options { display: grid; gap: 10px; }
.option-button {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    color: var(--ink);
    cursor: pointer;
    min-height: 52px;
    padding: 13px 16px;
    text-align: left;
}
.option-button:hover, .option-button.selected { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.question-footer { align-items: center; display: flex; justify-content: space-between; margin-top: 25px; }
.inline-error { color: var(--danger); font-size: .82rem; }

.result-hero {
    background: linear-gradient(145deg, var(--brand-dark), #37249a);
    border-radius: 28px;
    color: white;
    display: grid;
    gap: 28px;
    grid-template-columns: 1fr auto;
    padding: 38px;
}
.result-hero h1 { margin: 0; }
.result-score { align-items: center; display: grid; text-align: center; }
.result-score strong { color: #94ead5; font-size: 3rem; line-height: 1; }
.stats-grid { display: grid; gap: 14px; grid-template-columns: repeat(3,1fr); }
.stat-card strong { display: block; font-size: 1.6rem; }
.stat-card span { color: var(--muted); font-size: .78rem; }
.gap-list { display: flex; flex-wrap: wrap; gap: 9px; }
.gap-chip { background: var(--amber-soft); border-radius: 999px; color: var(--amber); font-size: .8rem; font-weight: 750; padding: 8px 12px; }

.dashboard-grid { display: grid; gap: 20px; grid-template-columns: 1.1fr .9fr; }
.level-summary h2 { font-size: 2rem; margin: 5px 0; }
.level-number { color: var(--brand); font-size: 3.2rem; font-weight: 850; letter-spacing: -.06em; }
.plan-list { margin-top: 15px; }
.plan-item > div { display: grid; flex: 1; }
.plan-item small { color: var(--muted); }
.plan-number {
    align-items: center;
    background: var(--brand-soft);
    border-radius: 10px;
    color: var(--brand);
    display: flex;
    font-weight: 850;
    height: 36px;
    justify-content: center;
    width: 36px;
}
.plan-item.completed { background: var(--teal-soft); border-radius: 12px; padding: 12px; }
.plan-item.completed + .plan-item { margin-top: 4px; }
.plan-item.completed strong { text-decoration: line-through; text-decoration-thickness: 1px; }
.plan-number.completed { background: var(--teal); color: #082f2a; }
.map-area + .map-area { margin-top: 25px; }
.map-area h2 { font-size: 1.15rem; margin: 0 0 10px; }
.map-unit { border-left: 2px solid var(--brand-soft); margin-left: 8px; padding-left: 18px; }
.map-unit h3 { color: var(--muted); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.web-skill {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 0;
}
.web-skill:first-of-type { border-top: 0; }
.web-skill > div { display: grid; }
.web-skill small { color: var(--muted); }

.lesson-content {
    color: var(--muted);
    font-size: 1.06rem;
    line-height: 1.75;
    white-space: pre-line;
}
.lesson-media-section > .eyebrow { margin-bottom: 16px; }
.lesson-media-grid { display: grid; gap: 16px; }
.lesson-media-card { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; padding: 18px; }
.lesson-media-card h3 { font-size: 1rem; margin: 0 0 12px; }
.image-media { margin: 0; padding: 0; }
.image-media img { aspect-ratio: 16 / 9; display: block; object-fit: cover; width: 100%; }
.image-media figcaption { color: var(--muted); font-size: .78rem; padding: 11px 15px; }
.video-frame { aspect-ratio: 16 / 9; background: #0f0d18; border-radius: 12px; overflow: hidden; }
.video-frame iframe { border: 0; height: 100%; width: 100%; }
.lesson-media-card audio { width: 100%; }
.transcript { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.transcript summary { color: var(--brand); cursor: pointer; font-size: .8rem; font-weight: 750; }
.transcript p { color: var(--muted); font-size: .85rem; white-space: pre-line; }
.ebook-media { align-items: center; display: flex; gap: 18px; justify-content: space-between; }
.ebook-media div { flex: 1; }.ebook-media p { color: var(--muted); font-size: .84rem; margin: 0; }
.feedback { border-radius: 14px; margin-top: 18px; padding: 16px; }
.feedback.correct { background: var(--teal-soft); color: #096458; }
.feedback.incorrect { background: var(--danger-soft); color: var(--danger); }

.toast {
    background: var(--ink);
    border-radius: 12px;
    bottom: 24px;
    box-shadow: var(--shadow);
    color: white;
    left: 50%;
    max-width: calc(100% - 30px);
    padding: 12px 18px;
    position: fixed;
    transform: translateX(-50%);
    z-index: 80;
}

@media (max-width: 850px) {
    .public-nav { display: none; }
    .site-header, .app-header { padding: 0 18px; }
    .hero, .map-showcase, .dashboard-grid { grid-template-columns: 1fr; }
    .hero { gap: 44px; min-height: auto; padding-top: 64px; }
    .level-preview { transform: none; }
    .value-strip { grid-template-columns: repeat(2,1fr); }
    .value-strip div:nth-child(3) { border-left: 0; }
    .feature-grid, .trust-grid { grid-template-columns: 1fr; }
    .trust-section { border-radius: 0; padding: 64px 28px; }
    .final-cta { align-items: flex-start; flex-direction: column; gap: 28px; margin-bottom: 60px; }
    .site-footer { grid-template-columns: 1fr; }
    .site-footer p:last-child { text-align: left; }
    .card-grid, .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .header-actions .button-ghost { display: none; }
    .header-actions .button { padding: 9px 13px; }
    .section { padding: 72px 18px; }
    .hero h1 { font-size: 3rem; }
    .hero-actions { align-items: stretch; flex-direction: column; }
    .value-strip { border-left: 0; border-radius: 0; border-right: 0; margin: 0; padding: 20px 10px; }
    .value-strip div { padding: 8px 13px; }
    .value-strip div + div { border-left: 0; }
    .map-panel, .level-preview, .final-cta { border-radius: 20px; padding: 22px; }
    .auth-card { padding: 30px 22px; }
    .app-account span { display: none; }
    .app-main { padding: 34px 16px 80px; }
    .app-page-head { align-items: flex-start; flex-direction: column; }
    .result-hero { grid-template-columns: 1fr; padding: 26px; }
    .result-score { justify-content: start; text-align: left; }
    .student-card { align-items: flex-start; flex-wrap: wrap; }
    .ebook-media { align-items: stretch; flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --ink: #f1effa;
        --muted: #aaa7bb;
        --surface: #141221;
        --surface-soft: #1b1929;
        --surface-tint: #242039;
        --line: #343044;
        --brand: #927cff;
        --brand-dark: #d9d2ff;
        --brand-soft: #302a50;
        --teal: #72dbc4;
        --teal-soft: #173d39;
        --amber: #ffc56d;
        --amber-soft: #3c2d16;
        --danger: #ff9aae;
        --danger-soft: #44202a;
    }
    .site-header, .app-header { background: rgba(20,18,33,.94); }
    .level-preview { background: linear-gradient(160deg, #27205f, #0f0c20); }
    .button-primary { color: #fff; }
    .button-light { background: #fff; color: #21145f; }
    .locked { background: #33313d; color: #bab7c5; }
    .demo-banner { color: #ffd28d; }
}
