/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Match <meta name="color-scheme">: opts the page out of Chrome Android's
     "Force dark on web contents" auto-darkening so legend swatches keep
     their literal hex values (see WindColors.arrowKmh). */
  color-scheme: dark;
  --bg-deep:   #0a0f1e;
  --bg-dark:   #0f172a;
  --bg-mid:    #1e293b;
  --bg-light:  #273549;
  --border:    rgba(255,255,255,0.08);
  --border-hi: rgba(255,255,255,0.15);
  --text-1:    #f1f5f9;
  --text-2:    #94a3b8;
  --text-3:    #64748b;
  --accent:    #f97316;
  --accent-hi: #fb923c;
  /* Windgram bottom panel height (overridable by drag-resize; stored in localStorage as windgramPanelHeightPx). Desktop default ~3/4 viewport; first drag persists user height. */
  --windgram-h: min(75vh, calc(100vh - 48px));
  /* Skew-T panel (same pattern; key skewtPanelHeightPx). */
  --skewt-h: min(44vh, 520px);
  /* Spit live + ML forecast bottom panel (drag resize; spitPopupPanelHeightPx). */
  --spit-popup-h: min(44vh, 520px);
  /* XContest live filter bar (fixed height; includes in-view pilot list). */
  --xcontest-live-panel-h: 118px;
  --map-fab-inset: max(12px, env(safe-area-inset-bottom, 0px));
  --toolbar-h: 52px;
  /** Top offset for stacked map strips: 0 on narrow viewports (toolbar docks bottom); equals toolbar height only when overridden; 0 when the toolbar is a left rail (desktop ≥901px). */
  --toolbar-stack-base: 0px;
  /** Horizontal space reserved for the toolbar; map + top strips start to the right (0 on mobile). */
  --toolbar-side-w: 0px;
  /** OpenAIP class toggle strip under the main toolbar (0 when Airspace is off). Set in JS when visible. */
  --airspace-subbar-h: 0px;
  /** Height of map overlay time strip (Wind Map = time + altitude rows; Thermal Map only = time row). */
  --spatial-wind-time-bar-h: 96px;
  /** When only Thermal Map is on (`body.map-wind-time-bar-no-wind`). */
  --spatial-wind-time-bar-h-compact: 56px;
  /** Measured Hike+Fly strip height when visible (see app.js); 0 when mode off. */
  --hike-fly-bar-h: 0px;
  /** Smoke Map → FireSmoke strip under toolbar (`body.fires-smoke-bar-open`); 0 when off. */
  --fires-smoke-bar-h: 0px;
  --radius:    10px;
}

body.fires-smoke-bar-open {
  --fires-smoke-bar-h: 96px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text-1);
}

button { cursor: pointer; font-family: inherit; }
input  { font-family: inherit; }
a      { color: var(--accent); }

/* ===== MAP CONTAINER ===== */
#map-container {
  position: absolute;
  inset: 0;
}

/**
 * Wind canvases are moved into `#map-container` in `MapManager#_reparentWindOverlayCanvases`
 * so HTML markers stay above transparent arrow/thermal layers. Controls stay on top for clicks.
 */
#map-container .maplibregl-marker {
  z-index: 10;
}
/** Popups must stack above DOM markers (`z-index: 10`); controls remain on top (`30`). */
#map-container .maplibregl-popup {
  z-index: 25;
}
#map-container .maplibregl-control-container {
  z-index: 30;
}

/* BC wildfire centroid markers — DOM Marker (above transparent wind canvases like takeoff pins). */
.pg-bc-wildfire-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  filter:
    drop-shadow(0 0 3px rgba(255, 255, 255, 0.92))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}
.pg-bc-wildfire-marker:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pg-bc-wildfire-marker__glyph {
  font-size: 26px;
  line-height: 1;
}

/* BC wildfire perimeter popup (MapLibre Popup) */
.pg-bc-wildfire-popup-wrap .maplibregl-popup-content {
  padding: 12px 14px;
  font: 13px/1.4 Inter, system-ui, sans-serif;
  color: #e8ecf4;
  background: rgba(10, 15, 30, 0.96);
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.pg-bc-wildfire-popup-wrap .maplibregl-popup-close-button {
  color: #94a3b8;
  font-size: 20px;
  padding: 4px 8px;
  width: auto;
  height: auto;
}
.pg-bc-wildfire-popup-wrap .maplibregl-popup-close-button:hover {
  color: #f97316;
  background: transparent;
}
.pg-bc-wildfire-popup__title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 8px;
  color: #f8fafc;
}
.pg-bc-wildfire-popup__row {
  font-size: 12px;
  color: #cbd5e1;
  margin: 0 0 6px;
  line-height: 1.35;
}
.pg-bc-wildfire-popup__row strong {
  color: #94a3b8;
  font-weight: 600;
  margin-right: 6px;
}
.pg-bc-wildfire-popup__link {
  display: inline-block;
  margin-top: 10px;
  font-weight: 600;
  font-size: 12px;
  color: #fb923c;
  text-decoration: none;
}
.pg-bc-wildfire-popup__link:hover {
  text-decoration: underline;
  color: #fdba74;
}

/* XContest live pilot / track popup */
.pg-xcontest-popup-wrap .maplibregl-popup-content {
  padding: 12px 14px;
  font: 13px/1.4 Inter, system-ui, sans-serif;
  color: #e8ecf4;
  background: rgba(10, 15, 30, 0.96);
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.pg-xcontest-popup-wrap .maplibregl-popup-close-button {
  color: #94a3b8;
  font-size: 20px;
  padding: 4px 8px;
  width: auto;
  height: auto;
}
.pg-xcontest-popup-wrap .maplibregl-popup-close-button:hover {
  color: #34f0a8;
  background: transparent;
}
.pg-xcontest-popup__title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 8px;
  color: #f8fafc;
}
.pg-xcontest-popup__row {
  font-size: 12px;
  color: #cbd5e1;
  margin: 0 0 6px;
  line-height: 1.35;
}
.pg-xcontest-popup__row strong {
  color: #94a3b8;
  font-weight: 600;
  margin-right: 6px;
}
.pg-xcontest-popup__link {
  display: inline-block;
  margin-top: 0;
  font-weight: 600;
  font-size: 12px;
  color: #34f0a8;
  text-decoration: none;
}
.pg-xcontest-popup__link--primary {
  font-weight: 700;
  font-size: 13px;
}
.pg-xcontest-popup__link:hover {
  text-decoration: underline;
  color: #6af5c0;
}
.pg-xcontest-popup__section {
  margin-top: 12px;
}
.pg-xcontest-popup__section:first-of-type {
  margin-top: 4px;
}
.pg-xcontest-popup__hint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: #94a3b8;
}
.pg-xcontest-popup__hint a {
  color: #7dd3fc;
  text-decoration: none;
}
.pg-xcontest-popup__hint a:hover {
  text-decoration: underline;
}
.pg-xcontest-popup__muted {
  margin-top: 0;
  font-size: 11px;
  line-height: 1.35;
  color: #94a3b8;
}

/* XContest 3D pilots — projected text (MapLibre symbols stay draped when tracks use custom 3D). */
.pg-xcontest-pilot-labels-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}
.pg-xcontest-pilot-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 12px));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(184px, 36vw);
  font: 600 11px/1.25 Inter, system-ui, sans-serif;
  color: #e8eef8;
  text-shadow:
    0 0 3px rgba(10, 15, 30, 0.95),
    0 1px 6px rgba(10, 15, 30, 0.88),
    0 -1px 2px rgba(10, 15, 30, 0.9);
}
.pg-xcontest-pilot-label[data-status='live'] {
  color: #6af5c0;
}
.pg-xcontest-pilot-label[data-status='landed'] {
  color: #93c5fd;
}
.pg-xcontest-pilot-label[data-status='lost'] {
  color: #cbd5e1;
}

/** NAV CANADA CAR/fire NOTAM popup (reuse wildfire typography) */
.pg-bc-fire-notam-popup-wrap .maplibregl-popup-content {
  padding: 12px 14px;
  font: 13px/1.4 Inter, system-ui, sans-serif;
  color: #e8ecf4;
  background: rgba(10, 15, 30, 0.96);
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.pg-bc-fire-notam-popup-wrap .maplibregl-popup-close-button {
  color: #c4b5fd;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 10px;
  width: auto;
  height: auto;
}
.pg-bc-fire-notam-popup-wrap .maplibregl-popup-close-button:hover {
  color: #f5eafc;
  background: rgba(168, 85, 247, 0.2);
}

.pg-bc-fire-notam-popup__link:hover {
  color: #e9d5ff;
}
.pg-bc-fire-notam-popup__excerpt-label {
  font-size: 11px;
  font-weight: 600;
  color: #c084fc;
  margin: 8px 0 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.pg-bc-fire-notam-popup__raw {
  margin: 0 0 8px;
  padding: 8px 10px;
  max-height: min(52vh, 420px);
  overflow: auto;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.pg-bc-fire-notam-popup__cfps-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.55);
  border-radius: 6px;
  color: #f5eafc;
  font: 600 12px/1.3 Inter, system-ui, sans-serif;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pg-bc-fire-notam-popup__cfps-btn:hover,
.pg-bc-fire-notam-popup__cfps-btn:focus-visible {
  background: rgba(168, 85, 247, 0.28);
  border-color: rgba(196, 181, 253, 0.85);
  outline: none;
}
.pg-bc-fire-notam-popup__cfps-btn--done {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(74, 222, 128, 0.7);
  color: #ecfdf5;
}
.pg-bc-fire-notam-popup__cfps-hint {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.42;
  color: #cbd5e1;
  opacity: 0.92;
}
.pg-bc-fire-notam-popup__cfps-hint strong {
  color: #e8ecf4;
  font-weight: 600;
}

/**
 * NAV CANADA NOTAM popup: fixed centred pane (tall copy + map-anchored positioning clips off-screen otherwise).
 * Whole card scrolls inside #map-container stacking context.
 */
#map-container .pg-bc-fire-notam-popup-wrap.maplibregl-popup.pg-bc-fire-notam-popup-wrap--fixed-pane {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  bottom: auto !important;
  right: auto !important;
  transform: translate(-50%, -50%) !important;
  max-width: min(560px, calc(100vw - 48px)) !important;
  width: min(560px, calc(100vw - 48px)) !important;
  max-height: min(88vh, calc(100dvh - 48px)) !important;
  margin: 0 !important;
  z-index: 60 !important;
  box-sizing: border-box;
}

#map-container
  .pg-bc-fire-notam-popup-wrap.maplibregl-popup.pg-bc-fire-notam-popup-wrap--fixed-pane
  .maplibregl-popup-tip {
  display: none !important;
}

#map-container
  .pg-bc-fire-notam-popup-wrap.maplibregl-popup.pg-bc-fire-notam-popup-wrap--fixed-pane
  .maplibregl-popup-content {
  display: flex;
  flex-direction: column;
  max-height: min(82vh, calc(100dvh - 92px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  width: 100%;
  box-sizing: border-box;
  padding-right: 10px;
  padding-top: max(44px, 12px); /* clear close × */
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

#map-container
  .pg-bc-fire-notam-popup-wrap.maplibregl-popup.pg-bc-fire-notam-popup-wrap--fixed-pane
  .maplibregl-popup-close-button {
  padding: 10px 12px;
  min-width: 44px;
  min-height: 44px;
  font-size: 19px;
}

.pg-bc-fire-notam-popup-wrap--fixed-pane .pg-bc-fire-notam-popup__raw {
  flex: 0 1 auto;
  min-height: 0;
  max-height: none;
}

@media (max-width: 720px) {
  #map-container .pg-bc-fire-notam-popup-wrap.maplibregl-popup.pg-bc-fire-notam-popup-wrap--fixed-pane {
    max-width: calc(100vw - 24px) !important;
    width: calc(100vw - 24px) !important;
  }

  #map-container
    .pg-bc-fire-notam-popup-wrap.maplibregl-popup.pg-bc-fire-notam-popup-wrap--fixed-pane
    .maplibregl-popup-content {
    max-height: min(82vh, calc(100dvh - 36px));
  }
}

/**
 * Hike+Fly launch pick: pass clicks through site/wind markers (icons use pointer-events: auto).
 * MapLibre fires `click` with the ground position under the cursor.
 */
body.hike-fly-picking .maplibregl-marker,
body.hike-fly-picking .maplibregl-marker * {
  pointer-events: none !important;
}

body.map-ruler-picking .maplibregl-marker,
body.map-ruler-picking .maplibregl-marker * {
  pointer-events: none !important;
}

/** Completed ruler label (×) must stay clickable while a new measure is in progress. */
body.map-ruler-picking .maplibregl-marker .map-ruler-label-wrap,
body.map-ruler-picking .maplibregl-marker .map-ruler-label-wrap * {
  pointer-events: auto !important;
}

.map-ruler-endpoint {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.map-ruler-label {
  padding: 4px 8px;
  border-radius: 6px;
  font: 600 12px Inter, system-ui, sans-serif;
  color: var(--bg-deep);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(10, 15, 30, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  white-space: nowrap;
}

.map-ruler-label--preview {
  opacity: 0.94;
}

.map-ruler-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 6px;
  font: 600 12px Inter, system-ui, sans-serif;
  color: var(--bg-deep);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(10, 15, 30, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

.map-ruler-label-text {
  white-space: nowrap;
}

.map-ruler-dismiss {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: -2px -4px -2px 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  font: 700 16px/1 Inter, system-ui, sans-serif;
  color: var(--text-3);
  background: transparent;
  cursor: pointer;
}

.map-ruler-dismiss:hover {
  color: var(--bg-deep);
  background: rgba(10, 15, 30, 0.08);
}

.map-ruler-dismiss:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ===== WIND OVERLAY ===== */
/* Flow/particle trails layer — below arrows, above the map, below all UI chrome */
#wind-flow-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
}
/* Arrow + thermal overlay — above flow, below toolbar (z-index: 20) and all UI */
#wind-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/** Bottom-left: fly map to GPS position (above bottom sheets when open). */
.map-locate-btn {
  position: fixed;
  z-index: 16;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.82);
  backdrop-filter: blur(12px) saturate(1.2);
  color: var(--text-2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.map-locate-btn:hover {
  color: var(--accent);
  border-color: var(--border-hi);
  background: var(--bg-mid);
}
.map-locate-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.map-locate-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}
body:has(#windgram-panel:not(.panel-hidden)) .map-locate-btn {
  bottom: calc(var(--windgram-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#windgram-panel:not(.panel-hidden)):has(#xcontest-live-panel:not(.panel-hidden)) .map-locate-btn {
  bottom: calc(var(--windgram-h) + var(--xcontest-live-panel-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#xcontest-live-panel:not(.panel-hidden)) .map-locate-btn {
  bottom: calc(var(--xcontest-live-panel-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#skewt-panel:not(.panel-hidden)) .map-locate-btn {
  bottom: calc(var(--skewt-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#spit-popup-panel:not(.panel-hidden)) .map-locate-btn {
  bottom: calc(var(--spit-popup-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}

/** Same row as locate, to its right — only visible when map bearing ≠ north-up. */
.map-reset-north-btn {
  position: fixed;
  z-index: 16;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: calc(max(12px, env(safe-area-inset-left, 0px)) + 42px + 8px);
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.82);
  backdrop-filter: blur(12px) saturate(1.2);
  color: var(--text-2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
/* `display: flex` above beats the UA `[hidden]` rule — force hide when JS sets `hidden`. */
.map-reset-north-btn[hidden] {
  display: none !important;
}
.map-reset-north-btn:hover {
  color: var(--accent);
  border-color: var(--border-hi);
  background: var(--bg-mid);
}
.map-reset-north-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
body:has(#windgram-panel:not(.panel-hidden)) .map-reset-north-btn {
  bottom: calc(var(--windgram-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#windgram-panel:not(.panel-hidden)):has(#xcontest-live-panel:not(.panel-hidden)) .map-reset-north-btn {
  bottom: calc(var(--windgram-h) + var(--xcontest-live-panel-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#xcontest-live-panel:not(.panel-hidden)) .map-reset-north-btn {
  bottom: calc(var(--xcontest-live-panel-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#skewt-panel:not(.panel-hidden)) .map-reset-north-btn {
  bottom: calc(var(--skewt-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#spit-popup-panel:not(.panel-hidden)) .map-reset-north-btn {
  bottom: calc(var(--spit-popup-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}

/* Paraglide game HUD: stacked above locate (same bottom offsets when panels open). */
.paraglide-game-hud {
  position: fixed;
  z-index: 16;
  left: max(12px, env(safe-area-inset-left, 0px));
  bottom: calc(58px + max(12px, env(safe-area-inset-bottom, 0px)));
  min-width: 9.5rem;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.88);
  backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  pointer-events: none;
}
.paraglide-game-hud__title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.paraglide-game-hud__actions {
  pointer-events: auto;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.paraglide-game-hud__speedbar {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.95);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.paraglide-game-hud__speedbar:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.98);
}
.paraglide-game-hud__speedbar:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.paraglide-game-hud__speedbar[aria-pressed="true"] {
  border-color: rgba(56, 189, 248, 0.75);
  background: rgba(14, 165, 233, 0.18);
  color: #7dd3fc;
}
.paraglide-game-hud__big-ears {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.95);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.paraglide-game-hud__big-ears:hover:not(:disabled) {
  background: rgba(51, 65, 85, 0.98);
}
.paraglide-game-hud__big-ears:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.paraglide-game-hud__big-ears[aria-pressed="true"] {
  border-color: rgba(249, 115, 22, 0.75);
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
}
.paraglide-game-hud__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.35;
}
.paraglide-game-hud__row--wind .paraglide-game-hud__wind-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.paraglide-game-hud__wind-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: #7dd3fc;
  transform-origin: 50% 50%;
  transition: opacity 0.12s ease, transform 0.15s ease;
}
.paraglide-game-hud__wind-arrow svg {
  display: block;
}
.paraglide-game-hud__wind-arrow--calm {
  opacity: 0.38;
}
.paraglide-game-hud__k {
  color: var(--text-3);
}
.paraglide-game-hud__v {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
body:has(#windgram-panel:not(.panel-hidden)) .paraglide-game-hud {
  bottom: calc(58px + var(--windgram-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#windgram-panel:not(.panel-hidden)):has(#xcontest-live-panel:not(.panel-hidden)) .paraglide-game-hud {
  bottom: calc(58px + var(--windgram-h) + var(--xcontest-live-panel-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#xcontest-live-panel:not(.panel-hidden)) .paraglide-game-hud {
  bottom: calc(58px + var(--xcontest-live-panel-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#skewt-panel:not(.panel-hidden)) .paraglide-game-hud {
  bottom: calc(58px + var(--skewt-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}
body:has(#spit-popup-panel:not(.panel-hidden)) .paraglide-game-hud {
  bottom: calc(58px + var(--spit-popup-h) + max(12px, env(safe-area-inset-bottom, 0px)));
}

/* Paraglide game: crash marker (stays until exit or new flight). */
.paraglide-game-crash {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

/* Nadir ground shadow under glider (separate marker); glider icon is lifted in screen px by AGL. */
.paraglide-game-ground-shadow {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.paraglide-game-ground-shadow svg {
  filter: blur(2px);
}

.paraglide-game-glider {
  pointer-events: none;
}

.paraglide-game-ground-shadow__body {
  will-change: transform;
}

/* Map wind: session counter (each chunk request to Open-Meteo) */
.spatial-wind-api-counter-wrap {
  position: absolute;
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--hike-fly-bar-h) + 10px);
  left: 12px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: max-content;
  max-width: min(440px, calc(100vw - 24px));
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(10, 15, 30, 0.78);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.spatial-wind-api-counter-wrap__om-row {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

body.map-wind-time-open .spatial-wind-api-counter-wrap {
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--spatial-wind-time-bar-h) + var(--hike-fly-bar-h) + 10px);
}

body.fires-smoke-bar-open .spatial-wind-api-counter-wrap {
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--fires-smoke-bar-h) + var(--hike-fly-bar-h) + 10px);
}

body.map-wind-time-open.fires-smoke-bar-open .spatial-wind-api-counter-wrap {
  top: calc(
    var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--spatial-wind-time-bar-h) + var(--fires-smoke-bar-h) +
      var(--hike-fly-bar-h) + 10px
  );
}

/** Wind + rain legends: below map-wind time strip when open; below firesmoke / Hike+Fly when set. */
body.map-wind-time-open .map-side-legends {
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--spatial-wind-time-bar-h) + var(--hike-fly-bar-h) + 12px);
}

body.fires-smoke-bar-open .map-side-legends {
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--fires-smoke-bar-h) + var(--hike-fly-bar-h) + 12px);
}

body.map-wind-time-open.fires-smoke-bar-open .map-side-legends {
  top: calc(
    var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--spatial-wind-time-bar-h) + var(--fires-smoke-bar-h) +
      var(--hike-fly-bar-h) + 12px
  );
}

.spatial-wind-api-counter-wrap[hidden] {
  display: none !important;
}

.spatial-wind-api-counter-wrap__label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: var(--text-3);
}

.spatial-wind-api-counter-wrap__meter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.spatial-wind-api-counter-wrap__sep {
  margin: 0 2px;
  color: var(--text-3);
  user-select: none;
}

.spatial-wind-api-counter-wrap__suffix {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.spatial-wind-api-counter-wrap__emoji {
  font-size: 14px;
  line-height: 1;
}

.spatial-wind-api-counter-wrap__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-hi);
}

.spatial-wind-api-counter-wrap__wu-line,
.spatial-wind-api-counter-wrap__zoom-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
  padding-top: 3px;
  margin-top: 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.spatial-wind-api-counter-wrap__wu-line__vals {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
}

.spatial-wind-api-counter-wrap__zoom-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

/* ===== MAIN TOOLBAR (bottom bar ≤900px; top strip + left rail on wider screens) ===== */
#toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: rgba(10, 15, 30, 0.82);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

#toolbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.openaip-airspace-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-map-extras {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kk7-thermal-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kk7-thermal-toolbar__toggles {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Airspace class filter: second row fixed under main toolbar (shown only when Airspace is on) ── */
#airspace-class-toolbar.airspace-class-toolbar {
  position: fixed;
  top: var(--toolbar-stack-base);
  left: var(--toolbar-side-w);
  right: 0;
  z-index: 19;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(10, 15, 30, 0.88);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

#airspace-class-toolbar[hidden] {
  display: none !important;
}

.airspace-class-toolbar__toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.airspace-class-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin: 0;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
  opacity: 0.55;
}

.airspace-class-btn[aria-pressed='true'] {
  opacity: 1;
  color: var(--text-1);
}

.airspace-class-btn:hover {
  opacity: 1;
  color: var(--text-1);
}

.airspace-class-btn:focus { outline: none; }
.airspace-class-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.airspace-class-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.airspace-swatch--e   { background: #d4c800; }
.airspace-swatch--f   { background: #c9a00a; }
.airspace-swatch--b   { background: #be185d; }
.airspace-swatch--cd  { background: #3d7ed8; }
.airspace-swatch--rdp { background: #c92672; }

/* Active (pressed) border matches swatch colour */
.airspace-class-btn[data-airspace-group='classe'][aria-pressed='true']    { border-color: #d4c800; }
.airspace-class-btn[data-airspace-group='classf'][aria-pressed='true']    { border-color: #c9a00a; }
.airspace-class-btn[data-airspace-group='classb'][aria-pressed='true']    { border-color: #e11d48; }
.airspace-class-btn[data-airspace-group='terminalcd'][aria-pressed='true'] { border-color: #3d7ed8; }
.airspace-class-btn[data-airspace-group='hazard'][aria-pressed='true']    { border-color: #c92672; }


.model-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-toggle-wrap__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Mobile: `index.html` swaps to the short "MODEL" label (see @media max-width: 900px). */
.model-toggle-wrap__label-short {
  display: none;
}

/* Model resolution toggle in windgram / Skew-T headers (moved off main toolbar) */
.model-toggle-wrap--panel {
  gap: 8px;
}
.model-toggle-wrap--panel .model-toggle-wrap__label {
  font-size: 10px;
  letter-spacing: 0.04em;
}
.model-toggle-wrap--panel .basemap-toggle__btn {
  padding: 5px 10px;
  font-size: 11px;
  min-height: 28px;
}

.skewt-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  max-width: min(100%, 420px);
}

.toolbar-label-short {
  display: none;
}

.historical-weather-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.historical-weather-toolbar__btn {
  flex-shrink: 0;
  margin: 0;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.historical-weather-toolbar__btn:hover:not(:disabled) {
  border-color: rgba(249, 115, 22, 0.45);
  color: var(--accent);
}
.historical-weather-toolbar__btn[aria-pressed='true'] {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent);
}
.historical-weather-toolbar__btn:focus {
  outline: none;
}
.historical-weather-toolbar__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.historical-weather-toolbar__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.historical-weather-toolbar__extra {
  display: flex;
  align-items: center;
  gap: 6px;
}
/* Author `display: flex` would otherwise defeat the HTML `hidden` attribute. */
.historical-weather-toolbar__extra[hidden] {
  display: none !important;
}
.historical-weather-toolbar__field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.historical-weather-toolbar__date {
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: 8px;
  outline: none;
  max-width: 9.5rem;
}
.historical-weather-toolbar__date:focus {
  border-color: var(--accent);
}

.historical-weather-toolbar--panel {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(100%, 280px);
}
.historical-weather-toolbar--panel .historical-weather-toolbar__btn {
  padding: 5px 10px;
  font-size: 11px;
}
.historical-weather-toolbar--panel .historical-weather-toolbar__field {
  font-size: 10px;
}
.historical-weather-toolbar--panel .historical-weather-toolbar__date {
  font-size: 11px;
  padding: 4px 6px;
  max-width: 8.5rem;
}

/* Basemap: topo (OpenTopoMap) vs satellite (Esri World Imagery) */
.basemap-toggle {
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.basemap-toggle__btn {
  margin: 0;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--bg-mid);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.basemap-toggle__btn + .basemap-toggle__btn {
  border-left: 1px solid var(--border);
}
.basemap-toggle__btn:hover {
  color: var(--text-1);
  background: rgba(15, 23, 42, 0.95);
}
.basemap-toggle__btn.active {
  color: var(--accent);
  background: rgba(249, 115, 22, 0.12);
}

/* Mobile-only single control (see @media max-width: 900px); hidden on desktop. */
#basemap-cycle {
  display: none;
}

#spatial-wind-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Wind Map + Thermal Map (same chrome as Windgram); KK7 + OpenAIP + map extras match */
#spatial-wind-controls .spatial-wind-toggle,
.toolbar-map-extras .spatial-wind-toggle,
.kk7-thermal-toolbar .spatial-wind-toggle,
#openaip-airspace-wrap .spatial-wind-toggle {
  flex-shrink: 0;
  margin: 0;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

#spatial-wind-controls .spatial-wind-toggle:hover,
.toolbar-map-extras .spatial-wind-toggle:hover,
.kk7-thermal-toolbar .spatial-wind-toggle:hover,
#openaip-airspace-wrap .spatial-wind-toggle:hover {
  border-color: rgba(249, 115, 22, 0.45);
  color: var(--accent);
}

#spatial-wind-controls .spatial-wind-toggle[aria-pressed='true'],
.toolbar-map-extras .spatial-wind-toggle[aria-pressed='true'],
.kk7-thermal-toolbar .spatial-wind-toggle[aria-pressed='true'],
#openaip-airspace-wrap .spatial-wind-toggle[aria-pressed='true'] {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent);
}

#spatial-wind-controls .spatial-wind-toggle:focus,
.toolbar-map-extras .spatial-wind-toggle:focus,
.kk7-thermal-toolbar .spatial-wind-toggle:focus,
#openaip-airspace-wrap .spatial-wind-toggle:focus {
  outline: none;
}

#spatial-wind-controls .spatial-wind-toggle:focus-visible,
.toolbar-map-extras .spatial-wind-toggle:focus-visible,
.kk7-thermal-toolbar .spatial-wind-toggle:focus-visible,
#openaip-airspace-wrap .spatial-wind-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/** Wind Map time + altitude sliders — strip under the toolbar when overlay time UI is on */
.spatial-wind-time-bar {
  position: absolute;
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h));
  left: 0;
  right: 0;
  z-index: 19;
  box-sizing: border-box;
  height: var(--spatial-wind-time-bar-h);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(10, 15, 30, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(1.2);
}
.spatial-wind-time-bar__rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.spatial-wind-time-bar__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 0;
}
.spatial-wind-time-bar[hidden] {
  display: none !important;
}

/** Altitude slider exists only for Wind Map; keep it out of layout when hidden. */
.spatial-wind-time-bar__row[hidden] {
  display: none !important;
}

body.map-wind-time-bar-no-wind {
  --spatial-wind-time-bar-h: var(--spatial-wind-time-bar-h-compact);
}
.spatial-wind-time-bar__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  flex-shrink: 0;
}
.spatial-wind-time-bar__slider-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 64px;
  justify-content: center;
}
.spatial-wind-time-bar__slider {
  width: 100%;
  height: 6px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.spatial-wind-time-bar__slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.spatial-wind-time-bar__ticks {
  position: relative;
  width: 100%;
  height: 22px;
  margin-top: 2px;
  padding: 0 10px;
  box-sizing: border-box;
  pointer-events: none;
}

.spatial-wind-time-bar__ticks--altitude {
  height: 18px;
}
.spatial-wind-time-bar__tick {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--text-3);
  white-space: nowrap;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spatial-wind-time-bar__tick::before {
  content: '';
  display: block;
  width: 1px;
  height: 4px;
  background: var(--border-hi);
  margin: 0 auto 3px;
}
/** Hourly mark without text — one per forecast step */
.spatial-wind-time-bar__tick--minor {
  font-size: 0;
  line-height: 0;
  color: transparent;
  max-width: none;
}
.spatial-wind-time-bar__tick--minor::before {
  height: 5px;
  margin-bottom: 0;
  opacity: 0.5;
}
.spatial-wind-time-bar__ticks--hourly .spatial-wind-time-bar__tick:not(.spatial-wind-time-bar__tick--minor) {
  font-size: 8px;
  max-width: 44px;
}
.spatial-wind-time-bar__ticks--dense .spatial-wind-time-bar__tick--minor::before {
  height: 4px;
  opacity: 0.42;
}
.spatial-wind-time-bar__ticks--dense .spatial-wind-time-bar__tick:not(.spatial-wind-time-bar__tick--minor) {
  font-size: 7px;
  max-width: 40px;
}
.spatial-wind-time-bar__value {
  flex-shrink: 0;
  min-width: 132px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Hike+Fly: glide slider under toolbar (below Wind Map time strip when open) */
.hike-fly-bar {
  position: absolute;
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h));
  left: 0;
  right: 0;
  z-index: 18;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px;
  background: rgba(10, 15, 30, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(1.2);
}
.hike-fly-bar__body {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.hike-fly-bar__controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex: 1 1 0;
  min-width: 0;
}
.hike-fly-bar__controls > .hike-fly-bar__row {
  flex: 1 1 0;
  min-width: 0;
}
body.map-wind-time-open .hike-fly-bar {
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--spatial-wind-time-bar-h));
}

body.fires-smoke-bar-open .hike-fly-bar {
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--fires-smoke-bar-h));
}

body.map-wind-time-open.fires-smoke-bar-open .hike-fly-bar {
  top: calc(
    var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--spatial-wind-time-bar-h) + var(--fires-smoke-bar-h)
  );
}
.hike-fly-bar[hidden] {
  display: none !important;
}

/** Fires → FireSmoke.ca hourly PM2.5 — under toolbar (below Wind Map time strip when open) */
.fires-smoke-bar {
  position: absolute;
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h));
  left: 0;
  right: 0;
  z-index: 19;
  box-sizing: border-box;
  height: var(--fires-smoke-bar-h);
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  padding: 6px 16px 8px;
  background: rgba(10, 15, 30, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(1.2);
}
body.map-wind-time-open .fires-smoke-bar {
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--spatial-wind-time-bar-h));
}
.fires-smoke-bar[hidden] {
  display: none !important;
}
.fires-smoke-bar__row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.fires-smoke-bar__slider-label {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.fires-smoke-bar__slider-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 64px;
  justify-content: center;
}
.fires-smoke-bar__slider {
  width: 100%;
  height: 6px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.fires-smoke-bar__slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.fires-smoke-bar__ticks {
  position: relative;
  width: 100%;
  height: 22px;
  margin-top: 2px;
  padding: 0 10px;
  box-sizing: border-box;
  pointer-events: none;
}
.fires-smoke-bar__tick {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--text-3);
  white-space: nowrap;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fires-smoke-bar__tick::before {
  content: '';
  display: block;
  width: 1px;
  height: 4px;
  background: var(--border-hi);
  margin: 0 auto 3px;
}
/** Hourly mark without text — one per forecast step */
.fires-smoke-bar__tick--minor {
  font-size: 0;
  line-height: 0;
  color: transparent;
  max-width: none;
}
.fires-smoke-bar__tick--minor::before {
  height: 5px;
  margin-bottom: 0;
  opacity: 0.5;
}
.fires-smoke-bar__ticks--hourly .fires-smoke-bar__tick:not(.fires-smoke-bar__tick--minor) {
  font-size: 8px;
  max-width: 44px;
}
.fires-smoke-bar__ticks--dense .fires-smoke-bar__tick--minor::before {
  height: 4px;
  opacity: 0.42;
}
.fires-smoke-bar__ticks--dense .fires-smoke-bar__tick:not(.fires-smoke-bar__tick--minor) {
  font-size: 7px;
  max-width: 40px;
}
.fires-smoke-bar__value {
  flex-shrink: 0;
  min-width: 148px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fires-smoke-bar__credit {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  line-height: 1.35;
}
.fires-smoke-bar__credit a {
  color: var(--accent);
}

.hike-fly-bar__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.hike-fly-bar__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  flex-shrink: 0;
}
.hike-fly-bar__slider {
  flex: 1;
  min-width: 64px;
  height: 6px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.hike-fly-bar__select {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-hi);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.hike-fly-bar__select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hike-fly-bar__value {
  flex-shrink: 0;
  min-width: 52px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-hi);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hike-fly-tooltip {
  position: fixed;
  z-index: 24;
  min-width: 120px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(15, 23, 42, 0.1);
  pointer-events: none;
}
.hike-fly-tooltip[hidden] {
  display: none !important;
}
.hike-fly-tooltip__line {
  font-variant-numeric: tabular-nums;
}

.hike-fly-start-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/** MapLibre marker: device GPS position from locate control. */
.map-user-location-marker {
  position: relative;
  width: 22px;
  height: 22px;
  pointer-events: none;
  --map-user-acc-px: 40px;
}
.map-user-location-marker__pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--map-user-acc-px);
  height: var(--map-user-acc-px);
  margin-left: calc(var(--map-user-acc-px) / -2);
  margin-top: calc(var(--map-user-acc-px) / -2);
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.22);
  border: 1px solid rgba(59, 130, 246, 0.45);
  animation: map-user-location-pulse 2s ease-out infinite;
  box-sizing: border-box;
}
.map-user-location-marker:not(.map-user-location-marker--has-accuracy) .map-user-location-marker__pulse {
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
}
.map-user-location-marker__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}
@keyframes map-user-location-pulse {
  0% {
    transform: scale(0.92);
    opacity: 0.95;
  }
  70% {
    transform: scale(1.08);
    opacity: 0.35;
  }
  100% {
    transform: scale(0.92);
    opacity: 0.95;
  }
}

#toolbar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.toolbar-about {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.toolbar-about:hover {
  color: var(--accent-hi);
  border-color: var(--border-hi);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.loading { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
/* No idle indicator in the toolbar once data is ready (map is the confirmation). */
.status-dot.ready {
  display: none;
}
.status-dot.error   { background: #ef4444; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

/* ===== WINDGRAM PANEL ===== */
#windgram-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: var(--windgram-h);
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 30, 0.96);
  backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border);
  z-index: 25;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#windgram-panel.panel-hidden {
  transform: translateY(var(--windgram-h));
}

/* ===== SPIT POPUP (live obs + ML forecast) ===== */
#spit-popup-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--spit-popup-h);
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 30, 0.96);
  backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border);
  z-index: 26;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#spit-popup-panel.panel-hidden {
  transform: translateY(var(--spit-popup-h));
}

/* ===== XCONTEST LIVE vario legend (bottom-right, above bottom sheets) ===== */
.xcontest-vario-legend {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: var(--map-fab-inset);
  left: auto;
  z-index: 24;
  padding: 8px 11px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.9);
  backdrop-filter: blur(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.xcontest-vario-legend.panel-hidden {
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
}
body:has(#xcontest-live-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
  bottom: calc(var(--xcontest-live-panel-h) + var(--map-fab-inset));
}
body:has(#windgram-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
  bottom: calc(var(--windgram-h) + var(--map-fab-inset));
}
body:has(#windgram-panel:not(.panel-hidden)):has(#xcontest-live-panel:not(.panel-hidden))
  .xcontest-vario-legend:not(.panel-hidden) {
  bottom: calc(var(--windgram-h) + var(--xcontest-live-panel-h) + var(--map-fab-inset));
}
body:has(#skewt-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
  bottom: calc(var(--skewt-h) + var(--map-fab-inset));
}
body:has(#spit-popup-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
  bottom: calc(var(--spit-popup-h) + var(--map-fab-inset));
}
.xcontest-vario-legend__title {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}
.xcontest-vario-legend__bar {
  width: 148px;
  height: 11px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    to right,
    #1d4ed8 0%,
    #60a5fa 22%,
    #94a3b8 50%,
    #86efac 78%,
    #16a34a 100%
  );
}
.xcontest-vario-legend__labels {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.xcontest-vario-legend__labels span:nth-child(1) {
  color: #93c5fd;
}
.xcontest-vario-legend__labels span:nth-child(3) {
  color: #86efac;
}

/* ===== XCONTEST LIVE (compact filter bar) ===== */
#xcontest-live-panel {
  position: absolute;
  bottom: 0;
  left: var(--toolbar-side-w);
  right: 0;
  height: var(--xcontest-live-panel-h);
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  /* Below windgram (25) so the filter bar never covers an open windgram. */
  z-index: 24;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#xcontest-live-panel.panel-hidden {
  transform: translateY(var(--xcontest-live-panel-h));
}
/* Sit on the map strip just above an open windgram instead of under it. */
body:has(#windgram-panel:not(.panel-hidden)) #xcontest-live-panel:not(.panel-hidden) {
  bottom: var(--windgram-h);
}
.xcontest-live-panel__bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 100%;
  min-width: 0;
  padding: 0;
}
.xcontest-live-panel__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px 8px 12px;
}
.xcontest-live-panel__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.xcontest-live-panel__lead {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.xcontest-live-panel__dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}
.xcontest-live-panel__dot--ok {
  background: #34f0a8;
  box-shadow: 0 0 6px rgba(52, 240, 168, 0.45);
}
.xcontest-live-panel__dot--warn {
  background: #fbbf24;
}
.xcontest-live-panel__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.xcontest-live-panel__sub {
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-3);
}
.xcontest-live-panel__toggles {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.xcontest-live-panel__toggle {
  padding: 7px 14px;
  min-height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font: 600 12px/1.2 Inter, system-ui, sans-serif;
  color: var(--text-3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.xcontest-live-panel__toggle:hover {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.05);
}
.xcontest-live-panel__toggle.active,
.xcontest-live-panel__toggle[aria-pressed='true'] {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.1);
}
.xcontest-live-panel__summary {
  margin: 0;
  padding-left: 17px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
  min-width: 0;
}
.xcontest-live-panel__ws-label {
  color: var(--text-2);
}
.xcontest-live-panel__ws-label--ok {
  color: #6ee7b7;
}
.xcontest-live-panel__ws-label--warn {
  color: #fcd34d;
}
.xcontest-live-panel__counts::before {
  content: ' · ';
  color: var(--text-3);
  opacity: 0.65;
}
.xcontest-live-panel__counts:empty::before {
  content: none;
}
.xcontest-live-panel__counts {
  font-variant-numeric: tabular-nums;
}
.xcontest-live-panel__pilots {
  flex-shrink: 0;
  width: 132px;
  max-width: 22vw;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 6px 8px 6px 10px;
  border-left: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}
.xcontest-live-panel__pilots-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}
.xcontest-live-panel__pilots-label {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.xcontest-live-panel__pilots-bulk {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
}
.xcontest-live-panel__bulk-btn {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  font: 600 8px/1.2 Inter, system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: var(--text-3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.xcontest-live-panel__bulk-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-2);
}
.xcontest-live-pilot-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.xcontest-live-pilot-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 3px 5px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  font: 500 10px/1.2 Inter, system-ui, sans-serif;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.xcontest-live-pilot-row:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-1);
}
.xcontest-live-pilot-row[aria-pressed='false'] {
  opacity: 0.42;
}
.xcontest-live-pilot-row[aria-pressed='false'] .xcontest-live-pilot-row__name {
  text-decoration: line-through;
  text-decoration-color: rgba(148, 163, 184, 0.55);
}
.xcontest-live-pilot-row__dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}
.xcontest-live-pilot-row__dot--live {
  background: #34f0a8;
}
.xcontest-live-pilot-row__dot--landed {
  background: #60a5fa;
}
.xcontest-live-pilot-row__dot--lost {
  background: #94a3b8;
}
.xcontest-live-pilot-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#spit-popup-resize-handle {
  flex-shrink: 0;
  height: 8px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
#spit-popup-resize-handle:hover {
  background: rgba(255, 255, 255, 0.06);
}
#spit-popup-resize-handle::after {
  content: '';
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--text-3);
  opacity: 0.35;
  pointer-events: none;
}
#spit-popup-resize-handle:hover::after {
  opacity: 0.65;
}
#spit-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.spit-popup-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
a.spit-popup-about-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1;
}
a.spit-popup-about-btn:hover {
  color: var(--text-1);
  border-color: var(--border-hi);
}
#spit-popup-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
  min-width: 0;
}
#spit-popup-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
#spit-popup-close:hover {
  color: var(--text-1);
  border-color: var(--border-hi);
}
#spit-popup-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#spit-popup-live-summary,
#spit-popup-forecast-meta {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}
.spit-popup-archive-note {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.45;
  margin: 0;
}
.spit-popup-archive-note a {
  color: var(--accent);
  font-weight: 600;
}
.spit-popup-archive-note a:hover {
  color: var(--accent-hi);
}
#spit-popup-charts {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.spit-popup-day-toggle {
  flex-shrink: 0;
  align-self: flex-start;
}
.spit-popup-day-toggle .basemap-toggle__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.spit-popup-chart-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
}
.spit-popup-chart-split {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}
#spit-popup-y-axis-canvas {
  display: none;
  flex-shrink: 0;
  width: 42px;
  align-self: stretch;
  height: auto;
  min-height: 130px;
  border-radius: 8px 0 0 8px;
  background: #0d1b2a;
  box-sizing: border-box;
}
.spit-popup-chart-scroll {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
}
#spit-popup-wind-canvas {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  height: 100%;
  max-height: none;
  border-radius: 8px;
  background: #0d1b2a;
  display: block;
}
@media (max-width: 900px) {
  #spit-popup-y-axis-canvas {
    display: block;
  }
  #spit-popup-wind-canvas {
    border-radius: 0 8px 8px 0;
  }
  .spit-popup-chart-scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
    scrollbar-color: var(--border-hi) transparent;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    touch-action: pan-x;
  }
  /* Horizontal bar styled like native scroll UX (similar to app scrollbars). */
  .spit-popup-chart-scroll::-webkit-scrollbar {
    height: 8px;
  }
  .spit-popup-chart-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
  }
  .spit-popup-chart-scroll::-webkit-scrollbar-thumb {
    background: var(--border-hi);
    border-radius: 4px;
  }
  .spit-popup-chart-scroll:focus-within {
    outline: none;
  }
  .spit-popup-chart-scroll #spit-popup-wind-canvas {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-height: 0;
    height: 100%;
    max-height: none;
  }
}
#spit-popup-external {
  font-size: 12px;
  color: var(--accent-hi);
  text-decoration: none;
  align-self: flex-start;
}
#spit-popup-external:hover {
  text-decoration: underline;
}

/* No-landing overlay: Notes use the same panel but forecast tabs / model controls are hidden. */
#windgram-panel.windgram-panel--notes-only #windgram-tabs {
  display: none;
}
#windgram-panel.windgram-panel--notes-only #windgram-actions .model-toggle-wrap,
#windgram-panel.windgram-panel--notes-only #windgram-actions .historical-weather-toolbar {
  display: none;
}

#windgram-resize-handle {
  flex-shrink: 0;
  height: 8px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
#windgram-resize-handle:hover {
  background: rgba(255, 255, 255, 0.06);
}
#windgram-resize-handle::after {
  content: '';
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--text-3);
  opacity: 0.35;
  pointer-events: none;
}
#windgram-resize-handle:hover::after {
  opacity: 0.65;
}

#windgram-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  position: relative;
  z-index: 30;
}

#windgram-title-area { min-width: 0; }

#windgram-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#windgram-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
  display: block;
}

/* Windgram tab strip */
#windgram-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.wg-thermals-with-help {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
}

.wg-tab-info-btn {
  flex-shrink: 0;
  width: 26px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 13px/1 'Inter', sans-serif;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-mid);
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.wg-tab-info-btn:hover,
.wg-tab-info-btn.active {
  color: var(--text-1);
  border-color: var(--border-hi);
  background: var(--bg-light);
}

.windgram-header-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(290px, calc(100vw - 32px));
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.45;
}
.windgram-header-popup.hidden { display: none; }

.wg-tab {
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wg-tab:hover {
  color: var(--text-2);
  border-color: var(--border-hi);
}
.wg-tab.active {
  background: rgba(249, 115, 22, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

#windgram-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  max-width: min(100%, 420px);
}

/* Chart hit target for horizontal swipe / drag (canvas is pointer-events: none). */
.windgram-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.windgram-chart-wrap.windgram-chart-wrap--dragging {
  cursor: grabbing;
}

/* Full-width time scrubber under the chart */
.windgram-time-scrubber {
  flex-shrink: 0;
  position: relative;
  display: block;
  padding: 0 16px max(4px, env(safe-area-inset-bottom, 0px)) 16px;
  border-top: 1px solid var(--border);
  background: rgba(8, 13, 26, 0.94);
}

#wg-time-slider,
.live-wind-graph-pan__slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  background: transparent;
  line-height: 0;
  --wg-track-h: 6px;
  --wg-thumb-h: 18px;
  --wg-thumb-w: 36px;
}

#wg-time-slider::-webkit-slider-runnable-track,
.live-wind-graph-pan__slider::-webkit-slider-runnable-track {
  height: var(--wg-track-h);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

#wg-time-slider::-webkit-slider-thumb,
.live-wind-graph-pan__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: var(--wg-thumb-w);
  height: var(--wg-thumb-h);
  margin-top: calc((var(--wg-track-h) - var(--wg-thumb-h)) / 2);
  border-radius: 5px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

#wg-time-slider:hover::-webkit-slider-thumb,
.live-wind-graph-pan__slider:hover::-webkit-slider-thumb {
  filter: brightness(1.08);
}

#wg-time-slider::-moz-range-track,
.live-wind-graph-pan__slider::-moz-range-track {
  height: var(--wg-track-h);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

#wg-time-slider::-moz-range-thumb,
.live-wind-graph-pan__slider::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--wg-thumb-w);
  height: var(--wg-thumb-h);
  border-radius: 5px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

#wg-time-slider::-moz-focus-outer,
.live-wind-graph-pan__slider::-moz-focus-outer {
  border: 0;
}

#wg-time-slider:focus,
.live-wind-graph-pan__slider:focus {
  outline: none;
}

#wg-time-slider:focus-visible,
.live-wind-graph-pan__slider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#wg-time-slider:disabled,
.live-wind-graph-pan__slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#wg-time-slider:disabled::-webkit-slider-thumb,
.live-wind-graph-pan__slider:disabled::-webkit-slider-thumb {
  filter: grayscale(0.35);
}

.windgram-body--notes .windgram-chart-wrap,
.windgram-body--notes .windgram-time-scrubber {
  display: none;
}

#close-windgram {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  width: 28px; height: 28px;
  border-radius: 6px;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
#close-windgram:hover { color: var(--text-1); border-color: var(--border-hi); }

.windgram-share-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.windgram-share-btn:hover { color: var(--text-1); border-color: var(--border-hi); }
.windgram-share-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
#windgram-panel.windgram-panel--notes-only .windgram-share-wrap { display: none; }
.windgram-share-toast {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  bottom: auto;
  z-index: 60;
  white-space: nowrap;
  font: 12px/1.3 'Inter', system-ui, sans-serif;
  font-weight: 500;
  color: var(--text-1);
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.windgram-share-toast.windgram-share-toast--open {
  opacity: 1;
  transform: translateY(0);
}

/* Shared windgram: ?embed=windgram — map and chrome hidden, chart only (see app.js) */
html.windgram-embed body > *:not(#windgram-panel):not(#loading-overlay) {
  display: none !important;
}
html.windgram-embed { overflow: hidden; }
html.windgram-embed body {
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}
html.windgram-embed #windgram-panel {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  max-height: 100dvh;
  height: 100dvh;
  z-index: 100;
  border-top: none;
  transform: none !important;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.windgram-embed #windgram-resize-handle {
  display: none;
}
html.windgram-embed #close-windgram {
  width: auto;
  min-width: 48px;
  padding: 0 10px;
  font-size: 0;
  line-height: 0;
}
html.windgram-embed #close-windgram::after {
  content: 'Map';
  font: 12px/1.2 Inter, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
html.windgram-embed #close-windgram:hover { color: var(--text-1); border-color: var(--border-hi); }
html.windgram-embed #close-windgram:hover::after { color: var(--text-1); }

/* Shared live-wind meter: ?embed=live-wind — map hidden, meter modal only (see app.js) */
html.live-wind-embed body > *:not(#live-wind-modal):not(#loading-overlay) {
  display: none !important;
}
html.live-wind-embed {
  overflow: hidden;
}
html.live-wind-embed body {
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}
html.live-wind-embed #live-wind-modal {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  pointer-events: auto;
}
html.live-wind-embed #live-wind-modal.live-wind-modal.hidden {
  display: none !important;
}
html.live-wind-embed #live-wind-modal:not(.hidden) {
  display: flex !important;
}
html.live-wind-embed .live-wind-modal__backdrop {
  display: none;
}
html.live-wind-embed .live-wind-modal__card {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
html.live-wind-embed .live-wind-modal__body {
  flex: 1;
  min-height: 0;
}
html.live-wind-embed .live-wind-share-wrap {
  display: none;
}
html.live-wind-embed #live-wind-modal-close {
  width: auto;
  min-width: 48px;
  font-size: 0;
  line-height: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
html.live-wind-embed #live-wind-modal-close::after {
  content: 'Map';
  font: 12px/1.2 Inter, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
html.live-wind-embed #live-wind-modal-close:hover { color: var(--text-1); border-color: var(--border-hi); background: var(--bg-mid); }
html.live-wind-embed #live-wind-modal-close:hover::after { color: var(--text-1); }

/* Shared Spit: ?embed=spit — map hidden, dock fills viewport (see app.js) */
html.spit-embed body > *:not(#spit-popup-panel):not(#loading-overlay) {
  display: none !important;
}
html.spit-embed {
  overflow: hidden;
}
html.spit-embed body {
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}
html.spit-embed #spit-popup-panel {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  max-height: 100dvh;
  height: 100dvh;
  z-index: 100;
  border-top: none;
  transform: none !important;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.spit-embed #spit-popup-resize-handle {
  display: none;
}
html.spit-embed #spit-popup-close {
  width: auto;
  min-width: 48px;
  padding: 0 10px;
  font-size: 0;
  line-height: 0;
}
html.spit-embed #spit-popup-close::after {
  content: 'Map';
  font: 12px/1.2 Inter, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
html.spit-embed #spit-popup-close:hover { color: var(--text-1); border-color: var(--border-hi); }
html.spit-embed #spit-popup-close:hover::after { color: var(--text-1); }

html.spit-embed #spit-popup-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

html.spit-embed #spit-popup-charts {
  flex: 1 1 auto;
  min-height: 0;
}

html.spit-embed .spit-popup-chart-row,
html.spit-embed .spit-popup-chart-split {
  flex: 1 1 auto;
  min-height: 0;
}

html.spit-embed .spit-popup-chart-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

html.spit-embed #spit-popup-wind-canvas {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
}

/* `chrome=mini`: used when the embed lives inside the about page; hide controls
   that would either point back at the about page or break out of the iframe. */
html.spit-embed-mini #spit-popup-about,
html.spit-embed-mini #spit-popup-close,
html.spit-embed-mini #spit-popup-external,
html.spit-embed-mini #spit-popup-archive-note {
  display: none !important;
}

/* Skew-T panel (map pick — same slide-up / resize pattern as windgram) */
.skewt-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--skewt-h);
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 30, 0.97);
  backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--border);
  z-index: 26;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.skewt-panel.panel-hidden {
  transform: translateY(var(--skewt-h));
}
#skewt-resize-handle {
  flex-shrink: 0;
  height: 8px;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
#skewt-resize-handle:hover {
  background: rgba(255, 255, 255, 0.06);
}
#skewt-resize-handle::after {
  content: '';
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--text-3);
  opacity: 0.35;
  pointer-events: none;
}
#skewt-resize-handle:hover::after {
  opacity: 0.65;
}
.skewt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.skewt-title-area {
  min-width: 0;
}
#skewt-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
#skewt-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  display: block;
}
#close-skewt {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
#close-skewt:hover {
  color: var(--text-1);
  border-color: var(--border-hi);
}
.skewt-body {
  flex: 1;
  min-height: 0;
  position: relative;
}
#skewt-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.skewt-time-scrubber {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 16px max(6px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: rgba(8, 13, 26, 0.94);
}
.skewt-time-slider-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.skewt-time-ticks {
  position: relative;
  height: 15px;
  margin: 0 4px 0 2px;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.skewt-time-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
#skewt-time-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  background: transparent;
  line-height: 0;
  --sk-track-h: 6px;
  --sk-thumb-h: 18px;
  --sk-thumb-w: 32px;
}
#skewt-time-slider::-webkit-slider-runnable-track {
  height: var(--sk-track-h);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}
#skewt-time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: var(--sk-thumb-w, 32px);
  height: var(--sk-thumb-h);
  margin-top: calc((var(--sk-track-h) - var(--sk-thumb-h)) / 2);
  border-radius: 5px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
#skewt-time-slider:hover::-webkit-slider-thumb {
  filter: brightness(1.08);
}
#skewt-time-slider::-moz-range-track {
  height: var(--sk-track-h);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}
#skewt-time-slider::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--sk-thumb-w, 32px);
  height: var(--sk-thumb-h);
  border-radius: 5px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
#skewt-time-slider::-moz-focus-outer {
  border: 0;
}
#skewt-time-slider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.skewt-time-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-hi);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 38%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 2px;
}

.tip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tip-header span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.03em;
}
.tip-header button {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  transition: color 0.12s;
}
.tip-header button:hover { color: var(--text-1); }

.tip-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.tip-body {
  font-size: 10.5px;
  color: var(--text-3);
  margin-bottom: 8px;
  line-height: 1.5;
}

.tip-swatches { display: flex; flex-direction: column; gap: 5px; }

.tip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-2);
}

.tip-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.10);
}

.tip-line {
  width: 24px;
  height: 2px;
  flex-shrink: 0;
  border-radius: 1px;
}
.tip-line--blh { background: rgba(251,191,36,0.85); border-top: 2px dashed rgba(251,191,36,0.85); background: none; }
.tip-line--fzl { border-top: 2px dashed rgba(125,211,252,0.85); background: none; }

#windgram-body {
  flex: 1;
  min-height: 0;
  overflow: visible;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Chart hidden via .windgram-chart-wrap when Notes tab is active */

.windgram-notes-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
  box-sizing: border-box;
}

.windgram-notes-panel[hidden] {
  display: none !important;
}

.windgram-body--notes .windgram-notes-panel {
  display: flex !important;
}

.windgram-notes-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.35;
}

.windgram-openair-export-wrap {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.windgram-openair-export-wrap[hidden] {
  display: none !important;
}

.windgram-openair-export-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 12px;
  font: 600 12px/1.3 Inter, system-ui, sans-serif;
  color: var(--text-1);
  background: var(--bg-mid);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.windgram-openair-export-btn:hover,
.windgram-openair-export-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.windgram-openair-export-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.windgram-openair-export-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-3);
}

.windgram-notes-display {
  flex: 1;
  min-height: 120px;
  margin: 0;
  padding: 12px 14px;
  box-sizing: border-box;
  font: 13px/1.5 Inter, system-ui, sans-serif;
  color: var(--text-1);
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: normal;
  overflow-y: auto;
}

.windgram-notes-display--empty {
  color: var(--text-3);
  font-style: italic;
  white-space: normal;
}

.windgram-notes-preamble {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-1);
}

.windgram-notes-preamble:last-child {
  margin-bottom: 0;
}

.windgram-notes-section {
  margin: 0 0 16px;
}

.windgram-notes-section:last-child {
  margin-bottom: 0;
}

.windgram-notes-h {
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}

.windgram-notes-p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-1);
}

.windgram-notes-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.windgram-notes-link:hover {
  color: var(--accent-hi);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Canvas would otherwise sit above margin controls in the GPU stack and steal clicks. */
#windgram-canvas {
  display: block;
  position: relative;
  z-index: 0;
  pointer-events: none;
}

/* ===== MAP SIDE LEGENDS (wind speed + optional rain) ===== */
/* Reparented into `#map-container` at runtime (see MapManager#_reparentMapSideLegends)
 * so Chrome/Android WebGL compositing does not darken legend swatches. */
.map-side-legends {
  position: absolute;
  top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + var(--hike-fly-bar-h) + 12px);
  right: 12px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
  /* Above wind canvases (z-index 9–10); below MapLibre popups (25) and controls (30). */
  z-index: 24;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  pointer-events: none;
  /* Mobile/WebGL: promote overlay so panel paints aren’t blended with the map framebuffer. */
  transform: translateZ(0);
}

.rain-map-legend {
  flex: 0 1 auto;
  box-sizing: border-box;
  max-width: min(200px, 100%);
  /*
   * Solid panel + no backdrop-filter: GPU compositing over MapLibre/WebGL can bleed map pixels
   * through fills on some phones unless this subtree is opaque and promoted (see transforms below).
   */
  background-color: rgb(12, 16, 32);
  background-image: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  position: relative;
  isolation: isolate;
  transform: translateZ(0);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.rain-map-legend__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.rain-map-legend__scale {
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  /* Match map.js _rainRgbFromUnit stops (pale → mid blue → navy) */
  background: linear-gradient(
    90deg,
    rgb(220, 246, 255) 0%,
    rgb(175, 224, 255) 17%,
    rgb(115, 190, 250) 38%,
    rgb(62, 140, 235) 58%,
    rgb(35, 95, 210) 75%,
    rgb(22, 48, 145) 90%,
    rgb(14, 22, 72) 100%
  );
}
.rain-map-legend__ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
}
.rain-map-legend__cap {
  font-weight: 500;
  color: var(--text-2);
}
.rain-map-legend__note {
  font-size: 9px;
  line-height: 1.35;
  color: var(--text-3);
  margin: 8px 0 0;
}

#wind-legend {
  flex: 0 1 auto;
  box-sizing: border-box;
  max-width: min(220px, 100%);
  background-color: rgb(12, 16, 32);
  background-image: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  position: relative;
  isolation: isolate;
  transform: translateZ(0);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.legend-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 7px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: 7px;
  align-items: center;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-2);
}

/*
 * One cell for swatch, one for all text. (Label + range must share a wrapper — a third grid
 * child was auto-placed on a new row and broke ranges across lines.)
 */
#wind-legend .legend-item {
  grid-template-columns: 18px minmax(0, 1fr);
}

#wind-legend .legend-item-text {
  min-width: 0;
}

#wind-legend .legend-item-range {
  white-space: nowrap;
}

.legend-swatch {
  display: block;
  width: 12px; height: 12px;
  border-radius: 3px;
  margin-top: 1px;
}

#wind-legend .legend-swatch {
  width: 16px;
  height: 16px;
  margin-top: 0;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  transform: translateZ(0);
  mix-blend-mode: normal;
  forced-color-adjust: none;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

/* Crisp SVG diagonal (legend-only): easier to see than CSS gradient on 12px tiles. */
.legend-swatch-wind-violent {
  background-color: rgb(5, 5, 8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' fill='rgb(5%2C5%2C8)'/%3E%3Cline x1='-1' y1='17' x2='17' y2='-1' stroke='%23ef4444' stroke-width='2.5' stroke-linecap='square' opacity='0.85'/%3E%3Cline x1='7' y1='17' x2='17' y2='7' stroke='%23f87171' stroke-width='1.35' stroke-linecap='square' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.legend-unit {
  font-size: 10px;
  color: var(--text-3);
  text-align: right;
  margin-top: 6px;
}

.wind-legend-flight-stats {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.wind-legend-flight-stats__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
  line-height: 1.35;
  margin-top: 5px;
}
.wind-legend-flight-stats__row:first-of-type {
  margin-top: 0;
}
.wind-legend-flight-stats__k {
  color: var(--text-3);
  font-weight: 500;
}
.wind-legend-flight-stats__v {
  color: var(--accent-hi);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ===== LOADING OVERLAY ===== */
#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.3s;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

#loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

#loading-text {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  max-width: 420px;
  line-height: 1.45;
}

#loading-error-actions {
  display: none;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

#loading-error-actions.visible {
  display: flex;
}

#loading-retry-no-token {
  flex: none;
  width: auto;
  padding: 10px 16px;
}


/* ===== SHARED BUTTONS ===== */
.btn-primary {
  flex: 1;
  background: var(--accent);
  border: none;
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 8px;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hi); }

.btn-secondary {
  background: var(--bg-dark);
  border: 1px solid var(--border-hi);
  color: var(--text-2);
  font-size: 13px;
  padding: 11px 16px;
  border-radius: 8px;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--bg-light); color: var(--text-1); }

/* ===== LIVE WIND MODAL (Spit iframe / Gondola) ===== */
.live-wind-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
}
.live-wind-modal.hidden { display: none; }

.live-wind-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 20, 0.72);
  pointer-events: auto;
}

.live-wind-modal__card {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  max-height: min(88vh, 780px);
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  overflow: hidden;
}

.live-wind-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.live-wind-modal__head h3 {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}
.live-wind-modal__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.live-wind-modal__close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.live-wind-modal__close:hover { color: var(--text-1); background: var(--bg-mid); }

.live-wind-modal__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 10px 14px 14px;
  gap: 10px;
}

.live-wind-spit-canvas {
  display: block;
  width: 100%;
  height: 220px;
  border-radius: 8px;
  background: #0d1b2a;
  margin-bottom: 6px;
}
.live-wind-spit-canvas.hidden { display: none; }

/* Horizontal scrub on chart (pointer drag); avoids browser overscroll stealing the gesture. */
.live-wind-spit-canvas.live-wind-graph-pannable {
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.live-wind-graph-pan {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 4px 12px max(6px, env(safe-area-inset-bottom, 0px)) 12px;
  border-top: 1px solid var(--border);
  background: rgba(8, 13, 26, 0.94);
  border-radius: 0 0 8px 8px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
}
.live-wind-graph-pan.hidden {
  display: none;
}
.live-wind-graph-pan__hint {
  flex: 0 0 auto;
  white-space: nowrap;
}
.live-wind-graph-pan__slider {
  flex: 1;
  min-width: 0;
}

.live-wind-gondola.hidden { display: none; }
.live-wind-gondola__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
  margin: 8px 0;
}

.live-wind-spit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(34,211,238,0.10);
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #67e8f9;
}
.live-wind-spit-bar.hidden { display: none; }

.live-wind-modal__links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: flex-start;
  margin-top: 4px;
}

.live-wind-modal__link {
  font-size: 12px;
  font-weight: 500;
  align-self: flex-start;
}
.live-wind-modal__link.hidden {
  display: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }

/* ===== DESKTOP LEFT TOOLBAR (≥901px — wider than windgram/Skew-T “mobile” breakpoint) ===== */
@media (min-width: 901px) {
  :root {
    --toolbar-stack-base: 0px;
    --toolbar-side-w: 156px;
  }

  #map-container {
    left: var(--toolbar-side-w);
  }

  #toolbar {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--toolbar-side-w);
    height: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 6px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }

  .toolbar-divider {
    width: 100%;
    height: 1px;
    min-height: 1px;
  }

  .openaip-airspace-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #spatial-wind-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar-map-extras {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .kk7-thermal-toolbar,
  .kk7-thermal-toolbar__toggles {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #toolbar #basemap-toggle.basemap-toggle {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  #toolbar #basemap-toggle .basemap-toggle__btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    box-sizing: border-box;
    padding: 6px 4px;
    font-size: 10px;
  }

  #toolbar .spatial-wind-toggle,
  #toolbar .historical-weather-toolbar__btn,
  #toolbar .toolbar-about {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    font-size: 11px;
    padding: 6px 8px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  #toolbar-info {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: auto;
    width: 100%;
    margin-left: 0;
  }

  /** Status dot centred under stacked links — avoids widening the pulse hit area full-rail */
  #toolbar #toolbar-info #data-status {
    align-self: center;
  }

  #toolbar-logo {
    flex-shrink: 0;
    font-size: 13px;
    gap: 6px;
  }

  #toolbar-logo svg {
    width: 22px;
    height: 22px;
  }

  .spatial-wind-time-bar,
  .hike-fly-bar,
  .fires-smoke-bar {
    left: var(--toolbar-side-w);
    right: 0;
  }

  .spatial-wind-api-counter-wrap {
    left: calc(var(--toolbar-side-w) + 12px);
    max-width: min(440px, calc(100vw - var(--toolbar-side-w) - 24px));
  }

  .map-side-legends {
    max-width: min(440px, calc(100vw - var(--toolbar-side-w) - 24px));
  }

  .map-locate-btn {
    left: calc(var(--toolbar-side-w) + max(12px, env(safe-area-inset-left, 0px)));
  }

  .map-reset-north-btn {
    left: calc(var(--toolbar-side-w) + max(12px, env(safe-area-inset-left, 0px)) + 42px + 8px);
  }

  .paraglide-game-hud {
    left: calc(var(--toolbar-side-w) + max(12px, env(safe-area-inset-left, 0px)));
  }
}

/* ===== MOBILE & TOUCH ============================================= */

@supports (height: 100dvh) {
  @media (max-width: 900px) {
    html, body {
      height: 100dvh;
      min-height: 100dvh;
    }
  }
}

@media (max-width: 900px) {
  :root {
    --windgram-h: min(48vh, min(480px, calc(100vh - 120px)));
    /** Taller than desktop strip: wrapped MAP TIME row + ticks need room (avoid label clipping). */
    --spatial-wind-time-bar-h: 104px;
    --spatial-wind-time-bar-h-compact: 62px;
  }

  /** Map time / Hike+Fly / Fires strips dock to the bottom (thumb-friendly; frees map center). */
  body {
    --spatial-dock-h: 0px;
    --fires-dock-h: 0px;
    /* Bottom chrome: main toolbar + docked HF / map-time / fires strips (see `#toolbar` + `.spatial-wind-time-bar`). */
    --mobile-map-dock-offset: calc(
      var(--toolbar-h) + var(--hike-fly-bar-h, 0px) + var(--spatial-dock-h) + var(--fires-dock-h)
    );
  }
  body.map-wind-time-open {
    --map-time-bar-stack-h: var(--spatial-wind-time-bar-h);
    --spatial-dock-h: var(--spatial-wind-time-bar-h);
  }
  body:not(.map-wind-time-open) {
    --map-time-bar-stack-h: 0px;
    --spatial-dock-h: 0px;
  }
  body.fires-smoke-bar-open {
    --fires-dock-h: var(--fires-smoke-bar-h);
  }
  .fires-smoke-bar {
    top: auto !important;
    bottom: calc(var(--toolbar-h) + var(--map-time-bar-stack-h));
    border-bottom: none;
    border-top: 1px solid var(--border);
    z-index: 20;
  }
  .spatial-wind-time-bar {
    top: auto !important;
    bottom: var(--toolbar-h);
    border-bottom: none;
    border-top: 1px solid var(--border);
    z-index: 21;
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
  .hike-fly-bar {
    top: auto !important;
    bottom: var(--toolbar-h);
    border-bottom: none;
    border-top: 1px solid var(--border);
    z-index: 22;
    padding-bottom: 8px;
  }
  body:has(#hike-fly-bar:not([hidden])) .spatial-wind-time-bar {
    bottom: calc(var(--toolbar-h) + var(--hike-fly-bar-h));
    padding-bottom: 0;
  }
  body:has(#hike-fly-bar:not([hidden])) .fires-smoke-bar {
    bottom: calc(var(--toolbar-h) + var(--hike-fly-bar-h) + var(--map-time-bar-stack-h));
  }
  body:has(#hike-fly-bar:not([hidden])) .hike-fly-bar {
    padding-bottom: 8px;
  }
  body.fires-smoke-bar-open:not(:has(#hike-fly-bar:not([hidden]))):not(.map-wind-time-open) .fires-smoke-bar {
    bottom: var(--toolbar-h);
    padding-bottom: 8px;
  }

  /** Map time: hide same-day 3-hour clock labels on ticks; keep day-change labels (narrow viewports). */
  .spatial-wind-time-bar__tick--same-day-hour {
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    max-width: none !important;
  }
  .spatial-wind-time-bar__tick--same-day-hour::before {
    height: 5px;
    margin-bottom: 0;
    opacity: 0.5;
  }

  /** Altitude strip: tick marks only (current level stays in the value readout). */
  #spatial-altitude-slider-ticks .spatial-wind-time-bar__tick {
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    max-width: none !important;
  }
  #spatial-altitude-slider-ticks .spatial-wind-time-bar__tick::before {
    height: 5px;
    margin-bottom: 0;
    opacity: 0.5;
  }
  .spatial-wind-time-bar__ticks--altitude {
    height: 12px;
  }

  /** Value readouts on the left; slider full width below. */
  .spatial-wind-time-bar__row {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 6px;
  }
  .spatial-wind-time-bar__value {
    order: -1;
    text-align: left;
    margin-right: auto;
  }
  .spatial-wind-time-bar__label {
    order: 0;
  }
  .spatial-wind-time-bar__slider-stack {
    order: 1;
    flex: 1 1 100%;
    min-width: 100%;
  }

  .hike-fly-bar__row {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 6px;
  }
  .hike-fly-bar__value {
    order: -1;
    text-align: left;
    margin-right: auto;
  }
  .hike-fly-bar__label {
    order: 0;
  }
  .hike-fly-bar__slider,
  .hike-fly-bar__select {
    order: 1;
    flex: 1 1 100%;
    min-width: 0;
  }
  .hike-fly-bar__body {
    flex-direction: column;
    align-items: stretch;
  }
  .hike-fly-bar__controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .hike-fly-bar__controls > .hike-fly-bar__row {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .fires-smoke-bar {
    height: auto;
    min-height: 72px;
  }

  .fires-smoke-bar__row {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 6px;
  }
  .fires-smoke-bar__value {
    order: -3;
    text-align: left;
    min-width: 0;
    margin-right: 8px;
  }
  .fires-smoke-bar__slider-label {
    order: -1;
  }
  .fires-smoke-bar__slider-stack {
    order: 0;
    flex: 1 1 100%;
    min-width: 0;
  }

  /** Narrow viewport: hide same-day 3-hour clock labels; keep day-change labels. */
  .fires-smoke-bar__tick--same-day-hour {
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    max-width: none !important;
  }
  .fires-smoke-bar__tick--same-day-hour::before {
    height: 5px;
    margin-bottom: 0;
    opacity: 0.5;
  }

  /*
   * Grid + display:contents on section wrappers: every button is a grid item so rows fill
   * left-to-right before wrapping (avoids a lone “Ruler” / “Hist.” on sparse lines).
   */
  #toolbar {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 5px;
    align-items: stretch;
    justify-items: stretch;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    height: auto;
    min-height: 52px;
    padding: 8px max(10px, env(safe-area-inset-right, 0px))
      max(6px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
    border-bottom: none;
    border-top: 1px solid var(--border);
    z-index: 28;
  }

  .toolbar-divider {
    display: none;
  }

  /* Drop top-left brand on phones/tablets — frees a full grid row for controls. */
  #toolbar-logo {
    display: none;
  }

  .toolbar-label-long {
    display: none;
  }

  .toolbar-label-short {
    display: inline;
  }

  #spatial-wind-controls,
  .toolbar-map-extras,
  #kk7-thermal-toolbar,
  .kk7-thermal-toolbar__toggles,
  #openaip-airspace-wrap {
    display: contents;
  }

  /**
   * Flatten `#toolbar-info` into the toolbar grid so Downloads / About / status share rows with
   * other controls (same pattern as `#spatial-wind-controls`). Explicit `order` keeps them after
   * Airspace (40); IDs avoid losing About behind overflow when widths were tied together.
   */
  #toolbar-info {
    display: contents;
  }

  #toolbar #toolbar-downloads {
    order: 50;
  }

  #toolbar #toolbar-about {
    order: 51;
  }

  #toolbar #toolbar-info #data-status {
    order: 52;
    justify-self: center;
    align-self: center;
  }

  #toolbar #toolbar-info .toolbar-about {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Basemap: one grid cell + single cycle button (TOPO/SAT); desktop pair hidden below. */
  #toolbar #basemap-toggle {
    display: flex;
    grid-column: span 1;
    order: 31;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    box-sizing: border-box;
    align-self: stretch;
    border-radius: 999px;
    border: 1px solid var(--border-hi);
    padding: 3px;
    gap: 0;
    background: rgba(5, 9, 18, 0.94);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.42);
    overflow: hidden;
  }

  #toolbar #basemap-toggle #basemap-topo,
  #toolbar #basemap-toggle #basemap-satellite {
    display: none !important;
  }

  #toolbar #basemap-cycle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    border-radius: 999px;
  }

  /* Match desktop: TOPO/SAT, then Skyways + Thermals (see `#toolbar-map-extras` in HTML). */
  #kk7-thermal-toggle {
    order: 32;
  }

  #kk7-thermals-toggle {
    order: 33;
  }

  #openaip-airspace-toggle {
    order: 40;
  }

  .historical-weather-toolbar__extra:not([hidden]) {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .historical-weather-toolbar__date {
    font-size: 11px;
    max-width: 140px;
  }

  .historical-weather-toolbar__btn {
    padding: 5px 8px;
    min-height: 34px;
    font-size: 10px;
  }

  #spatial-wind-controls .spatial-wind-toggle,
  .toolbar-map-extras .spatial-wind-toggle,
  .kk7-thermal-toolbar .spatial-wind-toggle,
  #openaip-airspace-wrap .spatial-wind-toggle {
    padding: 5px 8px;
    min-height: 34px;
    font-size: 10px;
  }

  #spatial-wind-controls .spatial-wind-toggle {
    order: 10;
  }

  /* Paraglide sim + XC live need desktop bandwidth/CPU; keep off the compact toolbar. */
  #paraglide-game-btn,
  #xcontest-live-wrap {
    display: none !important;
  }

  #toolbar .spatial-wind-toggle,
  #toolbar .historical-weather-toolbar__btn,
  #toolbar .toolbar-about {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #toolbar .basemap-toggle__btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    box-sizing: border-box;
    border-radius: 999px;
    color: var(--text-3);
    background: transparent;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  }

  #toolbar .basemap-toggle__btn + .basemap-toggle__btn {
    border-left: none;
  }

  #toolbar .basemap-toggle__btn:hover:not(.active) {
    color: var(--text-2);
    background: rgba(255, 255, 255, 0.06);
  }

  #toolbar .basemap-toggle__btn.active {
    color: var(--accent-hi);
    background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-mid) 100%);
    box-shadow:
      0 1px 4px rgba(0, 0, 0, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.07);
  }

  #toolbar .basemap-toggle__btn:focus {
    outline: none;
  }

  #toolbar .basemap-toggle__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    position: relative;
    z-index: 1;
  }

  .basemap-toggle__btn {
    padding: 5px 8px;
    min-height: 34px;
    font-size: 9px;
  }

  .model-toggle-wrap .basemap-toggle__btn {
    padding: 6px 6px;
    font-size: 10px;
  }

  .model-toggle-wrap__label-full {
    display: none;
  }
  .model-toggle-wrap__label-short {
    display: inline;
  }

  .spatial-wind-time-bar__value {
    min-width: 0;
    font-size: 11px;
    text-align: left;
  }

  .spatial-wind-api-counter-wrap {
    left: max(8px, env(safe-area-inset-left, 0px));
    right: auto;
    max-width: calc(100vw - 24px);
    font-size: 10px;
    top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + 10px) !important;
  }

  .map-side-legends {
    top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + 8px);
    right: max(8px, env(safe-area-inset-right, 0px));
    gap: 8px;
    max-width: calc(100vw - 16px);
  }

  #wind-legend {
    max-width: min(160px, calc(100vw - 24px));
    padding: 7px 8px;
  }

  .rain-map-legend {
    max-width: min(148px, calc(100vw - 24px));
    padding: 7px 8px;
  }

  /*
   * Legend swatches use opaque fills in index.html (same hex as WindColors.arrowKmh);
   * semi-transparent fills over backdrop-filter map/topo read muddy on some GPUs.
   *
   * Violent: data-URI SVG backgrounds often fail or flatten under GPU layers on mobile;
   * use a plain repeating gradient that matches the map hatch intent.
   */
  #wind-legend .legend-swatch-wind-violent {
    background-color: rgb(5, 5, 8);
    background-image: repeating-linear-gradient(
      -45deg,
      rgb(5, 5, 8),
      rgb(5, 5, 8) 4px,
      rgba(239, 68, 68, 0.72) 4px,
      rgba(239, 68, 68, 0.72) 5px
    );
    /* Desktop tall .legend-swatch-wind-violent uses 100%×100% for SVG; don’t stretch the hatch. */
    background-size: auto;
    border: 1px solid rgba(255, 255, 255, 0.35);
  }

  body.map-wind-time-open .map-side-legends,
  body.fires-smoke-bar-open .map-side-legends,
  body.map-wind-time-open.fires-smoke-bar-open .map-side-legends {
    top: calc(var(--toolbar-stack-base) + var(--airspace-subbar-h) + 8px);
  }

  .legend-items {
    gap: 3px;
  }

  .legend-item {
    font-size: 10px;
    line-height: 1.32;
  }

  #wind-legend .legend-item-label {
    display: none;
  }

  /*
   * Full-screen overlay on small viewports so the map isn’t visible behind the chart
   * (maximize usable area on phones).
   */
  #windgram-panel {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    z-index: 40;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: 0;
    border-top: none;
  }

  #windgram-panel.panel-hidden {
    transform: translateY(105%);
    pointer-events: none;
  }

  /**
   * Spit drawer: stacks above the docked bottom toolbar (z-index 28).
   * Otherwise the toolbar occludes the wind chart x-axis ticks and labels.
   */
  #spit-popup-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
  }

  #windgram-resize-handle {
    display: none;
  }

  #windgram-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 8px;
    padding: 10px max(12px, env(safe-area-inset-left, 0px)) 10px max(12px, env(safe-area-inset-right, 0px));
  }

  #windgram-title-area {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    align-self: center;
  }

  #windgram-actions {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
    align-self: center;
  }

  #windgram-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-bottom: 4px;
    gap: 6px;
    scrollbar-width: thin;
  }

  .wg-tab {
    min-height: 40px;
    padding: 8px 14px;
    flex-shrink: 0;
    touch-action: manipulation;
  }

  .wg-tab-info-btn {
    width: 36px;
    min-height: 40px;
  }

  .windgram-time-scrubber {
    padding: 0 max(12px, env(safe-area-inset-left, 0px)) max(6px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-right, 0px));
  }

  .live-wind-graph-pan {
    padding: 4px max(12px, env(safe-area-inset-left, 0px)) max(6px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-right, 0px));
  }

  #wg-time-slider,
  .live-wind-graph-pan__slider {
    height: 28px;
    margin-block: 6px;
    --wg-track-h: 7px;
    --wg-thumb-h: 20px;
  }

  #windgram-actions {
    max-width: 100%;
  }

  #close-windgram {
    width: 40px;
    height: 40px;
    min-width: 40px;
    touch-action: manipulation;
  }

  .skewt-panel {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    z-index: 40;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: 0;
    border-top: none;
  }

  .skewt-panel.panel-hidden {
    transform: translateY(105%);
    pointer-events: none;
  }

  #skewt-resize-handle {
    display: none;
  }

  .skewt-header {
    padding: 10px max(12px, env(safe-area-inset-left, 0px)) 10px max(12px, env(safe-area-inset-right, 0px));
  }

  .skewt-time-scrubber {
    padding: 8px max(12px, env(safe-area-inset-left, 0px)) max(6px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-right, 0px));
  }

  #skewt-time-slider {
    height: 28px;
    margin-block: 4px 0;
    --sk-track-h: 7px;
    --sk-thumb-h: 20px;
  }

  #close-skewt {
    width: 40px;
    height: 40px;
    min-width: 40px;
    touch-action: manipulation;
  }

  .windgram-header-popup {
    left: 0;
    right: auto;
    width: min(calc(100vw - 24px), 320px);
    max-height: min(70dvh, 480px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pg-marker-label {
    font-size: 10px !important;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .live-wind-modal {
    padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
      max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }

  .live-wind-modal__card {
    width: 100%;
    max-width: min(920px, 100%);
    max-height: min(85vh, calc(100vh - 32px));
  }

  #loading-text {
    max-width: calc(100vw - 48px);
    padding: 0 12px;
  }

  /**
   * Bottom-left GPS + reset-north sit above the docked map strips (HF / time / fires).
   * --hike-fly-bar-h is set on :root by JS when the strip is visible.
   */
  .map-locate-btn {
    bottom: calc(var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  .map-reset-north-btn {
    bottom: calc(var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#windgram-panel:not(.panel-hidden)) .map-locate-btn {
    bottom: calc(var(--windgram-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#skewt-panel:not(.panel-hidden)) .map-locate-btn {
    bottom: calc(var(--skewt-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#spit-popup-panel:not(.panel-hidden)) .map-locate-btn {
    bottom: calc(var(--spit-popup-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#xcontest-live-panel:not(.panel-hidden)) .map-locate-btn {
    bottom: calc(var(--xcontest-live-panel-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#windgram-panel:not(.panel-hidden)) .map-reset-north-btn {
    bottom: calc(var(--windgram-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#skewt-panel:not(.panel-hidden)) .map-reset-north-btn {
    bottom: calc(var(--skewt-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#spit-popup-panel:not(.panel-hidden)) .map-reset-north-btn {
    bottom: calc(var(--spit-popup-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#xcontest-live-panel:not(.panel-hidden)) .map-reset-north-btn {
    bottom: calc(var(--xcontest-live-panel-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  .xcontest-vario-legend:not(.panel-hidden) {
    bottom: calc(var(--mobile-map-dock-offset) + var(--map-fab-inset));
  }
  body:has(#xcontest-live-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
    bottom: calc(var(--xcontest-live-panel-h) + var(--mobile-map-dock-offset) + var(--map-fab-inset));
  }
  body:has(#windgram-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
    bottom: calc(var(--windgram-h) + var(--mobile-map-dock-offset) + var(--map-fab-inset));
  }
  body:has(#windgram-panel:not(.panel-hidden)):has(#xcontest-live-panel:not(.panel-hidden))
    .xcontest-vario-legend:not(.panel-hidden) {
    bottom: calc(
      var(--windgram-h) + var(--xcontest-live-panel-h) + var(--mobile-map-dock-offset) + var(--map-fab-inset)
    );
  }
  body:has(#skewt-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
    bottom: calc(var(--skewt-h) + var(--mobile-map-dock-offset) + var(--map-fab-inset));
  }
  body:has(#spit-popup-panel:not(.panel-hidden)) .xcontest-vario-legend:not(.panel-hidden) {
    bottom: calc(var(--spit-popup-h) + var(--mobile-map-dock-offset) + var(--map-fab-inset));
  }
  .paraglide-game-hud {
    bottom: calc(58px + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#windgram-panel:not(.panel-hidden)) .paraglide-game-hud {
    bottom: calc(58px + var(--windgram-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#skewt-panel:not(.panel-hidden)) .paraglide-game-hud {
    bottom: calc(58px + var(--skewt-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#spit-popup-panel:not(.panel-hidden)) .paraglide-game-hud {
    bottom: calc(58px + var(--spit-popup-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
  body:has(#xcontest-live-panel:not(.panel-hidden)) .paraglide-game-hud {
    bottom: calc(58px + var(--xcontest-live-panel-h) + var(--mobile-map-dock-offset) + max(12px, env(safe-area-inset-bottom, 0px)));
  }
}

@supports (height: 100dvh) {
  @media (max-width: 900px) {
    :root {
      --windgram-h: min(48dvh, min(480px, calc(100dvh - 120px)));
      --skewt-h: min(42dvh, min(460px, calc(100dvh - 120px)));
      --spit-popup-h: min(42dvh, min(480px, calc(100dvh - 120px)));
    }
    .live-wind-modal__card {
      max-height: min(85dvh, calc(100dvh - 32px));
    }
  }
}
