:root {
  --indigo: #6366f1;
  --indigo-deep: #4f46e5;
  --blade: #e0e7ff;
  --pink: #ec4899;
  --gold: #facc15;
  --bg: #0b0a1f;
  --text: #ece9ff;
  --muted: #9a95c9;
  --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: var(--bg);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
}

#game { position: fixed; inset: 0; }
#game canvas { display: block; touch-action: none; }

.hidden { display: none !important; }

/* ── HUD ── */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 0.7rem) 1.2rem 0;
  pointer-events: 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.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.hud-value { font-size: 1.9rem; font-weight: 900; font-family: var(--font-head); }
.hud-value.low { color: var(--pink); text-shadow: 0 0 16px currentColor; }
.hud-mult {
  font-size: 2.3rem; font-weight: 900; font-family: var(--font-head);
  color: var(--indigo); text-shadow: 0 0 18px currentColor;
}
.hud-value.punch, .hud-mult.punch { animation: score-punch .2s ease-out; }
@keyframes score-punch {
  0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); }
}

/* ── Combo-Balken ── */
.combo-bar {
  position: fixed; z-index: 5; pointer-events: none;
  top: calc(env(safe-area-inset-top) + 4.4rem); left: 50%; transform: translateX(-50%);
  width: min(54vw, 280px); height: 5px; border-radius: 999px;
  background: rgba(255,255,255,0.08); overflow: hidden;
}
.combo-fill {
  width: 0%; height: 100%; border-radius: 999px;
  background: var(--indigo); transition: width .1s ease-out, box-shadow .12s ease-out;
}

/* ── Combo-/Multiplikator-Feier ── */
.mult-pop {
  position: fixed; z-index: 7; pointer-events: none;
  top: 42%; left: 50%; transform: translate(-50%, -50%) scale(0.4);
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(2.6rem, 15vw, 5rem); color: var(--indigo);
  text-shadow: 0 0 28px currentColor; opacity: 0;
}
.mult-pop.show { animation: mult-pop .7s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes mult-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  25%  { opacity: 1; transform: translate(-50%, -50%) scale(1.18); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1.0); }
}
@media (prefers-reduced-motion: reduce) {
  .hud-value.punch, .hud-mult.punch, .mult-pop.show { animation: none; }
}

/* ── Screens ── */
.screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(120% 90% at 50% 30%, rgba(79,70,229,0.30) 0%, rgba(5,4,22,0.86) 70%);
  backdrop-filter: blur(2px);
}
.card {
  width: 100%; max-width: 360px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
.logo {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(2.8rem, 16vw, 4.4rem); line-height: 0.9; letter-spacing: -0.02em;
  text-shadow: 0 0 34px rgba(99,102,241,0.5);
}
.logo span {
  display: inline-grid; place-items: center; width: 0.95em; height: 0.95em;
  margin-left: 0.14em; border-radius: 0.24em; transform: rotate(6deg);
  background: linear-gradient(160deg, var(--indigo), var(--pink)); color: #0a0414;
  box-shadow: 0 0 24px rgba(99,102,241,0.6);
}
.tagline { color: var(--text); font-size: 1.1rem; font-weight: 700; }
.how { color: var(--muted); font-size: 0.9rem; font-weight: 600; line-height: 1.4; }

/* Big Play button (Deflect-style pill), tinted in the game's own accent */
.play-btn {
  width: 100%; max-width: 300px; margin-top: 0.5rem;
  padding: 1.2rem 1.5rem; border: none; border-radius: 999px;
  font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; letter-spacing: 0.02em;
  cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,0.3);
  background: linear-gradient(160deg, var(--indigo), #8b5cf6); color: #f4f2ff;
}
.play-btn:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,0.3); }

.tap-hint {
  margin-top: 0.6rem; color: var(--text); font-weight: 700; font-size: 1.05rem;
  opacity: 0.85; animation: blink 1.3s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:0.35} 50%{opacity:0.95} }

.go-title { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; color: var(--indigo); }
.go-score { font-family: var(--font-head); font-weight: 700; font-size: clamp(3.4rem, 22vw, 5rem); line-height: 1; }
.go-score.newbest { color: #39ff88; text-shadow: 0 0 26px rgba(57,255,136,0.6); }
.go-best { color: var(--muted); font-size: 1.05rem; }
.go-best strong { color: #fff; }
.go-taunt { color: var(--gold); font-size: 1rem; font-weight: 700; min-height: 1.2em; }
.share-btn {
  margin-top: 0.4rem; padding: 0.8rem 1.6rem; border: none; border-radius: 999px;
  background: linear-gradient(160deg, var(--indigo), #8b5cf6); color: #f4f2ff;
  font-family: var(--font); font-weight: 900; font-size: 1.05rem; cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.3);
}
.share-btn:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,0.3); }
@media (prefers-reduced-motion: reduce) { .tap-hint { animation: none; } }

/* ── 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(--indigo); color: #0a0620;
  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; }
