/* ============================================================
   HIDDEN RACER — easter egg overlay + unlock UX
   ============================================================ */

/* --- scene car unlock --- */

.car-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pixel-cars .car {
  pointer-events: auto;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s ease;
}

.pixel-cars .car:focus {
  outline: none;
}

.pixel-cars .car:focus-visible {
  filter:
    brightness(1.15)
    drop-shadow(0 0 12px rgba(1, 205, 254, 0.9));
}

.pixel-cars .car.unlocking {
  filter:
    brightness(1.2)
    drop-shadow(0 0 16px rgba(255, 43, 214, 0.7));
}

.car-right.unlocking {
  filter:
    brightness(1.2)
    drop-shadow(0 0 16px rgba(1, 205, 254, 0.8)) !important;
}

@keyframes carTapPulse {
  0%   { transform: scale(1) translateY(0); }
  35%  { transform: scale(1.08) translateY(-4px); }
  100% { transform: scale(1) translateY(0); }
}

.pixel-cars .car.car-tap {
  animation: carTapPulse 0.35s ease-out;
}

.car-progress {
  display: block;
  margin-top: 6px;
  font-family: "VT323", monospace;
  font-size: clamp(16px, 2.8vmin, 22px);
  letter-spacing: 0.2em;
  color: #ff71ce;
  text-shadow: 0 0 8px rgba(255, 43, 214, 0.8);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  min-height: 1.2em;
}

.car-slot:last-child .car-progress {
  color: #7de8ff;
  text-shadow: 0 0 8px rgba(1, 205, 254, 0.8);
}

.car-progress.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- game overlay --- */

.racer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #030008;
  touch-action: none;
}

.racer.hidden {
  display: none;
}

#racer-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.racer-hud {
  position: absolute;
  top: 12px;
  left: 0;
  right: 88px;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  font-family: "VT323", monospace;
  font-size: clamp(18px, 3.5vmin, 28px);
  letter-spacing: 0.08em;
  color: #ff71ce;
  text-shadow: 0 0 8px rgba(255, 43, 214, 0.8);
  pointer-events: none;
  z-index: 3;
}

.racer-hud .score {
  color: #01cdfe;
  text-shadow: 0 0 8px rgba(1, 205, 254, 0.8);
}

#racer-mute,
#racer-exit {
  position: absolute;
  top: 12px;
  padding: 4px 10px;
  font-family: "VT323", monospace;
  font-size: 16px;
  letter-spacing: 0.1em;
  color: #01cdfe;
  background: rgba(14, 2, 36, 0.85);
  border: 1px solid rgba(1, 205, 254, 0.5);
  cursor: pointer;
  z-index: 6;
}

#racer-mute {
  right: 72px;
  min-width: 36px;
}

#racer-exit {
  right: 16px;
}

#racer-mute:hover,
#racer-exit:hover {
  background: rgba(255, 43, 214, 0.2);
  border-color: #ff2bd6;
  color: #ff71ce;
}

.racer-intro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: clamp(20px, 5vmin, 42px);
  letter-spacing: 0.14em;
  color: #ffd0f0;
  text-shadow:
    0 0 12px rgba(255, 43, 214, 0.9),
    0 0 32px rgba(255, 43, 214, 0.5);
  pointer-events: none;
  z-index: 5;
  animation: introFlash 2.4s ease-out forwards;
}

.racer-intro.hidden {
  display: none;
}

@keyframes introFlash {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04); }
}

.racer-touch {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38%;
  z-index: 2;
}

#racer-touch-left { left: 0; }
#racer-touch-right { right: 0; }

.racer-over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(3, 0, 8, 0.82);
  text-align: center;
  padding: 24px;
  z-index: 4;
}

.racer-over.hidden {
  display: none;
}

.racer-over p {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: clamp(16px, 4vmin, 28px);
  color: #ffd0f0;
  text-shadow: 0 0 12px rgba(255, 43, 214, 0.8);
  line-height: 1.5;
}

#racer-retry,
#racer-back {
  font-family: "VT323", monospace;
  font-size: clamp(18px, 3.5vmin, 24px);
  letter-spacing: 0.12em;
  padding: 8px 20px;
  color: #01cdfe;
  background: rgba(14, 2, 36, 0.9);
  border: 2px solid #ff2bd6;
  cursor: pointer;
}

#racer-retry:hover,
#racer-back:hover {
  color: #ff71ce;
  box-shadow: 0 0 16px rgba(255, 43, 214, 0.5);
}

.racer-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}

@media (max-width: 560px) {
  .racer-hud { padding: 0 12px; top: 8px; right: 76px; }
  #racer-mute { top: 8px; right: 58px; }
  #racer-exit { top: 8px; right: 10px; }
  .car-progress { font-size: 14px; letter-spacing: 0.15em; }
}

@media (prefers-reduced-motion: reduce) {
  .pixel-cars .car.car-tap { animation: none; }
  .racer-intro { animation: none; opacity: 1; }
}
