/* TUMBLE — interface.
 *
 * The 3D world is bright and saturated, so the interface deliberately is not:
 * near-black glass, one periwinkle accent carried over from the main site, and
 * gold reserved entirely for medals. Anything that competes with the level for
 * attention is a thing the player has to look past while steering.
 *
 * Two type families do the work. Press Start 2P is the arcade's voice and is
 * used only for labels and the wordmark; DM Mono carries every number, because
 * a timer whose digits change width is a timer that twitches.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* The `hidden` attribute only gets `display: none` from the UA stylesheet, so
   any author rule that sets `display` on the same element silently outranks it
   and the element stays on screen. That is exactly how the WebGL failure panel
   ended up permanently covering a game that was running fine underneath. This
   makes the attribute win everywhere, once. */
[hidden] { display: none !important; }

:root {
  --font-arcade: 'Press Start 2P', monospace;
  --font-mono: 'DM Mono', ui-monospace, monospace;
  --font-sans: 'DM Sans', system-ui, sans-serif;

  --ink: #EEF0FA;
  --ink-dim: #AEBCCE;
  --ink-faint: #7C8CA4;

  /* Aqua rather than periwinkle. The whole interface is pitched at the glossy,
     water-and-light look this game is built around, and the accent is what
     carries it. */
  --accent: #35CFE8;
  --accent-deep: #1B9FC4;
  --accent-glow: rgba(53, 207, 232, 0.55);
  --accent-warm: #FFC96B;
  --gold: #FFD24D;
  --silver: #D6DEEC;
  --bronze: #D08A4A;
  --danger: #FF5D73;
  --good: #54E07A;

  --panel: rgba(8, 20, 32, 0.80);
  --panel-solid: #08141F;
  --line: rgba(120, 220, 245, 0.18);
  --line-strong: rgba(120, 220, 245, 0.48);

  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);

  /* The gloss pass. A bright upper half, a hard break at the midpoint and a
     softer lower half is the whole trick behind every shiny control of the
     era — it reads as a curved, wet surface catching a light source above. */
  --gloss: linear-gradient(180deg,
      rgba(255, 255, 255, 0.30) 0%,
      rgba(255, 255, 255, 0.12) 49%,
      rgba(255, 255, 255, 0.02) 51%,
      rgba(255, 255, 255, 0.10) 100%);
  --gloss-strong: linear-gradient(180deg,
      rgba(255, 255, 255, 0.46) 0%,
      rgba(255, 255, 255, 0.18) 49%,
      rgba(255, 255, 255, 0.04) 51%,
      rgba(255, 255, 255, 0.16) 100%);
}

html, body {
  height: 100%;
  background: #05060d;
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ── boot failure ───────────────────────────────────────────────────── */
.boot-fail {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.1rem; text-align: center; padding: 2rem; background: #05060d;
}
.boot-fail[hidden] { display: none; }
.boot-fail h1 { font-family: var(--font-arcade); font-size: 1.4rem; letter-spacing: 0.06em; }
.boot-fail p { color: var(--ink-dim); max-width: 34ch; line-height: 1.7; }
.boot-fail a { color: var(--accent); text-decoration: none; }
.boot-fail a:hover { text-decoration: underline; }

/* ── loading ────────────────────────────────────────────────────────── */
.loading {
  position: fixed; inset: 0; z-index: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem;
  background: radial-gradient(ellipse at 50% 40%, #12162c 0%, #05060d 70%);
  transition: opacity 0.5s ease;
}
.loading[hidden] { display: none; }
.loading.out { opacity: 0; pointer-events: none; }
.loading-mark {
  font-family: var(--font-arcade); font-size: clamp(1.5rem, 5vw, 2.6rem);
  letter-spacing: 0.1em; color: var(--ink);
  text-shadow: 0 0 30px var(--accent-glow);
}
.loading-bar { width: min(320px, 60vw); height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.loading-bar span { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.3s ease; }
.loading-note { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); letter-spacing: 0.08em; }

/* ── HUD ────────────────────────────────────────────────────────────── */
.hud {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none;
  padding: clamp(0.9rem, 2.2vw, 1.6rem);
}
.hud[hidden] { display: none; }

/* Scrims behind the readouts. A marble game spends most of its time looking at
   sky, and white numbers on a pale blue horizon are unreadable no matter how
   much text-shadow you pile on. These are steep enough to anchor the corners
   and shallow enough that they never read as a letterbox. */
.hud::before, .hud::after {
  content: ''; position: absolute; left: 0; right: 0;
  pointer-events: none; z-index: 0;
}
.hud::before {
  top: 0; height: 190px;
  background: linear-gradient(to bottom, rgba(3, 4, 10, 0.66) 0%, rgba(3, 4, 10, 0.3) 45%, transparent 100%);
}
.hud::after {
  bottom: 0; height: 210px;
  background: linear-gradient(to top, rgba(3, 4, 10, 0.52) 0%, rgba(3, 4, 10, 0.2) 48%, transparent 100%);
}

/* Above the scrims — ::after is generated last and would otherwise paint over
   the readouts it exists to support. */
.hud-corner, .effect-rail, .center-stack, .tip-bar, .reticle { z-index: 1; }

.hud-corner { position: absolute; display: flex; flex-direction: column; gap: 0.3rem; }
.hud-tl { top: clamp(0.9rem, 2.2vw, 1.6rem); left: clamp(0.9rem, 2.2vw, 1.6rem); }
.hud-tr { top: clamp(0.9rem, 2.2vw, 1.6rem); right: clamp(0.9rem, 2.2vw, 1.6rem); align-items: flex-end; }
.hud-bl { bottom: clamp(0.9rem, 2.2vw, 1.6rem); left: clamp(0.9rem, 2.2vw, 1.6rem); gap: 0.6rem; }
.hud-br { bottom: clamp(0.9rem, 2.2vw, 1.6rem); right: clamp(0.9rem, 2.2vw, 1.6rem); align-items: flex-end; }

.hud-timer {
  font-family: var(--font-mono); font-weight: 500;
  font-size: clamp(1.7rem, 4.4vw, 2.7rem);
  line-height: 1; letter-spacing: -0.01em;
  /* Tabular figures so the centiseconds do not shove the minutes sideways
     sixty times a second. */
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 18px rgba(0,0,0,0.95), 0 0 3px rgba(0,0,0,1), 0 0 12px rgba(0,0,0,0.7);
}
.hud-sub {
  font-family: var(--font-mono); font-size: 0.72rem; color: #C6CCE0;
  letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 8px rgba(0,0,0,1), 0 0 3px rgba(0,0,0,0.95);
}
.hud-key { color: var(--ink-dim); text-transform: uppercase; font-size: 0.62rem; letter-spacing: 0.14em; }
.hud-par { color: var(--ink-dim); font-size: 0.66rem; }
.hud-par b { color: var(--gold); font-weight: 500; }

.hud-gems {
  display: flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-weight: 500;
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 14px rgba(0,0,0,0.95), 0 0 3px rgba(0,0,0,1);
}
.hud-gem-sep { color: var(--ink-faint); margin: 0 0.1rem; }
#hud-gem-total { color: var(--ink-dim); }
.gem-mark {
  width: 13px; height: 19px; margin-right: 0.15rem;
  background: linear-gradient(160deg, #7af0ff, #4d8bff);
  clip-path: polygon(50% 0%, 100% 32%, 50% 100%, 0% 32%);
  filter: drop-shadow(0 0 7px rgba(120,200,255,0.75));
}
.hud-gems.pulse .gem-mark { animation: gem-pop 0.4s ease; }
@keyframes gem-pop { 0% { transform: scale(1); } 40% { transform: scale(1.55); } 100% { transform: scale(1); } }
.hud-gems.done { color: var(--good); }
.hud-levelname { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.58rem; }

.hud-speed {
  font-family: var(--font-mono); font-size: 1.05rem; color: var(--ink-dim);
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 10px rgba(0,0,0,1), 0 0 3px rgba(0,0,0,0.9);
}
.hud-unit { font-size: 0.6rem; color: var(--ink-faint); margin-left: 0.2rem; }

/* blast meter */
.blast-wrap { display: flex; flex-direction: column; gap: 0.3rem; }
.blast-label {
  font-family: var(--font-arcade); font-size: 0.4rem; letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-shadow: 0 1px 6px rgba(0,0,0,1);
}
.blast-track {
  position: relative;
  width: clamp(130px, 18vw, 190px); height: 9px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
  border-radius: 5px; overflow: hidden;
}
.blast-fill {
  position: absolute; inset: 0; width: 0%;
  background: linear-gradient(90deg, #1B9FC4, #35CFE8 55%, #BFF6FF);
  border-radius: 4px;
  transition: width 0.08s linear;
}
/* The overcharge from an Ultra Blast is drawn as a separate hot band, so past
   full reads as past full rather than as a bar that simply stopped moving. */
.blast-over {
  position: absolute; inset: 0; width: 0%;
  background: linear-gradient(90deg, transparent 55%, var(--danger));
  border-radius: 4px;
  mix-blend-mode: screen;
}
.blast-track.ready { box-shadow: 0 0 14px rgba(53,207,232,0.5); }
.blast-track.over { box-shadow: 0 0 18px rgba(255,93,115,0.6); border-color: rgba(255,93,115,0.5); }

/* power-up slot */
.power-slot {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.8rem 0.5rem 0.55rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  backdrop-filter: blur(9px);
  min-width: 168px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.power-slot[data-empty="true"] { opacity: 0.42; }
.power-slot[data-empty="false"] { border-color: var(--line-strong); box-shadow: 0 0 22px rgba(53,207,232,0.16); }
.power-glyph {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 6px; font-size: 0.85rem; line-height: 1;
  background: rgba(255,255,255,0.06);
}
.power-name {
  font-family: var(--font-mono); font-size: 0.66rem;
  letter-spacing: 0.03em; white-space: nowrap;
}
.power-slot .power-hint {
  font-family: var(--font-arcade); font-size: 0.36rem;
  color: var(--ink-faint); letter-spacing: 0.1em; margin-left: auto;
}

/* active timed effects */
.effect-rail {
  position: absolute; left: 50%; bottom: clamp(0.9rem, 2.2vw, 1.6rem);
  transform: translateX(-50%);
  display: flex; gap: 0.45rem;
}
.effect-chip {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.32rem 0.62rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; backdrop-filter: blur(9px);
  font-family: var(--font-mono); font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}
.effect-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.effect-chip.expiring { animation: chip-blink 0.45s steps(2) infinite; }
@keyframes chip-blink { 50% { opacity: 0.35; } }

/* centre stack: countdown and toasts */
.center-stack {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
  width: max-content;
}
.countdown {
  font-family: var(--font-arcade);
  font-size: clamp(2.4rem, 9vw, 5rem);
  letter-spacing: 0.06em;
  text-shadow: 0 0 44px rgba(53,207,232,0.65), 0 6px 30px rgba(0,0,0,0.75);
  animation: count-in 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.countdown[hidden] { display: none; }
.countdown.go { color: var(--good); text-shadow: 0 0 54px rgba(84,224,122,0.8), 0 6px 30px rgba(0,0,0,0.75); }
@keyframes count-in {
  from { transform: scale(1.7); opacity: 0; filter: blur(6px); }
  to   { transform: scale(1); opacity: 1; filter: blur(0); }
}
.toast {
  font-family: var(--font-mono); font-size: 0.82rem;
  padding: 0.5rem 1rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; backdrop-filter: blur(9px);
  animation: toast-in 0.3s ease;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.tip-bar {
  position: absolute; left: 50%; bottom: 4.6rem; transform: translateX(-50%);
  max-width: min(560px, 84vw); text-align: center;
  font-size: 0.8rem; color: var(--ink-dim); line-height: 1.6;
  background: var(--panel); border: 1px solid var(--line);
  padding: 0.55rem 1.1rem; border-radius: 10px; backdrop-filter: blur(9px);
  transition: opacity 0.6s ease;
}
.tip-bar[hidden] { display: none; }
.tip-bar.fade { opacity: 0; }

/* A red wash on a fall. Brief enough not to be annoying on a level you are
   falling off repeatedly, which is most of them at first. */
.hud-flash {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(255,60,80,0.5) 100%);
  opacity: 0; transition: opacity 0.45s ease;
}
.hud-flash.on { opacity: 1; transition: opacity 0.06s ease; }

.reticle {
  position: absolute; left: 50%; top: 50%;
  width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.35);
  opacity: 0.55;
}

/* ── overlay screens ────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  /* Deliberately thin. The level is playing underneath and the whole look
     depends on light and sky coming through the interface rather than the
     interface sitting on a black slab. The heavy blur is what keeps text
     readable over it. */
  background:
    radial-gradient(ellipse at 50% 30%, rgba(20, 60, 90, 0.28) 0%, rgba(4, 14, 26, 0.72) 78%);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  overflow-y: auto;
  padding: 2rem 1.2rem;
}
.overlay[hidden] { display: none; }

.screen { width: 100%; max-width: 940px; animation: screen-in 0.32s cubic-bezier(0.16,1,0.3,1); }
.screen[hidden] { display: none; }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.screen-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line); padding-bottom: 0.9rem;
}
.screen-head h2 {
  font-family: var(--font-arcade); font-size: 0.92rem;
  letter-spacing: 0.08em; font-weight: 400;
}
.screen-foot { margin-top: 1.4rem; font-size: 0.78rem; color: var(--ink-faint); text-align: center; }

/* main menu */
.menu-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.9rem; }
.eyebrow {
  font-family: var(--font-mono); font-size: 0.7rem;
  color: rgba(190, 232, 246, 0.72); letter-spacing: 0.16em; text-transform: lowercase;
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
.wordmark {
  font-family: var(--font-arcade);
  font-size: clamp(2rem, 8vw, 4.2rem);
  letter-spacing: 0.06em; font-weight: 400; line-height: 1.15;
  text-shadow: 0 0 18px rgba(255,255,255,0.5), 0 0 60px var(--accent-glow), 0 8px 40px rgba(0,0,0,0.6);
}
.tagline { color: #D6E4F0; font-size: 0.95rem; max-width: 42ch; line-height: 1.7; text-shadow: 0 1px 10px rgba(0,0,0,0.85); }
.menu-actions { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 1.4rem; width: min(300px, 80vw); }
.menu-stats {
  margin-top: 1.2rem; display: flex; gap: 1.6rem; flex-wrap: wrap; justify-content: center;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint);
}
.menu-stats b { color: var(--ink); font-weight: 500; }
.leave { margin-top: 1.6rem; color: var(--ink-faint); font-size: 0.8rem; text-decoration: none; }
.leave:hover { color: var(--accent); }

/* buttons */
.btn {
  position: relative;
  padding: 0.82rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: rgba(120, 200, 230, 0.07);
  background-image: var(--gloss);
  font-family: var(--font-mono); font-size: 0.84rem;
  letter-spacing: 0.02em;
  transition: background-color 0.16s, border-color 0.16s, transform 0.16s, box-shadow 0.16s;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 2px 10px rgba(0,0,0,0.35);
}
.btn:hover {
  background-color: rgba(53, 207, 232, 0.20);
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.34), 0 6px 18px rgba(0,0,0,0.4), 0 0 22px var(--accent-glow);
}
.btn:active { transform: translateY(0); box-shadow: inset 0 2px 6px rgba(0,0,0,0.35); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-primary {
  background-color: rgba(53, 207, 232, 0.28);
  background-image: var(--gloss-strong);
  border-color: rgba(150, 235, 250, 0.6);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 4px 16px rgba(0,0,0,0.4), 0 0 26px var(--accent-glow);
}
.btn-primary:hover { background-color: rgba(53, 207, 232, 0.42); }
.btn-ghost { border-color: transparent; color: var(--ink-dim); }
.btn-ghost:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.btn-danger { border-color: rgba(255,93,115,0.35); color: var(--danger); }
.btn-danger:hover { background: rgba(255,93,115,0.12); border-color: var(--danger); }
.btn-key { opacity: 0.6; margin-right: 0.3rem; }

/* level select */
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 0.8rem; }
.level-card {
  position: relative; text-align: left;
  padding: 1rem 1.1rem 0.9rem;
  border: 1px solid var(--line); border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.01) 55%),
    rgba(120, 200, 230, 0.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  display: flex; flex-direction: column; gap: 0.45rem;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}
.level-card:hover:not(.locked) { border-color: var(--line-strong); background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(53,207,232,0.06) 55%), rgba(53,207,232,0.10); transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 8px 22px rgba(0,0,0,0.35); }
.level-card.locked { opacity: 0.36; cursor: not-allowed; }
.level-card .lc-num {
  font-family: var(--font-arcade); font-size: 0.44rem;
  color: var(--ink-faint); letter-spacing: 0.14em;
}
.level-card .lc-name { font-size: 1.02rem; font-weight: 500; }
.level-card .lc-sub { font-size: 0.76rem; color: var(--ink-faint); line-height: 1.5; min-height: 2.2em; }
.level-card .lc-time {
  font-family: var(--font-mono); font-size: 0.8rem;
  font-variant-numeric: tabular-nums; color: var(--ink-dim);
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem;
}
.level-card .lc-pars {
  display: flex; gap: 0.7rem; font-family: var(--font-mono);
  font-size: 0.62rem; color: var(--ink-faint); font-variant-numeric: tabular-nums;
}
.level-card .lc-pars span::before {
  content: ''; display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; margin-right: 0.3rem; vertical-align: 0;
}
.lc-pars .p-gold::before { background: var(--gold); }
.lc-pars .p-silver::before { background: var(--silver); }
.lc-pars .p-bronze::before { background: var(--bronze); }

.medal-chip {
  width: 15px; height: 15px; border-radius: 50%;
  display: inline-block; flex: none;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.35);
}
.medal-chip.gold { background: linear-gradient(160deg, #FFE9A0, var(--gold)); box-shadow: 0 0 12px rgba(255,210,77,0.6); }
.medal-chip.silver { background: linear-gradient(160deg, #FFFFFF, var(--silver)); }
.medal-chip.bronze { background: linear-gradient(160deg, #F0B57A, var(--bronze)); }
.medal-chip.none { background: rgba(255,255,255,0.12); }

.lock-mark { position: absolute; top: 0.9rem; right: 1rem; font-size: 0.8rem; opacity: 0.7; }

/* marbles */
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.skin-card {
  padding: 1.1rem 0.8rem 0.9rem;
  border: 1px solid var(--line); border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.01) 55%),
    rgba(120, 200, 230, 0.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}
.skin-card:hover:not(.locked) { border-color: var(--line-strong); transform: translateY(-2px); }
.skin-card.locked { opacity: 0.34; cursor: not-allowed; }
.skin-card.active { border-color: var(--accent); background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(53,207,232,0.10) 55%), rgba(53,207,232,0.14); box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 0 24px var(--accent-glow); }
.skin-orb {
  width: 58px; height: 58px; border-radius: 50%;
  box-shadow: inset -8px -10px 18px rgba(0,0,0,0.5), inset 6px 7px 14px rgba(255,255,255,0.35), 0 8px 18px rgba(0,0,0,0.45);
}
.skin-name { font-family: var(--font-mono); font-size: 0.78rem; }
.skin-req { font-size: 0.66rem; color: var(--ink-faint); }

/* options */
.options { display: flex; flex-direction: column; gap: 0.2rem; }
.opt-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 0.85rem 0.2rem; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.opt-label { display: flex; flex-direction: column; gap: 0.18rem; }
.opt-label span { font-size: 0.92rem; }
.opt-label small { font-size: 0.72rem; color: var(--ink-faint); line-height: 1.5; max-width: 46ch; }
.opt-control { display: flex; align-items: center; gap: 0.7rem; flex: none; }
.opt-value {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-dim);
  min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: min(190px, 34vw); height: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.14); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 10px rgba(53,207,232,0.55);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
.toggle {
  position: relative; width: 44px; height: 24px; border-radius: 999px;
  background: rgba(255,255,255,0.12); border: 1px solid var(--line);
  transition: background 0.18s;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink-dim); transition: transform 0.18s, background 0.18s;
}
.toggle[aria-pressed="true"] { background: rgba(53,207,232,0.42); }
.toggle[aria-pressed="true"]::after { transform: translateX(20px); background: #fff; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  padding: 0.42rem 0.75rem; font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--ink-dim); transition: background 0.15s, color 0.15s;
}
.seg button[aria-pressed="true"] { background: rgba(53,207,232,0.24); color: #fff; }
.danger-row { margin-top: 1.6rem; display: flex; justify-content: center; }

/* how to play */
.howto-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.howto h3 {
  font-family: var(--font-arcade); font-size: 0.56rem; font-weight: 400;
  letter-spacing: 0.14em; color: var(--accent); margin: 1.2rem 0 0.7rem;
}
.howto h3:first-child { margin-top: 0; }
.howto p { font-size: 0.86rem; color: var(--ink-dim); line-height: 1.75; margin-bottom: 0.6rem; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1rem; align-items: baseline; }
.keys dt {
  font-family: var(--font-mono); font-size: 0.74rem;
  background: rgba(255,255,255,0.07); border: 1px solid var(--line);
  padding: 0.16rem 0.5rem; border-radius: 5px; white-space: nowrap; justify-self: start;
}
.keys dd { font-size: 0.82rem; color: var(--ink-dim); }
.keys .or { color: var(--ink-faint); font-size: 0.66rem; }
.note { font-size: 0.76rem !important; color: var(--ink-faint) !important; margin-top: 0.9rem; }

.power-table {
  margin-top: 1.8rem; padding-top: 1.4rem; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.9rem;
}
.pt-item { display: flex; gap: 0.7rem; align-items: flex-start; }
.pt-glyph {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 7px; background: rgba(255,255,255,0.06); font-size: 0.9rem;
}
.pt-body strong { font-size: 0.84rem; font-weight: 500; display: block; margin-bottom: 0.2rem; }
.pt-body span { font-size: 0.74rem; color: var(--ink-faint); line-height: 1.55; }

/* pause */
.screen-pause, .screen-results { display: grid; place-items: center; }
.pause-card, .results-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 40%, rgba(255,255,255,0)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px; padding: 2rem 2.2rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.28);
  backdrop-filter: blur(14px);
  text-align: center; width: min(420px, 92vw);
  overflow: hidden;
}
/* A specular sweep across the top of the panel — the same curved-glass cue as
   the buttons, at panel scale. */
.pause-card::before, .results-card::before {
  content: ''; position: absolute; top: 0; left: 6%; right: 6%; height: 46%;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.16), transparent 70%);
  pointer-events: none;
}
.pause-card h2, .results-card h2 { font-family: var(--font-arcade); font-size: 0.9rem; font-weight: 400; letter-spacing: 0.08em; }
.pause-level { margin: 0.8rem 0 1.5rem; color: var(--ink-faint); font-size: 0.82rem; }
.pause-actions, .results-actions { display: flex; flex-direction: column; gap: 0.5rem; }

/* results */
.results-card { width: min(460px, 92vw); }
.medal {
  width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 1.1rem;
  box-shadow: inset 0 -5px 12px rgba(0,0,0,0.4);
  animation: medal-in 0.6s cubic-bezier(0.16,1,0.3,1);
}
@keyframes medal-in { from { transform: scale(0.3) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
.medal.gold { background: linear-gradient(160deg, #FFF2C0, var(--gold)); box-shadow: 0 0 44px rgba(255,210,77,0.65), inset 0 -5px 12px rgba(140,90,0,0.35); }
.medal.silver { background: linear-gradient(160deg, #FFFFFF, var(--silver)); box-shadow: 0 0 30px rgba(214,222,236,0.4), inset 0 -5px 12px rgba(70,80,100,0.3); }
.medal.bronze { background: linear-gradient(160deg, #F5C08A, var(--bronze)); box-shadow: 0 0 26px rgba(208,138,74,0.4), inset 0 -5px 12px rgba(90,50,20,0.35); }
.medal.none { background: rgba(255,255,255,0.08); box-shadow: inset 0 -5px 12px rgba(0,0,0,0.3); }
.results-eyebrow { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); letter-spacing: 0.14em; text-transform: uppercase; }
.results-level { margin: 0.5rem 0 1rem; font-family: var(--font-arcade) !important; font-size: 0.82rem !important; }
.results-time {
  font-family: var(--font-mono); font-weight: 500;
  font-size: 2.4rem; font-variant-numeric: tabular-nums; line-height: 1;
}
.results-delta { margin-top: 0.6rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-dim); }
.results-delta.better { color: var(--good); }
.results-pars {
  display: flex; justify-content: center; gap: 1.2rem; margin: 1.3rem 0 1.5rem;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.results-pars .hit { color: var(--ink); }
.results-unlock {
  margin-bottom: 1.2rem; padding: 0.7rem 0.9rem;
  border: 1px solid rgba(84,224,122,0.3); background: rgba(84,224,122,0.08);
  border-radius: 9px; font-size: 0.8rem; color: var(--good);
}
.results-unlock[hidden] { display: none; }

/* click to play */
.click-to-play {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  background: rgba(3,4,10,0.55); backdrop-filter: blur(3px);
  cursor: pointer;
}
.click-to-play[hidden] { display: none; }
.ctp-inner { text-align: center; }
.ctp-title { font-family: var(--font-arcade); font-size: 0.8rem; letter-spacing: 0.06em; }
.ctp-sub { margin-top: 0.9rem; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint); }

/* touch sticks */
.touch-stick {
  position: fixed; width: 116px; height: 116px; margin: -58px 0 0 -58px;
  border: 2px solid rgba(255,255,255,0.16); border-radius: 50%;
  pointer-events: none; z-index: 120;
}
.touch-knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px;
  margin: -23px 0 0 -23px; border-radius: 50%;
  background: rgba(255,255,255,0.22);
}

/* ── narrow screens ─────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .howto-cols { grid-template-columns: 1fr; gap: 1rem; }
  .hud-timer { font-size: 1.5rem; }
  .tip-bar { bottom: 6.2rem; font-size: 0.72rem; }
  .power-slot { min-width: 0; }
  .power-name { display: none; }
  .hud-br { display: none; }
  .level-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
