/* Two bundled typefaces, so every device shows the same type (SIL Open Font License, see assets/fonts/OFL-*.txt):
   Inter for interface and reading text, Playfair Display for headings and big numbers. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("assets/fonts/inter-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/playfair-display-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/playfair-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400; font-display: swap; src: url("assets/fonts/playfair-display-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 700; font-display: swap; src: url("assets/fonts/playfair-display-latin-700-italic.woff2") format("woff2"); }

/* ==========================================================================
   firststock prototype styles. Local/system fonts only, no external URLs.
   Colors, type and spacing follow the Figma file (cream, navy, lime).
   Type, icon and tap sizes come from the tokens at the top of :root; use them instead of raw px.
   Theme: light/dark via prefers-color-scheme with a [data-theme] override.
   Figma icons are <img class="ic">; in dark mode they are inverted unless
   marked .ic-keep (art that sits on navy or lime keeps its colors).
   ========================================================================== */

:root {
  --stage: #E4E2D6;
  --bg: #F7F5ED;
  --surface: #FFFEF9;
  --surface-2: #F7F5ED;
  --line: #DDDCD1;
  --ink: #172D40;
  --muted: #5C6762;
  --green: #285D40;
  --green-soft: #E9F0DC;
  --green-line: #CBD8BC;
  --lime: #C4ED93;
  --slate: #6E93B3;
  --slate-soft: #E6EBEF;
  --hero: #172D40;
  --on-hero: #F7F5ED;
  --on-hero-muted: #CFD9DC;
  --on-hero-soft: #D4DBDA;
  --hero-line: #3A4D5A;
  --hero-track: #405464;
  --navy: #172D40;
  --loss: #B42318;
  --loss-soft: #FBE7E4;
  --on-loss: #FFFFFF;
  --gain: #285D40;
  --focus: #1D4ED8;
  /* One main-action color per theme, and one "selected" fill for chips, segments and amounts. */
  --primary: #172D40;
  --on-primary: #F7F5ED;
  --primary-accent: #C4ED93;
  --selected: #172D40;
  --on-selected: #F7F5ED;
  --mix-1: #172D40;
  --mix-2: #6E93B3;
  --mix-3: #C4ED93;
  --mix-4: #285D40;
  --mix-5: #B9C7A3;
  --mix-6: #A3B4C3;
  --icon-filter: none;
  --radius-lg: 18px;
  --radius-md: 10px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --display: var(--serif);

  /* Type scale, close to Apple's default text styles. rem, so a reader's larger browser text setting
     scales everything. Reading text is 15–16px; 13px is for labels and meta only; 12px is the floor. */
  --fs-caption: 0.75rem;    /* 12: tags, tab labels, table heads */
  --fs-footnote: 0.8125rem; /* 13: meta lines, fine print */
  --fs-sub: 0.9375rem;      /* 15: secondary reading text, buttons, list rows */
  --fs-body: 1rem;          /* 16: body text and inputs */
  --fs-headline: 1.0625rem; /* 17: card and row titles */
  --fs-title3: 1.25rem;     /* 20: section titles */
  --fs-title2: 1.375rem;    /* 22: sheet titles, key numbers */
  --fs-title1: 1.75rem;     /* 28: balances */
  --fs-large: 2.125rem;     /* 34: screen titles */
  --fs-hero: 2.5rem;        /* 40: the one big number or name on a screen */
  --lh-display: 1.1;
  --lh-title: 1.25;
  --lh-body: 1.5;

  /* Icons on three sizes; anything tappable gets at least a 44px hit area (Apple HIG, WCAG 2.5.5). */
  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 24px;
  --tap: 44px;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --stage: #070C11;
  --bg: #0F1A23;
  --surface: #15232E;
  --surface-2: #1B2B37;
  --line: #2B3B47;
  --ink: #EEF0E6;
  --muted: #A3ADA8;
  --green: #A5D9B3;
  --green-soft: #1C3226;
  --green-line: #2F4A38;
  --slate: #86A9C6;
  --slate-soft: #22323F;
  --hero: #1F3A50;
  --hero-line: #3A5568;
  --hero-track: #4A6276;
  --loss: #F28B82;
  --loss-soft: #3A1F1D;
  --on-loss: #2B0A07;
  --gain: #A5D9B3;
  --focus: #93C5FD;
  --primary: #C4ED93;
  --on-primary: #10202C;
  --primary-accent: #10202C;
  --selected: #EEF0E6;
  --on-selected: #0F1A23;
  --mix-1: #5C7FA0;
  --mix-4: #7DB894;
  --icon-filter: invert(1) hue-rotate(180deg) brightness(1.05);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stage: #070C11;
    --bg: #0F1A23;
    --surface: #15232E;
    --surface-2: #1B2B37;
    --line: #2B3B47;
    --ink: #EEF0E6;
    --muted: #A3ADA8;
    --green: #A5D9B3;
    --green-soft: #1C3226;
    --green-line: #2F4A38;
    --slate: #86A9C6;
    --slate-soft: #22323F;
    --hero: #1F3A50;
    --hero-line: #3A5568;
    --hero-track: #4A6276;
    --loss: #F28B82;
    --loss-soft: #3A1F1D;
    --on-loss: #2B0A07;
    --gain: #A5D9B3;
    --focus: #93C5FD;
  --primary: #C4ED93;
  --on-primary: #10202C;
  --primary-accent: #10202C;
  --selected: #EEF0E6;
  --on-selected: #0F1A23;
    --mix-1: #5C7FA0;
    --mix-4: #7DB894;
    --icon-filter: invert(1) hue-rotate(180deg) brightness(1.05);
    color-scheme: dark;
  }
}

/* School chips (Campus rivals board, onboarding) */
[data-school-chip="psu"] { --chip-bg: #1E407C; --chip-fg: #FFFFFF; }
[data-school-chip="osu"] { --chip-bg: #BB0000; --chip-fg: #FFFFFF; }
[data-school-chip="umich"] { --chip-bg: #00274C; --chip-fg: #FFCB05; }
[data-school-chip="rutgers"] { --chip-bg: #CC0033; --chip-fg: #FFFFFF; }
[data-school-chip="pitt"] { --chip-bg: #003594; --chip-fg: #FFB81C; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--stage);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.icon { width: var(--icon-md); height: var(--icon-md); flex: none; vertical-align: middle; }
.icon.inline { width: var(--icon-sm); height: var(--icon-sm); }
img.ic { display: block; flex: none; filter: var(--icon-filter); }
img.ic-keep { filter: none; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { top: 8px; }

/* ---------- Phone frame ---------- */
.stage { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; }
.device {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 500px) {
  .stage { padding: 24px; }
  .device {
    width: 422px;
    height: min(894px, calc(100vh - 48px));
    border-radius: 46px;
    border: 10px solid #0E1117;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  }
}

#view {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(16px, env(safe-area-inset-top)) 22px 28px;
  -webkit-overflow-scrolling: touch;
}
#view:focus, #view:focus-visible { outline: none; }
.screen { display: flex; flex-direction: column; gap: 22px; }
.section { display: flex; flex-direction: column; gap: 12px; }
.noscript { padding: 24px; }

/* ---------- Tab bar ---------- */
.tabbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 0 max(16px, env(safe-area-inset-bottom));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  font-size: var(--fs-caption); color: var(--muted); text-decoration: none;
}
.tab-pill { display: flex; align-items: center; justify-content: center; width: 48px; height: 27px; border-radius: 100px; color: var(--ink); }
/* With very large text a label shortens instead of pushing the bar off the screen. */
.tabbar a > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar a[aria-current="page"] .tab-pill { background: var(--lime); color: var(--navy); }
.tabbar a[aria-current="page"] img.ic { filter: none; }

/* ---------- Type ---------- */
.display { font-family: var(--serif); font-weight: 400; font-size: var(--fs-large); line-height: var(--lh-display); color: var(--ink); }
.display-hero { font-size: var(--fs-large); line-height: var(--lh-display); }
.display-md { font-family: var(--serif); font-weight: 400; font-size: var(--fs-title1); line-height: var(--lh-display); }
.display-sm { font-family: var(--serif); font-weight: 400; font-size: var(--fs-title2); line-height: var(--lh-title); }
.section-title { font-family: var(--serif); font-weight: 700; font-size: var(--fs-title3); line-height: var(--lh-title); }
.mono, .mono-label { font-variant-numeric: tabular-nums; }
.mono-label { font-size: var(--fs-footnote); color: var(--muted); }
.mono-label.green, .green { color: var(--green); }
.muted { color: var(--muted); }
.lede { font-size: var(--fs-body); line-height: var(--lh-body); }
.small-copy { font-size: var(--fs-sub); line-height: var(--lh-body); }
.fine { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--muted); }
.center { text-align: center; }
.empty-note { font-size: var(--fs-sub); color: var(--muted); line-height: var(--lh-body); }
.chg { font-variant-numeric: tabular-nums; }
.chg-up { color: var(--gain); }
.chg-down { color: var(--loss); }
.chg-flat { color: var(--muted); }
.ok { color: var(--green); font-weight: 600; display: flex; gap: 6px; align-items: center; }

.page-head { display: flex; flex-direction: column; gap: 14px; }
.page-context { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 23px; }
.page-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.back-btn {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  margin: -13px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-decoration: none;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-meta { font-size: var(--fs-footnote); font-weight: 600; color: var(--green); white-space: nowrap; }
.text-link {
  font-size: var(--fs-sub); font-weight: 600; color: var(--green); text-decoration: none; white-space: nowrap;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.center-link { align-self: center; font-size: var(--fs-sub); }
.status-chip {
  display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 100px; flex: none;
  background: var(--green-soft); color: var(--green); font-size: var(--fs-caption); line-height: var(--lh-title); white-space: nowrap;
}

/* ---------- Cards, CTAs, buttons ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 17px; }
.card-outline { background: transparent; }
.hero-card {
  background: var(--hero); color: var(--on-hero); border-radius: var(--radius-lg); padding: 19px;
  display: flex; flex-direction: column; gap: 15px;
}
.hero-card .mono-label, .on-hero-muted { color: var(--on-hero-muted); }
.on-hero-soft { color: var(--on-hero-soft); font-size: var(--fs-sub); line-height: var(--lh-body); }
.hero-rule { border: 0; height: 1px; background: var(--hero-line); margin: 0; }
.lime { color: var(--lime); }

.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  min-height: 52px; padding: 0 17px; border-radius: var(--radius-md); border: 0;
  font-size: var(--fs-sub); text-decoration: none; cursor: pointer; text-align: left;
}
.cta-dark { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.cta-dark .icon { color: var(--primary-accent); }
.cta .icon { width: var(--icon-md); height: var(--icon-md); }
.cta-lime { background: var(--lime); color: var(--navy); font-weight: 700; min-height: 47px; padding: 0 15px; }
.cta:disabled { opacity: .45; cursor: not-allowed; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 8px 14px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: var(--fs-sub); font-weight: 600; text-decoration: none; cursor: pointer; line-height: var(--lh-title);
}
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: var(--fs-sub); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-secondary { background: var(--green-soft); color: var(--green); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--loss); color: var(--on-loss); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--tap); height: var(--tap); border-radius: var(--radius-md); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn-plain { width: var(--tap); height: var(--tap); margin: -13px; border: 0; background: none; }

.icon-tile {
  width: 43px; height: 43px; border-radius: var(--radius-md); background: var(--green-soft);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.icon-tile.small { width: 34px; height: 34px; background: var(--slate-soft); }

/* Hit areas: small controls keep their look but are at least 44px to the finger (NN/g: about 1cm). */
.text-link, .btn-small, .scope-chip { position: relative; }
.text-link::after, .btn-small::after, .scope-chip::after {
  content: ""; position: absolute; left: 0; right: 0;
  top: min(0px, calc((100% - var(--tap)) / 2)); bottom: min(0px, calc((100% - var(--tap)) / 2));
}

/* Tap feedback: a quick press-in so every tap visibly lands. */
.btn, .cta, .icon-btn, .answer, .amount-choice, .scope-chip, .pick, .school-option {
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease;
}
.btn:active:not(:disabled), .cta:active:not(:disabled), .icon-btn:active, .answer:active:not(:disabled),
.amount-choice:active, .scope-chip:active, .pick:active, .school-option:active { transform: scale(.97); }

/* Glossary terms */
.term {
  background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: help;
  border-bottom: 1.5px dotted currentColor; line-height: inherit; text-align: inherit;
}
.term:hover { color: var(--green); }

/* Badges, progress, chips */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px;
  font-variant-numeric: tabular-nums; font-size: var(--fs-footnote); font-weight: 600; font-variant-numeric: tabular-nums;
}
.badge-big { font-size: var(--fs-headline); padding: 6px 12px; }
.badge.grade-good { background: var(--green-soft); color: var(--green); }
.badge.grade-neutral { background: var(--slate-soft); color: var(--ink); }
.badge.grade-bad { background: var(--loss-soft); color: var(--loss); }

.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.segments { display: flex; gap: 5px; }
.segments > span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.segments > span.is-done { background: var(--green); }
.segments-hero { gap: 4px; }
.segments-hero > span { height: 5px; background: var(--hero-track); }
.segments-hero > span.is-done { background: var(--lime); }

.school-chip {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: var(--fs-caption); font-weight: 700;
  background: var(--chip-bg); color: var(--chip-fg); letter-spacing: .03em; vertical-align: 1px;
}
.tag { font-size: var(--fs-caption); font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--slate-soft); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: var(--fs-sub); padding: 5px 10px; border-radius: 100px; background: var(--surface); border: 1px solid var(--line); }

.scope-chips { display: flex; gap: 5px; }
.scope-chip {
  flex: 1; min-width: 0; height: 40px; padding: 0 6px; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: var(--fs-footnote); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scope-chip.is-active { background: var(--selected); border-color: var(--selected); color: var(--on-selected); }

.notice {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--green-soft); color: var(--green); font-size: var(--fs-sub); line-height: var(--lh-body);
}
.notice-plain { color: var(--ink); }
.notice-plain b { color: var(--green); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field + .field { margin-top: 14px; }
label, legend { font-weight: 600; font-size: var(--fs-sub); }
legend { margin-bottom: 6px; padding: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: var(--fs-body);
}
textarea { resize: vertical; min-height: 110px; line-height: var(--lh-body); }
.field-error { color: var(--loss); font-size: var(--fs-sub); font-weight: 600; line-height: var(--lh-body); }

/* ---------- Onboarding ---------- */
.onb-hero { display: flex; flex-direction: column; gap: 14px; }
.onb-points { display: grid; gap: 8px; font-size: var(--fs-sub); }
.onb-points li { display: flex; gap: 10px; align-items: center; }
.form { display: flex; flex-direction: column; }
.form .cta { margin-top: 18px; }
.form .fine { margin-top: 10px; }
.school-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.school-option {
  display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: var(--fs-sub);
}
.school-option { position: relative; padding: 12px; font-size: var(--fs-sub); }
.school-option:has(input:checked) { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--green-soft); font-weight: 600; }
.school-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--chip-bg); flex: none; }

/* ---------- Home ---------- */
.brand-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-lockup { display: flex; align-items: center; gap: 7px; }
.brand-mark { width: 29px; height: 29px; border-radius: 8px; background: var(--navy); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-name { font-size: var(--fs-title3); color: var(--ink); }
.welcome { display: flex; flex-direction: column; gap: 8px; }
.greet-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.snapshot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.snapshot-balance { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.snapshot-value { font-size: var(--fs-title1); line-height: var(--lh-title); font-variant-numeric: tabular-nums; }
.snapshot-sub { font-size: var(--fs-footnote); color: var(--muted); }
.snapshot-side {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding-left: 13px;
  border-left: 1px solid var(--line); text-decoration: none; flex: none;
}
.snapshot-side b { font-size: var(--fs-headline); font-weight: 700; }
.snapshot-side small { font-size: var(--fs-caption); color: var(--muted); }

.lesson-feature { padding: 20px; gap: 17px; }
.lesson-meta { display: flex; gap: 32px; font-size: var(--fs-caption); color: var(--lime); }
.lesson-preview { display: flex; align-items: center; gap: 12px; }
.lesson-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.lesson-copy p { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--on-hero-soft); }
.lesson-rewards { display: flex; gap: 14px; font-variant-numeric: tabular-nums; font-size: var(--fs-footnote); }

.team-card { display: flex; align-items: center; gap: 13px; padding: 16px; text-decoration: none; }
.team-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.team-title { font-size: var(--fs-sub); }
.team-copy small { font-size: var(--fs-footnote); color: var(--muted); }
.safety { display: flex; gap: 7px; align-items: flex-start; font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); }
.safety img { margin-top: 2px; }

.demo { padding: 12px 16px; }
.demo summary { font-weight: 600; font-size: var(--fs-footnote); cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }
.demo[open] > * + * { margin-top: 10px; }
.demo p { font-size: var(--fs-sub); }
.demo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--fs-footnote); }
.demo-row select { width: auto; min-width: 120px; min-height: var(--tap); padding: 6px 10px; }

/* ---------- Lesson sheet ---------- */
.lesson-progress { display: flex; flex-direction: column; gap: 7px; }
.lesson-body { display: flex; flex-direction: column; gap: 15px; touch-action: pan-y; }
.lesson-lead { font-size: var(--fs-headline); line-height: var(--lh-body); }
.compare-card { display: flex; flex-direction: column; gap: 15px; padding: 18px; }
.compare-row { display: flex; align-items: center; gap: 12px; }
.compare-label { width: 72px; flex: none; font-variant-numeric: tabular-nums; font-size: var(--fs-caption); line-height: var(--lh-body); color: var(--muted); }
.compare-bars { flex: 1; display: flex; gap: 4px; }
.bar { height: 35px; border-radius: 6px; flex: 1; }
.bar-navy { background: var(--mix-1); }
.bar-lime { background: var(--lime); flex: 90; }
.bar-slate { background: var(--slate); flex: 68; }
.compare-bars .bar-lime + .bar-slate + .bar-navy { flex: 72; }
.compare-note { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); }

.knowledge-check { display: flex; flex-direction: column; gap: 12px; }
.check-head { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; font-size: var(--fs-caption); color: var(--muted); }
.answers { display: flex; flex-direction: column; gap: 12px; }
.answer {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 14px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; font-size: var(--fs-sub); color: var(--ink);
}
.answer-key { font-variant-numeric: tabular-nums; font-size: var(--fs-footnote); color: var(--muted); }
.answer-text { flex: 1; }
.answer.is-right { background: var(--green-soft); border: 1.5px solid var(--green); padding: 13.5px; }
.answer.is-right .answer-text { font-weight: 600; }
.answer.is-right .answer-key { color: var(--green); }
.answer.is-wrong { border: 1.5px solid var(--loss); padding: 13.5px; }
.answer:disabled { cursor: default; }
.answer:disabled:not(.is-right) { opacity: .6; }
.answer-feedback { font-size: var(--fs-sub); line-height: var(--lh-body); }
.answer-feedback.is-right { color: var(--green); }
.answer-feedback.is-wrong { color: var(--loss); }
.lesson-reward { display: flex; flex-direction: column; gap: 10px; }
.reward-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: var(--fs-sub); }
.reward-row b { font-weight: 600; }
.reward-row .mono { font-size: var(--fs-footnote); color: var(--green); }
.payout { text-align: center; display: grid; gap: 8px; padding: 22px 17px; }
.payout-amount { font-family: var(--serif); font-size: var(--fs-title2); line-height: var(--lh-title); color: var(--green); }
.payout .muted { font-size: var(--fs-footnote); }
.unlock-list { display: grid; gap: 6px; font-size: var(--fs-sub); font-weight: 600; justify-items: center; }
.unlock-list li { display: flex; gap: 6px; align-items: center; }
.unlock-list .icon { width: var(--icon-sm); height: var(--icon-sm); color: var(--green); }

/* ---------- Practice ---------- */
.overview { gap: 15px; }
.overview-top { display: flex; flex-direction: column; gap: 5px; }
.overview-total { font-size: var(--fs-hero); line-height: var(--lh-title); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.overview-split { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: var(--fs-footnote); color: var(--on-hero-muted); }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-footnote); }
.chart-head .mono { font-size: var(--fs-caption); }
.holdings-chart { position: relative; height: 79px; }
.holdings-chart .spark { position: relative; width: 100%; height: 71px; color: var(--lime); }
.holdings-chart polyline { stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-guide { position: absolute; left: 0; right: 0; top: 62px; height: 1px; background: var(--hero-line); }
.chart-foot { display: flex; justify-content: space-between; gap: 6px; font-size: var(--fs-caption); color: var(--on-hero-muted); }
.chart-empty { font-size: var(--fs-footnote); color: var(--on-hero-muted); }

.alloc-bar { display: flex; gap: 3px; }
.alloc-bar > span { height: 12px; border-radius: 3px; min-width: 4px; flex-basis: 0; }
.alloc-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.alloc-legend li { display: flex; flex-direction: column; gap: 5px; font-variant-numeric: tabular-nums; font-size: var(--fs-caption); color: var(--muted); }
.alloc-legend li:nth-child(3n+2) { align-items: center; }
.alloc-legend li:nth-child(3n) { align-items: flex-end; }
.alloc-legend a { display: flex; align-items: center; gap: 5px; text-decoration: none; color: var(--ink); }
.alloc-legend b { font-weight: 400; }
.legend-key { width: 6px; height: 6px; border-radius: 2px; flex: none; }
.mix-1 { background: var(--mix-1); }
.mix-2 { background: var(--mix-2); }
.mix-3 { background: var(--mix-3); }
.mix-4 { background: var(--mix-4); }
.mix-5 { background: var(--mix-5); }
.mix-6 { background: var(--mix-6); }
.spread { display: grid; gap: 6px; }
.spread-head { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-footnote); }
.spread-head .mono { font-size: var(--fs-footnote); color: var(--muted); }

.discover-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.discover { display: flex; flex-direction: column; gap: 10px; padding: 14px; text-decoration: none; color: var(--ink); min-width: 0; }
.discover-top { display: flex; justify-content: space-between; align-items: center; }
.ticker-badge { font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-footnote); padding: 7px; border-radius: 7px; background: var(--slate-soft); }
.ticker-badge.is-fund { background: var(--green-soft); }
.discover-id { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-footnote); }
.discover-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.discover-note { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); }

#all-tickers { scroll-margin-top: 12px; }
#all-tickers:focus { outline: none; }
.search-field {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--muted); cursor: text;
}
.search-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.search-field input[type="search"] {
  flex: 1; min-width: 0; min-height: var(--tap); padding: 0; border: 0; background: transparent; color: var(--ink);
  font-size: var(--fs-body); outline: none; -webkit-appearance: none; appearance: none;
}
.search-field input[type="search"]::placeholder { color: var(--muted); }
.search-note { font-size: var(--fs-footnote); color: var(--muted); line-height: var(--lh-body); margin: 0 0 8px; }
.ticker-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.ticker-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 13px 16px; color: inherit; text-decoration: none; border-top: 1px solid var(--line);
}
.ticker-list li:first-child .ticker-row { border-top: 0; }
.t-id, .t-px { display: flex; flex-direction: column; min-width: 0; }
.t-id b { font-weight: 600; font-size: var(--fs-sub); }
.t-id small { color: var(--muted); font-size: var(--fs-footnote); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-px { text-align: right; font-variant-numeric: tabular-nums; font-size: var(--fs-sub); }
.t-px small { font-size: var(--fs-footnote); }
.locked-tag { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: var(--fs-footnote); font-family: var(--sans); }
.locked-tag .icon { width: var(--icon-sm); height: var(--icon-sm); }
.is-locked .t-id b { color: var(--muted); }
.spark { display: block; }
.spark-up { color: var(--gain); }
.spark-down { color: var(--loss); }

/* ---------- Stock review ---------- */
.security { display: flex; align-items: center; gap: 12px; }
.monogram {
  width: 47px; height: 47px; border-radius: 12px; background: var(--navy); color: var(--lime); flex: none;
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-headline); display: flex; align-items: center; justify-content: center;
}
.security-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.security-name { font-size: var(--fs-headline); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.security-quote { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.quote { font-variant-numeric: tabular-nums; font-size: var(--fs-body); font-variant-numeric: tabular-nums; }
.security-quote small { font-size: var(--fs-caption); color: var(--muted); }
.about { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.about summary { font-size: var(--fs-sub); font-weight: 600; color: var(--green); cursor: pointer; }
.about[open] > * + * { margin-top: 10px; }
.desc { font-size: var(--fs-sub); line-height: var(--lh-body); }
.chart .spark { width: 100%; height: 120px; }
.chart-cap { font-size: var(--fs-footnote); color: var(--muted); margin-top: 6px; }
.owned { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-footnote); }

.amount-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.amount-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: var(--fs-footnote); font-weight: 600; }
.amount-head .mono-label { font-weight: 400; }
.amount-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.amount-value { font-size: var(--fs-hero); font-weight: 600; line-height: var(--lh-title); font-variant-numeric: tabular-nums; }
.amount-input { display: flex; align-items: center; font-size: var(--fs-hero); font-weight: 600; line-height: var(--lh-title); min-width: 0; }
.amount-input input {
  width: 170px; min-height: 0; padding: 0 0 2px; border: 0; border-bottom: 2px solid var(--line); border-radius: 0;
  background: transparent; font-size: var(--fs-hero); font-weight: 600;
}
.amount-input input:focus-visible { outline: none; border-bottom-color: var(--green); }
.amount-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.amount-choice {
  flex: 1; min-height: var(--tap); padding: 0 4px; border-radius: var(--radius-md); border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--fs-sub);
}
.amount-choice.is-active { background: var(--selected); color: var(--on-selected); font-weight: 600; }
.shares-line { font-size: var(--fs-sub); color: var(--muted); }
.amount-card .field + .field, .amount-card .field { margin-top: 0; }
.pick-preview { display: flex; flex-direction: column; gap: 22px; }
.pick-confirm { display: flex; flex-direction: column; gap: 12px; }
.cash-after { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-footnote); }
.cash-after span:first-child { color: var(--muted); }
.locked-card { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; font-size: var(--fs-sub); line-height: var(--lh-body); }
p.locked-card { flex-direction: row; align-items: center; }

/* AI coach card (Stock review + Coach) */
.coach-card { background: var(--green-soft); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 15px; }
.coach-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.coach-label { display: flex; align-items: center; gap: 7px; color: var(--green); }
.coach-tag { font-size: var(--fs-caption); color: var(--green); }
.coach-score { display: flex; align-items: center; gap: 15px; }
.mult-tile {
  width: 93px; height: 79px; border-radius: var(--radius-md); background: var(--navy); flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.mult-value { font-size: var(--fs-title1); line-height: var(--lh-title); color: var(--lime); font-variant-numeric: tabular-nums; }
.mult-label { font-variant-numeric: tabular-nums; font-size: var(--fs-caption); color: #F7F5ED; }
.coach-game { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.coach-grade { font-size: var(--fs-sub); font-weight: 400; }
.coach-game-note { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--green); }
.coach-feedback { display: flex; flex-direction: column; gap: 8px; }
.coach-feedback p { font-size: var(--fs-sub); line-height: var(--lh-body); }
.coach-tip { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--green); }
.coach-tip img { margin-top: 1px; }
.coach-rule { border: 0; height: 1px; background: var(--green-line); margin: 0; }
.coach-fine { font-size: var(--fs-caption); line-height: var(--lh-body); color: var(--green); }
.factors-wrap summary { font-size: var(--fs-sub); font-weight: 600; color: var(--green); cursor: pointer; }
.factors { margin-top: 10px; display: grid; gap: 10px; }
.factor { display: grid; grid-template-columns: 50px 1fr; gap: 8px; font-size: var(--fs-sub); line-height: var(--lh-body); }
.factor b { font-weight: 600; }
.f-delta { font-variant-numeric: tabular-nums; font-size: var(--fs-footnote); text-align: center; padding: 2px 0; border-radius: 6px; background: var(--surface); height: fit-content; }
.factor-pos .f-delta { color: var(--gain); }
.factor-neg .f-delta { color: var(--loss); }

/* ---------- Campus ---------- */
.scope { display: flex; flex-direction: column; gap: 10px; }
.scope-note { font-size: var(--fs-footnote); color: var(--muted); }
.panel { display: flex; flex-direction: column; gap: 22px; }
.panel:focus-visible { outline-offset: 4px; }
.rank-hero { gap: 16px; }
.rank-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rank-block { display: flex; flex-direction: column; gap: 5px; }
.rank-num { display: flex; align-items: center; gap: 12px; }
.rank-big { font-family: var(--serif); font-size: var(--fs-hero); line-height: var(--lh-display); }
.rank-of { font-size: var(--fs-footnote); font-weight: 600; color: var(--lime); }
.rank-points { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rank-points p { font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-headline); color: var(--lime); }
.rank-note { font-size: var(--fs-sub); line-height: var(--lh-body); }

.podium { display: flex; gap: 9px; align-items: flex-end; }
.podium-member { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium-name { font-size: var(--fs-sub); font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-step {
  width: 100%; border-radius: 9px 9px 0 0; background: var(--slate-soft); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding-top: 10px;
}
.podium-step .place { font-family: var(--serif); font-size: var(--fs-title2); line-height: var(--lh-title); }
.podium-step .pts { font-variant-numeric: tabular-nums; font-size: var(--fs-caption); }
.p1 .podium-step { height: 92px; background: var(--lime); color: var(--navy); }
.p2 .podium-step { height: 72px; }
.p3 .podium-step { height: 59px; }
.avatar {
  width: 35px; height: 35px; border-radius: 100px; background: var(--slate-soft); color: var(--ink); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: var(--fs-footnote);
}
.avatar-lime { background: var(--lime); color: var(--navy); }
.avatar-you { background: var(--navy); color: var(--lime); }
.nearby { display: flex; flex-direction: column; gap: 7px; }
.rank-item {
  display: flex; align-items: center; gap: 11px; min-height: 65px; padding: 0 12px;
  border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface);
}
.rank-item.is-you { background: var(--green-soft); border: 1.3px solid var(--green); }
.rank-pos { min-width: 16px; font-variant-numeric: tabular-nums; font-size: var(--fs-footnote); }
.rank-item .avatar { width: 33px; height: 33px; }
.member { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.member-name { font-size: var(--fs-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member small { font-size: var(--fs-caption); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-pts { font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-footnote); white-space: nowrap; }
.is-you .member-pts { color: var(--green); }
.rank-gap { text-align: center; color: var(--muted); line-height: 1; }
.join-card { display: flex; flex-direction: column; gap: 12px; font-size: var(--fs-sub); line-height: var(--lh-body); }
.join-row { display: flex; gap: 8px; }
.future-card { display: flex; gap: 12px; align-items: center; padding: 15px; }
.future-copy { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.future-title { font-size: var(--fs-sub); }
.future-copy small { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--muted); }

.rivalry { gap: 8px; }
.rival-line { font-family: var(--serif); font-size: var(--fs-title3); line-height: var(--lh-title); }
.board { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; font-size: var(--fs-footnote); }
.board caption { text-align: left; font-family: var(--serif); font-weight: 700; font-size: var(--fs-title3); line-height: var(--lh-title); padding: 0 0 12px; }
.board th, .board td { padding: 11px 10px; text-align: left; border-top: 1px solid var(--line); }
.board thead th { border-top: 0; font-variant-numeric: tabular-nums; font-weight: 400; font-size: var(--fs-caption);  color: var(--muted); }
.board th.name { font-weight: 400; }
.board .num { text-align: right; font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums; }
.board .rank { width: 36px; font-variant-numeric: tabular-nums; }
.board tr.is-you th, .board tr.is-you td { background: var(--green-soft); }
.you-tag { font-size: var(--fs-caption); font-weight: 600; padding: 1px 6px; border-radius: 100px; background: var(--green); color: var(--surface); margin-left: 2px; }
.challenge { display: flex; flex-direction: column; gap: 10px; }
.ch-rows li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: var(--fs-sub); }
.ch-rows li .mono { font-size: var(--fs-footnote); color: var(--muted); }
.ch-rows li.is-you { font-weight: 600; }

/* ---------- Learn ---------- */
.path-card { padding: 18px; gap: 15px; }
.path-head { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; font-size: var(--fs-caption); }
.path-line { display: flex; gap: 7px; align-items: center; font-size: var(--fs-sub); }
.up-next { display: flex; align-items: center; gap: 12px; padding: 16px; width: 100%; text-align: left; cursor: pointer; color: var(--ink); }
.up-next-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.up-next-meta { font-variant-numeric: tabular-nums; font-size: var(--fs-caption); color: var(--green); }
.up-next-title { font-family: var(--serif); font-size: var(--fs-title3); line-height: var(--lh-title); }
.up-next-teaser { font-size: var(--fs-sub); color: var(--muted); }
.chapters { gap: 2px; }
.chapter-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
}
.chapter-list li:first-child .chapter-row { padding-top: 12px; }
.topic-tile {
  width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--slate-soft); flex: none;
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.topic-tile .icon { width: var(--icon-lg); height: var(--icon-lg); stroke-width: 1.6; }
.node-complete .topic-tile { background: var(--green-soft); }
.chapter-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.chapter-name { font-size: var(--fs-headline); }
.chapter-blurb { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); }
.chapter-meta { font-variant-numeric: tabular-nums; font-size: var(--fs-caption); color: var(--green);  }
.node-locked .chapter-name { color: var(--muted); }

.jargon-card {
  display: flex; flex-direction: column; gap: 12px; padding: 17px; border-radius: var(--radius-lg);
  background: var(--green-soft); text-decoration: none; color: var(--ink);
}
.jargon-head { display: flex; gap: 7px; align-items: center; font-size: var(--fs-sub); }
.jargon-block { display: flex; flex-direction: column; gap: 5px; }
.jargon-label { font-variant-numeric: tabular-nums; font-size: var(--fs-caption); color: var(--muted); }
.jargon-before { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); }
.jargon-after { font-size: var(--fs-sub); line-height: var(--lh-body); }
.jargon-link { font-size: var(--fs-footnote); font-weight: 600; color: var(--green); }
.checklist-row { display: flex; gap: 12px; align-items: flex-start; }
.checklist-copy { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.checklist-title { font-size: var(--fs-sub); }
.checklist-copy p:not(.checklist-title), .checklist-items { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); }
.checklist-items { list-style: disc; padding-left: 16px; }

.brief-list { display: flex; flex-direction: column; gap: 8px; }
.brief-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 14px 16px; }
.brief-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.brief-title { font-size: var(--fs-headline); }
.brief-meta { font-size: var(--fs-footnote); color: var(--muted); display: flex; align-items: center; gap: 4px; }

/* ---------- Coach ---------- */
.explain-card { display: flex; flex-direction: column; gap: 12px; }
.explain-card form { display: flex; flex-direction: column; gap: 8px; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; }
/* Large text settings: let heads and links wrap instead of running off the screen. */
.section-head { flex-wrap: wrap; }
.section-meta, .text-link { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.explain-out:empty { display: none; }
.explain-out { display: flex; flex-direction: column; gap: 10px; }
.explained { padding: 14px; border-radius: var(--radius-md); background: var(--green-soft); font-size: var(--fs-sub); line-height: var(--lh-body); }
.explained > * + * { margin-top: 8px; }
.gloss { color: var(--green); font-style: italic; }
.bottom-line { font-size: var(--fs-sub); line-height: var(--lh-body); }
.tone { display: inline-block; font-variant-numeric: tabular-nums; font-size: var(--fs-caption);  padding: 2px 8px; border-radius: 100px; margin-right: 4px; background: var(--slate-soft); }
.tone-positive { color: var(--green); background: var(--green-soft); }
.tone-negative { color: var(--loss); background: var(--loss-soft); }
.check-list { padding: 4px 16px; }
.check-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: var(--fs-sub); }
.check-list li:first-child { border-top: 0; }
.check-list .muted { font-size: var(--fs-footnote); }
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.calc-grid .field + .field { margin-top: 0; }
.calc-grid label { font-size: var(--fs-footnote); }
.calc-out { font-family: var(--serif); font-size: var(--fs-title2); }
.calc-out b { font-weight: 400; color: var(--green); }
#calc-result .muted { font-size: var(--fs-footnote); margin-top: 4px; }

/* ---------- Modal sheets ---------- */
#modal-root, #popover-root { position: absolute; inset: 0; pointer-events: none; }
#modal-root { z-index: 20; }
#popover-root { z-index: 40; }
.overlay { position: absolute; inset: 0; background: rgba(4, 8, 16, .5); pointer-events: auto; animation: fade .15s ease-out; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; overflow-y: auto;
  background: var(--surface); color: var(--ink); border-radius: 22px 22px 0 0; padding: 20px 22px 24px;
  pointer-events: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); animation: rise .2s ease-out;
}
.sheet > * + * { margin-top: 12px; }
.eyebrow { font-variant-numeric: tabular-nums; font-size: var(--fs-caption);  color: var(--muted); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-title { font-family: var(--serif); font-weight: 400; font-size: var(--fs-title2); }
.sheet-actions { margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.sheet-briefing {
  top: 0; max-height: none; border-radius: 0; background: var(--bg); box-shadow: none;
  padding: 16px 22px 28px; display: flex; flex-direction: column; gap: 22px;
}
.sheet-briefing > * + * { margin-top: 0; }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Popover ---------- */
.popover {
  position: absolute; pointer-events: auto; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .22); display: grid; gap: 6px; animation: fade .12s ease-out;
}
.popover-head { display: flex; align-items: center; justify-content: space-between; }
.popover-head .eyebrow { font-variant-numeric: tabular-nums; font-size: var(--fs-caption);  color: var(--green); }
.popover-head .icon-btn { width: var(--tap); height: var(--tap); margin: -6px; }
.popover-title { font-family: var(--serif); font-weight: 400; font-size: var(--fs-title3); }
.popover-plain { font-size: var(--fs-sub); line-height: var(--lh-body); }
.popover-example { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts { position: absolute; left: 16px; right: 16px; top: calc(12px + env(safe-area-inset-top)); z-index: 60; pointer-events: none; display: grid; justify-items: center; }
.toast {
  background: var(--navy); color: #F7F5ED; padding: 11px 14px; border-radius: 12px; font-size: var(--fs-sub); line-height: var(--lh-body);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: rise .2s ease-out; max-width: 100%;
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Investor Legends: Challenge portfolio switcher + pick notes ---------- */
.portfolio-switch { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.portfolio-switch.is-challenge { border-color: var(--green-line); background: var(--green-soft); }
.portfolio-switch .field { flex-direction: row; align-items: center; gap: 10px; }
.portfolio-switch label { white-space: nowrap; }
.portfolio-switch select { min-height: var(--tap); padding: 6px 10px; }
.switch-note { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--ink); margin: 0; }
.pick-note { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pick-note .fine { margin: 0; }
.pick-note textarea { min-height: 76px; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); padding: 10px 0; font-weight: 600; font-size: var(--fs-sub); line-height: var(--lh-body); cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--green); }

/* ---------- Investor Legends: avatars, valuation numbers, playbook lens ---------- */
.card-title { font-size: var(--fs-headline); font-weight: 600; margin: 0 0 10px; }
.val-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; margin: 0 0 10px; }
.val-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.val-cell dt { font-size: var(--fs-caption); color: var(--muted); }
.val-cell dd { margin: 0; font-size: var(--fs-sub); }
.lens summary { font-weight: 700; font-size: var(--fs-sub); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.lens-list { list-style: none; margin: 12px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.lens-row { display: flex; gap: 12px; align-items: flex-start; }
.lens-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: var(--fs-sub); line-height: var(--lh-body); }
.lens-name { font-weight: 700; font-size: var(--fs-sub); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fit-chip { font-size: var(--fs-caption); font-weight: 700; padding: 2px 8px; border-radius: 100px;   }
.fit-yes { background: var(--green-soft); color: var(--green); }
.fit-maybe { background: var(--slate-soft); color: var(--ink); }
.fit-no { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- Investor Legends: Learn segment, gallery, Legend page, Showdown, Playbook, quiz, Home ---------- */
.segment { display: flex; gap: 4px; padding: 4px; border-radius: 100px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; }
.segment-link { padding: 7px 16px; border-radius: 100px; font-size: var(--fs-footnote); font-weight: 600; color: var(--muted); text-decoration: none; }
.segment-link { position: relative; }
.segment-link::after { content: ""; position: absolute; left: 0; right: 0; top: min(0px, calc((100% - var(--tap)) / 2)); bottom: min(0px, calc((100% - var(--tap)) / 2)); }
.segment-link.is-active { background: var(--selected); color: var(--on-selected); }
.segment-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.legend-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.legend-card {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.legend-card-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.legend-card-name { font-weight: 700; font-size: var(--fs-headline); }
.legend-card-tag { font-size: var(--fs-footnote); color: var(--muted); }
.legend-card-risk { align-self: flex-start; }
.legend-chip { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; margin-top: 3px; font-size: var(--fs-footnote); font-weight: 600; padding: 3px 9px; border-radius: 100px; }
.legend-chip .ic, .legend-chip svg { width: 12px; height: 12px; }
.legend-chip.is-locked { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.legend-chip.is-open { background: var(--slate-soft); color: var(--ink); }
.legend-chip.is-started { background: var(--green-soft); color: var(--green); }
.legend-chip.is-mastered { background: var(--lime); color: var(--navy); }
.risk-dots { display: inline-flex; gap: 3px; }
.risk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.risk-dot.is-on { background: var(--legend, var(--ink)); }
.legend-link { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); }
.legend-link > span { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sub); }
.legend-link small { color: var(--muted); font-size: var(--fs-footnote); }
.legend-disclaimer { text-align: center; }

.legend-profile { display: flex; flex-direction: column; gap: 14px; }
.legend-profile-top { display: flex; gap: 16px; align-items: center; }
.legend-profile-top p { margin: 0; }
.legend-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.legend-facts dt { font-size: var(--fs-caption); color: var(--muted);   margin-bottom: 3px; }
.legend-facts dd { margin: 0; font-size: var(--fs-sub); line-height: var(--lh-body); }
.legend-facts .span-2 { grid-column: span 2; }
.brief-row .mono-label { margin: 0 0 3px; }


.goal-list { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.goal-row { display: flex; flex-direction: column; gap: 5px; }
.goal-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: var(--fs-sub); }
.goal-pts { font-size: var(--fs-footnote); color: var(--green); font-weight: 600; }
.goal-what, .goal-text { font-size: var(--fs-sub); line-height: var(--lh-body); margin: 0; }
.goal-what { color: var(--muted); }
.goal-row.is-done .goal-name { color: var(--green); }

.rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rule-list.card { padding: 14px 16px; }
.rule-row { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sub); line-height: var(--lh-body); }
.rule-mark { flex: none; width: 18px; font-weight: 700; text-align: center; }
.rule-row.is-pass .rule-mark { color: var(--green); }
.rule-row.is-fail .rule-mark { color: var(--loss); }
.rule-text { font-size: var(--fs-sub); color: var(--muted); }
.missing-list { margin: 6px 0 0; padding-left: 18px; }

.challenge-start, .challenge-live { display: flex; flex-direction: column; gap: 14px; }
.style-meter { display: flex; flex-direction: column; gap: 6px; }
.style-meter-top { display: flex; justify-content: space-between; align-items: baseline; }
.style-score { font-size: var(--fs-large); line-height: 1; }
.style-score small { font-size: var(--fs-footnote); color: var(--muted); }
.mastered-banner { display: flex; gap: 10px; align-items: center; margin: 0; padding: 10px 12px; border-radius: var(--radius-md); background: var(--green-soft); font-size: var(--fs-sub); line-height: var(--lh-body); }
.mix-editor, .reflection { display: flex; flex-direction: column; gap: 10px; }
.mix-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.mix-field label { font-size: var(--fs-footnote); }
.mix-field + .mix-field { margin-top: 0; }
.reflection textarea { min-height: 84px; }

.benchmark { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.benchmark svg { display: block; }
.bm-mine { stroke: var(--green); }
.bm-voo { stroke: var(--muted); }
.benchmark figcaption { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-footnote); }
.bm-key { display: inline-flex; align-items: center; gap: 6px; }
.bm-swatch { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid var(--green); }
.bm-voo-swatch { border-top: 2px dashed var(--muted); }
.bm-caption { flex-basis: 100%; color: var(--ink); font-weight: 600; line-height: var(--lh-body); }
.sources ul { margin: 10px 0 6px; padding-left: 18px; font-size: var(--fs-sub); line-height: var(--lh-body); }
.sources summary { font-weight: 700; font-size: var(--fs-sub); cursor: pointer; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.showdown-table { width: 100%; border-collapse: collapse; font-size: var(--fs-footnote); }
.showdown-table th, .showdown-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.showdown-table tbody tr:last-child th, .showdown-table tbody tr:last-child td { border-bottom: 0; }
.showdown-table thead th { font-size: var(--fs-caption);   color: var(--muted); }
.showdown-table tbody th a { color: var(--ink); font-weight: 700; }
.showdown-table tbody th small { display: block; font-weight: 400; color: var(--muted); }
.playbook-group + .playbook-group { margin-top: 16px; }
.graduate { display: flex; flex-direction: column; gap: 6px; }

/* Opening quiz: one question per screen, big tappable answers like the lesson checks. */
.quiz-top { display: flex; align-items: center; justify-content: space-between; }
.quiz-top .text-link { font-size: var(--fs-sub); }
.quiz-flow { display: flex; flex-direction: column; gap: 22px; }
.quiz-progress { display: flex; flex-direction: column; gap: 8px; }
.quiz-count { font-size: var(--fs-footnote); color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.quiz-bar > span { transition: background .2s; }
.quiz-flow[data-step="1"] .quiz-bar > span:nth-child(-n+1),
.quiz-flow[data-step="2"] .quiz-bar > span:nth-child(-n+2),
.quiz-flow[data-step="3"] .quiz-bar > span:nth-child(-n+3),
.quiz-flow[data-step="4"] .quiz-bar > span:nth-child(-n+4) { background: var(--green); }
.quiz-step { display: none; flex-direction: column; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.quiz-step:focus { outline: none; }
.quiz-flow[data-step="1"] .quiz-step[data-step="1"],
.quiz-flow[data-step="2"] .quiz-step[data-step="2"],
.quiz-flow[data-step="3"] .quiz-step[data-step="3"],
.quiz-flow[data-step="4"] .quiz-step[data-step="4"] { display: flex; animation: quiz-in .25s ease-out; }
@keyframes quiz-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .quiz-step { animation: none !important; } }
.quiz-q { font-size: var(--fs-title1); line-height: var(--lh-display); padding: 0; margin: 0 0 12px; }
.picks { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.pick {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--ink);
  transition: border-color .15s, background .15s;
}
.pick input, .scale-dot input, .school-option input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.pick-key {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); font-size: var(--fs-footnote); color: var(--muted); font-variant-numeric: tabular-nums;
}
.pick-text { flex: 1; }
.pick-check { width: 20px; height: 20px; flex: none; color: var(--green); opacity: 0; transition: opacity .15s; }
.pick-check .icon { width: var(--icon-md); height: var(--icon-md); }
.pick:hover { border-color: var(--muted); }
.pick:has(input:checked) { border: 1.5px solid var(--green); background: var(--green-soft); padding: 15.5px; }
.pick:has(input:checked) .pick-key { background: var(--green); border-color: var(--green); color: var(--surface); }
.pick:has(input:checked) .pick-check { opacity: 1; }
.pick:has(input:focus-visible), .scale-dot:has(input:focus-visible), .school-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.quiz-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.quiz-nav .text-link { font-size: var(--fs-sub); padding: 6px 0; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.scale-dot { position: relative; cursor: pointer; }
.scale-dot span {
  display: grid; place-items: center; height: 48px; border-radius: var(--radius-md); border: 1px solid var(--line);
  background: var(--surface); font-size: var(--fs-body); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
}
.scale-dot:has(input:checked) span { background: var(--green); border-color: var(--green); color: var(--surface); }
.scale-ends { display: flex; justify-content: space-between; font-size: var(--fs-footnote); color: var(--muted); }
.quiz-step .cta { margin-top: 10px; }

.legend-step { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--ink); }
.legend-step-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.legend-step-copy .mono-label { margin: 0; }
.legend-step-copy small { font-size: var(--fs-footnote); color: var(--muted); line-height: var(--lh-body); }
.badge-shelf { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; }
.badge-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); font-size: var(--fs-footnote); font-weight: 600; text-align: center; }
.badge-item small { display: block; font-weight: 400; color: var(--muted); }
.style-list { list-style: none; margin: 10px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.style-row { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: var(--fs-sub); font-weight: 600; }
.style-row span { flex: 1; display: flex; flex-direction: column; }
.style-row small { font-weight: 400; color: var(--muted); font-size: var(--fs-footnote); }
.style-row b { font-size: var(--fs-title3); }

/* ---------- Investor Legends: Campus ---------- */
.rival-stat { margin: 8px 0 0; font-size: var(--fs-footnote); color: var(--on-hero-soft); }
.legend-month { display: flex; flex-direction: column; gap: 10px; }
.legend-month-head { display: flex; gap: 12px; align-items: center; }
.legend-month-head p { margin: 0; }
.playbook-board .member-pts { font-variant-numeric: tabular-nums; }
.demo-row input[type="number"] { width: 72px; min-height: var(--tap); padding: 6px 10px; }

/* ---------- UI polish pass (see PLAN.md §11) ---------- */
.page-head { gap: 8px; }
.page-sub { font-size: var(--fs-sub); line-height: var(--lh-body); color: var(--muted); margin: 0; }
.snapshot-label { font-size: var(--fs-sub); color: var(--muted); margin: 0; }
.legend-step { align-items: center; }
.legend-step-meta { font-size: var(--fs-footnote); color: var(--muted); }
.legend-step-title { font-size: var(--fs-headline); font-weight: 600; line-height: var(--lh-title); }
.lesson-rewards { font-size: var(--fs-sub); color: var(--on-hero-soft); }
.path-line { font-size: var(--fs-sub); margin: 0; }
.up-next-meta { font-size: var(--fs-footnote); color: var(--green); font-weight: 600; }
.up-next-teaser { font-size: var(--fs-sub); color: var(--muted); }
.chapter-name { font-size: var(--fs-headline); font-weight: 600; }
.chapter-meta { font-size: var(--fs-footnote); color: var(--muted); }
.node-available .chapter-meta { color: var(--green); }
.jargon-link { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: var(--ink); font-size: var(--fs-sub); line-height: var(--lh-body); }
.overview-label { font-size: var(--fs-sub); color: var(--on-hero-muted); margin: 0; }
.chart-head { display: flex; justify-content: space-between; font-size: var(--fs-sub); }
.scope-chips { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.scope-chips::-webkit-scrollbar { display: none; }
.scope-chip { flex: none; }
.discover { display: flex; flex-direction: column; gap: 8px; }
.discover-top { display: flex; flex-wrap: wrap; gap: 4px; justify-content: space-between; align-items: center; }
.discover-name { font-size: var(--fs-sub); color: var(--muted); }
.discover-price { font-size: var(--fs-sub); font-weight: 600; font-variant-numeric: tabular-nums; }
.quote-block { display: flex; flex-direction: column; gap: 2px; }
.quote-block .quote { font-size: var(--fs-large); font-weight: 600; font-variant-numeric: tabular-nums; margin: 0; }
.quote-change { font-size: var(--fs-sub); color: var(--muted); margin: 0; }
.detail .chart { margin: 0; }
.chart-cap { font-size: var(--fs-footnote); color: var(--muted); }
.detail .desc { font-size: var(--fs-sub); line-height: var(--lh-body); margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin: 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact dt { font-size: var(--fs-footnote); color: var(--muted); margin-bottom: 2px; }
.fact dd { margin: 0; font-size: var(--fs-sub); font-weight: 600; }
.amount-avail { font-size: var(--fs-footnote); color: var(--muted); }
.valuation summary { font-weight: 700; font-size: var(--fs-sub); cursor: pointer; }
.valuation .val-grid { margin-top: 12px; }
.coach-label { font-size: var(--fs-sub); font-weight: 600; color: var(--green); margin: 0; }
.coach-game-note { font-size: var(--fs-sub); line-height: var(--lh-body); }
.factors-wrap summary { font-size: var(--fs-sub); }
.rank-label { font-size: var(--fs-sub); color: var(--on-hero-muted); margin: 0; }
.card .rank-label, .legend-month .rank-label { color: var(--muted); }
.legend-link { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: var(--fs-sub); }
.legend-chip { font-size: var(--fs-footnote); }
.explained-label { font-size: var(--fs-sub); font-weight: 600; color: var(--green); margin: 0 0 6px; }
.lesson-where { font-size: var(--fs-footnote); color: var(--muted); margin: 0; min-width: 0; line-height: var(--lh-title); }
.lesson-step { font-size: var(--fs-footnote); color: var(--muted); margin: 0; }
.page-context { justify-content: flex-start; gap: 12px; }
.legend-lock { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-footnote); color: var(--muted); }
.legend-lock .icon { width: var(--icon-sm); height: var(--icon-sm); }

/* ---------- Investor Legends: crests + display type (Playfair Display) ---------- */
.legend-face {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden;
  border-radius: 50%; background: var(--surface-2); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--legend);
}
.legend-face img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.06); }
.legend-face.is-initials { background: var(--legend); }
.legend-face-initials { font-family: var(--display); font-weight: 700; color: #F7F5ED; letter-spacing: 0.02em; }
.legend-face-sm { width: 36px; height: 36px; }
.legend-face-sm .legend-face-initials { font-size: var(--fs-sub); }
.legend-face-md { width: 60px; height: 60px; }
.legend-face-md .legend-face-initials { font-size: var(--fs-title3); }
.legend-face-lg { width: 120px; height: 120px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--legend); }
.legend-face-lg .legend-face-initials { font-size: var(--fs-hero); }
.legend-card.is-locked .legend-face { opacity: .55; }
.photo-credit { font-size: var(--fs-caption); color: var(--muted); margin: 0; }
.photo-credit a { color: inherit; }

/* The Legends section speaks in a bolder editorial voice. */
.legend-card-name { font-family: var(--display); font-weight: 700; font-size: var(--fs-headline); line-height: var(--lh-title); }
.legend-card-tag { font-family: var(--display); font-style: italic; font-size: var(--fs-sub); color: var(--muted); }
.legend-profile { align-items: stretch; }
.legend-profile-top { flex-direction: column; text-align: center; gap: 14px; }
.legend-profile-top .display-sm { font-family: var(--display); font-style: italic; font-weight: 700; font-size: var(--fs-title1); line-height: var(--lh-title); }
.badge-item span { font-family: var(--display); font-weight: 700; }
.lens-name { font-family: var(--display); font-weight: 700; font-size: var(--fs-sub); }
#badges-title { font-family: var(--display); font-weight: 700; }
.badge-item small { font-weight: 400; font-size: var(--fs-caption); }
.card-kind { font-size: var(--fs-footnote); font-weight: 700; color: var(--green); margin: 0 0 8px; }
.lesson-body.is-example { background: var(--green-soft); border-radius: var(--radius-lg); padding: 16px; }
.lesson-body textarea { margin-top: 14px; min-height: 84px; }

/* Legend course: Unit 1 inline, deeper units fold. */
.unit-head { font-size: var(--fs-sub); font-weight: 700; margin: 6px 0 0; }
.unit-intro { font-size: var(--fs-sub); color: var(--muted); line-height: var(--lh-body); margin: 0; }
.unit-list { display: flex; flex-direction: column; gap: 8px; }
.unit { padding: 0; }
.unit summary { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; cursor: pointer; list-style: none; }
.unit summary::-webkit-details-marker { display: none; }
.unit-title { font-size: var(--fs-headline); font-weight: 600; }
.unit.is-locked .unit-title { color: var(--muted); }
.unit-summary { font-size: var(--fs-sub); color: var(--muted); line-height: var(--lh-body); margin: 0 16px 10px; }
.unit .brief-list { padding: 0 8px 8px; }
.unit .brief-row { box-shadow: none; border: 1px solid var(--line); }

/* ---------- Private groups (Campus → Private) ---------- */
.group-form { display: flex; flex-direction: column; gap: 14px; }
.group-form .field + .field { margin-top: 0; }
.group-form .check-list { padding: 0; gap: 0; }
.group-form .check-list li { display: block; padding: 0; }
.group-form .check-row { align-items: center; font-weight: 400; }
.group-form .cta { margin-top: 4px; }
.group-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: var(--tap); }
.danger-link { color: var(--loss); margin-left: auto; }
.group-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.group-switch .chip { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; text-decoration: none; color: var(--ink); font-weight: 600; }
.group-switch .chip.is-active { background: var(--selected); border-color: var(--selected); color: var(--on-selected); }
.group-switch .chip-add { color: var(--green); border-style: dashed; }
.invite-card { display: flex; flex-direction: column; gap: 10px; }
.invite-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.invite-code { font-size: var(--fs-title2); font-weight: 700; letter-spacing: 0.12em; margin: 2px 0 0; }

/* ---------- Grouped lists ----------
   Repeated rows sit in one rounded container with hairline dividers (the iOS inset-grouped pattern)
   instead of a stack of separately bordered cards. */
.legend-grid, .nearby, .unit-list, .brief-list {
  gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}
.legend-grid > li + li, .nearby > li + li, .unit-list > .unit + .unit, .brief-list > .brief-row + .brief-row { border-top: 1px solid var(--line); }
.legend-card, .rank-item, .unit, .brief-list > .brief-row { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.legend-card { padding: 14px 16px; }
.legend-card:hover, .unit summary:hover { background: var(--surface-2); }
.rank-item { min-height: 60px; padding: 0 14px; }
.rank-item.is-you { background: var(--green-soft); border: 0; }
.rank-gap { padding: 6px 0; }
.nearby > .rank-gap + li { border-top: 0; }
.unit .brief-list { margin: 0 12px 12px; padding: 0; background: var(--surface-2); }
.unit .brief-row { border: 0; }

/* Quieter chrome: tools that aren't the product don't get a card. */
.demo { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 4px 0 0; }
.demo summary { color: var(--muted); font-weight: 500; }
.legend-profile .photo-credit { border-top: 1px solid var(--line); padding-top: 10px; }

/* Numbers line up, everywhere money or ranks are shown. */
.snapshot-value, .overview-total, .amount-value, .quote, .t-px, .member-pts, .rank-big, .rank-points p, .discover-price,
.mult-value, .invite-code, .podium-step .pts, .calc-out { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.snapshot-value, .overview-total, .quote-block .quote, .amount-value { font-weight: 600; letter-spacing: -0.02em; }
.group-form-foot:empty { display: none; }

/* ---------- First-run tour (js/ui/view-tour.js) ---------- */
.tour-overlay { background: transparent; animation: none; }
.tour-ring {
  position: absolute; z-index: 1; pointer-events: none; border-radius: 16px;
  box-shadow: 0 0 0 2px var(--lime), 0 0 0 9999px rgba(4, 8, 16, .62);
  transition: left .25s ease, top .25s ease, width .25s ease;
}
.tour-card {
  position: absolute; z-index: 2; left: 16px; right: 16px; pointer-events: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35); animation: rise .2s ease-out;
}
.tour-card:focus { outline: none; }
.tour-count { font-size: var(--fs-caption); color: var(--muted); font-variant-numeric: tabular-nums; }
.tour-title { font-family: var(--serif); font-weight: 700; font-size: var(--fs-title2); line-height: var(--lh-title); margin-top: 2px; }
.tour-line { font-size: var(--fs-body); line-height: var(--lh-body); margin-top: 4px; }
.tour-foot { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.tour-dots { display: flex; gap: 5px; margin-right: auto; }
.tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: width .2s ease, background-color .2s ease; }
.tour-dots span.is-on { width: 16px; border-radius: 3px; background: var(--green); }
.tour-skip { color: var(--muted); }
.tour-next { min-width: 96px; }
.tour-caret {
  position: absolute; bottom: -7px; width: 16px; height: 16px; background: var(--surface);
  transform: rotate(45deg); border-radius: 3px;
}
@media (prefers-reduced-motion: reduce) { .tour-ring { transition: none; } }

/* ---------- Accounts (js/cloud.js) ---------- */
.account-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--fs-footnote); color: var(--muted); }
.account-line b { color: var(--ink); font-weight: 600; word-break: break-all; }
.forgot-link { align-self: flex-start; margin-top: 12px; font-size: var(--fs-footnote); }
.pw-hint { margin: -2px 0 0; }
.form .pw-hint + .field { margin-top: 14px; }
.code-input { letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.code-input::placeholder { letter-spacing: normal; }
.onboarding .form > .field-error { margin-top: 12px; }
.onboarding .center-link { margin-top: -6px; }

/* AI coach: a quiet label on words Claude wrote, and the waiting line while it writes. */
.ai-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; font-size: var(--fs-caption); font-weight: 700; line-height: 18px; vertical-align: 1px; color: var(--on-primary); background: var(--primary); }
.ai-wait { animation: ai-pulse 1.2s ease-in-out infinite; }
@keyframes ai-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .ai-wait { animation: none; } }
.ask-answer p + p { margin-top: 4px; }
.ask-card { display: flex; flex-direction: column; gap: 12px; }
.ask-card form { display: flex; flex-direction: column; gap: 8px; }
.ask-card .samples { margin-bottom: 4px; }

/* Polish pass: long links inside cards wrap instead of running off the edge; the tab row fades where it scrolls. */
.legend-month .text-link { white-space: normal; }
.scope-chips { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 24px; }
/* Coach: recent checks keep the card's padding (a later .check-list rule for playbooks zeroes it), and the question box is short. */
.card.check-list { padding: 4px 16px; gap: 0; }
.ask-card textarea { min-height: 64px; }

/* Shown for a moment while a saved sign-in is checked. */
.boot-wait { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

/* Sign-up and sign-in: brand and the way to the other screen on top, the balance card Home opens with,
   then the form straight on the page under the same serif headings as the rest of the app. */
.onb-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.onb-start { gap: 10px; }
.onb-start .hero-rule { margin: 4px 0; }
.onb-form .onb-part { margin: 26px 0 12px; }
.onb-form .onb-part:first-child { margin-top: 0; }
.onb-form .onb-part + .field { margin-top: 0; }
.onb-form .cta { margin-top: 24px; }
.onb-form .fine { text-align: center; }
/* School picker: three tiles a row, each with a crest (initials in the school's colours). The last tile
   opens a field to type in a school that isn't listed. */
.onb-form .school-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.onb-form .school-option { flex-direction: column; justify-content: center; gap: 8px; min-height: 96px; padding: 12px 6px; border-radius: var(--radius-md); text-align: center; }
.school-crest {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--chip-bg); color: var(--chip-fg); font-size: var(--fs-caption); font-weight: 700; letter-spacing: .03em;
}
.school-name { font-size: var(--fs-footnote); line-height: var(--lh-title); }
.school-add .school-crest { background: none; color: var(--muted); border: 1.5px dashed var(--line-strong, var(--muted)); }
.school-add:has(input:checked) .school-crest { color: var(--green); border-color: var(--green); }
.school-own { display: none; flex-direction: column; gap: 6px; margin-top: 12px; }
.school-field:has(input[value="other"]:checked) .school-own { display: flex; }
.school-own label { font-weight: 600; font-size: var(--fs-sub); }
.school-own .fine { margin: 0; text-align: left; }
.onb-form .forgot-link { align-self: center; margin-top: 16px; }

/* What you own: big ticker tiles, on Practice (one row per holding) and on Home (a card that leads there). */
.holding-tile {
  position: relative; display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; flex: none;
  border-radius: 14px; background: var(--slate-soft); font-weight: 700; font-size: var(--fs-sub); letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; overflow: hidden;
}
.holding-tile.is-fund { background: var(--green-soft); }
.holding-tile.is-long { font-size: var(--fs-caption); }
.holding-key { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }
.ticker-row.holding { grid-template-columns: auto 1fr auto auto; gap: 12px; padding: 12px 14px; min-height: 76px; }
.holding .t-id b { font-size: var(--fs-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holding .t-px b { font-size: var(--fs-body); font-weight: 600; }
.own-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.own-tiles { display: flex; gap: 6px; flex: none; }
.own-card .holding-tile { width: 44px; height: 44px; border-radius: 12px; font-size: var(--fs-footnote); }
.own-card .holding-tile.is-long { font-size: var(--fs-caption); }
.holding-more { display: flex; align-items: center; justify-content: center; min-width: 28px; font-size: var(--fs-footnote); font-weight: 600; color: var(--muted); }

/* ---------- First five minutes: welcome, one question, grouped Home, Settings ---------- */
.screen.welcome { gap: 24px; min-height: 100%; }
.screen.start { gap: 28px; min-height: 100%; }
.screen.start .start-form { flex: 1; }
.screen.start .start-form .cta { margin-top: auto; }
.welcome-actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.start-form { display: flex; flex-direction: column; gap: 28px; }
.start-q { display: flex; flex-direction: column; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.not-now { margin-top: 12px; }
.home-list { padding: 0 16px; gap: 0; display: flex; flex-direction: column; }
.home-list > .card { border: 0; border-radius: 0; background: none; box-shadow: none; padding: 16px 0; }
.home-list > .card + .card { border-top: 1px solid var(--line); }
.keep-card { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); }
.settings-card { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Lesson diagrams (js/ui/lesson-art.js) and the button at the thumb ---------- */
.sheet-briefing > .lesson-reward {
  margin-top: auto; position: sticky; bottom: -28px; margin-bottom: -28px;
  padding: 12px 0 max(28px, env(safe-area-inset-bottom)); background: var(--bg);
}
.art { margin: 6px 0 0; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.art-row { display: grid; grid-template-columns: minmax(64px, 30%) 1fr auto; align-items: center; gap: 12px; font-size: var(--fs-sub); }
.art-row b { font-variant-numeric: tabular-nums; }
.art-label { color: var(--muted); line-height: var(--lh-title); }
.art-track { display: block; min-width: 0; }
.art-bar { display: block; height: 30px; border-radius: 6px; background: var(--mix-1); }
.art-bar.is-lime { background: var(--lime); }
.art-bar.is-slate { background: var(--slate); }
.art-note { margin: 0; font-size: var(--fs-footnote); color: var(--muted); }
.art-lines .art-row { grid-template-columns: minmax(64px, 30%) 1fr; }
.art-lines svg { width: 100%; height: 48px; color: var(--green); }
.art-steps { align-items: center; text-align: center; gap: 8px; }
.art-steps .art-chip { width: 100%; }
.art-arrow { display: flex; color: var(--muted); transform: rotate(90deg); }
.art-arrow .icon { width: var(--icon-sm); height: var(--icon-sm); }
.art-chip { padding: 11px 14px; border-radius: var(--radius-md); background: var(--green-soft); color: var(--ink); font-size: var(--fs-sub); font-weight: 600; line-height: var(--lh-title); }
.art-formula { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.art-sign { font-size: var(--fs-title3); color: var(--muted); }
.art-chip.is-result { background: var(--lime); color: var(--navy); }
.art-pair, .art-boxes { flex-direction: row; flex-wrap: wrap; gap: 10px; padding: 0; border: 0; background: none; }
.art-box { flex: 1 1 120px; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-sub); line-height: var(--lh-title); }
.art-dir { font-size: var(--fs-title2); color: var(--green); }
.art-boxes .art-box b { font-family: var(--serif); font-weight: 400; font-size: var(--fs-title3); }
.art-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; }
.art-grid span { aspect-ratio: 1; border-radius: 4px; background: var(--slate-soft); }
.art-grid span.is-on { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--green); }
.art-paths svg { width: 100%; height: auto; }
.art-paths polyline { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.p-main { stroke: var(--ink); }
.p-up { stroke: var(--green); stroke-dasharray: 2 8; }
.p-down { stroke: var(--loss); stroke-dasharray: 10 7; }
.art-paths circle { fill: var(--ink); }
.art-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font-size: var(--fs-footnote); }
.p-key::before { content: ""; display: inline-block; width: 20px; height: 3px; border-radius: 2px; background: var(--ink); margin-right: 6px; vertical-align: middle; }
.p-key-1::before { background: repeating-linear-gradient(90deg, var(--green) 0 4px, transparent 4px 8px); }
.p-key-2::before { background: repeating-linear-gradient(90deg, var(--loss) 0 8px, transparent 8px 12px); }
/* Coach: the verdict in words first. */
.coach-feedback .coach-verdict { margin: 0; font-size: var(--fs-title2); font-weight: 700; line-height: var(--lh-title); color: var(--ink); }
.coach-verdict.is-grade-good { color: var(--green); }
.coach-verdict.is-grade-bad { color: var(--loss); }
.coach-card .coach-game-note { font-size: var(--fs-footnote); }
/* Practice: first pick */
.first-card { padding: 0 16px; }
.first-list { list-style: none; margin: 0; padding: 0; }
.first-list li + li { border-top: 1px solid var(--line); }
.first-row { display: flex; align-items: center; gap: 12px; padding: 16px 0; color: var(--ink); text-decoration: none; }
.first-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.first-copy b { font-size: var(--fs-headline); }
.first-copy small { font-size: var(--fs-footnote); line-height: var(--lh-body); color: var(--muted); }
.first-price { font-size: var(--fs-sub); font-weight: 600; font-variant-numeric: tabular-nums; }
.settings-form { display: flex; flex-direction: column; gap: 8px; }
.settings-input { display: flex; gap: 10px; }
.settings-input input { flex: 1; min-width: 0; }
.hero-loss { color: #FFB4A8; }
.group-switch .chip { min-height: var(--tap); display: inline-flex; align-items: center; }
