/* Money Guesser — dark, square, hairline panels.
   Colour has one job: magnitude. Million = blue, Billion = gold, Trillion = magenta.
   Everything else is ink on near-black. */
:root {
  --bg: #0b0b0c;
  --panel: #121315;
  --line: #3a3d42;      /* panel borders */
  --line-2: #2c2e32;    /* dividers */
  --line-3: #26282c;    /* list rules */
  --text: #e9e7e1;
  --muted: #8a8c90;
  --dim: #6c6e73;
  --faint: #34363b;

  /* per magnitude: line (borders, bars) · fill + on (chips, selected buttons) · fg (coloured text) */
  --unit-M: #4d94ff; --unit-M-fill: #2f6fe8; --unit-M-on: #ffffff; --unit-M-fg: #7cb0ff;
  --unit-B: #ffbe3d; --unit-B-fill: #f5ad1f; --unit-B-on: #2a1a02; --unit-B-fg: #ffc955;
  --unit-T: #ff5fa2; --unit-T-fill: #d6337a; --unit-T-on: #ffffff; --unit-T-fg: #ff86b9;

  --frame: 1040px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.5 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; align-items: center; padding: 32px clamp(16px, 5vw, 80px) 64px;
}
[hidden] { display: none !important; }
a { color: var(--text); text-underline-offset: 0.15em; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.caps { font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; }
.muted { color: var(--muted); }
main { width: min(var(--frame), 100%); }
.panel { border: 1px solid var(--line); background: var(--panel); }
.panel-head { display: flex; justify-content: space-between; gap: 16px; color: var(--dim); margin-bottom: 16px; }
.error { color: var(--unit-T-fg); }

/* ---------- chips: the only colour ---------- */
.unit-M { --u: var(--unit-M); --ufill: var(--unit-M-fill); --uon: var(--unit-M-on); --ufg: var(--unit-M-fg); }
.unit-B { --u: var(--unit-B); --ufill: var(--unit-B-fill); --uon: var(--unit-B-on); --ufg: var(--unit-B-fg); }
.unit-T { --u: var(--unit-T); --ufill: var(--unit-T-fill); --uon: var(--unit-T-on); --ufg: var(--unit-T-fg); }
.chip {
  display: inline-block; background: var(--ufill); color: var(--uon);
  font-weight: 800; font-size: 0.72em; line-height: 1.35; padding: 1px 0.42em; letter-spacing: 0; vertical-align: 0.1em;
}
.amount { white-space: nowrap; }
.amount .num { font-weight: 800; color: var(--text); }

/* ---------- top bar ---------- */
/* Full width with the home page's margins, so the logo sits in the same top-left spot, at the same size, on every screen. */
.topbar { width: 100%; min-height: 34px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: clamp(24px, 4vh, 40px); color: var(--dim); }
.brand-caps { display: none; }
.q-short { display: none; }
.topbar .lockup-words { text-transform: none; }
.brand { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }

/* ---------- logo: a thin $ the exact height of a square holding "?" ----------
   --s is the square's size. The $ glyph is 0.92em from tick to tail, so font-size s/0.92 with its tail
   tucked 0.038em down makes it span the square exactly. The square takes the colour of whatever unit
   class it carries (home: it follows the rolling amount), blue otherwise. */
.mark { --s: 16px; display: inline-flex; align-items: flex-end; gap: calc(var(--s) * 0.115); letter-spacing: 0; text-transform: none; }
.mark-dollar { font-size: calc(var(--s) / 0.92); font-weight: 300; line-height: 1; margin-bottom: -0.038em; }
.mark-q {
  width: var(--s); height: var(--s); display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--s) * 0.71); font-weight: 800; line-height: 1;
  background: var(--ufill, var(--unit-M-fill)); color: var(--uon, var(--text));
  transition: background-color 420ms ease, color 420ms ease;
}
.lockup { --s: 28px; margin: 0; display: flex; align-items: flex-end; gap: calc(var(--s) * 0.29); font-weight: 400; color: var(--text); }
.lockup .mark { --s: inherit; }
.lockup .mark-dollar { font-weight: 200; }
/* "Money" caps start on the square's top edge, "Guesser" sits on its bottom edge */
.lockup-words { height: var(--s); display: flex; flex-direction: column; justify-content: space-between; font-size: calc(var(--s) * 0.558); line-height: 1; letter-spacing: -0.03em; white-space: nowrap; }
.lockup-words > span { margin-top: -0.153em; }
.lockup-words > b { font-weight: 800; margin-bottom: -0.15em; }
.status { display: flex; align-items: center; gap: 12px; }
.status b { color: var(--text); font-weight: 600; }
.end-btn { margin-left: 12px; height: 34px; padding: 0 14px; border: 1px solid var(--muted); background: transparent; color: var(--text); font: inherit; letter-spacing: inherit; text-transform: inherit; transition: background-color 150ms, color 150ms, border-color 150ms; }
.end-btn:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.budget-bar { width: 96px; height: 2px; background: var(--line-2); }
.budget-fill { height: 2px; background: var(--text); }
.budget-fill.low { background: var(--unit-T); }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--dim); font: inherit; letter-spacing: inherit; text-transform: inherit; }
.link-btn:hover { color: var(--text); }

/* ---------- big button ---------- */
.go {
  width: 100%; height: 64px; border: 1px solid var(--text); background: var(--text); color: var(--panel);
  transition: background-color 300ms ease, border-color 300ms ease, color 300ms ease;
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  font-weight: 800; font-size: 24px; letter-spacing: -0.02em;
}
.go .arrow { font-weight: 200; font-size: 30px; }
.go:disabled { background: transparent; border-color: var(--line); color: var(--dim); cursor: default; }
.go:not(:disabled):hover { background: #ffffff; border-color: #ffffff; }

/* ---------- screens ---------- */
.screen { display: flex; flex-direction: column; gap: 16px; }
.hero { padding: 40px 44px; }
.hero h1 { font-size: clamp(34px, 6vw, 56px); font-weight: 300; letter-spacing: -0.04em; line-height: 1.02; }
.hero h1 b { font-weight: 800; }
.lede { margin: 16px 0 0; color: var(--muted); max-width: 60ch; }
.text-btn { background: none; border: 0; padding: 0; color: var(--text); font: inherit; letter-spacing: inherit; text-decoration: underline; text-underline-offset: 0.15em; }
.text-btn.caps { text-decoration: none; color: var(--dim); }
.text-btn.caps:hover { color: var(--text); }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); background: transparent; color: var(--text); display: flex; align-items: center; justify-content: center; }

/* ---------- home ---------- */
body.home-mode { padding-bottom: 56px; }
body.home-mode main { width: 100%; max-width: none; }
body.home-mode .topbar { display: none; }
.home { min-height: calc(100vh - 88px); gap: 0; }
.home-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px 32px; }
.home-brand { display: flex; flex-direction: column; gap: 14px; color: var(--dim); }
.home-play { width: 320px; max-width: 100%; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.home-play .go { height: 72px; font-size: 26px; padding: 0 26px; }
.home-play .go .arrow { font-size: 32px; }
.home-stage { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding-top: 48px; }

.hero-amount { margin: 0 0 40px; font-weight: 300; font-size: clamp(52px, 8.5vw, 140px); line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hero-line { display: flex; align-items: flex-end; height: 1em; }
.hero-num, .strip-full .glide { display: inline-flex; }
.hero-num > span, .strip-full .glide > span { display: inline-block; text-align: center; }
.hero-gap { width: 0.22em; flex: none; }
.hero-slot { position: relative; display: inline-block; height: 1em; width: 1.08em; }
.hero-square {
  position: absolute; left: 0; bottom: 0.06em; width: 1em; height: 1em; overflow: hidden; perspective: 700px;
  display: flex; align-items: center; justify-content: center; background: var(--ufill); color: var(--uon);
  transition: background-color 420ms ease, color 420ms ease;
}
.hero-square > span { line-height: 1; padding-top: 0.04em; }
.hero-r { display: inline-block; overflow: hidden; width: 0; opacity: 0; }
.hero-r.on { width: 0.34em; opacity: 1; }
.hero-illion { letter-spacing: -0.04em; }
.glide { transition: width 560ms cubic-bezier(.2,.8,.2,1), opacity 300ms; }
.flap-in { display: inline-block; transform-origin: 50% 0; animation: flap-in 420ms cubic-bezier(.3,1.4,.6,1) both; }
.fade-in { animation: fade-in 500ms ease-out both; }
@keyframes flap-in { from { transform: rotateX(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.home-strip { margin: 0; display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 16px 32px; border-top: 1px solid var(--line); padding-top: 14px; color: var(--dim); }
.home-strip > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.home-strip dd { margin: 0; font-size: 15px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text); }
.home-strip .strip-what dd { min-height: 2.5em; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.home-strip .strip-full { display: flex; font-size: 18px; font-weight: 300; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- setup ---------- */
.setup form { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 0 48px; display: flex; flex-direction: column; gap: 28px; }
.setup-head { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.setup-title { margin: 0; font-size: clamp(30px, 4vw, 44px); font-weight: 300; letter-spacing: -0.04em; line-height: 1.02; }
.setup fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.setup legend { padding: 0; margin-bottom: 8px; color: var(--dim); }
.mode-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode-card { position: relative; cursor: pointer; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card > span { display: flex; flex-direction: column; gap: 6px; height: 100%; box-sizing: border-box; padding: 16px 20px 18px; border: 1px solid var(--line); color: var(--muted); transition: border-color 150ms, background-color 150ms, color 150ms; }
.mode-card b { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.mode-card small { font-size: 14px; line-height: 1.45; }
.mode-card:hover > span { border-color: var(--muted); }
.mode-card input:checked + span { border-color: var(--text); background: var(--text); color: #45464b; }
.mode-card input:checked + span b { color: var(--bg); }
.mode-card input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 3px; }
.topics { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.topics summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 48px; color: var(--dim); }
.topics summary::-webkit-details-marker { display: none; }
.topics summary:hover { color: var(--text); }
.topics summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.chev { width: 9px; height: 9px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform 200ms; }
.topics[open] .chev { transform: translateY(2px) rotate(-135deg); }
.topics-body { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding: 4px 0 24px; }
.topics-body #category-choices { width: 100%; }
.segmented { display: grid; border: 1px solid var(--line); }
.segmented.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.segmented label { position: relative; cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--line); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; height: 46px; font-weight: 800; font-size: 15px; color: var(--muted); transition: background-color 150ms, color 150ms; }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--text); color: var(--bg); }
.segmented input:focus-visible + span { outline: 2px solid var(--text); outline-offset: -4px; }
.seg-note { margin: 0; font-size: 13px; color: var(--muted); }

.family { padding: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.family-head { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { position: relative; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle > span { display: inline-flex; align-items: center; min-height: 32px; box-sizing: border-box; padding: 4px 10px; border: 1px solid var(--line-2); color: var(--dim); font-size: 13px; transition: border-color 150ms, color 150ms; }
.toggle:hover > span { border-color: var(--muted); }
.toggle input:checked + span { border-color: var(--text); color: var(--text); }
.toggle input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 3px; }

/* ---------- play ---------- */
.play { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.play-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* At least 600px so the guess section usually stays put; the question section absorbs the difference,
   and grows past it when a question needs more room. The misses chart sits below. */
.stage { min-height: 600px; display: flex; flex-direction: column; gap: 16px; }

.question { flex: 1 0 auto; padding: 36px 44px; overflow: hidden; }
.q-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--dim); }
.q-cat { color: var(--text); }
.q-side { display: flex; gap: 14px; }
.dots { letter-spacing: 2px; }
.q-prompt { margin: 24px 0 0; font-size: 38px; line-height: 1.08; font-weight: 300; letter-spacing: -0.035em; text-wrap: balance; }
.q-prompt b { font-weight: 800; }
.q-context { margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); max-width: 62ch; }

.guess { position: relative; padding: 28px 44px 32px; }
.slots { display: flex; height: 185px; }
.slot { display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; min-width: 0; flex-basis: 0; }
.slot.g { flex-grow: 3; padding-right: 20px; }
.slot.a { flex-grow: 2; padding-left: 20px; border-left: 1px solid var(--line-2); }
body:not(.answer-phase) .slot.g .line { cursor: text; }
.line { height: 104px; border-bottom: 2px solid var(--text); display: flex; align-items: flex-end; gap: 10px; padding-bottom: 10px; transition: border-color var(--t-lock, 150ms); }
.slot.a .line, .answer-phase .slot.g .line { border-bottom: 1px solid var(--line); }
.slot.a .line { justify-content: flex-end; }
.sub { height: 51px; font-size: 12px; line-height: 17px; color: var(--dim); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.slot.a .sub { text-align: right; color: var(--muted); }
.sub.verdict { color: var(--text); }

.figure { display: flex; align-items: flex-end; font-weight: 200; letter-spacing: -0.05em; line-height: 0.9; white-space: nowrap; }
/* The input gets a roomy box (iOS centres text in it and clips anything outside). Both the $ and the input
   centre their text, so hanging the input 0.2em lower lines the digits up with the $; the negative top
   margin keeps the figure the same height. */
.g .figure { font-size: 80px; }
.empty .dollar { color: var(--dim); }
#guess-input {
  font: inherit; letter-spacing: inherit; color: var(--text); background: transparent; border: 0; padding: 0; margin: 0;
  line-height: 1.3; height: 1.3em; margin: -0.2em 0 -0.2em; outline: none; caret-color: var(--text); min-width: 0.6ch;
}
#guess-input::placeholder { color: var(--faint); }
.mirror { position: absolute; visibility: hidden; white-space: pre; font-weight: 200; letter-spacing: -0.05em; left: -9999px; top: 0; }
.gchip { margin: 0 0 4px 8px; font-size: 14px; padding: 3px 7px; }
.spacer { flex: 1; }
.units { display: flex; gap: 6px; }
.unit-btn {
  width: 44px; height: 44px; padding: 0; -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  background: transparent; font-weight: 800; font-size: 18px;
  border: 1px solid var(--u); color: var(--ufg); transition: background-color 180ms, border-color 180ms, color 180ms;
}
.unit-btn:hover { background: color-mix(in srgb, var(--u) 16%, transparent); }
.unit-btn[aria-checked="true"] { background: var(--ufill); border-color: var(--ufill); color: var(--uon); }
/* Celebration: a hollow stamp on the seam for Bullseye/Great, a ring out of the answer chip, the panel border lighting up */
.slot.a { position: relative; }
.stamp { position: absolute; left: 26px; top: 14px; z-index: 2; transform: translate(-50%, -50%) rotate(-7deg); border: 4px solid var(--u); color: var(--u); padding: 8px 20px 7px; font-weight: 800; font-size: 42px; line-height: normal; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; pointer-events: none; }
.ring-burst { position: fixed; z-index: 5; border: 2px solid var(--u); pointer-events: none; }
.flyer { position: fixed; margin: 0; padding: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; }

.qmark { font-size: 88px; font-weight: 200; line-height: 0.9; color: var(--faint); }
.ans { display: none; align-items: flex-end; gap: 10px; }
.ans .figure { font-size: 88px; perspective: 400px; }
.ans .char { display: inline-block; transform-origin: 50% 0; }
.achip { font-size: 18px; padding: 4px 10px; margin-bottom: 6px; }
.guess .go { margin-top: 24px; }

/* reference list */
/* contain: size lets the left column set the row height; the list scrolls inside it. */
.refs { contain: size; padding: 8px 0 16px; display: flex; flex-direction: column; min-width: 0; min-height: 0; font-size: 13px; }
.refs-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 32px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.refs-empty { color: var(--dim); line-height: 1.5; margin: 0; padding-top: 22px; }
/* Each category is its own block: a strong rule, a bold name, then its rows. */
.ref-group { padding: 20px 0 22px; }
.ref-group + .ref-group { border-top: 1px solid var(--line); }
.ref-group h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 8px; font-size: 14px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.2; color: var(--muted); }
.ref-group h2 .caps { color: var(--dim); white-space: nowrap; }
.ref-group.current h2 { color: var(--text); }
.ref-group.current h2 .caps { color: var(--text); }
.ref-group ol { list-style: none; margin: 0; padding: 0; }
.ref { padding: 4px 0 6px; overflow: hidden; }
.ref-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ref-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-name small { display: block; color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.ref-group:not(.current) .ref-name { color: var(--muted); }
.ref.fresh .ref-name { font-weight: 800; color: var(--text); }
.ref.ghost { color: var(--muted); }
.ref-bar { display: block; height: 2px; margin-top: 5px; background: var(--line-3); }
.ref-bar > span { display: block; height: 2px; background: var(--u); }
.ref.ghost .ref-bar > span { background: transparent; border-top: 2px dashed var(--muted); height: 0; }
.ref.ghost.beyond .ref-bar > span { border-top-color: var(--text); }
.misses-panel { padding: 24px 44px 20px; }
.misses-panel .panel-head { margin-bottom: 12px; }
.chart-empty { margin: 0; min-height: 60px; color: var(--dim); font-size: 13px; line-height: 1.5; }
.chart .bar { transform-box: fill-box; transform-origin: bottom; }

/* glossary tooltips: hover on desktop, tap or keyboard focus elsewhere */
.term {
  position: relative; cursor: help; outline-offset: 3px;
  text-decoration: underline dotted; text-decoration-thickness: 2px; text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
.term .tip {
  display: none; position: absolute; left: 0; top: 100%; z-index: 20;
  transform: translateX(var(--shift, 0px));
  width: max-content; max-width: min(300px, calc(100vw - 32px)); margin-top: 8px; padding: 10px 12px;
  background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 400; line-height: 1.4; letter-spacing: normal; text-transform: none; text-align: left; white-space: normal;
}
.term:hover .tip, .term:focus .tip { display: block; }
.term.name { text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); }

/* ---------- game over ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stat .caps { color: var(--dim); }
.stat-val { font-size: 32px; font-weight: 200; letter-spacing: -0.04em; line-height: 1; overflow-wrap: anywhere; }
.stat-val.small { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.stat-val small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 4px; }
.chart-panel, .over > .panel:last-child { padding: 28px 32px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-3); }
.chart .tick { fill: var(--dim); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--muted); }
.chart .bar.grade-bullseye, .chart .bar.grade-great { fill: var(--text); }
.chart .avg { fill: none; stroke: var(--text); stroke-width: 1.5; }
.history { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.history li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px 20px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line-3); }
.history .h-prompt { min-width: 0; }
.history .h-guess { color: var(--muted); white-space: nowrap; }
.history .h-verdict { color: var(--muted); white-space: nowrap; min-width: 9em; text-align: right; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  body { padding-top: 24px; }
  /* phones: the compact one-line logo in the top bar */
  .topbar { min-height: 34px; align-items: center; }
  .topbar .lockup { --s: 16px; gap: 10px; }
  .topbar .lockup-words { display: none; }
  .topbar .brand-caps { display: inline; }
  .q-long, .dots { display: none; } /* phones: "Q3", no difficulty dots */
  .q-short { display: inline; }
  .play { grid-template-columns: 1fr; }
  .stage { min-height: 0; }
  .question { flex: none; }
  /* one column: references straight after the guess section, misses last */
  .play-left { display: contents; }
  .stage { order: 1; }
  .refs { order: 2; }
  .misses-panel { order: 3; }
  .refs { contain: none; max-height: 480px; }
  .question { padding: 22px 20px; }
  .q-prompt { font-size: 30px; }
  .guess { padding: 20px; }
  .misses-panel { padding: 24px; }
  /* compact while the keyboard is up: short hint line, tight button */
  .slot { gap: 8px; }
  .sub { height: auto; min-height: 17px; }
  .guess .go { margin-top: 16px; height: 56px; }
  .g .figure { font-size: 56px; }
  .ans .figure, .qmark { font-size: 60px; }
  .slots { height: auto; flex-direction: column; gap: 16px; }
  .slot.g { padding-right: 0; }
  .slot.a { padding-left: 0; border-left: 0; }
  /* stacked slots size to their content (flex-basis 0 would override the height glide below) */
  .slots .slot { flex: 0 0 auto !important; }
  /* stacked: the answer slot only appears once there is an answer, so Guess sits right under the field */
  body:not(.answer-phase) .slot.a { display: none; }
  /* the keyboard is gone once the answer shows, so the answer gets room to breathe */
  .slot.a { padding-top: 20px; box-sizing: border-box; } /* border-box: the height glides include the padding */
  .stamp { left: 50%; top: 4px; font-size: 32px; }
  .line { height: 64px; }
  .hero { padding: 28px 24px; }
  .home-play { width: 100%; align-items: stretch; }
  .home-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-strip .strip-what { grid-column: 1 / -1; }
  .setup form { padding-top: 8px; gap: 36px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history li { grid-template-columns: minmax(0, 1fr) auto; }
  .history .h-verdict { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 480px) {
  .hero-amount { font-size: min(44px, 11.5vw); }
  .topbar { letter-spacing: 0.12em; gap: 10px; }
  .topbar .brand, .status, .end-btn { white-space: nowrap; }
  .end-btn { margin-left: 4px; padding: 0 10px; }
  .status { gap: 8px; }
  .budget-bar { width: 48px; }
  .segmented.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented.four label:nth-child(3) { border-left: 0; }
  .segmented.four label:nth-child(n+3) { border-top: 1px solid var(--line); }
  .mode-cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .glide, .hero-square, .go, .mark-q { transition: none; }
  .flap-in, .fade-in { animation: none; }
}
.nowrap { white-space: nowrap; }
