:root {
  --bg-deep: #06040f;
  --bg-panel: rgba(10, 8, 28, 0.82);
  --neon-cyan: #4df3ff;
  --neon-magenta: #ff4de1;
  --neon-purple: #9b6bff;
  --neon-gold: #ffd166;
  --text-light: #f2f3ff;
  --text-dim: #9a96c4;
  --danger: #ff5470;
  --success: #57ffb0;
  --radius-lg: 22px;
  --radius-md: 14px;
  --font-display: 'Orbitron', 'Space Grotesk', sans-serif;
  --font-ui: 'Space Grotesk', 'Inter', sans-serif;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(155, 107, 255, 0.28), transparent 60%),
    radial-gradient(ellipse 90% 50% at 80% 110%, rgba(77, 243, 255, 0.16), transparent 60%),
    linear-gradient(180deg, #0a0620 0%, #06040f 55%, #050310 100%);
}

#app { display: flex; flex-direction: column; align-items: center; min-height: 100vh; padding: 10px 10px 32px; }

.site-header { width: 100%; max-width: 900px; text-align: center; padding: 6px 0 2px; }
.site-header__brand {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.35em;
  color: var(--text-dim);
}

.game-shell { width: 100%; max-width: 900px; display: flex; flex-direction: column; align-items: center; }

.game-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(22px, 5vw, 34px);
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  margin: 6px 0 10px;
  text-shadow: 0 0 30px rgba(155, 107, 255, 0.35);
}

/* ---------- Ad slots ---------- */
.ad-slot {
  width: 100%;
  max-width: 900px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.22);
  font-size: 11px;
  letter-spacing: 0.08em;
  margin: 6px 0;
}
.ad-slot__label { text-transform: uppercase; }

/* ---------- HUD ---------- */
.hud { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; position: relative; }
.hud-stat { display: flex; flex-direction: column; min-width: 74px; }
.hud-stat--right { align-items: flex-end; }
.hud-stat__label { font-size: 10px; letter-spacing: 0.18em; color: var(--text-dim); }
.hud-stat__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--text-light);
  text-shadow: 0 0 12px rgba(77, 243, 255, 0.45);
}

.top-controls {
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(6, 4, 16, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, background 0.15s ease;
}
.icon-btn:hover { background: rgba(20, 14, 40, 0.8); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.active { color: var(--neon-cyan); border-color: rgba(77, 243, 255, 0.5); }
.icon-btn.muted { opacity: 0.5; }

/* ---------- Canvas ---------- */
.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #050310;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(77, 243, 255, 0.08);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#gameCanvas { width: 100%; height: 100%; display: block; touch-action: none; }

.tap-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: pulseHint 1.6s ease-in-out infinite;
}
@keyframes pulseHint { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }

.combo-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translate(-50%, 0);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 28px;
  color: var(--neon-gold);
  text-shadow: 0 0 20px rgba(255, 209, 102, 0.7);
  pointer-events: none;
  opacity: 0;
}
.combo-banner.show { animation: comboPop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; }
@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
  25% { opacity: 1; transform: translate(-50%, -6px) scale(1.12); }
  70% { opacity: 1; transform: translate(-50%, -6px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(1); }
}

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 2, 12, 0.55);
  backdrop-filter: blur(6px);
  padding: 16px;
}
.overlay__panel {
  width: 100%;
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.overlay--ready { background: linear-gradient(180deg, rgba(9, 6, 24, 0.55), rgba(5, 3, 16, 0.85)); }
.brand-glow {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 8vw, 44px);
  letter-spacing: 0.06em;
  color: var(--text-light);
  text-shadow: 0 0 18px var(--neon-cyan), 0 0 40px rgba(255, 77, 225, 0.5);
}
.overlay__tag { color: var(--text-dim); font-size: 13px; letter-spacing: 0.05em; }
.overlay__hint { color: var(--text-dim); font-size: 11px; margin-top: 6px; }

.overlay--countdown { background: rgba(4, 2, 12, 0.35); backdrop-filter: blur(2px); }
.countdown-number {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 96px;
  color: var(--neon-cyan);
  text-shadow: 0 0 40px rgba(77, 243, 255, 0.8);
  animation: countPop 1s ease-out;
}
@keyframes countPop { 0% { transform: scale(1.6); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { opacity: 0.2; } }

.overlay--gameover .overlay__panel { max-width: 460px; }
.gameover-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 0.08em;
  color: var(--danger);
  text-shadow: 0 0 22px rgba(255, 84, 112, 0.6);
}
.gameover-stats { display: flex; gap: 14px; width: 100%; justify-content: center; }
.stat-block {
  flex: 1;
  max-width: 130px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-block__label { font-size: 10px; letter-spacing: 0.16em; color: var(--text-dim); }
.stat-block__value { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--text-light); }

.new-best-badge {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  color: var(--neon-gold);
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.4);
  padding: 6px 14px;
  border-radius: 999px;
  animation: glowPulse 1.4s ease-in-out infinite;
}
@keyframes glowPulse { 0%, 100% { box-shadow: 0 0 4px rgba(255, 209, 102, 0.3); } 50% { box-shadow: 0 0 18px rgba(255, 209, 102, 0.65); } }

.unlock-banner {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  color: var(--neon-cyan);
  background: rgba(77, 243, 255, 0.08);
  border: 1px solid rgba(77, 243, 255, 0.35);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  line-height: 1.4;
}

.submit-block { width: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.submit-block__label { font-size: 12px; color: var(--text-dim); }
.nickname-input {
  width: 100%;
  max-width: 260px;
  text-align: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.05em;
  outline: none;
}
.nickname-input:focus { border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(77, 243, 255, 0.2); }
.nickname-hint { font-size: 11px; color: var(--text-dim); min-height: 14px; }
.submit-status { font-size: 12px; min-height: 16px; color: var(--text-dim); }
.submit-status.error { color: var(--danger); }
.submit-status.ok { color: var(--success); }

.gameover-actions { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }

.overlay--pause .overlay__panel h2 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.1em;
  color: var(--text-light);
}

/* Screen shake host */
.canvas-wrap.shake { animation: shakeAnim 0.32s ease; }
@keyframes shakeAnim {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, 2px); }
  80% { transform: translate(3px, -2px); }
  100% { transform: translate(0, 0); }
}
.canvas-wrap.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  animation: flashAnim 0.28s ease-out;
}
@keyframes flashAnim { 0% { opacity: 0.55; } 100% { opacity: 0; } }

.seo-content {
  width: 100%;
  max-width: 900px;
  margin-top: 22px;
  padding: 0 8px 20px;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.65;
}
.seo-content h2 {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--text-light);
  margin: 18px 0 6px;
}
.seo-content h2:first-child { margin-top: 0; }
