/* Next Ride HK — shared design tokens and chrome */
:root {
  --bg: #0b111e;
  --bg-elevated: #111a2e;
  --bg-card: #16213a;
  --bg-card-hover: #1c2a4a;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #ef4444;
  --kmb: #e11d48;
  --ctb: #eab308;
  --mtr: #a855f7;
  --lrt: #DBB400;
  --ferry: #06b6d4;
  --gmb: #22c55e;
  --nlb: #f97316;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 16px 40px rgba(2, 8, 23, 0.45);
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --type-all: var(--accent);
  --type-mtr: var(--mtr);
  --type-lrt: var(--lrt);
  --type-bus: #fb7185;
  --type-gmb: var(--gmb);
  --type-ferry: var(--ferry);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; background: var(--bg); color: var(--text); }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(56, 189, 248, 0.10), transparent 55%),
    var(--bg);
}
button, input, select, summary { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }

.glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.glyph svg { width: 100%; height: 100%; }

/* Type colors */
.type-all { color: var(--type-all); }
.type-mtr { color: var(--type-mtr); }
.type-lrt { color: var(--type-lrt); }
.type-bus { color: var(--type-bus); }
.type-gmb { color: var(--type-gmb); }
.type-ferry { color: var(--type-ferry); }
.rail-mtr { --rail: var(--mtr); }
.rail-lrt { --rail: var(--lrt); }
.rail-bus { --rail: var(--kmb); }
.rail-gmb { --rail: var(--gmb); }
.rail-ferry { --rail: var(--ferry); }

.op-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  white-space: nowrap;
}
.op-badge.op-MTR { background: rgba(168, 85, 247, 0.18); color: #e9d5ff; }
.op-badge.op-MTRBUS {
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
  text-transform: none;
  letter-spacing: 0.01em;
}
.op-badge.op-KMB { background: rgba(225, 29, 72, 0.2); color: #fecdd3; }
.op-badge.op-CTB { background: #eab308; color: #0b111e; }
.op-badge.op-NLB { background: rgba(249, 115, 22, 0.22); color: #fed7aa; }
.op-badge.op-GMB { background: rgba(34, 197, 94, 0.2); color: #bbf7d0; }
.op-badge.op-STAR, .op-badge.op-ferry { background: rgba(6, 182, 212, 0.2); color: #a5f3fc; }
.op-badge.op-LRT { background: rgba(217, 119, 6, 0.22); color: #fde68a; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(16, 185, 129, 0.08);
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 600;
}
.live-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: live-dot 1.8s ease-out infinite;
}

.weather-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.weather-pill .mono { font-weight: 600; }
.weather-pill .glyph { color: var(--amber); }
.weather-pill.is-compact { padding: 0 8px; gap: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: background 200ms ease, transform 200ms ease, border-color 200ms ease, color 200ms ease;
}
.btn-primary {
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
  color: #052033;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.28);
}
.btn-primary:hover { background: linear-gradient(180deg, #7dd3fc, #38bdf8); }
.btn-ghost {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.btn-text { min-height: 36px; padding: 0 8px; color: var(--text-muted); gap: 6px; }
.btn-text:hover { color: var(--text); }
.btn-sm { min-height: 36px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 13px; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.icon-btn:hover { background: var(--bg-card); color: var(--text); border-color: var(--border); }

/* ETA chips */
.eta-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.03em;
  color: var(--text);
}
.eta-chip small {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}
.eta-chip.is-arriving {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  animation: arriving-pulse 1.6s ease-in-out infinite;
}
.eta-chip.is-soon {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.32);
  color: #fbbf24;
}

/* Filters */
.filter-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
  padding: 2px;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  white-space: nowrap;
  transition: transform 240ms ease, background 240ms ease, border-color 240ms ease, color 240ms ease, box-shadow 240ms ease;
}
.filter-pill .labels { display: flex; flex-direction: column; line-height: 1.1; align-items: flex-start; }
.filter-pill .labels b { font-size: 12px; font-weight: 650; color: inherit; }
.filter-pill .labels span { font-size: 10px; color: var(--text-dim); }
.filter-pill .glyph { width: 22px; height: 22px; }
.filter-pill:hover { background: var(--bg-card-hover); color: var(--text); }
.filter-pill.is-selected {
  color: var(--text);
  border-color: color-mix(in srgb, var(--pill, var(--accent)) 55%, var(--border-strong));
  background: color-mix(in srgb, var(--pill, var(--accent)) 16%, var(--bg-card));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--pill, var(--accent)) 25%, transparent);
  transform: scale(1.04);
}

/* Location gate */
.gate {
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top, 0px)) 20px max(32px, env(safe-area-inset-bottom, 0px));
}
.gate-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.gate-bar-end {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lang-toggle {
  display: inline-flex;
  align-items: stretch;
  height: 32px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.lang-toggle button {
  min-width: 36px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  transition: background 200ms ease, color 200ms ease;
}
.lang-toggle button:hover { color: var(--text); }
.lang-toggle button.is-selected {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.gate-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 0 16px;
}
.gate h1 {
  margin: 16px 0 0;
  font-size: clamp(32px, 6vw, 44px);
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-weight: 700;
}
.gate .sub {
  margin: 12px 0 0;
  font-size: 16px;
  color: var(--text-muted);
  max-width: 28em;
}
.gate .cta { width: 100%; margin-top: 28px; min-height: 56px; font-size: 16px; }
.gate .hint { margin: 10px 0 0; font-size: 13px; color: var(--text-dim); text-align: center; }
.gate-alt {
  margin: 32px 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: left;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
}
.preset:hover, .preset:focus-visible {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.preset b { font-size: 14px; font-weight: 650; }
.preset span { font-size: 12px; color: var(--text-muted); }
.advanced {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.advanced summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 550;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary:hover { color: var(--text-muted); }
.coord-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 12px;
}
.coord-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.coord-row input {
  height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-family: var(--mono);
  font-size: 13px;
}

/* Map */
.hk-map {
  position: relative;
  overflow: hidden;
  background: #0a1220;
  isolation: isolate;
}
.hk-map svg.harbour { width: 100%; height: 100%; display: block; }
.hk-map .glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(56, 189, 248, 0.14), transparent 58%);
  pointer-events: none;
}
.hk-map.is-bright {
  background: #d6e4f0;
}
.hk-map.is-bright .glow { background: radial-gradient(ellipse at 50% 45%, rgba(2, 132, 199, 0.12), transparent 58%); }
.hk-map.is-satellite { background: #16301f; }
.hk-map.is-satellite .glow { background: radial-gradient(ellipse at 50% 45%, rgba(34, 197, 94, 0.12), transparent 58%); }

.pin {
  position: absolute;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: color-mix(in srgb, var(--pin, var(--accent)) 92%, #0b111e);
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 18px rgba(2, 8, 23, 0.45);
  transform: translateZ(0);
  transition: transform 220ms ease, box-shadow 220ms ease;
  z-index: 2;
}
.pin:hover { transform: scale(1.08); z-index: 4; }
.pin.is-selected {
  transform: scale(1.16);
  z-index: 5;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pin) 35%, transparent), 0 10px 22px rgba(2, 8, 23, 0.5);
}
.pin.is-arriving::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--pin);
  animation: pin-ring 1.8s ease-out infinite;
  pointer-events: none;
}
.pin .glyph { width: 20px; height: 20px; }

/* Cards */
.stop-card, .trip-card, .hero-card, .lookup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 200ms ease, border-color 200ms ease, transform 240ms ease, box-shadow 240ms ease;
}
.stop-card:hover, .trip-card:hover, .lookup-card:hover { background: var(--bg-card-hover); }
.stop-card.is-selected, .trip-card.is-selected {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.empty-state, .error-banner {
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.4);
}
.error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-style: solid;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}
.error-banner button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.2);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.error-banner button:hover { background: rgba(239, 68, 68, 0.35); }

.walk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 12px;
}
.walk .mono { color: var(--text-muted); font-size: 12px; font-weight: 500; }

.route-no {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.lookup {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 8px;
  align-items: end;
}
.lookup label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.lookup select, .lookup input {
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 0 10px;
  width: 100%;
}
.lookup-card {
  margin-top: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lookup-empty { margin-top: 10px; font-size: 13px; color: var(--text-dim); }

.preview-note {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px 0 4px;
}

/* Radius chips */
.radius-row { display: flex; gap: 6px; }
.radius-chip {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.radius-chip:hover { color: var(--text); background: var(--bg-card); }
.radius-chip.is-selected {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text);
}

/* Menu / pop */
.menu {
  position: relative;
}
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  z-index: 8;
  display: none;
}
.menu.is-open .menu-pop { display: block; }
.menu-pop button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.menu-pop button:hover, .menu-pop button.is-selected { background: var(--bg-card); color: var(--text); }

/* Motion */
@keyframes live-dot {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  100% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}
@keyframes arriving-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
@keyframes pin-ring {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes sheet-up {
  from { transform: translateY(28%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fade-up {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
@keyframes spin-once {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes tick {
  0% { transform: translateY(0); opacity: 1; }
  35% { transform: translateY(-6px); opacity: 0; }
  35.1% { transform: translateY(6px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes draw-y {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@keyframes slide-left {
  from { transform: translateX(-16px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes locating {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.7; }
}
@keyframes lead-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.15); }
  50% { box-shadow: 0 0 32px 0 rgba(16, 185, 129, 0.22); }
}

.is-locating .cta-glyph { animation: locating 1s ease-in-out infinite; }
.refresh-icon.is-spinning { animation: spin-once 600ms ease; }
.eta-chip.is-ticking { animation: tick 420ms ease; }

@media (min-width: 720px) {
  .presets { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

.gate-mark {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border);
}
.gate-glance .gate-mark { width: 64px; height: 64px; border-radius: 20px; }
.gate-rail { padding-top: 8px; }
.gate-rail .gate-body { justify-content: flex-start; padding-top: 40px; }
.gate-timeline h1 { font-size: clamp(36px, 7vw, 52px); }
/* Option A — Glance sheet */
.option-a { min-height: 100svh; min-height: 100dvh; }
.a-shell {
  box-sizing: border-box;
  height: 100svh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: 0;
}
.a-map-wrap { position: relative; min-height: 0; flex: 1 1 auto; }
.a-map-wrap .hk-map { height: 100%; }
.a-map-ui {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  z-index: 6;
  pointer-events: none;
}
.a-map-ui > * { pointer-events: auto; }
.a-map-float {
  position: absolute;
  right: 12px;
  bottom: 28px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: calc(100% - 72px);
  pointer-events: none;
}
.a-map-float > * { pointer-events: auto; }
.a-map-float-tools { display: flex; gap: 6px; }
.a-map-float .menu-pop { top: auto; bottom: calc(100% + 6px); }
.a-map-float .icon-btn,
.a-map-float .radius-chip {
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(2, 8, 23, 0.35);
}
.a-map-float .radius-chip.is-selected {
  background: var(--bg-card);
  color: var(--text);
}
.a-map-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(2, 8, 23, 0.35);
}
.a-sheet {
  position: relative;
  z-index: 3;
  background: color-mix(in srgb, var(--bg-elevated) 92%, #020617);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  margin-top: -20px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  animation: sheet-up 420ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -16px 40px rgba(2, 8, 23, 0.4);
  flex: 0 1 auto;
  height: auto;
  max-height: 60%;
}
.a-sheet:has(.a-sheet-pin.has-picked) {
  flex: 0 0 60%;
  height: 60%;
  max-height: 60%;
}
.a-sheet-body {
  flex: 0 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 16px max(16px, env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
.a-sheet:has(.a-sheet-pin.has-picked) .a-sheet-body {
  flex: 1 1 auto;
}
.a-sheet-body > :not(.a-sheet-pin) {
  min-width: 0;
}
.a-list,
.a-card,
.hero-card {
  overflow-x: hidden;
  touch-action: pan-y;
}
.a-filters,
.a-filter-bar {
  min-width: 0;
  max-width: 100%;
}
.a-filter-bar,
.a-filter-bar .filter-row {
  touch-action: pan-x pan-y;
}
.a-sheet-pin {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0 -16px 20px;
  padding: 0 16px 12px;
  background: color-mix(in srgb, var(--bg-elevated) 96%, #020617);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(2, 8, 23, 0.4);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.a-sheet-body:has(.a-sheet-pin.has-picked) {
  padding-bottom: 0;
}
.a-sheet-pin.has-picked {
  /* Fill the visible sheet; trip body grows and inner-scrolls. Not sticky at full height, so the list below stays reachable. */
  position: relative;
  top: auto;
  height: 100%;
  max-height: 100%;
  flex: 0 0 auto;
  margin-bottom: 0;
}
.a-sheet-pin .a-soon { margin-bottom: 0; }
#soon-slot { width: 100%; min-width: 0; }
.a-sheet-pin:not(.has-picked) #soon-slot,
.a-sheet-pin:not(.has-picked) .a-soon { display: none; }
.a-handle {
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.35);
  margin: 10px auto 12px;
}
.a-sheet-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title chrome"
    "title live";
  gap: 6px 8px;
  align-items: center;
  margin-bottom: 12px;
}
.a-sheet-title { grid-area: title; min-width: 0; }
.a-sheet-chrome, .a-sheet-live {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.a-sheet-chrome { grid-area: chrome; }
.a-sheet-live { grid-area: live; }
.a-sheet-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.03em;
}
.a-sheet-head .subhead { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }

.hero-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 16px;
  margin: 0 0 20px;
  align-items: center;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--hero, var(--mtr)) 16%, var(--bg-card)), var(--bg-card));
}
.hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--hero, var(--mtr)) 20%, #0b111e);
  color: var(--hero, var(--mtr));
  animation: breathe 1.5s ease-in-out infinite;
}
.hero-icon .glyph { width: 36px; height: 36px; }
.hero-card .hero-plat-sign {
  --rail: var(--sign, var(--type-mtr));
  width: 64px;
  min-height: 64px;
  border-radius: 18px;
  padding: 8px 4px 9px;
  flex-shrink: 0;
}
.hero-card .hero-plat-sign .num { font-size: 36px; }
.hero-card .hero-plat-sign .lab { font-size: 9px; margin-top: 4px; }
html[lang="en"] .hero-card .hero-plat-sign .lab { font-size: 8px; letter-spacing: 0; }
.hero-copy .kicker {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.hero-copy h3 { margin: 0; font-size: 16px; letter-spacing: -0.03em; line-height: 1.25; }
.hero-copy .dest { margin-top: 4px; color: var(--text-muted); font-size: 13px; }
.hero-eta {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 0.9;
  text-align: right;
}
.hero-eta .num { font-size: 48px; }
.hero-eta .unit { display: block; font-size: 12px; color: var(--text-muted); font-weight: 550; letter-spacing: 0; margin-top: 4px; }
.hero-eta.is-arriving { color: #6ee7b7; }
.hero-eta.is-arriving .num { font-size: 22px; letter-spacing: -0.04em; line-height: 1.1; width: 7ch; }

.a-filters { margin: 16px 0 12px; min-width: 0; max-width: 100%; }
.a-sheet-pin .a-filters {
  margin: 0;
  flex: 0 0 auto;
  min-width: 0;
}
.a-sheet-pin .a-filter-bar {
  touch-action: pan-x pan-y;
}
.a-sheet-pin.has-picked .a-filters {
  display: none;
}
.a-filter-bar > * { min-width: 0; }
#filter-slot { flex: 1 1 0; min-width: 0; max-width: 100%; overflow: hidden; }
#hero-slot, #error-slot, #stops-list, .hero-card, .hero-copy, .a-list { min-width: 0; max-width: 100%; }
.option-a .filter-pill { padding: 0 10px; min-height: 44px; }

.a-list { display: flex; flex-direction: column; gap: 8px; }
.a-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  animation: fade-up 360ms ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.a-card > div { min-width: 0; }
.a-card .type-slot {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--rail, var(--accent)) 16%, #0b111e);
  color: var(--rail);
}
.a-card-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.a-card-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  min-width: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.a-card-title .op-badge { flex-shrink: 0; }
.a-routes { margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.a-route { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
.a-route .to {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.3;
}
.a-route .to .route-no { flex-shrink: 0; }
.a-route .to .dest {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.a-route .etas { display: flex; flex-wrap: wrap; gap: 6px; }
.a-lookup { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.a-lookup h4 { margin: 0 0 10px; font-size: 13px; font-weight: 650; color: var(--text-muted); }

@media (min-width: 900px) {
  .a-shell,
  .a-shell:has(.a-sheet-pin.has-picked) {
    display: grid;
    grid-template-rows: none;
    grid-template-columns: 1.15fr 0.85fr;
  }
  .a-map-wrap { flex: none; }
  .a-sheet,
  .a-sheet:has(.a-sheet-pin.has-picked) {
    margin: 0;
    border-radius: 0;
    border-top: 0;
    border-left: 1px solid var(--border);
    animation: none;
    padding: 20px 0 0;
    flex: none;
    height: auto;
    max-height: none;
  }
  .a-sheet-body,
  .a-sheet:has(.a-sheet-pin.has-picked) .a-sheet-body {
    flex: 1 1 auto;
    padding: 0 24px 24px;
  }
  .a-sheet-pin {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
  }
  .a-handle { display: none; }
  .hero-eta .num { font-size: 56px; }
  .a-sheet-head {
    grid-template-areas: "title chrome live";
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }
  .a-map-float { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-icon, .a-sheet, .a-card { animation: none; }
}

/* App shell on top of the glance-sheet tokens */
[hidden] { display: none !important; }
html { color-scheme: dark; }

.gate-glance .gate-bar { justify-content: flex-end; }
.gps-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  text-align: center;
  color: var(--rose);
  font-size: 13px;
}
.coord-row { align-items: end; }
.feed-note {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.radius-row { max-width: 100%; overflow-x: auto; }
.a-sheet { min-height: 0; }
.a-map-wrap { min-height: 0; }
#map-container,
.radar-fallback-canvas {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  width: 100%;
  height: 100%;
}
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  bottom: 4px;
}
.user-dot {
  z-index: 6;
  box-sizing: border-box;
  pointer-events: none;
}
.radar-fallback-canvas { z-index: 1; }
.maplibregl-map { width: 100%; height: 100%; font-family: var(--font); }
.maplibregl-ctrl-attrib { display: none; }
.maplibregl-popup-content {
  background: var(--bg-card);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-family: var(--font);
}
.maplibregl-popup-tip { border-top-color: var(--bg-card); }
.maplibregl-marker.pin {
  width: 28px;
  height: 28px;
  margin: 0;
  cursor: pointer;
}
.maplibregl-marker.pin.is-selected {
  width: 36px;
  height: 36px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pin) 40%, transparent), 0 0 0 2px var(--accent);
}

button.hero-card,
.a-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.a-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.a-card.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
  transform: none;
  background: var(--bg-card-hover);
}
.a-card.is-selected:hover {
  transform: none;
}
.a-card.no-enter { animation: none; }
.filter-pill .glyph { transition: transform 240ms ease; }
.filter-pill.is-selected .glyph { transform: scale(1.12); }

.lookup { grid-template-columns: 1fr; }
.lookup .btn { width: 100%; }
.lookup-eta-line { min-height: 0; }
.op-badge.op-HKKF,
.op-badge.op-SUN,
.op-badge.op-DB {
  background: rgba(6, 182, 212, 0.2);
  color: #a5f3fc;
}

@media (min-width: 720px) {
  .lookup { grid-template-columns: minmax(180px, 230px) 1fr auto; }
  .lookup .btn { width: auto; }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 8, 23, 0.62); }
.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(80dvh, 720px);
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal-header, .modal-body { padding: 16px 18px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.hk-info-grid { display: grid; gap: 14px; }
.info-block h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-muted); }
.info-content { display: grid; gap: 8px; font-size: 14px; }
@media (min-width: 800px) {
  .hk-info-grid { grid-template-columns: 1fr 1fr; }
  .info-block:first-child { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .hero-card { gap: 10px; padding: 14px; }
  .hero-eta .num { font-size: 40px; }
  .hero-icon { width: 52px; height: 52px; }
}

/* Current Option A chrome */
.a-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 18px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(11, 17, 30, 0.78), rgba(11, 17, 30, 0));
}
#map-container { z-index: 1; }
.a-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.a-brand { display: flex; align-items: center; min-width: 0; pointer-events: none; }
.a-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: min(100%, 200px);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 4px 16px rgba(2, 8, 23, 0.35));
}
.a-top-chrome {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  pointer-events: auto;
}
.a-topbar .a-place-row {
  pointer-events: auto;
  align-self: flex-end;
  min-width: 0;
  max-width: min(70%, 220px);
  padding: 5px 10px 5px 5px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  box-shadow: 0 4px 16px rgba(2, 8, 23, 0.35);
}
.a-topbar .a-place-row .a-gps { width: 36px; height: 36px; border-radius: 11px; }
.a-topbar .a-place-row h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.a-topbar .a-place-row .subhead { margin: 1px 0 0; font-size: 12px; color: var(--text-muted); }
.a-topbar .lang-toggle,
.a-topbar .weather-pill,
.a-topbar .live-btn {
  box-shadow: 0 4px 16px rgba(2, 8, 23, 0.35);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
}
.a-topbar .live-btn { background: color-mix(in srgb, var(--bg-elevated) 88%, rgba(16, 185, 129, 0.2)); }
.a-place-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.a-gps {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 16%, #0b111e);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.a-gps:hover, .a-gps:focus-visible { background: color-mix(in srgb, var(--accent) 28%, #0b111e); }
.a-gps.is-locating .glyph { animation: locating 1s ease-in-out infinite; }
.a-place-btn {
  display: block;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}
.a-place-btn:hover .a-change, .a-place-btn:focus-visible .a-change { text-decoration: underline; }
.a-change { color: var(--accent); font-weight: 650; }
.live-control { display: inline-flex; }
.live-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 88%, rgba(16, 185, 129, 0.2));
  color: #6ee7b7;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.live-btn.is-open { padding: 0 10px 0 8px; }
.live-btn.is-open, .live-btn:hover, .live-btn:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--emerald) 45%, transparent);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: live-dot 1.8s ease-out infinite;
}
.live-btn.is-refreshing .live-dot { animation: live-dot 0.6s ease-out infinite; }
.weather-wrap { position: relative; display: inline-flex; }
.weather-pill.is-open { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.weather-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(260px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 96%, #020617);
  box-shadow: 0 12px 32px rgba(2, 8, 23, 0.5);
  text-align: left;
  color: var(--text);
}
.weather-pop-head { display: flex; justify-content: space-between; gap: 8px; }
.weather-pop-cond { margin: 0; font-weight: 650; }
.weather-pop-temp { margin: 4px 0 0; font-size: 28px; line-height: 1; }
.weather-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 12px 0 0; }
.weather-pop-grid .is-wide { grid-column: 1 / -1; }
.weather-pop-grid dt { font-size: 11px; color: var(--text-dim); }
.weather-pop-grid dd { margin: 2px 0 0; }
.weather-pop-warn { margin: 10px 0 0; font-size: 13px; }
.weather-pop-warn.is-none { color: var(--text-muted); }
.weather-pop-updated { margin: 10px 0 0; font-size: 11px; color: var(--text-dim); }
.a-filter-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.a-filter-bar .filter-row { flex: 1; min-width: 0; }
.a-filter-bar:has(.stop-search.is-open) .filter-row { display: none; }
.option-a .stop-search { min-height: 44px; }
.stop-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: inherit;
}
.stop-search.is-collapsed { width: 44px; height: 44px; justify-content: center; padding: 0; }
.stop-search.is-collapsed.has-query { width: auto; max-width: min(46%, 160px); padding: 0 12px 0 10px; color: var(--text); }
.stop-search.is-collapsed:hover { color: var(--text); background: var(--bg-card-hover); }
.stop-search-keyword { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
.stop-search.is-open {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 0 4px 0 12px;
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}
.stop-search-field { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.stop-search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.stop-search-clear {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
}
.a-credit {
  margin: 20px 0 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
html.is-area-open,
html.is-area-open body {
  overflow: hidden;
}
.a-area-pop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.a-area-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(2, 8, 23, 0.55);
  touch-action: none;
}
.a-area-card {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  height: min(78dvh, 640px);
  max-height: min(78dvh, 640px);
  overflow-x: hidden;
  overflow-y: hidden;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 20px;
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 96%, #020617);
  box-shadow: 0 -16px 40px rgba(2, 8, 23, 0.5);
}
.a-area-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex: 0 0 auto; }
.a-area-card-head h3 { margin: 0; font-size: 18px; }
.a-area-card-head .subhead { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.a-locate {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.a-locate .cta { width: 100%; min-height: 52px; font-size: 16px; }
.a-locate .hint { margin: 8px 0 0; text-align: center; color: var(--text-dim); font-size: 13px; }
.a-locate .gate-alt { margin: 16px 0 10px; }
.a-cancel-area { display: block; width: 100%; margin-top: 8px; text-align: center; }
.a-area-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 8px 0 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  background: var(--bg-card);
}
.a-area-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.a-area-search-ico { flex-shrink: 0; color: var(--text-muted); line-height: 0; }
.a-area-search-ico svg,
.a-area-search-ico .glyph { width: 18px; height: 18px; display: block; }
.a-area-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 400 16px/1.3 inherit;
  outline: none;
  padding: 10px 0;
  overflow-x: hidden;
}
.a-area-search input::placeholder { color: var(--text-dim); }
.a-area-search input[type="search"]::-webkit-search-cancel-button,
.a-area-search input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.a-area-search-clear {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.a-area-search-clear:hover,
.a-area-search-clear:focus-visible { color: var(--text); }
.a-area-search-clear svg,
.a-area-search-clear .glyph { width: 16px; height: 16px; display: block; }
.a-area-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 4px;
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
.a-area-label {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-dim);
}
.a-area-list { display: flex; flex-direction: column; gap: 2px; }
.a-area-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 4px 8px;
  align-items: center;
  width: 100%;
  padding: 4px 0;
  border-radius: 10px;
}
.a-area-pick {
  display: block;
  width: 100%;
  padding: 8px 4px 8px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  border-radius: 8px;
  min-width: 0;
}
.a-area-pick:hover,
.a-area-pick:focus-visible { background: var(--bg-card-hover, color-mix(in srgb, var(--bg-card) 80%, #020617)); }
.a-area-pick .name,
.a-area-pick .meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-area-pick .name {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: 0;
}
.a-area-pick .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.a-area-pin {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0;
}
.a-area-pin:hover,
.a-area-pin:focus-visible { color: var(--text-muted); background: color-mix(in srgb, var(--text) 8%, transparent); }
.a-area-pin.is-on { color: var(--accent); }
.a-area-pin svg,
.a-area-pin .glyph { width: 18px; height: 18px; display: block; }
.a-area-pin.is-on svg { fill: currentColor; }
.a-pin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.a-pin-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 40px;
  padding: 0 4px 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-card));
  color: var(--text);
}
.a-pin-chip-go {
  border: 0;
  background: transparent;
  color: inherit;
  font: 650 13px/1 inherit;
  padding: 0;
  max-width: 16em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-pin-chip .a-area-pin { width: 28px; height: 28px; color: var(--accent); }
.a-pin-chip .a-area-pin svg,
.a-pin-chip .a-area-pin .glyph { width: 14px; height: 14px; }
.a-pin-chip .a-area-pin svg { fill: currentColor; }
.a-area-status {
  margin: 14px 2px 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.a-area-foot { flex: 0 0 auto; }
.a-area-source {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
.a-area-foot .advanced { margin-top: 16px; }
.a-area-foot .coord-row input { font-size: 16px; }
.a-range { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.a-range-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 92px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 96%, #020617);
  box-shadow: 0 8px 24px rgba(2, 8, 23, 0.45);
}
.a-range-opt {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
}
.a-range-opt.is-selected, .a-range-opt:hover { color: var(--text); background: var(--bg-card); }
.eta-chip { position: relative; }
.eta-chip.is-updated { animation: eta-glow 1.8s ease; }
.eta-chip.is-sooner { --eta-glow: rgba(16, 185, 129, 0.55); }
.eta-chip.is-later { --eta-glow: rgba(245, 158, 11, 0.55); }
.eta-delta { font-size: 9px; font-weight: 700; margin-left: 2px; }
.eta-chip.is-sooner .eta-delta, .hero-eta.is-sooner .eta-delta { color: #6ee7b7; }
.eta-chip.is-later .eta-delta, .hero-eta.is-later .eta-delta { color: #fbbf24; }
.a-route.is-updated { border-radius: 10px; animation: eta-route-flash 1.8s ease; }
@keyframes eta-glow {
  0% { box-shadow: 0 0 0 0 var(--eta-glow, rgba(16, 185, 129, 0.5)); }
  100% { box-shadow: 0 0 0 8px transparent; }
}
@keyframes eta-route-flash {
  0% { background: color-mix(in srgb, var(--accent) 16%, transparent); }
  100% { background: transparent; }
}
.lang-toggle.is-collapsed button.is-selected { min-width: 40px; }
.a-sheet-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
  min-width: 0;
  max-width: 100%;
}
.a-sheet-meta .a-place-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
.a-sheet-meta .a-place-row:hover .a-change,
.a-sheet-meta .a-place-row:focus-visible .a-change { text-decoration: underline; }
.a-sheet-meta .a-place-row[aria-expanded="true"] .a-gps {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.a-sheet-meta .a-gps {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
}
.a-sheet-meta .a-place-name {
  min-width: 0;
  flex: 0 1 auto;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.a-sheet-meta .a-change {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}
.a-refresh-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
  cursor: pointer;
}
.a-refresh-meta:hover,
.a-refresh-meta:focus-visible { color: var(--text-muted); }
.a-refresh-meta:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
  border-radius: 6px;
}
.a-refresh-meta time,
.a-refresh-meta [data-refresh-ago] { font-variant-numeric: tabular-nums; }
.a-refresh-meta .a-refresh-ico {
  display: none;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 0;
}
.a-refresh-meta.has-refresh .a-refresh-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.a-refresh-meta .a-refresh-ico svg,
.a-refresh-meta .a-refresh-ico .glyph {
  width: 14px;
  height: 14px;
  display: block;
}
.a-refresh-meta .live-dot {
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65);
  animation: a-live-pulse-fresh 1.8s ease-out infinite;
}
.a-refresh-meta.is-stale .live-dot {
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.65);
  animation: a-live-pulse-stale 1.8s ease-out infinite;
}
.a-refresh-meta.is-old .live-dot {
  background: var(--rose);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65);
  animation: a-live-pulse-old 1.8s ease-out infinite;
}
.a-refresh-meta.is-refreshing .live-dot { animation: a-live-pulse-fresh 0.5s ease-out 2; }
.a-refresh-meta.is-refreshing.is-stale .live-dot { animation: a-live-pulse-stale 0.5s ease-out 2; }
.a-refresh-meta.is-refreshing.is-old .live-dot { animation: a-live-pulse-old 0.5s ease-out 2; }
@keyframes a-live-pulse-fresh {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  100% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}
@keyframes a-live-pulse-stale {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.65); }
  100% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}
@keyframes a-live-pulse-old {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
  100% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .a-refresh-meta .live-dot,
  .a-refresh-meta.is-stale .live-dot,
  .a-refresh-meta.is-old .live-dot,
  .a-refresh-meta.is-refreshing .live-dot,
  .a-refresh-meta.is-refreshing.is-stale .live-dot,
  .a-refresh-meta.is-refreshing.is-old .live-dot { animation: none; }
}
.a-card.is-signpost { align-items: start; }
.a-card.is-signpost .a-signposts {
  grid-column: 1 / -1;
  margin-top: 2px;
  gap: 0;
  min-width: 0;
}
.a-sign-section {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}
.a-sign-section + .a-sign-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.a-sign-section.is-unsigned { grid-template-columns: minmax(0, 1fr); }
.a-plat-sign {
  width: 48px;
  min-height: 58px;
  padding: 6px 4px 7px;
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rail) 22%, #0b111e) 0 8px, #0b111e 8px);
  border: 1.5px solid color-mix(in srgb, var(--rail) 70%, #0b111e);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--rail) 35%, transparent), 0 6px 14px rgba(2, 8, 23, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-shrink: 0;
}
.a-plat-sign .num {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  color: #fff;
}
.a-plat-sign .lab {
  margin-top: 3px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--rail) 25%, #f8fafc);
  line-height: 1.15;
  max-width: 100%;
  white-space: nowrap;
}
html[lang="en"] .a-plat-sign .lab { font-size: 7.5px; letter-spacing: 0; }
.a-sign-routes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 2px;
}
.a-signposts .line-text {
  flex-shrink: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--rail) 55%, #fff);
}
.a-route .to:has(.is-swatch) { align-items: center; }
.route-no.is-swatch,
.hero-copy .route-no.is-swatch,
.a-signposts .line-text.is-swatch {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  background: var(--line);
  color: var(--line-ink);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}
.a-signposts .a-route {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  min-width: 0;
}
.a-signposts .a-route .to { flex: 0 1 auto; min-width: 0; }
.a-signposts .a-route .etas {
  flex: 0 0 auto;
  margin-left: auto;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}
.a-signposts .depart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.a-signposts .depart .consist-svg {
  display: block;
  height: 18px;
  width: auto;
  flex-shrink: 0;
  color: color-mix(in srgb, var(--rail) 40%, #e2e8f0);
}
.eta-empty { color: var(--text-dim); font-size: 12px; }
.hero-platform { margin-top: 6px; color: var(--text-muted); font-size: 12px; }

.a-soon {
  --soon-h: 100px;
  box-sizing: border-box;
  height: var(--soon-h);
  max-height: var(--soon-h);
  margin: 0 0 12px;
  padding: 6px 8px 5px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-card) 78%, #020617);
  border: 1px solid var(--border);
  overflow: hidden;
}
.a-soon.is-empty {
  height: auto;
  max-height: var(--soon-h);
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
}
.a-soon.is-empty .a-soon-plot {
  height: auto;
  flex: 0 0 auto;
  overflow: visible;
}
.a-soon-empty {
  margin: 8px 2px 0;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.a-soon-plot {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.a-soon-items { position: relative; flex: 1 1 auto; min-height: 0; }
.a-soon-axis { position: relative; flex: 0 0 16px; height: 16px; margin-top: 2px; }
.a-soon-rail {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 3px;
  height: 2px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text-dim) 45%, transparent);
}
.a-soon-tick {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  pointer-events: none;
}
.a-soon-tick.is-end { color: var(--text-muted); }
.a-soon-tick.is-start { transform: none; }
.a-soon-tick.is-last { transform: translateX(-100%); }
.a-soon-tick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 1px;
  height: 5px;
  background: color-mix(in srgb, var(--text-dim) 55%, transparent);
  transform: translateX(-50%);
}
.a-soon-tick.is-start::before { left: 0; transform: none; }
.a-soon-tick.is-last::before { left: 100%; }
.a-soon.is-empty .a-soon-axis { flex: 0 0 18px; height: 18px; margin: 0; }
.a-soon.is-empty .a-soon-rail { left: 8px; right: 8px; }
.a-soon-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.15;
  max-width: var(--lab-w, 7.5rem);
  pointer-events: none;
}
.a-soon-label .ln {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.a-soon-label.has-line .ln {
  color: var(--line);
  color: oklch(from var(--line) max(l, 0.76) c h);
}
.a-soon-label .st {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-short .a-soon-label .st { display: none; }
.is-inline .a-soon-label { flex-direction: row; gap: 3px; align-items: baseline; }
.is-inline .a-soon-label .st { font-size: 10px; }
.a-soon-mark {
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--mark, var(--accent)) 22%, #0b111e);
  color: var(--mark, var(--accent));
}
.a-soon-mark .glyph { width: 16px; height: 16px; }
.a-soon-mark.is-arriving {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mark, var(--accent)) 35%, transparent);
}
.a-soon.is-spine .a-soon-item {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 22px;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.7s linear;
}
.a-soon.is-spine .a-soon-item.is-entering,
.a-soon.is-spine .a-soon-item.is-leaving { opacity: 0; pointer-events: none; }
.a-soon.is-spine .a-soon-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(calc(-50% + var(--lab-shift, 0px)));
}
.a-soon.is-spine .a-soon-item[data-row="1"] .a-soon-label { bottom: calc(100% + 18px); }
@media (max-width: 389px) {
  .a-sign-section { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
  .a-plat-sign { width: 44px; }
  .a-plat-sign .num { font-size: 26px; }
}
@media (min-width: 900px) {
  .a-sheet-meta { margin-bottom: 12px; }
  .a-refresh-meta { max-width: none; }
}
@media (min-width: 900px) {
  .a-logo { height: 38px; }
  .a-topbar { padding-top: 12px; }
  .a-topbar .a-place-row { max-width: 260px; }
  .a-area-pop { align-items: center; padding: 24px; }
  .a-area-card { border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .eta-chip.is-updated, .a-route.is-updated, .live-dot { animation: none; }
}

/* Combined selected-station + timeline card */
.a-picked.a-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  padding: 0;
  gap: 0;
  margin-top: 4px;
  transform: none;
  animation: none;
  overflow-x: hidden;
  touch-action: pan-y;
  cursor: default;
}
.a-picked.a-card:hover {
  transform: none;
}
.a-picked-head {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 44px 8px 12px;
  min-width: 0;
}
.a-picked-head .a-card-title h3 {
  flex: 0 1 auto;
}
.a-picked-soon {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}
.a-picked .a-soon {
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: transparent;
  box-shadow: none;
}
.a-picked-main {
  display: block;
  padding: 8px 12px 12px;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
.a-picked.is-signpost { align-items: stretch; }
.a-picked.is-signpost .a-signposts {
  margin-top: 0;
  min-width: 0;
}
.a-picked-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--bg-card) 88%, #020617);
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
}
.a-picked-close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}
.a-picked-close:hover,
.a-picked-close:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 12%, var(--bg-card));
}

/* iOS 27 standalone PWA: compositor hack + solid status-bar cover. */
.ios-blur-fix,
.ios-blur-fix-solid {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  background-color: #0b111e;
}
.ios-blur-fix {
  height: 11px;
  z-index: 2147483647;
  -webkit-background-clip: text;
  background-clip: text;
}
.ios-blur-fix-solid {
  height: max(11px, env(safe-area-inset-top, 0px));
  z-index: 2;
}
@media (display-mode: standalone), (display-mode: fullscreen) {
  .ios-blur-fix,
  .ios-blur-fix-solid { display: block; }
  .a-shell { padding-top: 0; padding-bottom: 0; }
}
html.is-standalone .ios-blur-fix,
html.is-standalone .ios-blur-fix-solid { display: block; }
html.is-standalone .a-shell { padding-top: 0; padding-bottom: 0; }
