/* ============================================================
   NEON RHYTHM — vibrant arcade aesthetic
   ============================================================ */

:root {
  /* Lane colors — neon palette */
  --lane-1: #ff2d6f;   /* hot pink/red */
  --lane-2: #36e25a;   /* neon green */
  --lane-3: #ffb629;   /* amber/gold */
  --lane-4: #29b6ff;   /* electric blue */
  --lane-5: #c44dff;   /* purple (5-lane mode) */

  /* Glow shadow helpers */
  --glow-1: 0 0 12px var(--lane-1), 0 0 28px var(--lane-1);
  --glow-2: 0 0 12px var(--lane-2), 0 0 28px var(--lane-2);
  --glow-3: 0 0 12px var(--lane-3), 0 0 28px var(--lane-3);
  --glow-4: 0 0 12px var(--lane-4), 0 0 28px var(--lane-4);
  --glow-5: 0 0 12px var(--lane-5), 0 0 28px var(--lane-5);

  /* Backgrounds */
  --bg-deep: #06030d;
  --bg-mid: #0f0820;
  --bg-purple: #1a0b3a;
  --track: rgba(8, 4, 18, 0.85);
  --track-line: rgba(255, 255, 255, 0.08);

  /* Feedback colors */
  --fb-perfect: #36e25a;
  --fb-great: #ffb629;
  --fb-good: #29b6ff;
  --fb-miss: #ff2d6f;

  /* Layout */
  --hit-zone-h: 110px;
  --note-h: 22px;
  --hud-pad: 16px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Heebo', 'Inter', system-ui, sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  direction: rtl;
}

#root { height: 100%; }

/* ============================================================
   STAGE — full viewport, dark background with subtle glow
   ============================================================ */

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(68, 28, 142, 0.55) 0%, transparent 60%),
    radial-gradient(ellipse 90% 50% at 50% 100%, rgba(190, 30, 110, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 100% 100% at 50% 50%, #1a0b3a 0%, #06030d 70%);
}

/* Ambient floor grid — perspective lines that pulse */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(transparent 0%, transparent calc(100% - 1px), rgba(122, 80, 220, 0.18) 100%),
    repeating-linear-gradient(90deg, transparent 0 60px, rgba(122, 80, 220, 0.08) 60px 61px);
  background-size: 100% 60px, 100% 100%;
  animation: gridscroll 4s linear infinite;
  pointer-events: none;
  opacity: 0.6;
}

@keyframes gridscroll {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 60px, 0 0; }
}

/* Vignette */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 100% 80% at 50% 50%, transparent 50%, rgba(0,0,0,0.55) 100%);
}

/* ============================================================
   HUD — top bar
   ============================================================ */

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: var(--hud-pad);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.hud-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.6), 0 0 24px rgba(120, 200, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

.hud-pct {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--lane-4);
  text-shadow: 0 0 10px var(--lane-4);
  font-variant-numeric: tabular-nums;
}

.hud-pause {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 10, 40, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.hud-pause:hover { background: rgba(40, 20, 80, 0.9); border-color: rgba(255,255,255,0.4); }
.hud-pause svg { width: 16px; height: 16px; }

/* Health bar */
.health-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.health-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.health-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lane-1), var(--lane-3), var(--lane-2));
  border-radius: 100px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px rgba(255, 100, 180, 0.6);
}

/* Time / song progress bar */
.time-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  margin-top: -2px;
}
.time-num {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}
.time-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
}
.time-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.1s linear;
}

/* ============================================================
   COMBO METER — center top, pulses
   ============================================================ */

.combo {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 25;
  pointer-events: none;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.combo-num {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(48px, calc(48px + var(--combo-scale, 0) * 1.5px), 120px);
  line-height: 0.9;
  background: linear-gradient(180deg, #ffffff 0%, #ffd9eb 50%, #ff6aa8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 80, 160, 0.8)) drop-shadow(0 0 24px rgba(255, 80, 160, 0.5));
  font-variant-numeric: tabular-nums;
  transition: font-size 0.2s ease;
}
.combo-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255, 200, 230, 0.85);
  text-shadow: 0 0 10px rgba(255, 100, 180, 0.6);
  margin-top: -4px;
}
.combo.pulse { animation: comboPulse 0.25s ease-out; }
@keyframes comboPulse {
  0% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.18); }
  100% { transform: translateX(-50%) scale(1); }
}
.combo.hidden { opacity: 0; }

/* ============================================================
   TRACK — the playfield
   ============================================================ */

.track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 480px);
  display: flex;
  direction: ltr;
  background:
    linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 12%, rgba(0,0,0,0.85) 100%);
  border-left: 2px solid rgba(122, 80, 220, 0.4);
  border-right: 2px solid rgba(122, 80, 220, 0.4);
  box-shadow:
    0 0 40px rgba(122, 80, 220, 0.3),
    inset 0 0 60px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

/* Top vanishing-point glow */
.track::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 30%;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.55) 0%, rgba(180, 100, 255, 0.35) 25%, transparent 70%);
  pointer-events: none;
}

/* ============================================================
   LANE
   ============================================================ */

.lane {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--track-line);
  overflow: hidden;
}
.lane:last-child { border-right: none; }

/* Lane glow when held */
.lane.active::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--lane-color, white) 100%);
  opacity: 0.18;
  pointer-events: none;
  animation: laneFlash 0.3s ease-out;
}
@keyframes laneFlash {
  0% { opacity: 0.4; }
  100% { opacity: 0; }
}

/* Lane streak when note travels — purely decorative */
.lane-streak {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, var(--lane-color) 80%, transparent 100%);
  opacity: 0.3;
  pointer-events: none;
}

/* ============================================================
   NOTES
   ============================================================ */

.note {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78%;
  max-width: 90px;
  aspect-ratio: 2.8 / 1;
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,255,255,0.95), var(--lane-color) 55%, color-mix(in oklab, var(--lane-color) 70%, black) 100%);
  box-shadow:
    0 0 14px var(--lane-color),
    0 0 32px var(--lane-color),
    inset 0 -6px 12px rgba(0, 0, 0, 0.4),
    inset 0 6px 12px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  will-change: top;
}
.note::before {
  /* Inner ring */
  content: "";
  position: absolute;
  inset: 18% 12%;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 8px rgba(255,255,255,0.5);
}

.note.hold {
  background: var(--lane-color);
  box-shadow: 0 0 14px var(--lane-color), 0 0 32px var(--lane-color);
}

/* ============================================================
   HIT ZONE — at bottom, where notes land
   ============================================================ */

.hit-zone {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--hit-zone-h);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.hit-zone-line {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8), 0 0 28px rgba(140, 100, 255, 0.6);
  animation: hitLinePulse 1.6s ease-in-out infinite;
}
@keyframes hitLinePulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; box-shadow: 0 0 18px rgba(255, 255, 255, 1), 0 0 40px rgba(140, 100, 255, 0.9); }
}

/* Pad receptors — circles at each lane's bottom */
.pads {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  display: flex;
  pointer-events: auto;
}
.pad {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  height: 80px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.pad-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--lane-color);
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.06), rgba(0,0,0,0.4) 70%);
  box-shadow:
    0 0 14px var(--lane-color),
    inset 0 0 12px color-mix(in oklab, var(--lane-color) 60%, transparent);
  position: relative;
  will-change: transform;
  transition: transform 40ms ease-out, box-shadow 40ms ease-out;
}
.pad-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--lane-color) 70%, white 30%);
  opacity: 0.7;
}
.pad.pressed .pad-ring {
  transform: scale(0.88);
  background: radial-gradient(circle at 50% 35%, color-mix(in oklab, var(--lane-color) 50%, white), var(--lane-color) 70%);
  box-shadow:
    0 0 24px var(--lane-color),
    0 0 48px var(--lane-color),
    inset 0 0 18px rgba(255,255,255,0.6);
}

/* ============================================================
   HIT BURSTS — particle explosion on successful tap
   ============================================================ */

.burst {
  position: absolute;
  left: 50%;
  bottom: calc(var(--hit-zone-h) - 50px);
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 20;
}
.burst .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--lane-color);
  box-shadow: 0 0 18px var(--lane-color), 0 0 36px var(--lane-color);
  animation: burstRing 0.55s ease-out forwards;
}
.burst .flash {
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: radial-gradient(circle, white 0%, var(--lane-color) 50%, transparent 80%);
  animation: burstFlash 0.4s ease-out forwards;
}
.burst .spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--lane-color);
  box-shadow: 0 0 8px var(--lane-color), 0 0 16px var(--lane-color);
  animation: sparkFly 0.6s ease-out forwards;
}

@keyframes burstRing {
  0%   { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes burstFlash {
  0%   { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes sparkFly {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ============================================================
   FLOATING FEEDBACK TEXT — Perfect/Great/Good/Miss
   ============================================================ */

.feedback {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(40px, 9vw, 72px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 28;
  animation: feedbackFloat 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  text-shadow:
    0 0 12px var(--fb-color),
    0 0 24px var(--fb-color),
    0 4px 0 rgba(0,0,0,0.4);
  -webkit-text-stroke: 2px rgba(0,0,0,0.35);
}
@keyframes feedbackFloat {
  0%   { transform: translate(-50%, -30%) scale(0.6); opacity: 0; }
  20%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  35%  { transform: translate(-50%, -55%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -90%) scale(0.95); opacity: 0; }
}

/* ============================================================
   TAP HINT — initial overlay
   ============================================================ */

.tap-hint {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(ellipse at center, rgba(15, 8, 32, 0.6) 0%, rgba(6, 3, 13, 0.85) 70%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  text-align: center;
  padding: 20px;
}
.tap-hint h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(40px, 12vw, 72px);
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fff, #ff6aa8 60%, #c44dff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(255, 80, 200, 0.7));
}
.tap-hint p {
  font-size: 14px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  animation: hintPulse 1.2s ease-in-out infinite;
}
.tap-hint .keys {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.45);
}
.tap-hint .keys kbd {
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: #fff;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ============================================================
   PAUSE OVERLAY
   ============================================================ */

.paused-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 3, 13, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  gap: 20px;
}
.paused-overlay h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 56px;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #fff;
  text-shadow: 0 0 20px rgba(255,80,160,0.7), 0 0 40px rgba(255,80,160,0.5);
}
.btn-resume {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  padding: 14px 36px;
  border: 2px solid var(--lane-2);
  border-radius: 100px;
  background: rgba(54, 226, 90, 0.1);
  cursor: pointer;
  box-shadow: 0 0 16px rgba(54, 226, 90, 0.5);
  transition: all 0.2s;
}
.btn-resume:hover { background: rgba(54, 226, 90, 0.25); transform: scale(1.05); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablets and larger phones — wider track */
@media (min-width: 600px) {
  :root { --hit-zone-h: 130px; }
  .track { width: min(70vw, 540px); }
  .pad-ring { width: 76px; height: 76px; }
}

@media (min-width: 900px) {
  .track { width: 600px; }
}

/* Short screens — tighter HUD */
@media (max-height: 700px) {
  .combo { top: 76px; }
  .combo-num { font-size: clamp(40px, calc(40px + var(--combo-scale, 0) * 1.2px), 96px) !important; }
}
