:root {
  --orange: #f5a65b;
  --orange-bright: #ffb86b;
  --blue: #5a86c8;
  --blue-bright: #7aa6e8;
  --red: #e27377;
  --red-bright: #ff8b8f;
  --dark: #3a4a6b;
  --dark-bright: #5a6a8b;
  --cyan: #4fc9e8;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: #000;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -ms-touch-action: manipulation;
  overscroll-behavior: none;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#game, #game * {
  touch-action: manipulation;
}

/* ----- 3D lane perspective ----- */
.perspective-\[600px\] { perspective: 600px; }
.preserve-3d { transform-style: preserve-3d; }
.rotate-x-\[55deg\] { transform: rotateX(55deg); }

/* ----- Buttons ----- */
.pad {
  position: relative;
  background: linear-gradient(160deg, var(--pad-color-light), var(--pad-color-dark));
  box-shadow:
    0 6px 0 var(--pad-color-shadow),
    0 10px 20px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}
.pad::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 12px;
  background: radial-gradient(ellipse at top, rgba(255, 255, 255, 0.3), transparent 60%);
  pointer-events: none;
}
.pad-orange {
  --pad-color-light: #ffc98a;
  --pad-color-dark: #e27a1f;
  --pad-color-shadow: #8b3e0a;
}
.pad-blue {
  --pad-color-light: #8db5f2;
  --pad-color-dark: #3a5a96;
  --pad-color-shadow: #1a2a56;
}
.pad-red {
  --pad-color-light: #ff9da0;
  --pad-color-dark: #c24b50;
  --pad-color-shadow: #6e1d20;
}
.pad-dark {
  --pad-color-light: #5a6a8b;
  --pad-color-dark: #1f2a44;
  --pad-color-shadow: #0a0f1e;
}
.pad.pressed {
  transform: translateY(4px) scale(0.96);
  box-shadow:
    0 2px 0 var(--pad-color-shadow),
    0 4px 10px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.5),
    0 0 25px var(--pad-color-light);
}
.pad.hit-glow {
  animation: pad-hit 0.35s ease-out;
}
@keyframes pad-hit {
  0% { box-shadow: 0 6px 0 var(--pad-color-shadow), 0 10px 20px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.4), 0 0 40px var(--pad-color-light); }
  100% { box-shadow: 0 6px 0 var(--pad-color-shadow), 0 10px 20px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.4), 0 0 0px var(--pad-color-light); }
}

/* ----- Notes (music note ikony) ----- */
.note {
  position: absolute;
  width: 22%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
  pointer-events: none;
  filter: drop-shadow(0 0 8px currentColor);
}
.note svg { width: 100%; height: 100%; }
.note-0 { color: var(--orange-bright); left: 2%; }
.note-1 { color: var(--blue-bright); left: 26%; }
.note-2 { color: var(--red-bright); left: 50%; }
.note-3 { color: var(--dark-bright); left: 74%; }

.note-hit {
  animation: note-burst 0.35s ease-out forwards;
}
@keyframes note-burst {
  0% { transform: scale(1) translateY(0); opacity: 1; filter: drop-shadow(0 0 14px currentColor); }
  40% { transform: scale(1.6) translateY(-6px); opacity: 0.9; filter: drop-shadow(0 0 28px currentColor); }
  100% { transform: scale(2.2) translateY(-18px); opacity: 0; filter: drop-shadow(0 0 40px currentColor); }
}
.note-miss {
  animation: note-miss 0.3s ease-out forwards;
}
@keyframes note-miss {
  0% { opacity: 0.8; filter: grayscale(0); }
  100% { opacity: 0; filter: grayscale(1) blur(4px); transform: scale(0.6); }
}

/* ----- Hit flash (particle burst at button row) ----- */
.flash-burst {
  position: absolute;
  pointer-events: none;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: flash-burst 0.5s ease-out forwards;
}
@keyframes flash-burst {
  0% {
    box-shadow: 0 0 0 0 var(--flash-color), 0 0 0 0 var(--flash-color);
    opacity: 1;
  }
  100% {
    box-shadow: 0 0 40px 20px transparent, 0 0 0 80px transparent;
    opacity: 0;
  }
}

/* ----- Timer + score pulse ----- */
#score.score-bump {
  animation: score-bump 0.25s ease-out;
}
@keyframes score-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); color: #fff4b8; }
  100% { transform: scale(1); }
}
#combo.combo-bump {
  animation: combo-bump 0.25s ease-out;
}
@keyframes combo-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ----- Remix device float anim ----- */
#remix-device.active {
  opacity: 1;
  scale: 1;
  animation: remix-float 2.4s ease-in-out infinite;
}
@keyframes remix-float {
  0%, 100% { transform: translate(-50%, 0) rotate(-2deg); }
  50% { transform: translate(-50%, -12px) rotate(2deg); }
}
.device-halo {
  animation: halo-pulse 1.8s ease-in-out infinite;
  transform-origin: 70px 100px;
}
@keyframes halo-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ----- GREAT REMIX text ----- */
.great-remix-text {
  font-size: 60px;
  font-weight: 900;
  line-height: 0.95;
  text-align: center;
  color: #ff9a44;
  -webkit-text-stroke: 4px #fff;
  paint-order: stroke fill;
  text-shadow:
    0 0 30px #ff9a44,
    0 0 60px #ff6a14,
    4px 4px 0 #8b3e0a;
  letter-spacing: -2px;
  transform: rotate(-6deg);
}
#great-remix.show {
  animation: great-pop 1.6s ease-out forwards;
}
@keyframes great-pop {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0) rotate(-20deg); }
  25% { opacity: 1; transform: translate(-50%, -10px) scale(1.25) rotate(5deg); }
  45% { transform: translate(-50%, -5px) scale(0.95) rotate(-3deg); }
  60% { transform: translate(-50%, -8px) scale(1.05) rotate(2deg); }
  75% { transform: translate(-50%, -8px) scale(1) rotate(-1deg); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(1.1) rotate(0deg); }
}

/* ----- Remix mode overall effect ----- */
#game.remix-mode #lane { filter: saturate(1.4) brightness(1.1); }
#game.remix-mode #bg { animation: bg-shake 0.8s ease-in-out infinite; }
@keyframes bg-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* ----- Stage lamps flicker ----- */
.lamp {
  filter: drop-shadow(0 0 8px #ffe89a);
  animation: lamp-pulse 2.8s ease-in-out infinite;
  transform-origin: center;
}
.lamp-1 { animation-delay: 0s; }
.lamp-2 { animation-delay: 0.3s; }
.lamp-3 { animation-delay: 0.6s; }
.lamp-4 { animation-delay: 0.9s; }
.lamp-5 { animation-delay: 1.2s; }
@keyframes lamp-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* ----- Light beams sweep ----- */
.light-beam {
  transform-origin: 180px 100px;
  animation: beam-sweep 5s ease-in-out infinite;
}
.light-beam-1 { animation-delay: 0s; }
.light-beam-2 { animation-delay: 1.6s; }
.light-beam-3 { animation-delay: 3.3s; }
@keyframes beam-sweep {
  0%, 100% { transform: rotate(-6deg); opacity: 0.55; }
  50% { transform: rotate(6deg); opacity: 0.85; }
}

/* ----- Crowd bob ----- */
.crowd-heads, .crowd-arms {
  animation: crowd-bob 0.9s ease-in-out infinite;
  transform-origin: center bottom;
}
@keyframes crowd-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* ----- Ambient star twinkle ----- */
.ambient-dots circle {
  animation: twinkle 3s ease-in-out infinite;
}
.ambient-dots circle:nth-child(2n) { animation-delay: 1s; }
.ambient-dots circle:nth-child(3n) { animation-delay: 2s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ----- Score popup floater ----- */
.score-popup {
  position: absolute;
  pointer-events: none;
  font-weight: 900;
  font-family: 'Orbitron', monospace;
  color: #fff4b8;
  text-shadow: 0 0 10px #fff, 0 0 20px #ffd97a, 2px 2px 0 #8b3e0a;
  animation: score-float 0.9s ease-out forwards;
  font-size: 22px;
  transform: translate(-50%, 0);
}
.score-popup.double { color: #ffb86b; font-size: 28px; }
@keyframes score-float {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(0.9); }
}

/* ----- Shake screen on miss ----- */
#game.shake { animation: game-shake 0.2s ease-out; }
@keyframes game-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ----- Start / Over screens ----- */
#over-screen.visible { display: flex; }
#cheat-screen.visible { display: flex; animation: cheat-in 0.35s ease-out; }
@keyframes cheat-in {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
.cheat-shield {
  animation: shield-bump 0.5s ease-out, shield-pulse 1.6s ease-in-out 0.5s infinite;
}
@keyframes shield-bump {
  0% { transform: scale(0) rotate(-45deg); }
  60% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes shield-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px #ff3b3b); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 30px #ff6a6a); }
}
.cheat-halo {
  transform-origin: center;
  animation: cheat-halo-pulse 1.4s ease-in-out infinite;
}
@keyframes cheat-halo-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.3); }
}

/* ----- Leaderboard row ----- */
.lb-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(20, 30, 50, 0.6);
  border-left: 2px solid var(--cyan);
  border-radius: 4px;
  color: #e6f5ff;
}
.lb-row .rank { color: #4fc9e8; font-weight: 700; width: 22px; }
.lb-row .name { flex: 1; }
.lb-row .pts { font-family: 'Orbitron', monospace; font-weight: 700; color: #fff4b8; }
.lb-row.me { background: rgba(50, 100, 140, 0.7); border-left-color: #ffd97a; }
