:root {
  --cyan: #05D9E8;
  --magenta: #FF3CAC;
  --yellow: #FFE14D;
  --bg: #160726;
  --text: #f3eaff;
  --muted: #a98fd0;
  --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-mult {
  font-size: 2.1rem; font-weight: 900; font-family: var(--font-head);
  color: var(--cyan); text-shadow: 0 0 18px currentColor;
}
.hud-lives { display: flex; gap: 5px; margin-top: 4px; }
.hud-lives .life {
  width: 13px; height: 13px; border-radius: 50%;
  /* Leben = Tropfen weißen Lichts (das, was das Prisma bricht) */
  background: var(--text); box-shadow: 0 0 10px rgba(243,234,255,0.9);
}
.hud-lives .life.lost { background: #3a2450; box-shadow: none; }

/* Score „puncht" bei Zuwachs */
.hud-value.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.2rem); 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(--cyan); transition: width .12s ease-out, box-shadow .12s ease-out, background .15s linear;
}

/* ── Multiplikator-Feier ── */
.mult-pop {
  position: fixed; z-index: 7; pointer-events: none;
  top: 38%; left: 50%; transform: translate(-50%, -50%) scale(0.4);
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(3rem, 18vw, 6rem); color: var(--cyan);
  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, .mult-pop.show { animation: none; }
}

/* ── Pads ── */
#pads {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  height: 50%; display: flex;
}
.pad {
  flex: 1; position: relative; border: none; background: transparent;
  cursor: pointer; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(env(safe-area-inset-bottom) + 1.4rem);
}
.pad-pill {
  display: grid; place-items: center;
  width: min(26vw, 120px); height: min(11vh, 76px);
  border-radius: 18px;
  /* Hintergrund + Glow werden pro Run inline gesetzt (RGB, dynamisch) */
  transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
  filter: saturate(0.85) brightness(0.78);
  box-shadow: 0 6px 0 rgba(0,0,0,0.35);
}
.pad:active .pad-pill { transform: translateY(3px) scale(0.96); }
/* aktiver Schild = volle Leuchtkraft (Glow-Farbe kommt inline) */
.pad.active .pad-pill { filter: none; transform: translateY(-2px) scale(1.06); }

/* ── 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(40,12,70,0.4) 0%, rgba(10,4,20,0.82) 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 30px rgba(5,217,232,0.4);
}
.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(--magenta), var(--yellow)); color: #1a0414;
  box-shadow: 0 0 24px rgba(255,60,172,0.6);
}
.tagline { color: var(--muted); font-size: 1.02rem; font-weight: 600; }

/* Modus-Wahl (2-Color / 3-Color) */
.mode-toggle { display: flex; gap: 0.6rem; margin: 0.3rem 0 0.1rem; }
.mode-btn {
  padding: 0.5rem 1.1rem; border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 999px; background: transparent; color: var(--muted);
  font-family: var(--font); font-weight: 800; font-size: 0.95rem;
  letter-spacing: 0.05em; cursor: pointer; transition: all .15s ease;
}
.mode-btn.sel {
  color: #0a0414; background: var(--text); border-color: var(--text);
  box-shadow: 0 0 18px rgba(243,234,255,0.35);
}

/* Farb-Chips (zeigen die Farben des gewählten Modus, ohne Form/Label) */
.legend { display: flex; gap: 0.7rem; margin: 0.2rem 0; justify-content: center; }
.chip { width: 0.85rem; height: 0.85rem; border-radius: 50%; }

/* Daily-Challenge-Button (Daily-Seed) */
.daily-btn {
  margin-top: 0.4rem; padding: 0.55rem 1.3rem; border: none; border-radius: 999px;
  background: rgba(255,255,255,0.07); color: var(--text);
  font-family: var(--font); font-weight: 800; font-size: 0.98rem;
  letter-spacing: 0.04em; cursor: pointer; transition: background .15s ease;
}
.daily-btn:active { transform: translateY(1px); }
.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(--magenta); }
.go-score { font-family: var(--font-head); font-weight: 700; font-size: clamp(3.4rem, 22vw, 5rem); line-height: 1; }
.go-best { color: var(--muted); font-size: 1.05rem; }
.go-best strong { color: #fff; }
.share-btn {
  margin-top: 0.5rem; padding: 0.8rem 1.6rem; border: none; border-radius: 999px;
  background: linear-gradient(160deg, var(--cyan), #3aa7ff); color: #062028;
  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; } }
