:root {
  --bg: #070B16;
  --panel: #0E1424;
  --line: rgba(255, 255, 255, 0.08);
  --text: #E8ECF5;
  --muted: #8A93A8;
  --neon: #39FF9F;
  --neon-2: #22D3EE;
  --food: #FF4D8D;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(900px 600px at 50% -10%, #12204A 0%, var(--bg) 60%) fixed;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.app { width: min(92vw, 560px); display: grid; gap: 16px; padding: 16px 0; }

.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 14px var(--neon); }
.stats { display: flex; gap: 8px; }
.stat { padding: 6px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: right; min-width: 64px; }
.stat span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; }

.board { position: relative; aspect-ratio: 1; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center;
  background: rgba(7, 11, 22, .82); backdrop-filter: blur(6px);
  transition: opacity .25s;
}
.overlay.is-hidden { opacity: 0; pointer-events: none; }
.overlay h1 { font-size: clamp(44px, 12vw, 72px); line-height: .95; letter-spacing: -.03em; }
.overlay h1 em { font-style: normal; color: var(--neon); text-shadow: 0 0 24px rgba(57, 255, 159, .55); }
.overlay h2 { font-size: 32px; }
.overlay p { color: var(--muted); max-width: 320px; line-height: 1.45; }
.overlay .hint { font-size: 12.5px; }
#count { font-size: 120px; font-weight: 700; color: var(--neon); text-shadow: 0 0 40px rgba(57, 255, 159, .6); }
.final b { color: var(--text); font-size: 28px; }
.record { color: var(--neon) !important; font-weight: 700; }
.record.is-hidden { display: none; }

.speeds { display: flex; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.chip.is-on { border-color: var(--neon); color: var(--neon); }
.btn { padding: 14px 40px; border: 0; border-radius: 999px; background: var(--neon); color: #04130C; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; box-shadow: 0 0 28px rgba(57, 255, 159, .45); }
.btn:active { transform: scale(.97); }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; text-decoration: underline; }

.pad { display: none; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 56px); justify-content: center; gap: 8px; }
.pad button { border-radius: 16px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 20px; }
.pad button:active { background: #18213A; }
.pad [data-dir="up"] { grid-column: 2; grid-row: 1; }
.pad [data-dir="left"] { grid-column: 1; grid-row: 2; }
.pad [data-dir="pause"] { grid-column: 2; grid-row: 2; font-size: 14px; color: var(--muted); }
.pad [data-dir="right"] { grid-column: 3; grid-row: 2; }
.pad [data-dir="down"] { grid-column: 2; grid-row: 3; }
@media (pointer: coarse) { .pad { display: grid; } }
