:root {
  --bg: #070a13;
  --panel: rgba(16, 18, 34, 0.92);
  --panel-2: rgba(12, 14, 26, 0.92);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.76);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #00d1ff;
  --accent-2: #ff4fd8;
  --warn: #ffcc00;
  --ok: #34d399;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);

  /* Mobile sizing is set by JS for stability (visualViewport). */
  --wtl-vh: 100dvh;
  --wtl-topbar-h: 0px;
  --wtl-kb: 0px;
  --wtl-sheet-collapsed: 46vh;
  --wtl-sheet-expanded: 78vh;
  --wtl-sheet-collapsed-px: 46vh;
  --wtl-sheet-expanded-px: 78vh;
}

@media (max-width: 980px) {
  :root {
    /* Give the panel more room on mobile (Google Maps-ish). */
    --wtl-sheet-collapsed: 60vh;
    --wtl-sheet-expanded: 88vh;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* Respect the HTML hidden attribute even with layout utilities */
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(900px 600px at 30% 0%, rgba(0, 209, 255, 0.12), transparent 60%),
              radial-gradient(900px 600px at 90% 20%, rgba(255, 79, 216, 0.12), transparent 55%),
              var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
}

.wtl-app { height: 100%; display: flex; flex-direction: column; }

.wtl-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  background: rgba(7, 10, 19, 0.7);
}

.wtl-title-line { font-weight: 700; letter-spacing: 0.2px; }
.wtl-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

.wtl-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.wtl-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45);
  animation: wtl-live-pulse 1.4s ease-in-out infinite;
}

@keyframes wtl-live-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); opacity: 1; }
  55% { transform: scale(1.22); box-shadow: 0 0 0 10px rgba(52, 211, 153, 0.0); opacity: 0.95; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.0); opacity: 1; }
}

.wtl-hero-anim {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  opacity: 0.92;
}

.wtl-hero-ico {
  font-size: 14px;
  opacity: 0.9;
}

.wtl-bus-track {
  flex: 1;
  height: 18px;
  position: relative;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  overflow: hidden;
}

.wtl-bus {
  position: absolute;
  left: calc(100% + 18px);
  top: 50%;
  transform: translateY(-55%);
  font-size: 16px;
  will-change: left, opacity;
  animation: wtl-bus-run 4.9s linear infinite;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.35));
}

@keyframes wtl-bus-run {
  0% { left: calc(100% + 18px); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { left: -26px; opacity: 0; }
}

.wtl-link { color: var(--text); text-decoration: none; opacity: 0.9; }
.wtl-link:hover { opacity: 1; text-decoration: underline; }
.wtl-link:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.35);
  outline-offset: 3px;
  border-radius: 10px;
}

.wtl-main {
  flex: 1;
  min-height: 0;
  position: relative;
  height: calc(var(--wtl-vh) - var(--wtl-topbar-h));
}

.wtl-map { position: relative; min-height: 0; height: 100%; }
.wtl-map-canvas { height: 100%; width: 100%; }

/* On-map navigation HUD (CarPlay-ish) */
.wtl-navhud {
  position: absolute;
  right: 12px;
  left: auto;
  top: 12px;
  z-index: 600;
  pointer-events: none;
  width: min(560px, calc(100% - 24px));
}

.wtl-navhud-card {
  pointer-events: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(16, 18, 34, 0.88), rgba(12, 14, 26, 0.86));
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 12px 12px;
}

.wtl-navhud-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.wtl-navhud-instr {
  font-weight: 900;
  letter-spacing: 0.2px;
  font-size: 18px;
  line-height: 1.2;
}

.wtl-navhud-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.wtl-navhud-right { text-align: right; }

.wtl-navhud-dist {
  font-weight: 900;
  font-size: 15px;
  color: var(--text);
}

.wtl-navhud-stop {
  margin-top: 8px;
  padding: 8px 12px;
}

.wtl-panel {
  position: fixed;
  top: calc(var(--wtl-topbar-h) + 12px);
  left: 12px;
  bottom: calc(12px + var(--wtl-kb));
  width: min(440px, calc(100% - 24px));
  min-height: 0;
  overflow: auto;
  z-index: 1000;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}

.wtl-panel-section { padding: 14px 14px 12px; border-bottom: 1px solid var(--border); }
.wtl-panel-row { display: flex; gap: 10px; align-items: center; }

.wtl-pages {
  display: none;
}

.wtl-page {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 12px;
  min-height: 40px;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.1px;
}

.wtl-page[aria-selected="true"] {
  border-color: rgba(0, 209, 255, 0.40);
  background: rgba(0, 209, 255, 0.12);
}

.wtl-page:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.30);
  outline-offset: 3px;
}

.wtl-panel-handle {
  display: none;
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 0 4px;
  cursor: pointer;
  touch-action: none;
}

.wtl-panel-handle-bar {
  display: block;
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.24);
  margin: 0 auto;
}

.wtl-panel-handle-icon {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  opacity: 0.75;
}

.wtl-panel-handle:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.35);
  outline-offset: 4px;
  border-radius: 12px;
}

.wtl-next {
  margin: 6px 2px 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.wtl-btn {
  appearance: none;
  border: 1px solid rgba(0, 209, 255, 0.34);
  background: rgba(0, 209, 255, 0.10);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 14px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.wtl-btn:hover { background: rgba(0, 209, 255, 0.16); }
.wtl-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.wtl-btn .wtl-ico { margin-right: 8px; }

.wtl-btn:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.35);
  outline-offset: 3px;
}

@keyframes wtlPulseCta {
  0% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(0, 209, 255, 0.00); }
  50% { transform: translateY(-2px); box-shadow: 0 0 0 6px rgba(0, 209, 255, 0.10); }
  100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(0, 209, 255, 0.00); }
}

.wtl-btn.wtl-pulse {
  animation: wtlPulseCta 1.15s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .wtl-btn.wtl-pulse { animation: none; }
}

.wtl-btn-ghost {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}
.wtl-btn-ghost:hover { background: rgba(255, 255, 255, 0.10); }

.wtl-btn-ok {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.14);
}
.wtl-btn-ok:hover { background: rgba(52, 211, 153, 0.20); }

.wtl-btn-go {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.wtl-label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.wtl-label { font-size: 13px; }
.wtl-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  outline: none;
}
.wtl-input:focus { border-color: rgba(0, 209, 255, 0.5); box-shadow: 0 0 0 3px rgba(0, 209, 255, 0.12); }
.wtl-input:focus-visible { outline: 3px solid rgba(0, 209, 255, 0.28); outline-offset: 2px; }

.wtl-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

.wtl-inline-msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text);
}

.wtl-inline-msg .wtl-inline-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--accent);
  margin-top: 1px;
}

.wtl-inline-msg .wtl-inline-text {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  font-size: 13px;
  color: var(--muted);
}

.wtl-inline-msg .wtl-inline-text strong {
  color: var(--text);
}

.wtl-inline-msg.is-warn .wtl-inline-ico { color: var(--warn); }
.wtl-inline-msg.is-ok .wtl-inline-ico { color: var(--ok); }

.wtl-input-row { position: relative; }

.wtl-input-wrap {
  position: relative;
}

.wtl-input-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wtl-input-clear:hover { background: rgba(255, 255, 255, 0.10); }

.wtl-input-clear:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.28);
  outline-offset: 2px;
}

.wtl-search-results {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  max-height: 42vh;
  overflow: auto;
  overscroll-behavior: contain;
}

.wtl-search-results .wtl-stop {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}

.wtl-search-results .wtl-stop:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(0, 209, 255, 0.28);
}

.wtl-search-results .wtl-stop-pick:focus-visible {
  outline-offset: 2px;
}

.wtl-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.wtl-mode {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wtl-mode:hover { background: rgba(255, 255, 255, 0.10); }

.wtl-mode.is-selected {
  border-color: rgba(0, 209, 255, 0.40);
  background: rgba(0, 209, 255, 0.10);
}

.wtl-mode:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.35);
  outline-offset: 3px;
}

.wtl-trip {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
}

.wtl-steps {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

/* Mobile: collapse route steps into a single "Route ready" card */
.wtl-steps-toggle {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 10px 10px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wtl-steps-toggle:hover { border-color: rgba(0, 209, 255, 0.35); }

.wtl-steps-toggle-left { display: grid; gap: 3px; }
.wtl-steps-toggle-title { font-weight: 900; }
.wtl-steps-toggle-sub { font-size: 13px; color: var(--muted); }

.wtl-steps-toggle-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--accent-2);
  font-weight: 900;
}

.wtl-steps-body { display: grid; gap: 8px; }

@media (max-width: 980px) {
  .wtl-steps-body {
    max-height: 38vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
  }
}

/* Location permission help modal */
.wtl-modal[hidden] { display: none; }
.wtl-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.wtl-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}

.wtl-modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 24px));
  max-height: min(80vh, calc(var(--wtl-vh, 100vh) - 24px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.78);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  padding: 12px;
}

.wtl-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.wtl-modal-title { font-weight: 900; font-size: 16px; }
.wtl-modal-body { color: var(--text); }
.wtl-modal-body p { margin: 0 0 10px 0; color: var(--muted); }

.wtl-help-steps { display: grid; gap: 10px; margin-top: 8px; }
.wtl-help-step {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.wtl-help-num {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  border: 1px solid rgba(0, 209, 255, 0.35);
  background: rgba(0, 209, 255, 0.10);
  color: var(--text);
  flex: 0 0 auto;
}

.wtl-help-step strong { color: var(--text); }
.wtl-help-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }

body.wtl-modal-open {
  overflow: hidden;
}

.wtl-step {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 9px 10px;
  background: rgba(0, 0, 0, 0.18);
}

.wtl-step-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.wtl-step-title { font-weight: 800; }
.wtl-step-right { font-weight: 900; color: var(--accent-2); white-space: nowrap; }
.wtl-step-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }

.wtl-section-title { font-weight: 700; margin-bottom: 8px; }
.wtl-muted { color: var(--muted); font-size: 13px; }

.wtl-list { display: grid; gap: 10px; }
.wtl-stop {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  transform: translateY(0);
  transition: transform 160ms ease, border-color 160ms ease;
}
.wtl-stop:hover { border-color: rgba(0, 209, 255, 0.35); transform: translateY(-1px); }

.wtl-stop-pick {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}

.wtl-stop-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.wtl-stop-act {
  flex: 1;
  min-height: 40px;
  padding: 9px 12px;
  font-weight: 800;
}

.wtl-stop-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
}

.wtl-stop-ico {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 209, 255, 0.28);
  background: rgba(0, 209, 255, 0.10);
}

.wtl-stop-text { min-width: 0; }
.wtl-stop-name { font-weight: 800; line-height: 1.15; }
.wtl-stop-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }

.wtl-stop-pick:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.35);
  outline-offset: 3px;
  border-radius: 12px;
}

.wtl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: var(--text);
}

.wtl-selected-actions {
  margin-top: 10px;
}

.wtl-step.is-active {
  border-color: rgba(0, 209, 255, 0.38);
  background: rgba(0, 209, 255, 0.08);
}

/* Destination results (bigger tap target + icon layout) */
.wtl-dest-search .wtl-search-results .wtl-stop {
  padding: 12px 12px;
}

.wtl-dest-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
}

.wtl-dest-ico {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 209, 255, 0.28);
  background: rgba(0, 209, 255, 0.10);
}

.wtl-dest-text {
  min-width: 0;
}

.wtl-dest-title {
  font-weight: 800;
  line-height: 1.15;
  color: rgba(255, 255, 255, 0.97);
}

.wtl-dest-sub {
  margin-top: 3px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.84);
  opacity: 0.95;
}

.wtl-dest-postal {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.88);
  opacity: 0.95;
}

/* User marker (person icon) */
.wtl-user-marker {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  position: relative;
}

.wtl-user-marker::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  border: 2px solid rgba(0, 209, 255, 0.28);
  background: rgba(0, 209, 255, 0.06);
  opacity: 0.85;
}

.wtl-user-marker::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  border: 2px solid rgba(0, 209, 255, 0.30);
  opacity: 0;
  transform: scale(0.8);
  animation: wtl-user-pulse 1.9s ease-in-out infinite;
}

.wtl-user-marker svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}

.wtl-user-emoji {
  font-size: 18px;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}

/* Live vehicle marker */
.wtl-vehicle-marker {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  position: relative;
}

.wtl-marker-rotor {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform: rotate(var(--wtl-rot, 0deg));
  transition: transform 220ms linear;
}

.wtl-marker-arrow {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid rgba(255, 79, 216, 0.65);
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.35));
}

.wtl-vehicle-marker svg {
  width: 18px;
  height: 18px;
  color: var(--accent-2);
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}

.wtl-marker-emoji {
  font-size: 18px;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}

/* Estimated bus marker */
.wtl-est-marker {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(52, 211, 153, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  position: relative;
}

.wtl-est-marker .wtl-marker-arrow {
  border-bottom-color: rgba(52, 211, 153, 0.65);
}

.wtl-est-marker svg {
  width: 18px;
  height: 18px;
  color: var(--ok);
  opacity: 0.9;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}

.wtl-btn.is-active {
  border-color: rgba(0, 209, 255, 0.40);
}

@keyframes wtl-user-pulse {
  0% { opacity: 0; transform: scale(0.75); }
  35% { opacity: 0.6; }
  100% { opacity: 0; transform: scale(1.18); }
}

@keyframes wtl-trail-dash {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -60; }
}

.wtl-bus-trail {
  stroke-dasharray: 10 12;
  animation: wtl-trail-dash 1.25s linear infinite;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.28));
}

.wtl-bus-trail-live {
  stroke: rgba(255, 79, 216, 0.72);
}

.wtl-bus-trail-est {
  stroke: rgba(0, 209, 255, 0.62);
}

.wtl-departures { display: grid; gap: 10px; padding-top: 10px; }
.wtl-dep {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  animation: wtl-fade-up 180ms ease both;
  cursor: pointer;
}

.wtl-dep-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}

.wtl-dep-ico {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.wtl-dep-text { min-width: 0; }
.wtl-dep:hover { border-color: rgba(0, 209, 255, 0.28); }
.wtl-dep.is-selected {
  border-color: rgba(0, 209, 255, 0.55);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}
.wtl-dep-top { display: flex; gap: 10px; justify-content: space-between; }
.wtl-route { font-weight: 800; color: var(--accent); }
.wtl-dest { color: var(--text); opacity: 0.92; }
.wtl-eta { font-weight: 800; color: var(--accent-2); }
.wtl-dep-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.wtl-dep-sub { font-size: 13px; }

.wtl-dep:focus-visible {
  outline: 3px solid rgba(0, 209, 255, 0.35);
  outline-offset: 3px;
}

.wtl-watch {
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
}

.wtl-watch-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.wtl-watch-title { font-weight: 800; }
.wtl-watch-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.wtl-watch-eta { font-weight: 900; color: var(--accent-2); white-space: nowrap; }

@keyframes wtl-arriving-glow {
  0% { transform: translateZ(0) scale(1); filter: drop-shadow(0 0 0 rgba(52, 211, 153, 0.0)); }
  50% { transform: translateZ(0) scale(1.03); filter: drop-shadow(0 0 12px rgba(52, 211, 153, 0.35)); }
  100% { transform: translateZ(0) scale(1); filter: drop-shadow(0 0 0 rgba(52, 211, 153, 0.0)); }
}

.wtl-watch.is-arriving .wtl-watch-eta {
  color: var(--ok);
  animation: wtl-arriving-glow 1.05s ease-in-out infinite;
}

.wtl-watch.is-est .wtl-watch-eta {
  color: var(--ok);
}

.wtl-watch.is-est .wtl-watch-hint {
  color: rgba(52, 211, 153, 0.80);
}

.wtl-btn.is-est {
  border-color: rgba(52, 211, 153, 0.45);
}

.wtl-watch-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.wtl-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}

.wtl-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.wtl-toggle-ui {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.22);
}

.wtl-toggle:has(input:checked) {
  border-color: rgba(0, 209, 255, 0.40);
  background: rgba(0, 209, 255, 0.10);
}

.wtl-toggle:focus-within {
  outline: 3px solid rgba(0, 209, 255, 0.35);
  outline-offset: 3px;
}

.wtl-watch-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .wtl-watch-actions { grid-template-columns: 1fr; }
}

.wtl-toast {
  position: absolute;
  left: 50%;
  top: 12px;
  bottom: auto;
  transform: translateX(-50%);
  max-width: min(640px, calc(100% - 24px));
  z-index: 550;
  pointer-events: none;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(16, 18, 34, 0.88), rgba(12, 14, 26, 0.84));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: wtl-fade-up 160ms ease;
}

/* Toast variants */
.wtl-toast.is-warn {
  border-color: rgba(255, 79, 216, 0.40);
}

.wtl-toast.is-warn .wtl-toast-ico {
  background: rgba(255, 79, 216, 0.14);
  border-color: rgba(255, 79, 216, 0.50);
}

.wtl-toast.is-warn .wtl-toast-ico::after {
  background: var(--accent-2);
  box-shadow: 0 0 18px rgba(255, 79, 216, 0.35);
}

.wtl-toast.is-ok {
  border-color: rgba(52, 211, 153, 0.40);
}

.wtl-toast.is-ok .wtl-toast-ico {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.50);
}

.wtl-toast.is-ok .wtl-toast-ico::after {
  background: var(--ok);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.30);
}

.wtl-toast-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
}

.wtl-toast-ico {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(0, 209, 255, 0.16);
  border: 1px solid rgba(0, 209, 255, 0.35);
  box-shadow: 0 0 0 0 rgba(0, 209, 255, 0.0);
  position: relative;
}

.wtl-toast-ico::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(0, 209, 255, 0.35);
}

.wtl-toast-msg { line-height: 1.25; }

/* Keep toast out of the way when the nav HUD is visible */
body.wtl-nav-active .wtl-toast {
  top: 92px;
}

@media (max-width: 980px) {
  .wtl-toast {
    top: 10px;
    max-width: min(620px, calc(100% - 18px));
  }
  body.wtl-nav-active .wtl-toast { top: 88px; }
}

@keyframes wtl-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .wtl-map { height: 100%; }

  /* Prevent iOS Safari from zooming the page on focus. */
  .wtl-input { font-size: 16px; }

  .wtl-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--wtl-kb);
    z-index: 1000;
    height: var(--wtl-sheet-collapsed-px);
    max-height: calc(var(--wtl-vh) - var(--wtl-topbar-h) - 12px);
    width: auto;
    top: auto;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: 0 -18px 60px rgba(0,0,0,0.55);
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.wtl-sheet-expanded .wtl-panel {
    height: var(--wtl-sheet-expanded-px);
  }

  body.wtl-sheet-expanded .wtl-panel-handle-icon {
    transform: rotate(180deg);
    transition: transform 160ms ease;
  }

  .wtl-panel-handle { display: block; }

  body.wtl-sheet-dragging {
    user-select: none;
    -webkit-user-select: none;
  }

  body.wtl-sheet-dragging .wtl-panel {
    transition: none;
  }

  .wtl-panel-section:first-child {
    padding-top: 8px;
    /* Avoid sections overlapping each other on mobile.
       Keep only the drag handle sticky (below). */
    position: relative;
    background: transparent;
  }

  /* Keep the drag handle always reachable without making the whole section sticky */
  .wtl-panel-handle {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: 10px;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
  }

  /* Panel pages toggle (Stops / Directions) */
  .wtl-pages {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 10px 0 2px;

    /* Bottom navigation (Maps-like) */
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 10px + var(--wtl-kb));
    z-index: 950;
    padding: 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(7, 10, 19, 0.62);
    backdrop-filter: blur(12px);
  }

  .wtl-page {
    width: 100%;
    min-height: 44px;
  }

  /* Give panel content breathing room so bottom nav doesn't cover buttons */
  .wtl-panel {
    padding-bottom: calc(env(safe-area-inset-bottom) + 78px);
  }

  /* Map page: keep the map visible (smaller sheet when collapsed) */
  body.wtl-page-map {
    --wtl-sheet-collapsed-px: min(26vh, 260px);
  }

  body.wtl-page-map .wtl-next,
  body.wtl-page-map .wtl-panel-row,
  body.wtl-page-map .wtl-dest-search,
  body.wtl-page-map #section-closest,
  body.wtl-page-map #selected-actions,
  body.wtl-page-map #departures,
  body.wtl-page-map #selected-meta,
  body.wtl-page-map #selected-title,
  body.wtl-page-map .wtl-stop-detail-top {
    display: none;
  }

  body.wtl-page-map .wtl-watch {
    margin-top: 2px;
  }

  /* Tracking peek overlay (tap to open Map / stop tracking) */
  .wtl-trackpeek {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 74px + var(--wtl-kb));
    z-index: 920;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(7, 10, 19, 0.72);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
  }

  .wtl-trackpeek-main {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 0;
    text-align: left;
    cursor: pointer;
  }

  .wtl-trackpeek-title {
    font-weight: 900;
    letter-spacing: 0.2px;
  }

  .wtl-trackpeek-sub {
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
  }

  .wtl-trackpeek-stop {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: grid;
    place-items: center;
  }

  .wtl-trackpeek-stop:hover { background: rgba(255, 255, 255, 0.10); }

  /* Floating Stop Search overlay on the map (below topbar) */
  .wtl-stop-search {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(var(--wtl-topbar-h) + 10px);
    z-index: 900;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    box-shadow: var(--shadow);
  }

  /* Floating Directions search overlay (From / Where to?) */
  body.wtl-page-directions .wtl-dest-search {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(var(--wtl-topbar-h) + 10px);
    z-index: 900;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    box-shadow: var(--shadow);
  }

  .wtl-stop-search .wtl-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);
    margin-top: 0;
    z-index: 910;
    max-height: min(56vh, calc(var(--wtl-vh) - 190px));
    -webkit-overflow-scrolling: touch;
  }

  /* Override the generic mobile results rule for the floating stop search */
  .wtl-input-row.wtl-stop-search .wtl-search-results {
    position: absolute;
  }

  /* Dedicated stop detail view (hide closest list while in detail mode) */
  .wtl-stop-detail-top {
    display: none;
    margin: 4px 0 8px;
  }

  body.wtl-stop-detail #section-closest {
    display: none;
  }

  body.wtl-stop-detail .wtl-stop-detail-top {
    display: block;
  }

  /* When a search dropdown is open, simplify the panel (Google Maps-like)
     so only one "screen" is active at a time. */
  body.wtl-popover-origin .wtl-stop-search,
  body.wtl-popover-dest .wtl-stop-search {
    display: none;
  }

  body.wtl-popover-stop .wtl-dest-search {
    display: none;
  }

  /* When a specific directions search popover is open, keep only that field visible */
  body.wtl-popover-origin .wtl-dest-search label[for="dest-search"],
  body.wtl-popover-origin .wtl-dest-search #dest-search,
  body.wtl-popover-origin .wtl-dest-search #dest-hint,
  body.wtl-popover-origin .wtl-dest-search #dest-results {
    display: none;
  }

  body.wtl-popover-dest .wtl-dest-search label[for="origin-search"],
  body.wtl-popover-dest .wtl-dest-search .wtl-input-wrap,
  body.wtl-popover-dest .wtl-dest-search #origin-hint,
  body.wtl-popover-dest .wtl-dest-search #origin-results {
    display: none;
  }

  body.wtl-popover-origin .wtl-modes,
  body.wtl-popover-dest .wtl-modes,
  body.wtl-popover-origin #btn-go,
  body.wtl-popover-dest #btn-go,
  body.wtl-popover-origin #trip,
  body.wtl-popover-dest #trip,
  body.wtl-popover-origin #inline-msg,
  body.wtl-popover-dest #inline-msg {
    display: none;
  }

  /* Panel pages: only one main section visible at a time (no crowding) */
  body.wtl-page-stops .wtl-dest-search,
  body.wtl-page-stops #trip,
  body.wtl-page-stops #inline-msg {
    display: none;
  }

  body.wtl-page-directions .wtl-stop-search,
  body.wtl-page-directions #section-closest,
  body.wtl-page-directions #section-selected {
    display: none;
  }

  /* Google-Maps-like travel mode selector: one row, horizontally scrollable */
  .wtl-modes {
    margin-top: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    gap: 8px;
    padding: 6px 6px;
    touch-action: pan-x;

    /* Chip tray container (Google Maps feel) */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.14);
  }

  .wtl-modes::-webkit-scrollbar { display: none; }

  .wtl-mode {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 12px;
    font-size: 14px;
    gap: 7px;

    /* Cleaner chip inside the tray */
    border-color: transparent;
    background: transparent;
  }

  .wtl-mode.is-selected {
    border-color: rgba(0, 209, 255, 0.40);
    background: rgba(0, 209, 255, 0.14);
  }

  /* Keep icons visually balanced in tighter chips */
  .wtl-mode .wtl-ico {
    width: 16px !important;
    height: 16px !important;
  }

  /* Google-Maps-like popover search results on mobile */
  .wtl-input-row .wtl-search-results {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    margin-top: 10px;
    z-index: 30;
    max-height: min(52vh, calc(var(--wtl-vh) - 180px));
    -webkit-overflow-scrolling: touch;
  }

  /* Floating stop-search uses an overlay dropdown (not in-sheet) */
  .wtl-input-row.wtl-stop-search .wtl-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);
    margin-top: 0;
    z-index: 910;
    max-height: min(56vh, calc(var(--wtl-vh) - 190px));
  }

  /* When a search popover is open, keep the UI focused */
  body.wtl-search-open .wtl-panel-section:nth-child(n+2) {
    display: none;
  }

  .wtl-hero-anim { max-width: 260px; }
}

/* When redirected from Parks, keep UI focused (Google Maps "route" mode) */
body.wtl-from-parks #section-closest { display: none; }
body.wtl-from-parks .wtl-stop-search { display: none; }
body.wtl-from-parks #selected-meta { display: none; }
body.wtl-from-parks #selected-title { content: "Nearby buses"; }

body.wtl-from-parks .wtl-next {
  margin-top: 2px;
}

body.wtl-from-parks #btn-nav.wtl-btn-ok {
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .wtl-stop, .wtl-dep { animation: none; transition: none; }
  .wtl-stop:hover { transform: none; }
  .wtl-bus { animation: none; left: 50%; transform: translate(-50%, -55%); opacity: 1; }
  .wtl-live-dot { animation: none; box-shadow: none; }
}
