/* ---- fonts (self-hosted, SIL Open Font Licence: see fonts/OFL-*.txt) ---- */
@font-face { font-family: 'IBM Plex Sans'; src: url('../fonts/plex-sans.woff2') format('woff2'); font-weight: 100 700; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/plex-mono-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('../fonts/newsreader.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('../fonts/newsreader-italic.woff2') format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Kalam'; src: url('../fonts/kalam-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Kalam'; src: url('../fonts/kalam-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* ---- themes ----
   Notebook is the default. With no data-theme attribute (the "match system" setting) dark mode
   gets Night desk. Tokens are set on [data-theme] rather than only :root, so any element can
   preview another theme (the Appearance screen's swatches). js/theme.js sets the attribute. */
:root, [data-theme='notebook'] {
  --bg: #f5efe3;
  --panel: #fffcf5;
  --panel-2: #eee7d8;
  --ink: #1f1c17;
  --muted: #5f584d;
  --line: #dcd2bf;
  --accent: #1f4e9e;
  --on-accent: #ffffff;
  --accent-soft: #e3eaf6;
  --ok: #1b6637;
  --ok-soft: #e1efe3;
  --bad: #a3341a;
  --bad-soft: #f6e2da;
  --on-bad: #ffffff;
  --suit-red: #a3341a;
  --tape: #1f1c17;
  --tape-ink: #f5efe3;
  --t-up: #86d9a2;
  --t-down: #ffa184;
  --grid: rgba(31, 28, 23, 0.06);
  --surface: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  --surface-size: 22px 22px;
  --display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --q-font: var(--display);
  --head-weight: 560;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #141519;
    --panel: #1d1f24;
    --panel-2: #25272d;
    --ink: #ece5d8;
    --muted: #a59e92;
    --line: #34363c;
    --accent: #93b6ff;
    --on-accent: #0e1526;
    --accent-soft: #22304d;
    --ok: #66cf91;
    --ok-soft: #17321f;
    --bad: #ff9673;
    --bad-soft: #3a2219;
    --on-bad: #1a0b05;
    --suit-red: #ff9673;
    --tape: #ece5d8;
    --tape-ink: #141519;
    --t-up: #1b6637;
    --t-down: #a3341a;
    --grid: rgba(236, 229, 216, 0.045);
    --surface: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    --surface-size: 22px 22px;
    --display: 'Newsreader', Georgia, 'Times New Roman', serif;
    --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;
    --q-font: var(--display);
    --head-weight: 560;
    --radius: 10px;
    color-scheme: dark;
  }
}
[data-theme='night'] {
  --bg: #141519;
  --panel: #1d1f24;
  --panel-2: #25272d;
  --ink: #ece5d8;
  --muted: #a59e92;
  --line: #34363c;
  --accent: #93b6ff;
  --on-accent: #0e1526;
  --accent-soft: #22304d;
  --ok: #66cf91;
  --ok-soft: #17321f;
  --bad: #ff9673;
  --bad-soft: #3a2219;
  --on-bad: #1a0b05;
  --suit-red: #ff9673;
  --tape: #ece5d8;
  --tape-ink: #141519;
  --t-up: #1b6637;
  --t-down: #a3341a;
  --grid: rgba(236, 229, 216, 0.045);
  --surface: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  --surface-size: 22px 22px;
  --display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --q-font: var(--display);
  --head-weight: 560;
  --radius: 10px;
  color-scheme: dark;
}
[data-theme='chalk'] {
  --bg: #1f2e27;
  --panel: #26382f;
  --panel-2: #2d4136;
  --ink: #f2f0e6;
  --muted: #c3ccc1;
  --line: #4a5c52;
  --accent: #f4d35e;
  --on-accent: #1f2e27;
  --accent-soft: #3b4a33;
  --ok: #a6e3b0;
  --ok-soft: #2e4a39;
  --bad: #f7a8a0;
  --bad-soft: #4a3431;
  --on-bad: #1f2e27;
  --suit-red: #f7a8a0;
  --tape: #f2f0e6;
  --tape-ink: #1f2e27;
  --t-up: #1b6637;
  --t-down: #a3341a;
  --grid: rgba(242, 240, 230, 0.05);
  --surface: radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.06), transparent 55%), radial-gradient(ellipse at 85% 60%, rgba(255, 255, 255, 0.035), transparent 50%);
  --surface-size: 100% 100%;
  --display: 'Kalam', 'Segoe Print', 'Bradley Hand', cursive;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --q-font: var(--body);
  --head-weight: 700;
  --radius: 6px;
  color-scheme: dark;
}
[data-theme='terminal'] {
  --bg: #0c0d0b;
  --panel: #141511;
  --panel-2: #1b1c17;
  --ink: #f0c35a;
  --muted: #bc9a4e;
  --line: #3b3420;
  --accent: #f0c35a;
  --on-accent: #0c0d0b;
  --accent-soft: #2a2412;
  --ok: #7edb92;
  --ok-soft: #13291a;
  --bad: #ff7a66;
  --bad-soft: #2f1612;
  --on-bad: #0c0d0b;
  --suit-red: #ff7a66;
  --tape: #f0c35a;
  --tape-ink: #0c0d0b;
  --t-up: #0b4f22;
  --t-down: #7a1a0c;
  --grid: rgba(240, 195, 90, 0.035);
  --surface: repeating-linear-gradient(0deg, var(--grid) 0 1px, transparent 1px 3px);
  --surface-size: auto;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --display: var(--mono);
  --body: var(--mono);
  --q-font: var(--mono);
  --head-weight: 600;
  --radius: 2px;
  color-scheme: dark;
}
/* Links and accents share the text colour in Terminal, so links keep an underline there. */
[data-theme='terminal'] main p a, [data-theme='terminal'] main li a { text-decoration: underline; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  background-image: var(--surface);
  background-size: var(--surface-size);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.55 var(--body);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, .brand { font-family: var(--display); font-weight: var(--head-weight); }
a { color: var(--accent); }
h1 { font-size: 1.85rem; line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.lede { color: var(--muted); margin-bottom: 22px; max-width: 70ch; }
.small { font-size: 0.85rem; color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---- layout ---- */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px;
  padding: 20px 12px; border-right: 1px solid var(--line); background: var(--panel);
}
.brand { font-size: 1.25rem; padding: 0 10px 16px; }
.brand span { color: var(--accent); }
.nav a {
  color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; white-space: nowrap;
}
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { padding: 32px 40px 80px; max-width: 980px; width: 100%; justify-self: center; }

.nav-foot { margin-top: auto; }
.lesson p:first-child { margin-top: 0; }
.lesson .examples { margin: 10px 0 14px; padding-left: 20px; }
.lesson .examples li { margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.nav { overflow-y: auto; }

/* bottom tab bar: phones only */
.tabbar { display: none; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: none; }
  main { padding: calc(18px + env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 0.7rem; padding: 4px 0;
  }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar svg circle { fill: currentColor; stroke: none; }
  .tabbar svg circle.ring { fill: none; stroke: currentColor; }
  .tabbar a.active { color: var(--accent); font-weight: 600; }
  h1 { font-size: 1.4rem; }
  .question { font-size: 1.05rem; }
  canvas { height: 220px; }
  .answer-row button { flex: 1 1 auto; }
}

/* touch ergonomics */
a, button, label, select, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
input[type='text'], select { font-size: 16px; } /* prevents iOS zoom-on-focus */
button, .btn { min-height: 40px; }

/* on-screen keypad */
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; user-select: none; }
.keypad.kp-3 { grid-template-columns: repeat(3, 1fr); }
.keypad button {
  min-height: 54px; font: 600 1.4rem var(--mono); background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  touch-action: manipulation;
}
.keypad .kp-op { color: var(--muted); font-size: 1.25rem; }
.keypad .kp-enter { font: 600 1rem var(--body); }
.keypad button:active { background: var(--accent-soft); }
.keypad .kp-enter { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.keypad.kp-disabled { opacity: 0.5; }
input.kp-active { outline: 2px solid var(--accent); outline-offset: -1px; }
input[readonly] { caret-color: transparent; }

/* multiple choice (80-in-8) */
.mc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mc button {
  min-height: 60px; font: 600 1.2rem var(--mono); background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mc button:hover { border-color: var(--accent); filter: none; }
.mc button .small { font-family: var(--body); font-weight: 400; }

/* case studies, menu, misc */
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; font-size: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 0.75rem; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.case-body ul, .sources { padding-left: 20px; margin: 6px 0 0; }
.case-body h3 { margin-top: 14px; }
.sources li { margin-bottom: 6px; }
.version { margin-top: 24px; font-family: var(--mono); }

/* mistakes deck */
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; margin-left: 4px;
  background: var(--bad); color: var(--on-bad); font-size: 0.72rem; font-weight: 700; line-height: 20px; text-align: center; vertical-align: 1px;
}
.badge[hidden] { display: none; }
.fb-note { font-weight: 400; opacity: 0.85; }
.due-card { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border-left: 3px solid var(--bad); margin-bottom: 8px; }

/* coach */
.recs { display: grid; gap: 10px; }
.rec { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.rec-body p { margin: 4px 0 0; }
.rec .btn { flex: none; }
@media (max-width: 520px) { .rec { flex-direction: column; align-items: stretch; } .rec .btn { text-align: center; } }
.coach-tip { margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); font-size: 0.92rem; }
.habit { margin-bottom: 14px; }
.habit-row { display: flex; justify-content: space-between; font-weight: 600; }
.habit .bar { margin: 6px 0 4px; }
.habit p { margin: 0; }

/* status chips: the reserved status hues on the icon badge, always with an icon + text label */
:root { --st-good: #0ca30c; --st-warn: #fab219; --st-crit: #d03b3b; }
.legend, .skill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.legend { margin: 6px 0 14px; }
.skill-topic { margin-bottom: 14px; }
.skill-topic h3 a { color: var(--ink); text-decoration: none; }
.sk {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 0.82rem; text-decoration: none;
}
a.sk:hover { border-color: var(--accent); }
.sk i {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font-style: normal; font-weight: 700; font-size: 0.75rem; line-height: 1;
}
.st-strong i { background: var(--st-good); color: #fff; }
.st-shaky i { background: var(--st-warn); color: #1b1d21; }
.st-weak i { background: var(--st-crit); color: #fff; }
.st-learning i { border: 1.5px solid var(--muted); color: var(--muted); }
.st-unseen i { border: 1.5px dashed var(--line); color: var(--muted); }
.st-unseen { color: var(--muted); }

/* accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* native app: no hover states on touch, no text selection on chrome */
.is-native .tabbar, .is-native .keypad, .is-native .mc { -webkit-user-select: none; user-select: none; }

/* interview bank */
.chips.filter { margin-bottom: 12px; }
.chips.filter .chip { text-decoration: none; padding: 5px 11px; font-size: 0.8rem; }
.chips.filter .chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tag.firm { margin-bottom: 0; }
.qlist { display: grid; gap: 10px; }
.qitem { display: block; color: var(--ink); text-decoration: none; }
.qitem:hover { border-color: var(--accent); }
.qitem .qtext { margin: 8px 0; }
.stem { margin: 0 0 10px; }
h1.q-title { font-size: 1.3rem; }
.card.note { border-left: 3px solid var(--bad); margin: 10px 0; font-size: 0.92rem; }
.intel ul { padding-left: 20px; margin: 8px 0; }
.intel summary { cursor: pointer; }
.followups { padding-left: 20px; }
.followups li { margin-bottom: 6px; }
.menu { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.menu a { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.menu a:hover { border-color: var(--accent); }

/* ---- components ---- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
}
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 8px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .v { font-family: var(--mono); font-size: 1.55rem; font-weight: 600; letter-spacing: -0.02em; }
.tile .k { color: var(--muted); font-size: 0.82rem; }

button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent); padding: 8px 16px; font-weight: 600; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

input[type='text'], input[type='number'], select {
  font: inherit; font-family: var(--mono); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { color: var(--muted); font-size: 0.88rem; }

.topic-card { display: block; color: inherit; text-decoration: none; }
.topic-card:hover { border-color: var(--accent); }
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin: 10px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); }

.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; margin-bottom: 10px;
}
.question { font-family: var(--q-font); font-size: 1.22rem; line-height: 1.45; margin-bottom: 16px; }
.answer-row { display: flex; gap: 8px; flex-wrap: wrap; }
.answer-row input { flex: 1 1 200px; font-size: 1.05rem; }
.fb { margin-top: 16px; padding: 12px 14px; border-radius: 8px; font-weight: 600; }
.fb.ok { background: var(--ok-soft); color: var(--ok); }
.fb.bad { background: var(--bad-soft); color: var(--bad); }
.solution { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.sim-out { margin-top: 10px; font-family: var(--mono); font-size: 0.88rem; }
details.notes { margin-bottom: 14px; }
details.notes summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.notes ul { margin: 8px 0 0; padding-left: 20px; }
.session { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; color: var(--muted); font-size: 0.9rem; }

.demo-banner {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between;
  padding: 8px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--accent-soft); font-size: 0.9rem;
}

/* standalone documents (privacy) */
main.doc { margin: 0 auto; max-width: 720px; display: block; }

/* home */
.eyebrow { font-family: var(--mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; }
.hero { padding: 28px 24px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 8px; }
.hero h1 { font-size: 1.7rem; margin-bottom: 10px; }
.hero p { color: var(--muted); max-width: 60ch; margin-bottom: 18px; }
.hero-alt { display: inline-block; margin-left: 14px; font-weight: 600; text-decoration: none; }
@media (max-width: 520px) { .hero .btn-lg { display: block; text-align: center; } .hero-alt { margin: 14px 0 0; } }
.steps { padding-left: 22px; margin: 0 0 14px; }
.steps li { margin-bottom: 10px; }
.upnext { border-left: 4px solid var(--accent); padding: 20px 22px; }
.upnext h2 { margin: 0 0 6px; font-size: 1.2rem; }
.upnext p { color: var(--muted); margin-bottom: 14px; }
.tiles a.tile { color: inherit; text-decoration: none; }
.tiles a.tile:hover { border-color: var(--accent); }
.tile .of { font-size: 0.95rem; color: var(--muted); font-weight: 500; }
.shortcuts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.shortcuts.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 18px; }
.shortcut { display: flex; flex-direction: column; gap: 3px; color: var(--ink); text-decoration: none; }
.shortcut span { color: var(--muted); font-size: 0.86rem; }
.shortcut:hover { border-color: var(--accent); }
.shortcut.primary { border-color: var(--accent); background: var(--accent-soft); }
.shortcut.primary span { color: var(--ink); opacity: 0.85; } /* muted grey on the tint was 4.4:1, below AA */
.menu-head { margin-top: 18px; }

/* question card */
.qcard { scroll-margin-top: 12px; }
.q-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.q-top .tag { margin-bottom: 0; }
.q-score { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.q-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
#p-hint.nudge { color: var(--bad); font-weight: 600; }
button.link { background: none; border: 0; color: var(--accent); padding: 6px 0; min-height: 0; font-weight: 600; }
button.link:hover { text-decoration: underline; filter: none; }
.qcard.has-keypad #p-btn { display: none; }
.next-btn { display: block; width: 100%; margin: 12px 0 4px; padding: 12px 16px; font-size: 1rem; }
#p-fb .fb { scroll-margin-top: 12px; }
.solution-box { margin-top: 12px; }
.solution-box > summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.solution-box .solution { margin-top: 8px; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 14px; max-width: 100%; overflow-x: auto; }
.seg a { padding: 6px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.card .seg { display: flex; width: 100%; max-width: 420px; }
.card .seg a { flex: 1; text-align: center; padding: 6px 8px; }
.grid > .card.wide { grid-column: 1 / -1; }
.seg a.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* mental maths */
.mm-q { font-family: var(--mono); font-size: 2.2rem; text-align: center; margin: 18px 0; font-variant-numeric: tabular-nums; }
.mm-top { display: flex; justify-content: space-between; font-family: var(--mono); color: var(--muted); }
.flash-ok { animation: fok 0.35s; }
.flash-bad { animation: fbad 0.35s; }
@keyframes fok { from { background: var(--ok-soft); } }
@keyframes fbad { from { background: var(--bad-soft); } }

/* market game */
.dice { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.die {
  width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center;
  font: 700 1.4rem var(--mono); border: 2px solid var(--line); background: var(--panel);
}
.die.hidden { color: var(--muted); background: var(--panel-2); border-style: dashed; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-family: var(--mono); }
.table-wrap { overflow-x: auto; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

/* lab */
canvas { width: 100%; height: 280px; display: block; background: var(--panel-2); border-radius: 8px; }
.controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.controls > div { display: flex; flex-direction: column; gap: 4px; }
.controls input[type='range'] { width: 160px; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.stats b { color: var(--ink); font-weight: 600; }

/* roadmap */
.stage { margin-bottom: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.check .auto { margin-left: auto; font-size: 0.8rem; color: var(--muted); white-space: nowrap; font-family: var(--mono); }
.check.done span.t { color: var(--muted); text-decoration: line-through; }

/* ---- charts (js/chart.js) ---- */
.chart { margin: 8px 0 0; }
.chart-plot { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.chart svg { width: 100%; height: 150px; display: block; overflow: visible; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chart path { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; font-size: 0.75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.chart-x { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }
.ch-s0 { stroke: var(--accent); }
.ch-s1 { stroke: var(--ok); }
.ch-s2 { stroke: var(--muted); }
.ch-s3 { stroke: var(--bad); }
.dashed { stroke-dasharray: 5 4; }
.chart .ch-target { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .ch-zero { stroke: var(--line); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.ch-key { display: inline-block; width: 16px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.ch-key.ch-s0 { border-color: var(--accent); }
.ch-key.ch-s1 { border-color: var(--ok); }
.ch-key.ch-s2 { border-color: var(--muted); }
.ch-key.ch-s3, .ch-key.ch-target { border-color: var(--bad); }
.ch-key.dashed, .ch-key.ch-target { border-top-style: dashed; }
.chart-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 12px; }
@media (max-width: 400px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-card { margin: 0; }
.heatmap { width: 100%; max-width: 420px; display: block; margin: 6px 0 10px; }
.hm-on { fill: var(--accent); }
.hm-off { fill: var(--panel-2); stroke: var(--line); stroke-width: 0.5; }
.unlock { padding-left: 20px; }
.h-link { font-size: 0.85rem; font-weight: 600; margin-left: 8px; }

/* ---- daily challenge ---- */
.daily-card { margin: 18px 0 0; }
.daily-squares { margin: 0 0 10px; }
.share-text { font-family: var(--mono); font-size: 0.85rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; user-select: all; }

/* ---- make me a market / bet sizing ---- */
.interviewer { font-weight: 600; margin: 10px 0; }
.interviewer::before { content: '“'; }
.interviewer::after { content: '”'; }
.mm-tape { margin: 0 0 6px; padding-left: 22px; }
.mm-tape li { margin-bottom: 4px; }
.mm-tape .say { color: var(--muted); font-style: italic; margin-left: 6px; }
.formula { font-family: var(--mono); font-size: 1.1rem; background: var(--panel-2); border-radius: 8px; padding: 8px 12px; display: inline-block; }
.chip-btn { min-height: 34px; padding: 4px 12px; }
input[type='range'] { accent-color: var(--accent); }

/* ---- Figgie ---- */
.suit { font-size: 1.25rem; line-height: 1; color: var(--ink); }
.fg-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fg-row:last-of-type { border-bottom: 0; }
.fg-suit { display: flex; align-items: center; gap: 16px; padding: 4px 0 6px; }
.fg-suit b { font-size: 1.1rem; }
.fg-book { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fg-book button { padding: 6px 8px; font-variant-numeric: tabular-nums; }
.fg-post { display: flex; gap: 6px; align-items: center; }
.fg-post input { width: 70px; }
.fg-post button { padding: 6px 10px; }
.fg-players { width: 100%; }
.fg-tape { margin: 0; padding-left: 20px; font-variant-numeric: tabular-nums; min-height: 4em; }
@media (max-width: 700px) {
  .fg-row { grid-template-columns: 1fr; gap: 6px; }
  .fg-post input { flex: 1; }
}

/* ---- online tests ---- */
.flash { font-family: var(--mono); font-size: 3rem; font-weight: 700; text-align: center; min-height: 1.6em; margin: 10px 0 16px; font-variant-numeric: tabular-nums; }

/* ---- think aloud ---- */
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
label.check input[type='checkbox'] { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.transcript { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; margin: 10px 0; max-height: 240px; overflow-y: auto; white-space: pre-wrap; }

/* ---- mental maths review ---- */
.review-item { padding: 12px 16px; margin-top: 8px; }
.review-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.review-meta { display: flex; gap: 8px; align-items: baseline; }
.review-how { margin: 6px 0 0; color: var(--ink); }
.flag { font-size: 0.78rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.flag.slow { background: var(--accent-soft); color: var(--ink); }
.flag.bad { background: var(--bad-soft); color: var(--ink); }

/* ---- ticker tape (js/flair.js) ---- */
:root { --ticker-h: 0px; }
.has-ticker { --ticker-h: 30px; }
.ticker {
  position: sticky; top: 0; z-index: 20; height: 30px; overflow: hidden;
  background: var(--tape); color: var(--tape-ink); font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em;
  display: flex; align-items: center;
}
.ticker-track { display: flex; width: max-content; animation: ticker var(--tk-dur, 40s) linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.tk-set { display: flex; }
.tk { white-space: nowrap; padding: 0 22px 0 0; }
.tk-k { opacity: 0.78; }
.tk-up { color: var(--t-up); font-weight: 600; }
.tk-down { color: var(--t-down); font-weight: 600; }
@keyframes ticker { to { transform: translateX(-50%); } }
[data-motion='off'] .ticker-track { animation: none; }
[data-motion='off'] .tk-set[aria-hidden] { display: none; }
.nav { top: var(--ticker-h); height: calc(100vh - var(--ticker-h)); }
@media (max-width: 760px) {
  .ticker { height: calc(30px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); box-sizing: border-box; }
  .has-ticker main { padding-top: 18px; }
}

/* ---- stamps, voice, scoreboard digits, die faces ---- */
.stamp {
  display: inline-block; transform: rotate(-7deg); margin: 0 6px; padding: 2px 9px; border: 2.5px double currentColor; border-radius: 4px;
  font-family: var(--mono); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.5; vertical-align: middle;
}
.stamp-ok { color: var(--ok); }
.stamp-accent { color: var(--accent); }
.stamp-bad { color: var(--bad); }
[data-motion='on'] .stamp { animation: stamp-in 0.38s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes stamp-in { from { transform: rotate(-16deg) scale(1.9); opacity: 0; } to { transform: rotate(-7deg) scale(1); opacity: 1; } }
.voice { font-family: var(--display); font-style: italic; font-size: 1.08rem; line-height: 1.45; color: var(--muted); margin: 4px 0 10px; }
[data-theme='chalk'] .voice, [data-theme='terminal'] .voice { font-style: normal; }
.flap { display: inline-flex; gap: 3px; vertical-align: middle; }
.flap span {
  position: relative; min-width: 0.95em; padding: 2px 3px; text-align: center; border-radius: 4px;
  background: var(--tape); color: var(--tape-ink); font-family: var(--mono); font-weight: 600;
}
.flap span::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--bg); opacity: 0.5; }
.tile .v .flap { font-size: 1.3rem; }
.pips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 34px; height: 34px; }
.pips i { border-radius: 50%; }
.pips i.on { background: currentColor; }
.die .pips { margin: auto; }
[data-motion='on'] .die.flip { animation: die-in 0.45s ease-out both; }
@keyframes die-in { from { transform: rotate(-90deg) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- week candles (home) ---- */
.candles { display: flex; align-items: flex-end; gap: 5px; height: 40px; }
.candle { position: relative; width: 8px; height: 40px; }
.candle .wick { position: absolute; left: 3.25px; width: 1.5px; background: currentColor; }
.candle .body { position: absolute; left: 0; width: 8px; border: 1.5px solid currentColor; border-radius: 1px; box-sizing: border-box; }
.candle.up { color: var(--ok); }
.candle.up .body { background: currentColor; }
.candle.down { color: var(--bad); }
.candle.none .body { left: 2px; width: 4px; height: 4px; bottom: 0; border-radius: 50%; background: var(--line); border: 0; }
.greet { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.greet .week { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ---- Figgie card faces and chip stacks ---- */
.card-face {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 58px; flex: none;
  border-radius: 6px; background: var(--bg); border: 1.5px solid var(--line); box-shadow: 2px 2px 0 var(--line); font-size: 1.6rem; line-height: 1;
}
.card-face.red, .suit.red { color: var(--suit-red); }
.card-face .corner { position: absolute; top: 2px; left: 4px; font-size: 0.7rem; }
.card-face .count {
  position: absolute; right: -9px; bottom: -9px; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 4px; box-sizing: border-box;
  background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-weight: 600; font-size: 0.78rem; display: flex; align-items: center; justify-content: center;
}
.chip-stack { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; margin-right: 6px; vertical-align: middle; }
.chip-stack i { width: 6px; border-radius: 2px; background: var(--accent); opacity: 0.85; }

/* ---- appearance ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.theme-opt {
  display: flex; flex-direction: column; padding: 0; text-align: left; overflow: hidden; color: var(--ink);
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px; min-height: 0;
}
.theme-opt:hover { filter: none; border-color: var(--muted); }
.theme-opt[aria-checked='true'] { border-color: var(--accent); }
.theme-opt .swatch {
  position: relative; display: block; height: 86px; background-color: var(--bg); background-image: var(--surface); background-size: var(--surface-size);
}
.theme-opt .swatch .sw-tape { display: block; height: 12px; background: var(--tape); }
.theme-opt .swatch .sw-head { position: absolute; left: 12px; top: 24px; font-family: var(--display); font-weight: var(--head-weight); font-size: 1.15rem; color: var(--ink); }
.theme-opt .swatch .sw-bar { position: absolute; left: 12px; bottom: 12px; width: 46px; height: 10px; border-radius: 3px; background: var(--accent); }
.theme-opt .swatch .sw-up { position: absolute; left: 66px; bottom: 12px; width: 24px; height: 10px; border-radius: 3px; background: var(--ok); }
.theme-opt .name { display: flex; justify-content: space-between; padding: 9px 12px; font-weight: 600; font-size: 0.92rem; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch { flex: none; position: relative; width: 48px; height: 28px; min-height: 0; padding: 0; border-radius: 14px; border: 0; background: var(--muted); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: var(--panel); transition: transform 0.15s; }
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(20px); background: var(--on-accent); }
.switch:hover { filter: none; }

/* Everything respects "less motion". */
[data-motion='off'] *, [data-motion='off'] *::before, [data-motion='off'] *::after { animation: none !important; transition: none !important; }
.daily-squares { display: flex; gap: 6px; align-items: center; }
.dq { width: 26px; height: 26px; border-radius: 5px; }
.dq.ok { background: var(--ok); }
.dq.bad { background: var(--bad); }
.dq { display: inline-flex; align-items: center; justify-content: center; color: var(--bg); font-weight: 700; font-size: 0.9rem; }
.dq.ok::after { content: '✓'; }
.dq.bad::after { content: '✗'; }
.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; }
.title-row h1 { margin: 0; }

/* Figgie on phones: card and prices side by side, the post-a-price row underneath. */
@media (max-width: 700px) {
  .fg-row { grid-template-columns: auto 1fr; gap: 10px 14px; }
  .fg-suit .small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* the card badge shows it */
  .fg-post { grid-column: 1 / -1; }
}

/* ---- tour ---- */
.tour { max-width: 620px; }
.tour h1 { font-size: 2.1rem; }
.tour-points { padding-left: 20px; margin: 0 0 14px; }
.tour-points li { margin-bottom: 6px; }
.tour-dots { display: flex; gap: 6px; margin: 18px 0; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--accent); width: 22px; border-radius: 4px; }

/* ---- interview plan ---- */
.plan-list { padding: 6px 16px; }
.plan-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.plan-item:last-child { border-bottom: 0; }
.plan-item.done > a { color: var(--muted); text-decoration: line-through; }
.plan-item .small { margin-left: auto; }
.tick {
  flex: none; width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 2px solid var(--muted); color: var(--on-accent); font-weight: 700;
}
.tick[aria-checked='true'] { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.tick:disabled { opacity: 1; cursor: default; }
@media (max-width: 520px) {
  .greet { flex-direction: column; align-items: flex-start; gap: 6px; }
  .greet .week { flex-direction: row-reverse; align-items: center; gap: 10px; }
}

/* ---- Zetamac settings ---- */
.zm-settings { margin-top: 12px; }
.zm-settings form { margin-top: 8px; }
.zm-settings label.check { flex-wrap: wrap; align-items: center; }
.zm-num { width: 70px; padding: 4px 6px; }

/* ---- sidebar sections ---- */
.nav-sec { margin-top: 6px; }
.nav-sec > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 10px 4px; border-radius: 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.nav-sec > summary::-webkit-details-marker { display: none; }
.nav-sec > summary::after { content: '›'; font-size: 1rem; line-height: 1; transform: rotate(90deg); transition: transform 0.15s; }
.nav-sec:not([open]) > summary::after { transform: rotate(0deg); }
.nav-sec > summary:hover { color: var(--ink); }
.nav-sec > a { display: block; }
.nav-home { margin-bottom: 2px; }

/* ---- static firm guide pages (tools/firm-pages.js) ---- */
main.static { margin: 0 auto; max-width: 860px; }
.crumbs { margin-bottom: 12px; }
.static-q { margin-top: 12px; }
.static-q ol { padding-left: 20px; }
.static-q li { margin-bottom: 10px; }
.static-q details { margin-top: 6px; }
.static-foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---- formula cards ---- */
.fc-card { min-height: 220px; display: flex; flex-direction: column; justify-content: center; gap: 18px; text-align: center; padding: 28px 22px; }
.fc-front { font-family: var(--q-font); font-size: 1.45rem; line-height: 1.35; }
.fc-back { font-size: 1.12rem; line-height: 1.5; padding-top: 16px; border-top: 1px dashed var(--line); }
.fc-list dt { font-weight: 600; margin-top: 10px; }
.fc-list dd { margin: 2px 0 0; color: var(--muted); }

/* search */
.nav-search { display: flex; justify-content: space-between; align-items: center; }
.nav-search kbd { font: 0.75rem var(--mono); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
@media (pointer: coarse) { .nav-search kbd { display: none; } }
.search-form input { width: 100%; font-size: 1.05rem; padding: 12px 14px; }
.search-list { display: grid; gap: 8px; }
.search-hit { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); }
.search-hit:hover { border-color: var(--accent); }
.search-back { color: var(--muted); }
.search-entry { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); margin-bottom: 8px; }
mark { background: var(--accent-soft); color: inherit; border-radius: 2px; padding: 0 1px; }

/* interview question tracking */
.qrow { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
.qmarks { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.qmark { width: 40px; height: 40px; padding: 0; border-radius: 50%; font: 600 1.05rem var(--mono); background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.qmark.done[aria-pressed='true'] { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.qmark.unsure[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.qrow.s-done .qitem { border-left: 3px solid var(--ok); }
.qrow.s-unsure .qitem { border-left: 3px solid var(--accent); }
.status-tag { font-size: 0.72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.status-tag.done { color: var(--ok); }
.status-tag.unsure { color: var(--accent); }
.qstatus { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.bank-progress { margin-bottom: 10px; }
.bar.stack { display: flex; height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin-top: 8px; }
.bar.stack i { display: block; height: 100%; background: var(--ok); }
.bar.stack i.unsure { background: var(--accent); }

/* hints */
.hints { margin: 6px 0 10px; }
.hint-list { margin: 0 0 6px; padding-left: 1.4em; display: grid; gap: 4px; }
.hint-list li { background: var(--accent-soft); border-radius: 6px; padding: 6px 10px; }
.hint-list li::marker { color: var(--muted); }
.hint-end { margin: 4px 0 0; }

/* structured worked solutions */
.solution .sol-idea { margin: 0 0 8px; }
.solution .sol-steps { margin: 0 0 8px; padding-left: 1.4em; display: grid; gap: 4px; }
.solution .sol-check, .solution .sol-trap { margin: 6px 0 0; font-size: 0.92em; }
.solution .sol-trap b { color: var(--bad); }
.solution .sol-check b { color: var(--ok); }

/* automatic backups */
.backups > summary { cursor: pointer; }
.backup-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.backup-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.newer-banner { position: sticky; top: 0; z-index: 50; }
