/* SA Maps — San Andreas radar / HUD skin.
   Fonts: drop-in "Pricedown" if installed locally (see web/fonts/README.md), else Anton.
   Gothic titles: Pirata One. Subtitles: bold sans with a heavy black outline. */

@font-face {
  font-family: 'Pricedown';
  src: local('Pricedown'), local('Pricedown Bl'), local('PricedownBl-Regular');
}

:root {
  --f-price: 'Pricedown', 'Anton', Impact, 'Arial Narrow', sans-serif;
  --f-goth: 'Pirata One', 'Old English Text MT', serif;
  --f-sub: Arial, 'Helvetica Neue', Helvetica, sans-serif;

  --ink: #000;
  --panel: rgba(0, 0, 0, 0.78);
  --panel-solid: #0b0b0b;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f1f1f1;
  --muted: #a8a8a8;
  --money: #36682c;
  --money-hi: #4f9a3f;
  --health: #b4191d;
  --health-bg: #5a0e0f;
  --armor: #e1e1e1;
  --armor-bg: #4b4b4b;
  --gold: #e0a72a;
  --star: #d8a52e;
  --zone: #acc8f0;
  --sel: #3c6ea5;
  --danger: #b4191d;
  --map-bg: #5d6a55;

  --outline: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000,
    1.5px 1.5px 0 #000, -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000;
  --outline-thin: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000,
    1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;

  /* layout vars (set by JS) */
  --D: 300px;
  --rx: 0px;
  --ry: 0px;
  --it: 0px; --ir: 0px; --ib: 0px; --il: 0px; /* car visible-area insets */
  /* system bars: the Android app injects --sa-inset-*; browsers use env() */
  --sat: var(--sa-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--sa-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sal: var(--sa-inset-left, env(safe-area-inset-left, 0px));
  --sar: var(--sa-inset-right, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: var(--f-sub); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--zone); }

/* ---------------------------------------------------------------- radar ---- */

#radar {
  position: fixed;
  inset: 0;
  background: var(--map-bg);
  overflow: hidden;
  transition: left .4s ease, top .4s ease, width .4s ease, height .4s ease, border-radius .4s ease;
}
#map { position: absolute; inset: 0; }
#radar-ring {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none; display: none;
  box-shadow: inset 0 0 0 calc(var(--D) * 0.035) #000, inset 0 0 0 calc(var(--D) * 0.042) rgba(255,255,255,.12),
    inset 0 0 calc(var(--D) * 0.08) rgba(0,0,0,.55);
}
#blips { position: absolute; inset: 0; pointer-events: none; }
.blip { position: absolute; left: 0; top: 0; width: 26px; height: 26px; pointer-events: none; will-change: transform; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.blip.clickable { pointer-events: auto; cursor: pointer; }
.blip.north { width: 24px; height: 24px; }
.blip.rim { animation: rimpulse 1.2s ease-in-out infinite; }
@keyframes rimpulse { 50% { opacity: .55; } }
.player-blip { width: 30px; height: 30px; background: url(../assets/blips/player.svg) center / contain no-repeat; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }

/* Classic round radar */
body.radar-circle:not(.mode-browse) #radar {
  inset: auto;
  left: var(--rx); top: var(--ry); width: var(--D); height: var(--D);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,.6), 0 10px 30px rgba(0,0,0,.6);
}
body.radar-circle:not(.mode-browse) #radar-ring { display: block; }
/* Black disc behind, map pulled in under the ring, so no map pixels leak at the rim. */
body.radar-circle:not(.mode-browse) #radar { background: #000; }
body.radar-circle:not(.mode-browse) #map { inset: calc(var(--D) * 0.02); border-radius: 50%; overflow: hidden; }
body.radar-circle:not(.mode-browse) .maplibregl-ctrl-attrib { display: none; }

/* Full-screen radar: same map, darkened edges like the radar's translucent rim */
body.mode-nav:not(.radar-circle) #radar-ring {
  display: block; border-radius: 0;
  box-shadow: inset 0 0 0 3px #000, inset 0 0 110px 24px rgba(0,0,0,.55);
}
body.mode-nav:not(.radar-circle) .blip.north { width: 28px; height: 28px; }
body.mode-nav:not(.radar-circle) .maplibregl-ctrl-bottom-left { bottom: calc(var(--sab) + 18px); }

.maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(0,0,0,.6); color: #ddd; }
.maplibregl-ctrl-attrib a { color: #ddd; }
.maplibregl-ctrl-bottom-left { bottom: calc(var(--sab) + 2px); }

/* ---------------------------------------------------------------- panels --- */

.sa-panel {
  background: var(--panel);
  border: 2px solid #000;
  box-shadow: 0 6px 24px rgba(0,0,0,.55), inset 0 0 0 1px var(--line);
  backdrop-filter: blur(3px);
}

.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  background: none; border: 0; color: #fff;
}
.icon-btn svg { width: 22px; height: 22px; }

.sa-btn {
  font-family: var(--f-price); font-size: 20px; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; text-shadow: var(--outline-thin);
  background: rgba(0,0,0,.6); border: 2px solid #000; box-shadow: inset 0 0 0 1px var(--line);
  padding: 10px 16px; min-height: 46px;
}
.sa-btn:active { transform: translateY(1px); }
.sa-btn.primary { background: linear-gradient(#2c5a25, #1d3d18); color: #fff; }
.sa-btn.primary:disabled { filter: grayscale(1); opacity: .6; }
.sa-btn.danger { background: linear-gradient(#8b1518, #5c0d0f); }

.chip {
  background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 2px;
  padding: 8px 12px; font-size: 14px; font-weight: 700; color: #ddd; min-height: 38px;
}
.chip.on { color: var(--gold); border-color: var(--gold); }

/* ---------------------------------------------------------------- search --- */

#search-bar {
  position: fixed; z-index: 20;
  top: calc(var(--sat) + 10px); left: calc(var(--sal) + 10px); right: calc(var(--sar) + 10px);
  max-width: 560px;
  display: flex; align-items: center; gap: 2px; height: 52px; padding: 0 4px;
  background: var(--panel); border: 2px solid #000; box-shadow: 0 6px 20px rgba(0,0,0,.5), inset 0 0 0 1px var(--line);
}
#search {
  flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none;
  color: #fff; font-family: var(--f-goth); font-size: 24px; letter-spacing: .01em;
}
#search::placeholder { color: #9aa3b5; }
#search::-webkit-search-cancel-button { display: none; }

#results {
  position: fixed; z-index: 19;
  top: calc(var(--sat) + 66px); left: calc(var(--sal) + 10px); right: calc(var(--sar) + 10px);
  max-width: 560px; max-height: min(60vh, 520px); overflow-y: auto; padding: 4px 0;
}
.result {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; padding: 10px 14px; min-height: 56px;
}
.result:hover, .result:focus-visible, .result.active { background: rgba(60,110,165,.35); outline: none; }
.result img { width: 22px; height: 22px; flex: none; }
.result .r-text { flex: 1; min-width: 0; }
.result .r-name { font-family: var(--f-goth); font-size: 22px; line-height: 1.05; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .r-addr { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.result .r-dist { font-family: var(--f-price); font-size: 17px; color: var(--money-hi); text-shadow: var(--outline-thin); flex: none; }
.results-head { font-family: var(--f-price); text-transform: uppercase; font-size: 15px; letter-spacing: .08em; color: var(--gold); padding: 8px 14px 2px; text-shadow: var(--outline-thin); }
.results-empty { padding: 14px; color: var(--muted); }

#fabs { position: fixed; z-index: 10; right: calc(var(--sar) + 12px); bottom: calc(var(--sab) + 28px); display: grid; gap: 10px; }
.fab, .round-btn {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.8); border: 2px solid #000; box-shadow: 0 4px 14px rgba(0,0,0,.5), inset 0 0 0 1px var(--line); color: #fff;
}
.fab svg, .round-btn svg { width: 24px; height: 24px; }
body.has-briefing #fabs { bottom: calc(var(--sab) + 290px); }

/* ---------------------------------------------------------------- briefing - */

#briefing {
  position: fixed; z-index: 18;
  left: calc(var(--sal) + 10px); right: calc(var(--sar) + 10px); bottom: calc(var(--sab) + 10px);
  max-width: 560px; padding: 14px 16px 16px;
}
.brief-close { position: absolute; top: 4px; right: 4px; }
.brief-kicker { font-family: var(--f-price); text-transform: uppercase; color: var(--gold); letter-spacing: .1em; font-size: 14px; text-shadow: var(--outline-thin); }
#brief-title { font-family: var(--f-goth); font-weight: 400; font-size: 32px; line-height: 1; margin: 4px 40px 4px 0; color: #fff; text-shadow: var(--outline); overflow-wrap: anywhere; }
#brief-addr { color: var(--muted); font-size: 14px; }
.brief-kicker { display: flex; align-items: center; gap: 6px; }
#brief-icon { width: 22px; height: 22px; }
#brief-details {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 10px 0 0; font-size: 14px;
  max-height: 96px; overflow-y: auto;
}
#brief-details dt { font-family: var(--f-price); text-transform: uppercase; letter-spacing: .06em; color: var(--gold); font-size: 13px; text-shadow: var(--outline-thin); }
#brief-details dd { margin: 0; color: #e8e8e8; overflow-wrap: anywhere; }
#brief-details a { color: var(--zone); }
#brief-stats { font-family: var(--f-price); font-size: 22px; color: var(--money-hi); text-shadow: var(--outline-thin); margin: 8px 0 10px; min-height: 28px; letter-spacing: .02em; }
#brief-stats small { display: block; font-family: var(--f-sub); font-size: 12px; color: var(--muted); text-shadow: none; letter-spacing: 0; margin-top: 2px; }
.brief-modes { display: flex; gap: 6px; margin-bottom: 12px; }
.brief-modes button {
  flex: 1; background: rgba(255,255,255,.06); border: 1px solid var(--line); padding: 8px 4px; min-height: 40px;
  font-family: var(--f-goth); font-size: 18px; color: #bbb;
}
.brief-modes button[aria-checked="true"] { color: #fff; background: rgba(60,110,165,.45); border-color: var(--sel); }
.brief-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.brief-save { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- HUD ------ */

#hud {
  position: fixed; z-index: 12; pointer-events: none;
  top: calc(var(--sat) + 10px); right: calc(var(--sar) + 12px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  transform-origin: top right;
}
body.mode-browse #hud { top: calc(var(--sat) + 72px); transform: scale(.8); }
body.mode-browse.has-results #hud { display: none; }
.hud-top { display: flex; align-items: flex-start; gap: 8px; }
#weapon {
  position: relative; width: 78px; height: 78px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3c3c3c, #111 70%);
  border: 3px solid #000; box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 4px 10px rgba(0,0,0,.5);
  display: grid; place-items: center;
}
#weapon-icon { width: 62%; height: 62%; }
#ammo {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--f-price); font-size: 17px; color: #e6e6e6; text-shadow: var(--outline);
}
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; padding-top: 2px; }
#clock { font-family: var(--f-price); font-size: 34px; line-height: .95; color: #e1e1e1; text-shadow: var(--outline); letter-spacing: .02em; }
.bar { width: 112px; height: 13px; border: 2px solid #000; background: var(--health-bg); position: relative; --v: 1; }
.bar i { position: absolute; inset: 0; right: auto; width: calc(var(--v) * 100%); background: var(--health); transition: width .6s; }
.bar.armor { background: var(--armor-bg); }
.bar.armor i { background: var(--armor); }
#money { font-family: var(--f-price); font-size: 34px; line-height: 1; color: var(--money); text-shadow: var(--outline); letter-spacing: .03em; }
#wanted { display: flex; gap: 1px; height: 26px; }
#wanted i { width: 26px; height: 26px; background: url(../assets/hud/star-empty.svg) center / contain no-repeat; opacity: 0; transition: opacity .3s; }
#wanted i.on { background-image: url(../assets/hud/star.svg); opacity: 1; }
#wanted.flash i.on { animation: starflash .5s steps(2, jump-none) infinite; }
@keyframes starflash { 50% { opacity: .15; } }

#infostack {
  position: fixed; z-index: 13; pointer-events: none;
  top: calc(var(--sat) + 10px); left: calc(var(--sal) + 10px);
  width: calc(100vw - 205px - var(--sal) - var(--sar)); max-width: 440px;
  display: grid; gap: 6px; align-content: start;
}
#timers { display: flex; gap: 4px; }
.timer {
  flex: 1; min-width: 0;
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  background: rgba(0,0,0,.6); border: 1px solid #000; padding: 3px 9px;
  font-family: var(--f-price); text-transform: uppercase; color: #fff; text-shadow: var(--outline-thin);
}
.timer span { font-size: 15px; color: #ddd; }
.timer b { font-weight: 400; font-size: 21px; }

#helpbox {
  display: flex; gap: 10px; align-items: center;
  background: rgba(0,0,0,.72); border: 1px solid #000; padding: 10px 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
#help-icon { width: 46px; height: 46px; flex: none; }
#help-main { font-size: 18px; font-weight: 700; line-height: 1.2; color: #fff; overflow-wrap: anywhere; }
#help-sub { font-size: 14px; color: #c8c8c8; margin-top: 3px; }

/* ---------------------------------------------------------------- nav buttons */

#nav-buttons {
  position: fixed; z-index: 14;
  left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 12px);
  display: flex; gap: 12px; align-items: center;
}
body.mode-browse .nav-only, body:not(.mode-browse) .browse-only { display: none !important; }
#btn-mute .cross { display: none; }
body.muted #btn-mute .cross { display: inline; }
body.muted #btn-mute .waves { display: none; }

/* ---------------------------------------------------------------- subtitles - */

#subtitle {
  position: fixed; z-index: 16; pointer-events: none;
  left: 50%; bottom: calc(var(--sab) + 80px); transform: translate(-50%, 8px);
  width: min(94vw, 680px);
  display: flex; align-items: flex-end; gap: 10px; justify-content: center;
  opacity: 0; transition: opacity .25s, transform .25s;
}
#subtitle.show { opacity: 1; transform: translate(-50%, 0); }
#subtitle-avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none; border: 3px solid #000;
  box-shadow: 0 0 0 2px #2f6b2a, 0 4px 12px rgba(0,0,0,.6); background: #222;
}
#subtitle[data-speaker="smoke"] #subtitle-avatar { box-shadow: 0 0 0 2px #8a8f6a, 0 4px 12px rgba(0,0,0,.6); }
#subtitle-name { display: block; font-family: var(--f-price); text-transform: uppercase; font-size: 14px; letter-spacing: .1em; color: var(--money-hi); text-shadow: var(--outline-thin); }
#subtitle[data-speaker="smoke"] #subtitle-name { color: #c9cf98; }
#subtitle-text {
  margin: 0; font-family: var(--f-sub); font-weight: 700; font-size: 21px; line-height: 1.22; color: #fff;
  text-shadow: var(--outline);
}

/* ---------------------------------------------------------------- big text --- */

#zone {
  position: fixed; z-index: 15; pointer-events: none;
  right: calc(var(--sar) + 18px); bottom: calc(var(--sab) + 140px);
  text-align: right; opacity: 0; transition: opacity .6s;
}
#zone.show { opacity: 1; }
#zone-vehicle { font-family: var(--f-goth); font-size: 30px; color: var(--money-hi); text-shadow: var(--outline); line-height: 1; }
#zone-name { font-family: var(--f-goth); font-size: 44px; color: var(--zone); text-shadow: var(--outline); line-height: 1.05; }

#mission-title {
  position: fixed; z-index: 15; pointer-events: none;
  left: 0; right: 0; top: 34%; text-align: center; padding: 0 16px;
  font-family: var(--f-goth); font-size: clamp(36px, 9vw, 72px); color: #e8d7a6; text-shadow: var(--outline);
  opacity: 0; transition: opacity .7s; overflow-wrap: anywhere;
}
#mission-title.show { opacity: 1; }

#mission-text {
  position: fixed; z-index: 30; pointer-events: none;
  left: 0; right: 0; top: 38%; text-align: center; padding: 0 12px;
  opacity: 0; transform: scale(.9); transition: opacity .35s, transform .35s;
}
#mission-text.show { opacity: 1; transform: scale(1); }
#mission-big { font-family: var(--f-price); text-transform: uppercase; font-size: clamp(44px, 12vw, 96px); line-height: 1; color: var(--gold); text-shadow: var(--outline), 0 0 24px rgba(0,0,0,.6); }
#mission-text[data-kind="failed"] #mission-big { color: #c9282c; }
#mission-small { font-family: var(--f-price); text-transform: uppercase; font-size: clamp(24px, 6vw, 44px); color: #fff; text-shadow: var(--outline); margin-top: 6px; }

#toast {
  position: fixed; z-index: 40; left: 50%; top: calc(var(--sat) + 74px); transform: translate(-50%, -10px);
  max-width: 90vw; padding: 9px 14px; background: rgba(0,0,0,.85); border: 1px solid #000;
  font-weight: 700; font-size: 15px; color: #fff; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#car-banner {
  position: fixed; z-index: 21; left: 10px; right: 10px; bottom: calc(var(--sab) + 10px); max-width: 560px;
  padding: 10px 14px; background: rgba(54,104,44,.92); border: 2px solid #000; font-weight: 700; font-size: 14px;
}
body.car-active #briefing { bottom: calc(var(--sab) + 70px); }

/* ---------------------------------------------------------------- options ---- */

.sa-menu {
  position: fixed; z-index: 50; inset: 0; overflow-y: auto;
  background: rgba(0,0,0,.92);
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 16px) calc(var(--sab) + 24px) calc(var(--sal) + 16px);
}
.sa-menu header { display: flex; align-items: center; justify-content: space-between; max-width: 640px; margin: 0 auto; }
.sa-menu h1 { font-family: var(--f-price); text-transform: uppercase; font-weight: 400; font-size: 46px; margin: 0; color: #fff; text-shadow: var(--outline); letter-spacing: .03em; }
#options-list { max-width: 640px; margin: 8px auto 0; }
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px;
  border-bottom: 1px solid rgba(255,255,255,.07); padding: 4px 0;
}
.opt-label { font-family: var(--f-goth); font-size: 23px; color: #dfe7f3; }
.opt-value { display: flex; align-items: center; gap: 4px; }
.opt-value button.arrow { width: 40px; height: 40px; background: none; border: 0; color: var(--gold); font-size: 20px; }
.opt-value .val { min-width: 128px; text-align: center; font-family: var(--f-price); font-size: 19px; text-transform: uppercase; color: #fff; text-shadow: var(--outline-thin); }
.opt input[type="text"], .opt select {
  width: min(56vw, 260px); background: rgba(255,255,255,.07); border: 1px solid var(--line); color: #fff;
  padding: 9px 10px; font-size: 15px; border-radius: 0;
}
.opt select option { background: #111; }
.opt-clip { display: flex; gap: 6px; }
.options-test { display: flex; gap: 8px; max-width: 640px; margin: 16px auto 0; flex-wrap: wrap; }
.credits { max-width: 640px; margin: 22px auto 0; color: #8d8d8d; font-size: 12px; line-height: 1.6; }

/* ---------------------------------------------------------------- splash ----- */

#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #2a2f25 0%, #050505 75%);
  padding: 24px;
}
.splash-inner { text-align: center; display: grid; gap: 14px; justify-items: center; }
.splash-logo { font-family: var(--f-price); font-size: clamp(76px, 26vw, 150px); line-height: .9; color: #fff; text-shadow: var(--outline), 0 8px 30px rgba(0,0,0,.8); letter-spacing: .02em; }
.splash-logo span { display: block; font-family: var(--f-goth); font-size: .5em; color: var(--gold); letter-spacing: 0; }
.splash-sub { font-family: var(--f-goth); font-size: 26px; color: var(--zone); text-shadow: var(--outline); }
.splash-note { color: #9b9b9b; font-size: 13px; max-width: 300px; }
#splash-start { margin-top: 10px; min-width: 220px; font-size: 26px; }

/* ---------------------------------------------------------------- nav layouts */

/* portrait phone */
body.mode-nav:not(.landscape) #subtitle { bottom: calc(var(--sab) + 84px); }
body.mode-nav:not(.landscape) #zone { bottom: calc(var(--sab) + 150px); }

body.mode-nav { background: radial-gradient(ellipse at 50% 55%, #262c22 0%, #10120e 55%, #050505 100%); }

/* landscape, classic radar: radar left, info right */
body.mode-nav.landscape.radar-circle:not(.car) #infostack { left: calc(var(--rx) + var(--D) + 14px); width: calc(100vw - var(--rx) - var(--D) - 230px); }
body.mode-nav.landscape.radar-circle:not(.car) #subtitle { left: calc(var(--rx) + var(--D) + (100vw - var(--rx) - var(--D)) / 2); width: min(calc(100vw - var(--rx) - var(--D) - 30px), 620px); bottom: calc(var(--sab) + 76px); }
body.mode-nav.landscape #nav-buttons { left: auto; right: calc(var(--sar) + 14px); transform: none; }
body.mode-nav.landscape #zone { bottom: calc(var(--sab) + 160px); }
body.mode-nav.landscape:not(.radar-circle) #infostack { width: min(42vw, 440px); }
@media (max-height: 420px) {
  body.mode-nav.landscape #hud { transform: scale(.78); }
  body.mode-nav.landscape #subtitle-text { font-size: 18px; }
}
@media (max-width: 380px) {
  #hud { transform: scale(.86); }
  #infostack { width: calc(100vw - 185px - var(--sal) - var(--sar)); }
  #help-main { font-size: 16px; }
}

/* ---------------------------------------------------------------- music ------ */

/* "Now playing" in SA style: black menu panel, framed cover, the song title in the
   gothic radio-station lettering, play button like the HUD's weapon slot. */
#radio {
  --art: none;
  position: fixed; z-index: 15; overflow: hidden; isolation: isolate;
  left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 72px); width: min(94vw, 460px);
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "art text" "art ctrl";
  column-gap: 14px; align-items: center; padding: 10px 12px;
  background: rgba(0, 0, 0, 0.78);
  border: 2px solid #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 24px rgba(0, 0, 0, 0.55);
  font-family: var(--f-sub); color: #fff;
}
/* a faint wash of the cover's colors behind the panel */
.radio-bg {
  position: absolute; inset: -40px; z-index: -1; pointer-events: none;
  background: var(--art) center / cover no-repeat;
  filter: blur(30px) saturate(1.5); opacity: 0.22;
}
.radio-cover {
  grid-area: art; width: 60px; height: 60px; overflow: hidden; flex: none;
  background: #1c1f1a; border: 2px solid #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 6px 16px rgba(0, 0, 0, 0.6);
  display: grid; place-items: center;
}
.radio-cover::after { content: '♫'; font-size: 28px; color: var(--gold); text-shadow: var(--outline-thin); }
.radio-cover:has(#radio-art:not([hidden]))::after { content: none; }
#radio-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.radio-text { grid-area: text; min-width: 0; }
#radio-station {
  font-family: var(--f-price); text-transform: uppercase; letter-spacing: .08em; font-size: 12px;
  color: var(--gold); text-shadow: var(--outline-thin);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#radio-title {
  font-family: var(--f-goth); font-size: 24px; line-height: 1.1; color: #9ec3ef; text-shadow: var(--outline);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#radio-artist {
  font-weight: 700; font-size: 13px; color: #f1f1f1; text-shadow: var(--outline-thin); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.radio-ctrl { grid-area: ctrl; display: flex; align-items: center; justify-content: space-between; max-width: 210px; margin-top: 6px; }
.radio-btn {
  width: 44px; height: 40px; display: grid; place-items: center; padding: 0;
  background: none; border: 0; color: #fff;
  filter: drop-shadow(1.5px 0 0 #000) drop-shadow(-1.5px 0 0 #000) drop-shadow(0 1.5px 0 #000) drop-shadow(0 -1.5px 0 #000);
  transition: transform .1s;
}
.radio-btn:active { transform: scale(.92); }
.radio-btn svg { width: 24px; height: 24px; }
.radio-btn.main {
  width: 50px; height: 50px; border-radius: 50%; filter: none;
  background: radial-gradient(circle at 40% 35%, #3c3c3c, #111 70%);
  border: 3px solid #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 4px 10px rgba(0, 0, 0, 0.5);
}
.radio-btn.main svg { width: 24px; height: 24px; }
#radio-toggle .i-pause, #radio-toggle.playing .i-play { display: none; }
#radio-toggle.playing .i-pause { display: block; }
#radio-connect { position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 76px); background: rgba(0,0,0,.8); }
#radio-banner {
  position: fixed; z-index: 15; pointer-events: none; left: 0; right: 0; top: 26%; padding: 0 16px;
  text-align: center; font-family: var(--f-goth); font-size: clamp(26px, 7vw, 46px); color: #9ec3ef;
  text-shadow: var(--outline); opacity: 0; transition: opacity .5s; overflow-wrap: anywhere;
}
#radio-banner.show { opacity: 1; }
/* phone map screen: mini player bottom-left, next to the locate button */
body.mode-browse #radio, body.mode-browse #radio-connect {
  left: calc(var(--sal) + 10px); transform: none; bottom: calc(var(--sab) + 30px);
  width: min(calc(100vw - var(--sal) - var(--sar) - 92px), 460px);
}
body.mode-browse #radio-connect { width: auto; }
body.mode-browse.has-radio .maplibregl-ctrl-bottom-left { bottom: calc(var(--sab) + 178px); }
body.mode-browse #radio-banner,
body.has-briefing #radio, body.has-briefing #radio-connect,
body.has-results #radio, body.has-results #radio-connect { display: none !important; }
body.has-radio:not(.car) #subtitle { bottom: calc(var(--sab) + 158px); }

/* Android Auto surface: radar (round or a panel) + an info column inside the area the
   host leaves free (--cx/--cw set by layoutCar). */
body.car #search-bar, body.car #results, body.car #fabs, body.car #briefing, body.car #nav-buttons,
body.car #options, body.car #splash, body.car #car-banner, body.car #radio-connect { display: none !important; }
body.car #hud { top: calc(var(--it) + 8px); right: calc(var(--ir) + 10px); transform: scale(.72); }
body.car #infostack { top: calc(var(--it) + 10px); left: var(--sx); width: var(--stackw); }
body.car #help-main { font-size: 16px; }
body.car #subtitle { bottom: calc(var(--ib) + 10px); left: calc(var(--cx) + var(--cw) / 2); width: var(--cw); }
body.car #subtitle-avatar { width: 44px; height: 44px; }
body.car #subtitle-text { font-size: 18px; }
/* music on the car screen: Spotify-style "Now Playing" — cover on top, then title and
   artist, then the controls with a round play button. Sits below the turn box. */
body.car #radio {
  --cover: min(190px, calc(100vh - var(--it) - var(--ib) - 370px));
  top: calc(var(--it) + 158px); bottom: auto;
  /* nudged right of the radar; the district name may pop up over it (#zone is drawn in front) */
  left: calc(var(--cx) + min(72px, var(--cw) * 0.12)); transform: none;
  width: min(calc(var(--cw) - 180px), 480px);
  grid-template-columns: 1fr; grid-template-areas: "art" "text" "ctrl";
  row-gap: 8px; padding: 12px 14px 8px;
}
/* wide banner of the cover across the top */
body.car .radio-cover { width: 100%; height: var(--cover); }
body.car .radio-cover::after { font-size: 56px; }
body.car #radio-station { font-size: 14px; }
body.car #radio-title { font-size: 32px; }
body.car #radio-artist { font-size: 16px; }
body.car .radio-ctrl { max-width: none; justify-content: center; gap: 34px; margin-top: 0; }
body.car .radio-btn svg { width: 30px; height: 30px; }
body.car .radio-btn.main { width: 60px; height: 60px; }
body.car .radio-btn.main svg { width: 28px; height: 28px; }
/* short car screens: not enough height for the banner on top, go side by side */
@media (max-height: 520px) {
  body.car #radio {
    --cover: 108px;
    grid-template-columns: var(--cover) 1fr; grid-template-areas: "art text" "art ctrl";
    column-gap: 16px; row-gap: 4px; padding: 12px 14px;
  }
  body.car .radio-cover { width: var(--cover); }
  body.car .radio-ctrl { justify-content: flex-start; gap: 22px; }
}
body.car #radio-banner { display: none !important; }
body.car #mission-text, body.car #mission-title { left: var(--cx); right: auto; width: var(--cw); }
body.car #zone { z-index: 16; right: calc(100vw - var(--cx) - var(--cw)); bottom: calc(var(--ib) + 140px); }
body.car #zone-name { font-size: 34px; }
body.car #mission-big { font-size: clamp(32px, 7vw, 64px); }
body.car .maplibregl-ctrl-bottom-left { left: var(--il); bottom: var(--ib); }
/* map panel on the left third */
body.car.car-panel #radar { inset: auto; left: var(--rx); top: var(--ry); width: var(--rw); height: var(--rh); }
body.car.car-panel .maplibregl-ctrl-bottom-left { left: 0; bottom: 0; }
