/* ============================================================
   LANE BLITZ – racer.css   (Synthwave Arcade Racer)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;900&display=swap');

:root {
  --font: 'Outfit', system-ui, sans-serif;
  --p1:   #ff2d78;
  --p2:   #00f0ff;
  --gold: #ffd060;
  --neon-purple: #b44fff;
  --neon-cyan:   #00f0ff;
  --neon-pink:   #ff2d78;
  --bg:   #0a0014;
}

body {
  font-family: var(--font);
  background: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#raceCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ── Overlays ── */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 0, 18, 0.88);
  backdrop-filter: blur(14px);
  z-index: 100;
}

/* ── Setup box ── */
.setup-box {
  position: relative;
  background: linear-gradient(160deg, #100030 0%, #050018 100%);
  border: 1px solid rgba(180, 80, 255, 0.3);
  border-radius: 28px;
  box-shadow:
    0 0 0 1px rgba(0,240,255,0.06),
    0 40px 100px rgba(0,0,0,0.9),
    0 0 80px rgba(100,0,200,0.2),
    inset 0 1px 0 rgba(255,255,255,0.06);
  padding: 36px 40px 38px;
  max-width: 640px;
  width: calc(100vw - 32px);
  text-align: center;
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

/* Animated neon border glow */
.setup-box::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 29px;
  background: linear-gradient(135deg, rgba(180,80,255,0.5), rgba(0,240,255,0.3), rgba(255,45,120,0.4));
  opacity: 0;
  z-index: -1;
  animation: borderPulse 3s ease-in-out infinite;
}

@keyframes borderPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.6; }
}

@keyframes popIn {
  from { transform: scale(0.88) translateY(20px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.setup-logo { font-size: 3.2rem; margin-bottom: 4px; filter: drop-shadow(0 0 16px rgba(255,120,0,0.8)); }

.setup-title {
  font-size: clamp(2.2rem,5vw,3.2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 0%, #00f0ff 40%, #b44fff 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(0,200,255,0.4));
}

.setup-sub {
  font-size: 0.82rem;
  color: rgba(150,200,255,0.45);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}

/* Neon divider */
.setup-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,240,255,0.4), rgba(180,80,255,0.4), transparent);
  margin: 16px 0;
}

/* Mode row */
.mode-row { margin-bottom: 18px; text-align: left; }
.mode-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(0,240,255,0.5);
  margin-bottom: 8px;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mode-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(0,240,255,0.12);
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 700;
  color: rgba(180,220,255,0.6);
  transition: all 0.18s;
  text-align: center;
}
.mode-opt input { display: none; }
.mode-opt small { font-size: 0.62rem; font-weight: 500; color: rgba(120,180,255,0.35); }
.mode-opt:hover {
  border-color: rgba(0,240,255,0.35);
  background: rgba(0,240,255,0.06);
  color: #fff;
  box-shadow: 0 0 16px rgba(0,240,255,0.15);
}
.mode-opt.selected {
  border-color: var(--neon-cyan);
  background: rgba(0,240,255,0.1);
  color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0,240,255,0.25), inset 0 0 12px rgba(0,240,255,0.06);
}

/* Difficulty row */
.difficulty-row { margin-bottom: 22px; text-align: left; }
.diff-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(0,240,255,0.5);
  margin-bottom: 8px;
}
.diff-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.diff-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(180,80,255,0.15);
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(180,200,255,0.6);
  transition: all 0.18s;
  text-align: center;
}
.diff-opt input { display: none; }
.diff-opt span { font-size: 0.9rem; font-weight: 800; }
.diff-opt small { font-size: 0.62rem; font-weight: 500; color: rgba(150,180,255,0.35); }
.diff-opt:hover { border-color: rgba(180,80,255,0.4); background: rgba(180,80,255,0.08); color:#fff; }
.diff-opt.selected {
  border-color: var(--gold);
  background: rgba(255,208,96,0.1);
  color: var(--gold);
  box-shadow: 0 0 20px rgba(255,200,60,0.25);
}

/* Controls display */
.controls-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 14px 20px;
}

.ctrl-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ctrl-badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.p1-badge {
  background: rgba(255,45,120,0.15);
  color: var(--p1);
  border: 1px solid rgba(255,45,120,0.5);
  box-shadow: 0 0 12px rgba(255,45,120,0.2);
}
.p2-badge {
  background: rgba(0,240,255,0.1);
  color: var(--p2);
  border: 1px solid rgba(0,240,255,0.4);
  box-shadow: 0 0 12px rgba(0,240,255,0.2);
}

.ctrl-keys-list {
  font-size: 0.78rem;
  color: rgba(160,200,255,0.55);
  font-weight: 600;
}

.k {
  display: inline-block;
  background: rgba(180,80,255,0.12);
  border: 1px solid rgba(180,80,255,0.35);
  border-radius: 5px;
  padding: 1px 7px;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.9em;
  color: #d0a0ff;
  margin: 0 1px;
  box-shadow: 0 0 6px rgba(180,80,255,0.2);
}

.ctrl-divider {
  font-size: 1rem;
  font-weight: 900;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.15em;
}

/* Start btn */
.start-btn {
  background: linear-gradient(135deg, var(--neon-pink), #a000cc);
  color: #fff;
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 900;
  padding: 15px 52px;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(180,0,200,0.45), 0 0 40px rgba(255,45,120,0.2);
  transition: filter 0.18s, transform 0.15s, box-shadow 0.18s;
  letter-spacing: 0.06em;
  display: inline-block;
  text-transform: uppercase;
}
.start-btn:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(180,0,200,0.65), 0 0 60px rgba(255,45,120,0.35);
}
.start-btn:active { transform: scale(0.97); }

/* Back btn */
.r-back-btn {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 100px;
  color: rgba(180,220,255,0.6);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.r-back-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* ── Results ── */
.results-box {
  background: linear-gradient(160deg, #100030 0%, #050018 100%);
  border: 1px solid rgba(180,80,255,0.3);
  border-radius: 28px;
  box-shadow:
    0 0 0 1px rgba(0,240,255,0.06),
    0 40px 100px rgba(0,0,0,0.9),
    0 0 80px rgba(100,0,200,0.2);
  padding: 36px 44px 40px;
  max-width: 520px;
  width: calc(100vw - 32px);
  text-align: center;
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.results-icon { font-size: 3.5rem; margin-bottom: 6px; }
.results-title {
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--gold), #ff9d4d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 22px;
  filter: drop-shadow(0 0 16px rgba(255,180,0,0.4));
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.result-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 13px 18px;
  transition: border-color 0.2s;
}
.result-entry:nth-child(1) {
  border-color: rgba(255,208,60,0.4);
  background: rgba(255,208,60,0.06);
  box-shadow: 0 0 20px rgba(255,180,0,0.1);
}

.result-pos  { font-size: 1.3rem; font-weight: 900; color: var(--gold); min-width: 52px; }
.result-swatch { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.result-name { flex: 1; font-size: 1rem; font-weight: 700; color: #e8f0ff; text-align: left; }
.result-time { font-size: 0.88rem; font-family: 'Courier New', monospace; color: rgba(180,210,255,0.6); font-weight: 600; }

.results-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.hub-link-btn {
  padding: 14px 26px;
  border-radius: 100px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(180,220,255,0.75);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.hub-link-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
