/* ═══════════════════════════════════════════════════════════════════════════
   ONYXFALL — POLISHED STONE · COLD · CUT

   A near-black cyan-cooled ground with solid slabs lifted off it. Every raised
   surface catches the same 1px cyan hairline along its top edge, the way light
   catches a polished lip. That hairline is the whole idea of the app.

   Rules this sheet keeps, without exception:
     · Radius is 6 (buttons, chips, tiles), 10 (cards, sheets, the stage) or
       999 (pills). Nothing else, and never 0. Stone is cut, not rounded.
     · ONE shadow, --sh, tight and unblurred, used everywhere and never varied.
     · ONE hairline, --gloss, on every surface that sits above another.
     · Cyan is LIGHT: hairlines, the meter, the active tab seam, and exactly one
       filled button per screen. Small cyan text is --accent-d. On the cyan
       fill, text is --bg.
     · Motion is 200ms cubic-bezier(.16,.84,.28,1); press is scale(.98).
       Exactly one looping animation exists in the app: the sheen on Play.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Written from JS by applySafeArea(). 0 outside Telegram fullscreen, so
     every utility that reads them collapses on its own. */
  --tg-safe-top: 0px;
  --tg-safe-bottom: 0px;

  /* Duplicated from brand.js so the splash paints correctly on frame one,
     before shell.js has stamped the palette onto <html>. */
  --bg:       #08131A;
  --surface:  #0D1F29;
  --tint:     #102B38;
  --tint-2:   #16394A;
  --line:     #1C4557;
  --ink:      #E6F4F8;
  --ink-2:    #9BB4BF;
  --ink-3:    #6E8996;
  --accent:   #22D3EE;
  --accent-d: #67E8F9;
  --good:     #4ADE80;
  --warn:     #FB7185;

  --f-display: "Syne", "Avenir Next", "Segoe UI", sans-serif;
  --f-text: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --r: 6px;           /* buttons, chips, tiles */
  --r-lg: 10px;       /* cards, sheets, the stage */
  --edge: 1px solid var(--line);
  --sh: 0 1px 0 rgba(0, 0, 0, .55), 0 14px 30px -22px #000;
  --gloss: inset 0 1px 0 rgba(103, 232, 249, .13);
  --t: 200ms cubic-bezier(.16, .84, .28, 1);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Overlays set their own display, which outranks the UA rule for [hidden]. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--f-text);
  font-weight: 400;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }

/* Anything that counts gets tabular figures, or the digits jitter as it ticks. */
.num, .hero-num, .bignum, .fig b, .daily-v, .hud-score b, .rw-sc, .revive span {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* The icon sprite itself never renders. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── icons ───────────────────────────────────────────────────────────────── */

.ic {
  display: block; flex: none;
  width: 24px; height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-s { width: 18px; height: 18px; stroke-width: 1.8; }

/* 38px cut chip: the icon on every card header. A lifted slab, not a blob. */
.chip {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: var(--tint);
  border: var(--edge);
  border-radius: var(--r);
  box-shadow: var(--gloss);
  color: var(--accent-d);
}
.chip--sm { width: 32px; height: 32px; border-radius: 5px; }
.chip--lg { width: 54px; height: 54px; border-radius: var(--r-lg); }
.chip--lg .ic { width: 28px; height: 28px; }

/* ── containers ──────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--sh), var(--gloss);
  padding: 16px;
  margin-bottom: 12px;
}

/* ── type ────────────────────────────────────────────────────────────────── */

.lbl {
  display: block;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
  font-style: normal;
}

.bignum {
  font-size: clamp(58px, 20vw, 72px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 12px 0 2px;
}
.bignum--mid { font-size: 56px; margin: 6px 0 2px; }

.lede {
  margin: 2px 0 16px;
  font-size: 14px; line-height: 1.55;
  color: var(--ink-2);
}
.sub  { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.footnote {
  margin: 6px 0;
  font-size: 11.5px; line-height: 1.55;
  color: var(--ink-3);
}

/* ── pills ───────────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--tint);
  border: var(--edge);
  color: var(--accent-d);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.pill--big { font-size: 12px; padding: 6px 14px; margin-top: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ── progress track: a seam, not a bar ───────────────────────────────────── */

.track {
  height: 5px;
  background: var(--tint);
  border: var(--edge);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.track .fill {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(34, 211, 238, .5);
  transition: width var(--t), background var(--t), box-shadow var(--t);
}
.track .fill.is-low { background: var(--warn); box-shadow: 0 0 10px rgba(251, 113, 133, .45); }

/* ── buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%;
  border-radius: var(--r);
  padding: 13px 16px;
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.005em;
  text-align: left;
}
/* The one filled object. --bg on --accent clears about 10:1. */
.btn--accent { background: var(--accent); color: var(--bg); font-weight: 700; }
.btn--soft { background: var(--tint); color: var(--accent-d); border: var(--edge); box-shadow: var(--gloss); }
.btn--outline { background: var(--surface); color: var(--ink); border: var(--edge); box-shadow: var(--gloss); }
.btn:disabled { opacity: .5; }

.press { transition: transform var(--t), box-shadow var(--t), background var(--t), opacity var(--t); }
.press:active { transform: scale(.98); }

.btn--ad { align-items: flex-start; text-align: left; margin-top: 10px; }
.ad-tx { display: flex; flex-direction: column; gap: 3px; }
.ad-tx b { font-size: 13.5px; font-weight: 600; }
.ad-tx i { font-style: normal; font-size: 11px; font-weight: 500; color: var(--ink-2); }
.ad-tx i:empty { display: none; }

.iconbtn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r);
  box-shadow: var(--gloss);
  color: var(--ink);
}

/* Squared small button, the "interface" variant. */
.btn--sq { width: auto; flex: none; border-radius: 5px; padding: 9px 12px; font-size: 12px; gap: 6px; }

/* ── splash ──────────────────────────────────────────────────────────────── */

#splash {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  transition: opacity 220ms cubic-bezier(.16, .84, .28, 1);
}
#splash.out { opacity: 0; }
.sp-mark {
  width: 76px; height: 76px;
  display: grid; place-items: center;
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--sh), var(--gloss);
  color: var(--accent);
  margin-bottom: 18px;
  animation: rise 420ms cubic-bezier(.16, .84, .28, 1) both;
}
.sp-mark .ic { width: 38px; height: 38px; stroke-width: 1.4; }
.sp-name {
  font-family: var(--f-display);
  font-size: 30px; font-weight: 700; letter-spacing: 0.02em;
  animation: rise 420ms cubic-bezier(.16, .84, .28, 1) 70ms both;
}
.sp-seam {
  width: 54px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 9px 0 7px;
  animation: seam 520ms cubic-bezier(.16, .84, .28, 1) 140ms both;
}
.sp-sub {
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  letter-spacing: 0.18em; text-transform: uppercase;
  animation: rise 420ms cubic-bezier(.16, .84, .28, 1) 180ms both;
}

@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes seam { from { transform: scaleX(0); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── frame ───────────────────────────────────────────────────────────────── */

#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* The top element carries the fullscreen top inset, so the brand line clears
   Telegram's floating Close / more row. */
.topbar {
  flex: none;
  padding-top: max(var(--tg-safe-top), env(safe-area-inset-top, 0px));
}
[data-fullscreen="1"] .topbar {
  padding-top: max(var(--tg-safe-top),
    calc(max(var(--tg-safe-top), env(safe-area-inset-top, 0px)) - 1.4vh));
}
.brandline {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.mark {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  background: var(--tint);
  border: var(--edge);
  border-radius: 5px;
  box-shadow: var(--gloss);
  color: var(--accent);
}
.mark .ic { width: 17px; height: 17px; stroke-width: 1.5; }
.wordmark {
  font-family: var(--f-display);
  font-size: 16px; font-weight: 700; letter-spacing: 0.06em;
}
.brand-rank {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent-d);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
}

/* ── bottom nav: four tabs, the active one lit along its top edge ─────────── */

.navbar {
  flex: none;
  display: flex;
  padding: 0 6px;
  padding-bottom: max(var(--tg-safe-bottom), env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--gloss);
}
.navtab {
  flex: 1; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 4px 8px;
  color: var(--ink-3);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  transition: color var(--t);
}
.navtab .ic { width: 21px; height: 21px; }
/* The seam is the active state: a hairline of light on the top edge. */
.navtab::before {
  content: ""; position: absolute; left: 14%; right: 14%; top: -1px; height: 1px;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(.3);
  transition: opacity var(--t), transform var(--t);
}
.navtab.is-on { color: var(--accent-d); }
.navtab.is-on::before { opacity: 1; transform: none; box-shadow: 0 0 9px rgba(34, 211, 238, .7); }

/* Play is the game and nothing else. */
[data-screen="play"] .topbar,
[data-screen="play"] .navbar { display: none; }

main { flex: 1; min-height: 0; position: relative; }

.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px 18px 22px;
}
.screen.is-active { display: flex; }
.screen.play { overflow: hidden; padding: 2px 14px 8px; }

/* One orchestrated cascade when a screen arrives, rather than a dozen
   scattered micro-animations. display:none to flex restarts it each time. */
.screen.is-active > * { animation: rise 300ms cubic-bezier(.16, .84, .28, 1) both; }
.screen.is-active > *:nth-child(2) { animation-delay: 40ms; }
.screen.is-active > *:nth-child(3) { animation-delay: 75ms; }
.screen.is-active > *:nth-child(4) { animation-delay: 105ms; }
.screen.is-active > *:nth-child(n+5) { animation-delay: 130ms; }
.screen.play > * { animation: none; }

/* ── home ────────────────────────────────────────────────────────────────── */

/* The divider is a seam too: light at the left, gone by the right. */
.rule {
  height: 1px; margin: 18px 0;
  background: linear-gradient(90deg, rgba(34, 211, 238, .38), var(--line) 32%, transparent);
}

.hero { margin: 2px 0 0; }
.hero-num {
  font-size: clamp(62px, 22vw, 88px);
  font-weight: 700; letter-spacing: -0.05em; line-height: 0.86;
  color: var(--ink);
}
.hero-seam {
  height: 1px; width: 100%;
  background: linear-gradient(90deg, var(--accent), rgba(34, 211, 238, .12) 55%, transparent);
  margin: 12px 0 9px;
}
.hero-meta { display: flex; align-items: center; gap: 10px; }
.hero-meta .lbl { margin-right: auto; }
.rankline {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent-d);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
}

.figrow { display: flex; }
.fig {
  flex: 1; position: relative;
  display: flex; flex-direction: column; gap: 4px;
  padding: 0 13px;
}
.fig:first-child { padding-left: 0; }
.fig:last-child { padding-right: 0; }
.fig + .fig::before {
  content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 1px;
  background: var(--line);
}
.fig b { font-size: 23px; font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; }
.fig span {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-3);
}

.daily { display: flex; align-items: center; gap: 10px; }
.daily-l {
  min-width: 0; flex-shrink: 1;
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.daily-state {
  flex: none;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-3);
}
.daily-state.is-done { color: var(--good); }
.daily-bar {
  flex: 1; min-width: 34px; height: 4px;
  background: var(--tint); border-radius: 999px; overflow: hidden;
}
.daily-bar i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(34, 211, 238, .55);
  transition: width var(--t);
}
.daily-v { flex: none; font-size: 13px; font-weight: 700; letter-spacing: -0.02em; }

.offer-row { display: flex; align-items: center; gap: 11px; }

/* On a tall phone the home column runs out before the screen does. The legal
   line falls to the foot of it rather than hanging off the daily strip. */
[data-screen="home"] .footnote { margin-top: auto; padding-top: 22px; }
.offer-tx { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.offer-tx b { font-size: 13.5px; font-weight: 600; }
.offer-tx i { font-style: normal; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.offer-tx i span:empty { display: none; }

/* ── the primary action ──────────────────────────────────────────────────────
   The only filled cyan object on Home and the only looping animation in the
   app: a slow band of light travelling across it, the polish tell. */
.playcta {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  margin: 18px 0 0;
  background: var(--accent); color: var(--bg);
  padding: 15px 18px;
  border-radius: var(--r);
  box-shadow: 0 10px 26px -18px rgba(34, 211, 238, .9);
}
.playcta::after {
  content: ""; position: absolute; top: -60%; bottom: -60%; width: 34%;
  left: -50%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-18deg);
  animation: sheen 5s cubic-bezier(.5, 0, .5, 1) infinite;
}
@keyframes sheen {
  0%, 62% { left: -50%; }
  100%    { left: 130%; }
}
.playcta-tx { display: flex; flex-direction: column; margin-right: auto; text-align: left; line-height: 1.15; }
.playcta-tx b { font-family: var(--f-display); font-size: 19px; font-weight: 700; letter-spacing: 0.02em; }
.playcta-tx i { font-style: normal; font-size: 11.5px; font-weight: 500; opacity: .78; margin-top: 2px; }
.playcta-ar { width: 22px; height: 22px; opacity: .75; }

/* ── play ────────────────────────────────────────────────────────────────── */

.hud {
  flex: none;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 0;
  padding-top: calc(max(var(--tg-safe-top), env(safe-area-inset-top, 0px)) + 8px);
}
.hud-score { display: flex; flex-direction: column; margin-right: auto; line-height: 1; }
.hud-score b { font-size: 38px; font-weight: 700; letter-spacing: -0.05em; }
.hud-score .lbl { margin-top: 5px; }
.hud .iconbtn { background: var(--tint); border-color: var(--line); color: var(--accent-d); }

/* The chain readout: the one thing that pops mid-run, so it arrives with a
   snap and sits lit while it holds. */
.pill--combo {
  opacity: 0;
  background: var(--accent); border-color: var(--accent); color: var(--bg);
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em;
  padding: 4px 12px;
  transition: opacity var(--t);
}
.pill--combo.is-on { opacity: 1; animation: chainpop 260ms cubic-bezier(.16, .84, .28, 1); }
@keyframes chainpop {
  0%   { transform: scale(.72); }
  55%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.pill--shield { background: var(--tint); }

.meter { flex: none; margin: 12px 0 10px; }

.stagewrap {
  flex: 1; min-height: 0; position: relative;
  border: var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--sh), var(--gloss);
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 4px;
}
#stage { display: block; width: 100%; height: 100%; touch-action: none; }

.startover {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border-radius: var(--r-lg);
  padding: 18px;
  overflow-y: auto;
}
.start-in { width: 100%; max-width: 330px; text-align: left; }
.start-in .chip--lg { margin: 0 auto 14px; animation: rise 340ms cubic-bezier(.16, .84, .28, 1) both; }
.start-t {
  display: block; text-align: center;
  font-family: var(--f-display);
  font-size: 21px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 18px;
  animation: rise 340ms cubic-bezier(.16, .84, .28, 1) 50ms both;
}
.steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.step {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r);
  box-shadow: var(--gloss);
  padding: 11px 12px;
  animation: rise 340ms cubic-bezier(.16, .84, .28, 1) both;
}
.step:nth-child(1) { animation-delay: 90ms; }
.step:nth-child(2) { animation-delay: 130ms; }
.step:nth-child(3) { animation-delay: 170ms; }
.step-n {
  width: 20px; height: 20px; flex: none;
  display: grid; place-items: center;
  border-radius: 4px;
  background: var(--tint-2);
  color: var(--accent-d);
  font-size: 11px; font-weight: 700;
}
.step-tx { display: flex; flex-direction: column; min-width: 0; }
.step-tx b { font-size: 13.5px; font-weight: 600; }
.step-tx i { font-style: normal; font-size: 12px; color: var(--ink-3); line-height: 1.4; margin-top: 2px; }
.start-in .btn { animation: rise 340ms cubic-bezier(.16, .84, .28, 1) 210ms both; }

/* ── rank ────────────────────────────────────────────────────────────────── */

.seg {
  display: flex; gap: 4px;
  background: var(--surface);
  border: var(--edge);
  border-radius: 999px;
  padding: 3px;
  margin: 0 0 16px;
}
.seg-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 8px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  transition: background var(--t), color var(--t);
}
.seg-btn.is-on { background: var(--tint-2); color: var(--accent-d); box-shadow: var(--gloss); }

.board { display: flex; flex-direction: column; margin-top: 2px; }
.rw {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 11px 4px;
  border-radius: var(--r);
}
/* The divider is a pseudo-element, not a border-top: a 1px border on a rounded
   box curves up at both ends and reads as a wobble. */
.rw + .rw::before, .row + .row::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: var(--line);
}
.rw--me::before, .rw--me + .rw::before { display: none; }
.rw-pos {
  min-width: 22px;
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  text-align: center;
}
.rw-av {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r);
  /* shell.js hands each name a hue; keep it cold and quiet so cyan stays the
     one live colour on the screen. */
  background: hsl(var(--h) 24% 17%);
  color: hsl(var(--h) 38% 68%);
  font-size: 12px; font-weight: 600;
}
.rw-nm { flex: 1; font-size: 14px; font-weight: 500; }
.rw-sc { font-size: 16px; font-weight: 700; letter-spacing: -0.03em; }
.rw--top .rw-pos { color: var(--accent-d); }
.rw--me {
  background: var(--surface);
  border: var(--edge);
  box-shadow: var(--gloss);
  padding-left: 8px; padding-right: 8px;
  margin: 5px 0;
}
.rw--me .rw-nm { font-weight: 600; }
.rw--me .rw-sc { color: var(--accent-d); }

/* ── more ────────────────────────────────────────────────────────────────── */

.rows { margin-top: 2px; }
.row {
  position: relative;
  display: flex; width: 100%; align-items: center; gap: 12px;
  padding: 13px 2px;
  font-size: 14px; font-weight: 500; text-align: left;
  color: var(--ink);
  border-radius: var(--r);
}
.row > span { flex: 1; min-width: 0; }
.row > .ic { color: var(--accent-d); }
.rowbtn { transition: background var(--t); }
.rowbtn:active { background: var(--surface); }
.chev { width: 17px; height: 17px; color: var(--ink-3); }

.sw {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 25px; flex: none;
  background: var(--tint-2);
  border: var(--edge);
  border-radius: 999px;
  position: relative; margin: 0;
  transition: background var(--t), border-color var(--t);
}
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 19px; height: 19px;
  background: var(--ink);
  border-radius: 999px;
  transition: transform var(--t), background var(--t);
}
.sw:checked { background: var(--accent); border-color: var(--accent); }
.sw:checked::after { transform: translateX(19px); background: var(--bg); }

.sect-h {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
  margin: 2px 0 10px;
}

/* ── overlays ────────────────────────────────────────────────────────────── */

.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(3, 8, 11, .74); }

.sheet {
  position: fixed; z-index: 50;
  left: 10px; right: 10px;
  bottom: calc(10px + max(var(--tg-safe-bottom), env(safe-area-inset-bottom, 0px)));
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--sh), var(--gloss);
  display: flex; flex-direction: column;
  max-height: calc(100dvh - max(var(--tg-safe-top), env(safe-area-inset-top, 0px)) - 24px);
  /* Deliberately NOT animated. A sheet that slides in from below sits, for the
     length of the animation, with its own Close button under the fold. */
}
.sheet-head {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-head b {
  flex: 1; min-width: 0;
  font-family: var(--f-display);
  font-size: 17px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
}
.sheet-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 4px;
  font-size: 13.5px; line-height: 1.6;
  color: var(--ink-2);
}
.sheet-body p { margin: 0 0 12px; }
.sheet-body ul { margin: 0 0 12px; padding-left: 0; list-style: none; }
.sheet-body li { position: relative; padding-left: 18px; margin-bottom: 10px; }
.sheet-body li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 8px; height: 1px;
  background: var(--accent);
}
.sheet-body b { font-weight: 600; color: var(--ink); }
.sheet-foot { flex: none; padding: 12px 16px 16px; border-top: 1px solid var(--line); }

.modal {
  position: fixed; inset: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  pointer-events: none;
}
.modal-card {
  pointer-events: auto;
  width: 100%; max-width: 330px;
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--sh), var(--gloss);
  padding: 20px 18px;
  text-align: center;
  animation: pop 240ms cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes pop { from { transform: scale(.93); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card .chip--lg { margin: 0 auto 4px; }
.modal-card .btn { justify-content: center; }
.modal-t {
  display: block; font-family: var(--f-display);
  font-size: 19px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  margin-top: 12px;
}
.modal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.modal-btns .btn { padding: 12px 10px; font-size: 13px; gap: 7px; }
.modal-btns .ic { width: 18px; height: 18px; }

.revive {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  pointer-events: none;
}
.revive span {
  display: grid; place-items: center;
  width: 124px; height: 124px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
  box-shadow: var(--sh), 0 0 40px -12px rgba(34, 211, 238, .6);
  font-size: 62px; font-weight: 700; letter-spacing: -0.05em;
  color: var(--accent-d);
  animation: pop 220ms cubic-bezier(.2, .9, .3, 1.1);
}

.toast {
  position: fixed; z-index: 70;
  left: 16px; right: 16px;
  bottom: calc(96px + max(var(--tg-safe-bottom), env(safe-area-inset-bottom, 0px)));
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--r);
  box-shadow: var(--sh), var(--gloss);
  padding: 13px 18px;
  font-size: 13px; font-weight: 500;
  text-align: center;
}

/* ── reduce motion: kill all of it ───────────────────────────────────────── */

[data-reduce-motion="1"] *,
[data-reduce-motion="1"] *::before,
[data-reduce-motion="1"] *::after {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Short phones: the big numbers and the step list give first. */
@media (max-height: 690px) {
  .bignum { font-size: 50px; }
  .hud-score b { font-size: 32px; }
  .lede { margin-bottom: 12px; }
  .step { padding: 8px 10px; }
  .steps { gap: 6px; }
  .playcta { padding: 13px 16px; margin-top: 14px; }
}
