/* ==== OutRun Retro — UI Synthwave ==== */
:root {
  --neon-pink: #ff2bd6;
  --neon-cyan: #19e6ff;
  --neon-purple: #7b2bff;
  --neon-yellow: #ffe21c;
  --hud-bg: rgba(10, 4, 28, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05010f;
  font-family: 'Press Start 2P', monospace;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  /* dimensionado via JS preservando 16:9 (letterbox) */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #05010f;
}

/* ==== HUD ==== */
#hud {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 18px;
  pointer-events: none;
  z-index: 5;
}
.hud-block { text-align: center; }
.hud-left  { text-align: left; }
.hud-right { text-align: right; }

.hud-label {
  font-size: 10px;
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.hud-value {
  font-size: 16px;
  color: #ffffff;
  text-shadow: 0 0 8px var(--neon-pink);
}
.hud-time {
  font-size: 26px;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 226, 28, 0.8);
}
.hud-time.low { color: #ff3030; text-shadow: 0 0 12px #ff3030; }
.hud-hi { margin-top: 6px; color: var(--neon-pink); text-shadow: 0 0 6px var(--neon-pink); }
.hud-speed {
  font-size: 22px;
  color: #ffffff;
  text-shadow: 0 0 8px var(--neon-cyan);
}
.hud-kmh { font-size: 10px; color: var(--neon-pink); }
#hud-gear { margin-top: 6px; color: #2ee05a; text-shadow: 0 0 6px #2ee05a; }

/* ==== Rádio ==== */
#radio {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 96px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--hud-bg);
  border: 1px solid var(--neon-purple);
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(123, 43, 255, 0.45);
  font-size: 9px;
  color: #fff;
  z-index: 6;
  cursor: pointer;
  max-width: 46vw;
  white-space: nowrap;
  overflow: hidden;
}
#radio-station { color: var(--neon-cyan); text-shadow: 0 0 6px var(--neon-cyan); }
#radio-track { color: #ffffffcc; overflow: hidden; text-overflow: ellipsis; }
.radio-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: 0 0 8px var(--neon-pink);
  animation: pulse 1.2s infinite;
  flex: none;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ==== Mensagens ==== */
.game-msg {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 28px;
  color: var(--neon-yellow);
  text-shadow: 0 0 14px var(--neon-yellow), 0 0 30px var(--neon-pink);
  z-index: 7;
  pointer-events: none;
  line-height: 1.8;
}
.game-msg span { font-size: 12px; color: var(--neon-cyan); text-shadow: 0 0 8px var(--neon-cyan); }
.hidden { display: none !important; }

/* ==== Controles touch ==== */
#touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}
.tc-group {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  gap: 14px;
  pointer-events: none;
}
.tc-left  { left:  max(16px, env(safe-area-inset-left)); }
.tc-right { right: max(16px, env(safe-area-inset-right)); }

.tc-btn {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--neon-cyan);
  background: rgba(25, 230, 255, 0.08);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 20px;
  text-shadow: 0 0 8px var(--neon-cyan);
  box-shadow: 0 0 12px rgba(25, 230, 255, 0.35), inset 0 0 12px rgba(25, 230, 255, 0.15);
  outline: none;
}
.tc-btn:active, .tc-btn.pressed {
  background: rgba(25, 230, 255, 0.3);
  transform: scale(0.94);
}
.tc-accel {
  width: 86px; height: 86px;
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  background: rgba(255, 43, 214, 0.08);
  text-shadow: 0 0 8px var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 43, 214, 0.4), inset 0 0 12px rgba(255, 43, 214, 0.15);
}
.tc-accel:active, .tc-accel.pressed { background: rgba(255, 43, 214, 0.3); }
.tc-brake {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  background: rgba(255, 226, 28, 0.08);
  text-shadow: 0 0 8px var(--neon-yellow);
  box-shadow: 0 0 12px rgba(255, 226, 28, 0.35), inset 0 0 12px rgba(255, 226, 28, 0.12);
}
.tc-brake:active, .tc-brake.pressed { background: rgba(255, 226, 28, 0.28); }

/* ==== Overlays ==== */
.brand-url {
  font-size: 11px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  letter-spacing: 3px;
  margin-top: 18px;
}

#overlay-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 22;
  pointer-events: none;
}
#countdown-num {
  font-size: 110px;
  color: var(--neon-yellow);
  text-shadow: 0 0 30px var(--neon-yellow), 0 0 70px var(--neon-pink);
}

.overlay-panel {
  position: absolute;
  inset: 0;
  background: rgba(5, 1, 15, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 24;
  text-align: center;
  padding: 16px;
}
.panel-title {
  font-size: 24px;
  color: var(--neon-pink);
  text-shadow: 0 0 14px var(--neon-pink);
  line-height: 1.5;
}
.panel-sub {
  font-size: 12px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  letter-spacing: 2px;
}
.panel-score {
  font-size: 14px;
  color: #ffffff;
}
.panel-score span { color: var(--neon-yellow); text-shadow: 0 0 8px var(--neon-yellow); }
.panel-btn {
  font-family: inherit;
  font-size: 14px;
  color: var(--neon-yellow);
  background: rgba(255, 226, 28, 0.08);
  border: 2px solid var(--neon-yellow);
  border-radius: 10px;
  padding: 14px 26px;
  margin-top: 8px;
  text-shadow: 0 0 8px var(--neon-yellow);
  box-shadow: 0 0 14px rgba(255, 226, 28, 0.35);
  cursor: pointer;
}
.panel-btn:active { transform: scale(0.95); }
.celebration-img {
  max-width: 56%;
  max-height: 38vh;
  border: 2px solid var(--neon-purple);
  border-radius: 10px;
  box-shadow: 0 0 18px rgba(123, 43, 255, 0.5);
}
.credits { margin-top: 6px; line-height: 2.2; }
.credits-line { font-size: 11px; color: #ffffffaa; letter-spacing: 2px; }
.credits-name {
  font-size: 20px;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan);
  letter-spacing: 4px;
}

.initials-row { display: flex; gap: 26px; margin: 10px 0; }
.initial-slot { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.init-letter {
  font-size: 44px;
  color: var(--neon-yellow);
  text-shadow: 0 0 14px var(--neon-yellow);
  min-width: 56px;
}
.init-btn {
  font-family: inherit;
  font-size: 18px;
  color: var(--neon-cyan);
  background: rgba(25, 230, 255, 0.08);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  width: 56px;
  height: 44px;
  cursor: pointer;
}
.init-btn:active { transform: scale(0.93); }

#ranklist-scroll {
  height: 46vh;
  overflow: hidden;
  width: min(420px, 80vw);
  border: 1px solid var(--neon-purple);
  border-radius: 10px;
  background: rgba(10, 4, 28, 0.6);
  padding: 10px 0;
}
#ranklist { list-style: none; }
#ranklist li {
  font-size: 13px;
  color: #ffffff;
  padding: 6px 22px;
  display: flex;
  justify-content: space-between;
}
#ranklist li .rk-pos { color: var(--neon-pink); min-width: 52px; text-align: left; }
#ranklist li .rk-name { color: var(--neon-cyan); }
#ranklist li .rk-score { color: var(--neon-yellow); }
#ranklist li.rk-me { background: rgba(255, 43, 214, 0.18); }

#overlay-start {
  position: absolute;
  inset: 0;
  background:
    url('../assets/sprites/title_hero.jpg?v=8') center / cover no-repeat,
    radial-gradient(ellipse at center, #1a0a3e 0%, #05010f 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 20;
  cursor: pointer;
  overflow: hidden;
}
#title-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
#title-video.hidden { display: none; }
.title-hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 1, 15, 0.85) 0%, rgba(5, 1, 15, 0.25) 32%, transparent 58%);
  z-index: 1;
  pointer-events: none;
}
.title-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-bottom: 30px;
}
.title-neon {
  font-size: 46px;
  color: #ffffff;
  text-shadow:
    0 0 6px var(--neon-pink),
    0 0 22px var(--neon-pink),
    0 0 60px var(--neon-purple),
    0 3px 0 rgba(0, 0, 0, 0.55);
  letter-spacing: 8px;
}
.title-neon span {
  display: block;
  text-align: center;
  font-size: 20px;
  margin-top: 10px;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px var(--neon-cyan), 0 0 36px var(--neon-cyan), 0 2px 0 rgba(0, 0, 0, 0.55);
  letter-spacing: 14px;
}
.difficulty-row {
  display: flex;
  gap: 14px;
}
.diff-btn {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 10px 16px;
  background: rgba(5, 1, 15, 0.55);
  color: #9aa;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  cursor: pointer;
}
.diff-btn.selected {
  color: var(--neon-yellow);
  border-color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-yellow);
  box-shadow: 0 0 14px rgba(255, 226, 28, 0.45), inset 0 0 10px rgba(255, 226, 28, 0.12);
}
.press-start {
  font-size: 12px;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px var(--neon-yellow);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

#overlay-rotate {
  position: absolute;
  inset: 0;
  background: #05010f;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 18px;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
  line-height: 2;
  z-index: 30;
}
#overlay-rotate span { font-size: 10px; color: var(--neon-pink); }
@media (orientation: portrait) {
  #overlay-rotate { display: flex; }
}
