/*!
 * Huelocity — site and game styles
 * Ball rendering happens on <canvas> as flat single-colour discs (see core.js).
 * Nothing in this file decorates the balls.
 */

/* ---------------------------------------------------------------- Fonts */
@font-face {
  font-family: 'Unbounded';
  src: url('../fonts/unbounded-latin-wght.woff2') format('woff2-variations'),
       url('../fonts/unbounded-latin-wght.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------- Tokens */
:root {
  --bg: #0a0b0d;
  --bg-raised: #101114;
  --bg-card: #141519;
  --bg-card-2: #1a1b20;
  --field: #16171b;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f1ea;
  --text-2: #bdbcb5;
  --muted: #85868d;
  --accent: #d4ff3d;
  --accent-hover: #e2ff7a;
  --accent-ink: #0a0b0d;
  --good: #6be29a;
  --bad: #ff6b5e;
  --warn: #ffc24b;

  --font-display: 'Unbounded', 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 72px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: dark;
}

/* ---------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
p { margin: 0; }
kbd {
  font-family: var(--font-body);
  font-size: 0.82em;
  font-weight: 600;
  padding: 0.1em 0.45em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-card-2);
  color: var(--text);
  white-space: nowrap;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 999px; font-weight: 700; text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.accent { color: var(--accent); }
.muted-2 { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }

/* -------------------------------------------------------------- Buttons */
.btn {
  --btn-h: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--btn-h);
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn-icon { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 10px 30px -10px rgba(212, 255, 61, 0.55); }
.btn-primary:active { transform: scale(0.97); box-shadow: none; }
.btn-primary:focus-visible { outline-color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-card-2); border-color: rgba(255, 255, 255, 0.24); }
.btn-lg { --btn-h: 56px; font-size: 15px; }
.btn-xl { --btn-h: 62px; padding: 0 30px 0 32px; font-size: 16px; }
.btn-xl .btn-icon { width: 20px; height: 20px; }
.btn-block { width: 100%; }
.btn-text {
  background: none; border: 0; padding: 8px 4px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-strong);
  transition: color 0.15s;
}
.btn-text:hover { color: var(--text); text-decoration-color: currentColor; }
.btn-text.is-armed { color: var(--bad); text-decoration-color: currentColor; }

/* ----------------------------------------------------------------- Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-mark { width: 28px; height: 28px; color: var(--text); flex: none; }
.logo-odd { fill: var(--accent); transform-origin: 23px 23px; transition: transform 0.4s var(--ease-spring); }
.logo:hover .logo-odd { transform: scale(1.14); }
.logo-word { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.logo-small .logo-mark { width: 22px; height: 22px; }
.logo-small .logo-word { font-size: 16px; }

/* --------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 11, 13, 0.78);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  padding: 8px 14px; border-radius: 999px;
  color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.site-nav a:hover { color: var(--text); background: var(--bg-card-2); }
.site-nav a.nav-cta { background: var(--accent); color: var(--accent-ink); font-family: var(--font-display); font-weight: 600; font-size: 13px; padding: 10px 18px; }
.site-nav a.nav-cta:hover { background: var(--accent-hover); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--bg-card-2); }

/* ----------------------------------------------------------------- Hero */
.hero { position: relative; padding-block: clamp(48px, 8vw, 104px) clamp(64px, 9vw, 120px); overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: -20% -10% auto auto; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px;
  background: radial-gradient(closest-side, rgba(212, 255, 61, 0.07), transparent 70%);
  pointer-events: none;
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 10px; border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--text-2); font-size: 13px; font-weight: 500;
}
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hero-title {
  margin-top: 24px;
  font-size: clamp(40px, 6.2vw, 80px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.0;
  text-wrap: balance;
}
.hero-lede { margin-top: 24px; max-width: 34em; color: var(--text-2); font-size: clamp(16px, 1.35vw, 18px); line-height: 1.65; }
.hero-actions { margin-top: 36px; display: flex; align-items: center; flex-wrap: wrap; gap: 18px 24px; }
.hero-best { color: var(--text-2); font-size: 14px; }
.hero-best strong { color: var(--text); font-family: var(--font-display); font-weight: 600; }
.rule-chips { list-style: none; margin: 36px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rule-chips li {
  padding: 8px 14px; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--line);
  color: var(--text-2); font-size: 13px;
}
.rule-chips strong { font-family: var(--font-display); font-weight: 600; color: var(--text); margin-right: 4px; }
.rule-chips strong.good { color: var(--good); }
.rule-chips strong.bad { color: var(--bad); }

/* Demo card */
.demo { min-width: 0; }
.demo-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--field);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8);
}
.demo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--text-2);
}
.demo-title { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.pulse-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.pulse-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--good); animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(2.8); opacity: 0; } }
.demo-score { font-variant-numeric: tabular-nums; }
.demo-score strong { font-family: var(--font-display); color: var(--text); font-weight: 600; margin-left: 4px; }
.demo-stage { position: relative; aspect-ratio: 1 / 0.86; }
#demo-canvas { width: 100%; height: 100%; cursor: crosshair; touch-action: manipulation; }
.demo-toast {
  position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 12px);
  max-width: calc(100% - 32px); width: max-content;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(10, 11, 13, 0.9); border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 500; text-align: center; color: var(--text);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}
.demo-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.demo-toast.good { border-color: rgba(107, 226, 154, 0.5); }
.demo-toast.bad { border-color: rgba(255, 107, 94, 0.5); }

/* ------------------------------------------------------------- Sections */
.section { padding-block: clamp(72px, 10vw, 128px); border-top: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.kicker {
  font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.section-head h2 { margin-top: 14px; font-size: clamp(32px, 4.6vw, 56px); font-weight: 700; letter-spacing: -0.04em; text-wrap: balance; }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.step {
  position: relative; padding: 24px 24px 30px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.step:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.step-art { height: 132px; margin-bottom: 22px; border-radius: 12px; background: var(--field); display: grid; place-items: center; overflow: hidden; }
.step-art svg { width: 100%; max-width: 240px; height: 100%; }
.art-chip rect { fill: var(--bg); }
.art-chip text { font-family: var(--font-display); font-size: 13px; font-weight: 600; text-anchor: middle; }
.art-good rect { stroke: rgba(107, 226, 154, 0.5); }
.art-good text { fill: var(--good); }
.art-bad rect { stroke: rgba(255, 107, 94, 0.5); }
.art-bad text { fill: var(--bad); }
.art-cursor { fill: var(--text); stroke: var(--bg); stroke-width: 1.5; stroke-linejoin: round; }
.step-num { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.1em; }
.step h3 { margin-top: 8px; font-size: 22px; }
.step p { margin-top: 10px; color: var(--text-2); font-size: 15px; line-height: 1.6; }

/* Climb */
.climb { margin-top: 56px; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius-lg); background: var(--bg-raised); border: 1px solid var(--line); }
.climb-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 24px; margin-bottom: 22px; }
.climb-head h3 { font-size: 22px; }
.climb-head p { color: var(--muted); font-size: 14px; }
.climb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.climb-card { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--bg-card); border: 1px solid var(--line); }
.climb-card canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--field); }
.climb-card figcaption { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; padding: 16px 18px 18px; font-size: 13px; color: var(--text-2); }
.climb-stage { font-family: var(--font-display); font-weight: 600; color: var(--text); font-size: 15px; }
.climb-count { text-align: right; font-variant-numeric: tabular-nums; }
.meter { grid-column: 1 / -1; display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.meter i { display: block; height: 6px; border-radius: 999px; background: var(--bg-card-2); overflow: hidden; }
.meter b { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.9s var(--ease); }
.climb-note { margin-top: 18px; color: var(--muted); font-size: 14px; }

/* Records */
.record-grid { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 14px; }
.record {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-height: 172px;
  padding: 22px 24px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--line);
}
.record-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.record-value { font-family: var(--font-display); font-size: clamp(36px, 4vw, 48px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.record-unit { font-size: 13px; color: var(--muted); }
.record-main { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.record-main .record-label, .record-main .record-unit { color: rgba(10, 11, 13, 0.7); }
.record-main .record-value { font-size: clamp(56px, 7vw, 88px); }
.records-foot { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: 14px; }

/* FAQ */
.faq-layout { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.faq-layout .section-head { position: sticky; top: calc(var(--header-h) + 32px); }
.faq-list { border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 2px;
  font-family: var(--font-display); font-size: clamp(16px, 1.6vw, 18px); font-weight: 600; letter-spacing: -0.015em;
  transition: color 0.15s;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: ''; flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(var(--text), var(--text)) center / 11px 1.6px no-repeat,
    linear-gradient(var(--text), var(--text)) center / 1.6px 11px no-repeat;
  transition: transform 0.3s var(--ease), background-color 0.2s;
}
.faq-list details[open] summary::after { transform: rotate(45deg); background-color: var(--bg-card-2); }
.faq-list summary:hover { color: var(--accent); }
.faq-list details p { padding: 0 48px 24px 2px; color: var(--text-2); }
.faq-list details[open] p { animation: faq-in 0.35s var(--ease); }
@keyframes faq-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Final CTA */
.section-cta { text-align: center; position: relative; overflow: hidden; }
.section-cta::before {
  content: ''; position: absolute; left: 50%; bottom: -60%; width: 900px; height: 600px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(212, 255, 61, 0.08), transparent 70%); pointer-events: none;
}
.cta-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.cta-inner h2 { font-size: clamp(38px, 6.4vw, 84px); font-weight: 800; letter-spacing: -0.05em; text-wrap: balance; }
.cta-inner p { color: var(--text-2); margin-bottom: 14px; }

/* ------------------------------------------------------------ Ad slots
 * Hidden until ads are enabled and the slot has an ad-unit ID (see assets/js/ads.js).
 * Always in normal document flow: never fixed, sticky, floating or over content.
 * Every slot keeps at least 150px from start buttons, the demo and game controls.
 */
.ad-slot { display: block; position: static; }
.ad-band { border-top: 1px solid var(--line); padding-block: clamp(56px, 7vw, 80px); }
.ad-band .container { max-width: 1018px; }
.page-info .ad-band { margin-top: 72px; } /* keeps 150px+ from the article's closing button */
.ad-label {
  margin: 0 0 10px; text-align: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.ad-unit { width: 100%; min-height: 100px; }
.ad-slot ins.adsbygoogle { display: block; width: 100%; text-decoration: none; }
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }
.ad-slot:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
@media (min-width: 768px) { .ad-unit { min-height: 90px; } }
/* No ad is ever visible during a run (the game screen also covers the page). */
body[data-game-state="countdown"] .ad-slot,
body[data-game-state="playing"] .ad-slot,
body[data-game-state="paused"] .ad-slot { visibility: hidden !important; }

/* --------------------------------------------------------------- Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 36px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px 32px; }
.footer-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.footer-nav a { padding: 6px 12px; border-radius: 999px; color: var(--text-2); font-size: 14px; text-decoration: none; transition: color 0.15s, background-color 0.15s; }
.footer-nav a:hover { color: var(--text); background: var(--bg-card-2); }
.footer-nav a[aria-current="page"] { color: var(--text); }
.footer-note { width: 100%; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------- Scroll reveal */
.js [data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js .steps .step[data-reveal]:nth-child(2) { transition-delay: 0.08s; }
.js .steps .step[data-reveal]:nth-child(3) { transition-delay: 0.16s; }

/* =================================================================== GAME */
body.in-game { overflow: hidden; }
.game {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.game > .hud, .game > .timebar, .game > .arena { animation: game-in 0.35s var(--ease); }
@keyframes game-in { from { opacity: 0; } to { opacity: 1; } }

/* HUD */
.hud {
  flex: none; position: relative; z-index: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  height: 68px; padding: 0 clamp(12px, 2.4vw, 28px);
  background: var(--bg);
}
.hud-stage { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.hud-label { font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hud-stage-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; display: inline-block; }
.hud-stage-value.bump { animation: bump 0.32s var(--ease-spring); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); color: var(--accent); } 100% { transform: scale(1); } }
.hud-sub { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.hud-clock { position: relative; display: flex; align-items: center; justify-content: center; min-width: 130px; }
.hud-time {
  font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
  min-width: 4.2ch; text-align: center;
  transition: color 0.2s;
}
.game[data-time="warn"] .hud-time { color: var(--warn); }
.game[data-time="danger"] .hud-time { color: var(--bad); }
.hud-clock.shake .hud-time { animation: shake 0.3s linear; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.hud-delta {
  position: absolute; left: calc(100% - 6px); top: 50%;
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  opacity: 0; transform: translate(0, -50%); pointer-events: none; white-space: nowrap;
}
.hud-delta.good { color: var(--good); }
.hud-delta.bad { color: var(--bad); }
.hud-delta.show { animation: delta 0.75s var(--ease) forwards; }
@keyframes delta { 0% { opacity: 0; transform: translate(-4px, -30%); } 15% { opacity: 1; transform: translate(0, -50%); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -90%); } }

.hud-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.hud-best { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; transition: color 0.2s; }
.hud-best.is-new { color: var(--accent); font-weight: 600; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--line-strong); background: var(--bg-card);
  color: var(--text); touch-action: manipulation;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--bg-card-2); border-color: rgba(255, 255, 255, 0.26); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* Time bar */
.timebar { flex: none; position: relative; z-index: 3; height: 4px; background: rgba(255, 255, 255, 0.06); }
.timebar-fill { height: 100%; width: 100%; transform-origin: left center; background: var(--accent); transition: background-color 0.3s; will-change: transform; }
.game[data-time="warn"] .timebar-fill { background: var(--warn); }
.game[data-time="danger"] .timebar-fill { background: var(--bad); }

/* Arena */
.arena { position: relative; flex: 1; min-height: 0; background: var(--field); overflow: hidden; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.arena.is-hidden #game-canvas { visibility: hidden; }
.arena-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.arena-flash.good { box-shadow: inset 0 0 0 3px rgba(107, 226, 154, 0.75); animation: flash 0.32s var(--ease) forwards; }
.arena-flash.bad { box-shadow: inset 0 0 0 3px rgba(255, 107, 94, 0.85); animation: flash 0.36s var(--ease) forwards; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fx-float {
  position: absolute; transform: translate(-50%, -100%);
  font-family: var(--font-display); font-size: 15px; font-weight: 700; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px; background: rgba(10, 11, 13, 0.82);
  animation: float-up 0.62s var(--ease) forwards;
}
.fx-float.good { color: var(--good); }
.fx-float.bad { color: var(--bad); }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, -60%); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }
.arena-hint {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom, 0)); transform: translateX(-50%);
  padding: 9px 16px; border-radius: 999px; background: rgba(10, 11, 13, 0.72); border: 1px solid var(--line);
  color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.arena-hint.is-gone { opacity: 0; transform: translate(-50%, 8px); }

/* Countdown */
.countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.countdown-num {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(96px, 18vw, 200px); letter-spacing: -0.05em; line-height: 1;
  color: var(--text);
}
.countdown-num.pop { animation: count-pop 0.55s var(--ease) both; }
@keyframes count-pop { 0% { opacity: 0; transform: scale(1.5); } 25% { opacity: 1; transform: scale(1); } 75% { opacity: 1; transform: scale(0.96); } 100% { opacity: 0; transform: scale(0.8); } }

/* Overlays */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 20px;
  overflow-y: auto; overscroll-behavior: contain;
  background: rgba(10, 11, 13, 0.94);
  touch-action: auto;
  user-select: text; -webkit-user-select: text;
}
.overlay-results { background: rgba(10, 11, 13, 0.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.overlay.is-open .panel { animation: panel-in 0.42s var(--ease-spring) both; }
.overlay.is-open { animation: game-in 0.25s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: none; } }
.results-stack { width: min(480px, 100%); margin-block: auto; }
.panel {
  width: min(440px, 100%);
  padding: clamp(24px, 4vw, 36px);
  border-radius: var(--radius-lg);
  background: var(--bg-card); border: 1px solid var(--line-strong);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
}
.panel-results { width: 100%; }
.panel-title { margin-top: 12px; font-size: clamp(30px, 5vw, 40px); font-weight: 800; letter-spacing: -0.04em; }
.panel-text { margin-top: 10px; color: var(--text-2); font-size: 15px; }
.mini-stats { margin: 22px 0 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.mini-stats div { padding: 12px 14px; background: var(--bg-card); }
.mini-stats dt { font-size: 12px; color: var(--muted); }
.mini-stats dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.panel-row { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel-row .btn { padding: 0 14px; font-size: 13px; }
.panel-quit { display: block; margin: 16px auto 0; }
#btn-sound[aria-pressed="false"] .sound-on, #btn-sound[aria-pressed="true"] .sound-off { display: none; }

/* Results */
.score { margin-top: 10px; display: flex; align-items: flex-end; gap: 16px; }
.score-value { font-family: var(--font-display); font-size: clamp(84px, 16vw, 124px); font-weight: 800; letter-spacing: -0.06em; line-height: 0.86; font-variant-numeric: tabular-nums; }
.score-label { padding-bottom: 6px; font-family: var(--font-display); font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--text-2); }
.score-note { margin-top: 16px; min-height: 1.6em; color: var(--text-2); font-size: 15px; }
.score-note .badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  animation: badge-in 0.6s var(--ease-spring) 0.25s both;
}
.score-note .badge::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-ink); }
@keyframes badge-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.res-grid { margin: 20px 0 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.res-grid div { padding: 12px 14px; background: var(--bg-card); }
.res-grid dt { font-size: 12px; color: var(--muted); }
.res-grid dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.share-status { margin-top: 12px; text-align: center; color: var(--good); font-size: 13px; }
.share-status:empty { display: none; }
.ad-results { margin-top: 112px; }
/* With an ad below the card, pin the card near the top so a loading ad never moves the buttons. */
.overlay-results:has(.ad-slot:not([hidden])) { align-items: start; }
.overlay-results:has(.ad-slot:not([hidden])) .results-stack { margin-block: clamp(0px, 6vh, 64px) 0; }

/* ======================================================== Info pages */
.page-info main { padding-block: clamp(48px, 8vw, 96px) clamp(72px, 10vw, 128px); }
.prose { max-width: 720px; }
.prose .kicker { margin-bottom: 16px; }
.prose h1 { font-size: clamp(38px, 6vw, 64px); font-weight: 800; letter-spacing: -0.045em; text-wrap: balance; }
.prose .updated { margin-top: 18px; color: var(--muted); font-size: 14px; }
.prose .lead { margin-top: 26px; font-size: clamp(17px, 1.6vw, 20px); color: var(--text); line-height: 1.6; }
.prose h2 { margin-top: 52px; font-size: clamp(21px, 2.2vw, 26px); letter-spacing: -0.025em; }
.prose h3 { margin-top: 28px; font-size: 17px; letter-spacing: -0.01em; }
.prose p, .prose li { color: var(--text-2); font-size: 16px; line-height: 1.75; }
.prose p { margin-top: 14px; }
.prose ul { margin: 14px 0 0; padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 22px; margin-top: 8px; }
.prose li::before { content: ''; position: absolute; left: 2px; top: 0.72em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.prose a:not(.btn) { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.prose a:not(.btn):hover { color: var(--accent); }
.prose strong { color: var(--text); }
.prose code { font-size: 0.9em; padding: 0.1em 0.4em; border-radius: 6px; background: var(--bg-card-2); color: var(--text); }
.prose .callout { margin-top: 28px; padding: 18px 20px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--line); }
.prose .callout p:first-child { margin-top: 0; }
.prose .btn { margin-top: 40px; }
.rule-table { width: 100%; margin-top: 18px; border-collapse: collapse; font-size: 15px; }
.rule-table th, .rule-table td { text-align: left; padding: 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.rule-table th { width: 44%; color: var(--text); font-weight: 600; padding-right: 16px; }
.rule-table td { color: var(--text-2); }

/* 404 */
.not-found { min-height: calc(100vh - var(--header-h) - 120px); display: grid; place-items: center; text-align: center; padding-block: 64px; }
.not-found .big { font-family: var(--font-display); font-size: clamp(96px, 20vw, 200px); font-weight: 800; letter-spacing: -0.06em; line-height: 1; }
.not-found .big span { color: var(--accent); }
.not-found p { margin: 16px auto 32px; color: var(--text-2); max-width: 28em; }

/* ======================================================== Responsive */
@media (max-width: 1024px) {
  .record-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .record-main { grid-column: 1 / -1; min-height: 150px; }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { max-width: 640px; }
  .demo { max-width: 560px; width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .step { display: grid; grid-template-columns: 180px 1fr; column-gap: 24px; align-items: start; }
  .step-art { grid-row: 1 / span 3; margin-bottom: 0; height: 120px; }
  .step-num { align-self: end; }
  .climb-grid { grid-template-columns: 1fr; }
  .climb-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
  .climb-card figcaption { align-content: center; }
  .faq-layout { grid-template-columns: 1fr; }
  .faq-layout .section-head { position: static; margin-bottom: 8px; }
}

@media (max-width: 720px) {
  :root { --header-h: 60px; }
  .site-nav a:not(.nav-cta) { display: none; }
  .hero-actions .btn-xl { flex: 1 1 100%; }
  .hero-best { width: 100%; text-align: center; }
  .rule-chips { margin-top: 28px; }
  .step { display: block; }
  .step-art { height: 120px; margin-bottom: 18px; }
  .climb-card { display: block; }
  .record-grid { gap: 10px; }
  .record { min-height: 118px; padding: 16px 14px; }
  .record-main { min-height: 140px; padding: 18px; }
  .record-label, .record-unit { font-size: 12px; }
  .record-value { font-size: 30px; }
  .faq-list details p { padding-right: 8px; }
  .cta-inner .btn-xl { width: 100%; }

  /* Game: compact HUD */
  .hud { height: 58px; gap: 8px; padding: 0 12px; }
  .hud-sub, .hud-best { display: none; }
  .hud-label { font-size: 10px; }
  .hud-stage { gap: 7px; }
  .hud-stage-value { font-size: 24px; }
  .hud-clock { min-width: 96px; }
  .hud-time { font-size: 28px; }
  .hud-delta { font-size: 13px; left: calc(100% - 10px); }
  .icon-btn { width: 42px; height: 42px; }
  .arena-hint { font-size: 12px; }
  .panel { padding: 22px 20px; }
  .res-grid { grid-template-columns: repeat(2, 1fr); }
  .mini-stats dd { font-size: 16px; }
}

@media (max-width: 380px) {
  .hero-title { font-size: 36px; }
  .rule-chips li { font-size: 12px; padding: 7px 11px; }
  .panel-row { grid-template-columns: 1fr; }
}

/* Short landscape screens (phones sideways) */
@media (max-height: 480px) and (orientation: landscape) {
  .hud { height: 48px; }
  .hud-time { font-size: 24px; }
  .hud-stage-value { font-size: 20px; }
  .icon-btn { width: 38px; height: 38px; }
  .arena-hint { display: none; }
  .overlay { place-items: start center; }
  .score-value { font-size: 72px; }
}

@media (hover: none) {
  .step:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  /* Keep essential feedback visible without movement. */
  .countdown-num.pop, .hud-delta.show, .fx-float, .arena-flash.good, .arena-flash.bad { animation: none !important; }
  .hud-delta.show { opacity: 1; transform: translate(0, -50%); }
  .fx-float { opacity: 1; }
  .arena-flash.good, .arena-flash.bad { opacity: 0.6; }
}
