/* Journexi — Map-First Live UK Transit Workspace */
:root {
  color-scheme: dark;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #070b14;
  --panel: #0d1424;
  --panel-2: #141f36;
  --panel-3: #1b2945;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #1e293b;
  --line-bright: #2e3e5c;

  --accent: #276ef1;
  --accent-bright: #3b82f6;
  --accent-hover: #1d5bd6;

  --live: #34d399;
  --live-bg: #0d2b22;
  --on: #4ade80;
  --on-bg: #0f2c1f;
  --warn: #fbbf24;
  --warn-bg: #332409;
  --bad: #f87171;
  --bad-bg: #381519;
  --sched: #cbd5e1;
  --sched-bg: #1e293b;

  --radius: 14px;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
  font-family: var(--font-sans);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); }
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel-2); color: var(--ink); padding: 8px 14px; border-radius: 8px; z-index: 2000; font-weight: 700; }
.skip:focus { left: 10px; top: 10px; }
.muted { color: var(--muted); }
:focus-visible { outline: 2.5px solid var(--accent-bright); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- clean 3-zone top bar ---------- */
.topbar {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: rgba(7, 11, 20, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 950;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand img { border-radius: 8px; display: block; }

.search {
  position: relative;
  flex: 1;
  max-width: 540px;
  min-width: 0;
}
.search-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line-bright);
  padding: 0 56px 0 40px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  background: var(--panel);
  color: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  border-color: var(--accent-bright);
  background: var(--panel-2);
  box-shadow: 0 0 0 3px rgba(39, 110, 241, 0.25);
  outline: none;
}
.search input::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: var(--panel-3);
  color: #e2e8f0;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.search-clear:hover { background: var(--accent); color: #ffffff; }

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line-bright);
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}
.search input:focus ~ .search-kbd,
.search input:not(:placeholder-shown) ~ .search-kbd { display: none; }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.region-atlas { position: relative; }
.region-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line-bright);
  background: var(--panel);
  color: #f8fafc;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.region-trigger:hover,
.region-trigger[aria-expanded="true"] {
  border-color: var(--accent-bright);
  background: var(--panel-2);
}
.region-ico { color: var(--accent-bright); flex: none; }
.region-code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
  color: #93c5fd;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.region-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(92vw, 490px);
  max-height: min(72vh, 520px);
  overflow: auto;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line-bright);
  background: rgba(11, 17, 31, 0.98);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.65);
  z-index: 1300;
  display: grid;
  gap: 12px;
}
.rg-group { display: grid; gap: 6px; }
.rg-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px;
}
.rg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.rg-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 0;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.rg-opt:hover { background: var(--panel-2); }
.rg-opt:last-child:nth-child(odd) { grid-column: span 2; }
.rg-opt.is-active {
  background: rgba(39, 110, 241, 0.16);
  box-shadow: inset 2.5px 0 0 var(--accent-bright);
}
.rg-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rg-top strong { font-size: 13px; font-weight: 700; color: #ffffff; }
.rg-code { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: #93c5fd; }
.rg-net { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-hubs { font-family: var(--font-mono); font-size: 10.5px; color: #64748b; }

.acc-btn.is-signed { padding-left: 7px; padding-right: 11px; }
.acc-avatar {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.acc-avatar.lg { width: 38px; height: 38px; border-radius: 10px; font-size: 15px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-bright);
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.btn:hover { border-color: var(--accent-bright); background: var(--panel-3); }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.icon { min-width: 40px; padding: 0; }
.btn.small { min-height: 32px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { cursor: wait; }
.btn.is-loading { opacity: 0.88; }
.btn:not(.google-btn).is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.72s linear infinite;
  flex: none;
}

/* ---------- full-height map + panel workspace ---------- */
.layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 416px;
  gap: 12px;
  padding: 12px 12px 0;
}

.mapwrap {
  position: relative;
  min-width: 0;
  min-height: 540px;
  height: 100%;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line-bright);
  background: #0d1422;
}
#map { position: absolute; inset: 0; background: #0d1422; }

.map-btn {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.chip {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 10px;
  background: rgba(13, 20, 36, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.24);
  backdrop-filter: blur(12px);
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.chip.is-following {
  border-color: rgba(52, 211, 153, 0.6);
  color: #ffffff;
}
.chip.is-following::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.4s infinite;
}

.map-filters {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 100%), rgba(13, 20, 36, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 32px rgba(0, 0, 0, 0.42);
}
.mf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(241, 245, 249, 0.88);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.mf-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}
.mf-btn.is-active {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.88), rgba(37, 99, 235, 0.78));
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 2px 10px rgba(37, 99, 235, 0.35);
}
.mf-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.22);
}
.mf-swatch.bus { background: #3b82f6; }
.mf-swatch.rail { background: #f43f5e; }
.mf-btn.is-active .mf-swatch { background: #ffffff; box-shadow: none; }

/* ---------- right workspace panel (single tab bar) ---------- */
.panel {
  height: 100%;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.grab {
  flex: none;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.grab-bar { display: none; }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: #080d18;
  border-radius: 10px;
}
.tabs button {
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tabs button:hover { color: #ffffff; }
.tabs button[aria-selected="true"] {
  background: var(--panel-3);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.24);
}

.panel-progress {
  position: relative;
  flex: none;
  height: 2.5px;
  background: rgba(39, 110, 241, 0.16);
  overflow: hidden;
}
.panel-progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  background: linear-gradient(90deg, transparent, var(--accent-bright) 45%, #60a5fa 75%, transparent);
  animation: progress-sweep 1.05s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.panel-body {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 14px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-bright) transparent;
}

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.msg { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.msg strong { color: #ffffff; }
.msg.error { color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 10px 12px; }
.msg.offline { color: var(--warn); background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; }

.quick-wrap { margin-bottom: 14px; }
.recent-wrap { margin-bottom: 16px; }
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.link-btn {
  background: none;
  border: 0;
  padding: 2px 4px;
  color: var(--accent-bright);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.idx-list {
  display: grid;
  border-top: 1px solid var(--line);
}
.idx-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.idx-row:hover { background: rgba(27, 41, 69, 0.45); }
.idx-code {
  min-width: 44px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
  flex: none;
}
.idx-code.rail { border-left: 3px solid #ef4444; }
.idx-code.tube { border-left: 3px solid #3b82f6; }
.idx-code.tram { border-left: 3px solid #22c55e; }
.idx-code.bus { border-left: 3px solid #38bdf8; }
.idx-code.corridor { min-width: 50px; border-left: 3px solid var(--accent-bright); color: #93c5fd; }

.idx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.idx-main strong { font-size: 13.5px; font-weight: 700; color: #ffffff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idx-main span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idx-state { font-size: 11.5px; font-weight: 700; color: var(--live); white-space: nowrap; font-variant-numeric: tabular-nums; }
.idx-state.plan { color: #60a5fa; }

/* ---------- Nearby metro directory & walkshed proximity rows ---------- */
.near-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.region-m-btn { flex: 1; justify-content: space-between; }
.near-header .section-label { margin-bottom: 4px; }
.near-radius { font-family: var(--font-mono); font-size: 11px; color: #93c5fd; font-weight: 600; }

.metro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.metro-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 12px;
  border: 0;
  background: rgba(13, 20, 36, 0.96);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}
.metro-cell:hover { background: var(--panel-2); }
.metro-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.metro-top strong { font-size: 13.5px; font-weight: 700; color: #ffffff; }
.metro-crs { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: #93c5fd; }
.metro-net { font-size: 11.5px; color: var(--muted); }

/* ---------- compact single-line footer ---------- */
.site-foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 16px 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.foot-credits { margin: 0; }
.foot-credits strong { color: #e2e8f0; }
.foot-links { display: flex; align-items: center; gap: 9px; font-weight: 600; white-space: nowrap; }
.foot-links a { color: #cbd5e1; text-decoration: none; }
.foot-links a:hover { color: #ffffff; text-decoration: underline; }

/* ---------- map overlays, markers & top-down SVG vehicles ---------- */
.stop-dot {
  position: relative;
  width: 15px;
  height: 15px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--stop-colour, #276ef1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}
.stop-dot.rail { width: 17px; height: 17px; border-radius: 5px; }
.stop-dot.sel { outline: 3px solid var(--accent-bright); outline-offset: 2px; }
.stop-dot.pulse-ring::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2.5px solid var(--accent-bright);
  border-radius: inherit;
  animation: marker-pulse 1.8s ease-out infinite;
}

.user-dot {
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #276ef1;
  box-shadow: 0 0 0 8px rgba(39, 110, 241, 0.35), 0 0 20px rgba(39, 110, 241, 0.7);
}

.vehicle-marker {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  transition: opacity 0.2s ease;
}
.vehicle-marker.dim { opacity: 0.32; }

.vehicle-halo {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--vehicle-colour, #276ef1) 50%, transparent);
  background: color-mix(in srgb, var(--vehicle-colour, #276ef1) 14%, transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.vehicle-marker.selected .vehicle-halo {
  opacity: 1;
  animation: marker-pulse 1.8s ease-out infinite;
}

.vehicle-rotator {
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  transform-origin: center center;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.5));
}
.vehicle-svg { display: block; }

.vehicle-badge {
  position: absolute;
  z-index: 3;
  right: -2px;
  bottom: 0;
  max-width: 34px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1.5px 5px;
  border: 1.5px solid #ffffff;
  border-radius: 6px;
  background: #0a0d14;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.vehicle-marker.train .vehicle-badge { background: #be123c; }

@keyframes marker-pulse {
  0% { transform: scale(0.82); opacity: 0.9; }
  100% { transform: scale(1.75); opacity: 0; }
}

.vehicle-popup { min-width: 175px; color: #0a0d14; font-family: var(--font-sans); }
.vehicle-popup strong { display: block; margin-bottom: 3px; font-size: 13.5px; }
.vehicle-follow-note { margin: 4px 0 2px; font-size: 11.5px; font-weight: 700; color: #059669; }

.leaflet-container { font-family: var(--font-sans); }
.leaflet-control-zoom a {
  background: rgba(13, 20, 36, 0.92) !important;
  color: #f8fafc !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}
.leaflet-control-zoom a:hover { background: var(--panel-3) !important; }
.leaflet-control-attribution {
  background: rgba(7, 11, 20, 0.85) !important;
  color: #94a3b8 !important;
  font-size: 11px !important;
  border-radius: 8px 0 0 0;
}
.leaflet-control-attribution a { color: #60a5fa !important; }

/* ---------- departure rows, badges & tiles ---------- */
.board-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.board-title { flex: 1; min-width: 0; }
.board-title h2 { margin: 0; font-size: 17.5px; font-weight: 800; letter-spacing: -0.02em; color: #ffffff; overflow-wrap: anywhere; }
.board-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.board-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex-shrink: 0; }

.deps, .stops { list-style: none; margin: 0; padding: 0; }
.dep { border-bottom: 1px solid var(--line); }
.dep-main {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px 4px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  min-height: 62px;
  transition: background 0.14s ease;
}
.dep-main:hover, .stop:hover { background: var(--panel-2); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--b, #276ef1);
  color: var(--bt, #ffffff);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  max-width: 92px;
  overflow-wrap: anywhere;
}
.badge.long { font-size: 11.5px; }

.plat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #172136;
  border: 1px solid var(--line-bright);
  color: #ffffff;
  line-height: 1;
}
.plat small { font-size: 8.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.72; margin-bottom: 2px; }
.plat b { font-family: var(--font-mono); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.dep-mid { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.dep-dest { font-weight: 700; font-size: 14.5px; color: #ffffff; overflow-wrap: anywhere; }
.dep-sub { color: var(--muted); font-size: 12px; }

.dep-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dep-time { font-family: var(--font-mono); font-size: 15.5px; font-weight: 700; color: var(--live); }
.dep-exp { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dep-exp.late { color: var(--warn); font-weight: 700; }
.st-cancelled .dep-time, .st-cancelled .dep-dest { text-decoration: line-through; opacity: 0.65; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.pill.live { background: var(--live-bg); color: var(--live); }
.pill.live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
.pill.ontime { background: var(--on-bg); color: var(--on); }
.pill.delayed { background: var(--warn-bg); color: var(--warn); }
.pill.cancelled { background: var(--bad-bg); color: var(--bad); }
.pill.scheduled { background: var(--sched-bg); color: var(--sched); }
@keyframes pulse { 50% { opacity: 0.25; } }

.dep-detail { padding: 4px 4px 14px 58px; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.dep-detail .btn { justify-self: start; }
.kv b { color: #ffffff; font-weight: 600; }

.calls { list-style: none; margin: 4px 0; padding: 0 0 0 14px; border-left: 2.5px solid var(--accent); }
.calls li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0 5px 10px; position: relative; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.calls li::before { content: ""; position: absolute; left: -20px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2.5px solid var(--accent); }
.calls .late { color: var(--warn); font-weight: 700; }
.calls .canc { color: var(--bad); text-decoration: line-through; }
.calls button { background: none; border: 0; padding: 0; font: inherit; color: #60a5fa; font-weight: 600; text-align: left; cursor: pointer; }
.calls button:hover { text-decoration: underline; }
.fine { font-size: 11.5px; color: var(--muted); }

/* ---------- stops, walkshed meters & live saved tiles ---------- */
.stop, .near-stop {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 58px;
  transition: background 0.14s ease;
}
.near-stop:hover { background: rgba(27, 41, 69, 0.45); }
.stop-ico { width: 30px; height: 30px; border-radius: 50%; background: var(--c, #276ef1); color: #ffffff; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; }
.stop-ico.rail { border-radius: 7px; }
.stop-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stop-name { font-weight: 700; color: #ffffff; overflow-wrap: anywhere; }
.stop-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-dist { color: var(--live); font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.near-walk {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 72px;
  font-variant-numeric: tabular-nums;
}
.near-walk strong { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: #ffffff; }
.near-walk span { font-size: 11px; color: var(--muted); }
.walk-meter {
  width: 64px;
  height: 3px;
  border-radius: 99px;
  background: var(--line-bright);
  position: relative;
  overflow: hidden;
  margin-top: 2px;
}
.walk-meter::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--walk, 50%);
  background: var(--live);
  border-radius: inherit;
}

.saved-empty {
  padding: 22px 14px;
  border: 1px dashed var(--line-bright);
  border-radius: 12px;
  text-align: center;
  margin-bottom: 14px;
}
.saved-empty-mark {
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  border-radius: 9px;
  background: rgba(39, 110, 241, 0.16);
  color: #60a5fa;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.saved-empty h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: #ffffff; }
.saved-empty .msg { margin-bottom: 12px; }

.saved-grid { list-style: none; margin: 0 0 12px; padding: 0; border-top: 1px solid var(--line); }
.saved-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.saved-item:hover { background: rgba(27, 41, 69, 0.4); }
.saved-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.saved-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.saved-name { font-weight: 700; font-size: 13.5px; color: #ffffff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-preview { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-live-slot { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--live); white-space: nowrap; }
.saved-live-slot.late { color: var(--warn); }
.saved-live-slot.canc { color: var(--bad); }
.saved-del {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
}
.saved-del:hover { background: var(--bad-bg); color: var(--bad); }

.sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px 2px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- autocomplete suggestions with live time previews ---------- */
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1200;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--panel);
  color: var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: min(60vh, 380px);
  overflow: auto;
  border: 1px solid var(--line-bright);
}
.suggest li { padding: 9px 10px; border-radius: 9px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--panel-2); }
.suggest .stop-ico { width: 28px; height: 28px; }
.sg-code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
  color: #93c5fd;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.sg-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-align: right;
  max-width: 138px;
  flex: none;
}
.sg-time strong { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--live); font-variant-numeric: tabular-nums; }
.sg-time.late strong { color: var(--warn); }
.sg-time.canc strong { color: var(--bad); }
.sg-time span { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------- connected rail-track journey composer & route spine ---------- */
.jcomposer { display: grid; gap: 10px; margin-bottom: 12px; }
.jtrack-wrap {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  padding: 4px 10px 4px 6px;
}
.jtrack-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 13px 0;
}
.jnode { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.jnode.origin { background: var(--accent-bright); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22); }
.jnode.dest { border: 2px solid #f43f5e; background: var(--panel-2); }
.jline { flex: 1; width: 1.5px; min-height: 8px; border-left: 1.5px dashed var(--line-bright); margin: 3px 0; }
.jswap {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line-bright);
  background: var(--panel);
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.jswap:hover { border-color: var(--accent-bright); color: #ffffff; }
.jfields { display: flex; flex-direction: column; min-width: 0; }
.jfield { position: relative; display: flex; align-items: center; gap: 8px; }
.jfield label { width: 34px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); flex: none; }
.jfield input {
  width: 100%;
  height: 40px;
  border: 0;
  padding: 0 4px;
  font: inherit;
  font-size: 13.5px;
  background: transparent;
  color: #ffffff;
}
.jfield input:focus { outline: none; }
.jdivider { height: 1px; background: var(--line); }
.jactions { display: flex; gap: 8px; }
.jactions .btn { flex: 1; }

.route { border: 1px solid var(--line-bright); border-radius: 12px; background: var(--panel-2); padding: 12px 14px; margin-bottom: 10px; }
.route-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.route-times { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: #ffffff; font-variant-numeric: tabular-nums; }
.route-dur { padding: 2px 7px; border-radius: 5px; background: var(--panel); border: 1px solid var(--line-bright); font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: #93c5fd; }
.route-legs { list-style: none; margin: 0 0 10px; padding: 0 0 0 14px; border-left: 2px solid var(--line-bright); display: grid; gap: 7px; }
.rleg { position: relative; display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: baseline; font-size: 12.5px; }
.rleg::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-bright);
  border: 2px solid var(--panel-2);
}
.rleg.rail::before { background: #ef4444; }
.rleg.tube::before { background: #3b82f6; }
.rleg.walk::before { background: var(--muted); }
.rleg-mode { font-weight: 700; color: #ffffff; }
.rleg-path { color: #cbd5e1; }
.rleg-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.route-link { font-size: 12px; font-weight: 700; color: #60a5fa; text-decoration: none; }
.route-link:hover { text-decoration: underline; }

/* ---------- install banner, dialog, toast ---------- */
.install {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  max-width: 520px;
  margin: 0 auto;
}
.install img { border-radius: 9px; flex: none; }
.install-text { flex: 1; display: flex; flex-direction: column; font-size: 13px; }
.install-text span { color: var(--muted); font-size: 12px; }

.dialog {
  border: 1px solid var(--line-bright);
  border-radius: 16px;
  padding: 22px;
  width: min(92vw, 410px);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.dialog[open] { animation: dialog-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) both; }
.dialog::backdrop { background: rgba(7, 11, 20, 0.72); backdrop-filter: blur(6px); }
.dialog[open]::backdrop { animation: backdrop-in 0.22s ease-out both; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dialog h2 { margin: 0; font-size: 19px; font-weight: 800; color: #ffffff; }
.dialog-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.dialog-close:hover { color: #ffffff; background: var(--panel-3); }
.providers { display: grid; gap: 10px; margin-top: 16px; }
.providers:not([hidden]),
.auth-signed:not([hidden]),
#auth-error:not([hidden]) {
  animation: panel-reveal 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.google-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 44px;
  background: #ffffff;
  color: #0f172a;
  border-color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.2s ease, transform 0.12s ease;
}
.google-btn:hover:not(:disabled) { background: #f1f5f9; border-color: #f1f5f9; }
.google-btn .btn-ico,
.google-btn .btn-spinner,
.google-btn .btn-check {
  display: inline-grid;
  place-items: center;
  flex: none;
}
.google-btn .btn-spinner,
.google-btn .btn-check { display: none; }
.google-btn.is-loading {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.google-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(59, 130, 246, 0.16) 50%, transparent 75%);
  animation: btn-shimmer 1.1s ease-in-out infinite;
  pointer-events: none;
}
.google-btn.is-loading .btn-ico { display: none; }
.google-btn.is-loading .btn-spinner {
  display: inline-grid;
  color: var(--accent);
  animation: spin 0.78s linear infinite;
}
.google-btn.is-done {
  background: #ecfdf5;
  border-color: #34d399;
  color: #065f46;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}
.google-btn.is-done .btn-ico,
.google-btn.is-done .btn-spinner { display: none; }
.google-btn.is-done .btn-check {
  display: inline-grid;
  color: #059669;
  animation: check-pop 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-signed { display: grid; gap: 14px; margin-top: 12px; }
.auth-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid var(--line-bright);
  background: var(--panel-2);
}
.auth-card-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.auth-card-meta strong { font-size: 13.5px; color: #ffffff; }
.auth-card-meta span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-sync-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(52, 211, 153, 0.3);
  background: rgba(16, 185, 129, 0.12);
  color: var(--live);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.auth-sync-pill.is-syncing {
  border-color: rgba(96, 165, 250, 0.38);
  background: rgba(39, 110, 241, 0.16);
  color: #93c5fd;
}
.auth-sync-pill.is-syncing::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.1s infinite;
}
.auth-actions { display: flex; gap: 8px; }
.auth-actions .btn { flex: 1; }
.btn.danger { color: var(--bad); border-color: rgba(248, 113, 113, 0.35); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }

@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes btn-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes check-pop {
  0% { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes dialog-in {
  0% { opacity: 0; transform: translateY(12px) scale(0.97); }
  100% { opacity: 1; transform: none; }
}
@keyframes backdrop-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes panel-reveal {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: none; }
}
@keyframes progress-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(360%); }
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  background: var(--panel-2);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--line-bright);
  z-index: 3000;
  max-width: 90vw;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ---------- responsive & mobile bottom sheet ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr) 365px; }
}

@media (max-width: 899px) {
  body { overflow: hidden; }
  .topbar {
    height: 58px;
    padding: 0 10px;
    gap: 8px;
  }
  .brand-name { display: none; }
  .search input { padding-right: 36px; }
  .search-kbd { display: none; }
  .region-trigger { display: none; }
  .region-menu {
    position: fixed;
    top: 66px;
    left: 12px;
    right: 12px;
    width: auto;
  }
  .rg-grid { grid-template-columns: 1fr; }
  .btn-label { display: none; }
  #near-me { width: 38px; padding: 0; }
  .acc-btn { padding: 0 10px; font-size: 12px; }

  .layout {
    position: relative;
    display: block;
    padding: 0;
    flex: 1;
    min-height: 0;
  }
  .mapwrap {
    position: absolute;
    inset: 0;
    min-height: 0;
    height: 100%;
    border-radius: 0;
    border: 0;
  }
  .map-btn { top: 54px; right: 10px; left: auto; transform: none; }
  .chip { top: 10px; right: 10px; font-size: 11.5px; padding: 6px 10px; }
  .map-filters { bottom: 198px; left: 10px; }
  .leaflet-bottom.leaflet-right { bottom: 172px; }
  .leaflet-control-attribution { font-size: 10px !important; padding: 1px 6px !important; }

  .panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100dvh - 58px);
    z-index: 800;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(var(--sheet-y, 0px));
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .panel.dragging { transition: none; }

  .grab { padding: 8px 12px 10px; touch-action: none; }
  .grab-bar {
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-bright);
    margin: 0 auto 8px;
    cursor: grab;
  }

  .mobile-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
  }
  .mobile-foot a { color: #cbd5e1; text-decoration: none; font-weight: 600; }
  .mobile-foot a:hover { color: #ffffff; text-decoration: underline; }
  .site-foot { display: none; }
}

@media (min-width: 900px) {
  .near-controls, .mobile-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
