/* ════════════════════════════════════════════════════════════
   NEON SERPENT — UI
   Dark neon arcade aesthetic. Glass HUD, glowing board,
   animated overlays. No build step, no dependencies.
   ════════════════════════════════════════════════════════════ */

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

:root {
  --bg: #04060d;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #eaf0fa;
  --dim: #8b98ad;
  --neon: #a3e635;
  --neon-soft: rgba(163, 230, 53, 0.55);
  --cyan: #22d3ee;
  --pink: #fb7185;
  --gold: #fbbf24;
  --danger: #f43f5e;
  --radius: 16px;
  --font-num: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(34, 211, 238, 0.07), transparent 60%),
    radial-gradient(1000px 700px at 90% 110%, rgba(163, 230, 53, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ── ambient floating orbs ─────────────────────────────── */
.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; animation: drift 18s ease-in-out infinite alternate; }
.orb-a { width: 340px; height: 340px; background: rgba(163, 230, 53, 0.10); top: -80px; left: -80px; }
.orb-b { width: 420px; height: 420px; background: rgba(34, 211, 238, 0.09); bottom: -120px; right: -100px; animation-delay: -6s; }
.orb-c { width: 260px; height: 260px; background: rgba(244, 63, 94, 0.07); top: 45%; left: 60%; animation-delay: -12s; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(50px, 36px) scale(1.12); }
}

/* ── shell ─────────────────────────────────────────────── */
.game-shell {
  position: relative; z-index: 1;
  width: min(94vw, 540px);
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px 0 30px;
}

/* ── top bar ───────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 12px var(--neon-soft), 0 0 30px rgba(163, 230, 53, 0.3);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 50% { transform: scale(1.35); opacity: 0.75; } }
.brand-name { font-family: var(--font-num); font-weight: 800; font-size: 15px; letter-spacing: 3px; }

.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 17px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px; color: var(--text);
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.09); }
.icon-btn:active { transform: scale(0.94); }

/* ── HUD stat cards ────────────────────────────────────── */
.hud { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 10px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
  backdrop-filter: blur(6px);
  min-width: 0;
}
.stat-label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); }
.stat-value { font-family: var(--font-num); font-weight: 800; font-size: 24px; line-height: 1.1; }
.stat-score .stat-value {
  color: var(--neon);
  text-shadow: 0 0 18px rgba(163, 230, 53, 0.45);
}
.stat-score .stat-value.pop { animation: score-pop 0.28s ease; }
@keyframes score-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.28); }
  100% { transform: scale(1); }
}
.speed-value { color: var(--cyan); font-size: 20px; }

/* ── board ─────────────────────────────────────────────── */
.board-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(163, 230, 53, 0.22);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 34px rgba(163, 230, 53, 0.10),
    0 24px 70px rgba(0, 0, 0, 0.55);
  background: #070b16;
  touch-action: none;
  user-select: none;
}
#game { display: block; width: 100%; aspect-ratio: 1 / 1; }

/* ── combo pill ────────────────────────────────────────── */
.combo-pill {
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(10, 8, 2, 0.72);
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 999px;
  padding: 6px 14px 8px;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.25);
  backdrop-filter: blur(4px);
  z-index: 3;
  animation: combo-in 0.25s ease;
}
@keyframes combo-in { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }
.combo-mult { font-family: var(--font-num); font-weight: 800; color: var(--gold); font-size: 18px; }
.combo-label { font-size: 10px; letter-spacing: 2px; color: var(--dim); }
.combo-track { width: 64px; height: 5px; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; }
.combo-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), #f59e0b); border-radius: 99px; }

/* ── GO flash ──────────────────────────────────────────── */
.go-flash {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-num); font-weight: 800; font-size: 64px;
  color: var(--neon);
  text-shadow: 0 0 30px var(--neon-soft);
  pointer-events: none; z-index: 4;
}
.go-flash:not(.hidden) { animation: go-zoom 0.7s ease forwards; }
@keyframes go-zoom {
  0% { transform: scale(0.4); opacity: 0; }
  25% { transform: scale(1.15); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* ── overlays ──────────────────────────────────────────── */
.overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 13, 0.78);
  backdrop-filter: blur(10px);
  padding: 22px;
  animation: overlay-in 0.3s ease;
}
@keyframes overlay-in { from { opacity: 0; } }
.hidden { display: none !important; }

.panel {
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
  animation: panel-rise 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes panel-rise { from { transform: translateY(26px) scale(0.96); opacity: 0; } }
.panel-slim { gap: 18px; }

.kicker {
  font-size: 11px; letter-spacing: 4px; color: var(--cyan);
  text-transform: uppercase;
}
.kicker.danger { color: var(--danger); }

.title {
  font-family: var(--font-num); font-weight: 800;
  font-size: clamp(44px, 12vw, 62px); line-height: 1.02; letter-spacing: 2px;
  background: linear-gradient(100deg, #d9f99d 10%, var(--neon) 35%, var(--cyan) 70%, #d9f99d 95%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 4s linear infinite;
  filter: drop-shadow(0 0 22px rgba(163, 230, 53, 0.25));
}
@keyframes shine { to { background-position: 220% center; } }
.title-sm {
  font-family: var(--font-num); font-weight: 800;
  font-size: 34px; letter-spacing: 3px;
}

.tagline { color: var(--dim); font-size: 15px; line-height: 1.55; }

.best-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--gold);
  border-radius: 999px; padding: 7px 16px; font-size: 14px;
}
.best-chip strong { font-family: var(--font-num); }

.newbest {
  font-family: var(--font-num); font-weight: 800; letter-spacing: 2px;
  color: #1a1000; font-size: 14px;
  background: linear-gradient(100deg, #fde68a, var(--gold));
  padding: 8px 20px; border-radius: 999px;
  box-shadow: 0 0 26px rgba(251, 191, 36, 0.55);
  animation: newbest-pulse 1.1s ease-in-out infinite;
}
@keyframes newbest-pulse { 50% { transform: scale(1.07); } }

.final-score {
  font-family: var(--font-num); font-weight: 800; font-size: 58px;
  color: var(--neon); text-shadow: 0 0 26px rgba(163, 230, 53, 0.4);
  line-height: 1;
}
.final-best { color: var(--dim); font-size: 14px; }
.final-best strong { color: var(--text); font-family: var(--font-num); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.mini-stat {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.mini-stat span { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); }
.mini-stat strong { font-family: var(--font-num); font-size: 17px; }

/* ── buttons ───────────────────────────────────────────── */
.btn-primary {
  font-family: var(--font-num); font-weight: 800; letter-spacing: 1.5px;
  font-size: 17px; color: #0a1206;
  background: linear-gradient(100deg, #bef264, var(--neon) 55%, #65d90f);
  border: none; border-radius: 14px;
  padding: 15px 42px; cursor: pointer;
  box-shadow: 0 0 28px rgba(163, 230, 53, 0.35), 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  animation: btn-breathe 2.4s ease-in-out infinite;
}
@keyframes btn-breathe {
  50% { box-shadow: 0 0 40px rgba(163, 230, 53, 0.5), 0 10px 30px rgba(0, 0, 0, 0.4); }
}
.btn-primary:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.06); }
.btn-primary:active { transform: scale(0.96); }

.hint { color: var(--dim); font-size: 13px; }

/* ── controls / perks ──────────────────────────────────── */
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.ctrl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); }
.ctrl em { font-style: normal; }
kbd {
  font-family: var(--font-ui); font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom-width: 2px; border-radius: 6px;
  padding: 2px 7px; margin: 0 1px; color: var(--text);
}
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: flex; } }

.perks { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--dim); }

/* ── footnote ──────────────────────────────────────────── */
.footnote { text-align: center; color: var(--dim); font-size: 12.5px; }
.kbd-hint kbd { font-size: 11px; }

/* ── small screens ─────────────────────────────────────── */
@media (max-width: 420px) {
  .hud { grid-template-columns: 1.3fr 1fr 1fr; }
  .stat-speed { display: none; }
  .stat-value { font-size: 21px; }
  .game-shell { gap: 12px; padding-top: 12px; }
}
