:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --glass: rgba(14, 18, 26, 0.8);
  --glass-strong: rgba(16, 20, 30, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e8edf5;
  --muted: #8b95a7;
  --faint: #6a7487;
  --red: #ff4d4f;
  --red-soft: rgba(255, 77, 79, 0.16);
  --amber: #ffb547;
  --amber-soft: rgba(255, 181, 71, 0.14);
  --soon: #7d8aa3;
  --car: #9fd8ff;
  --gold: #f5cf5c;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --radius: 14px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", "SF Mono", monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.noscript { position: fixed; inset: auto 16px 16px; padding: 16px; border-radius: 12px; background: #1b2130; z-index: 10; }

#map { position: fixed; inset: 0; }

/* ---------- Glass surfaces ---------- */
.panel, .timebar, .toolbar .legend, .toolbar .chip-btn, .modal-inner {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 18px 48px -12px rgba(0,0,0,0.6);
}

/* ---------- Panel (desktop: left card; phone: bottom sheet) ---------- */
.panel {
  position: fixed; top: 16px; left: 16px; bottom: calc(var(--tb, 92px) + 32px);
  width: 384px; border-radius: 20px;
  display: flex; flex-direction: column; overflow: hidden;
  z-index: 2;
}
.sheet-grab { flex: none; -webkit-user-select: none; user-select: none; }
.sheet-handle { display: none; }
.panel-head { padding: 20px 20px 12px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.02em; color: var(--gold); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.src-link { color: var(--gold); text-decoration: underline; text-decoration-color: rgba(245,207,92,0.4); text-underline-offset: 2px; transition: opacity 160ms ease; }
.src-link.top { margin-left: auto; padding: 6px 0; font-size: 12px; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .src-link:hover { opacity: 0.8; } }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(245,207,92,0.18); }
h1 { margin: 0 0 14px; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); }
.seg { height: 34px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); transition: color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out); }
.seg[aria-selected="true"] { color: var(--text); background: rgba(255,255,255,0.09); box-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.seg:active { transform: scale(0.97); }

.status { display: flex; align-items: center; gap: 14px; margin: 4px 20px 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--red-soft); border: 1px solid rgba(255,77,79,0.22); transition: background-color 200ms ease, border-color 200ms ease; }
.status[data-calm] { background: rgba(255,255,255,0.04); border-color: var(--line); }
.status-num { font-family: var(--mono); font-size: 34px; font-weight: 500; line-height: 1; color: var(--red); min-width: 2ch; font-variant-numeric: tabular-nums; transition: color 200ms ease; }
.status[data-calm] .status-num { color: var(--text); }
.status-text { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; }
.status-text strong { font-weight: 600; }
.status-text span { color: var(--muted); }

.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }

.assume { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 20px 10px; font-size: 13px; color: var(--muted); }
.select { height: 34px; border-radius: 999px; padding: 0 12px; font-size: 13px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); outline: 0; cursor: pointer; max-width: 60%; }
.select:focus-visible { outline: 2px solid var(--gold); }
.select option { background: #141922; }

.search { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; margin: 0 20px 10px; padding: 0 12px; height: 42px; border-radius: 10px; background: #161b25; border: 1px solid var(--line); transition: border-color 160ms ease; }
.search:focus-within { border-color: var(--line-strong); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search input { flex: 1; background: none; border: 0; outline: 0; font-size: 14px; min-width: 0; height: 100%; }
.search input::placeholder { color: var(--faint); }

.venues { padding: 0 12px 8px; }
.venues-empty { margin: 16px 8px; padding: 18px; border-radius: var(--radius); border: 1px dashed var(--line-strong); color: var(--muted); font-size: 14px; line-height: 1.5; }
.venues-empty strong { color: var(--text); display: block; margin-bottom: 4px; }
.other-day { width: 100%; display: flex; flex-direction: column; gap: 3px; margin: 6px 0 4px; padding: 12px 14px; border-radius: var(--radius); text-align: left; font-size: 12.5px; color: var(--muted); line-height: 1.45;
  border: 1px dashed var(--line-strong); transition: background-color 160ms ease, transform 160ms var(--ease-out); }
.other-day strong { color: var(--text); font-size: 13.5px; }
.other-day .od-go { color: var(--gold); font-weight: 500; margin-top: 2px; }
.other-day:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) { .other-day:hover { background: rgba(255,255,255,0.04); } }

.venue { border-radius: var(--radius); margin-bottom: 6px; border: 1px solid transparent; transition: background-color 160ms ease, border-color 160ms ease; }
.venue[data-enter] { animation: rise 320ms var(--ease-out) both; }
.venue[data-open] { background: rgba(255,255,255,0.035); border-color: var(--line); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.venue-btn { width: 100%; min-height: 56px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 12px 10px; border-radius: var(--radius); text-align: left; transition: transform 160ms var(--ease-out), background-color 160ms ease; }
.venue-btn:active { transform: scale(0.985); }
.num { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; background: rgba(255,255,255,0.06); color: var(--muted); transition: background-color 200ms ease, color 200ms ease; }
.venue[data-state="active"] .num { background: var(--red); color: #fff; }
.venue[data-state="possible"] .num { background: var(--amber); color: #1a1205; }
.vname { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.vtime { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.vtime b { font-family: var(--mono); font-weight: 500; color: var(--faint); }
.vlift { color: var(--faint); }

.pill { font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 999px; white-space: nowrap; transition: background-color 200ms ease, color 200ms ease; }
.pill-active { background: var(--red-soft); color: #ff8a8b; }
.pill-soon { background: rgba(255,255,255,0.06); color: var(--muted); }
.pill-possible { background: var(--amber-soft); color: var(--amber); }
.pill-done { background: rgba(255,255,255,0.04); color: var(--faint); }

.venue-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 240ms var(--ease-out); }
.venue[data-open] .venue-body { grid-template-rows: 1fr; }
.venue-body > div { overflow: hidden; }
.vblurb { margin: 0 12px 8px 50px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.vextra { margin: 0 12px 8px 50px; font-size: 12.5px; line-height: 1.45; padding: 8px 10px; border-radius: 9px; background: rgba(245,207,92,0.08); color: #f1dc9b; }

.corners { list-style: none; margin: 0; padding: 0 6px 8px 40px; }
.corner { width: 100%; min-height: 44px; display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; text-align: left; padding: 8px 6px; border-radius: 9px; transition: background-color 140ms ease, transform 140ms var(--ease-out); }
.corner:active { transform: scale(0.985); background: rgba(255,255,255,0.05); }
.cdir { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.06); }
.cdir svg { width: 12px; height: 12px; fill: currentColor; }
.venue[data-state="active"] .cdir { background: var(--red-soft); color: #ff7375; }
.venue[data-state="possible"] .cdir { background: var(--amber-soft); color: var(--amber); }
.cname { font-size: 13.5px; font-weight: 500; }
.crule { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.capprox { color: var(--faint); font-style: italic; }
mark { background: rgba(245,207,92,0.25); color: inherit; border-radius: 3px; padding: 0 1px; }

.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; padding: 12px 20px 16px; border-top: 1px solid var(--line); font-size: 12px; }
.link-btn { color: var(--gold); font-weight: 500; font-size: 13px; text-align: left; min-height: 32px; transition: opacity 160ms ease; }
.src { color: var(--faint); text-align: right; max-width: 55%; line-height: 1.4; }

/* ---------- View switch + route planner ---------- */
.views { margin: 0 20px 12px; }
[hidden] { display: none !important; }

.route-form { position: relative; margin: 0 20px 12px; padding: 12px; border-radius: var(--radius); background: rgba(255,255,255,0.035); border: 1px solid var(--line); }
.rf-row { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.rf-row + .swap + .rf-row { margin-top: 10px; }
.rf-pin { width: 24px; height: 24px; margin-top: 9px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.rf-pin.from, .route-pin.from span { background: var(--gold); color: #191300; }
.rf-pin.to, .route-pin.to span { background: #4cc9ff; color: #04202c; }
.rf-field input { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; background: #161b25; border: 1px solid var(--line); outline: 0; font-size: 14px; transition: border-color 160ms ease; }
.rf-field input:focus { border-color: var(--line-strong); }
.rf-field input::placeholder { color: var(--faint); }
.rf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mini { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--muted); background: rgba(255,255,255,0.05); border: 1px solid var(--line); transition: transform 160ms var(--ease-out), color 160ms ease, background-color 160ms ease; }
.mini svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mini:active { transform: scale(0.96); }
.mini:disabled { opacity: 0.6; }
.swap { position: absolute; right: 14px; top: 50%; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%; display: grid; place-items: center; background: #1d2330; border: 1px solid var(--line-strong); color: var(--muted); z-index: 1; transition: transform 160ms var(--ease-out), color 160ms ease; }
.swap svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.swap:active { transform: scale(0.92) rotate(180deg); }
.rf-field { padding-right: 40px; min-width: 0; }

.suggest { margin: 6px 0 4px 34px; padding: 4px; border-radius: 12px; background: #141922; border: 1px solid var(--line-strong); box-shadow: 0 12px 30px rgba(0,0,0,0.45); animation: pop 140ms var(--ease-out); }
.sg { width: 100%; min-height: 44px; display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; text-align: left; transition: background-color 120ms ease; }
.sg:active { background: rgba(255,255,255,0.06); }
.sg-kind { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; background: rgba(255,255,255,0.06); color: var(--muted); }
.sg-kind.place { color: var(--gold); }
.sg-body { display: flex; flex-direction: column; min-width: 0; }
.sg-label { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-hint { font-size: 11.5px; color: var(--faint); }
.sg-empty { padding: 10px; font-size: 13px; color: var(--muted); line-height: 1.45; }

#routeResult { margin: 0 20px 8px; }
.route-empty { padding: 16px; border-radius: var(--radius); border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.route-empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }
.route-sum { padding: 14px 16px; border-radius: var(--radius); background: rgba(76,201,255,0.1); border: 1px solid rgba(76,201,255,0.25); margin-bottom: 8px; }
.rs-main { display: flex; align-items: baseline; gap: 12px; }
.rs-time { font-family: var(--mono); font-size: 26px; font-weight: 500; color: #8fdcff; }
.rs-dist { font-size: 14px; color: var(--muted); }
.rs-when { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.callout { padding: 10px 12px 10px 34px; border-radius: 10px; font-size: 13px; line-height: 1.45; margin-bottom: 8px; position: relative; background: rgba(255,255,255,0.04); color: #c6cdd9; }
.callout::before { content: ""; position: absolute; left: 13px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.callout.good { background: rgba(84,214,140,0.1); color: #b6efcc; }
.callout.good::before { background: #54d68c; }
.callout.detour { background: rgba(76,201,255,0.08); color: #bfe9ff; }
.callout.detour::before { background: #4cc9ff; }
.callout.warn { background: var(--amber-soft); color: #ffd99a; }
.callout.warn::before { background: var(--amber); }
.callout.bad { background: var(--red-soft); color: #ffb1b2; }
.callout.bad::before { background: var(--red); }

.steps { list-style: none; margin: 4px 0 0; padding: 0; }
.step { width: 100%; min-height: 44px; display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 9px; text-align: left; font-size: 13.5px; transition: background-color 140ms ease, transform 140ms var(--ease-out); }
button.step:active { transform: scale(0.985); background: rgba(255,255,255,0.05); }
.step + .step, .steps li + li { border-top: 1px solid var(--line); }
.ti { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: rgba(76,201,255,0.12); color: #8fdcff; }
.ti svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ti.start, .ti.arrive { background: rgba(255,255,255,0.06); color: var(--text); }
.st-len { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }
.route-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0 4px; font-size: 12px; color: var(--faint); }

.route-pin { width: 30px; height: 38px; display: grid; justify-items: center; pointer-events: none; }
.route-pin span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 2px solid #0b0e14; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.route-pin::after { content: ""; width: 2px; height: 10px; background: #0b0e14; border-radius: 1px; }

.pick-hint { position: fixed; left: 50%; top: 16px; z-index: 4; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  background: var(--glass-strong); border: 1px solid rgba(76,201,255,0.4); box-shadow: 0 12px 30px rgba(0,0,0,0.5); animation: pop 160ms var(--ease-out); }
.pick-hint .chip-btn { height: 30px; background: rgba(255,255,255,0.08); }
.picking #map .maplibregl-canvas { cursor: crosshair; }

/* ---------- Legend + toolbar ---------- */
.legend { display: flex; flex-direction: column; gap: 7px; padding: 12px 14px; border-radius: 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 9px; }
.legend-inline { display: none; }
.lg { width: 18px; height: 4px; border-radius: 2px; display: inline-block; flex: none; }
.lg-active { background: var(--red); box-shadow: 0 0 8px var(--red); }
.lg-soon { background: repeating-linear-gradient(90deg, var(--soon) 0 4px, transparent 4px 7px); }
.lg-maybe { width: 10px; height: 10px; margin: 0 4px; border-radius: 50%; border: 2px solid var(--amber); }
.lg-car { width: 6px; height: 6px; margin: 0 6px; border-radius: 50%; background: var(--car); box-shadow: 0 0 6px var(--car); }

.toolbar { position: fixed; top: 16px; right: 16px; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chip-btn { white-space: nowrap; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease; }
.chip-btn:active { transform: scale(0.97); }
.chip-btn:disabled { opacity: 0.45; cursor: default; }
.chip-btn:disabled:active { transform: none; }
.q { width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #191300; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ---------- Timebar ---------- */
.timebar { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 3; min-height: 92px; border-radius: 20px; display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 18px; padding: 10px 18px; }
.play { width: 44px; height: 44px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; transition: transform 160ms var(--ease-out); }
.play:active { transform: scale(0.94); }
.play svg { width: 18px; height: 18px; fill: currentColor; grid-area: 1 / 1; transition: opacity 120ms ease, transform 160ms var(--ease-out); }
.play .i-pause { opacity: 0; transform: scale(0.8); }
.play[data-playing] .i-play { opacity: 0; transform: scale(0.8); }
.play[data-playing] .i-pause { opacity: 1; transform: none; }

.clock { min-width: 116px; }
.clock-12 { white-space: nowrap; font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.clock-24 { font-family: var(--mono); font-size: 12px; color: var(--faint); margin-top: 2px; white-space: nowrap; }

.track-wrap { position: relative; padding-top: 24px; min-width: 0; }
.ticks { position: absolute; left: 9px; right: 9px; top: 0; height: 24px; }
.tick { position: absolute; top: -6px; width: 30px; height: 30px; margin-left: -15px; display: grid; place-items: center; }
.tick b { font-family: var(--mono); font-size: 10.5px; font-weight: 500; width: 17px; height: 17px; border-radius: 5px; display: grid; place-items: center; background: rgba(255,255,255,0.1); color: var(--muted); transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-out); }
.tick:active b { transform: scale(0.9); }
.tick[data-on] b { background: var(--red); color: #fff; }

input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 28px; background: none; margin: 0; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--track, rgba(255,255,255,0.1)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--track, rgba(255,255,255,0.1)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,0.12), 0 2px 6px rgba(0,0,0,0.5); transition: transform 140ms var(--ease-out); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,0.12); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
.track-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 2px; }

.time-actions { display: flex; gap: 8px; align-items: center; }
.time-actions .chip-btn { background: rgba(255,255,255,0.06); }
.icon-only { display: none; }

/* ---------- Map markers ---------- */
.mk { width: 46px; height: 46px; pointer-events: none; }
.mk-dot { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--soon); border: 2px solid #0b0e14; pointer-events: auto; cursor: pointer;
  transition: background-color 220ms ease, transform 220ms var(--ease-out), opacity 220ms ease; }
.mk-dot::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; }
.mk-arrow { position: absolute; inset: 0; opacity: 0; transform: scale(0.85); transition: opacity 220ms ease, transform 220ms var(--ease-out); }
.mk-arrow svg { width: 100%; height: 100%; display: block; }
.mk-ring { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--red); opacity: 0; }
.mk[data-state="active"] .mk-dot { background: var(--red); transform: scale(1.1); }
.mk[data-state="active"] .mk-arrow { opacity: 1; transform: none; }
.mk[data-state="active"] .mk-ring { animation: ping 2.2s var(--ease-out) infinite; }
.mk[data-state="soon"] .mk-dot { opacity: 0.85; }
.mk[data-state="possible"] .mk-dot { background: transparent; border: 2.5px solid var(--amber); width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.mk[data-state="done"] .mk-dot { opacity: 0.35; }
.mk[data-state="hidden"] { visibility: hidden; }
.mk[data-flash] .mk-dot { transform: scale(1.8); }
.far .mk[data-state="active"] .mk-arrow { opacity: 0; }
.far .mk-dot { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-width: 1.5px; }
.far .mk[data-state="active"] .mk-ring { animation: none; }
@keyframes ping { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(3.2); } }

.vlabel { display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: rgba(12,15,22,0.88); border: 1px solid var(--line-strong); box-shadow: 0 6px 20px rgba(0,0,0,0.5); cursor: pointer; transition: transform 160ms var(--ease-out), opacity 200ms ease, border-color 200ms ease; }
.vlabel:active { transform: scale(0.96); }
.vlabel .num { width: 20px; height: 20px; border-radius: 999px; font-size: 11px; }
.vlabel[data-state="active"] { border-color: rgba(255,77,79,0.55); }
.vlabel[data-state="active"] .num { background: var(--red); color: #fff; }
.vlabel[data-state="possible"] .num { background: var(--amber); color: #1a1205; }
.vlabel small { font-weight: 500; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.vlabel[data-hidden] { opacity: 0; pointer-events: none; }
.vl-text { display: inline-flex; align-items: center; gap: 7px; }
.compact .vlabel { padding: 3px; }
.compact .vlabel .vl-text { display: none; }

.special { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #191300; font-weight: 700; font-size: 13px; box-shadow: 0 0 0 4px rgba(245,207,92,0.22); cursor: pointer; transition: opacity 200ms ease, transform 160ms var(--ease-out); }
.special:active { transform: scale(0.92); }
.special[data-hidden] { opacity: 0; pointer-events: none; }
.compact .special { width: 20px; height: 20px; font-size: 11px; box-shadow: 0 0 0 3px rgba(245,207,92,0.2); }

/* Popups */
.maplibregl-popup { max-width: min(280px, calc(100vw - 32px)) !important; animation: pop 160ms var(--ease-out); }
.maplibregl-popup-content { background: var(--glass-strong); color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; box-shadow: 0 16px 40px rgba(0,0,0,0.55); font-family: var(--font); }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 20px; width: 32px; height: 32px; right: 0; top: 0; border-radius: 0 12px 0 8px; }
.pop-title { font-weight: 600; font-size: 14px; margin-right: 22px; }
.pop-rule { font-size: 13px; margin-top: 6px; line-height: 1.45; }
.pop-rule.red { color: #ff8a8b; }
.pop-rule.amber { color: var(--amber); }
.pop-meta { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.pop-meta i { color: var(--faint); }
@keyframes pop { from { opacity: 0; } }

.maplibregl-ctrl-attrib { background: rgba(11,14,20,0.6) !important; color: var(--faint); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--tb, 92px) + 24px); }
.maplibregl-ctrl-group { background: #1a202c; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1) brightness(0.9); }

/* ---------- Modal ---------- */
.modal { padding: 0; border: 0; background: none; color: var(--text); width: min(560px, calc(100vw - 24px)); max-width: none; overflow: visible; max-height: none;
  opacity: 0; transform: scale(0.96); transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), overlay 200ms allow-discrete, display 200ms allow-discrete; }
.modal[open] { opacity: 1; transform: none; }
@starting-style { .modal[open] { opacity: 0; transform: scale(0.96); } }
.modal::backdrop { background: rgba(4,6,10,0); transition: background-color 200ms ease, overlay 200ms allow-discrete, display 200ms allow-discrete; }
.modal[open]::backdrop { background: rgba(4,6,10,0.6); }
@starting-style { .modal[open]::backdrop { background: rgba(4,6,10,0); } }
.modal-inner { border-radius: 20px; padding: 22px 24px; max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; background: var(--glass-strong); scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
.modal header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.icon-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.06); transition: transform 160ms var(--ease-out); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.gloss { margin: 0; display: grid; gap: 2px; }
.gloss > div { padding: 12px 0; border-top: 1px solid var(--line); }
.gloss dt { font-weight: 600; font-size: 14px; color: var(--gold); }
.gloss dd { margin: 4px 0 0; font-size: 14px; line-height: 1.55; color: #c6cdd9; }
.fine { margin: 10px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,0.04); color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Hover (pointer devices only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .venue-btn:hover { background: rgba(255,255,255,0.04); }
  .sg:hover, button.step:hover { background: rgba(255,255,255,0.05); }
  .mini:hover:not(:disabled), .swap:hover { color: var(--text); background: rgba(255,255,255,0.09); }
  .corner:hover { background: rgba(255,255,255,0.05); }
  .chip-btn:hover:not(:disabled) { background: rgba(30,36,48,0.95); }
  .link-btn:hover { opacity: 0.8; }
  .seg:hover:not([aria-selected="true"]) { color: var(--text); }
  .vlabel:hover { border-color: rgba(255,255,255,0.3); }
}

/* ---------- Phones: time controls on top, list as a bottom sheet ---------- */
@media (max-width: 760px) {
  .toolbar { display: none; }
  .icon-only { display: inline-flex; width: 36px; padding: 0; }

  .timebar { top: calc(var(--safe-t) + 8px); bottom: auto; left: 8px; right: 8px; min-height: 0; border-radius: 18px;
    grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 4px 12px; padding: 10px 12px 8px; }
  .play { width: 40px; height: 40px; }
  .clock { min-width: 0; }
  .clock-12 { font-size: 21px; }
  .clock-24 { font-size: 11px; }
  .track-wrap { grid-column: 1 / -1; grid-row: 2; }
  .track-wrap { padding-top: 38px; }
  .ticks { height: 38px; }
  .tick { top: 8px; width: 24px; height: 24px; margin-left: -12px; }
  .tick[data-row="1"] { top: -9px; }
  .tick b { width: 15px; height: 15px; font-size: 9.5px; }

  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: calc(100dvh - var(--tb, 110px) - var(--safe-t) - 20px);
    border-radius: 22px 22px 0 0; border-bottom: 0;
    transform: translateY(70%);
    transition: transform 500ms var(--ease-drawer);
    will-change: transform; }
  .panel[data-dragging] { transition: none; }
  .sheet-grab { touch-action: none; cursor: grab; }
  .sheet-handle { display: grid; place-items: center; width: 100%; height: 24px; }
  .sheet-handle span { width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.22); }
  .panel-head { padding: 0 16px 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
  .panel-head .eyebrow { width: 100%; margin: 0; }
  h1 { font-size: 21px; margin: 0; }
  .panel-head .segmented { width: 196px; }
  .seg { height: 32px; }
  .status { margin: 0 16px 12px; padding: 10px 12px; }
  .status-num { font-size: 26px; }

  .panel-scroll { padding-bottom: var(--safe-b); }
  .assume { margin: 0 16px 10px; }
  .legend-inline { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px 14px; margin: 0 16px 10px; padding: 0; font-size: 12px; }
  .search { margin: 0 16px 10px; }
  .search input, .rf-field input { font-size: 16px; } /* 16px stops iOS zooming in on focus */
  .views { margin: 0 16px 12px; }
  .route-form, #routeResult { margin-left: 16px; margin-right: 16px; }
  .pick-hint { top: calc(var(--tb, 110px) + var(--safe-t) + 16px); }
  .venues { padding: 0 8px 8px; }
  .panel-foot { flex-direction: column; align-items: flex-start; }
  .src { text-align: left; max-width: none; }

  .maplibregl-ctrl-bottom-right { bottom: 0; }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none; }
  .maplibregl-ctrl-top-right { top: calc(var(--tb, 110px) + var(--safe-t) + 16px); bottom: auto; }
  .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0 8px 0 0; }
  .maplibregl-ctrl-group button { width: 40px; height: 40px; }
}

@media (max-width: 380px) {
  .panel-head .segmented { width: 100%; }
  .clock-24 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .venue[data-enter] { animation: none; }
  .mk[data-state="active"] .mk-ring { animation: none; opacity: 0.5; transform: scale(1.8); }
  .venue-body, .panel { transition: none; }
}
