:root {
  --bg: rgba(27, 22, 17, 0.88);
  --bg-solid: #1b1712;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f6efe4;
  --muted: #b8ab9a;
  --brown: #c68b4e;
  --gold: #f5b82e;
  --good: #4fd18b;
  --bad: #ff6b5b;
  --info: #6bb8ff;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bar-h: 72px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg-solid); overscroll-behavior: none; }
#map { position: fixed; inset: 0; background: #d9d3c7; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
img { -webkit-user-drag: none; user-select: none; }
kbd {
  font: 600 10px/1 ui-monospace, monospace;
  padding: 2px 4px; border-radius: 4px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06);
}
label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
[hidden] { display: none !important; }
.mobile-only { display: none !important; }

.glass {
  background: var(--bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ---------------------------------------------------------------- HUD */
#hud {
  position: fixed; top: 12px; left: 12px; z-index: 1000;
  width: 300px; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.hud-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-top .name { font-weight: 800; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tier-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  background: #3a322a; border: 1px solid var(--line); white-space: nowrap;
}
.tier-badge[data-tier='bronze'] { background: #6b4122; }
.tier-badge[data-tier='silver'] { background: #5b6470; }
.tier-badge[data-tier='gold'] { background: #8a6512; color: #fff4d1; }
.tier-badge[data-tier='diamond'] { background: linear-gradient(135deg, #3f7fd8, #9a5cf0); }
.hud-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.hud-grid b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; }
.hud-grid b small { font-size: 11px; color: var(--muted); font-weight: 600; }
.cargo-slots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.slot { width: 24px; height: 24px; border-radius: 6px; border: 1px dashed rgba(255, 255, 255, 0.22); display: grid; place-items: center; }
.slot img { width: 24px; height: 24px; }
.slot.full { border-color: transparent; }
.epoch .bar { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 9px; margin-top: 6px; overflow: hidden; }
.epoch .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brown), var(--gold)); transition: width 1s linear; }
.status { font-size: 12px; color: var(--gold); }
.status:empty { display: none; }

/* -------------------------------------------------------------- Panel */
#panel {
  position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 1000;
  width: 350px; display: flex; flex-direction: column;
  transition: transform 0.25s ease;
}
#panel.collapsed { transform: translateX(calc(100% + 12px)); }
.panel-toggle {
  position: absolute; left: -34px; top: 12px; width: 28px; height: 40px;
  border-radius: 8px 0 0 8px; border: 1px solid var(--line); border-right: none;
  background: var(--bg); font-size: 16px;
}
#panel.collapsed .panel-toggle { transform: rotate(180deg); border-radius: 0 8px 8px 0; left: -40px; }
.tabs { display: flex; padding: 6px; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1; padding: 6px 4px; border: none; background: none; border-radius: 10px;
  color: var(--muted); font-weight: 700; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs button img { width: 28px; height: 28px; opacity: 0.75; transition: transform 0.15s; }
.tabs button.active { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.tabs button.active img { opacity: 1; transform: scale(1.08); }
.tabs .sheet-close { display: none; flex: 0 0 44px; font-size: 18px; justify-content: center; }
.tab-body { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tab-body h3 { margin: 4px 0 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.card { background: rgba(255, 255, 255, 0.045); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--muted); font-size: 12px; }
.big { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.upgrade { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; }
.upgrade > img { width: 48px; height: 48px; }
.upgrade b { font-size: 15px; }
.pips { display: flex; gap: 3px; margin: 5px 0 3px; }
.pips i { width: 16px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.pips i.on { background: var(--gold); }
.btn {
  min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07); font-weight: 700; font-size: 13px; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.gold { background: var(--gold); color: #2a1d05; border-color: transparent; }
.btn.gold:hover:not(:disabled) { background: #ffc94f; }
.btn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
td, th { padding: 7px 4px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.compact { font-size: 11px; }
table.compact td, table.compact th { padding: 6px 2px; }
tr.me td { color: var(--gold); font-weight: 700; }
tr.current td { background: rgba(245, 184, 46, 0.1); }
.flow { display: grid; gap: 6px; font-size: 12px; }
.flow .step { display: flex; align-items: center; gap: 8px; }
.flow .step b { min-width: 44px; text-align: right; color: var(--gold); }
.progress { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 9px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--gold); }
.help p, .help li { font-size: 14px; line-height: 1.5; color: #e9dfd1; }
.help ul { padding-left: 18px; margin: 4px 0; }
.legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend img { width: 36px; height: 36px; }

/* ------------------------------------------------------------ Actions */
#actions {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1000;
  display: flex; gap: 8px;
}
.action {
  position: relative; overflow: hidden;
  width: 86px; height: 72px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.action img { width: 38px; height: 38px; position: relative; transition: transform 0.12s; }
.action small { font-size: 11px; font-weight: 700; color: var(--muted); position: relative; display: flex; gap: 4px; align-items: center; }
.action:hover { border-color: rgba(255, 255, 255, 0.25); }
.action:active img { transform: scale(0.88); }
.action.on { border-color: var(--gold); }
.action.cd i {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 0;
  background: rgba(0, 0, 0, 0.45); transition: height 0.2s linear; z-index: 1;
}
.action.active { border-color: var(--info); box-shadow: 0 0 18px rgba(107, 184, 255, 0.55); }
.action.locked img { filter: grayscale(1); opacity: 0.5; }
.fab {
  position: fixed; z-index: 1000; width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--gold); place-items: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.fab img { width: 32px; height: 32px; display: block; margin: auto; }

/* ------------------------------------------------------------- Toasts */
#toasts {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 1100;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
  width: min(460px, calc(100% - 24px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 700;
  background: var(--bg); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: toast-in 0.2s ease-out; max-width: 100%;
}
.toast.has-icon { padding-left: 8px; }
.toast img { width: 32px; height: 32px; flex: none; }
.toast.good, .toast.deliver, .toast.shield { border-color: var(--good); }
.toast.bad, .toast.error { border-color: var(--bad); }
.toast.reward { border-color: var(--gold); background: rgba(60, 44, 10, 0.94); }
.toast.pickup, .toast.express, .toast.full { border-color: var(--brown); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all 0.3s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* -------------------------------------------------------------- Login */
.overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse at top, rgba(60, 40, 20, 0.55), rgba(10, 8, 6, 0.82));
}
.login-card { width: min(440px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.logo { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.logo img { width: 190px; height: auto; flex: none; margin-top: -6px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45)); }
.logo p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.login-card label { display: flex; flex-direction: column; gap: 6px; }
input, select {
  font: inherit; font-size: 16px; /* 16px prevents iOS zoom-on-focus */
  color: var(--text); text-transform: none; letter-spacing: 0;
  min-height: 46px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07);
}
select option { background: var(--bg-solid); }
.wallet-line { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.wallet-line code { color: var(--text); }
.primary {
  min-height: 52px; padding: 13px; border-radius: 12px; border: none; font-weight: 800; font-size: 17px;
  background: linear-gradient(135deg, var(--gold), #e0922a); color: #2a1d05;
}
.primary:disabled { opacity: 0.6; }
.error { color: var(--bad); font-size: 13px; margin: 0; min-height: 1em; }
.fine { color: var(--muted); font-size: 11px; margin: 0; }

/* ------------------------------------------------------------ Markers */
.car-icon, .pkg-icon, .depot-icon, .dest-icon { background: none; border: none; }
.car { width: 40px; height: 40px; transform-origin: 50% 50%; }
.car img { width: 40px; height: 40px; display: block; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.car.me img { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 8px rgba(245, 184, 46, 1)); }
.car.nitro img { filter: drop-shadow(0 0 10px rgba(107, 184, 255, 1)); }
.car.stun { animation: shake 0.15s linear infinite; }
@keyframes shake { 50% { margin-left: 3px; } }
.car-label {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font: 700 11px/1 ui-sans-serif, system-ui; color: #fff; white-space: nowrap;
  background: rgba(0, 0, 0, 0.68); padding: 3px 6px; border-radius: 6px;
  display: flex; align-items: center; gap: 3px;
}
.car-label em { font-style: normal; color: var(--gold); display: flex; align-items: center; gap: 1px; }
.car-label em img { width: 13px; height: 13px; }
.pkg { width: 32px; height: 32px; animation: bob 2.4s ease-in-out infinite; }
.pkg img { width: 32px; height: 32px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.pkg.express img { filter: drop-shadow(0 0 6px rgba(245, 184, 46, 1)); }
@keyframes bob { 50% { transform: translateY(-3px); } }
.depot img { width: 56px; height: 56px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)); }
.depot-label { font-weight: 700; }
.dest img { width: 36px; height: 36px; }

.edge-hint {
  position: absolute; left: 0; top: 0; z-index: 650; width: 48px; height: 48px; pointer-events: none;
  display: grid; place-items: center;
}
.edge-hint span {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); border: 2px solid var(--gold); position: relative; z-index: 1;
}
.edge-hint span img { width: 28px; height: 28px; }
.edge-hint i { position: absolute; inset: 0; transform-origin: 50% 50%; }
.edge-hint i::after {
  content: ''; position: absolute; right: -7px; top: 50%; margin-top: -7px;
  border: 7px solid transparent; border-left: 10px solid var(--gold);
}
.edge-hint small {
  position: absolute; top: 44px; font: 700 10px/1 ui-sans-serif, system-ui; color: #fff;
  background: rgba(0, 0, 0, 0.72); padding: 2px 5px; border-radius: 5px; white-space: nowrap;
}

@media (hover: none) {
  kbd { display: none; }
}

/* ------------------------------------------------------ HUD additions */
.hud-car { width: 36px; height: 36px; flex: none; }
.hud-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hud-id .city { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stamina { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.stamina .bar { position: relative; height: 16px; border-radius: 9px; background: rgba(255, 255, 255, 0.08); overflow: hidden; display: flex; align-items: center; line-height: 1; }
.stamina .bar i { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, #4fd18b, #a6e36b); transition: width 0.4s; }
.stamina .bar i.low { background: linear-gradient(90deg, #ff6b5b, #ffa25b); }
.stamina .bar span { position: relative; font-size: 10px; font-weight: 800; line-height: 1; padding-left: 7px; color: #10170f; font-variant-numeric: tabular-nums; }
.drink {
  display: flex; align-items: center; gap: 2px; min-height: 32px; padding: 2px 8px 2px 4px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-weight: 800; font-size: 12px;
}
.drink img { width: 24px; height: 24px; }
.drink:disabled { opacity: 0.4; }
.epoch .row label { display: inline; }
.clock { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.clock img { width: 20px; height: 20px; }
.slot img { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4)); }

.stun-banner {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 1150; pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 14px 22px 14px 14px; border-radius: 18px;
  background: rgba(60, 12, 8, 0.9); border: 2px solid var(--bad); box-shadow: 0 10px 40px rgba(255, 60, 40, 0.35);
  animation: stun-pulse 1s ease-in-out infinite;
}
.stun-banner img { width: 56px; height: 56px; }
.stun-banner b { display: block; font-size: 22px; letter-spacing: 0.02em; }
.stun-banner span { font-size: 15px; color: #ffc9c2; font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes stun-pulse { 50% { transform: translate(-50%, -50%) scale(1.04); } }

/* --------------------------------------------------- fog & day/night */
.leaflet-fog-pane { pointer-events: none; }
.fog {
  position: absolute; left: 0; top: 0; pointer-events: none;
  background: rgba(14, 11, 8, var(--fog-alpha, 0.18));
  backdrop-filter: blur(2.5px) grayscale(0.45) brightness(var(--fog-b, 0.92));
  -webkit-backdrop-filter: blur(2.5px) grayscale(0.45) brightness(var(--fog-b, 0.92));
  -webkit-mask-image: radial-gradient(circle var(--fr, 200px) at var(--fx, 50%) var(--fy, 50%), transparent 95%, #000 108%);
  mask-image: radial-gradient(circle var(--fr, 200px) at var(--fx, 50%) var(--fy, 50%), transparent 95%, #000 108%);
}
.vision-ring { stroke-dasharray: 6 8; }
.leaflet-tile-pane { transition: filter 2s linear; }

/* headlights at night */
.car .beam {
  position: absolute; left: 50%; bottom: 60%; width: 90px; height: 120px; transform: translateX(-50%);
  background: radial-gradient(ellipse 55% 100% at 50% 100%, rgba(255, 240, 170, 0.95), rgba(255, 240, 170, 0.25) 60%, rgba(255, 240, 170, 0) 85%);
  clip-path: polygon(38% 100%, 62% 100%, 100% 0, 0 0);
  opacity: var(--beam, 0); pointer-events: none; mix-blend-mode: screen;
}
.car { position: relative; }
.car.stun img { filter: grayscale(0.8) brightness(0.8) !important; }
.car-label { border-left: 3px solid var(--hue, var(--gold)); }

/* rarities on the map */
.pkg.r-uncommon img { filter: drop-shadow(0 0 4px rgba(79, 209, 139, 0.9)); }
.pkg.r-rare img { filter: drop-shadow(0 0 6px rgba(79, 155, 255, 1)); }
.pkg.r-epic img { filter: drop-shadow(0 0 8px rgba(181, 107, 255, 1)); }
.pkg.r-legendary { width: 44px; height: 44px; }
.pkg.r-legendary img { width: 44px; height: 44px; filter: drop-shadow(0 0 10px rgba(245, 184, 46, 1)); animation: legend 1.6s ease-in-out infinite; }
@keyframes legend { 50% { filter: drop-shadow(0 0 18px rgba(255, 214, 90, 1)); transform: scale(1.08); } }
.rarity-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

/* garage cards */
.car-card { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; }
.car-card > img { width: 56px; height: 56px; }
.car-card.active { border-color: var(--gold); background: rgba(245, 184, 46, 0.08); }
.car-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.car-stats span { display: inline-flex; align-items: center; gap: 3px; }
.car-stats img { width: 14px; height: 14px; }
.chip { font-size: 11px; font-weight: 800; color: var(--gold); }
.city-row td:first-child { display: flex; align-items: center; gap: 6px; }
.city-row.here td { color: var(--gold); font-weight: 700; }

/* ============================================================ Mobile */
@media (max-width: 760px) {
  .mobile-only { display: revert !important; }
  .fab.mobile-only { display: grid !important; }
  .fab.mobile-only[data-following='true'] { display: none !important; }
  .desktop-only { display: none !important; }
  .leaflet-control-zoom { display: none; }
  .leaflet-control-attribution { font-size: 9px; }
  .leaflet-bottom { bottom: calc(var(--bar-h) + var(--safe-bottom) + 16px); }

  /* Compact HUD across the top */
  #hud {
    top: calc(8px + var(--safe-top)); left: 8px; right: 8px; width: auto;
    padding: 9px 12px 10px; gap: 7px; border-radius: 14px;
  }
  .hud-top .name { font-size: 15px; }
  .hud-grid { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .hud-grid label { font-size: 9px; }
  .hud-grid b { font-size: 13px; }
  .hud-grid b small { font-size: 9px; }
  .cargo { display: flex; align-items: center; gap: 8px; }
  .cargo label { font-size: 9px; white-space: nowrap; }
  .cargo-slots { margin: 0; gap: 3px; }
  .slot, .slot img { width: 20px; height: 20px; }
  .epoch label { font-size: 9px; }
  .epoch .bar { height: 4px; margin-top: 4px; }
  .status { font-size: 11px; }

  /* Bottom action bar, thumb-reachable */
  #actions {
    left: 0; right: 0; bottom: 0; transform: none;
    padding: 8px 8px calc(8px + var(--safe-bottom));
    gap: 6px; background: var(--bg); border-top: 1px solid var(--line);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .action {
    flex: 1; width: auto; height: var(--bar-h); min-width: 0;
    box-shadow: none; background: rgba(255, 255, 255, 0.05); border-radius: 14px;
  }
  .action img { width: 36px; height: 36px; }
  .action small { font-size: 10px; }
  .fab { right: 12px; bottom: calc(var(--bar-h) + var(--safe-bottom) + 28px); }

  /* Panel becomes a bottom sheet */
  #panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: min(72vh, 620px); z-index: 1200;
    border-radius: 20px 20px 0 0; border-bottom: none;
    padding-bottom: var(--safe-bottom);
    transform: translateY(0);
  }
  #panel.collapsed { transform: translateY(105%); }
  .panel-toggle { display: none; }
  .tabs { padding: 8px 8px 6px; }
  .tabs button { font-size: 11px; padding: 6px 2px; }
  .tabs .sheet-close { display: flex; align-items: center; }

  #toasts { top: auto; bottom: calc(var(--bar-h) + var(--safe-bottom) + 24px); flex-direction: column-reverse; }
  .toast { font-size: 12px; }

  .login-card { padding: 20px; }
  .logo img { width: 150px; }

  .hud-car { width: 28px; height: 28px; }
  .stamina { gap: 6px; }
  .stamina label { font-size: 9px; }
  .stamina .bar { height: 14px; }
  .stamina .bar span { font-size: 9px; }
  .drink { min-height: 30px; }
  .clock { font-size: 11px; }
  .clock img { width: 16px; height: 16px; }
  .stun-banner { top: 45%; }
}

img.mini { width: 16px; height: 16px; vertical-align: -3px; }
.btn-col { display: flex; flex-direction: column; gap: 6px; }
.stack { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.stack i { display: block; height: 100%; }

.unlock { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.unlock.ok { color: var(--good); }
.locked-car > img { filter: grayscale(0.6) brightness(0.8); }

@keyframes claim-glow { 50% { box-shadow: 0 0 12px rgba(245, 184, 46, 0.45); } }

/* wallet picker */
.wallet-picker .login-card { gap: 10px; }
.wallet-option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05);
}
.wallet-option:hover { border-color: var(--gold); background: rgba(245, 184, 46, 0.08); }
.wallet-option img { width: 34px; height: 34px; border-radius: 8px; }
.wallet-option span { display: flex; flex-direction: column; }
.wallet-option small { color: var(--muted); font-size: 12px; }
.wallet-dot { width: 34px; height: 34px; border-radius: 8px; background: var(--gold); display: inline-block; }


.name-hint { display: block; min-height: 14px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.name-hint.ok { color: var(--good); }
.name-hint.bad { color: var(--bad); }
.guest-btn { width: 100%; min-height: 44px; margin-top: 8px; }
.guest-note { margin-top: 6px; }
.guest-card { border-color: var(--gold); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.guest-card p { margin: 0; }

/* ------------------------------------------------ collapsible HUD */
#hud.collapsed { gap: 8px; }
#hud.collapsed .full-only { display: none !important; }
#hud:not(.collapsed) .mini-only { display: none !important; }
.hud-top .name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-top .name-row .tier-badge { font-size: 10px; padding: 1px 7px; flex: none; }
.hud-id .mini-only { font-variant-numeric: tabular-nums; }
.claim-chip {
  flex: none; max-width: 44%; min-height: 32px; padding: 0 10px; border-radius: 99px;
  font: inherit; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid var(--gold); background: rgba(245, 184, 46, 0.14); color: var(--gold); cursor: pointer;
}
.claim-chip[data-state='claim'], .claim-chip[data-state='connect'] { animation: claim-glow 1.6s ease-in-out infinite; }
.claim-chip[data-state='locked'] { border-color: var(--line); background: rgba(255, 255, 255, 0.06); color: var(--muted); animation: none; }
.city-btn img { width: 20px; height: 20px; }
.city-picker select { width: 100%; }
.hud-toggle {
  flex: none; display: flex; align-items: center; gap: 4px; min-width: 32px; min-height: 32px; padding: 0 6px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--muted);
  font: inherit; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
}
#hud.collapsed .hud-toggle::before { content: attr(data-timer); }
.hud-toggle i { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s; }
#hud:not(.collapsed) .hud-toggle i { transform: rotate(-135deg) translate(-2px, -2px); }
.hud-car { transition: transform 0.2s; }
#hud.collapsed .name-row .tier-badge { display: none; }

/* referrals */
.invited { margin: 0; padding: 8px 10px; border-radius: 10px; background: rgba(245, 184, 46, 0.14); border: 1px solid var(--gold); color: var(--gold); font-weight: 700; font-size: 13px; }
.resume { margin: 0; font-size: 13px; color: var(--muted); }
.invite-card { border-color: var(--gold); display: flex; flex-direction: column; gap: 8px; }
.invite-card p { margin: 0; }
.invite-link { padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.invite-link code { font-size: 13px; word-break: break-all; }
.help-logo { display: block; width: 140px; height: auto; margin: 0 auto 6px; }
