/* ─────────────────────────────────────────────────────────────
   parkiraj.click
   Signal blue from the parking sign, asphalt and concrete for the
   surfaces, and one recurring picture: a row of parking bays that
   shows how much room is left. Archivo, one family, two widths:
   expanded for the numbers people scan, regular for everything else.
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Archivo";
  src: url("assets/fonts/archivo-parkiraj.woff2") format("woff2-variations"),
       url("assets/fonts/archivo-parkiraj.woff2") format("woff2");
  font-weight: 400 800;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --paper: #eef1f5;          /* concrete */
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e7ebf0;
  --line: #e0e5eb;
  --ink: #0f1622;            /* asphalt ink */
  --ink-2: #4b5666;
  --ink-3: #7f8a99;

  --brand: #1d5bff;          /* signal blue */
  --brand-ink: #ffffff;
  --brand-soft: #e6edff;
  --mall: #8b5cf6;            /* shopping-centre garages */
  --mall-ink: #6d3fe0;
  --hotel: #0e9f8e;            /* hotel garages */
  --hotel-ink: #0a7a6d;
  --sport: #e0457b;            /* sports venues */
  --sport-ink: #c42a62;
  --hospital: #5b5bd6;         /* hospitals */
  --hospital-ink: #4343b8;
  --airport: #52627a;          /* airport */
  --airport-ink: #3e4c61;
  --station: #b5651d;          /* bus and train stations */
  --station-ink: #94500f;
  --market: #6f8f1f;           /* green markets */
  --market-ink: #56710f;
  --focus: #1d5bff;

  /* availability, tuned for text on surfaces */
  --good: #12924f;
  --mid: #b26a00;
  --low: #d43a3a;
  /* availability, solid fills with dark text (map pins, bays) */
  --good-fill: #2bd67b;
  --mid-fill: #ffb224;
  --low-fill: #ff6b6b;
  --on-fill: #0b1118;

  --bay-taken: #dfe4ea;

  --glass: rgb(255 255 255 / 0.86);
  --shadow-1: 0 1px 2px rgb(15 22 34 / 0.06), 0 2px 8px rgb(15 22 34 / 0.06);
  --shadow-float: 0 14px 34px -16px rgb(15 22 34 / 0.38), 0 2px 6px rgb(15 22 34 / 0.08);

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gap: 10px;
  --topbar-h: 52px;
  --panel-w: clamp(368px, 30vw, 420px);
  --sheet-h: 55vh;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0e131b;        /* night asphalt */
    --surface: #161c26;
    --surface-2: #1d2531;
    --surface-3: #263040;
    --line: #283241;
    --ink: #f2f5f9;
    --ink-2: #a9b3c1;
    --ink-3: #717d8e;
    --brand: #3f74ff;
    --brand-soft: #1a2747;
    --mall: #9b74ff;
    --mall-ink: #b9a0ff;
    --hotel: #22c3ad;
    --hotel-ink: #5fe0cc;
    --sport: #f0619a;
    --sport-ink: #ff8db8;
    --hospital: #7c7cf0;
    --hospital-ink: #a5a5ff;
    --airport: #8292ab;
    --airport-ink: #b3c0d4;
    --station: #d9893f;
    --station-ink: #f0ad6b;
    --market: #9bbd3d;
    --market-ink: #bad86a;
    --focus: #7ea2ff;
    --good: #43e08a;
    --mid: #ffb938;
    --low: #ff7676;
    --bay-taken: #2a3443;
    --glass: rgb(22 28 38 / 0.84);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-float: 0 16px 36px -14px rgb(0 0 0 / 0.7), 0 2px 6px rgb(0 0 0 / 0.3);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, input { font: inherit; color: inherit; }
a { color: var(--brand); }

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 2px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* numbers people scan: expanded, heavy, tabular */
.num {
  font-stretch: 125%;
  font-weight: 800;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.01em;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s var(--ease);
}

.icon-btn:active { transform: scale(0.92); }
.icon-btn.outline { border: 1px solid var(--line); background: var(--surface); }

@media (hover: hover) {
  .icon-btn:hover { background: var(--surface-2); }
}

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

.map-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.leaflet-container {
  background: var(--paper);
  font-family: var(--font);
}

/* OSM tiles washed down so the pins carry the map */
.leaflet-tile-pane { filter: saturate(0.25) contrast(0.86) brightness(1.04); }

@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: invert(1) hue-rotate(185deg) brightness(0.86) contrast(0.82) saturate(0.3); }
}

.leaflet-control-attribution.leaflet-control {
  background: var(--glass);
  color: var(--ink-3);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 6px 0 0 0;
}

.leaflet-control-attribution a { color: var(--ink-2); }

.leaflet-bar.leaflet-control,
.map-btn {
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-touch .leaflet-bar a {
  width: 42px;
  height: 42px;
  line-height: 40px;
  background: var(--surface);
  color: var(--ink);
  border-bottom-color: var(--line);
  font-size: 20px;
  font-weight: 500;
}

.leaflet-touch .leaflet-bar { border: 1px solid var(--line); }

.map-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
}

.map-btn .ic { width: 22px; height: 22px; }
.map-btn.is-busy .ic { animation: spin 1s linear infinite; }

/* Garage pins: a status-coloured tag with the free count */
.pin-icon { background: none; border: 0; }

.pin {
  --fill: var(--good-fill);
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 2px));
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.pin.level-mid { --fill: var(--mid-fill); }
.pin.level-low { --fill: var(--low-fill); }

.pin-tag {
  display: block;
  min-width: 34px;
  padding: 4px 8px 3px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--on-fill);
  box-shadow: 0 0 0 2px var(--surface), 0 6px 14px -4px rgb(0 0 0 / 0.45);
  text-align: center;
  font-size: 14px;
  line-height: 1.15;
  transform-origin: 50% 120%;
  transition: transform 0.25s var(--spring), box-shadow 0.2s ease;
}

.pin::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: -5px;
  background: var(--fill);
  border-right: 2px solid var(--surface);
  border-bottom: 2px solid var(--surface);
  transform: rotate(45deg);
  border-bottom-right-radius: 2px;
}

.pin.is-selected .pin-tag {
  transform: scale(1.28);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px color-mix(in srgb, var(--brand) 55%, transparent), 0 8px 18px -4px rgb(0 0 0 / 0.5);
}

.pin.is-selected::after { opacity: 0; }

@media (hover: hover) {
  .pin:not(.is-selected):hover .pin-tag,
  .pin.is-hover:not(.is-selected) .pin-tag { transform: translateY(-3px) scale(1.12); }
}

/* zoomed out: tags collapse to dots so the centre does not pile up */
.is-zoomed-out .pin:not(.is-selected) { transform: translate(-50%, -50%); }

.is-zoomed-out .pin:not(.is-selected) .pin-tag {
  min-width: 0;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
}

.is-zoomed-out .pin:not(.is-selected)::after { display: none; }

.pin-ev {
  display: none;
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 2px var(--surface);
}

.pin-ev .ic { width: 11px; height: 11px; stroke-width: 2.6; }

.ev-mode .pin.has-ev .pin-ev { display: grid; animation: pop-in 0.35s var(--spring) both; }
.ev-mode .pin:not(.has-ev) { display: none; }
.traffic-mode .pin { display: none; }
/* live public pins switched off (they stay on the charger tab) */
.hide-public:not(.ev-mode) .pin:not(.is-info) { display: none; }

.is-zoomed-out .pin-ev { width: 14px; height: 14px; top: -9px; right: -11px; }
.is-zoomed-out .pin-ev .ic { width: 9px; height: 9px; }

/* shopping-centre garages (no live count): a violet bag tag, never a number */
.pin.is-info { --fill: var(--mall); }
.pin.is-info.kind-hotel { --fill: var(--hotel); }
.pin.is-info.kind-sport { --fill: var(--sport); }
.pin.is-info.kind-airport { --fill: var(--airport); }
.pin.is-info.kind-train { --fill: var(--station); }
.pin.is-info.kind-market { --fill: var(--market); }
.pin.is-info.kind-bus { --fill: var(--station); }
.pin.is-info.kind-hospital { --fill: var(--hospital); }
.pin.is-info .pin-tag {
  display: grid;
  place-items: center;
  min-width: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 11px;
  color: #fff;
}
.pin.is-info .pin-tag .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.is-zoomed-out .pin.is-info:not(.is-selected) .pin-tag { width: 14px; height: 14px; border-radius: 50%; }
.is-zoomed-out .pin.is-info:not(.is-selected) .pin-tag .ic { display: none; }

/* public charging stations: their own round marker */
.ev-station-pin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 2.5px var(--surface), 0 4px 10px -2px rgb(0 0 0 / 0.45);
  animation: pop-in 0.35s var(--spring) both;
}

.ev-station-pin.is-dc { background: #0f1622; color: var(--good-fill); }
.ev-station-pin .ic { width: 16px; height: 16px; stroke-width: 2.4; }

.is-zoomed-out .ev-station-pin { width: 14px; height: 14px; margin: 8px; }
.is-zoomed-out .ev-station-pin .ic { display: none; }

/* you are here */
.me-icon { background: none; border: 0; }

.me-dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.45);
}

.me-dot::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
}

.me-dot::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 28%, transparent);
  animation: me-pulse 2.4s ease-out infinite;
  z-index: -1;
}

@keyframes me-pulse {
  from { transform: scale(0.4); opacity: 1; }
  to { transform: scale(1.4); opacity: 0; }
}

/* popups */
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line);
}

.leaflet-popup-tip { background: var(--surface); box-shadow: none; }

.leaflet-popup-content {
  margin: 12px 36px 12px 14px;
  font-size: 14px;
  line-height: 1.35;
  min-width: 210px;
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--ink-3);
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 26px;
}

.pop-name { font-weight: 700; font-size: 15px; }
.pop-sub { color: var(--ink-2); margin-top: 2px; }

.pop-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
  color: var(--ink-2);
}

.pop-count .num { font-size: 22px; color: var(--lvl, var(--ink)); }

.pop-actions { display: flex; gap: 8px; margin-top: 10px; }

.leaflet-container a.pop-btn,
.leaflet-container button.pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.leaflet-container button.pop-btn.ghost { background: var(--surface-2); color: var(--ink); padding: 0 12px; }
.pop-btn .ic { width: 16px; height: 16px; }

.zone-pop strong { display: block; font-size: 14.5px; }
.zone-pop span { color: var(--ink-2); }
.zone-pop small { display: block; color: var(--ink-3); font-size: 12px; }

/* ── Top bar ──────────────────────────────────────────────── */

.topbar {
  position: fixed;
  z-index: 20;
  top: calc(var(--safe-top) + var(--gap));
  left: var(--gap);
  right: var(--gap);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 6px 0 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-float);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--ink);
  border-radius: 8px;
}

.brand-logo {
  display: block;
  height: 24px;
  width: auto;
  aspect-ratio: 867.4 / 107;
  max-width: 100%;
}

.status {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

#updated-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding-left: 4px;
}

.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink-3);
}

.status[data-health="live"] .live-dot {
  background: var(--good-fill);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good-fill) 25%, transparent);
}

.status[data-health="stale"] .live-dot { background: var(--mid-fill); }
.status[data-health="error"] .live-dot { background: var(--low-fill); }
.status[data-health="error"] #updated-label { color: var(--low); }

.refresh-btn { position: relative; }
.refresh-btn.spinning .refresh-icon { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.refresh-ring {
  position: absolute;
  inset: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.refresh-ring circle {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.refresh-btn.is-counting .refresh-ring circle {
  opacity: 0.85;
  animation: refresh-countdown var(--refresh-ms, 60s) linear calc(-1 * var(--refresh-elapsed, 0ms)) both;
}

.refresh-btn.spinning .refresh-ring circle { opacity: 0; }
.status[data-health="stale"] .refresh-ring circle { stroke: var(--mid-fill); }

@keyframes refresh-countdown {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 100; }
}

.live-dot.ping::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--good-fill);
  animation: ping 0.9s ease-out both;
}

@keyframes ping {
  from { transform: scale(0.5); opacity: 1; }
  to { transform: scale(2.4); opacity: 0; }
}

/* ── Bottom sheet (phone) / side panel (desktop) ──────────── */

.sheet {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sheet-h);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 32px -14px rgb(0 0 0 / 0.35), 0 -1px 0 var(--line);
  transition: height 0.45s var(--ease);
  will-change: height;
}

.sheet-grab {
  flex-shrink: 0;
  padding: 0 14px 10px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.sheet-handle {
  display: block;
  width: 100%;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  position: relative;
}

.sheet-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 9px;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 3px;
  background: var(--surface-3);
  transition: width 0.2s var(--ease), margin 0.2s var(--ease), background-color 0.2s ease;
}

body.is-sheet-dragging .sheet-handle::before {
  width: 56px;
  margin-left: -28px;
  background: var(--ink-3);
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-bottom) + 8px);
  scrollbar-width: thin;
}

body.is-sheet-dragging .sheet,
body.is-sheet-dragging .leaflet-bottom { transition: none; }

/* tabs: a segmented control with a sliding thumb */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  background: var(--surface-2);
  border-radius: 14px;
}

.tab-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line);
  transition: transform 0.4s var(--spring);
}

@media (prefers-color-scheme: dark) {
  .tab-slider { background: var(--surface-3); box-shadow: none; }
}

.tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease;
}

.tab .ic { width: 17px; height: 17px; }
.tab.active { color: var(--ink); }
.tab.active .ic { color: var(--brand); }

/* ── Parking view ─────────────────────────────────────────── */

.pulse { padding: 4px 16px 14px; }

.pulse-total {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 0;
}

.pulse-num {
  font-size: 34px;
  line-height: 1;
  font-stretch: 125%;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.pulse-text { font-size: 15px; color: var(--ink-2); }

/* how the city is doing: one bar split by location status */
.pulse-split {
  display: flex;
  gap: 3px;
  height: 8px;
  margin-top: 12px;
}

.pulse-split span {
  height: 100%;
  border-radius: 3px;
  background: var(--fill);
  transform-origin: left center;
}

.pulse-split .level-good { --fill: var(--good-fill); }
.pulse-split .level-mid { --fill: var(--mid-fill); }
.pulse-split .level-low { --fill: var(--low-fill); }

.pulse-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}

.pulse-legend span { display: inline-flex; align-items: center; gap: 6px; }

.pulse-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--fill);
}

.pulse-legend .level-good { --fill: var(--good-fill); }
.pulse-legend .level-mid { --fill: var(--mid-fill); }
.pulse-legend .level-low { --fill: var(--low-fill); }

/* the recommendation: blue like the sign you look for on the street */
.pick { padding: 0 12px 12px; }
.pick:empty { display: none; }

.pick-card {
  position: relative;
  overflow: hidden;
  padding: 14px 14px 12px 16px;
  border-radius: 20px;
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 12px 26px -16px color-mix(in srgb, var(--brand) 90%, #000);
}

.pick-card::before {
  /* painted bay lines, faintly, on the right */
  content: "";
  position: absolute;
  right: -12px;
  top: -10px;
  bottom: -10px;
  width: 132px;
  background: repeating-linear-gradient(90deg, rgb(255 255 255 / 0.13) 0 3px, transparent 3px 30px);
  transform: skewX(-14deg);
  pointer-events: none;
}

.pick-label {
  position: relative;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: rgb(255 255 255 / 0.82);
}

.pick-main {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.pick-name {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.pick-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 4px;
  font-size: 14px;
  color: rgb(255 255 255 / 0.88);
}

.pick-meta span { display: inline-flex; align-items: center; gap: 4px; }
.pick-meta .ic { width: 15px; height: 15px; }

.pick-free { text-align: right; flex-shrink: 0; }
.pick-free .num { display: block; font-size: 34px; line-height: 1; }
.pick-free small { font-size: 12.5px; color: rgb(255 255 255 / 0.82); }

.pick-actions {
  position: relative;
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  font-weight: 650;
  font-size: 15.5px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.15s ease;
}

.btn:active { transform: scale(0.97); }
.btn .ic { width: 19px; height: 19px; }

.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-secondary { background: var(--surface-2); color: var(--ink); }

.pick-card .btn-light { flex: 1; background: #fff; color: #0f1622; }
.pick-card .btn-ghost { background: rgb(255 255 255 / 0.16); color: #fff; }

/* no location yet: an invitation, not an error */
.pick-ask {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: 1.5px dashed color-mix(in srgb, var(--brand) 45%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--brand-soft) 60%, var(--surface));
}

.pick-ask p { margin: 0; flex: 1; font-size: 14.5px; line-height: 1.35; }
.pick-ask strong { display: block; font-size: 15.5px; }
.pick-ask .btn { min-height: 42px; padding: 0 14px; font-size: 14.5px; flex-shrink: 0; }

/* sticky list head */
.list-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.origin {
  position: relative;
  display: flex;
  gap: 8px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px; /* 16px keeps iOS from zooming in */
}

.search input::placeholder { color: var(--ink-3); }
.origin .icon-btn { width: 46px; height: 46px; border-radius: 14px; color: var(--brand); }
.origin .icon-btn.is-busy .ic { animation: spin 1s linear infinite; }

.origin-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 54px;
  z-index: 5;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
  max-height: 260px;
  overflow-y: auto;
  animation: drop-in 0.2s var(--ease) both;
}

.origin-results:empty { display: none; }

.origin-results li {
  padding: 11px 10px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}

.origin-results li:hover,
.origin-results li:focus-visible,
.origin-results li[aria-selected="true"] { background: var(--surface-2); }

.origin-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--brand);
  font-weight: 600;
}

.origin-label .ic { width: 15px; height: 15px; }
.origin-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.origin-label button {
  margin-left: auto;
  flex-shrink: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 10px -16px 0;
  padding: 0 16px;
  scroll-padding: 0 16px;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s var(--ease);
}

.chip:active { transform: scale(0.95); }
.chip .ic { width: 15px; height: 15px; }

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

@media (hover: hover) {
  .chip:not(.active):hover { color: var(--ink); border-color: var(--ink-3); }
}

/* ── Location rows ────────────────────────────────────────── */

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  --lvl: var(--good);
  --fill: var(--good-fill);
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name free"
    "meta free"
    "bays bays";
  column-gap: 14px;
  padding: 14px 16px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  scroll-margin-top: 140px;
  transition: background-color 0.15s ease;
}

.row.level-mid { --lvl: var(--mid); --fill: var(--mid-fill); }
.row.level-low { --lvl: var(--low); --fill: var(--low-fill); }

.row:focus-visible { outline-offset: -3px; border-radius: 6px; }
.row:active { background: var(--surface-2); }

@media (hover: hover) {
  .row:hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
}

.row.is-selected { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }

.row.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
}

.row-name {
  grid-area: name;
  min-width: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  margin-top: 3px;
  font-size: 14px;
  color: var(--ink-2);
  min-width: 0;
}

.row-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-meta .ic { width: 15px; height: 15px; color: var(--ink-3); }
.row-meta .strong { color: var(--ink); font-weight: 550; }
.row-meta .ev-count { color: var(--brand); font-weight: 600; }
.row-meta .ev-count .ic { color: var(--brand); }

.row-free {
  grid-area: free;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.row-free .num {
  font-size: 28px;
  line-height: 1;
  color: var(--lvl);
  transition: color 0.4s ease;
}

.row-word {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--lvl);
  white-space: nowrap;
}

.row-bays {
  grid-area: bays;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.bays-note {
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The bay meter: ten parking bays, the free ones lit */
.bays {
  --n: 10;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  gap: 3px;
  flex: 1;
  max-width: 210px;
  height: 14px;
}

.bay {
  border-radius: 3px;
  background: var(--bay-taken);
  transition: background-color 0.35s ease, transform 0.35s var(--spring);
}

.bay.free { background: var(--fill); }

.bays.boot .bay.free {
  animation: bay-park 0.5s var(--spring) both;
  animation-delay: calc(var(--row-delay, 0ms) + var(--i) * 40ms);
}

@keyframes bay-park {
  from { transform: scaleY(0.2); opacity: 0; }
}

.bay.flip { animation: bay-flip 0.6s var(--spring); }

@keyframes bay-flip {
  40% { transform: scaleY(1.45); }
}

.row.is-info { --lvl: var(--ink-2); }
.row.is-info .row-free .num { font-size: 22px; }
.row.is-info .row-meta > span { white-space: normal; }
.row.is-info .row-word { font-weight: 500; color: var(--ink-3); }
.row.is-info .row-note { display: flex; align-items: center; gap: 4px; }
.row.is-info .row-note .ic { width: 14px; height: 14px; flex-shrink: 0; }
.row.is-info { --kind-ink: var(--mall-ink); }
.row.is-info.kind-hotel { --kind-ink: var(--hotel-ink); }
.row.is-info.kind-sport { --kind-ink: var(--sport-ink); }
.row.is-info.kind-airport { --kind-ink: var(--airport-ink); }
.row.is-info.kind-train { --kind-ink: var(--station-ink); }
.row.is-info.kind-market { --kind-ink: var(--market-ink); }
.row.is-info.kind-bus { --kind-ink: var(--station-ink); }
.row.is-info.kind-hospital { --kind-ink: var(--hospital-ink); }
.row.is-info .row-kind-tag,
.row.is-info .row-kind-tag .ic { color: var(--kind-ink); font-weight: 600; }

.mall-intro { padding: 10px 16px 4px; border-top: 6px solid var(--paper); }
.mall-intro .group-title { padding: 6px 0 0; }

.row-note {
  grid-area: bays;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-3);
}

.trend {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  fill: currentColor;
}

.trend.up { color: var(--good); }
.trend.down { color: var(--low); }

/* change since the last refresh */
.delta {
  position: absolute;
  top: -12px;
  right: 100%;
  margin-right: 4px;
  z-index: 1;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  animation: delta-pop 4.2s var(--ease) both;
}

.delta.up { color: var(--on-fill); background: var(--good-fill); }
.delta.down { color: var(--on-fill); background: var(--low-fill); }

@keyframes delta-pop {
  0% { opacity: 0; transform: translateY(8px) scale(0.6); }
  7% { opacity: 1; transform: translateY(0) scale(1.1); }
  13% { transform: scale(1); }
  84% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px); }
}

.num.flash-up { animation: flash-up 1.1s ease-out; }
.num.flash-down { animation: flash-down 1.1s ease-out; }

@keyframes flash-up {
  0%, 30% { color: var(--good); transform: scale(1.12); }
}

@keyframes flash-down {
  0%, 30% { color: var(--low); transform: scale(0.92); }
}

/* loading placeholders */
.row.is-placeholder { cursor: default; grid-template-areas: "name free" "meta free" "bays bays"; }

.ph {
  display: block;
  border-radius: 6px;
  background: linear-gradient(100deg, var(--surface-2) 35%, var(--surface-3) 50%, var(--surface-2) 65%);
  background-size: 300% 100%;
  animation: shimmer 1.6s linear infinite;
}

.ph-name { grid-area: name; width: 60%; height: 17px; }
.ph-meta { grid-area: meta; width: 42%; height: 12px; margin-top: 9px; }
.ph-bays { grid-area: bays; width: 56%; height: 14px; margin-top: 12px; }
.ph-num { grid-area: free; width: 58px; height: 34px; }

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.list-message {
  padding: 28px 24px;
  color: var(--ink-2);
  font-size: 15px;
  text-align: center;
  list-style: none;
}

.list-message strong { display: block; color: var(--ink); margin-bottom: 4px; }

.foot-note {
  margin: 14px 16px 20px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

.foot-note a { color: var(--ink-2); }

/* ── EV & traffic views ───────────────────────────────────── */

.view-intro { padding: 4px 16px 12px; }

.view-headline {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.view-sub { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }

.group-head { padding-top: 6px; }

.group-title {
  margin: 0;
  padding: 16px 16px 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.group-head .chips { margin: 4px 0 6px; }

.stations { list-style: none; margin: 0; padding: 0; }

.station {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.station-name { font-size: 16px; font-weight: 650; line-height: 1.25; }
.station-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 1px; }

.station-power {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: right;
}

.station-power .num { font-size: 22px; line-height: 1; color: var(--ink); }
.station-power small { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.station-power.is-dc .num { color: var(--brand); }

.station-tags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.tag .ic { width: 13px; height: 13px; }

.station-notes { grid-column: 1 / -1; }

.note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-2);
}

.note .ic { width: 14px; height: 14px; margin-top: 1px; }
.note.warn { color: var(--low); }

.station-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 10px; }
.station-actions .chip { height: 38px; }

/* traffic */
.traffic-group { margin-bottom: 6px; }

.traffic-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 6px;
}

.traffic-group-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.traffic-group-head span { font-size: 13px; color: var(--ink-3); }

.traffic-list { list-style: none; margin: 0; padding: 0; }

.traffic-list li {
  border-bottom: 1px solid var(--line);
  animation: rise-in 0.36s var(--ease) calc(var(--i, 0) * 28ms) both;
}

.traffic-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  width: 100%;
  padding: 12px 16px 13px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.traffic-row:active { background: var(--surface-2); }

@media (hover: hover) {
  .traffic-row:hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
}

.traffic-name { display: block; font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.traffic-sub { display: block; font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.traffic-est { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.traffic-row.level-none .traffic-badge { color: var(--ink-2); }

.traffic-badge {
  align-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--on-fill);
  background: var(--fill, var(--surface-3));
}

.level-good { --fill: var(--good-fill); --lvl: var(--good); }
.level-mid { --fill: var(--mid-fill); --lvl: var(--mid); }
.level-low, .level-closed { --fill: var(--low-fill); --lvl: var(--low); }

/* speed gauge: how close to the usual speed the road is moving */
.speed {
  grid-column: 1 / -1;
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}

.speed i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 3px;
  background: var(--fill, var(--ink-3));
  transform-origin: left center;
  animation: grow-x 0.8s var(--ease) calc(var(--i, 0) * 28ms + 120ms) both;
}

@keyframes grow-x { from { transform: scaleX(0); } }

.traffic-cam {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 0 16px;
  padding: 0 16px 12px 0;
  color: var(--brand);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.traffic-cam .ic { width: 16px; height: 16px; }

/* ── Detail sheet ─────────────────────────────────────────── */

.detail {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(8 12 18 / 0.5);
  animation: fade-in 0.25s ease both;
}

.detail-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  height: min(92vh, 860px);
  height: min(92dvh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: sheet-up 0.42s var(--ease) both;
  will-change: transform;
}

.detail-card.is-dragging { transition: none; }
.detail-card.is-settling { transition: transform 0.3s var(--ease); }

.detail-grip {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  touch-action: none;
}

.detail-grip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.8);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
}

.detail-card:not(.has-hero) .detail-grip::before { background: var(--surface-3); box-shadow: none; }

/* compact title bar that appears once the name scrolls away */
.detail-bar {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  height: 62px;
  display: flex;
  align-items: center;
  padding: 4px 64px 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.25s var(--ease);
  pointer-events: none;
}

.detail-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-card.is-scrolled .detail-bar { opacity: 1; transform: none; }
.detail-card.is-scrolled .detail-close { background: var(--surface-2); color: var(--ink); }
.detail-card.is-scrolled .detail-grip::before { background: var(--surface-3); box-shadow: none; }

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgb(10 14 20 / 0.5);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.detail-card:not(.has-hero) .detail-close { background: var(--surface-2); color: var(--ink); }

.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-hero {
  position: relative;
  height: 190px;
  overflow: hidden;
  background: var(--surface-2);
}

.detail-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.5s ease, transform 1.4s var(--ease);
}

.detail-hero img.is-loaded { opacity: 1; transform: none; }

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgb(0 0 0 / 0.28), transparent 38%, transparent 62%, var(--surface));
}

.detail-body { padding: 14px 18px calc(28px + var(--safe-bottom)); }
.detail-card:not(.has-hero) .detail-body { padding-top: 36px; }
.detail-card:not(.has-hero) .d-head { padding-right: 44px; }

.d-kind {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}

.d-kind span { display: inline-flex; align-items: center; gap: 4px; }
.d-kind .ic { width: 15px; height: 15px; }
.d-kind .muted { color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }

#detail-title {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.d-stat {
  --lvl: var(--good);
  --fill: var(--good-fill);
  margin-top: 16px;
  padding: 16px 16px 14px;
  border-radius: 20px;
  background: var(--surface-2);
}

.d-stat.level-mid { --lvl: var(--mid); --fill: var(--mid-fill); }
.d-stat.level-low { --lvl: var(--low); --fill: var(--low-fill); }

.d-stat-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.d-free { position: relative; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.d-free .num { font-size: 52px; line-height: 0.95; color: var(--lvl); display: inline-block; }
.d-free-of { font-size: 15px; color: var(--ink-2); }

.status-pill {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--on-fill);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.d-stat .bays {
  --n: 20;
  max-width: none;
  height: 26px;
  gap: 4px;
  margin-top: 14px;
}

.d-stat .bay { border-radius: 4px; }

@media (prefers-color-scheme: dark) {
  .d-stat .bay:not(.free) { background: var(--surface-3); }
}

.d-stat-note {
  margin: 10px 0 0;
  font-size: 13.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.d-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 14px;
}

.d-actions .btn-primary { min-height: 52px; font-size: 16px; }
.d-actions .btn-secondary { min-height: 52px; padding: 0 18px; }

.d-section {
  margin-top: 26px;
}

.d-section h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

/* price calculator */
.calc-hours {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}

.calc-hours button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 650;
  font-size: 14.5px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.calc-hours button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--line);
}

@media (prefers-color-scheme: dark) {
  .calc-hours button[aria-pressed="true"] { background: var(--surface-3); box-shadow: none; }
}

.calc-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.calc-total { display: flex; align-items: baseline; gap: 6px; }
.calc-total .num { font-size: 34px; line-height: 1; }
.calc-total span:last-child { font-size: 15px; color: var(--ink-2); font-weight: 600; }
.calc-how { font-size: 13.5px; color: var(--ink-2); text-align: right; }

.calc-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 13.5px;
  line-height: 1.4;
}

.calc-tip .ic { width: 16px; height: 16px; color: var(--brand); margin-top: 1px; }

/* 24 h chart */
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chart-head h3 { margin-bottom: 10px; }

.chart-readout {
  font-size: 13.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.chart-readout.is-active { color: var(--ink); font-weight: 650; }

.chart-insight { margin: -4px 0 10px; font-size: 14px; color: var(--ink-2); }
.chart-insight strong { color: var(--ink); font-weight: 650; }

.chart-plot {
  position: relative;
  height: 120px;
  border-radius: 14px;
  background-color: var(--surface-2);
  background-image: linear-gradient(to bottom, color-mix(in srgb, var(--line) 80%, transparent) 1px, transparent 1px);
  background-size: 100% 25%;
  touch-action: pan-y;
  cursor: crosshair;
}

.chart-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--lvl);
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.chart-area { fill: color-mix(in srgb, var(--fill) 22%, transparent); }

.chart-gap { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 3 4; fill: none; vector-effect: non-scaling-stroke; }

.d-chart.is-drawing .chart-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: line-draw 1.1s var(--ease) 0.25s forwards;
}

.d-chart.is-drawing .chart-area { animation: fade-in 0.6s ease 0.8s both; }
.d-chart.is-drawing .chart-dot { animation: dot-pop 0.45s var(--spring) 1.2s both; }

@keyframes line-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes dot-pop { from { transform: translate(-50%, -50%) scale(0); } }

.chart-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--ink-3);
  pointer-events: none;
}

.chart-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fill);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px color-mix(in srgb, var(--fill) 40%, transparent);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.chart-dot.is-scrubbing { background: var(--ink); }

.chart-axis {
  position: relative;
  height: 18px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.chart-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.chart-axis .chart-now { left: auto; right: 0; transform: none; color: var(--ink-2); font-weight: 600; }

/* facts */
.d-facts { display: grid; gap: 12px; }

.d-fact {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
  line-height: 1.4;
}

.d-fact .ic { width: 20px; height: 20px; margin-top: 0; color: var(--ink-3); }
.d-fact small { display: block; font-size: 13px; color: var(--ink-3); }

.d-amenities { display: flex; flex-wrap: wrap; gap: 6px; }
.d-amenities .tag { padding: 6px 10px; font-size: 13.5px; }
.d-amenities .tag .ic { width: 16px; height: 16px; color: var(--ink-2); }

.price-list { margin-top: 2px; }

.price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  font-size: 14.5px;
  border-bottom: 1px solid var(--line);
}

.price-item { color: var(--ink-2); line-height: 1.35; }

.price-value {
  flex-shrink: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.price-more { margin-top: 2px; }

.price-more summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--brand);
  cursor: pointer;
  list-style: none;
}

.price-more summary::-webkit-details-marker { display: none; }
.price-more summary .ic { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.price-more[open] summary .ic { transform: rotate(90deg); }

.price-source { display: inline-block; margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }

.d-notes {
  margin: 22px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* ── Toast ────────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 24px);
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14.5px;
  font-weight: 550;
  box-shadow: var(--shadow-float);
  animation: toast-in 0.35s var(--spring) both;
}

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(0.96); } }

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 100;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
}

/* ── Shared motion ────────────────────────────────────────── */

@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes pop-in { from { transform: scale(0); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }

/* first load: pins drop onto the map, nearest the centre first */
.pin.boot .pin-tag {
  animation: pin-drop 0.55s var(--spring) var(--boot-delay, 0ms) both;
}

.pin.boot::after { animation: fade-in 0.3s ease calc(var(--boot-delay, 0ms) + 0.2s) both; }

@keyframes pin-drop {
  from { opacity: 0; transform: translateY(-18px) scale(0.6); }
}

.pin.flash-up .pin-tag,
.pin.flash-down .pin-tag { animation: pin-pop 0.6s var(--spring); }

@keyframes pin-pop { 40% { transform: scale(1.25); } }

.pin-ripple {
  position: absolute;
  left: 50%;
  top: 12px;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  border: 2.5px solid var(--brand);
  pointer-events: none;
  animation: ripple 1s ease-out 2 both;
}

@keyframes ripple {
  from { transform: scale(0.35); opacity: 0.9; }
  to { transform: scale(1.5); opacity: 0; }
}

.pulse-split.boot span { animation: grow-x 0.9s var(--ease) both; }
.pulse-split.boot span:nth-child(2) { animation-delay: 0.08s; }
.pulse-split.boot span:nth-child(3) { animation-delay: 0.16s; }

.pick-card.enter { animation: pick-in 0.6s var(--spring) both; }

@keyframes pick-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }

.detail.is-closing .detail-backdrop { animation: fade-out 0.24s ease both; }
.detail.is-closing .detail-card { animation: sheet-down 0.28s cubic-bezier(0.4, 0, 1, 1) both; }

/* the free count flies from the row (or pin) into the sheet */
::view-transition-group(free-count) {
  z-index: 2;
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}

::view-transition-old(free-count),
::view-transition-new(free-count) { animation-duration: 0.5s; height: 100%; }

::view-transition-new(detail-card):only-child { animation: sheet-up 0.46s cubic-bezier(0.32, 0.72, 0, 1) both; }
::view-transition-old(detail-card):only-child { animation: sheet-down 0.28s ease-in both; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.25s; }

.detail-card { view-transition-name: detail-card; }
#detail-free { view-transition-name: free-count; }

/* ── Phone: the sheet's height drives the map controls ───── */

@media (max-width: 859.98px) {
  .leaflet-bottom {
    bottom: var(--sheet-h);
    transition: bottom 0.45s var(--ease);
  }

  .leaflet-control-zoom { display: none; }
  .leaflet-bottom .leaflet-control { margin-right: 12px; margin-bottom: 12px; }
  .leaflet-control-attribution.leaflet-control { margin: 0; }

  .sheet[data-state="peek"] .sheet-body { overflow: hidden; }

  body[data-sheet="full"] .leaflet-bottom { opacity: 0; pointer-events: none; }

  /* in the peek state the sheet is just the tabs and the city total */
  .sheet[data-state="peek"] .pulse-split,
  .sheet[data-state="peek"] .pulse-legend { opacity: 0; }
}

@media (max-width: 599.98px) {
  .upd-word { display: none; }
}

@media (max-width: 420px) {
  :root { --topbar-h: 50px; }
  .brand-logo { height: 21px; }
  .row { padding: 13px 14px 14px; column-gap: 12px; }
  .row-name { font-size: 16.5px; }
  .row-meta { font-size: 13.5px; gap: 2px 10px; }
  .row-free .num { font-size: 26px; }
  .pin-tag { min-width: 30px; padding: 3px 6px 2px; font-size: 13px; border-radius: 9px; }
  .list-head, .pulse { padding-left: 14px; padding-right: 14px; }
  .chips { margin-left: -14px; margin-right: -14px; padding: 0 14px; }
  .group-head .chips { margin: 4px 0 6px; }
}

@media (max-width: 359.98px) {
  .brand-logo { height: 18px; }
  .tab { font-size: 13.5px; gap: 4px; }
  .tab .ic { width: 15px; height: 15px; }
  .pulse-num { font-size: 30px; }
  .calc-hours button { font-size: 13.5px; }
}

/* ── Desktop: floating side panel, detail beside it ───────── */

@media (min-width: 860px) {
  :root { --gap: 16px; --topbar-h: 58px; }

  .topbar { right: auto; width: var(--panel-w); }

  .sheet {
    top: calc(var(--gap) + var(--topbar-h) + 10px);
    bottom: var(--gap);
    left: var(--gap);
    right: auto;
    width: var(--panel-w);
    height: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-float);
    transition: none;
    overflow: hidden;
  }

  .sheet-grab { padding-top: 12px; cursor: default; touch-action: auto; }
  .sheet-handle { display: none; }

  .leaflet-bottom .leaflet-control { margin-right: var(--gap); }
  .leaflet-bottom .leaflet-control-attribution.leaflet-control { margin: 0; }
  .leaflet-control-zoom.leaflet-bar { margin-bottom: 10px; }

  .detail {
    inset: var(--gap) auto var(--gap) calc(var(--panel-w) + var(--gap) * 2);
    width: 440px;
    align-items: stretch;
    pointer-events: none;
  }

  .detail-backdrop { display: none; }

  .detail-card {
    height: auto;
    max-width: none;
    border-radius: 20px;
    border: 1px solid var(--line);
    pointer-events: auto;
    animation: panel-in 0.42s var(--ease) both;
  }

  .detail-grip { display: none; }
  .detail.is-closing .detail-card { animation: panel-out 0.24s ease-in both; }

  @keyframes panel-in { from { opacity: 0; transform: translateX(-24px); } }
  @keyframes panel-out { to { opacity: 0; transform: translateX(-16px); } }
}

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

  .refresh-ring, .delta, .pin-ripple { display: none; }
}

/* ── Garages without a live count ─────────────────────────── */

.pop-count.is-info .num { color: var(--ink-2); }

.d-stat.is-info { --lvl: var(--ink-2); --fill: var(--surface-3); }
.d-stat.is-info .d-stat-top { flex-wrap: wrap; align-items: center; }
.d-stat.is-info .status-pill { background: var(--surface-3); color: var(--ink-2); }

.d-price-summary { margin: 0 0 10px; font-size: 15px; line-height: 1.45; color: var(--ink); }

.d-sources a { color: var(--ink-2); }

.d-kind .d-kind-place { color: var(--mall-ink); }
.d-kind .d-kind-place.kind-hotel { color: var(--hotel-ink); }
.d-kind .d-kind-place.kind-sport { color: var(--sport-ink); }
.d-kind .d-kind-place.kind-airport { color: var(--airport-ink); }
.d-kind .d-kind-place.kind-train { color: var(--station-ink); }
.d-kind .d-kind-place.kind-market { color: var(--market-ink); }
.d-kind .d-kind-place.kind-bus { color: var(--station-ink); }
.d-kind .d-kind-place.kind-hospital { color: var(--hospital-ink); }
.mall-intro .chips { margin: 10px -16px 2px; }

.detail-hero.is-art { --art: var(--mall); }
.detail-hero.is-art[data-kind="hotel"] { --art: var(--hotel); }
.detail-hero.is-art[data-kind="sport"] { --art: var(--sport); }
.detail-hero.is-art[data-kind="airport"] { --art: var(--airport); }
.detail-hero.is-art[data-kind="train"] { --art: var(--station); }
.detail-hero.is-art[data-kind="market"] { --art: var(--market); }
.detail-hero.is-art[data-kind="bus"] { --art: var(--station); }
.detail-hero.is-art[data-kind="hospital"] { --art: var(--hospital); }
.detail-hero.is-art::after { background: linear-gradient(transparent 55%, var(--surface)); }

.hero-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--art) 70%, #fff);
  background:
    radial-gradient(circle at 78% 30%, color-mix(in srgb, var(--art) 45%, transparent), transparent 55%),
    radial-gradient(circle at 15% 85%, color-mix(in srgb, var(--art) 30%, transparent), transparent 50%),
    color-mix(in srgb, var(--art) 16%, var(--surface));
}

.hero-art .ic { width: 84px; height: 84px; stroke-width: 1.4; transform: translateY(-10px); }

/* ── Charging station detail ──────────────────────────────── */

.station[data-station-detail] { cursor: pointer; }
@media (hover: hover) {
  .station[data-station-detail]:hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
}
.station-brand { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--brand); }
.station-brand .ic { width: 14px; height: 14px; }
.station-actions .chip .ic:last-child:not(:first-child) { width: 14px; height: 14px; margin: 0 -2px 0 2px; }

.detail-hero.is-art[data-kind="station"] { --art: var(--brand); }
.d-kind .d-kind-station { color: var(--brand); }
.d-stat.is-station { --lvl: var(--brand); --fill: var(--brand-soft); }
.d-stat.is-station.is-dc { --lvl: var(--good); --fill: color-mix(in srgb, var(--good-fill) 30%, var(--surface)); }
.d-stat.is-station .d-stat-top { flex-wrap: wrap; align-items: center; }
.d-stat.is-station .status-pill { color: var(--ink); }
.d-stat.is-station .station-tags { margin-top: 12px; }
.d-station-notes { margin-top: 14px; }

/* ── Layers: which kinds of parking show ──────────────────── */

.layers-btn[aria-expanded="true"] { background: var(--brand); color: #fff; }

.layers-panel {
  position: fixed;
  z-index: 15; /* over the map, under the sheet and top bar */
  width: 240px;
  overflow-y: auto;
  padding: 10px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  color: var(--ink);
  font: 14px/1.3 var(--font);
}

.layers-title { margin: 0 10px 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }

.layers-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.layers-row:hover { background: var(--surface-2); }
.layers-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.layers-row .ic { width: 17px; height: 17px; color: var(--ink-2); }
.layers-row span { flex: 1; }
.layers-row small { color: var(--ink-3); font-variant-numeric: tabular-nums; }
