:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --surface: #fff;
  --soft: #fcfbf8;
  --line: #dedbd6;
  --strong-line: #918b83;
  --ink: #292624;
  --muted: #635d56;
  --accent: #b11f4b;
  --accent-hover: #941a3e;
  --accent-soft: #f9edf0;
  --accent-ink: #fff;
  --success: #236d40;
  --danger: #ae292d;
  --math: #096c60;
  --math-hover: #07574d;
  --math-soft: #edf6f2;
  --math-ink: #fff;
  --math-gold: #94600b;
  --topo: #1d567b;
  --topo-ink: #fff;
  --topo-soft: #edf4f8;
  --topo-land: #eee2c6;
  --topo-border: #9c8559;
  --topo-water: #207baa;
  --topo-ocean: #e0f0f7;
  --topo-city: #6b4432;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #33302e;
    --surface: #292726;
    --soft: #302d2b;
    --line: #514c48;
    --strong-line: #a59a93;
    --ink: #f2eae4;
    --muted: #c0b6ae;
    --accent: #fd8ea1;
    --accent-hover: #ffb0be;
    --accent-soft: #442c32;
    --accent-ink: #24191c;
    --success: #86d6a0;
    --danger: #ff9fa4;
    --math: #86d6b9;
    --math-hover: #a8e6ce;
    --math-soft: #273d35;
    --math-ink: #152920;
    --math-gold: #efc76e;
    --topo: #91c9f0;
    --topo-ink: #162835;
    --topo-soft: #263844;
    --topo-land: #514c3d;
    --topo-border: #b6a881;
    --topo-water: #74c4eb;
    --topo-ocean: #203442;
    --topo-city: #edbb96;
  }
}
* { box-sizing: border-box; }
.setting-option { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.setting-option input { width: 20px; height: 20px; accent-color: var(--accent); }
.word-skills { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.session-list { padding-left: 20px; font-size: 14px; }
.session-list li { margin: 8px 0; }
.hero > button + button { margin: 8px; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Aptos, Calibri, sans-serif; line-height: 1.6; }
button, input, textarea { font: inherit; }
textarea { display: block; width: 100%; resize: vertical; min-height: 110px; max-height: 280px; padding: 12px; border: 1px solid var(--strong-line); border-radius: 10px; color: var(--ink); background: var(--surface); }
textarea[aria-invalid="true"] { border-color: var(--danger); }
.meaning-status { margin-top: 16px; }
.subject-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.subject-nav a { padding: 9px 18px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-weight: 700; }
.subject-nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.subject-nav a[data-subject="math"][aria-current="page"] { color: var(--math-ink); background: var(--math); border-color: var(--math); }
.subject-nav a[data-subject="topo"][aria-current="page"] { color: var(--topo-ink); background: var(--topo); border-color: var(--topo); }
.arithmetic-nav { display: flex; gap: 8px; margin: -6px 0 22px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.arithmetic-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; text-decoration: none; border: 1px solid transparent; border-radius: 9px; color: var(--muted); font-weight: 650; }
.arithmetic-nav [aria-current="page"] { border-color: var(--math); color: var(--math); background: var(--math-soft); }
button, summary { cursor: pointer; }
button, input, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: 3px; }
button:disabled { cursor: default; opacity: .65; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
main:focus, h1[tabindex="-1"]:focus-visible, h2[tabindex="-1"]:focus-visible { outline: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { line-height: 1.23; letter-spacing: -.025em; }
h1 { font-size: clamp(26px, 5vw, 36px); }
h2 { font-size: clamp(24px, 4vw, 32px); }
h3 { font-size: 20px; }
p { margin-bottom: 18px; }
.app { width: min(800px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 32px; }
.app-header, .brand, .top-actions, .account-bar, .app-footer, .progress-meta, .breadcrumb, .actions, .next-row { display: flex; align-items: center; gap: 12px; }
.app-header { justify-content: space-between; margin-bottom: 20px; }
.math-active .app-header, .topo-active .app-header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; min-width: 0; line-height: 1.35; }
.brand-title { display: block; font-weight: 750; font-size: clamp(20px, 4vw, 27px); letter-spacing: -.03em; }
.brand-subtitle { display: block; margin-top: 3px; font-size: 13px; }
.logo { display: grid; flex-shrink: 0; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 24px; }
.account-bar { justify-content: space-between; border-top: 1px solid var(--line); padding: 10px 0 18px; font-size: 13px; color: var(--muted); }
#accountLabel { overflow-wrap: anywhere; }
.card { padding: clamp(22px, 5vw, 38px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px #00000006; }
.hero { text-align: center; }
.hero p { max-width: 590px; margin-left: auto; margin-right: auto; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 750; margin-bottom: 13px; }
.intro { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spaced { margin-top: 24px; }
.primary, .secondary, .ghost, .answer, .file-label {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 17px; border: 1px solid var(--strong-line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; line-height: 1.45;
}
.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary:hover:not(:disabled), .ghost:hover:not(:disabled), .file-label:hover { border-color: var(--accent); }
.ghost { background: var(--soft); border-color: var(--line); }
.text-button { min-height: 44px; padding: 4px 7px; color: var(--accent); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.actions { flex-wrap: wrap; }
.center-actions { justify-content: center; }
.breadcrumb { flex-wrap: wrap; font-size: 13px; margin: 0 0 18px; color: var(--muted); }
.breadcrumb a { min-height: 36px; display: inline-flex; align-items: center; }
.theme-list, .chapter-list, .word-list { list-style: none; padding: 0; margin: 26px 0 0; }
.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-link, .chapter-link { display: flex; gap: 16px; align-items: center; text-decoration: none; color: var(--ink); padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.theme-link:hover, .chapter-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.theme-number { color: var(--accent); font-family: Georgia, "Times New Roman", serif; font-size: 29px; line-height: 1; min-width: 30px; }
.link-title { display: block; font-weight: 700; font-size: 18px; }
.link-meta { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.chapter-list { display: grid; gap: 10px; }
.chapter-link { justify-content: space-between; }
.chapter-arrow { color: var(--accent); font-size: 24px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.stat { padding: 15px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); text-align: center; }
.stat strong { display: block; font-size: 25px; line-height: 1.4; }
.stat span { color: var(--muted); font-size: 13px; }
.word-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.word-list li { border-top: 1px solid var(--line); padding: 11px 0; font-size: 15px; }
.word-list .learned { color: var(--success); }
.progress-meta { justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
progress { display: block; appearance: none; border: 0; width: 100%; height: 7px; border-radius: 10px; background: var(--line); margin-bottom: 22px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--accent); }
.quiz-card { min-height: 450px; }
.quiz-type { display: inline-block; background: var(--accent-soft); color: var(--accent); padding: 5px 10px; border-radius: 7px; font-size: 12px; font-weight: 700; margin-bottom: 19px; }
.prompt { font-size: 16px; color: var(--muted); margin-bottom: 10px; }
.question { margin-bottom: 24px; overflow-wrap: anywhere; }
.english { border-left: 3px solid var(--accent); padding: 12px 15px; background: var(--accent-soft); color: var(--muted); }
.answers { display: grid; gap: 10px; }
.answer { width: 100%; text-align: left; justify-content: flex-start; padding: 15px 17px; font-weight: 500; background: var(--soft); border-color: var(--line); }
.answer:hover:not(:disabled) { border-color: var(--accent); }
.answer.correct { border-color: var(--success); color: var(--success); opacity: 1; }
.answer.wrong { border-color: var(--danger); color: var(--danger); opacity: 1; }
.typing-label { display: block; margin-bottom: 6px; font-weight: 650; }
.typing-row { display: flex; gap: 10px; }
.typing-row input { min-width: 0; flex: 1; padding: 13px 14px; border: 1px solid var(--strong-line); border-radius: 10px; background: var(--soft); color: var(--ink); }
.hint { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
summary { color: var(--accent); min-height: 44px; padding: 8px 0; font-weight: 650; }
.hint p { margin: 7px 0; }
.notice, .feedback, .record-panel { margin: 0 0 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); font-size: 15px; overflow-wrap: anywhere; }
.notice p:last-child, .feedback p:last-child { margin-bottom: 0; }
.notice.error { border-left: 4px solid var(--danger); }
.notice.info { border-left: 4px solid var(--accent); }
.feedback { margin-top: 22px; margin-bottom: 0; }
.feedback.good { border-left: 4px solid var(--success); }
.feedback.retry { border-left: 4px solid var(--accent); }
.feedback strong { display: block; margin-bottom: 6px; }
.next-row { justify-content: flex-end; margin-top: 18px; }
.listen-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.audio-note { flex-basis: 100%; margin: 4px 0 0; }
.read-along { margin: 0 0 20px; padding: 14px 18px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--soft); }
.read-along-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; min-height: 36px; margin-bottom: 6px; }
.read-along-header .eyebrow { margin: 0; }
.read-along-header .text-button { font-size: 13px; padding: 0 4px; min-height: 36px; }
.read-along-text { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(22px, 4vw, 27px); line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.read-along-word { border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.read-along-word.is-spoken { color: var(--accent-ink); background: var(--accent); box-shadow: 0 0 0 3px var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.read-along-status { margin: 0; }
.record-panel { margin-top: 22px; }
.record-panel h3 { font-size: 17px; margin-bottom: 8px; }
.record-status { margin: 12px 0; }
.recording { color: var(--danger); font-weight: 700; }
.self-check { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.self-check h3 { font-size: 17px; margin-bottom: 7px; }
.score-grid { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.score-grid .stat { min-width: 110px; flex: 1; }
.assessment-words { padding-left: 20px; font-size: 14px; }
.result-icon { font-size: 45px; margin-bottom: 10px; }
.data-tools { margin: 22px 0; border-top: 1px solid var(--line); padding-top: 8px; }
.file-label { position: relative; overflow: hidden; cursor: pointer; }
.file-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-label:focus-within { outline: 3px solid var(--accent); outline-offset: 4px; }
.app-footer { justify-content: space-between; flex-wrap: wrap; margin-top: 25px; font-size: 12px; color: var(--muted); }
.skip-link { position: fixed; left: 15px; top: -100px; background: var(--surface); padding: 10px 18px; z-index: 10; border: 2px solid var(--accent); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.privacy-copy h2 { font-size: 21px; margin-top: 28px; margin-bottom: 9px; }
.privacy-copy li { margin-bottom: 9px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.math-screen { --accent: var(--math); --accent-hover: var(--math-hover); --accent-soft: var(--math-soft); --accent-ink: var(--math-ink); }
.math-screen .card + .card { margin-top: 20px; }
.math-hero { display: grid; grid-template-columns: 1fr 165px; gap: 22px; background-color: var(--surface); background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 28px 28px; }
.math-hero > div:first-child { padding: 12px; margin: -12px; background: var(--surface); border-radius: 10px; }
.math-hero h1 { white-space: pre-line; font-size: clamp(30px, 5vw, 42px); }
.math-hero p:last-child { margin-bottom: 0; }
.math-rank { align-self: start; display: flex; flex-direction: column; align-items: center; padding: 18px 15px; border: 1px solid var(--math); border-radius: 50% 50% 12px 12px; background: var(--math-soft); text-align: center; }
.math-rank .eyebrow { font-size: 9px; margin: 8px 0; }
.math-level { font: bold 56px/1 Georgia, "Times New Roman", serif; color: var(--math); }
.math-rank progress { margin: 12px 0 0; height: 6px; }
.math-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; grid-column: 1 / -1; }
.math-metric { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 12px; text-align: center; }
.math-metric strong { display: block; font-size: 25px; color: var(--math); overflow-wrap: anywhere; }
.math-metric > span { font-size: 12px; color: var(--muted); }
.math-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 5px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.math-mode { min-height: 44px; padding: 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 650; }
.math-mode.is-active { background: var(--math); color: var(--math-ink); }
.math-table-grid, .math-group-grid { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.math-table-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.math-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.math-choice { position: relative; cursor: pointer; min-width: 0; }
.math-choice > input { position: absolute; top: 9px; right: 8px; margin: 0; width: 15px; height: 15px; accent-color: var(--math); }
.math-choice-content { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 100px; padding: 15px 5px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.math-choice > input:checked + .math-choice-content { border: 2px solid var(--math); padding: 14px 4px 9px; background: var(--math-soft); color: var(--math); }
.math-choice > input:focus-visible { outline: none; }
.math-choice > input:focus-visible + .math-choice-content { outline: 3px solid var(--math); outline-offset: 3px; }
.math-table-number { font: 32px/1.1 Georgia, "Times New Roman", serif; }
.math-table-stars { color: var(--math-gold); font-size: 14px; letter-spacing: 1px; }
.math-group-grid .math-choice-content { align-items: flex-start; padding: 20px; }
.math-group-grid input:checked + .math-choice-content { padding: 19px; }
.math-group-numbers { font: 23px/1.3 Georgia, "Times New Roman", serif; color: var(--math); }
.math-all { border: 1px dashed var(--math); border-radius: 12px; padding: 22px; background: var(--math-soft); }
.math-all > strong { display: block; font: 32px/1.2 Georgia, "Times New Roman", serif; color: var(--math); margin-bottom: 10px; }
.math-all p { margin: 0; }
.math-selection-summary { margin: 18px 0; font-size: 14px; font-weight: 650; }
.math-start { min-width: 160px; }
.math-badge-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; gap: 12px; }
.math-badge { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 10px; border: 1px dashed var(--strong-line); border-radius: 12px; color: var(--muted); gap: 7px; }
.math-badge.is-earned { color: var(--ink); border-style: solid; border-color: var(--math); background: var(--math-soft); }
.math-badge-icon { display: grid; place-items: center; width: 48px; height: 48px; font-size: 38px; color: var(--math-gold); }
.math-badge-state { font-size: 11px; font-weight: 700; color: var(--math); margin-top: auto; padding-top: 5px; }
.math-study-table { border-top: 1px solid var(--line); padding: 8px 0; }
.math-times-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px 20px; }
.math-times-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.math-times-list strong { color: var(--math); }
.math-dots { display: grid; gap: 6px; width: max-content; max-width: 100%; margin: 14px 0; padding: 14px; background: var(--math-soft); border-radius: 8px; }
.math-dot-row { display: flex; gap: 4px; }
.math-dot { width: 8px; height: 8px; flex-shrink: 0; background: var(--math); border-radius: 50%; }
.math-dot-gap { margin-right: 5px; }
.math-trail { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; list-style: none; padding: 0; margin: 0 0 20px; scroll-margin-top: 88px; }
.math-trail li { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; font-size: 13px; background: var(--surface); color: var(--muted); }
.math-trail .is-current { border: 2px solid var(--math); color: var(--math); font-weight: 700; }
.math-trail .is-correct { background: var(--math); color: var(--math-ink); border-color: var(--math); }
.math-trail .needs-practice { color: var(--math-gold); border-color: var(--math-gold); }
.math-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 26px; font-size: 13px; color: var(--muted); }
.math-combo { padding: 5px 10px; border-radius: 20px; background: var(--math-soft); color: var(--math); font-weight: 700; }
.math-question > .eyebrow { text-align: center; }
.math-equation { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 3vw, 20px); margin: 24px 0 18px; font: 64px/1.2 Georgia, "Times New Roman", serif; font-variant-numeric: lining-nums tabular-nums; }
.math-equation span:last-child { min-width: 65px; border-bottom: 3px solid var(--math); color: var(--math); text-align: center; }
.math-equation .is-spoken { color: var(--math); background: var(--math-soft); border-radius: 6px; text-decoration: underline; text-underline-offset: 5px; }
.math-reading { margin-bottom: 20px; }
.math-reading .read-along { margin-bottom: 8px; padding: 10px 14px; }
.math-reading .read-along-header { min-height: 30px; margin-bottom: 2px; }
.math-reading .read-along-text { font-size: 22px; line-height: 1.6; margin-bottom: 6px; }
.math-reading .read-along-status { font-size: 12px; }
.math-reading .listen-row { margin: 0; }
.math-language-note { margin: 8px 0 0; }
.math-question .typing-row input { font-size: 24px; }
.math-question input[aria-invalid="true"] { border-color: var(--danger); }
.math-validation { min-height: 20px; color: var(--danger); margin: 4px 0; }
.math-hint { margin-top: 14px; padding: 18px; border: 1px dashed var(--math); border-radius: 10px; }
.math-hint p:last-child { margin-bottom: 0; }
.math-xp-gain { display: inline-block; float: right; padding: 4px 10px; border-radius: 20px; font-size: 13px; font-weight: 700; color: var(--math); background: var(--math-soft); }
.math-solution { font: 30px/1.5 Georgia, "Times New Roman", serif; }
.math-feedback, .topo-feedback { scroll-margin-top: 100px; }
.topo-feedback .topo-map > svg { max-height: 330px; }
.math-solution .is-spoken { background: var(--math); color: var(--math-ink); border-radius: 4px; }
.math-part-first { color: var(--math); }
.math-part-second { color: var(--math-gold); }
.math-total { font-weight: 700; }
.math-worked { clear: both; margin: 14px 0; border-top: 1px solid var(--line); padding-top: 14px; }
.math-worked p { margin-bottom: 8px; }
.math-worked-parts { display: flex; gap: 8px; flex-wrap: wrap; }
.math-worked-parts > span:first-child, .math-worked-parts > span:last-child { padding: 3px 8px; border: 1px solid currentColor; border-radius: 6px; font-weight: 600; }
.math-dot-row.math-part-second .math-dot { background: var(--math-gold); }
.math-worked-visual { font-size: 14px; }
.math-results { text-align: center; }
.math-results .actions { justify-content: center; }
.math-results .math-metrics { margin: 24px 0; }
.math-reward-stars { font-size: clamp(44px, 12vw, 68px); letter-spacing: 10px; color: var(--math-gold); line-height: 1.4; margin: 8px 0 20px; }
.math-new-badges { border: 1px solid var(--math); border-radius: 12px; background: var(--math-soft); padding: 16px; margin: 20px 0; color: var(--math); }
.math-new-badges p { margin: 7px 0 0; }
.math-review { text-align: left; border-top: 1px solid var(--line); margin-top: 20px; }
.math-history { margin-top: 24px; }
.topo-screen { --accent: var(--topo); --accent-hover: var(--topo); --accent-soft: var(--topo-soft); --accent-ink: var(--topo-ink); }
.topo-screen .card + .card { margin-top: 20px; }
.topo-hero { position: relative; overflow: hidden; background-image: repeating-linear-gradient(0deg, transparent 0 29px, var(--line) 30px); }
.topo-hero-intro { background: var(--surface); padding: 8px; border-radius: 8px; }
.topo-hero h1 { white-space: pre-line; font: 700 clamp(32px, 6vw, 46px)/1.12 Georgia, "Times New Roman", serif; }
.topo-map { margin: 22px 0 0; }
.topo-map-caption { font-weight: 650; margin-bottom: 8px; color: var(--topo); }
.topo-map > svg { display: block; width: 100%; max-height: 550px; aspect-ratio: 600 / 490; border: 1px solid var(--line); border-radius: 12px; background: var(--topo-ocean); overflow: hidden; }
.topo-ocean { fill: var(--topo-ocean); }
.topo-land { fill: var(--topo-land); stroke: var(--topo-border); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.topo-land.is-neighbour { fill: var(--soft); stroke: var(--line); }
.topo-land.is-target { fill: var(--topo-city); stroke: var(--ink); stroke-width: 2.3; }
.topo-land.is-choice { cursor: pointer; }
.topo-land.is-choice:hover, .topo-land.is-choice:focus-visible { stroke: var(--topo); stroke-width: 3; fill: var(--topo-soft); outline: none; }
.topo-land.is-correct { fill: var(--math-soft); stroke: var(--success); stroke-width: 4; }
.topo-land.is-wrong { stroke: var(--danger); stroke-width: 3; stroke-dasharray: 6 3; }
.topo-compass { fill: var(--topo); font: 700 18px Georgia, serif; }
.topo-province-label { fill: var(--ink); font-size: 13px; font-weight: 650; text-anchor: middle; paint-order: stroke; stroke: var(--topo-land); stroke-width: 3; }
.topo-label-line { stroke: var(--topo-border); stroke-width: 1; }
.topo-place-label { fill: var(--ink); font-size: 15px; font-weight: 650; paint-order: stroke; stroke: var(--surface); stroke-width: 4; stroke-linejoin: round; }
.topo-kind-province { color: var(--topo-border); }
.topo-kind-city { color: var(--topo-city); }
.topo-kind-water { color: var(--topo-water); }
.topo-pin-hit { fill: transparent; }
.topo-pin-shape { fill: var(--surface); stroke: currentColor; stroke-width: 2; }
.topo-pin-label { fill: var(--ink); font-size: 16px; font-weight: 750; text-anchor: middle; }
.topo-pin[role="button"] { cursor: pointer; }
.topo-pin[role="button"]:focus-visible { outline: none; }
.topo-pin[role="button"]:focus-visible .topo-pin-hit, .topo-pin[role="button"]:hover .topo-pin-hit { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.topo-pin.is-target .topo-pin-shape { fill: currentColor; stroke: var(--ink); }
.topo-pin.is-target .topo-pin-label { fill: var(--topo-ink); }
.topo-pin.is-correct .topo-pin-shape { stroke: var(--success); stroke-width: 4; }
.topo-pin.is-wrong .topo-pin-shape { stroke: var(--danger); stroke-width: 4; stroke-dasharray: 4 2; }
.topo-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; margin: 10px 0; }
.topo-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.topo-legend b { font-size: 18px; }
.topo-map-note, .topo-map-credit { margin: 6px 0; font-size: 11px; }
.topo-map-credit { overflow-wrap: anywhere; }
.topo-level-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.topo-level-list > li:first-child { grid-column: 1 / -1; }
.topo-level-link { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: var(--ink); text-decoration: none; height: 100%; }
.topo-level-link:hover { border-color: var(--topo); }
.topo-level-list > li:first-child .topo-level-link { background: var(--topo-soft); border-color: var(--topo); }
.topo-level-link > span:last-child { display: grid; }
.topo-level-number { font: 30px/1 Georgia, "Times New Roman", serif; color: var(--topo); }
.topo-level-link strong { font-size: 18px; }
.topo-item-index { margin: 24px 0 0; line-height: 1.9; }
.topo-kind-label { display: inline-block; font-weight: 700; border-bottom: 2px solid currentColor; margin-bottom: 15px; }
.topo-explanation { padding: 14px 18px; border-left: 3px solid var(--topo); background: var(--topo-soft); margin-bottom: 20px; }
.topo-reading { margin: 24px 0; }
.topo-reading .listen-row { margin: 8px 0; }
.topo-reading .read-along { margin-bottom: 8px; }
.topo-question { scroll-margin-top: 100px; }
.topo-question > .topo-map { margin-bottom: 22px; }
.topo-answers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.topo-answers .answer { overflow-wrap: anywhere; min-width: 0; }
.topo-hint { padding: 16px; border: 1px dashed var(--topo); border-radius: 10px; margin-top: 10px; }
.topo-sources { font-size: 12px; margin-top: 18px; }
.topo-sources summary { font-size: 12px; font-weight: 400; }
.topo-sources ul { padding-left: 18px; }
.topo-filters [aria-pressed="true"] { color: var(--topo-ink); background: var(--topo); border-color: var(--topo); }
.topo-badges { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.topo-badges li { display: grid; gap: 5px; border: 1px dashed var(--line); padding: 14px; border-radius: 10px; }
.topo-badges li.is-earned { border: 1px solid var(--topo); background: var(--topo-soft); }
.topo-stamp { font: 70px/1 Georgia, serif; color: var(--topo); margin: 20px; }
.fractions-screen { --accent: #94501d; --accent-hover: #743b11; --accent-soft: #fff3e4; --accent-ink: #fff; --fraction-first: #096c60; --fraction-second: #a1640a; --fraction-result: #94501d; }
.fractions-screen .card + .card { margin-top: 20px; }
.fractions-hero { background: var(--surface); border-top: 5px solid var(--accent); }
.fractions-hero h1 { white-space: pre-line; font: 700 clamp(32px, 6vw, 43px)/1.13 Georgia, "Times New Roman", serif; }
.fraction-hero-model { padding: 18px; border: 1px dashed var(--strong-line); border-radius: 12px; background: var(--accent-soft); }
.fraction-hero-model .fraction-model { margin: 0; }
.fraction-hero-model .fraction-model > p { display: none; }
.fraction-hero-caption { text-align: right; font: italic 19px Georgia, serif; margin: 12px 0 0; color: var(--accent); }
.fraction-model { margin: 18px 0; min-width: 0; }
.fraction-model figcaption { font-weight: 650; margin-bottom: 6px; }
.fraction-model > svg { display: block; width: 100%; max-width: 520px; }
.fraction-model > p { margin: 0; font-size: 12px; }
.fraction-cell { fill: var(--surface); stroke: var(--strong-line); stroke-width: 1.5; }
.fraction-cell.is-filled { fill: var(--fraction-first); }
.fraction-tone-second .fraction-cell.is-filled { fill: var(--fraction-second); }
.fraction-tone-result .fraction-cell.is-filled { fill: var(--fraction-result); }
.fraction-topic-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.fraction-topic-link { display: flex; align-items: center; gap: 18px; padding: 17px; background: var(--soft); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.fraction-topic-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.fraction-topic-link > span:last-child { display: grid; gap: 2px; }
.fraction-topic-link strong { font-size: 18px; }
.fraction-topic-number { font: 31px/1 Georgia, serif; color: var(--accent); }
.fraction-equation { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; padding: 16px 0; margin: 4px 0 20px; font: 36px/1.4 Georgia, "Times New Roman", serif; }
.fraction-notation { display: inline-flex; flex-direction: column; align-items: stretch; justify-content: center; vertical-align: middle; min-width: 1.3em; text-align: center; font-variant-numeric: lining-nums tabular-nums; line-height: 1.15; }
.fraction-numerator { padding: 0 5px 4px; border-bottom: 2px solid currentColor; }
.fraction-denominator { padding: 4px 5px 0; }
.fraction-small-operator { font-size: 19px; }
.fraction-question, .fraction-feedback { scroll-margin-top: 100px; }
.fraction-question h1 { font-size: clamp(25px, 5vw, 33px); }
.fraction-comparisons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fraction-comparisons button { flex-direction: column; padding: 12px 4px; }
.fraction-comparisons strong { font: 36px/1 Georgia, serif; }
.fraction-comparisons span { font-size: 12px; }
.fraction-validation { color: var(--danger); min-height: 20px; font-size: 13px; margin: 4px 0; }
.fraction-controls form > p { margin: 8px 0; }
.fraction-controls input[aria-invalid="true"] { border-color: var(--danger); }
.fraction-hint { padding: 18px; margin-top: 12px; border: 1px dashed var(--accent); border-radius: 10px; }
.fraction-hint p:last-child { margin-bottom: 0; }
.fraction-worked { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.fraction-worked h2 { font-size: 22px; }
.fraction-steps { padding-left: 24px; }
.fraction-steps li { margin: 10px 0; padding-left: 4px; }
.fraction-steps li::marker { color: var(--accent); font-weight: bold; }
.fraction-worked .fraction-equation { font-size: 29px; gap: 10px; }
.fraction-reward { font: 64px/1 Georgia, serif; color: var(--accent); margin: 22px 0; }
.fraction-results .primary, .fraction-results .secondary { margin: 5px; }
.fractions-screen .math-reading { margin-top: 20px; }
.fractions-screen .topo-badges li.is-earned { border-color: var(--accent); background: var(--accent-soft); }
@media (prefers-color-scheme: dark) {
  .fractions-screen { --accent: #f3b378; --accent-hover: #ffd0a4; --accent-soft: #433329; --accent-ink: #2b2018; --fraction-first: #64b9a4; --fraction-second: #d7ad61; --fraction-result: #e89f61; }
}
@media (max-width: 560px) {
  .account-bar { flex-wrap: wrap; gap: 2px 10px; }
  #accountLabel { flex: 1; min-width: 0; }
  #syncStatus { order: 3; flex-basis: 100%; }
  .app { width: calc(100% - 24px); padding-top: 18px; }
  .brand-subtitle { display: none; }
  .logo { width: 38px; height: 42px; }
  .app-header { gap: 7px; }
  .top-actions .ghost { font-size: 12px; padding: 8px 10px; min-width: 85px; }
  .brand { gap: 8px; }
  .theme-list, .word-list { grid-template-columns: 1fr; }
  .stats { gap: 7px; }
  .stat span { font-size: 12px; }
  .typing-row { flex-direction: column; }
  .actions > button { flex: 1 1 160px; }
  .progress-meta { flex-wrap: wrap; gap: 2px 10px; }
  .chapter-link { padding: 15px; }
  .math-hero { grid-template-columns: 1fr 108px; gap: 16px; }
  .math-hero h1 { font-size: 30px; }
  .math-hero .muted { font-size: 14px; }
  .math-rank { padding: 12px 7px; }
  .math-rank .eyebrow { font-size: 8px; }
  .math-level { font-size: 46px; }
  .math-metrics { gap: 6px; }
  .math-metric { padding: 10px 4px; }
  .math-metric strong { font-size: 22px; }
  .math-modes { grid-template-columns: repeat(2, 1fr); }
  .math-table-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .math-choice-content { min-height: 90px; }
  .math-group-grid { grid-template-columns: 1fr; }
  .math-badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .math-equation { font-size: clamp(35px, 10vw, 48px); gap: 9px; }
  .math-equation span:last-child { min-width: 38px; }
  .math-trail { gap: 3px; }
  .math-trail li { font-size: 11px; }
  .math-times-list { grid-template-columns: 1fr; }
  .topo-level-list, .topo-badges { grid-template-columns: 1fr; }
  .topo-answers { grid-template-columns: 1fr; }
  .topo-map-credit { font-size: 10px; }
  .topo-screen .stats { gap: 5px; }
  .topo-screen .stat strong { font-size: 22px; }
  .fraction-equation { gap: 9px; font-size: 30px; }
  .fraction-worked .fraction-equation { gap: 7px; font-size: 25px; }
  .fraction-topic-link { padding: 14px; gap: 13px; }
  .fraction-topic-link strong { font-size: 16px; }
  .fraction-topic-number { font-size: 26px; }
  .fraction-hero-model { padding: 10px; }
}
@media (max-width: 400px) {
  .math-hero { grid-template-columns: 1fr; }
  .math-rank { display: grid; grid-template-columns: 52px 1fr; gap: 2px 16px; padding: 12px 16px; border-radius: 12px; text-align: left; }
  .math-rank .eyebrow { grid-column: 1 / -1; font-size: 9px; margin: 0 0 5px; }
  .math-level { grid-column: 1; grid-row: 2; font-size: 40px; text-align: center; }
  .math-level-label { grid-column: 1; grid-row: 3; text-align: center; font-size: 11px; }
  .math-total-xp { grid-column: 2; grid-row: 2; }
  .math-rank progress { grid-column: 2; grid-row: 3; margin: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .card { animation: settle 180ms ease-out; }
  @keyframes settle { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  .math-reward-stars, .math-new-badges { animation: math-reward 350ms ease-out; }
  @keyframes math-reward { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
}
