/* ── CSS variables ───────────────────────────────────────────────────────────── */

:root {
  --pid-green:    #78BE20;
  --pid-dark:     #1a202c;
  --pid-charcoal: #1a1a2e;
  --pid-slate:    #4a5568;
  --pid-white:    #ffffff;
  --pid-row-alt:  #f7f8fa;
  --pid-border:   #e2e8f0;
  --pid-orange:   #F59E0B;
  --pid-red:      #EF4444;
  --pid-blue:     #2563EB;
  --tab-h:        58px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0a0a18;
  height: 100dvh;
  overflow: hidden;
}

/* ── Map ─────────────────────────────────────────────────────────────────────── */

#map {
  position: absolute;
  inset: 0;
  bottom: calc(var(--tab-h) + var(--sab, 0px));
  z-index: 0;
}

/* Faster tile fade-in (Leaflet default is 200ms) */
.leaflet-tile { transition: opacity 0.1s linear !important; }

/* Promote map panes to GPU compositing layers for smoother rotation/zoom */
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-marker-pane,
.leaflet-overlay-pane {
  will-change: transform;
}

/* Tram icons only capture taps on the painted teardrop, not the transparent
   bounding box around it. Shrinks the accidental-tap zone (esp. when zoomed out)
   and lets box taps fall through to the stop/map underneath. */
.tram-icon,
.tram-icon svg { pointer-events: none; }
.tram-icon svg circle,
.tram-icon svg path { pointer-events: auto; }

.map-tiles  { filter: var(--map-tile-filter,  saturate(0.28) brightness(0.94) contrast(1.03)); }
.map-labels { filter: var(--map-label-filter, contrast(1.2)); }

/* ── Loading overlay ─────────────────────────────────────────────────────────── */

#loading {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 24, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#loading.hidden { display: none; }

#loading-text {
  font-size: 18px;
  color: #aaa;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ── Zoom controls ───────────────────────────────────────────────────────────── */

.leaflet-control-zoom {
  border: 1px solid #bbb !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.15) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  font-size: 22px !important;
  font-weight: 300 !important;
  color: #333 !important;
  background: #fff !important;
  border: none !important;
  border-bottom: 1px solid #e0e0e0 !important;
  display: block !important;
}

.leaflet-control-zoom-out { border-bottom: none !important; }

.leaflet-control-attribution { display: none !important; }

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: #f5f5f5 !important;
  color: #000 !important;
}

/* ── Location FAB ────────────────────────────────────────────────────────────── */

#locate-fab {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--sab, 0px) + 12px);
  left: 16px;
  width: 40px;
  height: 40px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.28), 0 1px 3px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 650;
  padding: 0;
  color: #555;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#locate-fab svg {
  width: 18px;
  height: 18px;
}

#locate-fab:hover { background: #f5f5f5; }

/* Three states, Google-Maps style:
   - ready  (default): hollow crosshair, neutral
   - active (locating / dot shown): filled blue centre
   - off    (location services off / denied; app only): slashed + muted */
.loc-slash { display: none; }

#locate-fab.locate-active {
  color: #2563EB;
  border-color: #2563EB;
}
#locate-fab.locate-active .loc-center {
  fill: #2563EB;
}

#locate-fab.loc-off {
  color: #9aa0a6;
}
#locate-fab.loc-off .loc-slash { display: inline; }

/* "Just enabled — tap again to center": located look + gentle pulsing ring. */
#locate-fab.loc-hint {
  color: #2563EB;
  border-color: #2563EB;
  animation: locHintPulse 1.6s ease-in-out infinite;
}
@keyframes locHintPulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(0,0,0,0.28), 0 0 0 0 rgba(37,99,235,0.45); }
  50%      { box-shadow: 0 2px 10px rgba(0,0,0,0.28), 0 0 0 9px rgba(37,99,235,0); }
}

/* Slide locate FAB behind panels when they're open */
#fav-panel:not(.hidden) ~ #locate-fab,
#yt-panel:not(.hidden) ~ #locate-fab {
  z-index: 640;
}

/* Mobile-only: hide locate on mouse/desktop, where geolocation is IP/wifi-based
   and too inaccurate to be useful. Touch devices (pointer: coarse) keep it. */
@media (hover: hover) and (pointer: fine) {
  #locate-fab { display: none; }
}

/* ── Refresh FAB (mobile browser only) ───────────────────────────────────────── */
/* Sits directly above the locate FAB (40px tall + 8px gap). Forces a fresh
   /api/trips so the dots jump up to date without a full page-reload. */

#refresh-fab {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--sab, 0px) + 12px + 48px);
  left: 16px;
  width: 40px;
  height: 40px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.28), 0 1px 3px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 650;
  padding: 0;
  color: #555;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#refresh-fab svg { width: 18px; height: 18px; }
#refresh-fab:hover { background: #f5f5f5; }

/* Spin + go blue while a manual refresh is in flight. */
#refresh-fab.refreshing { color: #2563EB; border-color: #2563EB; }
#refresh-fab.refreshing svg { animation: refreshSpin 0.7s linear infinite; }
@keyframes refreshSpin { to { transform: rotate(360deg); } }

/* Slide behind panels when they open, like the locate FAB. */
#fav-panel:not(.hidden) ~ #refresh-fab,
#yt-panel:not(.hidden) ~ #refresh-fab { z-index: 640; }

/* Hidden on desktop (mouse). Also hidden inside the installed app via JS
   (app.js sets display:none when running natively — the app already refetches
   on resume, so the manual button is mobile-web only). */
@media (hover: hover) and (pointer: fine) {
  #refresh-fab { display: none; }
}

/* ── Location permission dialog ──────────────────────────────────────────────── */

#loc-explain-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#loc-explain-box {
  background: #1c1c2e;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 26px 22px 16px;
  max-width: 300px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}

#loc-explain-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

#loc-explain-body {
  font-size: 14px;
  color: #b3b3c0;
  line-height: 1.5;
  margin-bottom: 22px;
}

#loc-explain-btns {
  display: flex;
  gap: 10px;
}

#loc-explain-btns button {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

#loc-explain-cancel {
  background: #2e2e44;
  color: #c8c8d4;
}

#loc-explain-ok {
  background: #C6007E;
  color: #fff;
}

#loc-explain-ok:hover { background: #a0006a; }
#loc-explain-cancel:hover { background: #3a3a55; }

/* ── Tooltip ─────────────────────────────────────────────────────────────────── */

.leaflet-tooltip {
  background: #1c1c2e;
  border: 1px solid #333;
  color: #eee;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
}

/* ── Stop labels (permanent tooltips at zoom 16+) ───────────────────────────── */

.stop-label {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  color: #1a202c !important;
  white-space: normal !important;
  max-width: 100px !important;
  line-height: 1.2 !important;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff !important;
  padding: 0 !important;
  display: none !important;
}
.stop-label::before { display: none !important; }
#map.show-labels .leaflet-tooltip.stop-label { display: block !important; }

/* ── PID Panel ───────────────────────────────────────────────────────────────── */

#pid-panel {
  position: fixed;
  z-index: 700;
  background: var(--pid-charcoal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 7px solid var(--pid-green);
  font-family: 'DM Sans', -apple-system, sans-serif;
}

#pid-panel.hidden { display: none; }

@media (min-width: 601px) {
  #pid-panel {
    top: 16px;
    right: 16px;
    bottom: calc(var(--tab-h) + var(--sab, 0px) + 8px);
    width: 320px;
    border-radius: 0 0 10px 10px;
    border: 1px solid #2a3a50;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
    overflow-y: auto;
  }
}

/* ── Mobile drag handle ──────────────────────────────────────────────────────── */

#pid-drag-handle {
  display: none;
}

@media (max-width: 600px) {
  #pid-drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 0 10px;
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
  }

  #pid-drag-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
  }

  #pid-panel {
    left: 0;
    right: 0;
    bottom: calc(var(--tab-h) + var(--sab, 0px));
    border-radius: 0;
    overflow-y: auto;
    box-shadow: 0 -6px 30px rgba(0,0,0,0.6);
    will-change: height;
    touch-action: none;
  }

  .leaflet-control-zoom { display: none !important; }
}

/* ── Stop name header ────────────────────────────────────────────────────────── */

#pid-header {
  background: var(--pid-dark);
  padding: 10px 44px 10px 14px;
  flex-shrink: 0;
  position: relative;
}

#pid-header-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

#pid-stop-name {
  min-width: 0;
  overflow-wrap: break-word;
  font-size: 18px;
  font-weight: 700;
  color: var(--pid-white);
  line-height: 1.2;
  letter-spacing: -0.2px;
}


#pid-stop-sub {
  font-size: 12px;
  color: #718096;
  margin-top: 3px;
  font-weight: 400;
}

#pid-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: var(--pid-white);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

#pid-close:hover { background: rgba(255,255,255,0.22); }

#pid-fav-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 22px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  margin-top: 1px;
  transition: color 0.15s;
}

#pid-fav-btn:hover  { color: rgba(255,255,255,0.7); }
#pid-fav-btn.active { color: #f5c542; }

/* ── PID body ────────────────────────────────────────────────────────────────── */

#pid-body {
  background: var(--pid-white);
  flex: 1;
  min-height: 0;                    /* let it shrink so the list can scroll */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;             /* allow vertical scroll despite the sheet's touch-action:none */
}

/* ── Direction section ───────────────────────────────────────────────────────── */

.pid-direction {
  background: var(--pid-white);
}

.pid-direction + .pid-direction {
  border-top: 1px solid #e2e8f0;
}

/* Direction header hidden — stop name already shown in pid-header */
.pid-dir-header {
  display: none;
}

.pid-dir-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--pid-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pid-dir-next-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--pid-dark);
  flex-shrink: 0;
}

.pid-info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  background: rgba(0,0,0,0.18);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
}

/* Column sub-header */
.pid-col-header {
  display: grid;
  grid-template-columns: 48px 1fr 52px;
  padding: 3px 0;
  border-bottom: 1px solid var(--pid-border);
  background: var(--pid-white);
}

.pid-col-header span {
  font-size: 9px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-align: center;
  padding: 2px 0;
}

.pid-col-header span:nth-child(2) {
  text-align: left;
  padding-left: 10px;
}

/* ── Tram row ────────────────────────────────────────────────────────────────── */

.pid-row {
  display: grid;
  grid-template-columns: 48px 1fr auto 52px;
  align-items: stretch;
  min-height: 42px;
  border-bottom: 1px solid var(--pid-border);
  background: var(--pid-white);
}

.pid-row:last-child { border-bottom: none; }

/* Route badge */
.pid-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--pid-white);
  align-self: stretch;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

/* Destination cell */
.pid-dest-cell {
  padding: 5px 6px 5px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.pid-vehicle-no {
  font-size: 11px;
  color: var(--pid-muted, #888);
  margin-top: 1px;
}

.pid-dest {
  font-size: 14px;
  font-weight: 500;
  color: var(--pid-dark);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Icons cell */
.pid-icons-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 4px;
}

.pid-icon-badge {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--pid-white);
  flex-shrink: 0;
}

.pid-icon-access  { background: var(--pid-blue);   border-radius: 4px; }
.pid-icon-disrupt { background: var(--pid-orange);  border-radius: 50%; font-size: 10px; }
.pid-icon-severe  { background: var(--pid-red);     border-radius: 4px; }

.pid-icon-ac {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

/* Minutes cell */
.pid-min-cell {
  background: var(--pid-slate);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  min-width: 52px;
  flex-shrink: 0;
}

.pid-minutes {
  font-size: 22px;
  font-weight: 700;
  color: var(--pid-white);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pid-now {
  font-size: 15px;
}

.pid-disrupted-icon {
  background: #F59E0B;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.pid-min-label {
  font-size: 9px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

/* ── Skeleton loading ────────────────────────────────────────────────────────── */

.pid-skel {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}

.pid-badge-skel {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  margin: auto 8px;
}

@keyframes skel-shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty / error state ─────────────────────────────────────────────────────── */

.pid-no-data {
  padding: 18px 16px;
  font-size: 13px;
  color: #a0aec0;
  text-align: center;
  background: var(--pid-white);
}

/* ── Alert carousel (below stop name, above departure list) ──────────────────── */

.pid-alert-carousel {
  padding: 8px 10px 4px;
  background: var(--pid-white);
}

.pid-alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pid-alert-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.pid-alert-warn-icon {
  flex-shrink: 0;
}

.pid-alert-routes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pid-alert-route-badge {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: -0.2px;
}

.pid-alert-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
  padding-left: 8px;
}

.pid-alert-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #CBD5E1;
  cursor: pointer;
  transition: background 0.15s;
}

.pid-alert-dot.active {
  background: var(--pid-orange);
}

.pid-alert-track {
  overflow: hidden;
}

.pid-alert-slide {
  display: none;
}

.pid-alert-slide.active {
  display: block;
}

.pid-alert-box {
  position: relative;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 8px;
  padding: 10px 32px 10px 14px;
}

.pid-alert-dismiss {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  color: #9CA3AF;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
}
.pid-alert-dismiss:hover {
  color: #374151;
  background: rgba(0, 0, 0, 0.07);
}

.pid-alert-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}

.pid-alert-body {
  font-size: 13px;
  color: #6B7280;
  margin-top: 3px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Route filter pills ──────────────────────────────────────────────────────── */

#pid-route-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--pid-white);
  border-bottom: 1px solid var(--pid-border);
}

.route-pill {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  background: var(--pill-color);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.route-pill:not(.active) {
  background: transparent;
  border-color: #D1D5DB;
  color: #6B7280;
}

.pid-pills-clear {
  font-size: 13px;
  font-weight: 600;
  color: #9CA3AF;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 4px;
  line-height: 1;
  flex-shrink: 0;
}

.pid-pills-clear.hidden { display: none; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */

#pid-footer {
  background: var(--pid-dark);
  padding: 7px 16px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#pid-updated {
  font-size: 10px;
  color: #7e98ba;
  font-variant-numeric: tabular-nums;
}

#pid-report-link {
  font-size: 10px;
  color: #9cbce0;
  text-decoration: underline;
}

#pid-report-link:hover { color: #c4dbf5; }

#vehicle-report-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  color: #888;
  text-decoration: none;
}

#vehicle-report-link:hover { color: #bbb; text-decoration: underline; }

/* ── Legend ──────────────────────────────────────────────────────────────────── */

#legend {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--sab, 0px) + 16px);
  right: 12px;
  background: rgba(28, 28, 46, 0.94);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 10px 12px;
  z-index: 650;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  backdrop-filter: blur(6px);
  color: #eee;
}

#legend-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

#legend-title {
  font-size: 10px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#legend-actions {
  display: flex;
  flex-direction: column;     /* stack the chips on top of each other */
  align-self: stretch;        /* conform to the box width — don't widen it */
  gap: 5px;
}

#legend-default,
#legend-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px 10px;
  min-height: 28px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #c7ccd6;
  touch-action: manipulation;
}

/* Selected: solid green with a tick so it's unmistakably "on". */
#legend-default.is-default {
  background: #5fae3a;
  border-color: #6cc043;
  color: #0c1a06;
  font-weight: 700;
}

#legend-default.is-default::before {
  content: "✓";
  margin-right: 5px;
  font-weight: 700;
}

#legend-default:hover,
#legend-clear:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

#legend-default.is-default:hover { background: #6cc043; color: #0c1a06; }

#legend-default:active,
#legend-clear:active { filter: brightness(1.15); }

#legend-default.hidden,
#legend-clear.hidden { display: none; }


/* ── Favourites list items ───────────────────────────────────────────────────── */

.fav-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fav-item-name {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: none;
  border-radius: 6px;
  color: #ddd;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 34px;
  line-height: 1.3;
}

.fav-item-name:hover { background: rgba(255,255,255,0.12); color: #fff; }

.fav-stop-name {
  display: block;
  line-height: 1.3;
}

.fav-dest {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-top: 1px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-item-name:hover .fav-dest { color: #ccc; }

.fav-item-remove {
  background: none;
  border: none;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.fav-item-remove:hover { color: #aaa; }

.fav-empty {
  font-size: 11px;
  color: #555;
  padding: 6px 2px 4px;
  line-height: 1.4;
}

/* Two-column route grid */
#legend-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.2s;
  min-height: 22px;
  padding: 1px 0;
}

.legend-item.muted { opacity: 0.25; }

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  font-size: 11px;
  font-weight: 500;
  color: #ccc;
  white-space: nowrap;
}

/* ── Vehicle info panel ──────────────────────────────────────────────────────── */

#vehicle-panel {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--sab, 0px) + 16px);
  left: 16px;
  width: 270px;
  background: rgba(28, 28, 46, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px 16px;
  z-index: 1000;
  color: #eee;
  font-family: 'DM Sans', sans-serif;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

#vehicle-panel.hidden { display: none; }

#vehicle-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
}

#vehicle-close:hover { color: #aaa; }

#vehicle-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-right: 24px;
}

#vehicle-route-badge {
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 15px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

#vehicle-destination {
  font-size: 14px;
  font-weight: 600;
  color: #eee;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#vehicle-silhouette {
  margin: 8px 0;
  line-height: 0;
}

#vehicle-silhouette img {
  width: 100%;
  height: auto;
  display: block;
}

#vehicle-meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#vehicle-class { color: #ccc; font-weight: 600; }

.vehicle-amenity-icon {
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 5px;
  padding: 2px 6px;
  color: #cbd5e1;
}

#vehicle-location {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 10px;
  margin-bottom: 10px;
}

#vehicle-near {
  font-size: 13px;
  color: #eee;
  margin-bottom: 4px;
}

#vehicle-near-label {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 6px;
}

#vehicle-heading {
  font-size: 12px;
  color: #aaa;
}

#vehicle-heading-arrow {
  color: #78BE20;
  margin-right: 4px;
}

#vehicle-gps {
  font-size: 11px;
  color: #aaa;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 8px;
}

#vehicle-gps-countdown {
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}

@media (max-width: 600px) {
  #vehicle-panel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: auto;
    top: 16px;
  }
}

/* ── Bottom tab bar ──────────────────────────────────────────────────────────── */

#bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-h) + var(--sab, 0px));
  background: #1c1c3a;
  border-top: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: stretch;
  z-index: 800;
  padding-bottom: var(--sab, 0px);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  cursor: pointer;
  color: #7070a8;
  padding: 8px 4px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn:hover { color: #9898c0; }

.tab-btn.active { color: #78BE20; }

.tab-btn.active#tab-fav .tab-icon polygon { fill: currentColor; }

.tab-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.tab-icon-text {
  font-size: 20px;
  line-height: 22px;
  font-variant-emoji: text;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.2px;
}

#yt-panel {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--sab, 0px) + 8px);
  left: 8px;
  top: auto;
  width: 300px;
  max-height: calc(100vh - var(--tab-h) - 80px);
  background: rgba(15, 20, 36, 0.98);
  backdrop-filter: blur(8px);
  border: 1px solid #333;
  border-radius: 10px;
  z-index: 650;
  color: #eee;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#yt-panel.hidden { display: none; }

#yt-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #2e2e44;
  flex-shrink: 0;
}

#yt-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

#yt-panel-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}

#yt-panel-close:hover { color: #aaa; }

#yt-panel-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 6px 8px;
}

.yt-loading {
  padding: 16px;
  font-size: 12px;
  color: #666;
  text-align: center;
}

.yt-tweet {
  display: block;
  padding: 11px 12px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}

.yt-tweet:hover { background: rgba(255,255,255,0.13); }

.yt-thread {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.yt-thread:last-child {
  border-bottom: none;
}

/* Continuation tweets (1/2, 2/2) — slight indent so they read as one post */
.yt-thread > .yt-tweet + .yt-tweet {
  margin-left: 10px;
  margin-top: -2px;
  background: rgba(255,255,255,0.06);
  border-left: 2px solid rgba(255,255,255,0.15);
}

.yt-replies-toggle {
  display: block;
  width: 100%;
  margin: 4px 0 0;
  padding: 7px 11px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  color: #4a9eff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.yt-replies-toggle:hover {
  background: rgba(255,255,255,0.08);
}

.yt-replies {
  margin-top: 6px;
}
.yt-replies.hidden {
  display: none;
}
.yt-replies .yt-tweet {
  margin-left: 10px;
  background: rgba(255,255,255,0.04);
  border-left: 2px solid rgba(255,255,255,0.10);
}

.yt-tweet-text {
  font-size: 15px;
  color: #ffffff;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.yt-tweet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 6px;
}

.yt-tweet-meta {
  font-size: 13px;
  color: #ccc;
  font-weight: 500;
  white-space: nowrap;
}

.yt-tweet-badges {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.yt-route-badge {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.6;
  white-space: nowrap;
  border: 1.5px solid rgba(0,0,0,0.25);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.yt-active-pill {
  font-size: 10px;
  font-weight: 700;
  color: #ff8b80;
  background: rgba(255, 59, 48, 0.18);
  border: 1px solid rgba(255, 59, 48, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  #yt-panel {
    left: 8px;
    right: 8px;
    width: auto;
    top: auto;
    max-height: calc(100vh - var(--tab-h) - 80px);
  }
}

/* ── Disruption type labels (used by map popup) ───────────────────────────── */

.disrupt-type {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #ff3b30;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.disrupt-type-divert     { background: #ff9500; }
.disrupt-type-no_service { background: #d11b1b; }
.disrupt-type-terminated { background: #d11b1b; }
.disrupt-type-delay      { background: #ff3b30; }

.dp-summary {
  font-size: 13px;
  color: #1a202c;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
}

/* ── Disruption map markers ───────────────────────────────────────────────── */

.disrupt-marker {
  border-radius: 50%;
  background: #ff9500;
  color: #fff;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  animation: disrupt-pulse 2.4s ease-in-out infinite;
  cursor: pointer;
}

@keyframes disrupt-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.35); opacity: 0.75; }
}

/* ── Disruption popup ─────────────────────────────────────────────────────── */

.disrupt-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.disrupt-popup-wrap .leaflet-popup-content { margin: 0; }

.disrupt-popup {
  padding: 10px 13px;
  min-width: 180px;
}

.dp-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.dp-seg {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  margin-bottom: 4px;
}

.dp-reason {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
}

/* ── Tab-bar alerts badge ─────────────────────────────────────────────────── */

#tab-alerts { position: relative; }

/* ── Favourites panel ────────────────────────────────────────────────────────── */

#fav-panel {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--sab, 0px) + 8px);
  left: 8px;
  top: auto;
  width: 240px;
  background: rgba(28, 28, 46, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid #333;
  border-radius: 10px;
  z-index: 750;
  color: #eee;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: hidden;
}

#fav-panel.hidden { display: none; }

#fav-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #2e2e44;
}

#fav-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

#fav-panel-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}

#fav-panel-close:hover { color: #aaa; }

#fav-panel-list {
  padding: 8px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── About panel ─────────────────────────────────────────────────────────────── */

#about-panel {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--sab, 0px) + 8px);
  right: 8px;
  width: 260px;
  background: rgba(28, 28, 46, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid #333;
  border-radius: 10px;
  z-index: 750;
  color: #eee;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: hidden;
}

#about-panel.hidden { display: none; }

#about-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #2e2e44;
}

#about-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

#about-panel-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}

#about-panel-close:hover { color: #aaa; }

#about-panel-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#about-app-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

#about-app-desc {
  font-size: 12px;
  color: #999;
  line-height: 1.5;
  margin-bottom: 6px;
}

.about-section-label {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 8px;
  margin-bottom: 2px;
}

.about-row {
  font-size: 12px;
  color: #bbb;
}

.about-row a {
  color: #9cbce0;
  text-decoration: none;
}

.about-row a:hover { text-decoration: underline; }

#about-disclaimer {
  font-size: 10px;
  color: #999;
  line-height: 1.5;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #2e2e44;
}

/* ── Feedback / bug-report modal ─────────────────────────────────────────────── */

#feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

#feedback-modal.hidden { display: none; }

#feedback-card {
  width: 100%;
  max-width: 380px;
  background: rgba(28, 28, 46, 0.99);
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
  color: #eee;
  overflow: hidden;
}

#feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #2e2e44;
}

#feedback-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

#feedback-close {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}

#feedback-close:hover { color: #ddd; }

#feedback-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-label {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

#feedback-category,
#feedback-text {
  width: 100%;
  background: #15152a;
  border: 1px solid #34344e;
  border-radius: 8px;
  color: #eee;
  font: inherit;
  font-size: 14px;
  padding: 9px 10px;
  box-sizing: border-box;
}

#feedback-text { resize: vertical; min-height: 84px; line-height: 1.4; }

#feedback-category:focus,
#feedback-text:focus { outline: none; border-color: #78BE20; }

.feedback-context-note {
  font-size: 12px;
  color: #78BE20;
  background: rgba(120, 190, 32, 0.1);
  border-radius: 6px;
  padding: 6px 8px;
}

.feedback-context-note.hidden { display: none; }

#feedback-submit {
  margin-top: 4px;
  background: #78BE20;
  color: #102100;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  padding: 11px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

#feedback-submit:hover { background: #8cd62a; }
#feedback-submit:disabled { opacity: 0.6; cursor: default; }

.feedback-status {
  font-size: 12px;
  color: #999;
  min-height: 16px;
}

.feedback-status-ok  { color: #78BE20; }
.feedback-status-err { color: #ff8a80; }
.feedback-status a   { color: #78BE20; }

/* ── Mobile legend ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  #legend {
    bottom: calc(var(--tab-h) + var(--sab, 0px) + 12px);
    right: 10px;
    max-height: 60vh;
    padding: 8px 10px;
  }

  #legend:not(.legend-expanded) {
    display: none;
  }

  .legend-item { min-height: 30px; }
}

/* ── Pac-man minigame (self-contained — delete this block to remove) ─────────── */


#game-hud {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 20, 36, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

#game-score {
  font-size: 16px;
  letter-spacing: 0.5px;
}

#game-score span { color: #FFD600; }

#game-exit {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

#game-exit:hover { background: rgba(255,255,255,0.22); }

#game-dpad {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 156px;
  height: 156px;
  z-index: 800;
  display: grid;
  grid-template-columns: 52px 52px 52px;
  grid-template-rows: 52px 52px 52px;
  gap: 0;
  pointer-events: none;
}

#game-dpad .dp {
  pointer-events: auto;
  background: rgba(15, 20, 36, 0.85);
  color: #FFD600;
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background 0.1s;
}

#game-dpad .dp:active { background: #FFD600; color: #0f1424; }

#game-dpad .dp-up    { grid-column: 2; grid-row: 1; border-radius: 8px 8px 0 0; }
#game-dpad .dp-left  { grid-column: 1; grid-row: 2; border-radius: 8px 0 0 8px; }
#game-dpad .dp-right { grid-column: 3; grid-row: 2; border-radius: 0 8px 8px 0; }
#game-dpad .dp-down  { grid-column: 2; grid-row: 3; border-radius: 0 0 8px 8px; }

#game-over {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.game-over-box {
  background: #0f1424;
  color: #fff;
  border: 2px solid #FFD600;
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  max-width: 90vw;
}

.game-over-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #FFD600;
}

.game-over-score {
  font-size: 16px;
  margin-bottom: 18px;
  color: #ddd;
}

.game-over-score strong { color: #FFD600; font-size: 22px; }

.game-over-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.game-over-btns button {
  background: #FFD600;
  border: none;
  color: #0f1424;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.game-over-btns button:hover  { background: #FFE34D; }
.game-over-btns button:active { transform: scale(0.97); }

#game-over-exit { background: rgba(255,255,255,0.12) !important; color: #fff !important; }
#game-over-exit:hover { background: rgba(255,255,255,0.22) !important; }

@media (max-width: 600px) {
  #game-hud { font-size: 13px; padding: 8px 12px; }
  #game-dpad { bottom: calc(var(--tab-h) + var(--sab, 0px) + 16px); right: 16px; }
}

/* ── Safe area insets (Capacitor: iOS notch / Dynamic Island, Android nav bar) ──
   Android: --sat/--sab/--sal/--sar injected in px by MainActivity.java
   iOS:     falls back to env(safe-area-inset-*) natively via viewport-fit=cover   */
:root {
  --sat: env(safe-area-inset-top,    0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left,   0px);
  --sar: env(safe-area-inset-right,  0px);
}

/* Game HUD sits below the status bar */
#game-hud {
  top: calc(16px + var(--sat));
}

/* Desktop: PID panel top/right + legend right edge account for notch/rounded corners */
@media (min-width: 601px) {
  #pid-panel {
    top: calc(16px + var(--sat));
    right: calc(16px + var(--sar));
  }
  #legend {
    right: calc(12px + var(--sar));
  }
  #game-dpad {
    bottom: calc(var(--tab-h) + var(--sab) + 28px);
  }
}

/* Mobile: cap PID sheet height; vehicle panel below status bar */
@media (max-width: 600px) {
  #pid-panel {
    max-height: calc(100dvh - var(--tab-h) - var(--sab) - var(--sat) - 8px);
  }
  #vehicle-panel {
    top: calc(16px + var(--sat));
  }
  #game-dpad {
    bottom: calc(var(--tab-h) + var(--sab) + 16px);
  }
}
