:root {
  /* Layout: one phone-height column. Route map beside the big readouts; gas and status stack underneath. */
  --bg: #0c0e11;
  --panel: #161a1f;
  --ink: #f3f0ea;
  --muted: #9ea5af;
  --line: rgba(255, 255, 255, 0.14);
  --red: #ff3a2d;
  --display: 'Barlow Condensed', 'Avenir Next Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --body: 'Barlow', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-weight: 500; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.app { height: 100%; max-width: 480px; margin: 0 auto; background: var(--bg); }
.ui {
  height: 100%; display: flex; flex-direction: column; gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
  overflow-y: auto;
}

.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #111; }
.pill { font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; white-space: nowrap; }
.pill.ok { color: #b9f2cf; border-color: rgba(185, 242, 207, .4); }
.pill.warn { color: #ffd9a0; border-color: rgba(255, 217, 160, .45); }

.main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px; flex: 1 1 auto; min-height: 380px; }
.mapbox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
#map { display: block; width: 100%; height: 100%; }
.side { display: flex; flex-direction: column; gap: 8px; min-height: 0; }

.hero { flex: 1 1 auto; min-height: 0; padding: 2px 2px 0; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1 { overflow-wrap: normal; margin: 4px 0 0; font-family: var(--display); font-weight: 700; font-size: 40px; line-height: .98; text-wrap: balance; }
.hero-row { display: flex; align-items: baseline; gap: 5px; margin-top: 8px; font-family: var(--display); }
.big { font-size: 84px; font-weight: 700; line-height: .9; font-variant-numeric: tabular-nums; }
.unit { font-size: 26px; font-weight: 600; color: var(--red); }
.eta { margin: 6px 0 0; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.eta b { color: var(--ink); font-weight: 600; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.label { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tile-num { font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.tile-num small { font-size: 20px; font-weight: 600; color: var(--red); margin-left: 3px; }
.sub { margin: 0; font-size: 14px; line-height: 1.2; color: var(--ink); }
.sub.dim { color: var(--muted); font-size: 12px; }

.gas { display: flex; flex-direction: column; gap: 5px; padding: 7px 11px; background: transparent; }
.gas .label { font-size: 10px; }
.gas-head { display: flex; align-items: center; gap: 8px; }
.price { font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1; background: rgba(18, 128, 74, .35); color: #d7f5e3; border-radius: 6px; padding: 3px 8px 2px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.price.none { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.gas-text { min-width: 0; flex: 1; }
.gas-text .sub { font-size: 12px; overflow-wrap: anywhere; }
.gas-text .sub.dim { font-size: 11px; }
.retry, .mini { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.mini[aria-pressed="true"] { background: var(--ink); color: #111; }
.chips { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 1px; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-size: 11px; line-height: 1.25; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip b { font-weight: 600; color: var(--ink); }
.chip.best { border-color: rgba(215, 245, 227, .6); background: rgba(18, 128, 74, .35); }
.chip.passed { opacity: .45; }

.controls { display: flex; flex-direction: column; gap: 8px; padding: 8px 12px; }
.gps-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.readouts { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 0; }
.readouts span:first-child { color: var(--ink); font-size: 13px; font-weight: 600; }
.demo-row { display: flex; align-items: center; gap: 12px; }
.demo-row input { flex: 1; min-width: 0; accent-color: var(--red); }
.play { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: 15px; cursor: pointer; }
.note { margin: 0; font-size: 11px; line-height: 1.3; color: var(--muted); }

.pulse { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .pulse { animation: pulse 1.8s ease-out infinite; }
  @keyframes pulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
}
