:root {
  --bg-top: #1a0b3d;
  --bg-bottom: #0a0118;
  --neon: #00f0ff;
  --neon-2: #ff2d9b;
  --neon-3: #7CFC6B;
  --ink: #e9e6ff;
  --ink-dim: rgba(233, 230, 255, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-bottom);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: radial-gradient(120% 80% at 50% -10%, var(--bg-top), var(--bg-bottom) 70%);
}

/* ── HUD ─────────────────────────────────────────────────── */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding: 18px 0 0;
  pointer-events: none;
}

#scoreBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#score {
  font-weight: 900;
  font-size: clamp(36px, 10vw, 64px);
  font-variant-numeric: tabular-nums;
  color: var(--neon);
  text-shadow: 0 0 12px var(--neon), 0 0 30px rgba(0, 240, 255, 0.4);
  line-height: 1;
  transition: transform 0.08s ease;
}

#score.bump {
  transform: scale(1.25);
}

#best {
  font-size: clamp(11px, 3vw, 14px);
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  font-weight: 600;
  min-height: 1.2em;
}

/* ── Stage / canvas ───────────────────────────────────────── */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Overlay ──────────────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(10, 1, 24, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#overlayTitle {
  font-size: clamp(38px, 12vw, 80px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-align: center;
  color: var(--neon);
  text-shadow: 0 0 16px var(--neon), 0 0 48px rgba(0, 240, 255, 0.5);
}

#overlaySubtitle {
  font-size: clamp(13px, 3.5vw, 18px);
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-align: center;
  max-width: 28ch;
}

/* game-over panel card */
#gameOverPanel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 18px;
  padding: 20px 40px;
}

#gameOverPanel .label {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 700;
}

#gameOverPanel .val {
  font-size: clamp(26px, 8vw, 48px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}

#gameOverPanel .val.new-best {
  color: var(--neon-3);
  text-shadow: 0 0 12px var(--neon-3), 0 0 30px rgba(124, 252, 107, 0.35);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  padding: 14px 36px;
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bg-bottom);
  background: var(--neon);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 0 18px var(--neon), 0 0 48px rgba(0, 240, 255, 0.35);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:active {
  transform: scale(0.95);
  box-shadow: 0 0 10px var(--neon);
}

.hint {
  font-size: clamp(11px, 3vw, 13px);
  color: var(--ink-dim);
  letter-spacing: 0.14em;
}
