/* Pump Rider theme system: every colour the page uses lives in variables
   under [data-theme]. Dark = true black night market. Light = warm paper.
   The canvas reads its own matching palette from app.js (THEMES). */

:root[data-theme="dark"] {
  --bg: #000000;
  --panel: #070707;
  --panel2: #0d0d0d;
  --ink: #eef2ff;
  --dim: #9aa7d9;
  --line: #232323;
  --neon: #00ffa3;
  --pink: #ff3d8a;
  --gold: #ffd23d;
  --gold-glow: rgba(255, 210, 61, .55);
  --red: #ff5252;
  --btn-bg: #0d0d0d;
  --overlay: rgba(0, 0, 0, .62);
  --card: rgba(5, 5, 5, .93);
  --pnl-bg: #000000;
  --pnl-panel: #0d0d0d;
  --score: #ffc837;
  --best: #00ec97;
  --glow-a: rgba(0, 0, 0, 0);
  --glow-b: rgba(0, 0, 0, 0);
  --glow-c: rgba(0, 0, 0, 0);
  --logo-body: #f5f7ff;
  --logo-win: #45d0ff;
  --logo-fin: #ff3d8a;
  --logo-flame: #ffb03a;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fdf3dd;
  --panel: #fffaf0;
  --panel2: #fff3da;
  --ink: #16213c;
  --dim: #5d6a8c;
  --line: #e3d3ae;
  --neon: #009e60;
  --pink: #e02473;
  --gold: #d97706;
  --gold-glow: rgba(217, 119, 6, .5);
  --red: #d92b2b;
  --btn-bg: #fffaf0;
  --overlay: rgba(84, 62, 20, .28);
  --card: rgba(255, 250, 240, .94);
  --pnl-bg: #fffdf6;
  --pnl-panel: #fdf3dd;
  --score: #b97e04;
  --best: #00875a;
  --glow-a: rgba(0, 158, 96, .14);
  --glow-b: rgba(224, 36, 115, .10);
  --glow-c: rgba(245, 158, 11, .16);
  --logo-body: #ffffff;
  --logo-win: #0e7fd8;
  --logo-fin: #e02473;
  --logo-flame: #ff8a2a;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink);
  background:
    radial-gradient(900px 420px at 12% -5%, var(--glow-a), transparent 60%),
    radial-gradient(820px 400px at 88% -5%, var(--glow-b), transparent 60%),
    radial-gradient(700px 500px at 50% 115%, var(--glow-c), transparent 60%),
    var(--bg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  transition: background .35s ease, color .35s ease;
}
h1 { font-size: 26px; margin: 0; letter-spacing: .05em; }
h1 .rider { color: var(--pink); }
h2 { font-size: 17px; margin: 0 0 8px; letter-spacing: .02em; }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
strong { font-weight: 800; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: var(--card); position: sticky; top: 0; z-index: 6; backdrop-filter: blur(6px);
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.logo { width: 42px; height: 42px; flex: none; }
/* NEAR attribution: the angular N glyph, drawn inline (no external
   assets — the single-file build stays offline), in NEAR green. */
.near-glyph { width: 11px; height: 11px; flex: none; }
.near-glyph path { stroke: var(--best); }
/* First-glance affiliation: the NEAR surfaces wear the brand
   treatment — black with NEAR green — in both themes, so the
   affiliation reads from colour before a single word does. */
.near-pill {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  border: 1px solid #00ec97; border-radius: 999px; padding: 3px 9px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .09em;
  color: #00ec97; background: #000000; white-space: nowrap;
}
.near-pill .near-glyph path { stroke: #00ec97; }
/* A slim NEAR-green accent bar under the start card's title. */
.near-accent {
  height: 3px; width: 56px; border-radius: 2px; margin: -2px 0 10px;
  background: linear-gradient(90deg, var(--best), rgba(0, 236, 151, 0));
  box-shadow: 0 0 12px rgba(0, 236, 151, .45);
}
.built-on {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--best); letter-spacing: .03em;
}
.built-on .near-glyph { width: 12px; height: 12px; }
.fan-note { margin: 4px 2px 0; text-align: center; font-size: 11px; color: var(--dim); }
.pnl-near {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--best);
}
.pnl-near .near-glyph { width: 10px; height: 10px; }
.tagline { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.stats { display: flex; gap: 8px; flex-wrap: nowrap; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; min-width: 74px;
}
.stat .k { display: block; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .v.hot { color: var(--pink); }
/* Score reads gold, Best reads NEAR green — in the HUD and on the
   PnL card alike, never both plain white. */
#stat-score { color: var(--score); }
#stat-best { color: var(--best); }
/* Beating the stored best mid-run lights the BEST box up, gold and
   pulsing, until the next run starts. */
.stat.beaten {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 16px 2px var(--gold-glow);
  animation: bestpulse 1s ease-in-out infinite alternate;
}
.stat.beaten .k { color: var(--gold); }
@keyframes bestpulse {
  from { box-shadow: 0 0 0 1px var(--gold), 0 0 9px 1px var(--gold-glow); }
  to { box-shadow: 0 0 0 1px var(--gold), 0 0 24px 6px var(--gold-glow); }
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
button {
  background: var(--btn-bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 13px; cursor: pointer; font-size: 14px; font-weight: 600;
  touch-action: manipulation;
}
button:hover { border-color: var(--neon); }
button.primary { background: var(--neon); color: #ffffff; border-color: transparent; font-weight: 800; }
:root[data-theme="dark"] button.primary { color: #032117; }
button.big { font-size: 16px; padding: 12px 22px; border-radius: 12px; }

.stage-wrap { max-width: 1060px; margin: 0 auto; padding: 16px 14px 4px; }
.stage {
  position: relative; border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
  /* No long-press callout anywhere on the game surface: on iOS the
     callout is what cancels a steady hold into pulses. */
  -webkit-touch-callout: none;
}
canvas#game {
  display: block; width: 100%;
  height: min(70vh, 640px); min-height: 300px;
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@media (max-width: 520px) {
  canvas#game { height: 62vh; min-height: 340px; }
  h1 { font-size: 21px; }
}
/* Phones: the five HUD boxes share ONE row, always. The stats strip
   takes the full topbar width and the boxes split it evenly, with
   compact padding and type so nothing has to wrap. */
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 10px; }
  .stats { width: 100%; gap: 5px; }
  .stat { flex: 1 1 0; min-width: 0; padding: 5px 4px; border-radius: 8px; text-align: center; }
  .stat .k { font-size: 9.5px; letter-spacing: .03em; }
  .stat .v { font-size: 13.5px; }
}

.rug-banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--red); color: #fff; font-weight: 900; letter-spacing: .14em;
  padding: 9px 20px; border-radius: 10px; font-size: clamp(14px, 3.4vw, 20px);
  pointer-events: none; z-index: 4; white-space: nowrap;
  animation: rugflash .28s steps(2, start) infinite;
}
@keyframes rugflash { 50% { opacity: .25; } }
.paused-banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  font-weight: 800; letter-spacing: .08em; padding: 8px 16px; border-radius: 10px;
  pointer-events: none; z-index: 4; white-space: nowrap; font-size: 14px;
}
/* The veil's own resume control (the banner itself lets presses
   through; the button takes them). */
.resume-btn {
  pointer-events: auto; margin-left: 8px; padding: 4px 10px;
  font-size: 12.5px; font-weight: 800; border-radius: 999px;
}
.paused-hint { opacity: .75; font-weight: 700; }
/* The visible pause control: the stage's top-right corner, shown
   only while a run is live (syncState keeps body[data-state]), and
   layered above the paused veil so the same button resumes —
   showing ▶ while paused. A 40px hit area, clear of the HUD row
   above the stage by construction. */
.pause-stage {
  position: absolute; top: 10px; right: 10px; z-index: 6;
  width: 40px; height: 40px; border-radius: 50%; padding: 0;
  display: none; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1; background: var(--panel);
}
body[data-state="playing"] .pause-stage { display: inline-flex; }

/* Overlay cards are complete boxes inside the stage frame: centred,
   a margin on every side (the overlay padding), full border and all
   four rounded corners visible, nothing clipped by the frame. A card
   can never be taller than the stage: if a card ever needs more room
   it scrolls WITHIN its own border (generic safety below) — except
   the game-over card, which is flex-built to genuinely fit and never
   scrolls as a whole (see .card-over). */
.overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: var(--overlay); padding: 14px;
}
.overlay .card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px; max-width: 520px; width: 100%; text-align: left;
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  backdrop-filter: blur(4px);
}
.overlay.stake { z-index: 5; }

/* Game over: a flex column that genuinely fits the frame. Every block
   is fixed-size except the PnL card, whose chart gives up height first
   when the frame is tight. The card itself never scrolls and is never
   clipped. Expanding the difficulty panel hides the chart (the
   .settings-open rule below) so even that state fits whole. */
.overlay .card-over {
  display: flex; flex-direction: column;
  overflow: hidden; padding: 12px 14px;
}
.overlay .card-over > * { flex: none; }
.overlay .card-over > .pnl { flex: 0 1 auto; min-height: 0; }
.overlay .card.card-over p { margin-bottom: 6px; }
.overlay .card-over .settings-panel { margin: 5px 0; padding: 6px 12px; }
.overlay .card-over.settings-open .pnl-chartwrap { display: none; }
.overlay .card-over.settings-open { overflow-y: auto; }

/* The death headline: one short line, small type, never wraps. */
.over-title {
  margin: 0 0 6px; font-size: 15.5px; font-weight: 800; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Post-run PnL card: the run retold as a trade CHART, shareable.
   Its own surface (true black at night, paper by day) with the run's
   score as the hero, a chart of the score itself, and the verdict. */
.pnl {
  display: flex; flex-direction: column;
  background: var(--pnl-bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 13px; overflow: hidden;
}
/* The card's identity is the bar settlement, not the last run: a
   green glow on a cleared bar, a red glow on a missed one, and the
   hero follows — gold on a win, red on a loss. */
.pnl.win { border-color: var(--best); box-shadow: 0 0 0 1px var(--best), 0 0 22px 2px rgba(0, 236, 151, .28); }
.pnl.loss { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 0 22px 2px rgba(255, 82, 82, .25); }
.pnl.loss .pnl-hero { color: var(--red); }
/* Only the chart gives up height when the frame is tight: every
   other block keeps its size. The money strip and the note line must
   never be the thing that squashes to nothing. */
.pnl > * { flex: none; }
.pnl > .pnl-chartwrap { flex: 0 1 150px; }
/* The demoted comparison to the previous run: one quiet line under
   the money strip. */
.pnl-vs {
  margin-top: 3px; text-align: center;
  font-size: 11px; font-weight: 600; color: var(--dim); letter-spacing: .02em; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pnl-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.pnl-brand {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 900; font-size: 13px; letter-spacing: .08em;
}
.pnl-logo { width: 16px; height: 16px; flex: none; }
.pnl-preset { color: var(--neon); font-weight: 800; font-size: 11.5px; letter-spacing: .1em; }
.pnl-herorow {
  /* The verdict pill gets its OWN line under the hero, never the same
     row: with a 4-digit score the old side-by-side row ran out of
     width and the pill painted over the hero's PTS. */
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 2px;
}
.pnl-hero {
  font-size: 30px; font-weight: 900; line-height: 1.05; letter-spacing: .01em;
  font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--score);
}
.pnl-hero .pnl-pts { font-size: 14px; font-weight: 800; color: var(--dim); margin-left: 5px; letter-spacing: .08em; }
.pnl-verdict {
  text-align: center;
  font-weight: 800; font-size: 10px; letter-spacing: .05em; line-height: 1.3;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
}
.pnl-verdict.green { color: var(--best); border-color: var(--best); }
.pnl-verdict.red { color: var(--red); border-color: var(--red); }
.pnl-verdict.flat { color: var(--dim); }
.pnl-sub {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 4px;
}
.pnl-substat .pk {
  display: block; font-size: 9.5px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 0;
}
.pnl-substat b { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pnl-right { text-align: right; }
.pnl-gainline { display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.pnl-gain.green { color: var(--best); }
.pnl-gain.red { color: var(--red); }
.pnl-gain.flat { color: var(--ink); }
.pnl-mult { color: var(--gold); font-size: 10.5px; font-weight: 800; white-space: nowrap; }
/* The stake settlement strip: what went in, what came out, and the
   difference — full width under the time/gain row, toned by its own
   result (up green, down red, break-even neutral). */
.pnl-money {
  margin-top: 4px; padding: 3px 8px; text-align: center;
  background: var(--pnl-panel); border: 1px solid var(--line); border-radius: 9px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.pnl-money.green { color: var(--best); }
.pnl-money.red { color: var(--red); }
.pnl-money.flat { color: var(--dim); }
.pnl-chartwrap {
  position: relative; flex: 0 1 150px; min-height: 64px; margin-top: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--pnl-panel);
  overflow: hidden;
}
.pnl-chart { display: block; width: 100%; height: 100%; }
.pnl-peak {
  /* Kept clear of the crash X, which is drawn into the chart's
     top-right corner: the chip ends well left of it. */
  position: absolute; top: 4px; right: 26px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em; color: var(--dim);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.pnl-tiles {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 5px;
}
.pnl-tile {
  background: var(--pnl-panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 3px 2px; text-align: center; color: var(--dim);
}
.pnl-tile svg { width: 11px; height: 11px; display: block; margin: 0 auto; }
.pnl-tile svg text { fill: var(--pnl-bg); }
.pnl-tile b {
  display: block; font-size: 13.5px; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.pnl-tile span { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: .05em; line-height: 1.15; }
.pnl-tile:nth-child(1) svg { color: var(--neon); }
.pnl-tile:nth-child(2) svg { color: var(--gold); }
.pnl-tile:nth-child(3) svg { color: var(--pink); }
.pnl-tile:nth-child(4) svg { color: var(--red); }
.pnl-foot {
  margin: 3px 0 0 !important; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--dim); line-height: 1.25;
}
.pnl-actions { display: flex; gap: 8px; margin-top: 4px; }
.pnl-actions button { flex: 1; padding: 6px 10px; font-size: 13.5px; }

/* Collapsible difficulty panels (both cards, closed by default):
   one tappable row. */
.settings-toggle {
  width: 100%; background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
}
.settings-toggle .preset-name { margin-left: auto; }
.settings-toggle .chev { color: var(--dim); font-size: 12px; margin-left: 8px; }
.settings-body { margin-top: 8px; }

/* Pre-game stake card: pick how much rides on the run. The amount
   sits big between the ladder steppers; the chips below are the same
   ladder, and chip and stepper never disagree. */
.stake-card { text-align: center; }
.overlay .stake-card { padding: 12px 18px; }
.stake-card h2 { font-size: 16px; margin-bottom: 4px; line-height: 1.15; }
/* The currency switch: a segmented $ / NEAR toggle above the
   amount. The stake, the ladders and the whole settlement follow
   the active unit (recap.js owns the conversion). */
.cur-row { display: flex; justify-content: center; margin: 4px 0 0; }
.cur-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.cur-btn {
  border: none; border-radius: 0; background: transparent; box-shadow: none;
  padding: 3px 14px; font-size: 12px; font-weight: 800; letter-spacing: .05em; color: var(--dim);
}
.cur-btn.active { background: var(--neon); color: #032117; }
:root[data-theme="light"] .cur-btn.active { color: #ffffff; }
.cur-rate { margin: 4px 0 0 !important; font-size: 11.5px; color: var(--dim); }
.stake-amountrow {
  display: flex; align-items: center; justify-content: center; gap: 18px; margin: 2px 0 0;
}
.stake-amount {
  font-size: 36px; font-weight: 900; line-height: 1; color: var(--score);
  font-variant-numeric: tabular-nums; min-width: 112px; white-space: nowrap;
}
/* In NEAR mode the amount carries its unit ("2.75 NEAR") — a touch
   smaller so the row never wraps between the steppers. */
.stake-card.near-mode .stake-amount { font-size: 32px; }
.stake-card.near-mode .stake-chip { font-size: 13px; }
.stake-step {
  width: 42px; height: 42px; border-radius: 50%; padding: 0; flex: none;
  font-size: 22px; font-weight: 900; line-height: 1;
}
.stake-step:disabled { opacity: .3; cursor: default; }
.stake-step:disabled:hover { border-color: var(--line); }
.stake-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0; }
.stake-chip { padding: 4px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stake-chip.active { border-color: var(--neon); color: var(--neon); box-shadow: inset 0 0 0 1px var(--neon); }
/* The called bar gets its own panel on the stake card, under its own
   heading, in gold — a different accent from the stake's green so the
   two pickers never blur together. Two rows of three chips. */
.target-block {
  margin: 5px 0 3px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.target-head {
  margin: 0; font-size: 15px; font-weight: 900;
  text-transform: uppercase; letter-spacing: .1em; color: var(--gold);
}
.target-sub { margin: 2px 0 6px !important; font-size: 12px; color: var(--dim); }
.target-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.target-chip { padding: 4px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.target-chip.active { border-color: var(--gold); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.target-need { margin: 5px 0 0 !important; font-size: 13px; font-weight: 800; color: var(--ink); }
/* The volatility readout: shown wherever the difficulty trade-off
   is chosen — both difficulty panels and the stake card — and kept
   live by app.js as the sliders move. */
.vol-line {
  margin: 8px 0 0; text-align: center;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--dim);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stake-vol { margin: 0 0 4px; }
.stake-ape { width: 100%; padding-top: 9px; padding-bottom: 9px; }
/* Game-over exits: run it back (to the stake card, never straight
   into a run) and the two-step reset beside it. */
.over-actions { display: flex; gap: 8px; align-items: stretch; }
.over-actions .big { padding: 10px 22px; }
.over-actions #btn-again { flex: 1; }
.reset-btn { color: var(--dim); font-weight: 700; white-space: nowrap; }
.reset-btn.armed {
  color: #ffffff; background: var(--red); border-color: var(--red); font-weight: 800;
  animation: resetpulse .6s ease-in-out infinite alternate;
}
@keyframes resetpulse {
  from { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0); }
  to { box-shadow: 0 0 14px 2px rgba(255, 82, 82, .55); }
}
.stake-backrow { margin: 6px 0 2px !important; }
.stake-back {
  background: none; border: none; padding: 2px 6px; cursor: pointer;
  color: var(--dim); font-size: 13.5px; font-weight: 700; text-decoration: underline;
}
.stake-back:hover { color: var(--ink); }
.settings-panel {
  margin: 12px 0; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel);
}
.settings-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--dim); margin-bottom: 8px;
}
.preset-name { color: var(--neon); font-size: 13px; }
.chips { display: flex; gap: 6px; margin-bottom: 6px; }
.chip { flex: 1; padding: 7px 4px; font-size: 13px; }
.chip.active { border-color: var(--neon); color: var(--neon); box-shadow: inset 0 0 0 1px var(--neon); }
.slider-row {
  display: grid; grid-template-columns: 58px 1fr 46px; align-items: center;
  gap: 8px; font-size: 13px; color: var(--dim); margin-top: 7px;
}
.slider-row input[type="range"] { width: 100%; accent-color: var(--neon); }
.slider-val { font-weight: 800; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.overlay .card p { margin: 0 0 10px; }
.overlay .final { font-size: 19px; }
.orb-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold); vertical-align: baseline;
}
.warn-text { color: var(--red); font-weight: 800; }

/* The toast floats: a fixed pill over the page bottom, never in the
   layout flow, so it costs the stage no height. */
.toast {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 60; margin: 0; padding: 6px 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--gold); font-size: 14.5px; font-weight: 700;
  white-space: nowrap; pointer-events: none;
}
.toast:empty { display: none; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin: 12px 0 18px;
}
/* The help card stays compact so the stage gets the screen: smaller
   type and a short list window that scrolls internally. All five
   instructions are still there — they just live behind the scroll. */
.howto { padding: 9px 14px 11px; margin: 10px 0 14px; }
.howto h2 { font-size: 14px; margin-bottom: 4px; }
.howto ol {
  margin: 0; padding-left: 17px; color: var(--dim); font-size: 12.5px; line-height: 1.4;
  max-height: 138px; overflow-y: auto; overscroll-behavior: contain; padding-right: 6px;
  /* The strip owns its vertical pan, by construction: no ancestor
     gesture handling may claim it, in either direction. */
  touch-action: pan-y; -webkit-overflow-scrolling: touch;
}
.howto li { margin-bottom: 4px; }
.howto li:last-child { margin-bottom: 0; }
footer { max-width: 1060px; margin: 0 auto; padding: 0 14px 26px; color: var(--dim); font-size: 13px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .92em; }

/* Small screens: the whole game is one 100dvh column — compact
   header, the HUD row, a stage that flexes to whatever height is
   actually visible on the phone, and a compact help strip. Nothing
   lives below a fold, so the game-over stack (PnL card, collapsed
   difficulty row, share buttons, run it back) always fits inside the
   real stage instead of being measured against a taller ideal one. */
@media (max-width: 760px) {
  body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  .brand .tagline { display: none; }
  /* Phones are the tight stage: the keyboard hint is garnish there
     (the keys still work), and the stake card needs the room. */
  .stake-hint { display: none; }
  .logo { width: 32px; height: 32px; }
  h1 { font-size: 20px; }
  .actions button { padding: 6px 9px; font-size: 12.5px; }
  .stage-wrap {
    flex: 1 1 auto; min-height: 0; width: 100%;
    display: flex; flex-direction: column; padding: 10px 10px 6px;
  }
  .stage { flex: 1 1 auto; min-height: 0; }
  canvas#game { height: 100%; min-height: 0; }
  .toast { font-size: 13px; bottom: 10px; }
  .howto { flex: none; margin: 6px 0 2px; padding: 7px 12px 8px; }
  .howto h2 { font-size: 13px; margin-bottom: 2px; }
  .howto ol { max-height: 60px; }
  footer { display: none; }
}

/* Short phone viewports — browser chrome visible, ~660-700px of real
   height: the game-over stack must still fit whole inside the stage.
   The PnL card gives up padding, hero size and chart height (never
   content: all four tiles and the footer stay on the card), the rows
   around it tighten, and the overlay keeps a smaller margin. */
@media (max-width: 760px) and (max-height: 740px) {
  .overlay { padding: 8px; }
  .overlay .card { padding: 12px 14px; }
  .overlay .card-over { padding: 5px 10px; }
  .over-title { font-size: 14px; margin-bottom: 1px; }
  .pnl { padding: 3px 10px; }
  .pnl-brand { font-size: 11.5px; }
  .pnl-logo { width: 15px; height: 15px; }
  .pnl-herorow { margin-top: 1px; gap: 2px; }
  .pnl-hero { font-size: 19px; }
  .pnl-verdict { font-size: 9.5px; padding: 2px 7px; }
  .pnl-sub { margin-top: 2px; }
  .pnl-substat .pk { font-size: 8.5px; }
  .pnl-substat b { font-size: 12.5px; }
  .pnl-money { margin-top: 1px; padding: 1px 6px; font-size: 11px; }
  .stake-amount { font-size: 30px; min-width: 104px; }
  .stake-card.near-mode .stake-amount { font-size: 27px; }
  .stake-step { width: 30px; height: 30px; font-size: 16px; }
  .stake-chips { margin: 3px 0; gap: 4px; }
  .stake-chip { padding: 3px; line-height: 1.05; }
  /* The currency row joins the card in this band too: slimmer
     toggle, slimmer rate line, and the explanatory rule line goes
     (the need line below already says what the bar takes). */
  .cur-row { margin-top: 2px; }
  .cur-btn { padding: 2px 12px; font-size: 11px; }
  .cur-rate { font-size: 10.5px; margin-top: 0 !important; }
  .stake-card > p.small { display: none; }
  .stake-ape { padding-top: 6px; padding-bottom: 6px; }
  .stake-back { padding: 2px 10px; }
  /* The stake card is taller now (the bar picker lives on it) and it
     must still fit WHOLE inside the stage at 660px: heading, chips,
     need line and APE IN all stay — the garnish lines go instead. */
  .overlay .stake-card { padding: 9px 14px; }
  .stake-card h2 { font-size: 14px; margin-bottom: 0; }
  .stake-amountrow { margin-top: 2px; }
  .stake-card p.small { margin-bottom: 6px; }
  .stake-backrow { margin: 2px 0 0 !important; }
  .vol-line { font-size: 10.5px; }
  .stake-vol { margin-bottom: 3px; }
  .target-block { margin: 3px 0; padding: 3px 8px 2px; }
  .target-head { font-size: 13.5px; }
  .target-sub { display: none; }
  .target-chips { gap: 4px; }
  .target-chip { padding: 2px 4px; font-size: 13px; line-height: 1.1; }
  .target-need { margin-top: 3px !important; font-size: 12.5px; }
  .stake-hint { display: none; }
  .pnl-vs { font-size: 10.5px; margin-top: 0; }
  .pnl-chartwrap { flex-basis: 44px; min-height: 24px; margin-top: 2px; }
  .pnl-tiles { margin-top: 0; gap: 4px; }
  .pnl-tile { padding: 2px 2px 1px; }
  .pnl-tile svg { display: none; }
  .pnl-tile b { font-size: 11.5px; }
  .pnl-tile span { font-size: 7.5px; }
  .pnl-foot { margin-top: 0 !important; font-size: 10px; }
  .pnl-actions { margin-top: 3px; }
  .pnl-actions button { padding: 4px 8px; font-size: 12.5px; }
  .over-actions .big { padding: 8px 16px; }
  .overlay .card-over .settings-panel { margin: 3px 0; padding: 3px 10px; }
  .over-actions .big { padding: 7px 16px; }
  button.big { padding: 7px 18px; font-size: 15px; }
}
