:root {
  --bg: #050510;
  --neon: #00ffcc;
  --neon2: #ff00aa;
  --panel: rgba(8, 12, 28, 0.92);
  --text: #e8f7ff;
  --muted: rgba(200, 230, 255, 0.65);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Orbitron", system-ui, sans-serif;
}

#github-link {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 30;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 255, 204, 0.2);
  border-radius: 50%;
  background: rgba(5, 10, 20, 0.7);
  color: rgba(200, 220, 255, 0.55);
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: all 0.2s ease;
}

#github-link:hover {
  color: var(--neon);
  border-color: rgba(0, 255, 204, 0.5);
  background: rgba(10, 25, 40, 0.85);
  box-shadow: 0 0 12px rgba(0, 255, 204, 0.2);
}

#audio-controls {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 30;
  display: flex;
  gap: 6px;
}

#audio-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(0, 255, 204, 0.25);
  border-radius: 5px;
  background: rgba(5, 10, 20, 0.7);
  color: var(--neon);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
  padding: 0;
  line-height: 1;
}

#audio-controls button:hover {
  background: rgba(10, 25, 40, 0.85);
  border-color: rgba(0, 255, 204, 0.5);
}

#audio-controls button.muted {
  color: rgba(0, 255, 204, 0.2);
  border-color: rgba(0, 255, 204, 0.08);
}

#game-root {
  position: relative;
  width: 100%;
  height: 100%;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
}

#screen-flash {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 40, 80, 0);
  transition: background 0.08s linear;
  z-index: 3;
}

#screen-flash.flash-hit {
  background: rgba(255, 40, 80, 0.35);
}

#game-root.shake {
  animation: shake 0.22s ease-out;
}

@keyframes shake {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-6px, 2px);
  }
  40% {
    transform: translate(5px, -2px);
  }
  60% {
    transform: translate(-4px, 1px);
  }
  80% {
    transform: translate(3px, -1px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(0, 255, 204, 0.35);
}

.hud-info-toggle {
  display: none;
}

.hud-close-btn {
  display: none;
}

.hud-resume-btn {
  display: none;
}

.hud-left {
  position: absolute;
  top: 1rem;
  left: 1rem;
  line-height: 1.45;
  max-width: min(220px, 42vw);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: rgba(5, 8, 18, 0.65);
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.hud-stats {
  line-height: 1.5;
}

.hud-stat-block {
  margin-bottom: 0.15rem;
}

.hud-health-row {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

#hud-health {
  font-size: 1.7rem;
  font-weight: 900;
  transition: color 0.2s;
}

.hud-health-row.danger {
  color: #ff2222;
  animation: health-flash 0.5s ease-in-out infinite;
}

.hud-health-row.danger #hud-health {
  color: #ff2222;
}

@keyframes health-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hud-stat-hint {
  margin: 0.2rem 0 0.35rem;
  padding: 0;
  font-size: 0.55rem;
  line-height: 1.35;
  letter-spacing: 0.03em;
  color: rgba(180, 210, 235, 0.75);
  font-weight: 500;
  max-width: 14rem;
}

.hud-flow-progress {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
}

.hud-flow-progress span {
  color: #fff;
  font-weight: 700;
}

.flow-pips {
  display: flex;
  gap: 3px;
}

.flow-pip {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 255, 204, 0.3);
  background: rgba(0, 255, 204, 0.08);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.flow-pip.filled {
  background: var(--neon);
  border-color: var(--neon);
  box-shadow: 0 0 6px rgba(0, 255, 204, 0.5);
}

.flow-pip.all-filled {
  background: #66ffcc;
  border-color: #66ffcc;
  box-shadow: 0 0 10px rgba(100, 255, 200, 0.7);
  animation: pip-glow 0.6s ease-in-out infinite alternate;
}

@keyframes pip-glow {
  from { box-shadow: 0 0 6px rgba(100, 255, 200, 0.5); }
  to { box-shadow: 0 0 14px rgba(100, 255, 200, 0.9); }
}

.hud-pickup-counter {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.72rem;
}

.hud-pickup-counter span:first-of-type {
  color: #fff;
  font-weight: 700;
}

.hud-pickup-pts {
  font-size: 0.6rem;
  color: var(--neon);
  font-weight: 400;
  opacity: 0.8;
}

.hud-legend {
  padding: 0.5rem 0.55rem;
  border: 1px solid rgba(0, 255, 204, 0.25);
  border-radius: 6px;
  background: rgba(4, 8, 20, 0.72);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: rgba(220, 235, 255, 0.88);
}

.legend-title {
  font-family: "Press Start 2P", monospace;
  font-size: 0.45rem;
  color: var(--neon);
  margin-bottom: 0.45rem;
  letter-spacing: 0.12em;
}

.legend-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.legend-row:last-child {
  margin-bottom: 0;
}

.swatch {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-top: 0.1rem;
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.swatch-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.35));
}

.swatch-outage {
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px, transparent 3px,
      #666 3px, #666 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px, transparent 6px,
      #666 6px, #666 7px
    ),
    linear-gradient(180deg, #b33319, #8b2010);
  background-size: 100% 100%;
}

.swatch-rival {
  background: linear-gradient(135deg, #ff4422 40%, #ffaa00 100%);
  clip-path: polygon(10% 30%, 0% 70%, 20% 100%, 80% 100%, 100% 70%, 90% 30%, 70% 0%, 30% 0%);
  box-shadow: 0 0 6px rgba(255, 100, 0, 0.5);
}

.swatch-shield {
  background: #9944ff;
  box-shadow: 0 0 8px rgba(180, 100, 255, 0.4);
  border-radius: 2px 2px 2px 2px;
  clip-path: polygon(50% 0%, 100% 15%, 100% 55%, 50% 100%, 0% 55%, 0% 15%);
  width: 15px;
  height: 17px;
}

.swatch-boost {
  background: linear-gradient(135deg, #ffdd00, #ffaa00);
  border-radius: 50%;
  width: 14px;
  height: 14px;
}

.legend-divider {
  border-top: 1px solid rgba(0, 255, 204, 0.15);
  margin: 0.35rem 0;
}

.swatch-flow {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  background: none;
  box-shadow: none;
  border-radius: 0;
}

.legend-flow-row span:last-child {
  font-size: 0.56rem;
  line-height: 1.4;
  color: var(--muted);
}

.recovery-countdown {
  font-family: "Orbitron", sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--neon);
  text-shadow: 0 0 18px rgba(0, 255, 204, 0.6);
  margin: 0.2rem 0 0.5rem;
  transition: color 0.2s, text-shadow 0.2s;
}

.recovery-countdown.urgent {
  color: #ff4444;
  text-shadow: 0 0 20px rgba(255, 60, 60, 0.8);
  animation: countdown-pulse 0.5s ease-in-out infinite;
}

@keyframes countdown-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.recovery-countdown.hidden {
  display: none;
}

#recovery-no.auto-selected {
  background: rgba(255, 60, 60, 0.35);
  border-color: #ff4444;
  color: #ff6666;
  animation: no-blink 0.28s ease-in-out 3;
}

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

.recovery-first-tip {
  text-align: left;
  max-width: 440px;
  margin: 0 auto 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: rgba(0, 40, 50, 0.45);
  border: 1px solid rgba(0, 255, 204, 0.2);
}

.recovery-first-tip.hidden {
  display: none;
}

.recovery-tip-title {
  font-size: 0.72rem;
  color: #ffee88;
  margin: 0 0 0.5rem;
}

.recovery-tip-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--muted);
}

.recovery-tip-list li {
  margin-bottom: 0.45rem;
}

.recovery-tip-list li:last-child {
  margin-bottom: 0;
}

.hud-right {
  position: absolute;
  top: 3.2rem;
  right: 1rem;
  text-align: right;
  line-height: 1.5;
  background: rgba(5, 8, 18, 0.65);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.hud-right .active {
  color: var(--neon);
}

#hud-shield.active {
  color: #cc88ff;
}

#hud-flow.active {
  color: #66ffcc;
  animation: pulse 1.2s ease-in-out infinite;
}

.hud-remediations {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  font-size: 0.78rem;
}

.rem-label {
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.rem-icons {
  display: flex;
  gap: 0.2rem;
}

.rem-pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.85rem;
  line-height: 1;
  transition: all 0.3s ease;
}

.rem-pip.available {
  background: rgba(0, 255, 140, 0.2);
  border: 1.5px solid rgba(0, 255, 140, 0.6);
  color: #00ff8c;
  text-shadow: 0 0 6px rgba(0, 255, 140, 0.5);
}

.rem-pip.spent {
  background: rgba(255, 50, 50, 0.15);
  border: 1.5px solid rgba(255, 50, 50, 0.35);
  color: rgba(255, 60, 60, 0.5);
  text-decoration: line-through;
  opacity: 0.5;
}

.hud-manual-boost {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.hud-manual-boost.ready .mb-label {
  color: #ffcc00;
  font-weight: 700;
}

.hud-manual-boost.active .mb-label {
  color: #ff8800;
  font-weight: 700;
}

.mb-bar {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  margin-top: 3px;
  overflow: hidden;
}

.mb-fill {
  height: 100%;
  border-radius: 3px;
  background: #ffcc00;
  transform-origin: left;
  transition: transform 0.15s linear;
}

.hud-manual-boost.cooldown .mb-fill {
  background: #888;
}

.hud-manual-boost.active .mb-fill {
  background: #ff8800;
}

.hud-manual-boost.ready .mb-fill {
  background: #ffcc00;
}

.brake-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  border: 4px solid rgba(255, 60, 60, 0.5);
  box-shadow: inset 0 0 60px rgba(255, 60, 60, 0.15);
  opacity: 0;
  transition: opacity 0.2s;
}

.brake-vignette.active {
  opacity: 1;
}

/* Attract mode score flash */
.attract-scores {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.85);
  backdrop-filter: blur(6px);
  animation: attract-fade-in 0.6s ease-out;
  cursor: pointer;
}

.attract-scores.hidden {
  display: none;
}

@keyframes attract-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.attract-scores-title {
  font-family: var(--font-head);
  font-size: 2.4rem;
  color: var(--neon);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.2rem;
  text-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
}

.attract-scores-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(90vw, 400px);
  max-height: 55vh;
  overflow-y: auto;
}

.attract-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: #ccc;
  animation: attract-row-slide 0.4s ease-out both;
}

.attract-score-row:nth-child(-n+3) {
  color: #ffcc00;
  font-weight: 700;
  background: rgba(255, 204, 0, 0.08);
}

.attract-score-row .rank {
  width: 2rem;
  color: var(--muted);
}

.attract-score-row .flag {
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.attract-score-row .name {
  flex: 1;
  text-align: left;
  margin-left: 0.5rem;
}

.attract-score-row .level {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.3);
  margin-right: 0.5rem;
  white-space: nowrap;
}

.attract-score-row .pts {
  text-align: right;
  font-weight: 600;
}

@keyframes attract-row-slide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.attract-insert {
  margin-top: 1.5rem;
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: #fff;
  animation: pulse 1.5s ease-in-out infinite;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@keyframes pulse {
  50% {
    opacity: 0.7;
  }
}

.finish-progress {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6rem;
  color: rgba(200, 220, 255, 0.7);
  pointer-events: none;
}

.finish-label {
  white-space: nowrap;
}

.finish-track {
  width: 200px;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}

.finish-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #00ffcc, #ffffff);
  border-radius: 4px;
  transition: transform 0.3s linear;
}

.finish-time {
  font-family: var(--font-head);
  font-size: 0.55rem;
  color: rgba(200, 220, 255, 0.5);
  min-width: 2.2rem;
}

.boost-bar {
  position: absolute;
  top: 6.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  color: var(--muted);
}

.boost-track {
  width: 120px;
  height: 8px;
  border: 1px solid rgba(0, 255, 204, 0.4);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}

#boost-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #00ffcc, #ffcc00);
}

.tt-cooldown-bar {
  position: absolute;
  top: 7.4rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6rem;
  color: #44ccff;
  text-shadow: 0 0 6px rgba(68, 204, 255, 0.5);
}
.tt-cooldown-bar.ready span {
  color: #44ccff;
  animation: tt-pulse 1.5s ease-in-out infinite;
}
@keyframes tt-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; text-shadow: 0 0 10px #44ccff; }
}
.tt-track {
  width: 120px;
  height: 8px;
  border: 1px solid rgba(68, 204, 255, 0.4);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}
#tt-cooldown-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #ff6600, #44ccff);
  transition: background 0.3s;
}
.tt-cooldown-bar.ready #tt-cooldown-fill {
  background: #44ccff;
}

.hud-status {
  position: absolute;
  bottom: 3.2rem;
  left: 50%;
  transform: translateX(-50%);
  min-height: 1.2rem;
  font-size: 0.75rem;
  color: var(--neon);
  text-align: center;
  text-shadow: 0 0 14px rgba(0, 255, 204, 0.5);
  white-space: nowrap;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 4;
  padding: 2rem;
  background: radial-gradient(
    ellipse at center,
    rgba(6, 10, 30, 0.75),
    rgba(2, 4, 12, 0.94)
  );
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.tutorial-overlay {
  z-index: 7;
}

.tutorial-panel {
  width: min(38rem, 94vw);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 0.5rem 0 0;
}

.tutorial-title {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.75rem, 2.2vw, 0.95rem);
  line-height: 1.45;
  margin: 0 0 0.75rem;
  color: #fff;
  text-shadow: 0 0 18px rgba(0, 255, 204, 0.4);
  text-align: center;
}

.tutorial-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.25rem 0.75rem 0;
  margin-right: -0.25rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text);
}

.tutorial-scroll::-webkit-scrollbar {
  width: 8px;
}
.tutorial-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 204, 0.25);
  border-radius: 4px;
}

.tutorial-section {
  margin-bottom: 1rem;
}

.tutorial-section:last-child {
  margin-bottom: 0.35rem;
}

.tutorial-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--neon);
  font-weight: 700;
}

.tutorial-section p {
  margin: 0;
  color: var(--muted);
}

.tutorial-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.tutorial-list li {
  margin-bottom: 0.35rem;
}

.tutorial-list li:last-child {
  margin-bottom: 0;
}

.tutorial-scroll kbd {
  display: inline-block;
  padding: 0.1em 0.35em;
  font-size: 0.72em;
  font-family: inherit;
  border: 1px solid rgba(0, 255, 204, 0.35);
  border-radius: 4px;
  background: rgba(0, 20, 40, 0.6);
  color: var(--neon);
}

.tutorial-spoiler {
  border-left: 3px solid rgba(255, 0, 170, 0.55);
  padding-left: 0.65rem;
}

.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  padding: 0.85rem 0 0.25rem;
  border-top: 1px solid rgba(0, 255, 204, 0.12);
  flex-shrink: 0;
}

.panel {
  text-align: center;
  max-width: 520px;
}

.panel.compact {
  max-width: 420px;
}

.eyebrow {
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  color: var(--neon2);
  letter-spacing: 0.2em;
  margin-bottom: 0.75rem;
}

.title {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  line-height: 1.5;
  margin: 0 0 0.75rem;
  color: #fff;
  text-shadow: 0 0 24px rgba(0, 255, 204, 0.45), 3px 3px 0 #111;
}

.tagline {
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.best-row {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  color: #ffd54a;
}

/* Summit booth link — fixed bottom center; body-level so it paints above #game-root overlays */
.summit-booth-dock {
  position: fixed;
  left: 50%;
  bottom: clamp(0.75rem, 3.5vh, 2rem);
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: min(92vw, 36rem);
  pointer-events: auto;
  text-align: center;
}

.summit-booth-dock.hidden {
  display: none;
}

.summit-booth-dock-lead {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.8rem, 2.2vw, 0.95rem);
  color: rgba(232, 247, 255, 0.88);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
}

.summit-booth-dock-btn {
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  line-height: 1.35;
  color: #fff;
  background: #ee0000;
  text-decoration: none;
  text-align: center;
  padding: 14px 22px;
  border-radius: 9px;
  border: 1px solid #c00;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.summit-booth-dock-btn:hover {
  background: #cc0000;
  color: #fff;
}

.summit-booth-dock-btn:focus-visible {
  outline: 2px solid #06c;
  outline-offset: 3px;
}

.help {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.7;
}

.btn {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.65rem 1.4rem;
  margin: 0.35rem;
  border: 2px solid rgba(0, 255, 204, 0.45);
  background: rgba(0, 40, 50, 0.65);
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 255, 204, 0.35);
}

.btn.primary {
  background: linear-gradient(180deg, #00c4aa, #007a6b);
  border-color: #66ffdd;
  color: #031016;
}

.btn.menu-focus {
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.5), inset 0 0 8px rgba(0, 255, 204, 0.15);
  transform: translateY(-1px) scale(1.03);
  border-color: #66ffdd;
}

.hint {
  margin-top: 1rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.5rem;
  margin: 1rem 0 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.stats-grid span {
  color: #fff;
  font-weight: 700;
}

/* Game Over / Leaderboard */
.go-entry {
  margin-bottom: 1rem;
}

.go-final-score {
  font-family: "Orbitron", sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--neon);
  text-shadow: 0 0 18px rgba(0, 255, 204, 0.5);
  margin: 0 0 0.5rem;
}

.go-final-score span {
  color: #fff;
}

.go-stats-row {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.go-stats-row span span {
  color: #fff;
  font-weight: 700;
}

.go-name-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.go-name-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.go-name-input {
  font-family: "Orbitron", sans-serif;
  font-size: 1rem;
  text-align: center;
  width: 10rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(0, 255, 204, 0.35);
  border-radius: 4px;
  background: rgba(0, 20, 30, 0.7);
  color: #fff;
  outline: none;
  letter-spacing: 0.1em;
}

.go-name-input:focus {
  border-color: var(--neon);
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.3);
}

.go-country {
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.35rem 0.3rem;
  border: 1px solid rgba(0, 255, 204, 0.35);
  border-radius: 4px;
  background: rgba(0, 20, 30, 0.7);
  color: #fff;
  outline: none;
  width: 3rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
}

.go-country option {
  font-size: 1.3rem;
  padding: 0.3rem;
  background: #0a0e18;
}

.go-country:focus {
  border-color: var(--neon);
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.3);
}

.lb-flag {
  font-size: 1.1em;
  line-height: 1;
}

.go-leaderboard {
  width: 100%;
  max-width: 480px;
  margin: 0 auto 1rem;
}

.go-leaderboard.hidden {
  display: none;
}

.lb-title {
  font-family: "Press Start 2P", monospace;
  font-size: 0.6rem;
  color: var(--neon);
  letter-spacing: 0.15em;
  margin: 0 0 0.5rem;
}

.lb-scroll {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid rgba(0, 255, 204, 0.2);
  border-radius: 4px;
  background: rgba(0, 10, 20, 0.5);
}

.lb-scroll::-webkit-scrollbar {
  width: 6px;
}

.lb-scroll::-webkit-scrollbar-track {
  background: rgba(0, 20, 30, 0.4);
}

.lb-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 204, 0.3);
  border-radius: 3px;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.72rem;
}

.lb-table thead th {
  position: sticky;
  top: 0;
  background: rgba(4, 8, 20, 0.95);
  color: var(--neon);
  font-family: "Press Start 2P", monospace;
  font-size: 0.5rem;
  padding: 0.45rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 255, 204, 0.2);
}

.lb-table thead th:nth-child(1) {
  width: 2rem;
  text-align: center;
}

.lb-table thead th:nth-child(2),
.lb-table tbody td.lb-flag {
  width: 1.6rem;
  text-align: center;
  padding-left: 0;
  padding-right: 0;
  font-size: 0.85rem;
}

.lb-table thead th:nth-child(3) {
  width: auto;
}

.lb-table thead th:nth-child(4) {
  width: 5.5rem;
}

.lb-table thead th:last-child {
  width: 4rem;
  text-align: right;
}

.lb-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lb-table tbody td {
  padding: 0.35rem 0.5rem;
  color: var(--muted);
}

.lb-table tbody td:first-child {
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
}

.lb-table tbody td.lb-level {
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-table tbody td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-table tbody td:last-child {
  text-align: right;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  color: #fff;
}

.lb-table tbody tr.lb-current {
  background: rgba(0, 255, 204, 0.12);
}

.lb-table tbody tr.lb-current td {
  color: var(--neon);
}

.lb-table tbody tr.lb-current td:last-child {
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 255, 204, 0.4);
}

.lb-hint {
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.25);
  margin: 0.3rem 0 0;
}

.rank-banner {
  font-family: "Press Start 2P", monospace;
  font-size: 0.7rem;
  text-align: center;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  line-height: 1.6;
}

.rank-banner.hidden {
  display: none;
}

.rank-banner.top50 {
  background: linear-gradient(135deg, rgba(0, 255, 204, 0.18), rgba(255, 215, 0, 0.12));
  border: 1px solid rgba(0, 255, 204, 0.4);
  color: var(--neon);
  animation: rankPulse 2s ease-in-out infinite;
}

.rank-banner.outside {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

@keyframes rankPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 255, 204, 0.2); }
  50% { box-shadow: 0 0 18px rgba(0, 255, 204, 0.45); }
}

.go-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.quiz {
  max-width: 640px;
}

.quiz h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 0.65rem;
  color: var(--neon);
  margin-bottom: 0.75rem;
}

#quiz-prompt {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 520px;
}

.quiz-opt {
  text-align: left;
  font-family: "Orbitron", sans-serif;
  font-size: 0.78rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(0, 255, 204, 0.35);
  background: rgba(0, 30, 40, 0.75);
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
}

.quiz-opt:hover {
  border-color: #66ffdd;
  box-shadow: 0 0 12px rgba(0, 255, 204, 0.25);
}

.quiz-explain {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.quiz-explain.hidden {
  display: none;
}

#quiz-overlay {
  overflow: hidden;
}

#quiz-question-panel {
  position: relative;
  z-index: 1;
}

.quiz-result-panel {
  position: relative;
  z-index: 2;
  max-width: 520px;
  padding: 0.5rem 0;
}

.quiz-result-burst {
  position: fixed;
  left: 50%;
  top: 45%;
  width: 40vmin;
  height: 40vmin;
  margin: -20vmin 0 0 -20vmin;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: scale(0.2);
}

.quiz-result-panel.is-correct .quiz-result-burst {
  background: radial-gradient(
    circle,
    rgba(0, 255, 140, 0.95) 0%,
    rgba(0, 200, 100, 0.45) 35%,
    transparent 70%
  );
  box-shadow: 0 0 80px 40px rgba(0, 255, 160, 0.5);
  animation: quiz-burst-pop 0.55s ease-out forwards;
}

.quiz-result-panel.is-wrong .quiz-result-burst {
  background: radial-gradient(
    circle,
    rgba(255, 80, 80, 0.75) 0%,
    rgba(180, 40, 40, 0.35) 40%,
    transparent 70%
  );
  animation: quiz-burst-wrong 0.45s ease-out forwards;
}

@keyframes quiz-burst-pop {
  0% {
    opacity: 0;
    transform: scale(0.15);
  }
  35% {
    opacity: 1;
    transform: scale(1.35);
  }
  100% {
    opacity: 0.85;
    transform: scale(2.8);
  }
}

@keyframes quiz-burst-wrong {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  100% {
    opacity: 0.55;
    transform: scale(1.8);
  }
}

.quiz-result-title {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1rem, 3.5vw, 1.35rem);
  line-height: 1.4;
  margin: 0 0 1rem;
  text-shadow: 0 0 24px currentColor;
  animation: quiz-title-pop 0.35s ease-out;
}

.quiz-result-panel.is-correct .quiz-result-title {
  color: #4fff9a;
}

.quiz-result-panel.is-wrong .quiz-result-title {
  color: #ff6b6b;
}

@keyframes quiz-title-pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.quiz-result-lines {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  text-align: left;
  font-size: 0.82rem;
  line-height: 1.65;
  color: rgba(230, 248, 255, 0.92);
}

.quiz-result-lines li {
  padding: 0.25rem 0 0.25rem 1.1rem;
  position: relative;
}

.quiz-result-lines li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--neon);
  opacity: 0.85;
}

.quiz-result-panel.is-wrong .quiz-result-lines li::before {
  color: #ff8888;
}

.correct-answer-reveal {
  color: #00e8a2;
  font-weight: 700;
  font-size: 1.05em;
  margin-top: 0.4em;
  padding: 0.35em 0.5em;
  border: 1px solid rgba(0, 232, 162, 0.35);
  border-radius: 6px;
  background: rgba(0, 232, 162, 0.08);
}

.quiz-result-explain {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.quiz-result-timer {
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.quiz-result-timer.hidden {
  display: none;
}

.quiz-result-timer #quiz-result-countdown {
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffcc00;
}

/* Touch-only pause button */
.touch-pause {
  display: none;
  position: absolute;
  top: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 38px;
  border: 1px solid rgba(0, 255, 204, 0.25);
  border-radius: 50%;
  background: rgba(5, 10, 20, 0.6);
  color: rgba(200, 220, 255, 0.7);
  font-size: 12px;
  letter-spacing: 2px;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  padding: 0;
  line-height: 1;
  z-index: 5;
}

.touch-pause:active {
  background: rgba(10, 25, 40, 0.85);
  border-color: rgba(0, 255, 204, 0.5);
}

.mobile-secret-btn {
  display: none;
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 200, 0, 0.2);
  border-radius: 50%;
  background: rgba(5, 10, 20, 0.4);
  color: rgba(255, 200, 0, 0.35);
  font-size: 11px;
  cursor: pointer;
  pointer-events: auto;
  z-index: 10;
}
.mobile-secret-btn:active {
  background: rgba(255, 200, 0, 0.15);
  color: rgba(255, 200, 0, 0.8);
}

@media (pointer: coarse) {
  .touch-pause {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-secret-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Debug panel (bottom-right) */
.debug-panel {
  position: absolute;
  bottom: 0.8rem;
  right: 0.8rem;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  pointer-events: auto;
}

.btn-debug-toggle {
  font-family: "Orbitron", sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 60, 60, 0.3);
  border-radius: 3px;
  background: rgba(20, 10, 10, 0.6);
  color: rgba(255, 80, 80, 0.5);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.btn-debug-toggle:hover { opacity: 1; }
.btn-debug-toggle.active {
  opacity: 1;
  border-color: rgba(255, 60, 60, 0.6);
  color: rgba(255, 80, 80, 0.9);
}

.debug-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.debug-btn {
  font-family: "Orbitron", sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255, 204, 0, 0.4);
  border-radius: 4px;
  background: rgba(5, 10, 20, 0.7);
  color: #ffcc00;
  cursor: pointer;
  backdrop-filter: blur(6px);
  opacity: 0.7;
  transition: opacity 0.15s, background 0.12s;
  white-space: nowrap;
}
.debug-btn:hover {
  opacity: 1;
  background: rgba(40, 50, 80, 0.85);
  border-color: rgba(0, 255, 204, 0.5);
  color: #fff;
}

/* Billboard demo overlay */
#billboard-overlay {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 5;
  cursor: default;
}

.billboard-panel {
  width: min(94vw, 1100px);
  height: min(88vh, 700px);
  background: #141820;
  border-radius: 14px;
  border: 2px solid #2a3550;
  box-shadow: 0 0 50px rgba(0, 120, 255, 0.08), inset 0 0 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.billboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: #1a2030;
  border-bottom: 1px solid #2a3550;
}

.billboard-label {
  font-family: "Press Start 2P", monospace;
  font-size: 0.65rem;
  color: var(--neon);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.billboard-close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.billboard-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.billboard-bonus {
  font-family: "Press Start 2P", monospace;
  font-size: 0.55rem;
  color: #00ff88;
  letter-spacing: 0.1em;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
  animation: billboard-bonus-pulse 1.5s ease-in-out infinite;
}
.billboard-bonus.hidden { display: none; }

@keyframes billboard-bonus-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.billboard-close:hover {
  background: rgba(255, 60, 60, 0.2);
  border-color: rgba(255, 60, 60, 0.4);
  color: #ff6666;
}

.billboard-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.billboard-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  color-scheme: light;
}

.billboard-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #141820;
  z-index: 1;
}
.billboard-loading p {
  font-family: "Press Start 2P", monospace;
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.billboard-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--neon);
  border-radius: 50%;
  animation: billboard-spin 0.8s linear infinite;
}

.billboard-placeholder {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.billboard-placeholder-logo {
  max-width: 180px;
  max-height: 80px;
  margin-bottom: 1.5rem;
  opacity: 0.85;
}

.billboard-placeholder-icon {
  font-size: 3rem;
  color: var(--neon);
  opacity: 0.4;
  margin-bottom: 1rem;
  animation: billboard-spin 8s linear infinite;
}

@keyframes billboard-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.billboard-placeholder h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 0.8rem;
  color: var(--neon);
  margin: 0 0 0.75rem;
  letter-spacing: 0.1em;
}

.billboard-placeholder p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.billboard-placeholder-hint {
  font-size: 0.7rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(200, 220, 255, 0.35);
}


/* --- Level select --- */
#level-select.panel {
  max-width: 740px;
  overflow-y: auto;
  max-height: 90vh;
}

.level-select-hint {
  font-size: 0.78rem;
  color: rgba(200, 220, 255, 0.5);
  margin-bottom: 1rem;
}

.level-cards {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 720px;
  margin: 0 auto;
}

.level-card {
  background: rgba(15, 20, 35, 0.85);
  border: 2px solid rgba(100, 140, 200, 0.25);
  border-radius: 10px;
  padding: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 160px;
}

.level-card:hover {
  border-color: rgba(0, 255, 204, 0.6);
  transform: translateY(-3px);
  box-shadow: 0 4px 20px rgba(0, 255, 204, 0.15);
}

.level-card.active {
  border-color: #00ffcc;
  box-shadow: 0 0 16px rgba(0, 255, 204, 0.35);
}

.level-preview {
  border-radius: 6px;
  display: block;
  width: 148px;
  height: 100px;
  background: #0a0e18;
}

.level-card-label {
  font-family: "Orbitron", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e0e8ff;
}

.level-card-sub {
  font-size: 0.72rem;
  color: rgba(200, 220, 255, 0.5);
  font-style: italic;
}

/* Current theme — top center, prominent during play */
.hud-theme-strip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  text-align: center;
  max-width: min(94vw, 620px);
  padding: 0 0.5rem;
  pointer-events: none;
}

.hud-theme-title {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(0.88rem, 3.8vw, 1.55rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #f0f8ff;
  text-shadow:
    0 0 20px rgba(0, 255, 204, 0.5),
    0 0 40px rgba(0, 255, 204, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.85);
  margin: 0;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid rgba(0, 255, 204, 0.45);
}

/* Quiz countdown */
.quiz-countdown {
  font-family: "Orbitron", sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: rgba(0, 255, 204, 0.85);
  text-align: center;
  margin: 0 0 0.3rem;
  transition: color 0.15s, transform 0.15s;
}

.quiz-countdown.urgent {
  color: #ff4444;
  animation: countdown-pulse 0.5s ease-in-out infinite;
}

@keyframes countdown-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.quiz-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.8rem;
}

.quiz-bottom-row .hint {
  margin: 0;
  flex: 1;
}

.btn-quiz-skip {
  font-size: 0.7rem !important;
  padding: 0.3rem 0.9rem !important;
  opacity: 0.65;
  white-space: nowrap;
}

.btn-quiz-skip:hover {
  opacity: 1;
}

/* Floating damage popup */
.damage-popup {
  position: fixed;
  top: 25%;
  left: 50%;
  transform: translate(-50%, 0);
  font-family: "Orbitron", sans-serif;
  font-size: 4rem;
  font-weight: 900;
  color: #ff2222;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.7), 0 0 40px rgba(255, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  z-index: 200;
  transition: none;
}

.damage-popup.show {
  animation: damage-float 1.4s ease-out forwards;
}

@keyframes damage-float {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.2);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -20px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -80px) scale(0.7);
  }
}

.pickup-popup {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, 0);
  font-family: "Orbitron", sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  color: #00ffcc;
  text-shadow: 0 0 16px rgba(0, 255, 204, 0.7), 0 0 32px rgba(0, 255, 204, 0.3);
  pointer-events: none;
  opacity: 0;
  z-index: 200;
  transition: none;
  white-space: nowrap;
}

.pickup-popup.show {
  animation: pickup-float 1.6s ease-out forwards;
}

@keyframes pickup-float {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.3);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -15px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70px) scale(0.6);
  }
}

/* Hippo mode announcement */
.hippo-announce {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: "Orbitron", sans-serif;
  font-size: 6rem;
  font-weight: 900;
  color: #ffdd00;
  text-shadow:
    0 0 20px rgba(255, 100, 0, 0.9),
    0 0 60px rgba(255, 60, 0, 0.6),
    0 0 120px rgba(255, 0, 0, 0.4),
    4px 4px 0 #663300;
  pointer-events: none;
  opacity: 0;
  z-index: 500;
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.1;
}

.hippo-announce.show {
  animation: hippo-smash 2.8s ease-out forwards;
}

@keyframes hippo-smash {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0) rotate(-10deg);
  }
  8% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(3.5) rotate(3deg);
  }
  15% {
    transform: translate(-50%, -50%) scale(1.0) rotate(-2deg);
  }
  20% {
    transform: translate(-50%, -50%) scale(1.3) rotate(1deg);
  }
  25% {
    transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
  }
  55% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
  }
  75% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1) rotate(-1deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.5) rotate(5deg);
  }
}

.hippo-announce.crush {
  animation: hippo-crush 3.8s ease-out forwards;
  font-size: 4.5rem;
  color: #ff4400;
  text-shadow:
    0 0 20px rgba(255, 200, 0, 0.9),
    0 0 50px rgba(255, 100, 0, 0.6),
    0 0 100px rgba(255, 0, 0, 0.4),
    3px 3px 0 #441100;
}

@keyframes hippo-crush {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0) rotate(-15deg);
  }
  6% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(2.8) rotate(5deg);
  }
  12% {
    transform: translate(-50%, -50%) scale(1.0) rotate(-3deg);
  }
  17% {
    transform: translate(-50%, -50%) scale(1.2) rotate(0deg);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.8) rotate(8deg);
  }
}

/* Combo display */
.combo-display {
  position: fixed;
  top: 18%;
  right: 2rem;
  font-family: var(--font-head);
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffcc00;
  text-shadow: 0 0 12px rgba(255, 204, 0, 0.8), 0 0 30px rgba(255, 140, 0, 0.4);
  pointer-events: none;
  z-index: 200;
  transition: transform 0.15s, opacity 0.3s;
}

.combo-display.active {
  opacity: 1;
  animation: combo-pulse 0.3s ease-out;
}

@keyframes combo-pulse {
  0% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* Achievement popup */
.achievement-popup {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 24, 0.92);
  border: 2px solid #ffcc00;
  border-radius: 10px;
  padding: 0.8rem 1.5rem;
  z-index: 300;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.achievement-popup.show {
  display: block;
  animation: ach-slide-up 0.5s ease-out, ach-fade-out 0.5s 3.5s ease-in forwards;
}

.achievement-popup .ach-title {
  font-family: var(--font-head);
  font-size: 0.75rem;
  color: #ffcc00;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
}

.achievement-popup .ach-name {
  font-family: var(--font-head);
  font-size: 1.2rem;
  color: #fff;
  font-weight: 700;
}

.achievement-popup .ach-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

@keyframes ach-slide-up {
  from { transform: translateX(-50%) translateY(30px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes ach-fade-out {
  to { opacity: 0; }
}

/* Quiz toggle in legend */
.quiz-toggle-row {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: auto;
}

.quiz-toggle-row input[type="checkbox"] {
  accent-color: var(--neon);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Achievements menu panel */
.menu-achievements {
  margin-top: 0.5rem;
}

.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  max-height: 40vh;
  overflow-y: auto;
  padding: 0.3rem;
}

.ach-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.5rem;
  text-align: left;
}

.ach-card.unlocked {
  border-color: rgba(255, 204, 0, 0.4);
  background: rgba(255, 204, 0, 0.06);
}

.ach-card .ach-card-name {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 700;
  color: #ccc;
}

.ach-card.unlocked .ach-card-name {
  color: #ffcc00;
}

.ach-card .ach-card-desc {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.ach-card.locked .ach-card-name {
  color: #555;
}

.ach-card.locked .ach-card-desc {
  color: #444;
}

/* --- Driver select --- */
#driver-select.panel {
  max-width: 1060px;
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.driver-select-title {
  font-family: var(--font-head);
  color: var(--neon);
  margin-bottom: 0.3rem;
}

.driver-select-hint {
  font-family: var(--font-head);
  font-size: 0.75rem;
  color: rgba(0, 255, 204, 0.5);
  letter-spacing: 0.1em;
  margin-bottom: 0.8rem;
}

.driver-cards {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  align-items: stretch;
}

.driver-card {
  position: relative;
  width: 140px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid rgba(0, 255, 204, 0.2);
  border-radius: 10px;
  background: rgba(0, 10, 20, 0.6);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-align: center;
}

.driver-card:hover {
  border-color: var(--neon);
  box-shadow: 0 0 18px rgba(0, 255, 204, 0.25);
  transform: translateY(-3px);
}

.driver-card.active {
  border-color: var(--neon);
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.35);
}

.driver-card-flag {
  font-size: 0.85rem;
}

.driver-card-photo {
  width: 85px;
  height: 85px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid rgba(0, 255, 204, 0.3);
  margin-bottom: 0.5rem;
}

.driver-card-name {
  font-family: var(--font-head);
  font-size: 0.7rem;
  color: #fff;
  margin: 0.3rem 0 0.15rem;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.driver-card-origin {
  font-size: 0.55rem;
  color: var(--muted);
  margin: 0;
}

.driver-card-tag {
  display: inline-block;
  margin-top: auto;
  padding-top: 0.4rem;
  font-size: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(0, 255, 204, 0.12);
  color: var(--neon);
  font-family: var(--font-mono);
}

/* Driver cards compact mode (when detail is shown) */
.driver-cards.compact {
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.driver-cards.compact .driver-card {
  width: auto;
  padding: 0.25rem;
  border-width: 1px;
}

.driver-cards.compact .driver-card-photo {
  width: 42px;
  height: 42px;
  margin-bottom: 0;
}

.driver-cards.compact .driver-card-name,
.driver-cards.compact .driver-card-origin,
.driver-cards.compact .driver-card-tag {
  display: none;
}

.driver-cards.compact .driver-card.active {
  border-color: var(--neon);
  box-shadow: 0 0 12px rgba(0, 255, 204, 0.35);
}

/* Driver detail (expanded view) */
.driver-detail {
  margin-top: 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.driver-detail.hidden {
  display: none;
}

.driver-detail-inner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-align: left;
  max-width: 740px;
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid rgba(0, 255, 204, 0.15);
  border-radius: 10px;
  background: rgba(0, 10, 20, 0.7);
}

.driver-car-preview {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  border-radius: 8px;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(0, 40, 60, 0.5) 0%, transparent 70%);
}

.driver-car-preview canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.driver-detail-photo {
  width: 140px;
  height: 170px;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  border: 2px solid rgba(0, 255, 204, 0.25);
  flex-shrink: 0;
}

.driver-detail-info {
  flex: 1;
  min-width: 0;
}

.driver-detail-name {
  font-family: var(--font-head);
  font-size: 0.9rem;
  color: var(--neon);
  margin: 0 0 0.2rem;
}

.driver-detail-origin {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 0.6rem;
  font-style: italic;
}

.driver-detail-bio {
  font-size: 0.6rem;
  line-height: 1.55;
  color: rgba(200, 220, 240, 0.85);
  margin: 0 0 0.8rem;
}

/* --- Level complete --- */
.lc-flags {
  font-size: 3rem;
  animation: lc-bounce 0.6s ease-in-out infinite alternate;
}
@keyframes lc-bounce {
  from { transform: scale(1); }
  to   { transform: scale(1.15) rotate(5deg); }
}
.lc-message {
  font-size: 0.72rem;
  color: rgba(200, 220, 255, 0.75);
  margin: 0.4rem 0 0.8rem;
  line-height: 1.5;
  max-width: 400px;
}

/* --- Mobile popup scaling --- */
@media (max-width: 768px), (pointer: coarse) {
  .hippo-announce {
    font-size: 2.2rem;
    letter-spacing: 0.08em;
  }
  .hippo-announce.show {
    animation: hippo-smash-mobile 2s ease-out forwards;
  }
  .hippo-announce.crush {
    font-size: 1.8rem;
    animation: hippo-crush-mobile 2.5s ease-out forwards;
  }
  @keyframes hippo-smash-mobile {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(0) rotate(-8deg); }
    10%  { opacity: 1; transform: translate(-50%, -50%) scale(1.6) rotate(2deg); }
    18%  { transform: translate(-50%, -50%) scale(1.0) rotate(-1deg); }
    25%  { transform: translate(-50%, -50%) scale(1.1) rotate(0deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.7) rotate(0deg); }
  }
  @keyframes hippo-crush-mobile {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(0) rotate(-10deg); }
    8%   { opacity: 1; transform: translate(-50%, -50%) scale(1.4) rotate(3deg); }
    15%  { transform: translate(-50%, -50%) scale(1.0) rotate(0deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(0deg); }
  }
  .damage-popup {
    font-size: 1.8rem;
  }
  .pickup-popup {
    font-size: 1.4rem;
  }
  .combo-display {
    font-size: 1.2rem;
    right: 0.8rem;
  }

  /* Mobile HUD: hide left panel, show info toggle */
  .hud-left {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: rgba(5, 8, 18, 0.92);
    padding: 3.5rem 1.5rem 2rem;
    z-index: 600;
    overflow-y: auto;
    backdrop-filter: blur(8px);
  }
  .hud-left.mobile-open {
    display: flex;
  }
  .hud-info-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(0, 230, 255, 0.5);
    background: rgba(5, 8, 18, 0.7);
    color: var(--neon);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    z-index: 100;
    backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
  }
  .hud-info-toggle:active {
    background: rgba(0, 230, 255, 0.2);
  }
  .hud-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(0, 230, 255, 0.7);
    background: rgba(0, 20, 40, 0.7);
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    z-index: 601;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 0 8px rgba(0, 230, 255, 0.4);
  }
  .hud-close-btn:active {
    background: rgba(0, 230, 255, 0.3);
  }
  .hud-resume-btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    border: 2px solid rgba(0, 230, 255, 0.6);
    border-radius: 8px;
    background: rgba(0, 230, 255, 0.15);
    color: #fff;
    font-family: "Press Start 2P", monospace;
    font-size: 0.75rem;
    text-align: center;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
  }
  .hud-resume-btn:active {
    background: rgba(0, 230, 255, 0.35);
  }

  /* Mobile driver select: scrollable compact grid */
  #driver-select.panel {
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 0.6rem;
  }
  .driver-select-title {
    font-size: 1rem;
    margin-bottom: 0.15rem;
  }
  .driver-select-hint {
    font-size: 0.6rem;
    margin-bottom: 0.5rem;
  }
  .driver-cards {
    gap: 0.5rem;
    justify-content: center;
  }
  .driver-card {
    width: 90px;
    padding: 0.4rem;
  }
  .driver-card-photo {
    width: 52px;
    height: 52px;
    margin-bottom: 0.25rem;
  }
  .driver-card-name {
    font-size: 0.55rem;
    margin: 0.15rem 0 0.1rem;
  }
  .driver-card-origin {
    font-size: 0.45rem;
  }
  .driver-card-tag {
    font-size: 0.4rem;
    padding: 0.1rem 0.35rem;
  }
  .driver-cards.compact .driver-card-photo {
    width: 36px;
    height: 36px;
  }
  .driver-detail {
    margin-top: 0.5rem;
  }
  .driver-detail-photo {
    width: 70px;
    height: 70px;
  }
  .driver-detail-name {
    font-size: 0.8rem;
  }
  .driver-detail-bio {
    font-size: 0.55rem;
  }
  #btn-select-driver,
  #btn-driver-back {
    font-size: 0.7rem;
    padding: 0.5rem 1.2rem;
  }
}

/* --- Godzilla Mode HUD --- */
.godzilla-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1rem 0.6rem;
  pointer-events: none;
  z-index: 500;
}
.gz-title {
  font-family: "Press Start 2P", monospace;
  font-size: 1.4rem;
  color: #44ff44;
  text-shadow: 0 0 12px rgba(0, 255, 0, 0.6), 2px 2px 0 #000;
  margin-bottom: 0.5rem;
  letter-spacing: 2px;
  animation: gzPulse 1.5s ease-in-out infinite;
}
@keyframes gzPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.gz-stats {
  display: flex;
  gap: 2rem;
}
.gz-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gz-label {
  font-family: "Orbitron", sans-serif;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.gz-value {
  font-family: "Press Start 2P", monospace;
  font-size: 1.6rem;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4), 2px 2px 0 #000;
}
.gz-hint {
  font-family: "Orbitron", sans-serif;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 0.4rem;
  letter-spacing: 1px;
}

/* Godzilla score overlay */
.gz-score-title {
  font-family: "Press Start 2P", monospace;
  font-size: 1.2rem;
  color: #44ff44;
  text-shadow: 0 0 12px rgba(0, 255, 0, 0.5);
  margin-bottom: 1.5rem;
}
.gz-score-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.gz-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Orbitron", sans-serif;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
}
.gz-score-row strong {
  font-size: 1.1rem;
  color: #fff;
  font-family: "Press Start 2P", monospace;
}

@media (max-width: 768px), (pointer: coarse) {
  .gz-title { font-size: 0.9rem; }
  .gz-stats { gap: 1rem; }
  .gz-value { font-size: 1rem; }
  .gz-label { font-size: 0.5rem; }
  .gz-hint { display: none; }
}

.hidden {
  display: none !important;
}
