/* GED Prep — design system
   Warm paper background, deep ink text, one amber brand accent; each subject brings its own
   colour through --sc. Light and dark themes share the same tokens. */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --ink: #16202e;
  --ink-2: #4a5566;
  --muted: #5f6878;
  --line: #e3dfd5;
  --line-2: #d4cfc3;
  /* border of answer controls (choices, blanks): their only visible edge, so 3:1 against the surface */
  --ctl: #8c8577;
  /* text on a solid --good / --bad fill */
  --on-state: #fff;
  --brand: #14213d;
  --accent: #ffb703;
  --focus: #2f6feb;
  --good: #17722f;
  --good-bg: #e6f4ea;
  --bad: #c42b1c;
  --bad-bg: #fdecea;
  --warn: #8a5c00;
  --warn-bg: #fff4d6;
  --sc: #2f6feb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 14px rgba(20, 33, 61, .06);
  --shadow-lg: 0 10px 40px rgba(20, 33, 61, .16);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-read: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1520; --surface: #171f2c; --surface-2: #1d2736; --ink: #e8ecf2; --ink-2: #c1c9d6; --muted: #8e99aa;
    --line: #273244; --line-2: #34415a; --ctl: #5f7090; --on-state: #0f1520; --brand: #e8ecf2; --focus: #79a6ff;
    --good: #4cc26f; --good-bg: #13301e; --bad: #ff7b6e; --bad-bg: #3a1a17; --warn: #e7b84a; --warn-bg: #352a0f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
/* Same tokens as the block above (CSS can't share one declaration between a media query and a
   selector). Keep the two in sync. */
:root[data-theme="dark"] {
  --bg: #0f1520; --surface: #171f2c; --surface-2: #1d2736; --ink: #e8ecf2; --ink-2: #c1c9d6; --muted: #8e99aa;
  --line: #273244; --line-2: #34415a; --ctl: #5f7090; --on-state: #0f1520; --brand: #e8ecf2; --focus: #79a6ff;
  --good: #4cc26f; --good-bg: #13301e; --bad: #ff7b6e; --bad-bg: #3a1a17; --warn: #e7b84a; --warn-bg: #352a0f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* Subject tints. A custom property that uses var() is resolved where it is declared, so these
   must be re-declared wherever --sc changes (inline style="--sc:…"), not only on :root.
   --sc-ink is the subject colour pulled toward the text colour, readable (4.5:1+) on --sc-soft. */
:root, [style*="--sc"], [class*="gl-s-"] {
  --sc-soft: color-mix(in srgb, var(--sc) 12%, var(--surface));
  --sc-ink: color-mix(in srgb, var(--sc) 55%, var(--ink));
  /* bars, rings, underlines: pulled slightly toward the text colour so even light subject colours
     (Social Studies amber) keep 3:1 against the page and the track in both themes */
  --sc-line: color-mix(in srgb, var(--sc) 78%, var(--ink));
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--sc); }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem); letter-spacing: -.025em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.page { padding: 28px 0 64px; min-height: 70vh; }
/* pages that open with a breadcrumb: keep it close to the site header */
.page:has(> .crumbs:first-child) { padding-top: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--brand); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.d-block { display: block; }
.big { font-size: 2rem; font-weight: 800; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap-row { flex-wrap: wrap; }
.between { justify-content: space-between; }
.truncate { display: inline-block; vertical-align: bottom; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(40ch, 100%); }
.lead { font-size: 1.1rem; color: var(--ink-2); max-width: 62ch; }
/* --sc-ink, not --sc: the plain subject colour is under 4.5:1 for small text on the page background */
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sc-ink); margin: 0 0 .4em; }
.code { font-family: var(--mono); font-size: .78em; color: var(--muted); font-weight: 600; }
.section-title { margin-top: 2.2em; }

/* ------------------------------------------------------------ header */
.site-head { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
/* logo left, tools right, the links centred in the space between the two */
.head-row { display: flex; align-items: center; gap: 20px; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; font-size: 1.08rem; color: var(--ink); }
.brand:hover { color: var(--ink); }
/* the whole logo on its white tile (white in dark mode too, like the app icon), with a thin edge on light pages */
.brand-logo { display: block; flex: none; width: 46px; height: 46px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line-2); }
.brand-free { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--accent); color: #14213d; padding: 2px 6px; border-radius: 5px; }
.top-nav { flex: 1 1 auto; display: flex; justify-content: center; gap: 4px; }
.top-nav a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .95rem; padding: 7px 12px; border-radius: 9px; }
.top-nav a:hover { background: var(--surface-2); color: var(--ink); }
.top-nav a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.head-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); text-decoration: none; font-weight: 600; font-size: .85rem; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--ink-2); }

/* the phone menu (header, top right) and the phone app bar (bottom): hidden on wider screens */
.menu { display: none; position: relative; }
.menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: .85rem; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: var(--ink-2); }
.menu > nav { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; display: grid; min-width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.menu > nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 700; }
.menu > nav a:hover { background: var(--surface-2); }
.menu > nav a[aria-current] { background: var(--sc-soft, var(--surface-2)); }
.menu > nav a svg { color: var(--muted); flex: none; }
.menu > nav .menu-sub { min-height: 38px; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.menu > nav .menu-sub:first-of-type { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: 4px; }
.menu .menu-lang { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; margin-top: 4px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: 700 .95rem var(--font); text-align: left; cursor: pointer; }
.menu .menu-lang img { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; }
.app-bar, .app-bar-x, .app-bar-space { display: none; }
html.app-bar-off .app-bar, html.app-bar-off .app-bar-x, html.app-bar-off .app-bar-space { display: none !important; }

/* ------------------------------------------------------------ footer */
/* brand + promise on the left, link columns on the right; a thin bottom row with © and the trademark notice */
.site-foot { margin-top: 48px; border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .92rem; }
.foot-top { display: grid; grid-template-columns: minmax(240px, 1.1fr) 2.4fr; gap: 40px; padding: 40px 0 32px; }
.foot-brand { display: grid; gap: 14px; align-content: start; }
.foot-brand > p { margin: 0; max-width: 34ch; line-height: 1.55; }
.foot-badges { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.foot-badges li { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--good-bg); color: var(--good); font-size: .78rem; font-weight: 700; }
.foot-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.foot-col h2 { margin: 0 0 12px; font-size: .74rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.foot-col a { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.foot-col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.foot-col a[aria-current] { color: var(--ink); }
.foot-col a[aria-current]::after { content: "✓"; font-size: .8em; color: var(--good); }
.foot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sc-line); flex: none; }
.foot-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 32px; flex-wrap: wrap; padding: 18px 0 28px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.foot-bottom p { margin: 0; }
.foot-tm { max-width: 72ch; }
/* ------------------------------------------------------------ Android app promotion */
.app-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--brand); color: var(--bg); text-decoration: none; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.app-btn:hover { color: var(--bg); filter: brightness(1.12); }
@media (max-width: 1100px) { .app-btn-label { display: none; } .app-btn { width: 36px; padding: 0; justify-content: center; } }
/* Google Play button: the store's own look (black in both themes) */
.play-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 16px 6px 12px; border-radius: 10px; background: #000; color: #fff; border: 1px solid #5f6368; text-decoration: none; line-height: 1.1; white-space: nowrap; }
.play-btn:hover { color: #fff; background: #1f1f1f; }
.play-btn span { display: grid; }
.play-btn small { font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.play-btn b { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.app-card { display: grid; gap: 12px; margin-top: 6px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.app-card h2 { margin: 0 0 4px; font-size: 1rem; color: var(--ink); }
.app-card p { margin: 0; font-size: .86rem; line-height: 1.5; }
.app-card .play-btn { justify-self: start; }
@media (max-width: 860px) {
  .foot-top { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; }
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 16px; }
}

/* ------------------------------------------------------------ buttons, pills, inputs */
.btn { --b: var(--brand); display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 11px; border: 1px solid transparent;
  font: 700 .95rem/1 var(--font); text-decoration: none; cursor: pointer; background: var(--surface-2); color: var(--ink); transition: transform .05s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { color: var(--ink); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--bg); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 85%, var(--sc)); color: var(--bg); }
.btn.soft { background: var(--sc-soft); color: var(--sc-ink); }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.input { min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); color: var(--ink); font: inherit; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.note { font-size: .88rem; color: var(--ink-2); background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel.empty { text-align: center; padding: 48px 22px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }

.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.meter i { display: block; height: 100%; background: var(--sc-line); border-radius: inherit; min-width: 4px; transition: width .4s; }
.meter.thin { height: 5px; margin: 6px 0 0; max-width: 220px; }

.ring { --p: 0; position: relative; flex: none; width: 104px; height: 104px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79%), conic-gradient(var(--sc-line) calc(var(--p) * 1%), var(--line) 0); }
.ring span { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.ring small { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 4px; }
.ring.big { width: 150px; height: 150px; }
.ring.big span { font-size: 2.4rem; }

.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* round back button at the start of the breadcrumb: an arrow only (its name is in aria-label) */
.back-btn { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; margin-right: 4px; border-radius: 50%;
  background: #fff; color: #16202e; border: 1px solid var(--line-2); box-shadow: var(--shadow); text-decoration: none; }
.back-btn:hover { color: #16202e; border-color: #16202e; transform: translateX(-1px); }
.back-btn svg { display: block; }
.crumbs a { text-decoration: none; }
/* the current page (a lesson title can be long): one line, cut with an ellipsis */
.crumb-cur { min-width: 0; max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover { text-decoration: underline; }

/* overflow-y hidden: the active tab's 1px overlap (margin-bottom: -1px) would otherwise add a vertical scrollbar */
/* padding-top: room for the 3px focus ring, which overflow would otherwise cut off; narrow phones: the tabs wrap
   instead of scrolling out of sight */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 22px; padding-top: 6px; }
.tabs a { text-decoration: none; padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--sc-line); }
.tabs a:hover { color: var(--ink); }

/* ------------------------------------------------------------ home */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: center; padding: 36px; border-radius: 22px; margin-bottom: 8px;
  background: linear-gradient(135deg, #14213d 0%, #1f3563 60%, #28407a 100%); color: #f4f1ea; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 183, 3, .35), transparent 70%); pointer-events: none; z-index: 0; }
.hero-text { position: relative; z-index: 1; min-width: 0; }
.hero :focus-visible { outline-color: #fff; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero .eyebrow { color: var(--accent); }
.hero .lead { color: #d3dae6; }
.hero .btn.primary { background: var(--accent); color: #14213d; }
.hero .btn.primary:hover { background: #ffc933; }
.hero .muted { color: #aab4c6; }
.hero-stats { display: grid; gap: 10px; margin: 0; position: relative; z-index: 1; }
.hero-stats div { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: baseline; }
.hero-stats dt { font-size: .85rem; color: #c3cbd9; }
.hero-stats dd { margin: 0; font-size: 1.6rem; font-weight: 800; }
.hero-stats.wide { grid-template-columns: repeat(4, 1fr); margin: 18px 0 24px; }
.hero-stats.wide div { background: var(--surface); border-color: var(--line); flex-direction: column; box-shadow: var(--shadow); }
.hero-stats.wide dt { color: var(--muted); }

.subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.subject-card { position: relative; display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: var(--shadow); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.subject-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--sc); }
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.subject-card h3 { font-size: 1.2rem; margin-top: 6px; }
.subject-card p { color: var(--ink-2); font-size: .93rem; }
.subject-code { display: inline-block; font: 800 .72rem/1 var(--mono); letter-spacing: .06em; color: var(--sc-ink); background: var(--sc-soft); padding: 5px 8px; border-radius: 6px; }

.diag { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; flex-wrap: wrap; }
.diag h2 { margin-bottom: .2em; }
.diag p { margin: 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.step { padding: 4px 4px; }
.step-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #14213d; font-weight: 800; margin-bottom: 10px; }
.step p { color: var(--ink-2); font-size: .95rem; }
.steps-wrap { margin-top: 32px; }
.steps-wrap .steps { margin-top: 12px; list-style: none; padding: 0; }

.faq { max-width: 820px; }
.faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; box-shadow: var(--shadow); }
.faq-item summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; font-weight: 700; cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; flex: none; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { color: var(--sc); }
.faq-item p { margin: 0; padding: 0 18px 16px; color: var(--ink-2); }

/* ------------------------------------------------------------ subject */
.subject-head { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.subject-head-text { min-width: 0; }
.subject-head h1 { margin-top: 10px; }
/* below the subject head, which now ends with the "Practice tests" button: a real gap (a negative margin put the
   chips over the button's lower edge) */
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 26px; }
.jump .chip { height: auto; min-height: 32px; padding: 4px 11px; font-size: .8rem; color: var(--ink-2); }
.jump .chip:hover { color: var(--ink); border-color: var(--sc-line); }
.jump .code { margin-right: 2px; }
.tree-node.depth-0 { margin-bottom: 34px; }
.tree-node.depth-0 > .tree-title { font-size: 1.3rem; padding-bottom: 10px; border-bottom: 2px solid var(--sc-line); }
/* sub-domain labels: small caps so they don't read like another skill name */
.tree-node.depth-1 > .tree-title { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 8px; }
.tree-node.depth-1 > .tree-title .code { color: var(--sc-ink); font-size: 1em; }
.tree-title .code { margin-right: 4px; }
.skill-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.skill-row { border-bottom: 1px solid var(--line); }
.skill-row:last-child { border-bottom: 0; }
/* the whole card is one link */
.skill-link { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 18px; text-decoration: none; color: inherit; transition: background .15s; }
.skill-link:hover { background: var(--sc-soft); color: inherit; }
.skill-link:hover .skill-name { color: var(--sc-ink); }
.skill-link:focus-visible { outline-offset: -3px; }
.skill-main { display: block; min-width: 0; }
.skill-name { display: block; font-weight: 650; }
.skill-meta { display: block; font-size: .82rem; color: var(--muted); }
.skill-main .meter { display: block; }
.skill-go { flex: none; font-size: 1.5rem; line-height: 1; color: var(--muted); transition: transform .15s; }
.skill-link:hover .skill-go { transform: translateX(3px); color: var(--sc-ink); }
.subject-head-text .btn { margin-top: 4px; }

.tests-section { margin-top: 48px; padding-top: 26px; border-top: 2px solid var(--sc-line); }
.tests-title { font-size: 1.5rem; margin-bottom: 18px; }
.done-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--good); color: var(--surface); font-size: .7rem; }

.test-group { margin-bottom: 28px; }
.test-group h3 { margin-bottom: .2em; }
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.test-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s; }
.test-card:hover { border-color: var(--sc); color: inherit; }
.test-card.is-done { border-left: 4px solid var(--good); }
.test-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ------------------------------------------------------------ lesson */
.lesson-head { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 40px; align-items: start; }
.lesson-toc { position: sticky; top: 86px; font-size: .88rem; max-height: calc(100vh - 100px); overflow-y: auto; }
.lesson-head .pill { white-space: normal; }
.toc-title { font-weight: 800; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.lesson-toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.lesson-toc a { display: block; padding: 5px 0 5px 14px; text-decoration: none; color: var(--ink-2); margin-left: -2px; border-left: 2px solid transparent; }
.lesson-toc a:hover { border-left-color: var(--sc); color: var(--ink); }
/* the section being read (set by app.js while scrolling) */
.lesson-toc a.is-active { border-left-color: var(--sc-line); color: var(--ink); font-weight: 700; background: linear-gradient(90deg, var(--sc-soft), transparent); }
@media (prefers-reduced-motion: no-preference) { .lesson-toc a { transition: color .15s, border-color .15s, background .15s; } }
.prose { font-family: var(--font-read); font-size: 1.08rem; line-height: 1.7; }
.prose h2, .prose h3, .prose h4, .prose .block-kind, .prose table, .prose .q, .prose .btn, .prose .pill { font-family: var(--font); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose li > ul, .prose li > ol { margin: .25em 0; }
.prose blockquote { margin: 1em 0; padding: .6em 1.1em; border-left: 4px solid var(--line-2); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.block { margin: 0 0 22px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.block > h2 { font-size: 1.3rem; }
.block-kind { font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--sc-ink); margin-bottom: 6px; }
/* comfortable reading line (~70 characters); figures, tables and cards keep the full block width */
.block > p, .block > ul, .block > ol, .block > h2, .block > h3, .block > blockquote { max-width: 70ch; }
.block-key_idea { background: linear-gradient(var(--sc-soft), var(--surface) 70%); }
.block-worked_example { border-left: 5px solid var(--sc-line); }
.block-formula { border-left: 5px solid var(--sc-line); background: linear-gradient(90deg, var(--sc-soft), var(--surface) 60%); }
.block-vocabulary { border-top: 4px solid var(--sc-line); }
.block-common_mistake { border-left: 5px solid var(--bad); }
.block-common_mistake .block-kind { color: var(--bad); }
.block-tip, .block-calculator_tip, .block-test_strategy { border-left: 5px solid var(--accent); }
.block-tip .block-kind, .block-calculator_tip .block-kind, .block-test_strategy .block-kind { color: var(--warn); }
.block-summary { background: var(--surface-2); }
.block-check_question { background: transparent; border-style: dashed; box-shadow: none; }
.block > :last-child { margin-bottom: 0; }
.lesson-end { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 22px 0; border-top: 1px solid var(--line); margin-top: 10px; }
/* video on top, "Visual lesson" slides below it (styles: lesson-media.css, player: slides.js) */
/* previous / next lesson at the end of a lesson */
.lesson-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; font-family: var(--font); }
.pager-link { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; box-shadow: var(--shadow); }
.pager-link small { color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.pager-link span { font-weight: 700; }
.pager-link.next { text-align: right; }
.pager-link:hover { border-color: var(--sc-line); }
@media (max-width: 560px) { .lesson-pager { grid-template-columns: 1fr; } .pager-link.next { text-align: left; } }

/* left column of the lesson: title, the video right under it, the slides, the lesson text (all the same width) */
.lesson-main { min-width: 0; }
/* the title and the video above the two columns: the video uses the full page width */
.lesson-top h1 { margin-bottom: 14px; }
.lesson-media-video .lvideo { max-width: none; margin-block: 0 22px; }
.lesson-media-slides { margin: 0 0 26px; }
.lesson-media-slides .deck-sec { padding-top: 0; }
/* html already has scroll-padding-top: 80px; the ported 76px scroll-margin on top of it left #slides 156px down,
   past the table-of-contents highlight line (120px), so "Slides" lit up "Video" */
.lesson-media .lvideo, .lesson-media .deck-sec { scroll-margin-top: 0; }
/* media that failed to load: one short line, not a full-size empty frame pushing the lesson down */
.lesson-media .vframe.is-ph, .lesson-media .deck.is-empty .deck-stage { aspect-ratio: auto; }
.lesson-media .is-ph .media-ph, .lesson-media .is-empty .media-ph { position: static; grid-auto-flow: column; align-items: center; gap: 12px; padding: 14px 18px; }
.lesson-media .is-ph .media-ph .ph-ico, .lesson-media .is-empty .media-ph .ph-ico { width: 36px; height: 36px; }
.lesson-media .is-ph .media-ph b, .lesson-media .is-empty .media-ph b { font-size: 1rem; }
/* the tokens used by lesson-media.css and i18n.css, mapped onto this site's (inside those parts only: --accent
   is amber elsewhere, green there) */
.lesson-media, .sv, .lang-pick, .translation-box, .tr-notice {
  /* accent: the focus blue pulled toward the text colour, so it passes 4.5:1 as text on its own soft tint
     (light: darker blue; dark: lighter blue) */
  --accent: color-mix(in srgb, var(--focus) 78%, var(--ink)); --accent-soft: color-mix(in srgb, var(--focus) 12%, var(--surface));
  --body: var(--font); --display: var(--font); --paper: var(--bg);
  /* focus ring on the media stage, which is dark in both themes */
  --mark: #e7b84a;
}
.video { position: relative; aspect-ratio: 16 / 9; margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* position: relative on every horizontal scroller: KaTeX's hidden MathML is position:absolute, and without a
   positioned ancestor it escapes the scroller and widens the whole page on phones */
.figure { position: relative; margin: 1.2em 0; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); text-align: center; color: var(--ink); overflow-x: auto; }
.figure svg { height: auto; max-width: 100%; }
/* Figures come from the content database with fixed colours (dark text, green/red/blue labels) drawn for a
   light page. In dark mode they stay on a light card so every label keeps its contrast. */
:root[data-theme="dark"] .figure { background: #fbfaf7; color: #16202e; border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .figure { background: #fbfaf7; color: #16202e; border-color: transparent; } }
.asset-missing { color: var(--bad); font-family: var(--mono); font-size: .8rem; }
/* the scroll shadows (local backgrounds over scroll ones) show that a wide table continues past the edge */
.table-wrap { position: relative; overflow-x: auto; margin: 1em 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: linear-gradient(to right, var(--surface), var(--surface)) left / 24px 100% no-repeat local,
              linear-gradient(to left, var(--surface), var(--surface)) right / 24px 100% no-repeat local,
              radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .18), transparent) left / 12px 100% no-repeat scroll,
              radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .18), transparent) right / 12px 100% no-repeat scroll; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.table-wrap th, .table-wrap td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table-wrap th { background: var(--surface-2); font-weight: 700; }
.table-wrap tr:last-child td { border-bottom: 0; }
.math.display { position: relative; display: block; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.katex { font-size: 1.08em; }
.katex-display { margin: .8em 0; }

/* ------------------------------------------------------------ practice header */
/* eyebrow above the title, both on the left (the counters live in the practice strip now) */
.practice-head { margin-bottom: 4px; }
.practice-head h1 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem); margin: 0; }
.practice-stats { display: flex; gap: 10px; }
.practice-stats div { display: flex; flex-direction: column; align-items: center; min-width: 76px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.practice-stats b { font-size: 1.15rem; }
.practice-stats span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.q-host { margin: 18px 0; }
/* ------------------------------------------------------------ practice set: strip, map, finish card */
.pr-shell { max-width: 820px; }
/* wide screens: the question map stays open in the right-hand column (no "Questions" button needed) */
@media (min-width: 1100px) {
  .pr-shell { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) 300px; column-gap: 32px; align-items: start; }
  .pr-shell > :not(.pr-map) { grid-column: 1; }
  .pr-shell > .pr-map { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 80px; margin-top: 14px; }
  .pr-map-btn { display: none; }
  .pr-map-head { display: grid; gap: 10px; }
  .is-list > .pr-map { display: none !important; }
  .is-list > :not(.pr-map) { grid-column: 1 / -1; }
}
.pr-bar { position: sticky; top: 64px; z-index: 15; margin: 14px 0 0; padding: 10px 0 8px; background: var(--bg); }
.pr-bar-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pr-pos { margin: 0; font-weight: 700; color: var(--ink); }
.pr-pos b { color: var(--good); }
.pr-tools { display: flex; gap: 8px; align-items: center; }
.pr-bar .meter { margin-top: 8px; }
.pr-map { margin: 8px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.pr-map-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pr-map-head h2 { margin: 0; font-size: 1rem; }
.pr-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pr-filters .chip[aria-pressed="true"] { border-color: var(--sc-line); background: var(--sc-soft); color: var(--sc-ink); }
.pr-grid { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.pr-dot { position: relative; width: 100%; height: 44px; border-radius: 12px; border: 1.5px solid var(--ctl); background: var(--surface); color: var(--ink); font: 700 .95rem var(--font); cursor: pointer; }
/* the state is an icon too, not only a colour */
.pr-dot[data-st="right"] { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.pr-dot[data-st="wrong"] { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.pr-dot[data-st="right"]::after, .pr-dot[data-st="wrong"]::after { position: absolute; top: 2px; right: 5px; font-size: .7rem; }
.pr-dot[data-st="right"]::after { content: "✓"; }
.pr-dot[data-st="wrong"]::after { content: "✗"; }
.pr-dot.is-cur { outline: 3px solid var(--ink); outline-offset: 1px; }
.q-before { margin: -6px 0 12px; font-size: .85rem; font-weight: 700; }
.q-before[data-st="right"] { color: var(--good); }
.q-before[data-st="wrong"] { color: var(--bad); }
.q-head .q-again { margin-left: auto; }
/* Next sits right after the result line */
.verdict + [data-next] { margin-top: 10px; }
h2.q-label { margin: 0; font-size: .82rem; font-weight: 700; color: var(--muted); }
h2.q-label:focus { outline: none; }
h2.q-label:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.pr-done { margin: 18px 0; display: grid; gap: 12px; }
.pr-done h2 { margin: 0; }
.pr-done h2:focus { outline: none; }
.pr-done-score { margin: 0; font-size: 1.2rem; font-weight: 800; }
.pr-empty { margin: 18px 0; display: grid; gap: 12px; justify-items: start; }
.is-list .pr-bar .pr-tools .pr-map-btn, .is-list [data-pr-pos] { display: none; }
.is-list .q { margin-bottom: 24px; }

/* ------------------------------------------------------------ question card */
.q { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px clamp(16px, 3vw, 30px); box-shadow: var(--shadow); margin-bottom: 18px; }
.q-form { margin: 0; }
.q-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.q-pills { display: flex; gap: 6px; }
.q-stem { font-size: 1.08rem; line-height: 1.65; }
.q-stem > :last-child { margin-bottom: .6em; }
.q-help { font-size: .88rem; color: var(--muted); margin: 0 0 12px; }
.passage { margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.passage > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; }
.passage-body { padding: 4px 18px 10px; max-height: 60vh; overflow: auto; font-size: 1rem; }

.choices { border: 0; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--ctl); border-radius: 12px; cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.choice:hover { border-color: var(--sc); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-key { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--ctl); font-weight: 800; font-size: .85rem; color: var(--ink-2); }
.q-multi_select .choice-key { border-radius: 6px; }
.q-mcq .choice-key { border-radius: 50%; }
.choice-text { padding-top: 2px; }
.choice:has(input:checked), .choice.is-sel { border-color: var(--sc); background: var(--sc-soft); }
/* filled with the subject colour mixed toward the text colour, text in the page background: readable on every
   subject (Social Studies' gold with white text was 3.1:1) and in both themes */
.choice:has(input:checked) .choice-key, .choice.is-sel .choice-key { background: var(--sc-ink); border-color: var(--sc-ink); color: var(--bg); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.is-locked .choice { cursor: default; }
.is-locked .choice:hover { border-color: var(--ctl); }
.is-locked .choice.right { border-color: var(--good); background: var(--good-bg); }
.is-locked .choice.right .choice-key { background: var(--good); border-color: var(--good); color: var(--on-state); }
.is-locked .choice.wrong { border-color: var(--bad); background: var(--bad-bg); }
.is-locked .choice.wrong .choice-key { background: var(--bad); border-color: var(--bad); color: var(--on-state); }
/* the state in words as well as colour (added by ged.js reveal) */
.choice-state { flex: none; margin-left: auto; align-self: center; padding: 2px 8px; border-radius: 999px; font: 800 .75rem var(--font); white-space: nowrap; }
.choice.right .choice-state { background: var(--good); color: var(--on-state); }
.choice.wrong .choice-state { background: var(--bad); color: var(--on-state); }
.rationale { margin: 6px 0 4px 54px; font-size: .92rem; color: var(--ink-2); }
.rationale p { margin: 0; }
.rationale-es { margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--line-2); color: var(--ink-2); }
.verdict:focus { outline: none; }
.verdict:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[data-hotspot]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 8px; }
.solution-es { margin-top: 12px; }

.blank { width: 8.5em; min-height: 40px; padding: 0 10px; margin: 2px 2px; border: 1.5px solid var(--ctl); border-bottom-width: 3px; border-radius: 9px; font: 600 1rem var(--font); background: var(--surface); color: var(--ink); vertical-align: middle; }
.blank:focus, .blank-select:focus, .zone-select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.blank-select, .zone-select { min-height: 40px; max-width: 100%; padding: 0 8px; border: 1.5px solid var(--ctl); border-radius: 9px; font: 600 .98rem var(--font); background: var(--surface); color: var(--ink); vertical-align: middle; }
.blank-view, .zone.filled { display: inline-block; min-width: 3em; padding: 3px 10px; border-radius: 8px; font-weight: 700; border: 1.5px solid; }
.blank-view.ok, .zone.ok { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.blank-view.no, .zone.no { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.zone .zone-tile:empty { display: none; }
.js .q-drag_drop .zone:not(.filled) { display: inline-flex; align-items: center; justify-content: center; min-width: 7em; min-height: 42px; padding: 4px 10px; border: 2px dashed var(--line-2); border-radius: 10px; cursor: pointer; vertical-align: middle; background: var(--surface-2); }
.js .q-drag_drop .zone:not(.filled) .zone-select { display: none; }
.js .q-drag_drop .zone.has-tile { border-style: solid; border-color: var(--sc); background: var(--sc-soft); }
.js .q-drag_drop .zone.is-target { border-color: var(--sc); }
.zone .zone-empty { color: var(--muted); font-size: .8rem; }
.tray { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; margin: 10px 0 4px; border-radius: 12px; background: var(--surface-2); }
.tile { min-height: 42px; padding: 6px 14px; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 1rem var(--font); cursor: pointer; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--sc); }
.tile.is-picked { border-color: var(--sc-ink); background: var(--sc-ink); color: var(--bg); }
.tile.is-used { opacity: .6; border-style: dashed; }

.hotspot { margin: 8px 0 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; text-align: center; color: var(--ink); background: var(--surface); }
.hotspot { position: relative; overflow-x: auto; }
.hotspot svg { width: 100%; height: auto; max-width: 100%; }
.hs-live { margin: 6px 0 0; font-size: .88rem; color: var(--muted); min-height: 1.3em; }
.hotspot.is-active svg { cursor: crosshair; }
.hs-mark { fill: var(--bad); fill-opacity: .85; stroke: #fff; stroke-width: 2; }
.is-right .hs-mark { fill: var(--good); }
.hs-zone { fill: var(--good); fill-opacity: .16; stroke: var(--good); stroke-width: 2.5; stroke-dasharray: 5 3; }

.essay { width: 100%; min-height: 280px; padding: 14px; border: 1.5px solid var(--ctl); border-radius: 12px; font: 1rem/1.6 var(--font-read); background: var(--surface); color: var(--ink); resize: vertical; }
.essay-view { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); font-family: var(--font-read); white-space: normal; }
.rubric { margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; }
.rubric > summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
.trait { padding: 10px 0 14px; border-top: 1px solid var(--line); }
.trait h4 { margin-bottom: .4em; }
.self-score { display: flex; gap: 8px; margin-top: 8px; }
.self-score label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--line-2); border-radius: 9px; font-weight: 700; cursor: pointer; }
.self-score label:has(input:checked) { border-color: var(--sc); background: var(--sc-soft); }
/* essay self-score: one button per point, the chosen one filled and ticked (not only a colour) */
.self-btn { min-width: 44px; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--ctl); border-radius: 10px; background: var(--surface); color: var(--ink); font: 800 1rem var(--font); cursor: pointer; }
.self-btn:hover:not(:disabled) { border-color: var(--ink-2); }
.self-btn.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.self-btn.on::before { content: "✓ "; }
.self-btn:disabled { opacity: .55; cursor: default; }

.hint { margin-top: 14px; border-radius: 12px; background: var(--warn-bg); color: var(--ink); }
.hint > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; color: var(--warn); }
.hint > :not(summary) { padding: 0 14px; }
.hint > :last-child { padding-bottom: 12px; margin-bottom: 0; }
.q-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.verdict { margin-top: 20px; padding: 12px 16px; border-radius: 12px; font-weight: 800; font-size: 1.05rem; }
.verdict.right { background: var(--good-bg); color: var(--good); }
.verdict.wrong { background: var(--bad-bg); color: var(--bad); }
.verdict.neutral { background: var(--surface-2); color: var(--ink-2); }
.solution { margin-top: 12px; padding: 16px 18px; border-left: 4px solid var(--sc); background: var(--sc-soft); border-radius: 0 12px 12px 0; font-size: 1rem; }
.solution h3, .solution h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sc-ink); }
.solution > :last-child { margin-bottom: 0; }
.spanish { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.spanish > summary { cursor: pointer; font-weight: 700; color: var(--ink-2); font-size: .92rem; }
.spanish-body { padding-top: 10px; }
.spanish-body h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 1em; }
.es-options { padding-left: 1.2em; }
.q.is-loading { opacity: .6; pointer-events: none; }

/* ------------------------------------------------------------ review */
/* Review: summary, a card per subject (subject colour on top), test mistakes, fixed and gone lists */
.rv { display: grid; gap: 18px; max-width: 820px; }
.rv > .lead { margin: 0; }
.rv-summary { display: grid; gap: 12px; justify-items: start; }
.rv-total { margin: 0; font-size: 1.15rem; font-weight: 800; }
.rv-fixed-n { margin: 0; color: var(--good); font-weight: 700; }
.rv-subjects { display: grid; gap: 18px; }
.rv-subjects:empty { display: none; }
.rv-card { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--sc); border-radius: var(--radius); padding: 18px 20px 8px; box-shadow: var(--shadow); }
.rv-card h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 6px; font-size: 1.15rem; }
.rv-count { font-size: .85rem; font-weight: 700; color: var(--bad); white-space: nowrap; }
.rv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.rv-card .rv-row:first-child { border-top: 0; }
.rv-text { display: grid; gap: 3px; min-width: 0; flex: 1 1 260px; }
.rv-text b { line-height: 1.35; }
.rv-row .btn { flex: none; }
.rv-tests h2 { margin: 0 0 4px; font-size: 1.15rem; }
.rv-tests > p { margin: 0 0 10px; }
.panel-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px; }
.rv-more { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 20px; }
.rv-more > summary { cursor: pointer; padding: 14px 0; font-weight: 700; }
.rv-more .panel-list { border: 0; padding: 0; background: none; }
.rv-more > p, .rv-more > .btn { margin: 0 0 12px; }
.rv-empty { display: grid; gap: 14px; justify-items: start; }
.rv-empty p { margin: 0; font-size: 1.05rem; }
@media (max-width: 760px) {
  .rv-card, .panel-list, .rv-more { padding-inline: 16px; }
  /* phones: the button under the text, full width (a big, clear target) */
  .rv-row .btn { width: 100%; }
}

/* ------------------------------------------------------------ tests */
.intro-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-top: 18px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 16px; }
.facts div { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.facts dd { margin: 0; font-size: 1.25rem; font-weight: 800; }
.parts { padding-left: 1.2em; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }

body.is-bare { background: var(--surface-2); }
.page-bare { min-height: 100vh; }
.test { display: flex; flex-direction: column; min-height: 100vh; }
.test-bar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px clamp(12px, 3vw, 28px); background: #14213d; color: #f4f1ea; }
.test-bar .muted { color: #aab4c6; }
.test-title { display: flex; gap: 10px; align-items: baseline; }
.test-title h1 { margin: 0; font-size: 1rem; font-weight: 800; letter-spacing: 0; }
.time-choice { margin: 4px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; gap: 6px; }
.time-choice legend { padding: 0 4px; font-weight: 800; }
.time-choice label { display: flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.time-choice p { margin: 2px 0 0; }
.test-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.test-bar .btn.ghost { color: #f4f1ea; border-color: rgba(255, 255, 255, .25); }
.timer { font: 800 1.05rem var(--mono); padding: 6px 12px; border-radius: 9px; background: rgba(255, 255, 255, .1); }
.timer.low { background: var(--bad); color: var(--on-state); }
.test-body { flex: 1; width: min(860px, 100% - 24px); margin: 22px auto; }
.test-body.has-passage { width: min(1360px, 100% - 24px); display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.test-passage { position: sticky; top: 74px; max-height: calc(100vh - 96px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px 26px; font-size: 1rem; }
.test-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.btn.is-flagged { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.test-foot { padding: 14px clamp(12px, 3vw, 28px) 22px; border-top: 1px solid var(--line); background: var(--surface); }
.nav-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nav-grid button { width: 38px; height: 38px; border-radius: 9px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; position: relative; }
/* answered: filled + a bar under the number; flagged: a dark corner dot; current: a thick outline (shapes, not only colours) */
.nav-grid button.ans { background: var(--sc-soft); border-color: var(--sc-line); }
.nav-grid button.ans::before { content: ""; position: absolute; left: 50%; bottom: 4px; width: 14px; height: 3px; margin-left: -7px; border-radius: 2px; background: var(--sc-line); }
.nav-grid button.cur { outline: 3px solid var(--ink); outline-offset: 1px; }
.nav-grid button.flag::after { content: ""; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--warn); border: 2px solid var(--surface); }

.score-card { display: flex; gap: 28px; align-items: center; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); flex-wrap: wrap; }
.score-text { flex: 1; min-width: 260px; }
.band { font-size: 1.3rem; font-weight: 800; margin-bottom: .3em; }
.band-below { color: var(--bad); }
.band-pass, .band-college_ready, .band-college_credit { color: var(--good); }
.skill-table { width: 100%; border-collapse: collapse; }
.skill-table th, .skill-table td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.skill-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.skill-table .num { text-align: right; white-space: nowrap; }
.skill-table tr:last-child td { border-bottom: 0; }
.review-list .q { margin-bottom: 16px; }
.sticky-save { position: sticky; bottom: 16px; display: flex; justify-content: center; }
.sticky-save .btn { box-shadow: var(--shadow-lg); }

dialog.sheet { width: min(640px, 100% - 24px); max-height: 85vh; border: 0; border-radius: 18px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(10, 15, 25, .5); }
.sheet-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
dialog .formula-sheet { padding: 4px 20px 20px; }

/* ------------------------------------------------------------ progress & tools */
.progress-code { display: inline-block; font-size: 1.05rem; padding: 10px 14px; letter-spacing: .04em; user-select: all; cursor: copy; }
.danger-zone { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
/* progress page: next step first, then the last 4 weeks, readiness, what to work on, results, backup */
.pg > .note { margin: 0 0 14px; }
.pg-next { display: grid; gap: 8px; justify-items: start; border-left: 5px solid var(--focus); }
.pg-next p { margin: 0; }
.pg-kicker { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.pg-next-title { font-size: 1.25rem; font-weight: 800; line-height: 1.3; }
.pg-next .row { margin-top: 6px; gap: 10px; }
.pg-empty { display: grid; gap: 12px; justify-items: start; }
.pg-empty h2, .pg-empty p { margin: 0; }
.pg-diag { display: flex; flex-wrap: wrap; gap: 10px; }
.pg-diag .btn { border-left: 4px solid var(--sc); }
.pg-undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--warn-bg); border-color: var(--warn); }
.pg-undo p { margin: 0; font-weight: 700; }
.pg-days-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.pg-days-head h2 { margin: 0; font-size: 1.15rem; }
.pg-cal { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; list-style: none; margin: 0; padding: 0; max-width: 560px; }
.pg-cal li, .pg-cal-key i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.pg-cal .lv1, .pg-cal-key .lv1 { background: color-mix(in srgb, var(--good) 25%, var(--surface)); }
.pg-cal .lv2, .pg-cal-key .lv2 { background: color-mix(in srgb, var(--good) 50%, var(--surface)); }
.pg-cal .lv3, .pg-cal-key .lv3 { background: color-mix(in srgb, var(--good) 75%, var(--surface)); }
.pg-cal .lv4, .pg-cal-key .lv4 { background: var(--good); }
.pg-cal .is-today { outline: 2px solid var(--ink); outline-offset: 1px; }
.pg-cal-key { display: flex; align-items: center; gap: 4px; margin: 10px 0 0; }
.pg-cal-key i { display: inline-block; width: 12px; }
.pg-ready { margin: 0 0 18px; }
.pg-ready > h2 { font-size: 1.15rem; margin: 6px 0 12px; }
.pg-subjects .subject-card { display: grid; gap: 2px; padding: 16px 18px 14px; }
.pg-subjects .subject-card h3 { margin: 0; font-size: 1.05rem; }
.pg-subjects .meter { margin: 8px 0 4px; }
.pg-explain { margin-top: 12px; }
.pg-explain > summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.pg-explain p { max-width: 72ch; color: var(--ink-2); }
.pg .two-col { margin-top: 0; margin-bottom: 18px; }
.pg .two-col .panel { margin-bottom: 0; }
.pg .panel > h2 { font-size: 1.15rem; margin-top: 0; }
.pg-bk { margin: 0 0 12px; color: var(--ink-2); }
.pg-bk.is-warn { color: var(--warn); font-weight: 700; }
.pg-bk:empty { display: none; }
.file-btn:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.pg-words { display: grid; gap: 10px; justify-items: start; }
.pg-words p { margin: 0; }
/* deleting is kept apart and behind one more click, away from "Open a backup file" */
.pg-danger { margin: 34px 0 8px; padding: 0 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.pg-danger > summary { cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--bad); }
.pg-danger > p { margin: 0 0 12px; max-width: 72ch; }
.pg-danger > .btn { margin-bottom: 16px; }
@media (max-width: 760px) {
  .pg-cal { gap: 4px; }
  /* phones: subjects two by two, so the next step and the skills to work on come sooner */
  .pg .pg-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pg-subjects .subject-card { padding: 12px 12px 10px 16px; }
  .pg-subjects .subject-card h3 { font-size: .95rem; }
  .pg-next .row { justify-self: stretch; }
  .pg-next .btn { width: 100%; }
}
/* formula sheet: a section per group of the official sheet, each a list of name → formula */
.formula-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; }
.formula-intro .lead { margin: 0; max-width: 70ch; }
.formula-sheet { display: grid; gap: 8px; }
.fsec + .fsec { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--line); }
.fsec > h2, .fsec > h3 { margin: 0 0 4px; font-size: 1.05rem; color: var(--sc-ink); }
.fsec-note { margin: 0 0 6px; }
.fsec-extra > h2, .fsec-extra > h3 { color: var(--warn); }
/* Tools page: each group is its own card (the test dialog keeps one list with dividers) */
.formula-cards { gap: 18px; margin-top: 18px; }
.formula-cards .fsec { margin: 0; padding: 18px 22px 6px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--sc-line); border-radius: var(--radius); box-shadow: var(--shadow); }
.formula-cards .fsec + .fsec { margin-top: 0; border-top: 4px solid var(--sc-line); }
.formula-cards .fsec.fsec-extra { border-top-color: var(--warn); background: linear-gradient(var(--warn-bg), var(--surface) 90px); }
.formula-cards .fsec > h2 { font-size: 1.15rem; }
@media (max-width: 760px) { .formula-cards .fsec { padding: 16px 16px 4px; } }
.formula-list { display: grid; margin: 0; }
.formula-row { display: flex; justify-content: space-between; align-items: center; gap: 6px 20px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.formula-row:last-child { border-bottom: 0; }
.formula-row dt { display: grid; gap: 2px; min-width: 0; }
.formula-name { font-weight: 700; }
.formula-lesson { justify-self: start; }
.formula-row dd { margin: 0; }
/* overflow-y hidden + a little padding: a tall fraction must not turn the box into a tiny vertical scroller */
.formula { flex: 0 1 auto; min-width: 0; text-align: right; overflow-x: auto; overflow-y: hidden; padding: 4px 3px; max-width: 100%; position: relative; }
/* KaTeX's subscripts measure a pixel wider than they draw: no scroll bar for a formula that only just fits */
.formula .katex { padding-right: 1px; }
@media (min-width: 761px) { .formula { flex-shrink: 0; max-width: 62%; } }
.formula-words { display: block; max-width: 46ch; text-align: right; color: var(--ink-2); }
.search-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.search-bar input[type=search] { flex: 1; min-width: 200px; }
/* ------------------------------------------------------------ glossary
   hub: search first (results with the meaning), flashcards, each subject's most used words.
   subject page: rows that already show the word, its other-language name and the first line of the meaning
   (<details>: open for the rest); A–Z or by lesson. Only the search box stays on screen while scrolling. */
.gl-kicker { margin: -6px 0 12px; color: var(--muted); font-weight: 700; }
.gl-toolbar { position: sticky; top: 64px; z-index: 14; margin: 0 -6px; padding: 8px 6px; background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: saturate(1.3) blur(10px); backdrop-filter: saturate(1.3) blur(10px); }
.gl-search { position: relative; max-width: 900px; }
.gl-search .input { width: 100%; min-height: 52px; padding: 0 16px 0 48px; border: 1.5px solid var(--ctl); border-radius: 14px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='M14 14l4 4'/%3E%3C/svg%3E") no-repeat 16px 50%; color: var(--ink); font: 600 1.05rem var(--font); box-shadow: var(--shadow); }
.gl-search .input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.gl-subjects { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.gl-subjects .chip { gap: 6px; min-height: 40px; color: var(--ink-2); }
.gl-subjects .chip[aria-current] { background: var(--sc-line, var(--ink)); border-color: transparent; color: var(--surface); box-shadow: none; }
.gl-subjects .chip[aria-current] .gl-n { color: inherit; opacity: .85; }
.gl-subjects .chip[aria-current] .foot-dot { background: currentColor; }
.gl-n { font-size: .78rem; color: var(--muted); font-weight: 700; }
.gl-count { margin: 10px 0 0; min-height: 1.2em; }
.gl-empty { display: grid; gap: 10px; justify-items: start; margin-top: 12px; max-width: 900px; }
.gl-empty p { margin: 0; }
.gl-empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* hub */
.gl-hub { margin-top: 18px; max-width: 1100px; }
.gl-cta { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; max-width: 900px; }
.gl-cta:hover { border-color: var(--line-2); color: var(--ink); }
.gl-cta > span:nth-child(2) { display: grid; gap: 2px; flex: 1; }
.gl-cta-icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #14213d; }
.gl-cta-go { flex: none; font-size: 1.3rem; color: var(--muted); }
.gl-hub-h { margin: 28px 0 2px; font-size: 1.3rem; }
.gl-hub-p { margin: 0 0 12px; }
.gl-subject-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.gl-subject-card { display: flex; flex-direction: column; padding: 16px 18px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: inset 0 4px 0 var(--sc-line); }
.gl-subject-card h3 { margin: 4px 0 8px; font-size: 1.12rem; display: flex; align-items: baseline; gap: 8px; }
.gl-subject-card h3 a { color: var(--sc-ink); text-decoration: none; }
.gl-top-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.gl-top-list li + li { border-top: 1px solid var(--line); }
.gl-top-list a { display: grid; gap: 2px; padding: 8px 0; color: var(--ink); text-decoration: none; }
.gl-top-list a:hover .gl-term { text-decoration: underline; text-underline-offset: 3px; }
.gl-subject-all { margin-top: 8px; font-weight: 700; color: var(--sc-ink); text-decoration: none; }
.gl-results { margin-top: 12px; max-width: 900px; }
.gl-res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gl-res { padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: inset 3px 0 0 var(--sc-line); }
.gl-res-link { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: var(--ink); text-decoration: none; }
.gl-res-link:hover .gl-term { text-decoration: underline; text-underline-offset: 3px; }
.gl-res-def { margin: 4px 0 0; color: var(--ink-2); line-height: 1.5; }
.gl-res .gl-ex { margin: 6px 0 0; }

/* shared word parts */
.gl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.gl-term { font-weight: 800; font-size: 1.04rem; min-width: 0; }
.gl-term mark { background: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: inset 0 -2px 0 var(--warn); color: inherit; border-radius: 2px; padding: 0 1px; }
.gl-es { color: var(--sc-ink, var(--ink-2)); font-weight: 600; font-size: .95rem; }
.gl-peek { display: block; color: var(--muted); font-size: .92rem; line-height: 1.4; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.gl-subj { flex: none; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; color: var(--sc-ink); background: var(--sc-soft); }
.gl-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.gl-chip { display: inline-flex; align-items: center; min-height: 38px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; }
.gl-chip:hover { border-color: var(--sc-line, var(--line-2)); color: var(--ink); }

/* subject page */
.gl-top-words { margin: 16px 0 0; max-width: 900px; }
.gl-top-words h2 { margin: 0 0 8px; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.gl-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 0; max-width: 900px; }
.gl-view { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.gl-view-btn { min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font: 700 .92rem var(--font); cursor: pointer; }
.gl-view-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.gl-jump { display: none; }
.gl-jump select { min-height: 44px; padding: 0 10px; border: 1.5px solid var(--ctl); border-radius: 10px; background: var(--surface); color: var(--ink); font: 700 .95rem var(--font); }
.gl-az { display: grid; grid-template-columns: repeat(26, 1fr); gap: 2px; margin-top: 10px; max-width: 900px; }
.gl-az:has(> :nth-child(27)) { grid-template-columns: repeat(27, 1fr); }
.gl-az a, .gl-az span { display: grid; place-items: center; height: 36px; border-radius: 8px; font-weight: 800; font-size: .88rem; text-decoration: none; }
.gl-az a { color: var(--ink); }
.gl-az a:hover { background: var(--surface-2); }
.gl-az span { color: var(--line-2); }
.gl-list { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; max-width: 900px; }
.gl-list.is-search > section, .gl-list.is-search > .gl-topics { display: none; }
.gl-hits:empty { display: none; }
.gl-letter { padding: 6px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); content-visibility: auto; contain-intrinsic-size: auto 900px; }
/* the letter of a #slug link is drawn at once, so the jump lands on the term, not on an empty placeholder */
.gl-letter:has(:target) { content-visibility: visible; }
.gl-letter > h2 { margin: 12px 0 2px; font-size: 1.6rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.gl-topic > h2 { font-size: 1.1rem; color: var(--sc-ink); }
.gl-topics { display: flex; flex-direction: column; gap: 16px; }
.gl-rows { list-style: none; margin: 0; padding: 0; }
.gl-rows > li + li { border-top: 1px solid var(--line); }
.gl-hits { padding: 4px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.gl-item > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 2px; min-height: 56px; padding: 10px 0; cursor: pointer; list-style: none; }
.gl-item > summary .gl-head, .gl-item > summary .gl-peek { grid-column: 1; }
.gl-item > summary::-webkit-details-marker { display: none; }
.gl-item > summary::after { content: ""; grid-column: 2; grid-row: 1 / span 2; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s; }
.gl-item[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.gl-item[open] > summary .gl-peek { display: none; }
.gl-item[open] { background: var(--sc-soft); margin-inline: -12px; padding-inline: 12px; border-radius: 12px; }
.gl-body { padding: 0 0 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.gl-body p { margin: 0; line-height: 1.6; }
.gl-body > .gl-def { font-size: 1.04rem; }
.gl-ex { color: var(--ink-2); }
.gl-alt { color: var(--ink); padding-left: 10px; border-left: 3px solid var(--sc-line, var(--line-2)); }
.gl-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.gl-links .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-more { font-weight: 700; }
.gl-star { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 700 .88rem var(--font); cursor: pointer; }
.gl-star[aria-pressed="true"] { color: var(--ink); border-color: var(--warn); background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.gl-item.is-target { outline: 2px solid var(--sc-line); outline-offset: 2px; }
.gl-from-lesson { margin-top: 10px; }
.gl-word { display: inline; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: inherit; cursor: pointer; text-decoration: underline dotted; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--sc-line, var(--muted)); }
.gl-word:hover { text-decoration-style: solid; }
.gl-pop .gl-pop-body { padding: 14px 20px 20px; display: grid; gap: 10px; }
.gl-pop .gl-pop-body p { margin: 0; line-height: 1.6; }
/* keyboard focus never ends up under the sticky search box */
html:has(.gl-toolbar) { scroll-padding-top: 150px; scroll-padding-bottom: 80px; }

/* term page */
.gl-page { max-width: 760px; }
.gl-page-head { display: grid; gap: 4px; margin-bottom: 14px; }
.gl-page-subj { margin: 0; font-weight: 700; }
.gl-page-subj a { color: var(--sc-ink); text-decoration: none; }
.gl-page-term { margin: 0; font-size: clamp(2rem, 6vw, 2.8rem); letter-spacing: -.03em; }
.gl-page-alt { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--sc-ink); }
.gl-page-head .gl-star { justify-self: start; margin-top: 8px; }
.gl-page-def { font-size: 1.2rem; line-height: 1.6; margin: 0 0 16px; }
.gl-page-ex { padding: 14px 18px; border-radius: 14px; background: var(--sc-soft); margin: 0 0 16px; }
.gl-page-ex p { margin: 0; line-height: 1.6; }
.gl-page-label { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--sc-ink); margin-bottom: 4px !important; }
.gl-page-other { padding: 14px 18px; border-left: 4px solid var(--sc-line); background: var(--surface); border-radius: 0 14px 14px 0; margin: 0 0 18px; }
.gl-page-other h2 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gl-page-other p { margin: 0 0 6px; line-height: 1.6; }
.gl-page-other-ex { color: var(--ink-2); }
.gl-page-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.gl-page-rel { margin: 0 0 22px; }
.gl-page-rel h2 { font-size: 1.05rem; margin: 0 0 10px; }
.gl-else { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gl-else a { display: block; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.gl-else .gl-subj { margin-right: 6px; }

/* flashcards */
.cd { max-width: 640px; }
.cd-setup { display: grid; gap: 16px; }
.cd-field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.cd-field label, .cd-field legend { font-weight: 700; }
.cd-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 600; cursor: pointer; }
.cd-seg label:has(:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cd-note { margin: 0; }
.cd-pos { margin: 0 0 8px; }
.cd-card { padding: 28px 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow), inset 0 5px 0 var(--sc-line, var(--accent)); display: grid; gap: 14px; }
.cd-term { margin: 0; font-size: clamp(1.8rem, 7vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; text-align: center; }
.cd-tools { margin: 0; text-align: center; }
.cd-back { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.cd-def { margin: 0; font-size: 1.12rem; line-height: 1.6; }
.cd-back p, .cd-card p { margin: 0; }
.cd-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; }
.cd-actions .btn { min-width: 140px; min-height: 48px; }
.cd-opts { display: grid; gap: 8px; }
.cd-opt { display: block; width: 100%; min-height: 52px; padding: 10px 14px; text-align: left; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: 700 1rem var(--font); cursor: pointer; }
.cd-opt:hover:not(:disabled) { border-color: var(--ink-2); }
.cd-opt.is-right { border-color: var(--ok, #1a7f4b); background: color-mix(in srgb, var(--ok, #1a7f4b) 12%, var(--surface)); }
.cd-opt.is-wrong { border-color: var(--bad, #b42318); background: color-mix(in srgb, var(--bad, #b42318) 10%, var(--surface)); }
.cd-fb { min-height: 1.4em; font-weight: 700; text-align: center; }
.cd-done { text-align: center; }

@media (max-width: 760px) {
  .gl-toolbar { top: 56px; }
  /* chips in one line that scrolls sideways; the intro stays one short line */
  .gl-subjects { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 0 16px 2px; }
  .gl-subjects::-webkit-scrollbar { display: none; }
  .gl-subjects .chip { flex: none; white-space: nowrap; min-height: 36px; }
  .gl-az { display: none; }
  .gl-jump { display: block; }
  .gl-controls { margin-top: 12px; }
  .gl-controls .btn { margin-left: auto; }
  /* the most used words: one line that scrolls sideways */
  .gl-top-words { margin-top: 12px; }
  .gl-top-words h2 { font-size: .8rem; margin-bottom: 6px; }
  .gl-top-words .gl-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 0 16px 4px; }
  .gl-top-words .gl-chips::-webkit-scrollbar { display: none; }
  .gl-top-words .gl-chip { white-space: nowrap; }
  .gl-kicker { margin-bottom: 8px; font-size: .92rem; }
  .gl-letter { padding: 4px 14px; }
  .gl-hits { padding: 4px 14px; }
  .gl-cta { padding: 14px 16px; gap: 12px; }
  .gl-cta-icon { width: 44px; height: 44px; }
  .gl-links a { min-height: 44px; display: inline-flex; align-items: center; }
  html:has(.gl-toolbar) { scroll-padding-top: 140px; }
  .cd-card { padding: 22px 16px; }
}
/* the tool tabs stay on one line on a phone (the cut-off last tab shows there is more to scroll) */
@media (max-width: 520px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 10px 0 14px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 10px 11px; margin-bottom: 0; }
}
@media (max-height: 520px) { .gl-toolbar { position: static; } }
@media print { .gl-toolbar, .gl-subjects, .gl-controls, .gl-az, .gl-star, .gl-top-words { display: none !important; } .gl-letter { content-visibility: visible; } .gl-item .gl-body { display: grid !important; } }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 20px; }

/* ------------------------------------------------------------ calculator */
.calc { font-family: var(--font); }
#calc { position: fixed; right: 18px; bottom: 18px; z-index: 50; width: 300px; padding: 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lg); }
.inline-calc { max-width: 340px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.calc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; cursor: grab; font-weight: 800; }
.calc-display { width: 100%; height: 48px; padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: 10px; font: 600 1.15rem var(--mono); background: var(--surface-2); color: var(--ink); text-align: right; }
.calc-result { min-height: 30px; padding: 4px 4px 8px; text-align: right; font: 800 1.2rem var(--mono); color: var(--sc); }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.calc-keys button { height: 42px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink); font: 700 1rem var(--font); cursor: pointer; }
.calc-keys .fn { font-size: .86rem; }
.calc-hist { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.calc-hist:empty { display: none; }
.calc-hist button { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 3px 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: 600 .85rem var(--mono); text-align: left; cursor: pointer; }
.calc-hist button:hover { background: var(--surface-2); color: var(--ink); }
.calc-hist span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-result { overflow-wrap: anywhere; }
.calc-keys button:hover { border-color: var(--ink-2); }
.calc-keys .op { background: var(--surface-2); }
.calc-keys .eq { background: var(--brand); color: var(--bg); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: var(--brand); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow-lg); transition: transform .25s; z-index: 80; }
.toast.show { transform: translate(-50%, 0); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 960px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-toc { display: none; }
  .test-body.has-passage { grid-template-columns: 1fr; }
  .test-passage { position: static; max-height: 50vh; }
  .intro-grid, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wrap { width: min(1120px, 100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  .hero .btn, .diag .btn { white-space: normal; text-align: center; line-height: 1.25; padding-block: 8px; }
  .top-nav { display: none; }
  .head-row { height: 56px; gap: 10px; }
  .brand-logo { width: 40px; height: 40px; border-radius: 10px; }
  .brand-free { display: none; }
  /* phones: the header's Menu drop-down replaces the top links; the app bar replaces the header app button */
  .menu { display: block; }
  .app-btn { display: none; }
  .app-bar-space { display: block; height: calc(4.4rem + env(safe-area-inset-bottom)); }
  /* a focused field or button is never left under the bottom app bar */
  html:has(.app-bar) { scroll-padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
  .app-bar { position: fixed; z-index: 30; left: 50%; bottom: calc(.7rem + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: .6rem; width: min(360px, calc(100% - 1rem)); min-height: 52px; padding: .45rem .75rem .45rem .5rem; color: #fff; background: linear-gradient(100deg, #14213d, #22345c); border: 1px solid rgb(255 255 255 / .18); border-radius: 15px; box-shadow: 0 12px 28px rgb(10 15 25 / .32); text-decoration: none; }
  .app-bar:hover { color: #fff; }
  .app-bar-copy { flex: 1 1 auto; min-width: 0; font-weight: 800; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-bar-store { flex: none; padding: .38rem .5rem; color: #e8ecf2; background: rgb(255 255 255 / .14); border-radius: 7px; font-weight: 800; font-size: .68rem; white-space: nowrap; }
  .app-bar-arrow { flex: none; font-size: .95rem; }
  /* inside the screen (its right edge on the bar's), with a 44px touch area around the visible 30px circle */
  .app-bar-x::after { content: ""; position: absolute; inset: -7px; }
  .app-bar-x { position: fixed; z-index: 31; bottom: calc(.7rem + env(safe-area-inset-bottom) + 38px); left: calc(50% + min(180px, 50% - .5rem) - 30px); display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: #fff; background: #17212c; border: 2px solid #fff; border-radius: 50%; font-size: .9rem; line-height: 1; cursor: pointer; }
  /* phones that aren't Android (theme.js sets html.is-android): no Google Play bar or card at all */
  html:not(.is-android) .app-bar, html:not(.is-android) .app-bar-x, html:not(.is-android) .app-bar-space, html:not(.is-android) .app-card { display: none !important; }
  /* toasts and the floating calculator sit above the bar */
  html.is-android:not(.app-bar-off) .toast { bottom: calc(5.2rem + env(safe-area-inset-bottom)); }
  html.app-bar-off .toast, html:not(.is-android) .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  html.app-bar-off #calc, html:not(.is-android) #calc { bottom: 12px; }
  .hero { grid-template-columns: 1fr; padding: 26px 20px; border-radius: 18px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .hero-stats div { flex-direction: column; padding: 10px; }
  .hero-stats dd { font-size: 1.3rem; }
  .hero-stats.wide { grid-template-columns: repeat(2, 1fr); }
  .subject-grid, .steps { grid-template-columns: 1fr; }
  /* phone: ring goes above the title instead of squeezing the text column */
  .subject-head { flex-direction: column-reverse; align-items: flex-start; gap: 12px; }
  /* section shortcuts: one swipeable row instead of a tall block of chips */
  .jump { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .jump .chip { flex: none; white-space: nowrap; }
  .jump::-webkit-scrollbar { display: none; }
  .subject-head .ring { width: 84px; height: 84px; }
  .skill-link { padding: 13px 14px; gap: 10px; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .rationale { margin-left: 14px; }
  .block { padding: 18px 16px; }
  /* figures: give the drawing every pixel so its labels stay readable */
  .figure { padding: 6px; margin-inline: -8px; }
  /* wide drawings keep a readable size and scroll sideways instead of shrinking their labels to ~6px */
  .figure svg.svg-wide { min-width: 520px; max-width: none; }
  /* a one-line number line is wide and short: it fits the screen (no sideways scroll to find the answer) and the
     card gives it the full width; taller drawings keep a readable minimum width */
  .hotspot { padding: 6px 0; border-inline: 0; border-radius: 0; margin-inline: -16px; }
  .hotspot svg.svg-wide { min-width: 520px; max-width: none; }
  /* phones: the set's progress bar scrolls with the page (sticky under the header it took ~90px of a small screen) */
  .pr-bar { position: static; }
  /* a question inside a lesson block: drop the outer card so the question gets the full width */
  .block-check_question { padding: 0; border: 0; }
  .block-check_question > .block-kind, .block-check_question > h2 { padding: 0 4px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .crumbs a { display: inline-flex; align-items: center; min-height: 40px; }
  #calc { left: 12px; right: 12px; bottom: 76px; width: auto; }
  .is-bare #calc { bottom: 12px; }
  .formula-row { flex-direction: column; align-items: flex-start; }
  .formula, .formula-words { text-align: left; }
}
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  /* always print with the light palette, even when the page is in dark mode */
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #f4f2ec; --ink: #16202e; --ink-2: #3c4656; --muted: #5f6878;
    --line: #d9d4c8; --line-2: #c9c3b5; --brand: #14213d; --good: #17722f; --bad: #c42b1c; --warn: #8a5c00;
    --good-bg: #e6f4ea; --bad-bg: #fdecea; --warn-bg: #fff4d6; --ctl: #8c8577; --on-state: #fff; color-scheme: light;
  }
  .site-head, .app-bar, .app-bar-x, .app-bar-space, .site-foot, .lesson-toc, .lesson-media, .q-actions, .spanish, .lesson-end, .jump, .skip-link,
  .back-btn, .tr-notice, .lang-pick, .lesson-pager, .crumbs, .app-btn, .menu { display: none !important; }
  /* nothing scrolls on paper: wide tables, formulas and figures fit the page instead of being cut off */
  .table-wrap, .math.display, .figure, .hotspot { overflow: visible !important; background: none; }
  .table-wrap table { font-size: .85rem; }
  .figure svg, .hotspot svg { min-width: 0 !important; max-width: 100% !important; }
  /* the table-of-contents column is not printed: the lesson uses the whole page */
  .lesson-layout { display: block; }
  :root { --focus: #2f6feb; }
  body { background: #fff; color: #16202e; }
  .block, .q { box-shadow: none; break-inside: avoid; }
  .panel, .formula-cards .fsec { box-shadow: none; background: #fff; }
  /* the formula sheet may break between rows, never inside one; no tabs or print button on paper */
  .formula-row { break-inside: avoid; }
  .tabs, [data-print] { display: none !important; }
  .pill.warn, .pill.good, .pill.bad { background: none !important; border: 1px solid currentColor; }
}
