:root {
  --cyan: #38bdf8;
  --cyan-hot: #7af6ff;
  --cyan-deep: #0891b2;
  --pink: #e879f9;
  --pink-hot: #ff6ec7;
  --magenta: #d946ef;
  --gold: #fbbf24;
  --gold-hot: #ffe14a;
  --green: #34d399;
  --green-hot: #6ee7b7;
  --navy: #050e1b;
  --ink: #e8f6ff;
  --muted: #8fb4c8;
  --warn: #fb923c;
  --panel: rgba(5, 16, 32, 0.78);
  --stroke: rgba(56, 189, 248, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #000105;
  color: var(--ink);
  font-family: "Rajdhani", "Exo 2", sans-serif;
  user-select: none;
}
#stage, #c {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
#c { z-index: 0; }
#float-layer {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
}
.hidden { display: none !important; }

#hud {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
}

#top-rule {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 46px;
  background: linear-gradient(180deg, rgba(4, 18, 36, 0.92), rgba(4, 18, 36, 0.15));
  border-bottom: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.18);
}

/* ----- top left title ----- */
#hud-title {
  position: absolute;
  top: 7px;
  left: 3.2%;
}
.title-row {
  display: flex; align-items: center; gap: 8px;
}
.bolt {
  color: var(--cyan-hot);
  font-size: 16px;
  text-shadow: 0 0 10px #38bdf8;
}
.title-word {
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: clamp(13px, 1.15vw, 18px);
  color: #7dd3fc;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}
.title-sub {
  margin-left: 24px;
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #67e8f9;
  opacity: 0.85;
}

/* ----- place badge ----- */
#hud-place {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.place-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 22px 3px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #1a1204;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: clamp(14px, 1.35vw, 20px);
  letter-spacing: 0.08em;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 100%, 0 100%);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.55);
}
.place-slash { opacity: 0.55; font-weight: 600; }
.place-split {
  margin-top: 3px;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--gold-hot);
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

/* ----- lap / time ----- */
#hud-lapblock {
  position: absolute;
  top: 8px;
  right: 3.2%;
  text-align: right;
  font-family: "Orbitron", sans-serif;
  color: #7dd3fc;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.55);
}
.lap-line {
  font-size: clamp(13px, 1.2vw, 18px);
  letter-spacing: 0.12em;
  font-weight: 700;
}
.time-line {
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #67e8f9;
}

/* ----- score panel ----- */
#score-panel {
  position: absolute;
  top: 58px;
  left: 2.1%;
  width: clamp(280px, 24vw, 360px);
  padding: 12px 16px 12px 16px;
  background: var(--panel);
  border: 1.5px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 0 22px rgba(8, 145, 178, 0.18), inset 0 0 24px rgba(8, 145, 178, 0.06);
  backdrop-filter: blur(8px);
}
#score-panel .lab {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #7dd3fc;
  font-weight: 700;
}
.score-num {
  font-family: "Share Tech Mono", "Orbitron", monospace;
  font-weight: 700;
  font-size: clamp(28px, 2.6vw, 40px);
  color: #e8fbff;
  letter-spacing: 0.06em;
  text-shadow: 0 0 14px rgba(125, 211, 252, 0.55);
  line-height: 1.05;
  margin: 2px 0 8px;
}
.chain-box {
  background: linear-gradient(180deg, #f59e0b, #d97706 70%);
  border-radius: 8px;
  padding: 7px 10px 8px;
  color: #1a1204;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.35);
}
.chain-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-align: center;
}
.chain-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  margin-top: 2px;
}
.combo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.combo-track {
  flex: 1;
  height: 6px;
  background: rgba(26, 18, 4, 0.35);
  border-radius: 4px;
  overflow: hidden;
}
.combo-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #78350f, #fde68a);
}

/* ----- center banner ----- */
#banner {
  position: absolute;
  top: 13.5%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
}
.banner-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: clamp(16px, 1.7vw, 26px);
  letter-spacing: 0.06em;
  color: var(--gold-hot);
}
.banner-sub {
  margin-top: 4px;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 1.15vw, 16px);
  letter-spacing: 0.08em;
  color: #fde68a;
}

#warn {
  position: absolute;
  top: 22.5%;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--warn);
  text-shadow: 0 0 10px rgba(251, 146, 60, 0.7);
}
#nametag {
  position: absolute;
  top: 30%;
  left: 42%;
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  color: #fb7185;
  letter-spacing: 0.06em;
  text-shadow: 0 0 8px rgba(251, 113, 133, 0.7);
}

.floater {
  position: absolute;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 10px currentColor;
  animation: floatUp 1.15s ease-out forwards;
}
.floater.cyan { color: #67e8f9; }
.floater.pink { color: #f0abfc; }
.floater.gold { color: #fde68a; }
@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -54px); }
}

/* ----- radar ----- */
#radar-panel {
  position: absolute;
  top: 56px;
  right: 2.1%;
  width: clamp(210px, 17vw, 250px);
  padding: 10px 12px 12px;
  background: var(--panel);
  border: 1.5px solid var(--stroke);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 0 22px rgba(8, 145, 178, 0.18);
  backdrop-filter: blur(8px);
}
.radar-head {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #7dd3fc;
  font-weight: 700;
  margin-bottom: 4px;
}
#radar {
  display: block;
  width: 148px; height: 148px;
  margin: 2px auto 6px;
}
.radar-meta, .radar-canopy {
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #67e8f9;
}
.radar-canopy { color: #6ee7b7; margin-top: 2px; }

/* ----- telemetry ----- */
#tele-panel {
  position: absolute;
  left: 2.1%;
  bottom: 4.4%;
  width: clamp(340px, 32vw, 470px);
  padding: 12px 16px 12px;
  background: var(--panel);
  border: 1.5px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 0 22px rgba(8, 145, 178, 0.18);
  backdrop-filter: blur(8px);
}
.tele-head {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #7dd3fc;
  font-weight: 700;
  margin-bottom: 8px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #cfefff;
}
.stat-num { color: #7dd3fc; font-family: "Share Tech Mono", monospace; }
.bar {
  height: 10px;
  margin: 4px 0 9px;
  background: rgba(8, 30, 48, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 3px;
  overflow: hidden;
}
.bar i { display: block; height: 100%; width: 0%; }
.bar.cyan i { background: linear-gradient(90deg, #0891b2, #67e8f9); }
.bar.green i { background: linear-gradient(90deg, #059669, #6ee7b7); }
.bar.rpm {
  height: 8px;
  margin: 5px 0 8px;
}
.bar.rpm i { background: linear-gradient(90deg, #22d3ee, #e879f9); }
.tele-pills {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #9ec4dc;
  margin-top: 2px;
}
.tele-pills .gold { color: var(--gold-hot); }
.spray-line {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #67e8f9;
  font-weight: 700;
}

/* ----- speed ----- */
#speed-panel {
  position: absolute;
  right: 2.1%;
  bottom: 4.4%;
  width: clamp(280px, 24vw, 360px);
  padding: 12px 18px 12px;
  background: var(--panel);
  border: 1.5px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 0 22px rgba(8, 145, 178, 0.18);
  backdrop-filter: blur(8px);
}
.spd-row { display: flex; align-items: flex-start; gap: 12px; }
.spd-num {
  font-family: "Share Tech Mono", "Orbitron", sans-serif;
  font-weight: 700;
  font-size: clamp(42px, 4.4vw, 64px);
  line-height: 0.9;
  color: #f0fbff;
  text-shadow: 0 0 18px rgba(125, 211, 252, 0.5);
  min-width: 2.2ch;
}
.spd-unit {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.14em;
  color: #67e8f9;
  margin-top: 8px;
}
#overdrive-pill {
  margin-top: 8px;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.35);
  border: 1px solid #67e8f9;
  color: #e0f7ff;
  font-family: "Orbitron", sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.rpm-lab {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #9ec4dc;
  font-weight: 700;
}
.gear-line {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #9ec4dc;
  font-weight: 700;
}
.gear-line b { color: #e8f6ff; }
.gear-line .sep { margin: 0 8px; opacity: 0.45; }

/* ----- hint ----- */
#hintbar {
  position: absolute;
  left: 50%;
  bottom: 1.5%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #b7e9f8;
  text-shadow: 0 2px 8px #000;
}
#hintbar span { margin: 0 8px; color: #67e8f9; }

/* ----- menu / results ----- */
#menu, #results {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(8, 40, 70, 0.35), rgba(0, 2, 8, 0.72));
}
.menu-card {
  width: min(720px, 92vw);
  padding: 28px 36px 26px;
  background: rgba(5, 16, 32, 0.88);
  border: 1.5px solid var(--stroke);
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 0 40px rgba(8, 145, 178, 0.25);
  backdrop-filter: blur(10px);
}
.title-row.big {
  flex-wrap: nowrap;
  justify-content: center;
}
.title-row.big .title-word {
  font-size: clamp(13px, 1.55vw, 20px);
  white-space: nowrap;
}
.menu-sub {
  margin-top: 6px;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: #67e8f9;
}
.menu-blurb {
  margin: 16px auto 8px;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.45;
  color: #cfefff;
  font-weight: 600;
}
.menu-art {
  height: 150px;
  display: flex; align-items: center; justify-content: center;
  margin: 4px 0 10px;
}
.menu-art img {
  max-height: 150px;
  max-width: 280px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(56, 189, 248, 0.45));
}
#btn-play, #btn-again {
  pointer-events: auto;
  cursor: pointer;
  margin-top: 6px;
  padding: 12px 36px;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 15px;
  color: #041018;
  background: linear-gradient(180deg, #67e8f9, #22d3ee);
  border: none;
  border-radius: 8px;
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.45);
}
#btn-play:hover, #btn-again:hover {
  background: linear-gradient(180deg, #a5f3fc, #67e8f9);
}
.menu-controls {
  margin-top: 16px;
  font-size: 13px;
  color: #9ec4dc;
  line-height: 1.55;
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 4px;
  background: rgba(8, 30, 48, 0.8);
  color: #7dd3fc;
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin: 18px 0;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.08em;
  color: #9ec4dc;
  font-size: 13px;
}
.res-grid b {
  display: block;
  margin-top: 4px;
  color: #e8fbff;
  font-size: 22px;
}

#countdown {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: 96px;
  color: #7af6ff;
  text-shadow: 0 0 30px rgba(56, 189, 248, 0.8);
  pointer-events: none;
}
