:root {
  --bg: #0a0a1f;
  --accent: #5bd1e6;
  --text: #ffffff;
  --font: 'Rajdhani', system-ui, sans-serif;
  --font-head: 'Space Grotesk', var(--font);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #1d1d45 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
}

#board {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  transition: filter 0.25s ease;
}
#board.dimmed { filter: blur(3px) brightness(0.55); }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: calc(env(safe-area-inset-top) + 0.7rem) 1.1rem 0.6rem;
  pointer-events: none;
  z-index: 5;
}
.hud.hidden { display: none; }
.hud-block { display: flex; flex-direction: column; line-height: 1; }
.hud-mid { align-items: center; flex: 1; }
.hud-right { align-items: flex-end; }
.hud-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8b8bb5;
  font-weight: 700;
}
.hud-value { font-size: 1.9rem; font-weight: 900; font-family: var(--font-head); }

.ball-dots { display: flex; gap: 0.4rem; }
.ball-dot {
  width: 0.6rem; height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.ball-dot.spent { background: rgba(255,255,255,0.15); box-shadow: none; }

.mute-btn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 0.7rem);
  right: 0.9rem;
  z-index: 6;
  width: 2.6rem; height: 2.6rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---------- Screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.screen.hidden { display: none; }

.card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
}

.logo {
  font-family: var(--font-head);
  font-size: clamp(2.6rem, 16vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.9;
}
.logo span {
  display: inline-grid;
  place-items: center;
  width: 0.9em; height: 0.9em;
  margin-left: 0.12em;
  border-radius: 0.26em;
  background: linear-gradient(160deg, var(--accent), #54a0ff);
  transform: rotate(6deg);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.22);
}
.tagline { color: #b9b9e0; font-size: 1rem; margin-bottom: 0.6rem; font-weight: 500; }

.mode-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 1.2rem 1.5rem;
  color: #05202a;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: linear-gradient(160deg, #8fe8f5, var(--accent));
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.mode-btn:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }

/* ---------- Game Over ---------- */
.go-reason { color: #b9b9e0; font-weight: 600; }
.go-score {
  font-family: var(--font-head);
  font-size: clamp(3.4rem, 22vw, 5rem);
  font-weight: 700;
  line-height: 1;
  margin: 0.2rem 0;
}
.go-best { color: #c9c9ec; font-size: 1.05rem; margin-bottom: 0.7rem; }
.go-best strong { color: #fff; }

/* ── Registration panel ── */
.reg-panel {
  width: 100%; display: flex; flex-direction: column; gap: 0.55rem;
  padding: 0.9rem; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; background: rgba(255,255,255,0.04);
}
.reg-panel form { display: flex; flex-direction: column; gap: 0.55rem; }
.reg-hint { font-size: 0.9rem; font-weight: 700; opacity: 0.65; }
.reg-input {
  width: 100%; padding: 0.65rem 0.9rem;
  border: 1.5px solid rgba(255,255,255,0.18); border-radius: 8px;
  background: rgba(255,255,255,0.07); color: #fff;
  font-family: var(--font); font-size: 1rem; outline: none;
}
.reg-input::placeholder { opacity: 0.4; }
.reg-input:focus { border-color: rgba(255,255,255,0.45); }
.reg-error { font-size: 0.82rem; font-weight: 700; color: #ff4d6d; }
.reg-btns { display: flex; gap: 0.55rem; }
.reg-submit-btn {
  flex: 1; padding: 0.7rem; border: none; border-radius: 8px;
  background: var(--accent); color: #05202a;
  font-family: var(--font); font-weight: 900; font-size: 1rem; cursor: pointer;
}
.reg-skip-btn {
  padding: 0.7rem 1rem; border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
  background: transparent; color: rgba(255,255,255,0.45);
  font-family: var(--font); font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.reg-saved { font-size: 0.95rem; font-weight: 700; color: #39ff88; }
