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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: rgba(255,255,255,0.09);
  --text: #f8fafc;
  --muted: #64748b;
  --accent: #ff0099;
  --accent-dark: #cc007a;
  --accent-glow: rgba(255,0,153,0.4);
  --red: #ff0099;
  --green: #34d399;
  --amber: #fbbf24;
  --font: 'Roboto Mono', 'SF Mono', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg); color: var(--text);
  height: 100dvh; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
/* MapLibre GL canvas container — full viewport, WebGL handles all 3D projection */
#map {
  position: absolute; inset: 0; z-index: 0;
}
/* body.nav-3d used only for UI state (street labels, controls visibility) —
   actual 3D is done by map.setPitch() in WebGL, not CSS transforms */
.hidden { display: none !important; }

/* ── Top bar ──────────────────────────────────── */
#topbar {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1000;
  display: flex; align-items: center; gap: 6px;
  background: rgba(3,7,17,0.92);
  border: 1px solid rgba(255,0,153,0.18); border-radius: 999px;
  padding: 5px 10px;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  white-space: nowrap; max-width: calc(100vw - 20px);
  box-shadow: 0 4px 32px rgba(0,0,0,.7), 0 0 0 1px rgba(255,0,153,0.08);
}
#logo { line-height: 1; padding-right: 2px; display: flex; align-items: center; gap: 5px; }
#logo-text {
  font-family: var(--font);
  font-size: .85rem; font-weight: 900;
  letter-spacing: .18em; color: var(--accent);
  text-transform: uppercase;
}
#filters { display: flex; gap: 2px; }
.filter-btn {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 999px; color: #fff; cursor: pointer;
  font-size: .95rem; padding: 6px 9px; opacity: .38;
  transition: opacity .15s, background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.filter-btn.active { opacity: 1; background: rgba(255,255,255,0.12); }
.filter-btn:active { transform: scale(.9); opacity: 1; }
/* search-toggle and style-toggle removed — replaced by idle-bar */

/* ── Route planner ────────────────────────────── */
/* Planner slides UP from bottom. JS sets display:flex before animating in,
   and restores display:none after animating out (see openPlanner/closePlanner). */
#route-planner {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1100;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(148,163,184,.08);
  max-height: 100dvh; overflow: hidden;
  display: none; /* JS sets to flex before animating */
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 48px rgba(0,0,0,.7);
}
#route-planner.planner-open {
  transform: translateY(0);
}
#planner-top { flex-shrink: 0; }
#search-results {
  flex: 1; min-height: 0; /* critical: allows flex child to shrink below content height */
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#planner-top {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 12px 10px;
  padding-top: calc(14px + env(safe-area-inset-top));
}
#planner-back {
  background: rgba(255,255,255,0.08); border: none; border-radius: 50%;
  color: var(--text); cursor: pointer; font-size: 1.1rem;
  width: 36px; height: 36px; flex-shrink: 0; margin-top: 2px;
}
#planner-fields { flex: 1; display: flex; flex-direction: column; }
.field-row {
  display: flex; align-items: center; gap: 10px; padding: 3px 0;
}
.field-row.active .field-input { border-color: var(--accent); background: rgba(59,130,246,.1); }
.field-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.dot-from { background: var(--green); }
.dot-to   { background: var(--red);   }
.field-input {
  flex: 1; background: rgba(255,255,255,0.06);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: .95rem; padding: 9px 12px; outline: none;
  transition: border-color .15s, background .15s;
}
.field-input::placeholder { color: #444; }
.field-input:focus { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.08); }
.field-clear {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: .75rem; padding: 4px 6px; border-radius: 4px;
  flex-shrink: 0;
}
body:not(.show-start) #from-row,
body:not(.show-start) .field-connector { display: none; }
.field-connector {
  position: relative; display: flex; align-items: center;
  padding: 2px 0; height: 18px;
}
.connector-line {
  width: 1px; height: 100%; background: rgba(255,255,255,.15); margin-left: 4.5px;
}
#swap-btn {
  position: absolute; right: 0;
  background: rgba(255,255,255,0.1); border: 1px solid var(--border);
  border-radius: 50%; color: var(--text); cursor: pointer;
  width: 30px; height: 30px; font-size: .85rem; transition: background .15s;
}
#swap-btn:hover { background: rgba(255,255,255,.2); }

/* ── Search results ───────────────────────────── */
#search-results { padding: 2px 12px 12px; }
.results-section-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); padding: 8px 10px 4px;
}
.search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px; border-radius: 12px; cursor: pointer;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.search-result:active { background: rgba(255,255,255,.09); }
.search-result:hover { background: rgba(255,255,255,.06); }
.result-emoji { font-size: 1.25rem; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.result-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.result-body strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-body em { font-style: normal; font-size: .7rem; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.result-body span { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-body { flex: 1; min-width: 0; }
.result-fav-btn {
  background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 1rem; padding: 2px 4px;
  flex-shrink: 0; line-height: 1;
}
.result-fav-btn.saved { color: var(--amber); }
/* Distance badge */
.result-dist {
  flex-shrink: 0; font-size: .68rem; font-weight: 700;
  color: var(--muted); white-space: nowrap;
  background: rgba(255,255,255,.07); border-radius: 6px;
  padding: 2px 6px; margin-left: auto;
}
/* Query match highlight */
mark {
  background: none; color: #ffd700; font-weight: 700;
}
/* Spinner state while fetching */
.no-results { padding: 12px 10px; color: var(--muted); font-size: .85rem; }
.srch-spin::before {
  content: ''; display: inline-block; width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
  margin-right: 8px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* NSS result layout with dist badge */
.nss-result { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; gap: 10px; border-radius: 10px; transition: background .12s; }
.nss-result:active { background: rgba(255,255,255,.08); }
.nss-r-icon { font-size: 1.1rem; flex-shrink: 0; }
.nss-r-body { flex: 1; min-width: 0; }
.nss-r-dist { flex-shrink: 0; font-size: .68rem; font-weight: 700; color: var(--muted); background: rgba(255,255,255,.07); border-radius: 6px; padding: 2px 6px; }

/* ── Preview bar — Waze-style bottom sheet ─────── */
#preview-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1000;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 48px rgba(0,0,0,.7), 0 -1px 0 rgba(148,163,184,.08);
  display: flex; flex-direction: column;
  max-height: var(--sheet-h, 240px); /* JS controls this */
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(0.4,0,0.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}
#sheet-handle {
  padding: 10px 0 6px;
  cursor: grab; user-select: none; flex-shrink: 0;
  touch-action: none; /* let JS handle it */
}
#sheet-handle:active { cursor: grabbing; }
.handle-pill {
  width: 38px; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,0.18);
  margin: 0 auto;
}
#preview-head {
  display: flex; flex-direction: column; gap: 12px;
  padding: 0 16px 16px; flex-shrink: 0;
}
#preview-meta { flex: 1; min-width: 0; }
/* Waze-style: big time on left, distance on right, same row */
#preview-top-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px;
}
#preview-time { font-size: 2.4rem; font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
#preview-dist { font-size: 1.1rem; font-weight: 600; color: var(--muted); }
#preview-via {
  font-size: .78rem; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#preview-avoidance-note { font-size: .72rem; color: var(--amber); margin-top: 3px; }
/* Action row: Cancel (ghost) | Share (secondary) | Go now (hero) */
#preview-actions { display: flex; gap: 8px; }
#cancel-route-btn {
  padding: 15px 14px; border-radius: 99px;
  background: none; border: 1px solid rgba(255,255,255,.12);
  color: var(--muted); cursor: pointer; font-size: .88rem; font-weight: 600;
  flex-shrink: 0;
  transition: background .15s;
}
#cancel-route-btn:active { background: rgba(255,255,255,.08); }
#start-nav-btn {
  flex: 1; padding: 15px; border-radius: 99px;
  background: #00cfff; border: none;
  color: #000; cursor: pointer; font-size: 1.05rem; font-weight: 900;
  letter-spacing: .02em; white-space: nowrap;
  box-shadow: 0 2px 20px rgba(0,207,255,.5);
  transition: filter .15s, transform .12s;
}
#start-nav-btn:active { transform: scale(.96); filter: brightness(.92); }

/* ── Sheet scrollable content (chips + profile + steps) ── */
#sheet-content {
  overflow-y: auto; flex: 1;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ── Directions list ──────────────────────────── */
#directions-list {}
.dir-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,.04);
}
.dir-step:last-child { border-bottom: none; padding-bottom: 16px; }
.dir-step.dir-arrive { color: var(--green); }
.dir-arrow { font-size: 1.1rem; min-width: 24px; text-align: center; line-height: 1; flex-shrink:0; }
.dir-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px; /* FIX: stack name above instruction */
}
.dir-street { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-instr  { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-speed  { font-size: .7rem; color: var(--accent); white-space: nowrap; flex-shrink:0; }
.dir-dist   { font-size: .78rem; color: var(--muted); white-space: nowrap; min-width: 40px; text-align: right; flex-shrink:0; }

/* ── Nav instruction ──────────────────────────── */
#nav-instruction {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1000;
  background: linear-gradient(180deg, #0c1a36 0%, #0c1526 100%);
  border-bottom: 1px solid rgba(255,0,153,.2);
  box-shadow: 0 8px 40px rgba(0,0,0,.8);
}
#nav-main {
  display: flex; align-items: center; gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
}
#nav-icon {
  width: 68px; height: 68px; flex-shrink: 0;
  background: linear-gradient(145deg, #ff0099, #cc007a);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(255,0,153,0.5), inset 0 1px 0 rgba(255,255,255,.18);
}
#nav-text { flex: 1; min-width: 0; }
#nav-dist  { font-size: 2rem; font-weight: 900; color: #fff; line-height: 1; letter-spacing: -0.03em; }
#nav-street {
  font-size: 1.05rem; color: rgba(255,255,255,.92); margin-top: 4px;
  font-weight: 700; letter-spacing: 0.01em;
  white-space: normal; overflow-wrap: break-word; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
@keyframes pulse-red { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }

#nav-next-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 12px;
  font-size: .78rem; color: rgba(255,255,255,.5);
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.25);
}
#nav-next-icon { font-size: .9rem; opacity: .55; }
#nav-next-label { color: rgba(255,255,255,.55); letter-spacing: .01em; }

/* ── Alert bar (camera / hazard) ─────────────── */
#alert-bar {
  position: absolute; left: 10px; right: 10px; z-index: 999;
  top: auto; /* set by JS to sit below nav-instruction */
  background: #1c1408; border: 1px solid var(--amber);
  border-radius: 12px; padding: 9px 14px;
  display: flex; align-items: center; gap: 10px;
  animation: slideDown .25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
#alert-bar.police-alert { background: #1a0808; border-color: var(--red); }
@keyframes slideDown { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:none} }
#alert-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
#alert-text { flex: 1; font-size: .88rem; font-weight: 700; color: var(--amber); }
#alert-bar.police-alert #alert-text { color: #fca5a5; }
#alert-dist {
  font-size: .9rem; font-weight: 800; color: var(--amber); white-space: nowrap;
}
#alert-bar.police-alert #alert-dist { color: #fca5a5; }

/* ── Camera marker ripple rings ──────────────────── */
/* ── GTA-style police marker: alternating red/blue flash ─────────────── */
@keyframes gta-cop-lights {
  0%,49%  { box-shadow: 0 0 0 3px #2563eb, 0 0 20px 8px rgba(37,99,235,.75), 0 4px 14px rgba(0,0,0,.5); }
  50%,99% { box-shadow: 0 0 0 3px #dc2626, 0 0 20px 8px rgba(220,38,38,.75), 0 4px 14px rgba(0,0,0,.5); }
}
.gta-cop-marker {
  width: 46px; height: 46px; border-radius: 50%;
  background: #0a0a1a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  animation: gta-cop-lights .65s step-end infinite;
}
.gta-cop-inner { display: flex; align-items: center; justify-content: center; }

.cam-marker-wrap { position: relative; display: inline-block; }
@keyframes cam-ripple {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(3.2); opacity: 0;  }
}
@keyframes cam-ripple-fast {
  0%   { transform: scale(1);   opacity: .85; }
  100% { transform: scale(2.6); opacity: 0;   }
}
.cam-approaching::before,
.cam-approaching::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: rgba(245,158,11,.45);
  animation: cam-ripple 1.6s ease-out infinite;
  pointer-events: none;
  z-index: -1;
}
.cam-approaching::after { animation-delay: .8s; }
/* Closer — amber rings speed up */
.cam-mid::before,
.cam-mid::after {
  background: rgba(249,115,22,.55);
  animation: cam-ripple 1s ease-out infinite;
}
.cam-mid::after { animation-delay: .5s; }
/* In capture zone — red urgent rings */
.cam-critical::before,
.cam-critical::after {
  background: rgba(239,68,68,.65);
  animation: cam-ripple-fast .6s ease-out infinite;
  border-radius: 13px;
}
.cam-critical::after { animation-delay: .3s; }

/* ── Floating speed display ──────────────────────── */
#nav-speed-float {
  display: none;
  position: fixed;
  bottom: calc(160px + env(safe-area-inset-bottom));
  left: 16px; z-index: 1100;
  flex-direction: column; align-items: center; gap: 6px;
}
body.navigating #nav-speed-float { display: flex; }
#speed-limit-sign {
  background: #fff; border: 3px solid #dc2626; border-radius: 50%;
  width: 48px; height: 48px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 900; color: #111; line-height: 1;
  transition: background .2s, color .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
#speed-limit-sign.over-limit { background: var(--red); border-color: var(--red); color: #fff; animation: pulse-red .6s ease infinite; }
#current-speed {
  font-size: 3.8rem; font-weight: 900; color: #fff; line-height: 1;
  letter-spacing: -0.05em;
  background: rgba(0,0,0,0.65);
  border-radius: 14px;
  padding: 5px 10px 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
#current-speed.over-limit { color: var(--red); }
#current-speed small {
  font-size: .55rem; font-weight: 700; color: rgba(255,255,255,.7);
  display: block; text-align: center; letter-spacing: 0.12em;
  text-transform: uppercase; margin-top: 2px;
}

/* ── Nav footer ───────────────────────────────── */
#nav-footer {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1000;
  background: var(--surface);
  border-top: 1px solid rgba(148,163,184,.08);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 32px rgba(0,0,0,.6);
}
#nav-eta-block { flex: 1; text-align: center; }
#nav-eta { font-size: 2rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; }
#nav-remaining { font-size: 1.05rem; color: #cbd5e1; margin-top: 3px; font-weight: 700; letter-spacing: -0.01em; }
.nav-footer-icon-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; color: #fff; cursor: pointer;
  width: 46px; height: 46px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.nav-footer-icon-btn:active { background: rgba(255,255,255,.18); }
#end-nav-btn {
  background: rgba(239,68,68,.14); border: 1px solid rgba(239,68,68,.35);
  border-radius: 12px; color: var(--red); cursor: pointer;
  font-size: .85rem; font-weight: 700; padding: 12px 14px; white-space: nowrap;
  letter-spacing: 0.01em; transition: background .15s; flex-shrink: 0;
}
#end-nav-btn:active { background: rgba(239,68,68,.28); }

/* ── Arrival overlay ──────────────────────────── */
#arrival-overlay {
  position: absolute; inset: 0; z-index: 3000;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fadeIn .4s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
#arrival-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 24px; padding: 36px 28px 28px;
  text-align: center; max-width: 320px; width: calc(100% - 40px);
  animation: popIn .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from{transform:scale(.7);opacity:0} to{transform:scale(1);opacity:1} }
#arrival-emoji { font-size: 4rem; line-height: 1; margin-bottom: 12px; }
#arrival-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
#arrival-dest  { font-size: .9rem; color: var(--muted); margin-bottom: 24px; }
#arrival-done  {
  background: var(--accent); border: none; border-radius: 12px;
  color: #fff; cursor: pointer; font-size: .95rem; font-weight: 700;
  padding: 13px 32px; width: 100%;
}

/* ── Settings / Style panel ───────────────────── */
#style-panel { position: absolute; inset: 0; z-index: 2100; display: flex; align-items: flex-end; }
#style-panel-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
#style-sheet {
  position: relative; z-index: 1; width: 100%;
  background: var(--surface); border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  animation: slideUp .22s ease;
  max-height: 80dvh; overflow-y: auto;
}
@keyframes slideUp { from{transform:translateY(100%);opacity:0} to{transform:translateY(0);opacity:1} }
#style-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; font-weight: 700; font-size: 1rem;
}
#style-close {
  background: rgba(255,255,255,.08); border: none; border-radius: 50%;
  color: var(--muted); cursor: pointer; width: 28px; height: 28px; font-size: .8rem;
}
.settings-section-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 10px;
}
#style-grid { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
#style-grid::-webkit-scrollbar { display: none; }
.style-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 2px solid var(--border); border-radius: 12px;
  padding: 8px; cursor: pointer; color: var(--muted); font-size: .73rem;
  min-width: 68px; flex-shrink: 0; transition: border-color .15s, color .15s;
}
.style-btn.active { border-color: var(--accent); color: var(--text); }
.style-thumb { width: 52px; height: 38px; border-radius: 7px; border: 1px solid rgba(255,255,255,.1); }

#settings-toggles { display: flex; flex-direction: column; gap: 0; }
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.04); cursor: pointer;
  font-size: .88rem;
}
.setting-row:last-child { border-bottom: none; }
.setting-row input[type=checkbox] {
  width: 42px; height: 24px; appearance: none; -webkit-appearance: none;
  background: #333; border-radius: 999px; cursor: pointer; position: relative;
  transition: background .2s;
}
.setting-row input[type=checkbox]:checked { background: var(--accent); }
.setting-row input[type=checkbox]::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  top: 3px; left: 3px; transition: left .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.setting-row input[type=checkbox]:checked::after { left: 21px; }

#unit-toggle { display: flex; gap: 8px; }
.unit-btn {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 8px; color: var(--muted); cursor: pointer;
  font-size: .85rem; font-weight: 600; padding: 9px 0;
  transition: background .15s, color .15s, border-color .15s;
}
.unit-btn.active { background: rgba(255,0,153,.15); border-color: var(--accent); color: var(--text); }

#lighting-toggle { display: flex; gap: 8px; }
.lighting-btn {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 8px; color: var(--muted); cursor: pointer;
  font-size: .85rem; font-weight: 600; padding: 9px 0;
  transition: background .15s, color .15s, border-color .15s;
}
.lighting-btn.active { background: rgba(255,0,153,.15); border-color: var(--accent); color: var(--text); }

#install-btn {
  display: block; width: 100%; margin-top: 16px;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); cursor: pointer;
  font-size: .9rem; font-weight: 600; padding: 12px;
  transition: background .15s;
}
#install-btn:hover { background: rgba(255,255,255,.12); }

/* ── Install toast ────────────────────────────── */
#install-toast {
  position: absolute; bottom: 20px; left: 12px; right: 12px; z-index: 1500;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; animation: slideUp .3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
#install-toast-btn {
  background: var(--accent); border: none; border-radius: 8px;
  color: #fff; cursor: pointer; font-size: .8rem; font-weight: 700;
  padding: 7px 14px; white-space: nowrap; flex-shrink: 0;
}
#install-toast-close {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem;
}
#install-toast span { flex: 1; }

/* ── Report FAB — Waze-style yellow ⚠️+ ────────── */
#report-btn {
  position: fixed; z-index: 1010;
  right: 16px;
  bottom: calc(90px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 16px;
  background: #f5b800; border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245,184,0,.45), 0 2px 8px rgba(0,0,0,.4);
  transition: transform .15s;
  display: flex; align-items: center; justify-content: center;
}
body.navigating #report-btn {
  bottom: calc(82px + env(safe-area-inset-bottom)); /* right-side, level with speed display bottom */
}
#report-btn:hover { transform: scale(1.06); }
body.previewing #report-btn { display: none; }
body.navigating #recenter-btn { bottom: calc(152px + env(safe-area-inset-bottom)); } /* above report btn */
#report-btn:active { transform: scale(.93); }

/* ── Re-center button ─────────────────────────── */
#recenter-btn {
  position: fixed; z-index: 1010;
  right: 16px;
  bottom: calc(90px + env(safe-area-inset-bottom));
  background: rgba(13,13,13,.92); border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 14px; color: var(--text); cursor: pointer;
  width: 50px; height: 50px; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}

/* ── Report bottom sheet (Waze-style) ────────── */
#report-sheet {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2000;
  background: #1c1c1e;
  border-radius: 24px 24px 0 0;
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 48px rgba(0,0,0,.85);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(0.32, 0.72, 0, 1);
}
#report-sheet:not(.hidden) { transform: translateY(0); }
.rpt-drag-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.2); margin: 10px auto 14px;
}
.rpt-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.rpt-title { font-size: 1.3rem; font-weight: 800; color: #fff; }
.rpt-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none;
  color: #fff; cursor: pointer; font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
/* Category grid — 3×3 large circles like Waze */
#rpt-categories {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 16px 8px;
  margin-bottom: 12px;
}
.rpt-cat {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer; color: #ccc;
  font-size: .78rem; font-weight: 600; padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}
.rpt-icon {
  width: 68px; height: 68px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
  transition: transform .12s;
}
.rpt-cat:active .rpt-icon { transform: scale(.88); }
/* Sub-type grid */
#rpt-subtypes {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
  margin-bottom: 20px;
}
.rpt-sub {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer; color: #aaa;
  font-size: .78rem; font-weight: 600; padding: 4px 0; position: relative;
}
.rpt-sub-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: #2a2a2a;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  border: 3px solid transparent;
  transition: border-color .15s;
  position: relative;
}
.rpt-sub.selected .rpt-sub-icon {
  border-color: #00cfff;
}
.rpt-sub.selected .rpt-sub-icon::after {
  content: '✓';
  position: absolute; top: -2px; right: -2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #00cfff; color: #000;
  font-size: .7rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.rpt-sub.selected { color: #fff; }
/* Action row */
#rpt-actions { display: flex; gap: 10px; }
#rpt-cancel {
  flex: 1; padding: 15px; border-radius: 99px;
  background: rgba(255,255,255,.08); border: none;
  color: #00cfff; cursor: pointer; font-size: 1rem; font-weight: 700;
}
#rpt-submit {
  flex: 2; padding: 15px; border-radius: 99px;
  background: #00cfff; border: none;
  color: #000; cursor: pointer; font-size: 1rem; font-weight: 900;
  letter-spacing: .02em;
}

/* ── User position arrow (SVG kart easter eggs) ── */
.user-arrow {
  display: block; transform-origin: center;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.9));
  width: auto; height: auto;
  max-width: 90px; max-height: 120px;
}

/* ═══ CSS 3D car system ═══════════════════════════════════════════════ */
/* car3d-wrap MUST NOT have filter — it kills preserve-3d in Chrome/Safari.
   Shadow lives on the img so it composites flat and doesn't break the 3D. */
.car3d-wrap {
  transform-origin: center;
  transform-style: preserve-3d;
  will-change: transform;
}
.car3d-tilt {
  transform-style: preserve-3d;
  will-change: transform;
}
.car3d-body {
  position: relative;
  width: 64px; height: 64px;
  transform-style: preserve-3d;
}
/* Top face — carries the SVG bird's-eye art */
.c3-top {
  position: absolute; inset: 0;
  transform: translateZ(var(--d, 13px));
}
.car3d-img {
  width: 64px; height: 64px;
  object-fit: contain; display: block;
  filter: drop-shadow(0 4px 18px rgba(0,0,0,.9));
}
/* Front face — visible at high map pitch (car nose) */
.c3-front {
  position: absolute;
  width: 64px; height: var(--d, 13px);
  top: 0; left: 0;
  background: var(--front, #111);
  transform-origin: top center;
  transform: rotateX(90deg);
}
.c3-front::before, .c3-front::after {
  content: '';
  position: absolute;
  width: 12px; height: 4px;
  background: rgba(255,252,200,.95);
  bottom: 2px; border-radius: 2px;
  box-shadow: 0 0 8px 2px rgba(255,248,160,.65);
}
.c3-front::before { left: 5px; }
.c3-front::after  { right: 5px; }
/* Rear face — visible in 3D nav (camera behind car) */
.c3-back {
  position: absolute;
  width: 64px; height: var(--d, 13px);
  bottom: 0; left: 0;
  background: var(--back, #0a0a0a);
  transform-origin: bottom center;
  transform: rotateX(-90deg);
}
.c3-back::before, .c3-back::after {
  content: '';
  position: absolute;
  width: 11px; height: 4px;
  background: rgba(220,20,0,.92);
  top: 2px; border-radius: 2px;
  box-shadow: 0 0 7px 2px rgba(200,10,0,.55);
}
.c3-back::before { left: 5px; }
.c3-back::after  { right: 5px; }
/* Side faces */
.c3-side-l, .c3-side-r {
  position: absolute;
  width: var(--d, 13px); height: 64px;
  top: 0;
  background: var(--side, #1a1a1a);
}
.c3-side-l {
  left: 0;
  transform-origin: left center;
  transform: rotateY(90deg);
}
.c3-side-r {
  right: 0;
  transform-origin: right center;
  transform: rotateY(-90deg);
}
/* car picker thumbnail */
.car-pick-img {
  width: 58px; height: 58px;
  object-fit: contain;
  display: block; margin: 0 auto;
}

/* Palestine labels are now handled at the vector tile render level via
   MapLibre GL style expressions — no CSS overlay needed. */

/* ── 2D street name bubbles overlay ───────────── */
#street-labels-overlay {
  position: absolute; inset: 0; z-index: 500;
  pointer-events: none; overflow: hidden;
}
body:not(.nav-3d) #street-labels-overlay { display: none; }
.street-label {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.96);
  color: #0c1526;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(0,0,0,.5), 0 0 0 1px rgba(0,0,0,.06);
}

/* ── Leaflet overrides ────────────────────────── */
/* ── MapLibre GL overrides ────────────────────── */
.maplibregl-map { background: var(--bg); }
.maplibregl-popup-content {
  background: #0f172a; color: var(--text);
  border: 1px solid rgba(255,255,255,.1); border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.7);
  padding: 14px 16px;
}
.maplibregl-popup-tip { border-top-color: #0f172a !important; border-bottom-color: #0f172a !important; }
.maplibregl-popup-content p { margin: 4px 0; font-size: .82rem; color: var(--muted); }
.maplibregl-popup-content strong { display: block; font-size: .95rem; margin-bottom: 4px; }
.maplibregl-popup-close-button { color: rgba(255,255,255,.4); right: 10px; top: 10px; font-size: 1.1rem; background: rgba(255,255,255,.08); border-radius: 50%; width: 24px; height: 24px; line-height: 24px; text-align: center; }
.popup-actions { display: flex; gap: 8px; margin-top: 10px; }
.popup-actions button {
  flex: 1; background: rgba(255,255,255,.07);
  border: 1px solid var(--border); border-radius: 8px;
  color: #ccc; cursor: pointer; font-size: .78rem; padding: 6px 0;
}
.popup-confirm { color: var(--green) !important; }
.popup-deny    { color: var(--red) !important; }
.maplibregl-ctrl-zoom-in,.maplibregl-ctrl-zoom-out,.maplibregl-ctrl-compass {
  background-color: var(--surface) !important; color: var(--text) !important;
  border-color: var(--border) !important;
}
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1); }
.dest-pin { font-size: 2.2rem; line-height: 1; filter: drop-shadow(0 3px 8px rgba(0,0,0,.7)); }

/* ── Compass widget — Waze-style rotating N/S diamond ── */
#compass-widget {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 120px); right: 14px; z-index: 1001;
  width: 52px; height: 52px; cursor: pointer;
  background: rgba(10,10,10,.92); border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: 0 2px 16px rgba(0,0,0,.6);
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
#compass-widget:active { background: rgba(30,30,30,.98); transform: scale(.93); }
body.navigating #compass-widget { top: calc(env(safe-area-inset-top, 0px) + 250px); }
#compass-dial {
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
#compass-svg {
  /* JS rotates this to point N toward true north */
}
#compass-n-label {
  font-family: var(--font); font-size: .48rem; font-weight: 900;
  color: var(--accent); letter-spacing: .05em; line-height: 1; margin-top: -2px;
}

/* ── Avoidance pills ─────────────────────────────── */
#avoid-pills {
  display: flex; gap: 8px; margin-top: 10px; padding-left: 21px;
}
.avoid-pill {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted); cursor: pointer;
  font-size: .75rem; font-weight: 600; padding: 5px 11px;
  transition: background .15s, border-color .15s, color .15s;
}
.avoid-pill.active {
  background: rgba(239,68,68,.18); border-color: var(--red); color: #fca5a5;
}

/* ── Route chips (alt routes) ────────────────────── */
#route-chips {
  display: flex; gap: 8px; padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; overflow-x: auto;
}
#route-chips::-webkit-scrollbar { display: none; }
.route-chip {
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted); cursor: pointer;
  font-size: .73rem; font-weight: 600; padding: 5px 13px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  flex-shrink: 0;
}
.route-chip.selected {
  background: rgba(255,0,153,.22); border-color: var(--accent); color: var(--text);
}

/* ── Preview avoidance note ──────────────────────── */
#preview-avoidance-note {
  font-size: .72rem; color: #f59e0b; margin-top: 4px;
}

/* ── Share button ────────────────────────────────── */
#share-route-btn {
  padding: 15px 14px; border-radius: 99px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7); cursor: pointer;
  font-size: .88rem; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  transition: background .15s;
}
#share-route-btn:active { background: rgba(255,255,255,.14); }

/* ── Speed profile strip ─────────────────────────── */
#speed-profile {
  padding: 6px 16px 4px; flex-shrink: 0; position: relative;
  border-bottom: 1px solid var(--border);
}
#speed-profile-bar {
  display: flex; height: 20px; border-radius: 4px; overflow: hidden;
}
.sp-seg {
  height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: .55rem; font-weight: 700; color: rgba(255,255,255,.85);
  overflow: hidden; flex-shrink: 0; transition: opacity .15s;
}
#speed-profile-legend {
  display: flex; gap: 10px; margin-top: 5px; flex-wrap: wrap;
}
.sp-legend-item { display: flex; align-items: center; gap: 3px; font-size: .62rem; color: var(--muted); }
.sp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
#speed-profile-cursor {
  position: absolute; top: 6px; width: 3px; height: 20px;
  background: rgba(255,255,255,.9); border-radius: 2px;
  pointer-events: none; transition: left .2s;
  box-shadow: 0 0 4px rgba(255,255,255,.5);
}

/* ── North-up button (in nav footer) ────────────── */

/* ── Toast ───────────────────────────────────────── */
#toast {
  position: absolute; bottom: calc(90px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: 2000; background: rgba(20,20,28,.97);
  border: 1px solid rgba(255,255,255,.12); border-radius: 22px;
  padding: 11px 20px; font-size: .85rem; font-weight: 600; white-space: nowrap;
  animation: slideUp .2s ease;
  box-shadow: 0 4px 24px rgba(0,0,0,.6);
  pointer-events: none;
}
body.navigating #toast { bottom: calc(120px + env(safe-area-inset-bottom)); }

/* ── Near-me chips ───────────────────────────────── */
#nearme-chips {
  display: flex; gap: 8px; padding: 8px 10px 4px; flex-wrap: wrap;
}
.nearme-chip {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); cursor: pointer;
  font-size: .78rem; padding: 6px 12px;
  transition: background .15s;
}
.nearme-chip:hover { background: rgba(255,255,255,.12); }

/* ── Idle bottom bar (Waze-style) ──────────────── */
#idle-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 950;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 6px 14px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 32px rgba(0,0,0,0.65);
  border-top: 1px solid rgba(255,255,255,0.06);
  touch-action: pan-down;
}
body.navigating #idle-bar { display: none; }
body.searching #idle-bar { display: none; }
body.previewing #idle-bar { display: none; }

/* ── Shared wayfinding footer (theradicalparty.com/footer.js, pill mode) ──
   It injects a fixed bottom-right badge at max z-index. On this full-screen
   app that badge covered the End button during nav and the bottom sheet on
   idle. Hide it whenever the screen is busy; on idle, lift it above the bar.
   The transform makes #radical-footer-root the containing block for the
   pill's own position:fixed, so `bottom` here actually moves it. */
#radical-footer-root {
  position: fixed !important;
  left: 0 !important; right: 0 !important;   /* full-width containing block so the pill doesn't wrap */
  top: calc(env(safe-area-inset-top, 0px) + 195px) !important;  /* top-right, below the toolbar */
  bottom: auto !important;
  height: 0 !important;                       /* zero-height strip blocks no map touches */
  transform: translateZ(0) !important;        /* become the containing block for the pill's fixed pos */
  z-index: 940 !important;
}
body.navigating #radical-footer-root,
body.searching  #radical-footer-root,
body.previewing #radical-footer-root { display: none !important; }
.handle-row { display:flex; justify-content:center; padding: 0 0 8px; }
#idle-row { display: flex; gap: 10px; align-items: center; }
#idle-search-btn {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; color: var(--muted); cursor: pointer;
  font-size: 1rem; font-weight: 500; padding: 14px 16px;
  text-align: left;
}
#idle-search-btn:active { background: rgba(255,255,255,0.12); }
#idle-settings-btn {
  width: 50px; height: 50px; flex-shrink: 0;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#idle-settings-btn:active { background: rgba(255,255,255,0.14); }

/* ── Alert bar urgency states ──────────────────── */
#alert-bar[data-urgency="medium"] { border-color: var(--amber); }
#alert-bar[data-urgency="high"] { border-color: #ff8c00; background: #1c1008; }
#alert-bar[data-urgency="critical"] { border-color: var(--red); background: #1a0808; animation: pulse-red .4s ease infinite; }

/* ── Speed danger animation ────────────────────── */
@keyframes speed-danger { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }
#current-speed.over-limit { color: var(--red); animation: speed-danger .5s ease infinite; }
#current-speed.way-over { animation: speed-danger .3s ease infinite; }

/* ── Street name pill ──────────────────────────── */
#street-pill {
  position: absolute; z-index: 900;
  left: 88px; right: 64px;
  bottom: calc(115px + env(safe-area-inset-bottom));
  background: rgba(10,10,10,0.88);
  border-radius: 20px; padding: 8px 14px;
  font-size: .88rem; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
body:not(.navigating) #street-pill { display: none; }

/* ── Mid-nav search sheet ────────────────────────── */
#nav-search-sheet {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2100;
  background: #1c1c1e; border-radius: 24px 24px 0 0;
  padding: 0 0 calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 48px rgba(0,0,0,.85);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(0.32,0.72,0,1);
  max-height: 80dvh; display: flex; flex-direction: column;
}
#nav-search-sheet:not(.hidden) { transform: translateY(0); }
#nss-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 12px;
}
#nss-mode-tabs { display: flex; gap: 8px; }
.nss-tab {
  background: rgba(255,255,255,.08); border: 1px solid transparent;
  border-radius: 20px; color: var(--muted); cursor: pointer;
  font-size: .8rem; font-weight: 700; padding: 7px 14px;
  transition: all .15s; font-family: inherit;
}
.nss-tab.active { background: rgba(255,0,153,.18); border-color: var(--accent); color: #fff; }
#nss-input {
  margin: 0 16px 10px; padding: 12px 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; color: #fff; font-size: 1rem; font-family: inherit;
  outline: none; flex-shrink: 0;
}
#nss-input:focus { border-color: var(--accent); }
#nss-results { flex: 1; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.nss-result {
  padding: 13px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  cursor: pointer;
}
.nss-result:active { background: rgba(255,255,255,.07); }
.nss-result-name { font-size: .92rem; font-weight: 700; color: var(--text); }
.nss-result-sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.nss-empty { padding: 20px 16px; color: var(--muted); font-size: .9rem; text-align: center; }

/* ── Mid-nav routes sheet ────────────────────────── */
#nav-routes-sheet {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2100;
  background: #1c1c1e; border-radius: 24px 24px 0 0;
  padding: 0 0 calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 48px rgba(0,0,0,.85);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(0.32,0.72,0,1);
  max-height: 65dvh;
}
#nav-routes-sheet:not(.hidden) { transform: translateY(0); }
#nrs-list { padding: 0 16px 4px; }
.nrs-route {
  padding: 14px 16px; margin-bottom: 8px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; cursor: pointer; transition: all .15s;
}
.nrs-route.active { background: rgba(255,0,153,.12); border-color: var(--accent); }
.nrs-route:active { background: rgba(255,255,255,.1); }
.nrs-route-top { display: flex; align-items: center; justify-content: space-between; }
.nrs-label { font-size: 1rem; font-weight: 800; color: #fff; }
.nrs-badge {
  font-size: .72rem; font-weight: 700; padding: 3px 9px;
  background: var(--accent); color: #fff; border-radius: 99px;
}
.nrs-meta { font-size: .8rem; color: var(--muted); margin-top: 5px; }

/* ═══════════════════════════════════════════════
   GTA MODE
═══════════════════════════════════════════════ */

/* ── HUD: stars + score ─────────────────────── */
/* ── Wanted Level HUD — permanent top-right, GTA V style ── */
#gta-hud {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 70px); /* below topbar (~58px) */
  right: 10px;
  z-index: 1005;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  background: rgba(0,0,0,0.60);
  border-radius: 12px;
  padding: 6px 10px 5px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: opacity .5s, background .5s, border-color .5s;
}
/* During nav: push below nav instruction + alert bar zone */
body.navigating #gta-hud {
  top: calc(env(safe-area-inset-top, 0px) + 182px);
  z-index: 900; /* behind alert bar (999) so safety info wins */
}
/* 0 stars — faint ghost outline, no panel */
#gta-hud[data-stars="0"] {
  background: transparent;
  border-color: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: none;
  opacity: 0.18;
}
#gta-stars-row { display: flex; gap: 5px; }
.gta-star {
  font-size: 1.7rem; line-height: 1;
  color: rgba(255,255,255,0.14);
  transition: color .25s, text-shadow .25s, transform .15s;
  display: inline-block;
}
.gta-star.active {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255,215,0,1), 0 0 24px rgba(255,215,0,.55);
}
.gta-star.pulse { animation: star-pulse .35s ease; }
@keyframes star-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.75); filter: brightness(2.5); }
  100% { transform: scale(1); filter: brightness(1); }
}
#gta-score-display {
  font-size: .72rem; font-weight: 800; color: #ffd700;
  letter-spacing: .04em; opacity: 0;
  transition: opacity .3s;
}
#gta-hud:not([data-stars="0"]) #gta-score-display { opacity: 1; }

/* ── Floating score popups ──────────────────── */
.gta-score-popup {
  position: fixed; z-index: 2000; pointer-events: none;
  font-size: 1.1rem; font-weight: 900; letter-spacing: .02em;
  text-shadow: 0 2px 8px rgba(0,0,0,.8);
  animation: score-float 1.4s ease forwards;
}
@keyframes score-float {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-50px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-80px) scale(.9); }
}

/* ── WANTED banner ──────────────────────────── */
#gta-wanted-banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1050;
  background: rgba(180,0,0,.92);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  animation: wanted-slide .3s ease;
  border-bottom: 2px solid #ff4444;
  backdrop-filter: blur(4px);
}
@keyframes wanted-slide {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
#gta-wanted-text {
  font-size: 1rem; font-weight: 900; color: #fff;
  letter-spacing: .25em; text-shadow: 0 0 20px rgba(255,100,100,.8);
}
#gta-wanted-stars {
  font-size: 1.3rem; letter-spacing: 3px;
  color: #ffd700; text-shadow: 0 0 10px #ffd700, 0 0 20px rgba(255,215,0,.5);
}

/* ── BUSTED overlay ─────────────────────────── */
#gta-busted-overlay {
  position: absolute; inset: 0; z-index: 3500;
  background: rgba(200,0,0,.0);
  display: flex; align-items: center; justify-content: center;
  animation: busted-anim 2.2s ease forwards;
  pointer-events: none;
}
@keyframes busted-anim {
  0%   { background: rgba(200,0,0,0); }
  15%  { background: rgba(200,0,0,.85); }
  40%  { background: rgba(200,0,0,.7); }
  85%  { background: rgba(200,0,0,.5); }
  100% { background: rgba(200,0,0,0); }
}
#gta-busted-text {
  font-size: 3.2rem; font-weight: 900; color: #fff;
  letter-spacing: .15em;
  text-shadow: 0 0 40px rgba(255,100,100,1), 0 4px 0 rgba(0,0,0,.5);
  animation: busted-text 2.2s ease forwards;
}
@keyframes busted-text {
  0%   { opacity: 0; transform: scale(.4); }
  20%  { opacity: 1; transform: scale(1.15); }
  35%  { transform: scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── EVADED overlay ─────────────────────────── */
#gta-evaded-overlay {
  position: absolute; inset: 0; z-index: 3500;
  display: flex; align-items: center; justify-content: center;
  animation: evaded-anim 1.8s ease forwards;
  pointer-events: none;
}
@keyframes evaded-anim {
  0%   { background: rgba(0,180,0,0); }
  15%  { background: rgba(0,180,0,.7); }
  80%  { background: rgba(0,180,0,.3); }
  100% { background: rgba(0,180,0,0); }
}
#gta-evaded-overlay div {
  font-size: 2.8rem; font-weight: 900; color: #fff;
  letter-spacing: .1em;
  text-shadow: 0 0 30px rgba(0,255,0,1), 0 4px 0 rgba(0,0,0,.5);
  animation: evaded-text 1.8s ease forwards;
}
@keyframes evaded-text {
  0%   { opacity: 0; transform: scale(.5); }
  20%  { opacity: 1; transform: scale(1.1); }
  35%  { transform: scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Car picker grid ────────────────────────── */
#car-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-top: 4px;
}
.car-pick-btn {
  background: rgba(255,255,255,.06); border: 2px solid rgba(255,255,255,.1);
  border-radius: 14px; padding: 10px 6px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all .15s; color: var(--muted); font-size: .72rem; font-weight: 700;
}
.car-pick-btn.active {
  border-color: var(--accent); background: rgba(255,0,153,.14); color: #fff;
}
.car-pick-btn:active { transform: scale(.95); }
.car-pick-preview {
  font-size: 2rem; line-height: 1; height: 54px; width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.car-pick-preview .car-pick-img {
  width: 100%; height: 54px; object-fit: contain; display: block; margin: 0;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.5));
}

/* ── Congestion "hue lights" — screen-edge glow inside a jam ─────── */
#congestion-glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 1500;
  opacity: 0; transition: opacity .6s ease;
  box-shadow: inset 0 0 100px 22px rgba(220,38,38,0);
}
#congestion-glow.on { opacity: 1; animation: congestionPulse 1.8s ease-in-out infinite; }
#congestion-glow.slow  { box-shadow: inset 0 0 84px 16px rgba(249,115,22,.55); }
#congestion-glow.heavy { box-shadow: inset 0 0 120px 28px rgba(220,38,38,.72); }
@keyframes congestionPulse { 0%,100% { opacity:.5 } 50% { opacity:1 } }

/* ── 3D showroom (garage) ───────────────────────── */
#car-showroom {
  position: relative; margin: 6px 0 12px;
  height: 190px; border-radius: 16px;
  background: radial-gradient(circle at 50% 120%, rgba(255,0,153,.16), transparent 60%), #0c1220;
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden; touch-action: pan-y;
}
#car-showroom-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
#car-showroom-canvas:active { cursor: grabbing; }
#car-showroom-name {
  position: absolute; left: 12px; bottom: 10px;
  font-weight: 900; font-size: 1rem; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.8); letter-spacing: -.01em;
  pointer-events: none;
}
#car-showroom::after {
  content: '↻ drag to spin'; position: absolute; right: 12px; bottom: 12px;
  font-size: .62rem; font-weight: 700; color: rgba(255,255,255,.4);
  letter-spacing: .04em; pointer-events: none;
}

/* ── Score submit + Leaderboard modals ───────── */
#score-modal, #lb-modal {
  position: absolute; inset: 0; z-index: 4000;
  background: rgba(0,0,0,.75); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
#score-modal-card, #lb-card {
  background: #111827; border: 1px solid rgba(251,191,36,.3);
  border-radius: 20px; padding: 24px; width: min(340px, 90vw);
  box-shadow: 0 8px 48px rgba(0,0,0,.8), 0 0 60px rgba(251,191,36,.1);
}
#score-modal-title { font-size: 1.3rem; font-weight: 900; color: #fbbf24; text-align: center; margin-bottom: 12px; }
#score-modal-score { font-size: 2.4rem; font-weight: 900; color: #fff; text-align: center; letter-spacing: -0.03em; }
#score-modal-stars { text-align: center; font-size: 1.4rem; margin: 6px 0 16px; letter-spacing: 3px; }
#score-modal-nick {
  width: 100%; box-sizing: border-box; padding: 12px 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; color: #fff; font-size: 1rem; font-family: inherit;
  outline: none; margin-bottom: 14px;
}
#score-modal-nick:focus { border-color: #fbbf24; }
#score-modal-btns { display: flex; gap: 10px; }
#score-modal-skip {
  flex: 1; padding: 12px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  color: var(--muted); cursor: pointer; font-family: inherit; font-weight: 700;
}
#score-modal-submit {
  flex: 2; padding: 12px; background: rgba(251,191,36,.2);
  border: 1px solid rgba(251,191,36,.5); border-radius: 10px;
  color: #fbbf24; cursor: pointer; font-family: inherit; font-weight: 800;
}
#lb-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 1.1rem; font-weight: 900; color: #fbbf24; margin-bottom: 16px;
}
#lb-close {
  background: rgba(255,255,255,.1); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: .9rem;
}
#lb-list { max-height: 55vh; overflow-y: auto; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.lb-rank { font-size: 1rem; font-weight: 900; color: var(--muted); width: 28px; flex-shrink: 0; text-align: center; }
.lb-rank.gold   { color: #fbbf24; }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #d97706; }
.lb-name { flex: 1; font-weight: 700; color: #fff; font-size: .92rem; }
.lb-stars { font-size: .85rem; letter-spacing: 1px; }
.lb-score { font-weight: 900; color: #fbbf24; font-size: .95rem; }
.lb-loading { text-align: center; padding: 20px; color: var(--muted); }

/* ═══════════════════════════════════════════════
   COP WATCH
═══════════════════════════════════════════════ */

/* ── FAB ────────────────────────────────────── */
#cw-fab {
  position: fixed; z-index: 1010;
  left: 16px; bottom: calc(170px + env(safe-area-inset-bottom));
  width: 52px; height: 52px; border-radius: 15px;
  background: #1e40af; border: none; color: #93c5fd;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(30,64,175,.6), 0 2px 8px rgba(0,0,0,.4);
  transition: transform .15s;
}
#cw-fab:active { transform: scale(.93); }
/* During nav the left side is occupied by the tall speed float (limit sign + big
   speed number), so move Cop Watch to the right column, stacked above recenter. */
body.navigating #cw-fab {
  left: auto; right: 16px;
  bottom: calc(222px + env(safe-area-inset-bottom));
}

/* ── Submission sheet ───────────────────────── */
#cw-sheet {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2200;
  background: #1c1c1e; border-radius: 24px 24px 0 0;
  padding: 0 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 48px rgba(0,0,0,.85);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(0.32,0.72,0,1);
  max-height: 90dvh; overflow-y: auto;
}
#cw-sheet:not(.hidden) { transform: translateY(0); }

#cw-types {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.cw-type-btn {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px; color: var(--muted); cursor: pointer;
  font-size: .78rem; font-weight: 700; padding: 7px 13px;
  font-family: inherit; transition: all .15s;
}
.cw-type-btn.active {
  background: rgba(59,130,246,.2); border-color: #3b82f6; color: #93c5fd;
}

.cw-field { margin-bottom: 14px; }
.cw-label {
  display: block; font-size: .78rem; font-weight: 700;
  color: rgba(255,255,255,.5); margin-bottom: 6px; letter-spacing: .04em;
}
.cw-optional { color: rgba(251,191,36,.7); font-weight: 600; }

#cw-plate {
  width: 100%; box-sizing: border-box; padding: 12px 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; color: #fff; font-size: 1.1rem; font-weight: 800;
  font-family: inherit; letter-spacing: .12em; text-transform: uppercase; outline: none;
}
#cw-plate:focus { border-color: #3b82f6; }

#cw-notes {
  width: 100%; box-sizing: border-box; padding: 10px 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; color: #fff; font-size: .9rem; font-family: inherit;
  resize: none; outline: none;
}
#cw-notes:focus { border-color: #3b82f6; }

#cw-photo-area {
  background: rgba(255,255,255,.04); border: 1.5px dashed rgba(255,255,255,.2);
  border-radius: 12px; padding: 14px; text-align: center;
}
#cw-photo-btns { display: flex; gap: 10px; justify-content: center; }
.cw-photo-label {
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; color: #fff; cursor: pointer; font-family: inherit;
  font-size: .85rem; font-weight: 700; padding: 10px 16px;
  display: inline-flex; align-items: center; gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.cw-photo-label:active { background: rgba(255,255,255,.18); }
.cw-photo-label input[type="file"] { display: none; }
#cw-photo-preview { position: relative; display: flex; justify-content: center; }
#cw-preview-img { max-height: 160px; border-radius: 10px; object-fit: cover; }
#cw-photo-clear {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.7); border: none; color: #fff;
  border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: .85rem;
}

#cw-pts-preview {
  font-size: .8rem; color: #fbbf24; font-weight: 700;
  text-align: center; margin-bottom: 12px;
}

#cw-submit {
  width: 100%; padding: 15px; border-radius: 14px;
  background: linear-gradient(135deg,#1e40af,#1d4ed8);
  border: 1px solid rgba(96,165,250,.4); color: #fff;
  font-size: 1rem; font-weight: 800; cursor: pointer; font-family: inherit;
  box-shadow: 0 4px 20px rgba(30,64,175,.5);
}
#cw-submit:active { transform: scale(.98); }

/* ── Gallery / feed ─────────────────────────── */
#cw-gallery {
  position: absolute; inset: 0; z-index: 2500;
  background: rgba(0,0,0,.75); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
#cw-gallery-card {
  background: #111827; border: 1px solid rgba(96,165,250,.25);
  border-radius: 20px; width: min(360px,94vw); max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 48px rgba(0,0,0,.8);
}
#cw-gallery-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 18px 12px; font-weight: 900; color: #60a5fa; font-size: 1.05rem;
  flex-shrink: 0;
}
#cw-gallery-close {
  background: rgba(255,255,255,.1); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: .9rem;
}
#cw-search-bar {
  display: flex; gap: 8px; padding: 0 16px 12px; flex-shrink: 0;
}
#cw-plate-search {
  flex: 1; padding: 9px 12px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px; color: #fff; font-family: inherit; font-size: .9rem;
  letter-spacing: .08em; text-transform: uppercase; outline: none;
}
#cw-plate-search-btn {
  padding: 9px 14px; background: rgba(59,130,246,.2);
  border: 1px solid rgba(59,130,246,.4); border-radius: 8px;
  color: #60a5fa; font-weight: 700; font-family: inherit; cursor: pointer;
}
#cw-feed { flex: 1; overflow-y: auto; padding: 0 12px 12px; }
.cw-entry {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; padding: 12px; margin-bottom: 10px;
}
.cw-entry-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cw-entry-plate {
  font-size: 1rem; font-weight: 900; color: #fff;
  background: rgba(30,64,175,.4); border-radius: 6px; padding: 3px 10px;
  letter-spacing: .1em;
}
.cw-entry-type { font-size: .78rem; color: #60a5fa; font-weight: 700; }
.cw-entry-time { font-size: .72rem; color: var(--muted); margin-left: auto; }
.cw-entry-photo { width: 100%; border-radius: 10px; margin-bottom: 8px; max-height: 200px; object-fit: cover; cursor: pointer; }
.cw-entry-desc { font-size: .82rem; color: rgba(255,255,255,.7); margin-bottom: 8px; }
.cw-entry-footer { display: flex; align-items: center; gap: 10px; }
.cw-confirm-btn {
  background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.3);
  border-radius: 8px; color: #60a5fa; cursor: pointer; font-family: inherit;
  font-size: .78rem; font-weight: 700; padding: 5px 12px;
}
.cw-confirms { font-size: .78rem; color: var(--muted); }

/* ── Cop watch map marker ────────────────────── */
.cw-map-marker {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(30,64,175,.9); border: 2px solid #60a5fa;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  box-shadow: 0 3px 12px rgba(30,64,175,.6);
  transition: transform .15s;
}
.cw-map-marker:active { transform: scale(.9); }

/* ── Traffic camera sheet ───────────────────── */
#cam-sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 420;
  background: var(--panel-bg, #13131f);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 -4px 32px rgba(0,0,0,.5);
  padding: 0 0 env(safe-area-inset-bottom,12px);
  max-height: 70vh; display: flex; flex-direction: column;
  transition: max-height .28s cubic-bezier(0.32,0.72,0,1);
}
#cam-sheet .handle-row {
  cursor: grab; touch-action: none;
}
#cam-sheet .handle-row:active { cursor: grabbing; }
#cam-sheet-header {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px 8px; flex-shrink: 0;
}
#cam-sheet-info { flex: 1; min-width: 0; }
#cam-sheet-title { font-size: 1rem; font-weight: 700; color: #e2e8f0; }
#cam-sheet-view  { font-size: .78rem; color: #64748b; margin-top: 2px; }
#cam-grid-open-btn, #cam-sheet-close {
  background: rgba(255,255,255,.06); border: none; border-radius: 8px;
  color: #94a3b8; font-size: 1rem; padding: 6px 10px; cursor: pointer; flex-shrink: 0;
}
#cam-grid-open-btn:hover, #cam-sheet-close:hover { background: rgba(255,255,255,.12); color: #e2e8f0; }
#cam-img-wrap {
  flex: 1; overflow: hidden; position: relative; background: #0a0a14;
  min-height: 160px;
}
#cam-img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  max-height: calc(70vh - 120px);
}
#cam-unavail {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #475569; font-size: .85rem;
}
#cam-refresh-bar {
  flex-shrink: 0; padding: 8px 16px; font-size: .75rem; color: #475569;
  border-top: 1px solid rgba(255,255,255,.05); background: rgba(0,0,0,.2);
}
#cam-refresh-icon { margin-right: 4px; }

/* ── Camera grid panel ──────────────────────── */
#cam-grid-panel {
  position: fixed; inset: 0; z-index: 430;
  background: #0a0a14; display: flex; flex-direction: column;
}
#cam-grid-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 1rem; font-weight: 700; color: #e2e8f0; flex-shrink: 0;
  /* push below topbar (~58px) + safe area */
  padding-top: calc(env(safe-area-inset-top, 0px) + 68px);
}
#cam-grid-close {
  background: rgba(255,255,255,.08); border: none; border-radius: 8px;
  color: #94a3b8; font-size: 1rem; padding: 6px 12px; cursor: pointer;
}
#cam-grid-scroll { flex: 1; overflow-y: auto; padding: 12px; }
#cam-grid-items {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.cam-thumb {
  background: #13131f; border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px; overflow: hidden; cursor: pointer; transition: border-color .15s;
}
.cam-thumb:hover { border-color: rgba(56,189,248,.4); }
.cam-thumb-img-wrap {
  position: relative; background: #0a0a14; aspect-ratio: 4/3; overflow: hidden;
}
.cam-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-thumb-spinner {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 1.2rem; color: #334155;
}
.cam-thumb-spinner.hidden { display: none; }
.cam-thumb-title { font-size: .75rem; font-weight: 600; color: #cbd5e1; padding: 6px 8px 2px; }
.cam-thumb-view  { font-size: .65rem; color: #475569; padding: 0 8px 8px; line-height: 1.3; }

/* ── Pigs banner ─────────────────────────────── */
#pigs-banner {
  position: fixed; top: 58px; left: 50%; transform: translateX(-50%);
  background: rgba(20,0,0,.92); color: #ff4444; border: 1px solid rgba(255,68,68,.4);
  padding: 7px 18px; border-radius: 20px; font-size: .82rem; font-weight: 600;
  z-index: 500; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 20px rgba(255,40,40,.3);
  backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════════════
   ACCELERATION TIMER HUD
═══════════════════════════════════════════════ */
#accel-timer {
  position: fixed; z-index: 950;
  top: calc(env(safe-area-inset-top, 0px) + 158px); left: 10px;
  min-width: 104px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 11px 6px;
  background: rgba(8,8,14,.72);
  border: 1px solid rgba(255,255,255,.10);
  border-left: 3px solid #38bdf8;
  border-radius: 12px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  transition: border-color .2s, background .2s;
}
#accel-timer.accel-armed { border-left-color: #64748b; opacity: .82; }
#accel-timer.accel-armed .accel-time { color: rgba(255,255,255,.82); }
#accel-timer.accel-live  { border-left-color: #fbbf24; opacity: 1; }
#accel-timer.accel-done  { border-left-color: #38bdf8; }
#accel-timer.accel-best  { border-left-color: #22c55e; animation: accel-flash .5s ease 3; }
@keyframes accel-flash { 0%,100%{background:rgba(8,8,14,.72)} 50%{background:rgba(34,197,94,.35)} }
.accel-range { font-size: .58rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.6); }
.accel-time  { font-size: 1.7rem; font-weight: 900; color: #fff; line-height: 1; letter-spacing: -.03em; }
.accel-time small { font-size: .7rem; font-weight: 700; color: rgba(255,255,255,.6); margin-left: 1px; }
.accel-tag   { font-size: .58rem; font-weight: 800; letter-spacing: .04em; color: #22c55e; margin-top: 1px; }
.accel-live .accel-tag { color: rgba(255,255,255,.5); }

/* Accel range picker (settings) */
#accel-range-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.accel-range-btn {
  padding: 10px 4px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.8); font-weight: 800; font-size: .82rem; font-family: inherit;
}
.accel-range-btn.active { background: rgba(56,189,248,.18); border-color: #38bdf8; color: #7dd3fc; }

/* ═══════════════════════════════════════════════
   ARRIVAL ROAST
═══════════════════════════════════════════════ */
#arrival-roast { margin: 6px 0 4px; }
#arrival-roast .roast-line {
  font-size: 1.15rem; font-weight: 900; color: #ff2ec4;
  text-shadow: 0 0 18px rgba(255,46,196,.5); letter-spacing: .01em;
}
#arrival-roast .roast-sub {
  font-size: .8rem; font-weight: 600; color: rgba(255,255,255,.55); margin-top: 3px;
}

/* ═══════════════════════════════════════════════
   ACCOUNTS
═══════════════════════════════════════════════ */
#account-box { margin-top: 4px; }
.acct-btn-primary {
  width: 100%; padding: 13px; border-radius: 12px; cursor: pointer;
  background: rgba(56,189,248,.14); border: 1px solid rgba(56,189,248,.4);
  color: #7dd3fc; font-weight: 800; font-size: .95rem; font-family: inherit;
}
.acct-signed { display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: 11px 13px; }
.acct-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-name  { font-weight: 900; font-size: .98rem; color: #fff; }
.acct-score { font-size: .74rem; color: #fbbf24; font-weight: 700; }
.acct-btn-sm {
  padding: 8px 12px; border-radius: 10px; cursor: pointer; flex-shrink: 0;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.75); font-weight: 700; font-size: .8rem; font-family: inherit;
}

#account-modal {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(0,0,0,.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
#am-card {
  width: 100%; max-width: 360px;
  background: #14141c; border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px; padding: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  display: flex; flex-direction: column; gap: 12px;
}
#am-header { display: flex; align-items: center; justify-content: space-between; }
#am-title { font-size: 1.25rem; font-weight: 900; color: #fff; }
#am-close { background: none; border: none; color: rgba(255,255,255,.6);
  font-size: 1.3rem; cursor: pointer; line-height: 1; }
#account-modal input {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  color: #fff; font-size: .95rem; font-family: inherit; outline: none;
}
#account-modal input:focus { border-color: #38bdf8; }
#am-error { color: #f87171; font-size: .82rem; font-weight: 600; min-height: 1px; }
#am-submit {
  width: 100%; padding: 14px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(145deg,#38bdf8,#0ea5e9); border: none;
  color: #04121e; font-weight: 900; font-size: 1rem; font-family: inherit;
}
#am-submit:disabled { opacity: .6; }
#am-switch { text-align: center; font-size: .85rem; color: rgba(255,255,255,.6); }
.am-link { background: none; border: none; color: #7dd3fc; font-weight: 800;
  cursor: pointer; font-family: inherit; font-size: .85rem; }

#score-modal-banked { font-size: .95rem; color: #fff; margin: 6px 0 2px; min-height: 1.1em; }

/* ═══════════════════════════════════════════════
   GAME — recording, replays, daily challenges
═══════════════════════════════════════════════ */
/* Record FAB */
#rec-fab {
  position: fixed; z-index: 1010; right: 16px;
  bottom: calc(156px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 16px;
  background: rgba(13,13,13,.92); border: 1.5px solid rgba(255,255,255,.15);
  color: #fff; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0,0,0,.5); transition: transform .15s;
}
#rec-fab.rec-unsupported { display: none; }
#rec-dot { width: 16px; height: 16px; border-radius: 50%; background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.25); transition: border-radius .2s; }
#rec-time { font-size: .62rem; font-weight: 800; color: #fca5a5; display: none; }
#rec-fab:active { transform: scale(.93); }
body.recording #rec-dot { border-radius: 4px; animation: recPulse 1.2s ease-in-out infinite; }
body.recording #rec-time { display: block; }
body.recording #rec-fab { border-color: rgba(239,68,68,.7); background: rgba(60,10,10,.92); }
@keyframes recPulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
body.navigating #rec-fab { bottom: calc(292px + env(safe-area-inset-bottom)); }
body.previewing #rec-fab { display: none; }

/* Daily button badge + streak chip */
.daily-badge { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px; padding: 2px 9px; font-size: .78rem; font-weight: 900; color: #fff; }
.daily-badge.complete { background: rgba(34,197,94,.35); color: #4ade80; border-color: rgba(34,197,94,.5); }
#daily-streak-chip { position: absolute; right: 68px; top: 50%; transform: translateY(-50%);
  font-size: .82rem; font-weight: 900; color: #fb923c; }
#daily-streak-chip.hidden { display: none; }

/* Toast */
#game-toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 66px);
  transform: translate(-50%,-16px); z-index: 5000; max-width: 88vw;
  background: rgba(17,24,39,.96); border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 11px 16px; color: #fff; font-size: .86rem; font-weight: 700;
  box-shadow: 0 10px 40px rgba(0,0,0,.6); opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .3s ease; text-align: center; }
#game-toast.show { opacity: 1; transform: translate(-50%,0); }
.toast-coin { color: #fbbf24; font-weight: 900; margin-left: 4px; }

/* Generic game modal */
.game-modal { position: absolute; inset: 0; z-index: 4000; background: rgba(0,0,0,.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; }
.game-modal.hidden { display: none; }
.game-card { background: #111827; border: 1px solid rgba(255,255,255,.12); border-radius: 20px;
  padding: 20px; width: min(380px,92vw); max-height: 82vh; overflow-y: auto;
  box-shadow: 0 8px 48px rgba(0,0,0,.8); }
.game-card-head { display: flex; align-items: center; justify-content: space-between;
  font-size: 1.15rem; font-weight: 900; color: #fff; margin-bottom: 14px; }
.game-close { background: rgba(255,255,255,.08); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 10px; font-size: 1rem; cursor: pointer; }

/* Daily challenges */
.daily-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.daily-streak { display: flex; align-items: baseline; gap: 6px; }
.ds-flame { font-size: 1.5rem; } .ds-num { font-size: 1.9rem; font-weight: 900; color: #fb923c; }
.ds-lbl { font-size: .8rem; color: #9ca3af; }
.daily-coins { font-size: 1.05rem; font-weight: 900; color: #fbbf24; }
.daily-sub { font-size: .76rem; color: #9ca3af; margin-bottom: 12px; }
.chal-row { display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,.07); }
.chal-emoji { font-size: 1.5rem; width: 30px; text-align: center; }
.chal-main { flex: 1; min-width: 0; }
.chal-label { font-size: .9rem; font-weight: 800; color: #fff; margin-bottom: 6px; }
.chal-bar { height: 7px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.chal-bar span { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg,#22c55e,#4ade80); transition: width .4s ease; }
.chal-val { font-size: .74rem; font-weight: 800; color: #9ca3af; white-space: nowrap; }
.chal-row.done .chal-val { color: #4ade80; }

/* Replays */
.replays-empty { text-align: center; color: #9ca3af; font-size: .9rem; padding: 34px 10px; line-height: 1.6; }
.replay-card { display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,.07); }
.replay-thumb { position: relative; width: 92px; height: 56px; border-radius: 10px;
  background: #0c1220 center/cover no-repeat; flex-shrink: 0; cursor: pointer; overflow: hidden; }
.replay-dur { position: absolute; right: 4px; bottom: 3px; background: rgba(0,0,0,.7);
  color: #fff; font-size: .62rem; font-weight: 800; padding: 1px 5px; border-radius: 5px; }
.replay-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.4rem; text-shadow: 0 2px 6px rgba(0,0,0,.8); }
.replay-info { flex: 1; min-width: 0; }
.replay-title { font-size: .9rem; font-weight: 800; color: #fff; }
.replay-meta { font-size: .72rem; color: #9ca3af; margin-top: 3px; }
.replay-actions { display: flex; flex-direction: column; gap: 4px; }
.replay-actions button { background: rgba(255,255,255,.08); border: none; border-radius: 8px;
  width: 30px; height: 26px; cursor: pointer; font-size: .8rem; }

/* Video player */
.video-wrap { position: relative; width: min(92vw,520px); }
#video-player { width: 100%; border-radius: 14px; background: #000; max-height: 80vh; display: block; }
#video-modal .game-close { position: absolute; top: -42px; right: 0; }

/* ═══════════════════════════════════════════════
   RACE MODE
═══════════════════════════════════════════════ */
#race-route-btn {
  background: linear-gradient(135deg,#ff0099,#7c2d92); border: none; color: #fff;
  font-weight: 800; border-radius: 12px; padding: 0 14px; cursor: pointer;
  font-family: inherit; font-size: .9rem;
}
#race-route-btn:active { transform: scale(.95); }

.race-modal {
  position: absolute; inset: 0; z-index: 4200; background: rgba(0,0,0,.78);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.race-modal.hidden { display: none; }
.race-card {
  background: #111827; border: 1px solid rgba(255,0,153,.35); border-radius: 20px;
  padding: 22px; width: min(360px,92vw); box-shadow: 0 8px 48px rgba(0,0,0,.8), 0 0 60px rgba(255,0,153,.12);
}
.race-card-head { display: flex; align-items: center; justify-content: space-between; font-size: 1.2rem; font-weight: 900; color: #fff; }
.race-x { background: rgba(255,255,255,.08); border: none; color: #fff; width: 32px; height: 32px; border-radius: 10px; cursor: pointer; }
.race-sub { color: #9ca3af; font-size: .84rem; margin: 8px 0 14px; }
.race-code {
  text-align: center; font-size: 2.6rem; font-weight: 900; letter-spacing: .35em;
  color: #ff0099; background: rgba(255,0,153,.08); border: 1px dashed rgba(255,0,153,.4);
  border-radius: 14px; padding: 12px 0; margin-bottom: 14px; text-indent: .35em;
}
.race-btns { display: flex; gap: 10px; }
.race-btn {
  flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: #fff; font-weight: 800; border-radius: 12px; padding: 12px; cursor: pointer; font-family: inherit; font-size: .9rem;
}
.race-btn-pink { background: linear-gradient(135deg,#ff0099,#7c2d92); border: none; }
.race-btn:active { transform: scale(.96); }
.race-players { margin: 14px 0 6px; min-height: 24px; }
.race-player { color: #fff; font-weight: 700; font-size: .9rem; padding: 4px 0; }
.race-host { color: #fbbf24; font-size: .7rem; font-weight: 800; }
.race-wait { color: #9ca3af; font-size: .85rem; font-style: italic; }
.race-hint { color: #6b7280; font-size: .75rem; margin-top: 6px; text-align: center; }

/* VS bar during nav */
#race-vs {
  position: fixed; left: 10px; right: 10px; top: calc(env(safe-area-inset-top) + 118px);
  z-index: 1400; background: rgba(10,12,20,.88); border: 1px solid rgba(255,0,153,.35);
  border-radius: 14px; padding: 8px 12px; backdrop-filter: blur(10px);
}
#race-vs.hidden { display: none; }
.race-vs-title { color: #ff5bbf; font-weight: 900; font-size: .78rem; margin-bottom: 6px; }
.race-vs-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; opacity: .85; }
.race-vs-row.leader { opacity: 1; }
.race-vs-lbl { width: 62px; font-size: .74rem; font-weight: 800; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-vs-row.leader .race-vs-lbl::after { content: ' 👑'; }
.race-vs-bar { flex: 1; height: 8px; background: rgba(255,255,255,.1); border-radius: 6px; overflow: hidden; }
.race-vs-bar span { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg,#22c55e,#4ade80); transition: width .4s ease; }
.race-vs-row[data-who="opp"] .race-vs-bar span { background: linear-gradient(90deg,#f43f5e,#fb7185); }
.race-vs-d { width: 52px; text-align: right; font-size: .74rem; font-weight: 800; color: #e5e7eb; }

/* Opponent marker */
.race-opp-marker { display: flex; flex-direction: column; align-items: center; }
.race-opp-dot { font-size: 1.4rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.race-opp-name { background: rgba(244,63,94,.9); color: #fff; font-size: .62rem; font-weight: 800; padding: 1px 6px; border-radius: 8px; margin-top: -2px; white-space: nowrap; }

/* Result */
.race-result-card { text-align: center; }
.race-result-emoji { font-size: 3.4rem; }
.race-result-title { font-size: 2rem; font-weight: 900; margin: 4px 0; letter-spacing: .02em; }
.race-result-title.win { color: #4ade80; }
.race-result-title.lose { color: #f43f5e; }
.race-result-line { color: #e5e7eb; font-size: .95rem; font-weight: 700; }

#race-toast {
  position: fixed; left: 50%; bottom: calc(120px + env(safe-area-inset-bottom));
  transform: translate(-50%,10px); z-index: 5000; background: rgba(17,24,39,.96);
  border: 1px solid rgba(255,0,153,.4); border-radius: 12px; padding: 10px 16px;
  color: #fff; font-weight: 700; font-size: .85rem; opacity: 0; pointer-events: none; transition: all .3s;
}
#race-toast.show { opacity: 1; transform: translate(-50%,0); }

/* Race countdown */
#race-countdown {
  position: fixed; inset: 0; z-index: 6000; display: flex; align-items: center; justify-content: center;
  pointer-events: none; background: rgba(0,0,0,.35);
}
#race-countdown.hidden { display: none; }
.cd-num {
  font-size: 9rem; font-weight: 900; color: #fff; line-height: 1;
  text-shadow: 0 0 40px rgba(255,0,153,.9), 0 6px 20px rgba(0,0,0,.8);
  font-family: inherit;
}
.cd-go { color: #4ade80; text-shadow: 0 0 50px rgba(74,222,128,.95), 0 6px 20px rgba(0,0,0,.8); }
.cd-pop { animation: cdPop .5s ease-out; }
@keyframes cdPop { 0% { transform: scale(2.2); opacity: 0 } 30% { transform: scale(1); opacity: 1 } 100% { transform: scale(.8); opacity: .5 } }

/* Guide links in settings — internal links to SEO content pages */
#guide-links{ display:flex; flex-direction:column; gap:2px; }
#guide-links a{
  color:var(--text); text-decoration:none; font-size:.86rem;
  padding:9px 10px; border-radius:9px; opacity:.85;
  transition:background .15s, opacity .15s;
}
#guide-links a:hover{ background:rgba(255,255,255,0.06); opacity:1; }

/* ── GPS-lost banner ── shown during nav when GPS fixes stop arriving ── */
#gps-lost {
  position: fixed; z-index: 1001;
  top: calc(env(safe-area-inset-top, 0px) + 220px); /* below the nav-instruction card */
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px;
  background: rgba(180, 60, 20, 0.94);
  border: 1px solid rgba(255,180,120,.4);
  border-radius: 999px;
  font-size: .82rem; font-weight: 700; letter-spacing: .02em; color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
#gps-lost.hidden { display: none; }
.gps-lost-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #ffd27f;
  box-shadow: 0 0 10px #ffb060; animation: gps-lost-pulse 1s ease-in-out infinite;
}
@keyframes gps-lost-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.35;transform:scale(.7)} }

/* ── Route preview loading state ── shown instantly while /api/route fetches ── */
.route-spinner {
  display: inline-block; width: 15px; height: 15px; margin-right: 9px;
  vertical-align: -2px;
  border: 2.5px solid rgba(255,255,255,.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: route-spin .7s linear infinite;
}
@keyframes route-spin { to { transform: rotate(360deg); } }
#preview-bar.route-loading #preview-time {
  font-size: 1.05rem; font-weight: 700; color: var(--muted);
  display: inline-flex; align-items: center;
}
/* Can't Go / Race / Share until the route resolves — keep Cancel live */
#preview-bar.route-loading #preview-actions button:not(#cancel-route-btn) {
  opacity: .4; pointer-events: none;
}

/* ── Voice guidance mute toggle (top-right of the nav card) ── */
#voice-toggle {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.15);
  color: #fff; font-size: 1.15rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; transition: transform .1s, opacity .15s, background .15s;
}
#voice-toggle:active { transform: scale(.9); }
#voice-toggle.muted { opacity: .55; background: rgba(255,255,255,.05); }

/* ── Car colour swatches (garage — tintable cars only) ── */
#car-color-row{ display:flex; flex-wrap:wrap; gap:9px; margin:12px 0 4px; align-items:center; }
#car-color-row.hidden{ display:none; }
.car-swatch{
  width:28px; height:28px; border-radius:50%; padding:0; cursor:pointer;
  border:2px solid rgba(255,255,255,.2); box-shadow:0 2px 6px rgba(0,0,0,.4);
  transition:transform .1s, border-color .15s, box-shadow .15s;
}
.car-swatch:active{ transform:scale(.88); }
.car-swatch.active{ border-color:#fff; box-shadow:0 0 0 3px rgba(255,255,255,.25); }
.car-swatch.swatch-reset{
  background:rgba(255,255,255,.06); color:#94a3b8; font-size:13px; line-height:1;
  display:flex; align-items:center; justify-content:center;
}

/* ── Route cams — live traffic cameras on your route (nav only) ── */
#route-cams-btn {
  position: fixed; z-index: 1002; left: 14px;
  bottom: calc(150px + env(safe-area-inset-bottom));
  width: 52px; height: 52px; border-radius: 15px;
  background: linear-gradient(145deg,#12233a,#0a1626); border: 1.5px solid #22d3ee;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.5), 0 0 14px rgba(34,211,238,.35);
  -webkit-tap-highlight-color: transparent; transition: transform .1s;
}
#route-cams-btn:active { transform: scale(.92); }
#route-cams-btn.hidden { display: none; }
#route-cams-count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: #22d3ee; color: #06202b; font-size: .72rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
#route-cams-count.hidden { display: none; }

#route-cams-sheet {
  position: fixed; z-index: 1003; left: 0; right: 0;
  bottom: calc(84px + env(safe-area-inset-bottom)); /* sit above the nav footer */
  background: rgba(10,12,20,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,.1); border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.6); padding: 12px 0 14px;
  transform: translateY(0); transition: transform .25s ease;
}
#route-cams-sheet.hidden { display: none; }
#route-cams-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 10px; }
#route-cams-title { font-size: .92rem; font-weight: 800; color: #f8fafc; }
#route-cams-close {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.08); color: #cbd5e1; font-size: .9rem;
}
#route-cams-list { display: flex; gap: 12px; overflow-x: auto; padding: 0 16px 4px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
#route-cams-list::-webkit-scrollbar { display: none; }
.rc-card {
  flex: 0 0 auto; width: 168px; scroll-snap-align: start; cursor: pointer;
  background: #0f172a; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; overflow: hidden;
  transition: transform .1s, border-color .15s;
}
.rc-card:active { transform: scale(.97); }
.rc-card.rc-alt { border-color: rgba(168,85,247,.5); }
.rc-thumb-wrap { position: relative; width: 100%; height: 100px; background: #060a12; display: flex; align-items: center; justify-content: center; }
.rc-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.rc-thumb-wrap .rc-loading { position: absolute; font-size: 1.1rem; opacity: .5; }
.rc-dist { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.7); color: #22d3ee; font-size: .68rem; font-weight: 800; }
.rc-alt .rc-dist { color: #c4a3f7; }
.rc-name { padding: 7px 9px 8px; font-size: .74rem; font-weight: 600; color: #dbe2ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-alt-tag { color: #a855f7; font-size: .64rem; font-weight: 800; }
#route-cams-empty { padding: 4px 16px 8px; color: #64748b; font-size: .82rem; }
