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

:root {
  --bg:           #080012;
  --purple:       #7700dd;
  --purple-light: #aa44ff;
  --pink:         #ff006e;
  --pink-light:   #ff69b4;
  --yellow:       #ffdd00;
  --text:         #f0e6ff;
  --font:         'Press Start 2P', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#wrap {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Scanlines ─────────────────────────────────────────── */
#scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
  z-index: 100;
}

/* ── HUD ───────────────────────────────────────────────── */
#hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: clamp(6px, 1.2vw, 10px);
  letter-spacing: 0.04em;
}

#hud-title {
  display: flex;
  gap: 0.6em;
  align-items: center;
}

.hud-artist {
  color: var(--pink-light);
  text-shadow: 0 0 10px var(--pink);
}

.hud-dash { color: var(--purple-light); }

.hud-track {
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 221, 0, 0.6);
}

#hud-score {
  display: flex;
  gap: 0.5em;
  color: var(--purple-light);
  text-shadow: 0 0 8px var(--purple);
}

#vol-btn {
  background: none;
  border: 1px solid var(--purple-light);
  color: var(--purple-light);
  font-family: var(--font);
  font-size: clamp(5px, 1vw, 7px);
  padding: 0.4em 0.7em;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px var(--purple);
  transition: border-color 0.15s, color 0.15s;
}

#vol-btn:hover {
  border-color: var(--pink-light);
  color: var(--pink-light);
}

#vol-btn.muted {
  color: rgba(170, 68, 255, 0.4);
  border-color: rgba(170, 68, 255, 0.3);
  text-shadow: none;
}

#score {
  color: var(--text);
  min-width: 4ch;
  text-align: right;
  transition: color 0.1s;
}

#hud-score.score-flash {
  animation: scoreFlash 0.6s ease-out forwards;
}

@keyframes scoreFlash {
  0%   { text-shadow: 0 0 18px #fff, 0 0 36px var(--yellow); color: var(--yellow); }
  60%  { text-shadow: 0 0 10px var(--purple); color: var(--text); }
  100% { text-shadow: 0 0 8px var(--purple); }
}

/* ── Canvas ────────────────────────────────────────────── */
#canvas-wrap {
  position: relative;
  width: 100%;
}

#c {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 380;
  image-rendering: pixelated;
  cursor: pointer;
}

/* ── Overlays common ───────────────────────────────────── */
#overlay,
#dead {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#overlay { background: rgba(8, 0, 18, 0.88); }
#dead    { background: rgba(8, 0, 18, 0.92); }

.hidden { display: none !important; }

/* ── Intro overlay ─────────────────────────────────────── */
#overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 20px;
}

#cover {
  width: clamp(110px, 28vw, 200px);
  height: clamp(110px, 28vw, 200px);
  object-fit: cover;
  border: 2px solid var(--purple-light);
  animation: coverPulse 2.5s ease-in-out infinite;
}

@keyframes coverPulse {
  0%, 100% { box-shadow: 0 0 30px var(--purple), 0 0 60px rgba(119, 0, 221, 0.3); }
  50%       { box-shadow: 0 0 50px var(--pink),   0 0 80px rgba(255, 0, 110, 0.3); }
}

#intro-title {
  font-size: clamp(14px, 3.8vw, 28px);
  color: var(--yellow);
  text-shadow: 0 0 20px var(--yellow), 0 0 40px rgba(255, 221, 0, 0.5);
  letter-spacing: 0.1em;
  animation: flicker 4s ease-in-out infinite;
}

@keyframes flicker {
  0%, 88%, 100% { opacity: 1; }
  90% { opacity: 0.55; }
  92% { opacity: 1; }
  94% { opacity: 0.35; }
  96% { opacity: 1; }
}

#intro-sub {
  font-size: clamp(6px, 1.4vw, 9px);
  color: var(--pink-light);
  text-shadow: 0 0 10px var(--pink);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

#intro-hints {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.hint-line {
  font-size: clamp(5px, 1.1vw, 8px);
  color: var(--purple-light);
  opacity: 0.75;
  letter-spacing: 0.05em;
}

/* ── Warning overlay ───────────────────────────────────── */
#warning {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 0, 18, 0.96);
  z-index: 20;
}

#warning-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  max-width: 480px;
  border: 1px solid rgba(255, 0, 110, 0.3);
}

#warn-epilepsy {
  font-size: clamp(14px, 3.5vw, 24px);
  color: var(--pink);
  text-shadow: 0 0 20px var(--pink), 0 0 40px rgba(255, 0, 110, 0.4);
  letter-spacing: 0.12em;
}

.warn-text {
  font-size: clamp(7px, 1.5vw, 11px);
  color: var(--text);
  line-height: 2.2;
  opacity: 0.85;
}

.warn-rule {
  width: 60%;
  height: 1px;
  background: rgba(170, 68, 255, 0.3);
}

#warn-ok {
  font-size: clamp(6px, 1.3vw, 9px);
  color: var(--purple-light);
  animation: blink 1s step-end infinite;
  margin-top: 4px;
}

/* ── Dead overlay ──────────────────────────────────────── */
#dead-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
  padding: 20px;
}

#dead-title {
  font-size: clamp(8px, 1.8vw, 13px);
  line-height: 1.7;
  color: var(--pink);
  opacity: 0.6;
  text-shadow: none;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px) rotate(-1deg); }
  40%       { transform: translateX(8px)  rotate(1deg); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

#dead-score {
  font-size: clamp(7px, 1.6vw, 12px);
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 221, 0, 0.7);
}

#dead-best {
  font-size: clamp(5px, 1.1vw, 8px);
  color: var(--purple-light);
  opacity: 0.7;
}

#dead-cta {
  display: inline-block;
  font-family: var(--font);
  font-size: clamp(10px, 2.4vw, 18px);
  color: #fff;
  background: var(--pink);
  text-decoration: none;
  padding: 0.75em 1.4em;
  letter-spacing: 0.06em;
  box-shadow: 0 0 24px var(--pink), 0 0 50px rgba(255, 0, 110, 0.45);
  transition: box-shadow 0.15s;
}

#dead-cta:hover {
  box-shadow: 0 0 36px var(--pink), 0 0 70px rgba(255, 0, 110, 0.65);
}

#dead-dl {
  font-family: var(--font);
  font-size: clamp(5px, 1vw, 7px);
  color: rgba(170, 68, 255, 0.55);
  text-decoration: none;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(170, 68, 255, 0.25);
}

#dead-dl:hover {
  color: var(--purple-light);
  border-color: var(--purple-light);
}

#dead-restart {
  font-size: clamp(5px, 1.2vw, 8px);
  color: var(--purple-light);
  animation: blink 1s step-end infinite;
}
