/* self-hosted fonts (SIL OFL, see fonts/OFL-*.txt): no third-party requests */
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/public-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/public-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Saira Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/saira-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Saira Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/saira-condensed-latin-700-normal.woff2") format("woff2"); }
/* Layout: one reading column (max 72ch) under a slim header; answer-sheet bubbles are the recurring motif. */
:root {
  --paper: #f6f7f4;
  --surface: #ffffff;
  --ink: #17212c;
  --muted: #56616c;
  --line: #d9ddd6;
  --accent: #1f6b57;      /* answer-sheet green */
  --accent-ink: #ffffff;
  --accent-soft: #e2efe9;
  --mark: #b7791f;        /* pencil-mark amber for highlights */
  --good: #2e7d32;
  --bad: #b3261e;
  --display: "Saira Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Public Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11171d; --surface: #182129; --ink: #e6ebe7; --muted: #a2adb5; --line: #2b3640;
    --accent: #5fb89c; --accent-ink: #0d1a15; --accent-soft: #1d3a31; --mark: #e0a849; --good: #81c784; --bad: #ef8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11171d; --surface: #182129; --ink: #e6ebe7; --muted: #a2adb5; --line: #2b3640;
  --accent: #5fb89c; --accent-ink: #0d1a15; --accent-soft: #1d3a31; --mark: #e0a849; --good: #81c784; --bad: #ef8a80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--body);
}
a { color: var(--accent); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; height: auto; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-inline: 16px; }
.col { max-width: 46rem; }

/* header */
.top { position: sticky; isolation: isolate; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.35rem/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.brand-logo { width: 44px; height: 44px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.18)); }
.nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav a:hover { color: var(--accent); }
.nav .cta { background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 6px; }
.menu { display: none; margin-left: auto; }
@media (max-width: 720px) {
  .nav { display: none; }
  .menu { display: block; position: relative; }
  .menu summary { list-style: none; cursor: pointer; font-weight: 700; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; }
  .menu summary::-webkit-details-marker { display: none; }
  .menu nav { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; min-width: 200px; }
  .menu nav a { padding: 10px 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
}

/* type */
h1, h2, h3 { font-family: var(--display); line-height: 1.1; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); font-weight: 700; letter-spacing: 0.005em; }
h2 { font-size: clamp(1.55rem, 3.6vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; }
.eyebrow { font: 600 0.78rem/1.35 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 40rem; }
.prose { max-width: 42rem; }
.prose p { margin: 0 0 1em; }
.small { font-size: 0.875rem; color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

main { padding-block: 28px 64px; }
.stack { display: grid; gap: 18px; }
.section { padding-block: 34px 6px; display: grid; gap: 16px; }

/* breadcrumb */
.crumbs { font-size: 0.85rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.crumb-back { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 6px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--ink) !important; box-shadow: 0 1px 3px rgb(15 23 42 / 0.08); text-decoration: none; transition: border-color .15s, color .15s, transform .15s; }
.crumb-back:hover { border-color: var(--accent); color: var(--accent) !important; transform: translateX(-1px); }
.crumb-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { opacity: 0.6; }

/* buttons */
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 8px; font-weight: 700; text-decoration: none; border: 2px solid var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { color: var(--accent); background: transparent; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; align-items: center; padding-block: 18px 10px; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.hero .stack > * { min-width: 0; }

/* answer-sheet card (sample item) */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 12px; min-width: 0; }
.sheet .stem { font-weight: 600; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.opts li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; }
.bub { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; font: 700 0.8rem/1 var(--mono); }
.reveal summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.reveal[open] .bub.key { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.answer { margin-top: 10px; padding: 12px 14px; background: var(--accent-soft); border-radius: 8px; }
.answer p { margin: 0 0 0.6em; }
.answer p:last-child { margin: 0; }

/* grids of subjects / lessons */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 12px; }
.tile { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-decoration: none; color: var(--ink); min-width: 0; }
.tile:hover { border-color: var(--accent); }
.tile .code { font: 700 0.8rem/1 var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.tile h3 { font-size: 1.2rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.tag { display: inline-block; font: 600 0.7rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); justify-self: start; }

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 14px 4px; text-decoration: none; color: var(--ink); }
.list a:hover .t { color: var(--accent); }
.list .n { font: 600 0.9rem/1 var(--mono); color: var(--muted); }
.list .t { font-weight: 600; }
.list .m { font: 500 0.82rem/1 var(--mono); color: var(--muted); white-space: nowrap; }

/* facts strip */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 10px; }
.fact { display: block; border-left: 3px solid var(--accent); padding: 4px 12px; color: var(--ink); text-decoration: none; }
a.fact:hover b { color: var(--accent); }
.fact b { display: block; font: 700 1.9rem/1.1 var(--display); }
.fact span { color: var(--muted); font-size: 0.9rem; }

/* lesson outline + preview */
.outline { columns: 2 16rem; column-gap: 28px; margin: 0; padding-left: 1.3em; }
.outline li { break-inside: avoid; margin-bottom: 4px; }
.more summary { cursor: pointer; font-weight: 700; color: var(--accent); margin-top: 8px; }
.more .outline { margin-top: 8px; }
.preview { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 14px; }
.preview h3 { font-size: 1.25rem; }
.preview .prose p:last-child { margin-bottom: 0; }
.math-block { overflow-x: auto; overflow-y: hidden; margin: 0 0 1em; padding: 10px 16px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; }
.math-block .katex-display { margin: 0; text-align: left; }
.math-block .katex-display > .katex { text-align: left; }
.math-block.eq { display: grid; gap: 6px; justify-items: start; }
.eq-row { max-width: 100%; display: flex; align-items: baseline; gap: 0.35em; }
.eq-unit { font-family: KaTeX_Main, "Times New Roman", serif; font-size: 1.12em; }
.eq-join { font-size: 0.85rem; color: var(--muted); font-style: italic; }
.answer .math-block { background: var(--surface); }
.q .stem .math-block { margin: 0.6em 0; }
.figure { background: #fff; border-radius: 8px; padding: 8px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font: 600 0.78rem/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* app call to action */
.appcta { background: var(--ink); color: var(--paper); border-radius: 12px; padding: 24px; display: grid; gap: 12px; }
.appcta h2 { color: var(--paper); }
.appcta p { margin: 0; opacity: 0.85; }
.appcta .btn.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.appcta .btn.ghost { color: var(--paper); border-color: var(--paper); }
/* timed test in progress (static/test.js): no app call-to-action, no ad under the runner */
body.test-running .app-sec, body.test-running .runner ~ .ad { display: none; }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); padding: 12px 2px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 10px 0 0; color: var(--muted); max-width: 44rem; }

footer { border-top: 1px solid var(--line); padding-block: 26px 40px; color: var(--muted); font-size: 0.875rem; }
footer .wrap { display: grid; gap: 12px; }
footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
footer a { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .tile, .btn { transition: border-color 0.15s, background-color 0.15s; }
}

/* skip link */
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 16px; }
.meta { font-size: 0.82rem; color: var(--muted); }
img.figure { display: block; max-width: 100%; height: auto; margin-block: 8px; background: #fff; border-radius: 6px; }

/* ads: space reserved so the page does not jump when a unit fills */
.ad { margin-block: 26px; min-height: 120px; display: grid; gap: 4px; align-content: start; }
.ad-label { font: 600 0.68rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ad-ph { place-items: center; align-content: center; border: 1px dashed var(--line); border-radius: 8px; background: repeating-linear-gradient(135deg, transparent 0 10px, var(--accent-soft) 10px 11px); }
.ad-ph span { font: 600 0.72rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* lesson */
.toc { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: var(--surface); }
.toc summary { cursor: pointer; font-weight: 700; }
.toc ol { margin: 10px 0 4px; padding-left: 1.4em; columns: 2 15rem; column-gap: 26px; }
.toc li { break-inside: avoid; margin-bottom: 4px; font-size: 0.95rem; }
.lesson { max-width: 46rem; display: grid; gap: 6px; }
.lsec { padding-top: 22px; scroll-margin-top: 76px; min-width: 0; }
.lsec h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin-bottom: 10px; }
.lsec .prose { max-width: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 10px; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.card dt { font-weight: 700; margin-bottom: 4px; }
.card dd { margin: 0; color: var(--muted); }
.endcta { border: 2px solid var(--accent); border-radius: 12px; padding: 22px; display: grid; gap: 10px; background: var(--accent-soft); }
.endcta p { margin: 0; }

/* questions */
.qs { max-width: 46rem; gap: 14px; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 12px; min-width: 0; scroll-margin-top: 76px; }
.q .stem { font-weight: 600; min-width: 0; }
.q .stem p { margin: 0 0 0.6em; }
.q .stem p:last-child { margin: 0; }
.qsplit { margin-top: 26px; }
.qs > .qsplit:first-child { margin-top: 0; }
.q .opts li { display: block; }
.opt { width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; text-align: left; font: inherit; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.opt .ot { min-width: 0; overflow-wrap: anywhere; padding-top: 1px; }
.opt:hover { border-color: var(--accent); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .bub { background: var(--ink); color: var(--paper); }
.q.done .opt { cursor: default; }
.q.done .opt:hover { border-color: var(--line); }
.opt.right { border-color: var(--good); }
.opt.right .bub { background: var(--good); border-color: var(--good); color: var(--surface); }
.opt.wrong { border-color: var(--bad); }
.opt.wrong .bub { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.opts.pics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opts.pics .opt { grid-template-columns: 1fr; justify-items: start; }
.opts.pics img.figure { background: #fff; border-radius: 6px; padding: 4px; margin: 0; }
.q img.figure { background: #fff; border-radius: 6px; padding: 6px; }
.why { margin: 8px 0 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: 0.95rem; }
.score { position: fixed; z-index: 6; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 14px; font-size: 0.88rem; box-shadow: 0 4px 14px rgb(0 0 0 / 0.25); }

/* timed test runner */
.runner { max-width: 46rem; }
.run-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: grid; gap: 12px; min-width: 0; }
.run-card p { margin: 0; }
.run-card h3 { margin-top: 8px; }
.run-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 700; }
.timer { background: var(--ink); color: var(--paper); border-radius: 6px; padding: 4px 10px; font-size: 1.05rem; }
.timer.low { background: var(--bad); color: var(--surface); }
.run-prog { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.run-prog i { display: block; height: 100%; background: var(--accent); }
.run-q { margin-block: 4px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
button.btn { font: inherit; font-weight: 700; cursor: pointer; }
.review { margin-top: 26px; }
.review h3 { margin-top: 12px; }
.q.miss { border-left: 3px solid var(--bad); }
.q.ok { border-left: 3px solid var(--good); }

/* word list */
.jump { display: flex; flex-wrap: wrap; gap: 6px; }
.jump a { font: 700 0.9rem/1 var(--mono); padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 0 26px; margin: 0; }
.word { border-bottom: 1px solid var(--line); padding: 10px 2px; min-width: 0; }
.word { display: grid; gap: 6px; padding: 14px 2px; align-content: start; }
.word dt { font-weight: 700; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 1.06rem; }
.word dt .pos { font: 600 0.7rem/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 7px; border-radius: 5px; }
.word dd { margin: 0; color: var(--muted); display: grid; gap: 8px; justify-items: start; }
.word .wdef { margin: 0; color: var(--ink); }
.wsyn { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.wsyn li { font-size: 0.8rem; line-height: 1.2; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); }
.wex { display: block; font-style: italic; font-size: 0.93rem; padding-left: 10px; border-left: 2px solid var(--line); }
.wex::before, .wex::after { content: none; }
.wq { font-size: 0.84rem; font-weight: 600; text-decoration: none; color: var(--accent); }
.wq:hover { text-decoration: underline; }
section[id^="letter-"] { scroll-margin-top: 76px; }

td.num { white-space: nowrap; }
.teq { font-family: KaTeX_Main, "Times New Roman", serif; font-size: 1.12em; white-space: pre-wrap; }

/* lesson: sticky "on this page" sidebar on wide screens (the collapsible contents box stays for phones/tablets) */
.toc-side { display: none; }
@media (min-width: 1100px) {
  .lesson-grid { display: grid; grid-template-columns: minmax(0, 1fr) 15.5rem; gap: 36px; align-items: start; }
  .lesson-grid .lesson { max-width: none; }
  .toc-side { display: block; position: sticky; top: 80px; }
  .toc-side nav { max-height: calc(100vh - 100px); overflow: auto; padding: 4px 4px 12px 0; display: grid; gap: 10px; }
  .toc-side ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); display: grid; gap: 2px; }
  .toc-side li a { display: block; padding: 4px 0 4px 12px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 0.875rem; line-height: 1.35; }
  .toc-side li a:hover { color: var(--ink); }
  .toc-side li a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
  .toc-side .btn { justify-self: start; font-size: 0.9rem; padding: 8px 14px; }
  .toc { display: none; }
}
.prose h2 { margin: 1.6em 0 0.4em; font-size: 1.6rem; }

/* ---------------------------------------------------------------- translation (site.js): language picker, boxes, notice */
.lang-pick { position: relative; flex: none; }
.lang-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 10px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; font: 600 0.9rem/1 var(--body); cursor: pointer; }
.lang-btn:hover { border-color: var(--accent); }
.lang-btn.is-on { border-color: var(--accent); background: var(--accent-soft); }
.lang-flag, .lang-opt img, .menu-lang img { width: 22px; height: 16px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12); flex: none; }
.lang-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-caret { flex: none; color: var(--muted); }
.lang-btn[aria-expanded="true"] .lang-caret { transform: rotate(180deg); }
.lang-dd { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: 300px; display: grid; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgb(15 23 42 / 0.2); }
.lang-dd[hidden] { display: none; }
.lang-search { width: 100%; min-height: 42px; padding: 8px 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font: 400 1rem/1.2 var(--body); }
.lang-search:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.lang-list { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.lang-list li[hidden] { display: none; }
.lang-opt { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 10px; color: var(--ink); background: transparent; border: 0; border-radius: 8px; font: 400 0.95rem/1.2 var(--body); text-align: left; cursor: pointer; }
.lang-opt span { flex: 1; min-width: 0; }
.lang-opt small { font: 600 0.7rem/1 var(--mono); letter-spacing: 0.06em; color: var(--muted); }
.lang-opt:hover, .lang-opt:focus-visible { background: var(--accent-soft); outline: none; }
.lang-opt[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.lang-opt[aria-selected="true"] small { color: var(--accent); }
.lang-note { margin: 0; padding: 2px 4px 0; font-size: 0.78rem; line-height: 1.4; color: var(--muted); }
.menu-lang { display: none; }
@media (max-width: 720px) {
  .lang-pick { margin-left: auto; }
  .lang-pick + .menu { margin-left: 8px; }
  .lang-name { display: none; }
  .lang-btn { padding: 6px 9px; gap: 6px; }
  .lang-dd { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 66px); left: 12px; right: 12px; width: auto; }
  .lang-list { max-height: min(62vh, 480px); }
  .menu-lang { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 4px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); font: 600 1rem/1.2 var(--body); text-align: left; cursor: pointer; }
}

.translation-box { display: block; margin: 0.35em 0 0.9em; padding: 0.5em 0.85em; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; color: var(--ink); font: 400 0.93rem/1.55 var(--body); letter-spacing: normal; text-transform: none; text-align: start; overflow-wrap: anywhere; }
.translation-box[dir="rtl"] { border-left: 0; border-right: 3px solid var(--accent); border-radius: 8px 0 0 8px; }
.translation-box.is-loading { color: var(--muted); font-style: italic; }
.translation-box .katex { font-size: 1.05em; }
.translation-box img { max-height: 3em; width: auto; vertical-align: middle; }
.translation-box .math-block, .translation-box .eq-row { display: inline-flex; margin: 0; padding: 0; background: none; border: 0; vertical-align: middle; }
.translation-box .katex-display { display: inline; margin: 0; }
.translation-box .katex-display > .katex { display: inline; }
.translation-box.tr-in { margin: 0.45em 0 0.1em; font-size: 0.88rem; padding: 0.4em 0.7em; }
h1 + .translation-box { font-size: 1.05rem; font-weight: 600; max-width: 40rem; }
h2 + .translation-box, h3 + .translation-box, .tile .translation-box { font-weight: 600; }
.lede + .translation-box { max-width: 40rem; }
.opt .translation-box { background: transparent; padding: 0.15em 0 0.15em 0.6em; margin: 0.35em 0 0; font-weight: 400; }
.opt .translation-box[dir="rtl"] { padding: 0.15em 0.6em 0.15em 0; }
.answer .translation-box { background: var(--surface); }
.card .translation-box, .word .translation-box { font-size: 0.86rem; }
.list .t .translation-box { font-weight: 400; color: var(--muted); }
.appcta .translation-box { background: rgb(255 255 255 / 0.08); color: var(--paper); }
.faq summary .translation-box { font-weight: 400; }

.tr-notice { background: var(--accent-soft); border-bottom: 1px solid var(--line); color: var(--ink); font-size: 0.86rem; line-height: 1.45; }
.tr-notice[hidden] { display: none; }
.tr-notice .wrap { display: flex; align-items: center; gap: 12px; padding-block: 8px; }
.tr-notice p { margin: 0; flex: 1; min-width: 0; display: grid; gap: 2px; }
.tr-notice-en { font-weight: 600; }
.tr-notice-t:empty { display: none; }
.tr-notice-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 0.9rem; }
.tr-notice-x:hover { border-color: var(--accent); color: var(--accent); }
.stack > .translation-box { margin: -8px 0 0; }
.stack > .translation-box { margin: -8px 0 0; }

/* ---------------------------------------------------------------- Google Play (as on rumocarta.com) */
.play-top { display: inline-flex; align-items: center; gap: 9px; flex: none; min-height: 42px; padding: 6px 12px 6px 7px; color: #fff; background: linear-gradient(135deg, #1f6b57, #17523f); border: 1px solid rgb(31 107 87 / 0.35); border-radius: 10px; box-shadow: 0 5px 14px rgb(31 107 87 / 0.22); text-decoration: none; transition: transform .2s ease, box-shadow .2s ease; }
.play-top:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgb(31 107 87 / 0.3); color: #fff; }
.play-ic { display: grid; place-items: center; width: 28px; height: 28px; flex: none; color: #fff; background: rgb(255 255 255 / 0.14); border: 1px solid rgb(255 255 255 / 0.22); border-radius: 8px; }
.play-ic svg { width: 15px; height: 15px; fill: currentColor; }
.play-copy { display: grid; line-height: 1; }
.play-copy b { font: 700 0.8rem/1 var(--body); white-space: nowrap; }
.play-copy small { margin-top: 3px; color: #cfe6dd; font: 600 0.66rem/1 var(--body); }
:root[data-theme="dark"] .play-top { background: linear-gradient(135deg, #2b7d66, #1f6b57); }
.app-bar, .app-bar-x, .app-bar-space { display: none; }
@media (max-width: 720px) {
  .play-top { display: none; }
  .app-bar-space { display: block; height: calc(4.4rem + env(safe-area-inset-bottom, 0px)); }
  .app-bar { position: fixed; z-index: 30; left: 50%; bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 0.6rem; width: min(360px, calc(100% - 1rem)); min-height: 52px; padding: 0.45rem 0.75rem 0.45rem 0.5rem; color: #fff; background: linear-gradient(100deg, #17523f, #1f6b57); border: 1px solid rgb(143 207 182 / 0.5); border-radius: 15px; box-shadow: 0 12px 28px rgb(12 40 32 / 0.3); text-decoration: none; }
  .app-bar .play-ic { width: 34px; height: 34px; }
  .app-bar .play-ic svg { width: 18px; height: 18px; }
  .app-bar-copy { flex: 1 1 auto; min-width: 0; font: 800 0.9rem/1 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-bar-store { flex: none; padding: 0.38rem 0.5rem; color: #dff1ea; background: rgb(255 255 255 / 0.14); border-radius: 7px; font: 800 0.68rem/1 var(--body); white-space: nowrap; }
  .app-bar-arrow { flex: none; font-size: 0.95rem; }
  .app-bar-x { position: fixed; z-index: 31; bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px) + 40px); left: calc(50% + min(180px, 50% - 0.5rem) - 16px); display: grid; place-items: center; width: 24px; height: 24px; padding: 0; color: #fff; background: #17212c; border: 2px solid #fff; border-radius: 50%; font-size: 0.85rem; line-height: 1; cursor: pointer; }
  body:has(.app-bar) .score { bottom: calc(env(safe-area-inset-bottom, 0px) + 78px); }
  html.app-bar-off body .score { bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); }
}
html.app-bar-off .app-bar, html.app-bar-off .app-bar-x, html.app-bar-off .app-bar-space { display: none !important; }
@media print { .play-top, .app-bar, .app-bar-x, .app-bar-space { display: none !important; } }

/* ---------------------------------------------------------------- header 2: language + day/night, pinned to the right edge */
.top { position: sticky; }
.top-tools { position: absolute; top: 0; right: 16px; height: 100%; display: flex; align-items: center; gap: 8px; z-index: 2; }
.lang-slot:empty { display: none; }
.theme-toggle { position: relative; display: inline-flex; align-items: center; justify-content: space-between; width: 62px; height: 34px; padding: 0 8px; flex: none; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .ti { position: relative; z-index: 1; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .ti-sun circle { fill: #f2b233; stroke: #f2b233; }
.theme-toggle .ti-sun path { stroke: #e0a020; }
.theme-toggle .ti-moon { fill: #8fa3c7; stroke: #8fa3c7; }
.theme-toggle .knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); box-shadow: 0 1px 3px rgb(0 0 0 / 0.18); transition: transform .22s ease; }
.theme-toggle[aria-checked="true"] .knob { transform: translateX(28px); }
/* the content column keeps its width; only when the window is too narrow for header 2 to sit beside it
   does the header row leave room for it */
@media (max-width: 1620px) { .top .wrap { padding-right: 230px; } }
@media (max-width: 720px) {
  .top .wrap { padding-right: 132px; }
  .top-tools { right: 12px; gap: 6px; }
  .lang-pick { margin-left: 0; }
  .menu { margin-left: auto; }
  .lang-pick + .menu { margin-left: auto; }
  .theme-toggle { width: 56px; height: 32px; padding: 0 7px; }
  .theme-toggle .knob { width: 24px; height: 24px; }
  .theme-toggle[aria-checked="true"] .knob { transform: translateX(24px); }
}
.brand { white-space: nowrap; }
@media (max-width: 720px) {
  .top .wrap { gap: 10px; }
  .brand { font-size: 1.12rem; gap: 7px; }
  .brand-logo { width: 36px; height: 36px; }
  .menu summary { padding: 7px 10px; font-size: 0.92rem; }
}
@media (max-width: 360px) { .brand { font-size: 0; gap: 0; } }

/* ---------------------------------------------------------------- flashcards */
.fc-feature { display: grid; gap: 6px; padding: 22px; color: var(--ink); background: var(--accent-soft); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; text-decoration: none; }
.fc-feature b { font: 700 1.5rem/1.1 var(--display); }
.fc-feature:hover { border-color: var(--accent); }
.fc-decks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.fc-decks a { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 100%; padding: 14px 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-weight: 600; }
.fc-decks a:hover { border-color: var(--accent); color: var(--accent); }
.fc-decks .small { flex: none; }
.fc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.fc-card details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.fc-card summary { list-style: none; cursor: pointer; display: grid; gap: 10px; padding: 18px 20px; }
.fc-card summary::-webkit-details-marker { display: none; }
.fc-front { font-size: 1.1rem; font-weight: 600; }
.fc-front p, .fc-back p { margin: 0 0 0.5em; }
.fc-back { padding: 16px 20px 18px; border-top: 1px dashed var(--line); background: var(--accent-soft); }
.fc-word { font: 700 1.8rem/1.1 var(--display); }
.fc-pos { color: var(--muted); font-style: italic; }
.fc-card.is-known summary .eyebrow::after { content: " · got it ✓"; color: var(--accent); }
@keyframes fcin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.linkbtn { padding: 4px 2px; color: var(--accent); background: none; border: 0; font: 600 0.9rem/1.2 var(--body); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* flashcards trainer (deck and mixed review pages) */
.fc-page { max-width: 46rem; min-width: 0; }
.fc-layout { display: grid; gap: 40px; }
.fc-side { display: none; }
@media (min-width: 1100px) {
  .fc-layout { grid-template-columns: minmax(0, 46rem) 300px; justify-content: space-between; align-items: start; }
  .fc-side { display: grid; gap: 16px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
  .fc-side .ad { margin: 0; min-height: 250px; }
}
.fc-side-card { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.fc-side-card .eyebrow { margin: 0 0 8px; }
.fc-side-card ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.fc-side-card li a { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 0.88rem; line-height: 1.3; }
.fc-side-card li a .num { font: 600 0.75rem/1 var(--mono); color: var(--muted); }
.fc-side-card li a:hover { background: var(--accent-soft); color: var(--accent); }
.fc-side-card li a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.fc-side-card li.mixed a { margin-bottom: 4px; }
.fc-side-card .fcstat { font-size: 0.7rem; }
.fc-side-card li.done .fcstat { color: var(--accent); }
.fc-side-all { display: inline-block; margin-top: 10px; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.fc-head { display: grid; gap: 6px; margin-bottom: 18px; }
.fc-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.05; margin: 0; }
.fc-lede { margin: 0; color: var(--muted); }
.fc-links { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.92rem; }
.fc-links a { color: var(--accent); font-weight: 600; }
.fc-on .fc-list { display: none; }
.fc-bar { display: grid; gap: 8px; margin-bottom: 12px; }
.fc-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 700; }
.fc-tracks { display: grid; gap: 4px; }
.fc-track { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; }
.fc-track i { display: block; height: 100%; width: 0; transition: width .25s ease; }
.fc-pos i { background: var(--ink); opacity: .55; }
.fc-got i { background: var(--accent); }
.fc-stage { position: relative; perspective: 1400px; cursor: pointer; outline: none; touch-action: pan-y; transition: transform .18s ease, opacity .18s ease; }
.fc-stage[hidden] { display: none; }
.fc-stage:focus-visible .fc-face { outline: 2px solid var(--accent); outline-offset: 3px; }
.fc-inner { display: grid; transition: transform .45s cubic-bezier(.3,.7,.3,1); transform-style: preserve-3d; }
.fc-face { grid-area: 1 / 1; min-height: 280px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 30px 28px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 34px rgb(15 23 42 / 0.09); backface-visibility: hidden; -webkit-backface-visibility: hidden; text-align: center; overflow-wrap: anywhere; }
.fc-f .fc-front { font-size: 1.35rem; font-weight: 600; line-height: 1.4; }
.fc-f .eyebrow { color: var(--muted); }
.fc-b { transform: rotateY(180deg); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); text-align: left; justify-content: flex-start; font-size: 1.05rem; line-height: 1.55; }
.fc-b p { margin: 0 0 0.6em; }
.fc-b .math-block { background: none; border-left: 2px solid var(--accent); border-radius: 0; padding: 2px 0 2px 14px; margin: 6px 0 10px; }
.fc-stage.flipped .fc-inner { transform: rotateY(180deg); }
.fc-stage.is-known .fc-f::after { content: "Got it ✓"; position: absolute; top: 14px; right: 16px; font: 700 0.72rem/1 var(--mono); color: var(--accent); }
.fc-f { position: relative; }
.fc-tip { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font: 600 0.72rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); pointer-events: none; transition: opacity .2s; }
.fc-stage.flipped .fc-tip { opacity: 0; }
.fc-stage.out-r { transform: translateX(40px) rotate(2deg); opacity: 0; }
.fc-stage.out-l { transform: translateX(-40px) rotate(-2deg); opacity: 0; }
.fc-from { display: inline-block; margin-top: auto; padding-top: 10px; font-size: 0.88rem; font-weight: 600; color: var(--accent); }
.fc-ctr { display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr) 48px; gap: 10px; align-items: center; margin-top: 16px; }
.fc-ctr[hidden] { display: none; }
.fc-ctr .btn { justify-content: center; min-width: 0; padding-inline: 12px; }
.fc-ctr .fc-flip { grid-column: 2 / 4; }
.fc-ctr .fc-again, .fc-ctr .fc-gotit { display: none; }
.is-flipped .fc-ctr .fc-flip { display: none; }
.is-flipped .fc-ctr .fc-again, .is-flipped .fc-ctr .fc-gotit { display: inline-flex; }
.fc-ctr .fc-again { border-color: var(--mark); color: var(--mark); }
.fc-ctr .fc-again:hover { background: color-mix(in srgb, var(--mark) 12%, transparent); }
.fc-nav { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.fc-nav:hover { border-color: var(--accent); color: var(--accent); }
.fc-ctr kbd { margin-left: 6px; padding: 1px 6px; font: 600 0.7rem/1.4 var(--mono); border: 1px solid currentColor; border-radius: 4px; opacity: .6; }
.fc-hint { text-align: center; margin: 10px 0 0; color: var(--muted); }
.fc-hint[hidden] { display: none; }
.fc-hint kbd { padding: 1px 6px; font: 600 0.72rem/1.4 var(--mono); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; }
.fc-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.chipbtn { padding: 7px 12px; font: 600 0.85rem/1 var(--body, inherit); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.chipbtn:hover { border-color: var(--accent); color: var(--accent); }
.chipbtn[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chipbtn.confirm { color: #fff; background: var(--bad); border-color: var(--bad); }
.fc-done { display: grid; gap: 14px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 34px rgb(15 23 42 / 0.09); }
.fc-done[hidden] { display: none; }
.fc-done .eyebrow { margin: 0; }
.fc-done h3 { margin: 4px 0 0; font-size: 1.2rem; }
.fc-score { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.fc-score div { display: grid; gap: 4px; padding: 14px; text-align: center; }
.fc-score div + div { border-left: 1px solid var(--line); }
.fc-score b { font: 700 2rem/1 var(--display); }
.fc-score div:first-child b { color: var(--accent); }
.fc-score div:nth-child(2) b { color: var(--mark); }
.fc-score span { font-size: 0.8rem; color: var(--muted); }
.fc-weak { margin: 0; padding-left: 1.1rem; display: grid; gap: 6px; }
@media (max-width: 600px) {
  .fc-face { min-height: 240px; padding: 24px 18px 36px; }
  .fc-f .fc-front { font-size: 1.2rem; }
  .fc-ctr { grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; }
  .fc-nav { width: 44px; height: 44px; }
  .fc-ctr kbd { display: none; }
  .fc-page .crumbs > span[aria-current] { display: none; }
  .fc-head { margin-bottom: 12px; }
  .fc-lede { display: none; }
  .fc-face { min-height: 210px; }
  body:has(.fc.fc-on) .app-bar, body:has(.fc.fc-on) .app-bar-x { display: none; }
  body:has(.fc.fc-on) .app-bar-space { height: 0; }
  .fc-page .crumbs > span[aria-hidden]:nth-last-child(2) { display: none; }
}

/* ---------------------------------------------------------------- home page */
:root { --olive: #4f5f3a; --olive-soft: #eef0e6; }
:root[data-theme="dark"] { --olive: #9db27a; --olive-soft: #1b2219; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --olive: #9db27a; --olive-soft: #1b2219; } }
body { overflow-x: clip; }
.band { margin-inline: calc(50% - 50vw); padding-inline: calc(50vw - 50%); margin-top: -28px; padding-top: 28px; padding-bottom: 26px;
  background:
    radial-gradient(circle at 1px 1px, rgb(79 95 58 / 0.13) 1px, transparent 1.6px) 0 0 / 22px 22px,
    linear-gradient(180deg, var(--olive-soft), var(--paper));
  border-bottom: 1px solid var(--line); }
.badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.badges li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; font-size: 0.86rem; font-weight: 600; color: var(--olive); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.badges li::before { content: "✓"; font-weight: 800; color: var(--accent); }
.hero-note { margin: -4px 0 0; }
.resume { margin-top: 22px; position: relative; display: grid; gap: 8px; padding: 16px 48px 16px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--olive); border-radius: 12px; }
.resume[hidden] { display: none; }
.resume-main { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; color: var(--ink); text-decoration: none; }
.resume-main .eyebrow { grid-column: 1; }
.resume-main b { grid-column: 1; font: 700 1.3rem/1.2 var(--display); }
.resume-go { grid-column: 2; grid-row: 1 / span 2; font-size: 1.5rem; color: var(--accent); }
.resume-main:hover b { color: var(--accent); }
.resume-more { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; font-size: 0.9rem; }
.resume-more a small { color: var(--muted); margin-right: 6px; font-weight: 600; }
.resume-x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 12px; counter-reset: s; }
.steps a { display: grid; gap: 6px; height: 100%; padding: 18px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.steps a:hover { border-color: var(--accent); }
.steps b { font: 700 1.25rem/1.15 var(--display); }
.steps span:not(.step-n) { color: var(--muted); font-size: 0.93rem; }
.step-n { display: grid; place-items: center; width: 34px; height: 34px; font: 700 1.1rem/1 var(--display); color: #fff; background: var(--olive); border-radius: 50%; }
:root[data-theme="dark"] .step-n { color: #11171d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .step-n { color: #11171d; } }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 8px; }
.group-head h3 { font-size: 1.35rem; }
.group-head p { margin: 0; }
.grid-key { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.tile-key { border-top: 4px solid var(--accent); box-shadow: 0 6px 18px rgb(31 107 87 / 0.08); }
.tile-key h3 { font-size: 1.35rem; }
.tcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 12px; }
.tcard { display: grid; gap: 8px; align-content: start; padding: 20px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.tcard:first-child { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.tcard:hover { border-color: var(--accent); }
.tcard h3 { font-size: 1.45rem; }
.tcard p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.tmeta { display: flex; gap: 14px; font-size: 0.85rem; font-weight: 600; color: var(--ink) !important; }
.tgo { margin-top: 4px; font-weight: 700; color: var(--accent); }
.btns .small { align-self: center; }
.appcta { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 28px; padding: 28px; }
.appcta-copy { display: grid; gap: 12px; }
.app-points { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.92rem; opacity: 0.9; }
.app-points li::before { content: "✓ "; color: #8fcfb6; font-weight: 800; }
/* the app's home screen drawn in HTML (app_phone_html): the app's own blue theme, not the site's */
.phone { width: 236px; padding: 8px; background: #0b1016; border: 1px solid #3a4652; border-radius: 34px; box-shadow: 0 22px 44px rgb(0 0 0 / 0.38); transform: rotate(3deg); }
.ap { display: grid; gap: 7px; padding: 12px 10px 14px; background: #f4f6fb; color: #111827; border-radius: 27px; font: 500 9.5px/1.25 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
.ap svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ap-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; padding: 0 2px 7px; border-bottom: 1px solid #e5e9f2; }
.ap-rank { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #4f5f3a; border: 1.5px solid #e8b923; color: #ffd43b; }
.ap-rank svg { width: 12px; height: 12px; stroke-width: 3; }
.ap-greet { display: grid; gap: 4px; min-width: 0; }
.ap-greet b { font-size: 10.5px; font-weight: 800; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-greet i, .ap-prog i { display: block; height: 3px; border-radius: 3px; background: linear-gradient(90deg, #2563eb var(--p), #dfe4ee var(--p)); }
.ap-greet i { width: 62px; }
.ap-energy { display: flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 99px; background: #eaf0fe; color: #1d4ed8; font-weight: 800; border: 1px solid #d6e1fc; }
.ap-ctrl { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.ap-ctrl span { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 5px 7px; background: #fff; border: 1px solid #e5e9f2; border-radius: 9px; font-weight: 700; }
.ap-ctrl small { color: #6b7280; font-weight: 700; }
.ap-lang img { width: 14px; height: 10px; border-radius: 2px; }
.ap-cont { position: relative; display: grid; gap: 1px; padding: 9px 10px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #1d4ed8, #3b82f6); box-shadow: 0 4px 10px rgb(37 99 235 / 0.3); }
.ap-cont small { font-size: 7px; font-weight: 800; letter-spacing: 0.6px; opacity: 0.85; }
.ap-cont b { font-size: 11px; }
.ap-cont span { opacity: 0.85; }
.ap-cont em { position: absolute; right: 9px; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: rgb(255 255 255 / 0.2); font-style: normal; font-size: 9px; }
.ap-h { margin: 3px 2px 0; font-size: 11.5px; font-weight: 800; }
.ap-topic { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 8px; background: #fff; border: 1px solid #e9edf4; border-radius: 12px; }
.ap-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #e8eefd; color: #2563eb; }
.ap-topic b { display: block; font-size: 9.5px; font-weight: 700; }
.ap-prog { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 5px; margin-top: 4px; }
.ap-prog small { font-size: 7.5px; color: #6b7280; font-weight: 600; }
.ap-prog em { padding: 1px 4px; border-radius: 4px; background: #e8eefd; color: #1d4ed8; font: 800 7px/1.3 inherit; font-style: normal; }
@media (max-width: 720px) { .appcta { grid-template-columns: minmax(0, 1fr); } .phone { margin: 4px auto 0; transform: none; } }
.foot-subs { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.82rem; }

/* ---------------------------------------------------------------- practice test page: all questions at once */
.exam-bar { position: sticky; top: 61px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 20px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 18px rgb(15 23 42 / 0.08); }
.exam-count { font-weight: 700; }
.exam-time { font-weight: 800; font-size: 1.05rem; color: var(--accent); }
.exam-time.low { color: var(--bad); }
.exam-jump { display: flex; flex-wrap: wrap; gap: 4px; }
.exam-jump a { padding: 3px 7px; font: 700 0.75rem/1 var(--mono); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; }
.exam-check { margin-left: auto; padding: 9px 14px; }
.exam-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.exam-sec { scroll-margin-top: 130px; }
.exam .q { scroll-margin-top: 130px; }
.exam.checked .exam-check, .exam.checked [data-timer] { display: none; }
.exam.only-missed article.q:not(.is-wrong), .exam.only-missed .ad { display: none; }
.exam-result { margin-top: 18px; display: grid; gap: 14px; padding: 20px; background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; scroll-margin-top: 130px; }
.exam-result:focus { outline: none; }
.exam-score { display: grid; gap: 2px; }
.exam-score b { font: 700 3rem/1 var(--display); color: var(--accent); }
.exam-result .bar { display: block; width: 100%; min-width: 80px; height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; }
.exam-result .bar i { display: block; height: 100%; background: var(--accent); }
.exam-review { margin: 0; padding-left: 1.2em; }
@media (max-width: 720px) {
  .exam-bar { top: 61px; gap: 6px 12px; padding: 8px 10px; }
  .exam-result td:nth-child(3), .exam-result th:nth-child(3) { display: none; }
  .exam-result { padding: 14px; }
  .exam-jump { display: none; }
  .exam-check { margin-left: 0; width: 100%; justify-content: center; }
}
.mode-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 13px 6px 9px; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 999px; font: 600 0.88rem/1 var(--body); cursor: pointer; transition: border-color .15s, background-color .15s, color .15s; }
.mode-btn:hover { border-color: var(--accent); }
.mode-box { display: grid; place-items: center; width: 20px; height: 20px; flex: none; color: transparent; background: var(--surface); border: 1.5px solid var(--muted); border-radius: 6px; transition: inherit; }
.mode-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.mode-btn[aria-pressed="true"] .mode-box { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.mode-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.exam.checked .mode-btn { display: none; }
.exam-result[hidden] { display: none; }
.opt.wrong { border-width: 1.5px; background: color-mix(in srgb, var(--bad) 7%, transparent); }
.opt.right { border-width: 1.5px; background: color-mix(in srgb, var(--good) 8%, transparent); }

/* ---------------------------------------------------------------- subtest (category) pages */
.band-cat { margin-top: -28px; padding-top: 22px; padding-bottom: 28px; }
.band-cat .crumbs { margin-bottom: 18px; }
.cat-hero { display: grid; gap: 14px; max-width: 52rem; }
.pill { justify-self: start; padding: 5px 10px; font: 700 0.8rem/1 var(--mono); letter-spacing: 0.08em; color: #fff; background: var(--olive); border-radius: 6px; }
:root[data-theme="dark"] .pill { color: #11171d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill { color: #11171d; } }
.cat-hero .lede { margin: 0; max-width: 44rem; }
.badges li.key { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.cat-grid { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 36px; align-items: start; }
.cat-main { min-width: 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.sec-head > * { min-width: 0; max-width: 100%; }
.lcards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lcard a { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 16px 18px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.lcard a:hover { border-color: var(--accent); box-shadow: 0 6px 16px rgb(15 23 42 / 0.06); }
.lnum { display: grid; place-items: center; width: 3rem; height: 3rem; font: 700 1.2rem/1 var(--display); color: var(--olive); background: var(--olive-soft); border-radius: 10px; }
.lbody { display: grid; gap: 5px; min-width: 0; }
.lbody b { font: 700 1.25rem/1.15 var(--display); }
.lcard a:hover b { color: var(--accent); }
.lobj { color: var(--muted); font-size: 0.9rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lstats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.lseen { visibility: hidden; display: grid; place-items: center; width: 26px; height: 26px; font-size: 0.85rem; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 50%; }
.lcard.seen .lseen { visibility: visible; }
.lcard.seen .lnum { color: var(--accent-ink); background: var(--accent); }
.cprog { display: grid; gap: 6px; }
.cprog[hidden] { display: none; }
.cprog-top { margin: -4px 0 4px; }
.cprog-bar { height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; }
.cprog-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.tchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.tchip { display: grid; gap: 4px; justify-items: center; padding: 14px 8px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.tchip b { font: 700 1.8rem/1 var(--display); color: var(--accent); }
.tchip:hover { border-color: var(--accent); background: var(--accent-soft); }
.about-cat .prose { color: var(--muted); }
.cat-aside { position: sticky; top: 84px; padding-top: 34px; }
.aside-card { display: grid; gap: 12px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--olive); border-radius: 12px; }
.aside-card h2 { font-size: 1.6rem; }
.aside-card h3 { font-size: 1.1rem; margin-top: 4px; }
.aside-card .eyebrow { margin: 0; }
.glance { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.glance div { padding: 10px; background: var(--paper); border-radius: 8px; }
.glance dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.glance dd { margin: 2px 0 0; font-weight: 700; }
.traps { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: 0.9rem; }
.traps a { color: var(--ink); }
.traps a:hover { color: var(--accent); }
.aside-links { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
@media (max-width: 960px) {
  .cat-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cat-aside { position: static; padding-top: 8px; }
}
@media (max-width: 720px) {
  .lcard a { grid-template-columns: 2.4rem minmax(0, 1fr); gap: 12px; padding: 14px; }
  .lnum { width: 2.4rem; height: 2.4rem; font-size: 1rem; }
  .lseen { display: none; }
  .lbody b { font-size: 1.12rem; }
  .cat-hero .btns .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---- lesson page v1.185: lighter formulas, next steps, mobile reading bar ---- */
.lesson .math-block { background: none; border-left: 2px solid var(--line); border-radius: 0; padding: 4px 0 4px 16px; }
.lhead .lede { margin: 0; }
.nsteps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.nstep { display: grid; gap: 4px; align-content: start; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; background: var(--surface); transition: border-color .15s, transform .15s; }
.nstep:hover { border-color: var(--accent); transform: translateY(-1px); }
.nstep b { font-size: 1.05rem; line-height: 1.3; }
.nstep span:not(.eyebrow) { color: var(--muted); font-size: 0.9rem; }
.nstep.primary { border: 2px solid var(--accent); background: var(--accent-soft); }
.prev-link { display: inline-block; margin-top: 14px; color: var(--muted); font-size: 0.9rem; }
.narration { margin-top: 24px; }
.about-lesson .prose { color: var(--muted); }
.rbar { display: none; }
@media (max-width: 960px) {
  .rbar { display: flex; align-items: center; gap: 10px; position: fixed; left: 0; right: 0; top: 61px; z-index: 40; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); transform: translateY(-120%); opacity: 0; visibility: hidden; transition: transform .2s, opacity .2s, visibility .2s; font-size: 0.875rem; }
  .rbar.on { transform: none; opacity: 1; visibility: visible; }
  .rbar .rb-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
  .rbar button { flex: none; border: 1px solid var(--line); background: none; color: inherit; border-radius: 999px; padding: 4px 12px; font: inherit; cursor: pointer; }
  .rbar .rb-p { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--accent); width: 0; }
  .rb-menu { position: fixed; left: 8px; right: 8px; top: 112px; z-index: 41; max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
  .rb-menu[hidden] { display: none; }
  .rb-menu a { display: block; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
  .rb-menu a.cur { background: var(--accent-soft); font-weight: 600; }
  .lsec { scroll-margin-top: 112px; }
}

/* ---- lessons index: subtest cards grouped (start / AFQT / technical / finish) ---- */
.scards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.scard.wide { grid-column: 1 / -1; }
.scard a { position: relative; height: 100%; box-sizing: border-box; display: grid; gap: 8px; align-content: start; padding: 18px 20px 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.scard a:hover { border-color: var(--accent); box-shadow: 0 8px 20px rgb(15 23 42 / 0.07); transform: translateY(-2px); }
.scard-top { display: flex; align-items: center; gap: 8px; }
.stag { font: 600 0.72rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.stag.key { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.scard h3 { font-size: 1.4rem; margin: 2px 0 0; padding-right: 28px; }
.scard a:hover h3 { color: var(--accent); }
.scard p { margin: 0; color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.smeta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }
.sprog { display: grid; gap: 4px; margin-top: 4px; }
.sprog[hidden] { display: none; }
.sgo { position: absolute; top: 16px; right: 18px; font-size: 1.2rem; color: var(--muted); transition: transform .15s, color .15s; }
.scard a:hover .sgo { color: var(--accent); transform: translateX(3px); }
.scard.wide a { grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; }
.scard.wide a > * { grid-column: 2; }
.scard.wide .scard-top { grid-column: 1; grid-row: 1 / span 4; align-self: start; flex-direction: column; align-items: flex-start; }
.scard.done .sgo::after { content: " ✓"; color: var(--accent); }
.cprog-all { max-width: 28rem; }
@media (max-width: 600px) {
  .scard.wide a { grid-template-columns: 1fr; }
  .scard.wide a > *, .scard.wide .scard-top { grid-column: 1; grid-row: auto; flex-direction: row; align-items: center; }
}

/* ---- practice tests index: subtest rows ---- */
.srows { display: grid; gap: 12px; }
.srow { display: grid; gap: 12px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.srow-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.srow-h b { font: 700 1.2rem/1.2 var(--display); }
.srow-h .small { margin-left: auto; font-family: var(--mono); }
.srow .tchips { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.srow .tchip { padding: 10px 6px; }
.srow .tchip b { font-size: 1.4rem; }
.tcard .small { margin-top: auto; font-family: var(--mono); }

/* ---- word list: sticky search + letters ---- */
.wtools { position: sticky; top: 61px; z-index: 30; display: grid; gap: 10px; margin: 22px calc(50% - 50vw) 0; padding: 12px calc(50vw - 50%); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
@media (min-width: 961px) { .wtools { top: 61px; } }
.wsearch input { width: 100%; max-width: 26rem; box-sizing: border-box; padding: 10px 14px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.wsearch input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.wtools .jump { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.wtools .jump a { flex: none; background: var(--surface); }
.wcount { margin: 0; }
.wcount:empty { display: none; }
.word[hidden], .words-sec[hidden], section[id^="letter-"][hidden] { display: none; }
.wl-searching .ad, .wl-searching [data-wl-extra] { display: none; }
.wtools .jump a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.wtools .jump a.off { opacity: 0.35; pointer-events: none; }
.wtools .jump.more-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.wtools .jump.more-l.more-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.wtools .jump.more-l:not(.more-r) { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.totop { position: fixed; right: 18px; bottom: 22px; z-index: 40; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.14); }
.totop[hidden] { display: none; }
.totop:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 600px) {
  .wtools { gap: 8px; padding-block: 8px; }
  .wsearch input { padding: 8px 14px; font-size: 16px; }
  .wtools .jump a { padding: 7px 9px; font-size: 0.85rem; }
  #main section[id^="letter-"] { scroll-margin-top: 172px; }
  .totop { bottom: 92px; right: 14px; }
}

#main section[id^="letter-"] { scroll-margin-top: 190px; }

/* ---- practice tests index: one card per test ---- */
.band-slim { padding-bottom: 22px; }
.sec-intro { margin: -4px 0 14px; color: var(--muted); max-width: 48rem; }
.xcards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.xcard a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; height: 100%; box-sizing: border-box; padding: 14px 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.xcard a:hover { border-color: var(--accent); box-shadow: 0 6px 16px rgb(15 23 42 / 0.07); transform: translateY(-1px); }
.xicon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.xcard-full_practice .xicon { color: var(--olive); background: var(--olive-soft); }
.xcard-afqt_practice .xicon { color: var(--mark); background: color-mix(in srgb, var(--mark) 14%, transparent); }
.xbody { display: grid; gap: 4px; min-width: 0; }
.xbody b { font-weight: 650; line-height: 1.3; }
.xcard a:hover .xbody b { color: var(--accent); }
.xmeta { display: flex; flex-wrap: wrap; gap: 2px 12px; font: 500 0.78rem/1.3 var(--mono); color: var(--muted); }
.xgo { display: grid; justify-items: end; gap: 4px; }
.xbtn { padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: var(--accent); border: 1.5px solid var(--accent); white-space: nowrap; }
.xcard a:hover .xbtn { color: var(--accent-ink); background: var(--accent); }
.xscore { font: 700 0.75rem/1 var(--mono); color: var(--accent); white-space: nowrap; }
.xscore[hidden] { display: none; }
.xcard.done a { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.xcard.done .xicon { color: var(--accent-ink); background: var(--accent); }
.xcard.done .xbtn { color: var(--muted); border-color: var(--line); }
.xacc { display: grid; gap: 10px; }
.xgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; scroll-margin-top: 80px; }
.xgroup[open] { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.xgroup summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 14px 16px; cursor: pointer; border-radius: 12px; }
.xgroup summary::-webkit-details-marker { display: none; }
.xgroup summary:hover b { color: var(--accent); }
.xgroup summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.xgroup summary b { font: 700 1.2rem/1.2 var(--display); }
.xsum { margin-left: auto; font: 500 0.8rem/1.3 var(--mono); color: var(--muted); }
.xchev { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); position: relative; transition: transform .2s; }
.xchev::before { content: ""; position: absolute; left: 50%; top: 45%; width: 7px; height: 7px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translate(-50%, -50%) rotate(45deg); }
.xgroup[open] .xchev { transform: rotate(180deg); }
.xgroup-body { display: grid; gap: 12px; }
.xgroup-body { padding: 0 16px 14px; }
.xgroup-body .xcards { display: block; border-top: 1px solid var(--line); }
.xgroup-body .xcard + .xcard { border-top: 1px solid var(--line); }
.xgroup-body .xcard a { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; padding: 11px 6px; background: none; border: 0; border-radius: 0; box-shadow: none; transform: none; }
.xgroup-body .xcard a:hover { background: var(--accent-soft); box-shadow: none; transform: none; }
.xgroup-body .xicon { width: 30px; height: 30px; border-radius: 8px; font: 700 0.85rem/1 var(--mono); }
.xgroup-body .xbody { grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 14px; }
.xgroup-body .xgo { grid-auto-flow: column; align-items: center; gap: 12px; }
.xgroup-body .xbtn { padding: 4px 10px; font-size: 0.8rem; }
@media (max-width: 480px) { .xgroup-body .xcard a { grid-template-columns: auto minmax(0, 1fr) auto; } .xgroup-body .xbody { grid-auto-flow: row; gap: 2px; } .xgroup-body .xgo { grid-column: auto; } .xgroup-body .xscore { display: none; } }
.xlesson { justify-self: start; font-size: 0.9rem; color: var(--accent); }
@media (max-width: 600px) { .xsum { margin-left: 0; order: 5; flex-basis: 100%; } .xchev { margin-left: auto; } }
@media (max-width: 480px) { .xcard a { grid-template-columns: auto minmax(0, 1fr); } .xgo { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; align-items: center; } }

/* ---- flashcards index: vocabulary card, accordion of decks with progress, search ---- */
.fc-vocab { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 28px; align-items: center; padding: 22px 24px; border: 2px solid var(--accent); border-radius: 16px; background: linear-gradient(120deg, var(--accent-soft), var(--surface) 70%); }
.fc-vocab h2 { margin: 4px 0 6px; font-size: 1.7rem; }
.fc-vocab p { margin: 0; color: var(--muted); max-width: 40rem; }
.fc-vocab .btns { flex-direction: column; }
.fc-prog, .fcgprog { display: grid; grid-template-columns: minmax(80px, 160px) auto; align-items: center; gap: 10px; margin-top: 10px; }
.fc-prog[hidden], .fcgprog[hidden] { display: none; }
.fcgprog { margin: 0 0 0 auto; grid-template-columns: 90px auto; }
.xsum + .fcgprog { margin-left: 12px; }
.fcgroup .xchev { margin-left: 12px; }
@media (max-width: 600px) { .fcgroup .xchev { margin-left: auto; } }
.fcsearch input { max-width: 16rem; padding: 8px 14px; }
.fccount { margin: -6px 0 10px; }
.fccount:empty { display: none; }
.fcrows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.fcrow + .fcrow { border-top: 1px solid var(--line); }
.fcrow[hidden], .fcgroup[hidden] { display: none; }
.fcrow a { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 6px; color: var(--ink); text-decoration: none; }
.fcrow a:hover { background: var(--accent-soft); }
.fcrow a:hover .xbtn { color: var(--accent-ink); background: var(--accent); }
.fcnum { font: 700 0.85rem/1 var(--mono); color: var(--muted); text-align: center; padding: 7px 0; border-radius: 8px; background: var(--paper); }
.fcname { font-weight: 600; line-height: 1.3; }
.fcstat { font: 600 0.78rem/1 var(--mono); color: var(--muted); white-space: nowrap; }
.fcrow.part .fcstat { color: var(--mark); }
.fcrow.done .fcstat { color: var(--accent); }
.fcrow.done .fcnum { color: var(--accent-ink); background: var(--accent); }
.fcmix { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 2px 0 12px; padding: 12px 14px; color: var(--ink); text-decoration: none; border: 1px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); }
.fcmix .ficon { width: 34px; height: 34px; border-radius: 10px; }
.fcmix b { display: block; }
.fcmix .small { color: var(--muted); }
.fcmix:hover .xbtn { color: var(--accent-ink); background: var(--accent); }
.fc-resume { margin-top: 22px; }
@media (max-width: 700px) {
  .fc-vocab { grid-template-columns: 1fr; }
  .fc-vocab .btns { flex-direction: row; }
  .fcgprog { margin-left: 0; order: 6; flex-basis: 100%; grid-template-columns: 1fr auto; }
  .fcsearch { flex-basis: 100%; }
  .fcsearch input { max-width: none; }
  .fcrow a { grid-template-columns: 2.2rem minmax(0, 1fr) auto; }
  .fcrow .xbtn { display: none; }
}
.fcmix[hidden] { display: none; }

/* ---------------------------------------------------------------- lesson test page */
.qz-layout { display: grid; gap: 40px; }
.qz-side { display: none; }
@media (min-width: 961px) {
  .qz-layout { grid-template-columns: minmax(0, 46rem) 300px; justify-content: space-between; align-items: start; }
  .qz-side { display: grid; gap: 16px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; margin-top: 34px; }
  .qz-side .ad { margin: 0; min-height: 250px; }
  .qz-mbar { display: none !important; }
}
.qz-prog { display: grid; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 14px; }
.qz-prog .eyebrow, .qz-prog p { margin: 0; }
.qz-row { display: flex; align-items: baseline; gap: 8px; }
.qz-row b { font: 700 2rem/1 var(--display); color: var(--accent); }
.qz-bar { display: block; height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; }
.qz-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 9px; transition: width .3s; }
.qz-prog .linkbtn { justify-self: start; font-size: 0.85rem; }
.qz-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.qz-links li a { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.qz-links li a .eyebrow { margin: 0; font-size: 0.66rem; }
.qz-links li a:hover { background: var(--accent-soft); color: var(--accent); }
.qz-mbar { position: sticky; top: 61px; z-index: 20; display: none; align-items: center; gap: 12px; margin: 0 calc(50% - 50vw); padding: 8px calc(50vw - 50%); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); font-size: 0.85rem; font-weight: 600; }
.qz-mbar.on { display: flex; }
.qz-mbar .qz-bar { flex: 1; height: 6px; }
.qz-mbar > span:first-child { flex: none; }
.qz-pool { scroll-margin-top: 80px; }
.qz-pool > .exam-sec-head h2 { margin: 0; }
.qz-done { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; padding: 22px; background: var(--surface); border: 2px solid var(--accent); border-radius: 16px; }
.qz-done[hidden] { display: none; }
.qz-done:focus { outline: none; }
.qz-done h3 { margin: 2px 0 4px; font: 700 1.5rem/1.15 var(--display); }
.qz-done p { margin: 0; }
.qz-done .btns { margin-top: 14px; }
.qz-done .linkbtn { margin-top: 10px; font-size: 0.88rem; }
.qz-ring { --p: 0; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--bad) calc(var(--p) * 1%), var(--line) 0); }
.qz-done.good .qz-ring { background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); }
.qz-ring b { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font: 700 1.7rem/1 var(--display); }
@media (max-width: 600px) {
  .qz-done { grid-template-columns: 1fr; justify-items: start; padding: 18px; }
  .qz-ring { width: 92px; height: 92px; } .qz-ring b { width: 72px; height: 72px; font-size: 1.4rem; }
  .qz-done .btns .btn { flex: 1 1 100%; justify-content: center; }
}
.menu-lang { display: none !important; }

/* ---------------------------------------------------------------- practice test page */
.secgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); gap: 8px; max-width: 52rem; }
.secgrid a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 10px; align-items: center; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.secgrid a:hover { border-color: var(--accent); }
.secgrid b { grid-row: span 2; font: 700 0.8rem/1 var(--mono); color: var(--accent); background: var(--accent-soft); padding: 6px 7px; border-radius: 6px; }
.secgrid span { font-size: 0.86rem; font-weight: 600; line-height: 1.2; }
.secgrid small { font-size: 0.74rem; color: var(--muted); }
.exam-how { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 28px; scroll-margin-top: 80px; }
.exam-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; counter-reset: es; font-size: 0.9rem; color: var(--muted); }
.exam-steps li { counter-increment: es; display: flex; gap: 8px; align-items: baseline; max-width: 24rem; }
.exam-steps li::before { content: counter(es); flex: none; width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--paper); font: 700 0.75rem/1 var(--mono); transform: translateY(-1px); }
.exam-steps b { color: var(--ink); }
.exam-prog { display: grid; gap: 5px; min-width: 9.5rem; }
.exam-pbar { display: block; height: 5px; background: var(--line); border-radius: 9px; overflow: hidden; }
.exam-pbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.exam.checked .exam-pbar { display: none; }
.exam-timer { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.exam-timer:hover span { text-decoration: underline; }
.exam .q.flash { box-shadow: 0 0 0 3px var(--accent); transition: box-shadow .3s; }
@media (max-width: 600px) {
  .exam-bar { flex-wrap: nowrap; gap: 10px; padding: 8px 10px; }
  .exam-prog { min-width: 0; flex: 1; }
  .exam-count { font-size: 0.85rem; }
  .exam-timer span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .exam-timer { width: 38px; height: 38px; justify-content: center; border: 1px solid var(--line); border-radius: 50%; flex: none; }
  .exam-time { font-size: 0.92rem; flex: none; }
  .exam-check { width: auto !important; flex: none; padding: 9px 12px; font-size: 0.9rem; }
  .exam-steps { font-size: 0.85rem; }
}
/* result */
.exam-result { gap: 22px; padding: 24px; border-width: 2px; border-radius: 16px; }
.rs-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; }
.rs-sum h2 { margin: 2px 0 4px; font-size: 1.7rem; }
.rs-sum p { margin: 0; }
.rs-sum .small { margin-top: 4px; }
.rs-block h3 { margin: 0 0 10px; }
.rs-subs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 8px; }
.rs-subs li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.rs-code { font: 700 0.75rem/1 var(--mono); padding: 5px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.rs-subs li.low .rs-code { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.rs-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-bar { grid-column: 1 / -1; height: 7px; background: var(--line); border-radius: 9px; overflow: hidden; }
.rs-bar i { display: block; height: 100%; background: var(--accent); }
.rs-subs li.low .rs-bar i { background: var(--bad); }
.rs-num { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); }
.rs-review { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rs-review a { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; background: var(--paper); }
.rs-review a:hover { border-color: var(--accent); }
.rv-n { display: grid; place-items: center; height: 2.2rem; border-radius: 8px; background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); font: 700 1rem/1 var(--mono); }
.rv-t { font-weight: 600; }
.rv-m { font-size: 0.8rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
@media (max-width: 600px) {
  .exam-result { padding: 16px; }
  .rs-top { grid-template-columns: 1fr; justify-items: start; gap: 14px; }
  .rs-review a { grid-template-columns: 2.2rem minmax(0, 1fr); }
  .rv-m { grid-column: 2; }
  .exam-result .btns .btn { flex: 1 1 100%; justify-content: center; }
}
/* in-page dialog */
.dlg { max-width: min(28rem, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / 0.3); }
.dlg::backdrop { background: rgb(10 20 16 / 0.45); backdrop-filter: blur(2px); }
.dlg h2 { margin: 0 0 8px; font-size: 1.4rem; }
.dlg p { margin: 0 0 18px; color: var(--muted); }
.dlg .btns .btn { flex: 1 1 auto; justify-content: center; }
@media (max-width: 600px) {
  .exam-bar .ex-l { display: none; }
  .exam-count { font-size: 0.95rem; white-space: nowrap; }
  .exam-prog { flex: 0 1 auto; min-width: 4.5rem; }
  .exam-time { font-size: 0.85rem; white-space: nowrap; margin-left: auto; }
  .exam-timer { margin-left: auto; }
  .exam-time:not([hidden]) + .exam-timer { margin-left: 0; }
  .exam-check { margin-left: 0 !important; }
  .exam.checked .exam-time { margin-left: auto; }
}
.cat-hero { grid-template-columns: minmax(0, 1fr); }
.cat-hero > * { min-width: 0; }
@media (max-width: 600px) {
  .secgrid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .secgrid a { padding: 7px 9px; gap: 0 8px; }
  .secgrid span { font-size: 0.8rem; }
  .rs-subs li { grid-template-columns: auto minmax(0, 1fr) auto; padding: 9px 10px; gap: 6px 8px; }
  .rs-num { grid-column: 3; grid-row: 1; }
  .rs-bar { grid-row: 2; }
}
.exam-check { gap: 0; } .exam-check .ex-l { padding-left: .28em; }
