/* ═══════════════════════════════════════════════════════════════════
   CRUDE RUN — OFFSHORE NOIR DESIGN SYSTEM
   Typography: Syne (Display) · Space Grotesk (UI) · JetBrains Mono (HUD)
   Palette: Obsidian #070a12 · Burnished Gold #e6a84c · Seafoam #38e8c8 · Crimson #ff3b4e
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg-obsidian: #070a12;
  --glass-bg: rgba(8, 12, 22, 0.72);
  --glass-strong: rgba(7, 10, 18, 0.88);
  --border-subtle: rgba(242, 237, 228, 0.12);
  --border-gold: rgba(230, 168, 76, 0.36);
  --ink: #f2ede4;
  --ink-dim: rgba(242, 237, 228, 0.56);
  --ink-muted: rgba(242, 237, 228, 0.34);
  --gold: #e6a84c;
  --gold-bright: #f5c86b;
  --cyan: #38e8c8;
  --crimson: #ff3b4e;
  --amber-hot: #ff7a28;
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  background: var(--bg-obsidian);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

#canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  filter: blur(0px) brightness(1) saturate(1.04);
  transition: filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.in-setup #canvas {
  filter: blur(0px) brightness(1.02) saturate(1.08);
}

body.in-setup #hud,
body.in-setup #compass-widget,
body.in-setup #hud-bottom-right,
body.in-setup #hud-utilities,
body.in-setup #radio-chatter,
body.in-setup #touch-controls,
body.in-setup #controls-hint,
body.in-modal #hud,
body.in-modal #compass-widget,
body.in-modal #hud-bottom-right,
body.in-modal #hud-utilities,
body.in-modal #radio-chatter,
body.in-modal #controls-hint {
  opacity: 0;
  pointer-events: none;
}

/* ══ ATMOSPHERIC SCREEN OVERLAYS ════════════════════════════════════ */

#boundary-overlay,
#turbo-overlay,
#siren-overlay,
#speed-lines,
#leg-fade {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#boundary-overlay {
  z-index: 2;
  transition: background 0.35s ease;
}

#turbo-overlay {
  z-index: 3;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(56, 232, 200, 0.10) 76%, rgba(230, 168, 76, 0.22) 100%);
  transition: opacity 0.2s ease;
}
#turbo-overlay.active {
  opacity: 1;
}

#siren-overlay {
  z-index: 4;
  opacity: 0;
  transition: opacity 0.14s ease;
}

#speed-lines {
  z-index: 3;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.35s ease;
}

.sl-band {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9%;
  overflow: hidden;
}
.sl-band-l { left: 0; }
.sl-band-r { right: 0; }

.sl {
  position: absolute;
  left: -100%;
  right: -100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 237, 228, 0.28), transparent);
  animation: slMove 0.22s linear infinite;
}
#speed-lines.turbo .sl {
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(56, 232, 200, 0.55), transparent);
  animation-duration: 0.10s;
}
.sl:nth-child(1) { top: 14%; animation-delay: 0s; }
.sl:nth-child(2) { top: 28%; animation-delay: -0.06s; }
.sl:nth-child(3) { top: 44%; animation-delay: -0.12s; }
.sl:nth-child(4) { top: 61%; animation-delay: -0.04s; }
.sl:nth-child(5) { top: 76%; animation-delay: -0.09s; }
.sl:nth-child(6) { top: 88%; animation-delay: -0.15s; }

@keyframes slMove {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

#leg-fade {
  z-index: 60;
  background: #04060c;
  opacity: 0;
  transition: opacity 0.34s ease;
}

/* ══ IN-GAME HUD ════════════════════════════════════════════════════ */

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 22px;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.hud-cluster {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-cluster-right {
  align-items: flex-end;
}

body.photo-clean #hud,
body.photo-clean #compass-widget,
body.photo-clean #hud-bottom-right,
body.photo-clean #hud-utilities,
body.photo-clean #radio-chatter,
body.photo-clean #controls-hint,
body.photo-clean #pause-overlay,
body.photo-clean #telemetry-drawer {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Precision Marine Avionics HUD (Teenage Engineering × Furuno — Zero Rounded AI Pills!) ── */
.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(5, 8, 15, 0.72);
  border: 1px solid rgba(242, 237, 228, 0.14);
  border-left: 2px solid rgba(230, 168, 76, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 2px;
  padding: 5px 10px;
}

.hud-cluster-right .hud-pill {
  border-left: 1px solid rgba(242, 237, 228, 0.14);
  border-right: 2px solid rgba(230, 168, 76, 0.65);
}

#hud-sector-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan);
  padding-left: 8px;
  border-left: 1px solid rgba(242, 237, 228, 0.16);
}
#hud-sector-badge.visible {
  display: inline;
}

#hud-ghost-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan);
  padding-left: 8px;
  border-left: 1px solid rgba(242, 237, 228, 0.16);
}
#hud-ghost-badge.visible {
  display: inline;
}

#hud-flow-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #070a12;
  background: var(--gold-bright);
  padding: 2px 6px;
  border-radius: 2px;
}
#hud-flow-badge.visible {
  display: inline-block;
}

#hud-op-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
  text-transform: uppercase;
}

#hud-obj-pill {
  border-color: var(--border-gold);
  transition: border-color 0.25s, background 0.25s;
}
#hud-obj-pill.ready {
  border-color: rgba(56, 232, 200, 0.55);
  background: rgba(12, 30, 32, 0.78);
}
#hud-obj-pill.urgent {
  border-color: rgba(255, 59, 78, 0.65);
  background: rgba(38, 10, 16, 0.8);
}

.hud-k {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.hud-v {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

#hud-obj-val {
  color: var(--cyan);
}
#hud-obj-pill.ready #hud-obj-val {
  color: var(--gold-bright);
}
#hud-obj-pill.urgent #hud-obj-val {
  color: var(--crimson);
}

.hud-telemetry-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(5, 8, 15, 0.72);
  border: 1px solid rgba(242, 237, 228, 0.14);
  border-left: 2px solid rgba(56, 232, 200, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 2px;
  padding: 5px 10px;
}

.hud-metric {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

#hud-score-val {
  color: var(--gold-bright);
}

#hud-style-val {
  color: var(--cyan);
}

#hud-style-pop {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-bright);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 0.45s ease;
  white-space: nowrap;
}

/* Hull Integrity Pips */
#hud-hull-wrap {
  gap: 8px;
}
.hull-pips {
  display: flex;
  gap: 5px;
}
.hull-pip {
  width: 22px;
  height: 7px;
  border-radius: 3px;
  background: rgba(242, 237, 228, 0.12);
  border: 1px solid rgba(242, 237, 228, 0.16);
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.hull-pip.filled {
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-color: var(--gold-bright);
  box-shadow: 0 0 10px rgba(230, 168, 76, 0.4);
}
#hud-hull-wrap.critical .hull-pip.filled {
  background: var(--crimson);
  border-color: #ff6b79;
  box-shadow: 0 0 12px rgba(255, 59, 78, 0.7);
  animation: pulseCritical 0.65s ease-in-out infinite alternate;
}

@keyframes pulseCritical {
  from { opacity: 1; }
  to { opacity: 0.4; }
}

/* Wanted Stars */
#hud-wanted-stars {
  display: inline-flex;
  gap: 3px;
  font-size: 13px;
  line-height: 1;
}
#hud-wanted-stars .star {
  color: rgba(242, 237, 228, 0.16);
}
#hud-wanted-stars .star.lit {
  color: var(--gold-bright);
  text-shadow: 0 0 10px rgba(245, 200, 107, 0.55);
}
#hud-wanted-wrap.critical #hud-wanted-stars .star.lit {
  color: var(--crimson);
  text-shadow: 0 0 12px rgba(255, 59, 78, 0.65);
}

/* ── Tactical Maritime Radar (Top Center) ── */
#compass-widget {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: opacity 0.4s ease;
}

#compass-canvas {
  width: 90px;
  height: 90px;
  display: block;
}

#compass-dist {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

/* ── Bottom-Right Speedometer & Nitro Gauge ── */
#hud-bottom-right {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  transition: opacity 0.4s ease;
}

#speed-gauge {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: rgba(5, 8, 15, 0.76);
  border: 1px solid rgba(242, 237, 228, 0.14);
  border-right: 2px solid var(--gold);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 2px;
  padding: 6px 12px 7px;
}

#hud-knots-val {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.knots-unit {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.hud-gauges-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

#slick-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5, 8, 15, 0.74);
  border: 1px solid rgba(242, 237, 228, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 2px;
  padding: 5px 10px;
  transition: border-color 0.2s;
}
#slick-gauge.ready {
  border-color: var(--border-gold);
}
.slick-bar {
  width: 44px;
  height: 6px;
  border-radius: 1px;
  background: rgba(242, 237, 228, 0.12);
  overflow: hidden;
}
#slick-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width 0.08s linear;
}

#boost-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5, 8, 15, 0.74);
  border: 1px solid rgba(242, 237, 228, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 2px;
  padding: 5px 10px;
}

.boost-cells {
  display: flex;
  gap: 4px;
}

.boost-cell {
  width: 30px;
  height: 6px;
  border-radius: 1px;
  background: rgba(242, 237, 228, 0.12);
  overflow: hidden;
}

.boost-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--cyan), #88ffee);
  transition: width 0.08s linear;
}

/* ── Utility Icon Buttons (Bottom-Left) ── */
#hud-utilities {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 12;
  display: flex;
  gap: 8px;
  transition: opacity 0.4s ease;
}

.util-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 15, 0.72);
  border: 1px solid rgba(242, 237, 228, 0.14);
  border-radius: 2px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}
.util-btn:hover {
  color: var(--ink);
  border-color: var(--border-gold);
  background: rgba(18, 24, 38, 0.85);
  transform: translateY(-1px);
}
#mute-btn .ico-off { display: none; }
#mute-btn.muted { color: var(--crimson); border-color: rgba(255, 59, 78, 0.4); }
#mute-btn.muted .ico-on { display: none; }
#mute-btn.muted .ico-off { display: block; }
#fullscreen-btn .ico-exit { display: none; }
body.is-fullscreen #fullscreen-btn .ico-enter { display: none; }
body.is-fullscreen #fullscreen-btn .ico-exit { display: block; }

/* ── Center Callouts, Air Trick Banner, Follow Warning & Controls Hint ── */
#msg-flash {
  --flash-color: #f5c86b;
  position: fixed;
  top: 23%;
  left: 50%;
  transform: translate(-50%, 8px);
  z-index: 12;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: clamp(16px, 2.4vw, 24px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--flash-color);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.85), 0 0 28px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#msg-flash.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

#hud-air {
  position: fixed;
  top: 64%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
  background: var(--glass-bg);
  border: 1px solid rgba(56, 232, 200, 0.45);
  border-radius: 999px;
  padding: 5px 14px;
  opacity: 0;
  transition: opacity 0.16s ease;
}
#hud-air.visible { opacity: 1; }

#hud-trick {
  position: fixed;
  top: calc(64% + 34px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 0.16s ease;
}
#hud-trick.visible { opacity: 1; }

#follow-warn {
  position: fixed;
  top: 126px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  pointer-events: none;
  width: 260px;
  background: rgba(34, 8, 14, 0.84);
  border: 1px solid rgba(255, 59, 78, 0.6);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#follow-warn.visible { opacity: 1; }
#follow-warn-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ff8a96;
  margin-bottom: 6px;
}
.follow-warn-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
#follow-warn-fill {
  height: 100%;
  width: 100%;
  background: var(--crimson);
}

#controls-hint {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  pointer-events: none;
  display: flex;
  gap: 12px;
  white-space: nowrap;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.6s ease;
}
#controls-hint.visible { opacity: 1; }
#controls-hint kbd {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(230, 168, 76, 0.12);
  border: 1px solid rgba(230, 168, 76, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 4px;
}

/* ── VHF Radio Dispatch Bar ── */
#radio-chatter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%, 10px);
  z-index: 11;
  pointer-events: none;
  max-width: min(560px, calc(100vw - 340px));
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(5, 8, 15, 0.84);
  border: 1px solid rgba(56, 232, 200, 0.32);
  border-left: 2px solid var(--cyan);
  border-radius: 2px;
  padding: 7px 12px;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Backtick (`) Engineering Telemetry Drawer ── */
#telemetry-drawer {
  display: none;
  position: fixed;
  left: 20px;
  top: 126px;
  z-index: 50;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 40px);
  padding: 6px 10px;
  background: rgba(4, 7, 13, 0.88);
  border: 1px solid rgba(56, 232, 200, 0.32);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-dim);
  pointer-events: none;
}
#telemetry-drawer.active {
  display: flex;
}
#telemetry-metrics {
  display: flex;
  gap: 12px;
  white-space: nowrap;
}
#telemetry-metrics b {
  color: var(--cyan);
  font-weight: 700;
}

/* ── URL Challenge Banner on Title Screen ── */
#challenge-banner {
  display: none;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #070a12;
  background: var(--cyan);
  padding: 4px 12px;
  border-radius: 2px;
}
#challenge-banner.visible {
  display: inline-block;
}

/* ── Strava-Style Post-Run GPS Chart Frame ── */
.gps-frame {
  width: 100%;
  background: rgba(4, 7, 13, 0.72);
  border: 1px solid rgba(242, 237, 228, 0.12);
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
}
.gps-frame canvas {
  width: 100%;
  height: 112px;
  display: block;
}

/* ── Photo-Orbit Pause Backdrop (Transparent so you can orbit your boat!) ── */
.modal-screen.pause-transparent {
  background: rgba(4, 7, 14, 0.24);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  justify-content: flex-start;
  padding-left: 36px;
}
.modal-screen.pause-transparent .modal-card {
  max-width: 280px;
  padding: 24px 24px;
}
.photo-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-top: 4px;
}
#radio-chatter.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.radio-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  flex-shrink: 0;
}
#radio-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.03em;
  color: var(--ink);
  white-space: normal;
}

/* ══ TITLE / SETUP SCREEN (Unobstructed Hero 3D Showcase) ═══════════ */

#setup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(22px, 4vh, 42px) 24px clamp(16px, 2.6vh, 28px);
  background: linear-gradient(
    180deg,
    rgba(6, 10, 18, 0.72) 0%,
    rgba(6, 10, 18, 0.22) 26%,
    rgba(6, 10, 18, 0.0) 46%,
    rgba(6, 10, 18, 0.08) 62%,
    rgba(5, 8, 15, 0.86) 100%
  );
}
#setup.active { display: flex; }

#setup-top {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: riseIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#setup-bottom {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: riseIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.06s both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-lockup {
  text-align: center;
}

.brand-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--gold-bright);
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.75);
}

#setup-top h1 {
  font-family: var(--font-display);
  font-size: clamp(44px, 7.2vw, 82px);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 0.96;
  white-space: nowrap;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.65));
}

#setup-top h1 span {
  display: inline-block;
  opacity: 0;
  background: linear-gradient(110deg, #9a6d2b 0%, #e6b25c 30%, #fff1c9 50%, #e0a74b 70%, #8e6122 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: letterDrop 0.45s ease forwards, foilShimmer 7s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.05s), calc(var(--i) * 0.22s + 0.5s);
}
#setup-top h1 span.dot {
  background: linear-gradient(110deg, #38e8c8 0%, #d4fff7 50%, #38e8c8 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes letterDrop {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes foilShimmer {
  0%, 100% { background-position: 170% center; }
  50% { background-position: -70% center; }
}

.brand-tagline {
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(242, 237, 228, 0.82);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

/* Minimal Livery + Callsign + Scores Strip */
.callsign-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 12, 22, 0.66);
  border: 1px solid rgba(242, 237, 228, 0.12);
  border-radius: 999px;
  padding: 5px 8px 5px 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.livery-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.livery-swatch {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--sw);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.livery-swatch:hover {
  transform: scale(1.18);
}
.livery-swatch.active {
  border-color: #070a12;
  box-shadow: 0 0 0 2px var(--gold-bright);
  transform: scale(1.12);
}
#callsign-input {
  width: 96px;
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--gold-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  outline: none;
}
#callsign-input:focus {
  background: rgba(255, 255, 255, 0.06);
}
.bar-sep {
  width: 1px;
  height: 14px;
  background: rgba(242, 237, 228, 0.14);
}
#btn-open-lb {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.18s;
}
#btn-open-lb:hover {
  color: var(--ink);
}

/* Minimal 3-Mode Selector Buttons */
#setup-mode-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.mode-card {
  text-align: center;
  background: rgba(8, 12, 22, 0.72);
  border: 1px solid rgba(242, 237, 228, 0.16);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-bright);
  background: rgba(14, 20, 34, 0.86);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}
.mode-card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mode-card-desc {
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.35;
}
.mode-card-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 2px;
}
.mode-card-meta:empty {
  display: none;
}

/* ══ SHARED GLASS MODALS (Briefing, Pause, Complete, Death, Victory, LB) ══ */

.modal-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 14, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.modal-screen.active { display: flex; }

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--glass-strong);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 32px 34px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.65);
  animation: riseIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-card.modal-wide {
  max-width: 520px;
}

.mission-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mission-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.15s;
}
.mission-row:hover {
  border-color: var(--gold-bright);
  background: rgba(230, 168, 76, 0.09);
  transform: translateY(-1px);
}
.mr-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}
.mr-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mr-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.mr-sub {
  font-size: 11.5px;
  color: var(--ink-dim);
}
.mr-stars {
  font-size: 14px;
  letter-spacing: 2px;
  color: rgba(242, 237, 228, 0.16);
}
.mr-stars .lit {
  color: var(--gold-bright);
}

.lc-stars {
  font-size: 26px;
  letter-spacing: 6px;
  color: rgba(242, 237, 228, 0.18);
  margin: -6px 0;
}
.lc-stars .lit {
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(245, 200, 107, 0.65);
}

#touch-slick-btn {
  border-color: rgba(230, 168, 76, 0.35);
  opacity: 0.45;
}
#touch-slick-btn.ready {
  border-color: var(--gold-bright);
  opacity: 1;
}

.modal-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--gold);
  text-transform: uppercase;
}

.modal-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.05;
}

.modal-pill-tag {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--cyan);
  background: rgba(56, 232, 200, 0.1);
  border: 1px solid rgba(56, 232, 200, 0.32);
  border-radius: 999px;
  padding: 4px 12px;
}

.modal-copy {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-dim);
}

.modal-objective {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  padding: 12px 14px;
  background: rgba(230, 168, 76, 0.08);
  border: 1px solid rgba(230, 168, 76, 0.24);
  border-radius: 12px;
}

.modal-prompt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  margin-top: 4px;
}
.modal-prompt.ready {
  color: var(--cyan);
  animation: pulseSoft 1.2s ease-in-out infinite alternate;
}

@keyframes pulseSoft {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

/* Stat Table */
.stat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-dim);
}
.stat-row b {
  color: var(--ink);
  font-weight: 700;
}
.stat-row.accent {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--gold);
}
.stat-row.accent b {
  color: var(--gold-bright);
  font-size: 15px;
}
.ngp-tag {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.14em;
}

/* Leaderboard Rows */
.lb-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}
.lb-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 4px;
}
.lb-header.highlight {
  color: var(--cyan);
}
.lb-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 12px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink-dim);
}
.lb-row.is-new {
  background: rgba(56, 232, 200, 0.12);
  color: var(--cyan);
  font-weight: 700;
}
.lb-rank { color: var(--gold); font-weight: 700; text-align: left; }
.lb-name { text-align: left; color: var(--ink); }
.lb-score { font-weight: 700; color: var(--gold-bright); }
.lb-time { color: var(--ink-muted); }
.lb-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  padding: 18px 0;
}

.lb-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.lb-tab {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  cursor: pointer;
}
.lb-tab.active {
  background: rgba(230, 168, 76, 0.14);
  border-color: var(--border-gold);
  color: var(--gold-bright);
}

/* Action Buttons */
.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.btn-primary,
.btn-secondary {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 20px;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 0.15s, background 0.18s, border-color 0.18s, color 0.18s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  border: none;
  color: #090c14;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--ink-dim);
}
.btn-secondary:hover {
  border-color: var(--border-gold);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

/* Death Title Responsive Sizing (Fixes 120px overflow bug!) */
#death-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 8vw, 76px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 0.96;
  text-shadow: 0 0 36px currentColor;
}

#death-cop-l,
#death-cop-r {
  position: fixed;
  top: 0;
  width: 6px;
  height: 100vh;
  z-index: 55;
  pointer-events: none;
  display: none;
}
#death-cop-l { left: 0; animation: copBarL 0.6s step-end infinite; }
#death-cop-r { right: 0; animation: copBarR 0.6s step-end infinite; }
@keyframes copBarL { 0%, 49% { background: var(--crimson); } 50%, 100% { background: #267dff; } }
@keyframes copBarR { 0%, 49% { background: #267dff; } 50%, 100% { background: var(--crimson); } }

/* ══ TOUCH / MOBILE CONTROLS ════════════════════════════════════════ */

#touch-controls {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 14;
  pointer-events: none;
}

#touch-zone {
  position: fixed;
  left: 20px;
  bottom: 76px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 237, 228, 0.22);
  background: rgba(7, 10, 18, 0.35);
  pointer-events: auto;
  touch-action: none;
}
#touch-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(230, 168, 76, 0.68);
  transform: translate(-50%, -50%);
}

#touch-actions {
  position: fixed;
  right: 20px;
  bottom: 126px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}
.touch-action-btn {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-gold);
  background: rgba(8, 12, 22, 0.78);
  color: var(--gold-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  touch-action: manipulation;
}
#touch-trick-btn {
  border-color: rgba(56, 232, 200, 0.55);
  color: var(--cyan);
  opacity: 0.35;
}
#touch-trick-btn.airborne {
  opacity: 1;
  background: rgba(14, 42, 44, 0.88);
}

@media (pointer: coarse) {
  #touch-controls { display: block; }
  #controls-hint { display: none; }
}

@media (max-width: 680px) {
  #hud { padding: 12px 12px; }
  .hud-telemetry-row { gap: 10px; padding: 6px 10px; }
  #compass-canvas { width: 72px; height: 72px; }
  #setup-mode-row { grid-template-columns: 1fr; }
  .modal-card { padding: 24px 20px; }
  #radio-chatter { max-width: calc(100vw - 24px); bottom: 68px; }
  #hud-bottom-right { right: 12px; bottom: 14px; }
  #hud-utilities { left: 12px; bottom: 14px; }
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  #death-cop-l, #death-cop-r, #siren-overlay { display: none !important; }
}
