/* ===========================================================================
   ACARS flight tracks + wind barbs — styles
   Dark "night-ops" basemap so the color-coded wind barbs and tracks pop, framed
   by the same dark instrument chrome + amber accents as the sounding map.
   ========================================================================== */

:root {
  --slate-900: #141b23;
  --slate-850: #18212b;
  --slate-800: #1d2832;
  --slate-700: #283643;
  --slate-600: #364654;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --amber: #ffb000;
  --amber-bright: #ffc94d;
  --amber-dim: #b98300;
  --amber-glow: rgba(255, 176, 0, 0.35);
  /* Airports with a moisture (dewpoint) sounding. Deliberately lighter than the
     amber as well as a different hue: amber and green converge under red-green
     colour vision deficiency, so lightness carries the distinction too, and the
     panel prints a key rather than leaving colour to do the work alone. */
  --wv-green: #3ddc84;
  --wv-green-bright: #8af7bd;
  --wv-green-glow: rgba(61, 220, 132, 0.40);

  --text: #eef2f5;
  --text-dim: #9fb0bd;
  --text-faint: #6f7f8c;

  --track: #5b8fd6;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, monospace;

  --bezel-shadow: 0 6px 22px rgba(8, 12, 16, 0.55);
  --topbar-h: 52px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  font-family: var(--font-ui); color: var(--text);
  background: #0b0f14; overflow: hidden;
}

/* ---- top instrument bar -------------------------------------------------- */
#topbar {
  position: absolute; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 1200;
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: linear-gradient(180deg, var(--slate-800), var(--slate-850));
  border-bottom: 1px solid var(--line-strong); box-shadow: var(--bezel-shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700;
  letter-spacing: 0.4px; font-size: 15px; white-space: nowrap; }
.brand .glyph { width: 26px; height: 26px; display: grid; place-items: center;
  color: var(--slate-900); background: var(--amber); border-radius: 7px;
  box-shadow: 0 0 0 1px var(--amber-dim), 0 0 12px var(--amber-glow); }
.brand .sub { color: var(--amber-bright); font-weight: 600; }

.readout { display: flex; align-items: center; gap: 16px; margin-left: auto;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.readout .field { display: flex; flex-direction: column; line-height: 1.15; }
.readout .field .k { color: var(--text-faint); font-size: 9.5px; letter-spacing: 0.6px; text-transform: uppercase; }
.readout .field .v { color: var(--text); }
.readout .v.live { color: var(--amber-bright); }
.readout .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber-glow); }

.controls { display: flex; align-items: center; gap: 8px; }
.btn { font-family: var(--font-ui); font-size: 12px; color: var(--text);
  background: var(--slate-700); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 7px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s; }
.btn:hover { background: var(--slate-600); border-color: var(--amber-dim); }
.btn svg { width: 14px; height: 14px; }
.btn.toggle.on { background: var(--amber); color: var(--slate-900); border-color: var(--amber-dim); font-weight: 600; }
.btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- map ----------------------------------------------------------------- */
#map { position: absolute; inset: var(--topbar-h) 0 0 0; background: #0b0f14; }

/* lift the dark basemap so land + state/country lines stay legible under the
   wind barbs (applies to the basemap tiles only, not the data) */
/* Two layers pulled opposite ways: the land basemap is DARKENED to match the
   near-black interface, while the boundaries/labels overlay below is left near full
   strength so national borders stay crisp and country/city names stay legible.
   Darkening a single combined layer would crush the borders into the land — hence
   the split. Lower this brightness for a darker map, raise it for a lighter one. */
/* Two layers pulled opposite ways: the land basemap is DARKENED to match the
   near-black interface, while the boundaries/labels overlay above is BRIGHTENED so
   national/state borders and place names read close to white.
   IMPORTANT: brightness only — no contrast(). Esri's dark canvas separates land
   from ocean by only a small margin, and a contrast boost pushes both toward black,
   erasing coastlines. Brightness preserves the land/water ratio. */
.basemap-tiles { filter: brightness(0.7); }        /* land: darkened to match the UI */
.basemap-labels { filter: brightness(1.15); }      /* boundaries+places are already light; gentle lift */

/* wind-barb icons carry no box; just the SVG */
.barb { pointer-events: none; }
.barb svg { display: block; filter: drop-shadow(0 0 1px rgba(0,0,0,0.6)); }

/* ---- hover tooltip + click popup (Leaflet overrides) --------------------- */
.leaflet-tooltip.obs-tip, .leaflet-popup.obs-pop .leaflet-popup-content-wrapper {
  background: var(--slate-800); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 9px;
  box-shadow: var(--bezel-shadow); font-family: var(--font-mono); font-size: 11.5px;
}
.leaflet-tooltip.obs-tip { padding: 7px 10px; line-height: 1.45; }
.leaflet-tooltip.obs-tip::before { border-top-color: var(--line-strong) !important; }
.obs-tip .id { color: var(--amber-bright); font-weight: 700; font-size: 12.5px; }
.obs-tip .wind { color: var(--amber-bright); }
.obs-tip .mut { color: var(--text-faint); }
.leaflet-popup.obs-pop .leaflet-popup-content { margin: 9px 12px; line-height: 1.5; }
.leaflet-popup.obs-pop .leaflet-popup-tip { background: var(--slate-800); }
.leaflet-popup.obs-pop a.leaflet-popup-close-button { color: var(--text-faint); }

/* ---- wind-speed legend --------------------------------------------------- */
#legend {
  position: absolute; left: 14px; bottom: 16px; z-index: 1000;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 11px 13px;
  font-size: 11px; color: var(--text-dim); display: none;
}
#legend.show { display: block; }
#legend h4 { margin: 0 0 8px; font-size: 10px; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
#legend .scale { display: flex; align-items: flex-end; gap: 0; }
#legend .seg { width: 30px; text-align: center; }
#legend .seg .bar { height: 9px; }
#legend .seg .num { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim);
  margin-top: 3px; }
#legend .scale .seg:first-child .bar { border-radius: 3px 0 0 3px; }
#legend .scale .seg:last-child .bar { border-radius: 0 3px 3px 0; }
#legend .unit { margin-top: 6px; font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); }

/* ---- turbulence (EDR) legend --------------------------------------------- */
#edr-legend {
  position: absolute; left: 14px; bottom: 104px; z-index: 1000; display: none;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 10px 13px;
  font-size: 11px; color: var(--text-dim); max-width: 250px;
}
#edr-legend.show { display: block; }
#edr-legend h4 { margin: 0 0 7px; font-size: 10px; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.edr-scale { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.edr-key { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text); }
.edr-key i { width: 11px; height: 11px; border-radius: 50%; display: inline-block;
  border: 1px solid #0a0e14; }
.edr-note { margin-top: 7px; font-family: var(--font-mono); font-size: 9px; color: var(--text-faint);
  line-height: 1.4; }

/* ---- PIREP markers + legend ---------------------------------------------- */
.pirep-marker { pointer-events: auto; cursor: default; }
.pirep-mk {
  width: var(--s); height: var(--s); margin: auto; background: var(--c);
  transform: rotate(45deg); border: 1px solid rgba(0, 0, 0, 0.65); border-radius: 2px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.55); transition: transform 0.12s;
}
.pirep-marker:hover .pirep-mk { transform: rotate(45deg) scale(1.25); }
#pirep-legend {
  position: absolute; left: 14px; bottom: 200px; z-index: 1000; display: none;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 10px 13px;
  font-size: 11px; color: var(--text-dim); max-width: 250px;
}
#pirep-legend.show { display: block; }
#pirep-legend h4 { margin: 0 0 7px; font-size: 10px; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.pirep-scale { display: flex; flex-wrap: wrap; gap: 5px 10px; }
.pirep-key { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text); }
.pirep-sw { width: 10px; height: 10px; display: inline-block; transform: rotate(45deg);
  border: 1px solid rgba(0, 0, 0, 0.65); border-radius: 2px; }
.obs-tip .praw { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); max-width: 260px;
  white-space: normal; }

/* ---- tracks/barbs info chip + toast -------------------------------------- */
#hint {
  position: absolute; right: 14px; bottom: 16px; z-index: 1000;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 9px 12px;
  font-size: 11px; color: var(--text-dim); max-width: 230px; line-height: 1.45;
}
#hint b { color: var(--text); }

#toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(var(--topbar-h) + 14px); z-index: 1300;
  background: var(--slate-800); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 12px; padding: 9px 15px; border-radius: 8px; box-shadow: var(--bezel-shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.25s; font-family: var(--font-mono);
}
#toast.show { opacity: 1; }

#loading {
  position: absolute; inset: var(--topbar-h) 0 0 0; z-index: 1400;
  display: grid; place-items: center; background: rgba(11, 15, 20, 0.82);
  font-family: var(--font-mono); color: var(--text-dim); font-size: 13px;
}
#loading.hidden { display: none; }
#loading .loading-card {
  text-align: center; padding: 22px 30px; min-width: 300px; max-width: 82vw;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 12px; box-shadow: var(--bezel-shadow);
}
#loading #loading-msg { font-size: 14px; color: var(--text); font-weight: 600; }
#loading .loading-sub { margin-top: 8px; font-size: 11.5px; color: var(--amber-bright);
  line-height: 1.5; white-space: pre-line; min-height: 1.4em; }
#loading .spinner { width: 30px; height: 30px; border: 3px solid var(--line-strong);
  border-top-color: var(--amber); border-radius: 50%; animation: spin 0.8s linear infinite;
  margin: 0 auto 14px; }

/* Leaflet chrome on dark */
.leaflet-container { font-family: var(--font-ui); background: #0b0f14; }
.leaflet-control-zoom a { background: var(--slate-800) !important; color: var(--text) !important;
  border-color: var(--line-strong) !important; }
.leaflet-control-zoom a:hover { background: var(--slate-700) !important; }
.leaflet-bar { box-shadow: var(--bezel-shadow) !important; border: none !important; }
.leaflet-control-attribution { background: rgba(20,27,35,0.8) !important; color: var(--text-faint) !important; }
.leaflet-control-attribution a { color: var(--text-dim) !important; }

@media (max-width: 600px) {
  .readout .field.host { display: none; }
  #hint { display: none; }
}

/* ===========================================================================
   Soundings: location markers + skew-T panel
   ========================================================================== */

/* clickable airport/sounding marker */
.snd-marker { pointer-events: auto; cursor: pointer; }
.snd-marker .badge {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 176, 0, 0.16); border: 1.5px solid var(--amber);
  color: var(--amber-bright); box-shadow: 0 0 8px var(--amber-glow);
  font-size: 12px; font-weight: 800; line-height: 1;
  transition: transform 0.12s, background 0.12s;
}
.snd-marker:hover .badge { transform: scale(1.18); background: var(--amber); color: var(--slate-900); }

/* radiosonde (balloon) stations — cyan pills, distinct from the amber soundings */
.raob-marker { pointer-events: auto; cursor: pointer; }
/* world-view form of a station: a dot, so 484 of them stay legible */
.raob-dot { width: 9px; height: 9px; border-radius: 50%;
  background: rgba(77, 210, 255, 0.30); border: 1.5px solid var(--cyan, #4dd2ff);
  box-shadow: 0 0 6px rgba(77, 210, 255, 0.45);
  transition: transform 0.12s, background 0.12s; }
.raob-marker:hover .raob-dot { transform: scale(1.7);
  background: var(--cyan, #4dd2ff); }
.raob-marker .raob-pill {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  background: rgba(8, 30, 38, 0.82); border: 1.5px solid #22d3ee;
  color: #a5f3fc; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  line-height: 1; padding: 3px 6px; border-radius: 9px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55); transition: transform 0.12s, background 0.12s;
}
.raob-marker .raob-glyph {
  width: 7px; height: 7px; background: #22d3ee; border-radius: 1px;
  transform: rotate(45deg); box-shadow: 0 0 6px rgba(34, 211, 238, 0.7);
}
.raob-marker:hover .raob-pill { transform: scale(1.12); background: rgba(34, 211, 238, 0.9); color: #042530; }
.raob-marker:hover .raob-glyph { background: #042530; }

.leaflet-tooltip.snd-tip {
  background: var(--slate-800); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: var(--font-mono); font-size: 11px; padding: 6px 9px;
  box-shadow: var(--bezel-shadow);
}
.leaflet-tooltip.snd-tip::before { border-top-color: var(--line-strong) !important; }
.snd-tip b { color: var(--amber-bright); }

/* skew-T panel docked on the right */
#sndpanel {
  position: absolute; top: var(--topbar-h); right: 0; bottom: 0; width: 480px;
  max-width: 94vw; z-index: 1500; background: linear-gradient(180deg, var(--slate-850), var(--slate-900));
  border-left: 1px solid var(--line-strong); box-shadow: -10px 0 30px rgba(8,12,16,0.5);
  transform: translateX(100%); transition: transform 0.22s ease;
  display: flex; flex-direction: column;
}
#sndpanel.open { transform: translateX(0); }
.snd-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: var(--slate-800);
}
.snd-title { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.snd-hrrr { flex: none; background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text); height: 30px; padding: 0 11px; border-radius: 7px; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: var(--font-mono); white-space: nowrap; }
.snd-hrrr:hover { background: var(--slate-600); border-color: #5dade2; color: #9ed2f5; }
.snd-hrrr:disabled { opacity: 0.6; cursor: default; }
.snd-title #snd-tail { font-weight: 700; font-size: 15px; color: var(--amber-bright);
  font-family: var(--font-mono); }
.snd-title .snd-sub { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snd-close { margin-left: auto; background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text); width: 30px; height: 30px; border-radius: 7px; font-size: 18px;
  cursor: pointer; line-height: 1; flex: none; }
.snd-close:hover { background: var(--slate-600); border-color: var(--amber-dim); }

.snd-body { flex: 1; overflow: auto; display: grid; align-content: start; justify-items: center; padding: 10px; background: #0e141b; }
.snd-body img { max-width: 100%; height: auto; border-radius: 6px; cursor: zoom-in; }
.snd-cross { position: fixed; height: 0; border-top: 1px dashed var(--amber-bright); z-index: 1600;
  pointer-events: none; display: none; opacity: 0.85; }
.snd-cross::after { content: ""; position: absolute; left: 50%; top: -3px; width: 6px; height: 6px;
  margin-left: -3px; border-radius: 50%; background: var(--amber-bright); }
.snd-readout { position: fixed; z-index: 1601; pointer-events: none; display: none;
  background: var(--slate-800); border: 1px solid var(--line-strong); border-radius: 7px;
  box-shadow: var(--bezel-shadow); padding: 7px 9px; font-family: var(--font-mono);
  font-size: 11px; color: var(--text); white-space: nowrap; line-height: 1.55; }
.snd-readout b { color: var(--amber-bright); }
.snd-readout .mut { color: var(--text-faint); }
#snd-hodo { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.snd-loading { color: var(--text-dim); font-family: var(--font-mono); font-size: 12.5px; text-align: center; }
.snd-loading .spinner { width: 26px; height: 26px; border: 3px solid var(--line-strong);
  border-top-color: var(--amber); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 10px; }
.snd-error { color: #e74c3c; font-family: var(--font-mono); font-size: 12.5px; text-align: center; padding: 20px; }

.snd-foot { padding: 9px 14px; border-top: 1px solid var(--line); background: var(--slate-800);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.snd-foot b { color: var(--text-dim); }

/* Warning under the sounding header (bad dewpoint, QC flags, missed launch).
   Its parent (.snd-sub) is a single nowrap/ellipsis line, so the note has to opt
   back into wrapping or long warnings get cut off mid-sentence. Red and briefly
   flashing so it's not mistaken for ordinary amber chrome, then it settles. */
.snd-note {
  display: block; margin-top: 6px;
  white-space: normal; overflow: visible; text-overflow: clip;
  color: #ff5c5c; font-family: var(--font-mono); font-size: 11.5px;
  font-weight: 700; letter-spacing: 0.2px; line-height: 1.45;
  background: rgba(255, 82, 82, 0.10); border: 1px solid rgba(255, 82, 82, 0.45);
  border-left: 3px solid #ff5c5c; border-radius: 5px; padding: 5px 8px;
  animation: noteFlash 1.1s ease-in-out 5;      /* catch the eye, then hold steady */
}
@keyframes noteFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; border-left-color: rgba(255, 92, 92, 0.25); }
}
@media (prefers-reduced-motion: reduce) { .snd-note { animation: none; } }
/* Informational tier: MADIS per-ob QC flags, "site did not launch". Worth
   knowing, not worth alarming over — red stays reserved for "this sensor is
   lying to you", so it keeps its meaning. */
.snd-note.info {
  color: var(--amber-bright); font-weight: 600;
  background: transparent; border: none; border-left: 2px solid var(--amber-dim);
  border-radius: 0; padding: 1px 0 1px 7px; animation: none;
}

@media (max-width: 640px) {
  #sndpanel { width: 100vw; }
}

/* "click for sounding" cue inside the obs hover tooltip */
.obs-tip .snd-cue { margin-top: 3px; color: var(--amber-bright); font-size: 10px;
  letter-spacing: 0.03em; }

/* ===========================================================================
   Sounding zoom lightbox (click the plot to enlarge / pan / zoom)
   ========================================================================== */
.snd-expand {
  background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text); width: 30px; height: 30px; border-radius: 7px;
  cursor: pointer; display: grid; place-items: center; flex: none; padding: 0;
}
.snd-expand:hover { background: var(--slate-600); border-color: var(--amber-dim); color: var(--amber-bright); }
.snd-expand svg { width: 16px; height: 16px; }

#sndzoom { position: fixed; inset: 0; z-index: 3000; display: none; background: rgba(6, 9, 13, 0.94); }
#sndzoom.open { display: block; }
#sndzoom .zwrap { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; }
#sndzoom .zwrap.grabbing { cursor: grabbing; }
#sndzoom img {
  position: absolute; top: 0; left: 0; transform-origin: 0 0;
  user-select: none; -webkit-user-drag: none; will-change: transform;
  image-rendering: auto; background: #0e141b; border-radius: 4px;
}
#sndzoom .zcap {
  position: absolute; top: 16px; left: 20px; z-index: 3010; pointer-events: none;
  font-family: var(--font-mono); color: var(--text); text-shadow: 0 1px 4px #000;
}
#sndzoom .zcap b { color: var(--amber-bright); font-size: 15px; }
#sndzoom .zcap span { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
#sndzoom .zbar { position: absolute; top: 14px; right: 16px; z-index: 3010; display: flex; gap: 8px; }
#sndzoom .zbtn {
  background: rgba(27, 35, 44, 0.92); border: 1px solid var(--line-strong); color: var(--text);
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 19px;
  display: grid; place-items: center; line-height: 1; backdrop-filter: blur(3px);
}
#sndzoom .zbtn:hover { background: var(--slate-700); border-color: var(--amber-dim); color: var(--amber-bright); }
#sndzoom .zhint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 3010;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
  background: rgba(16, 22, 29, 0.8); padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--line); pointer-events: none;
}

/* ===========================================================================
   Sounding tabs (switch between multiple soundings at one airport)
   ========================================================================== */
.snd-tabs { border-top: 1px solid var(--line); background: var(--slate-850);
  display: none; flex-direction: column; flex: none; }
.snd-tabs.show { display: flex; }
.snd-tabs-label { padding: 8px 12px 2px; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-dim); letter-spacing: 0.04em; }
.snd-tabs-label b { color: var(--amber-bright); }
.snd-tabs-row { display: flex; gap: 6px; overflow-x: auto; padding: 5px 10px 10px; scrollbar-width: thin; }
.snd-tabs-row::-webkit-scrollbar { height: 7px; }
.snd-tabs-row::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.snd-tab { flex: 0 0 auto; background: var(--slate-700); border: 1px solid var(--line-strong);
  color: var(--text-dim); border-radius: 7px; padding: 6px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; white-space: nowrap;
  display: flex; align-items: center; gap: 5px; transition: background 0.12s, border-color 0.12s; }
.snd-tab:hover { border-color: var(--amber-dim); color: var(--text); }
.snd-tab.active { background: rgba(255, 176, 0, 0.16); border-color: var(--amber); color: var(--amber-bright); }
.snd-tab .arr { font-size: 10px; opacity: 0.85; }

/* multi-sounding marker badge shows a count */
.snd-marker .badge.multi { background: var(--amber); color: var(--slate-900);
  font-size: 11px; font-weight: 800; }

/* at least one sounding at this airport carries a dewpoint profile */
.snd-marker .badge.wv {
  background: rgba(61, 220, 132, 0.18); border-color: var(--wv-green);
  color: var(--wv-green-bright); box-shadow: 0 0 8px var(--wv-green-glow);
}
.snd-marker .badge.wv.multi { background: var(--wv-green); color: var(--slate-900); }
.snd-marker:hover .badge.wv { background: var(--wv-green); color: var(--slate-900); }

/* water-vapor filter panel */
.wv-row { display: flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 12px; color: var(--text-dim, #9fb0c0); margin: 2px 0 5px; }
.wv-row input { accent-color: var(--wv-green); cursor: pointer; margin: 0; }
.wv-note { display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-faint, #74869a); }
.wv-key { width: 11px; height: 11px; border-radius: 50%; flex: none;
  background: rgba(61, 220, 132, 0.18); border: 1.5px solid var(--wv-green);
  box-shadow: 0 0 6px var(--wv-green-glow); }

.snd-tabs-hint { color: var(--text-faint); font-style: italic; }

/* ===========================================================================
   Archive (historical date) control in the header
   ========================================================================== */
.arc { display: flex; align-items: center; gap: 6px; margin-right: 4px; }
.arc-input {
  background: var(--slate-700); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 6px; padding: 5px 7px; font-family: var(--font-mono); font-size: 11px;
  color-scheme: dark;            /* dark native date picker */
}
.arc-input.arc-hour { width: 50px; text-align: center; }
.arc-input:focus { outline: none; border-color: var(--amber); }

.find { display: flex; align-items: center; gap: 6px; margin-right: 4px; }
.find-input { width: 96px; text-transform: uppercase; }
.find-input::placeholder { text-transform: none; letter-spacing: 0; }

/* floating aircraft-lookup box (top-left of the map, right of the zoom control) */
#find-box {
  position: absolute; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 1100;
  display: flex; align-items: center; gap: 7px;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 7px 9px;
}
#find-box .find-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  letter-spacing: 0.4px; text-transform: uppercase; white-space: nowrap; }
#find-id {
  width: 120px; background: var(--slate-700); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase;
}
#find-id::placeholder { text-transform: none; letter-spacing: 0; color: var(--text-faint); }
#find-id:focus { outline: none; border-color: var(--amber); }
#find-box .btn { padding: 5px 10px; font-size: 12px; }
#find-box .btn.find-clear { padding: 5px 8px; line-height: 1; }
/* highlighted aircraft track: bright amber, flashing */
@keyframes trackFlash { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.2; } }
.track-flash { animation: trackFlash 0.85s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .track-flash { animation: none; stroke-opacity: 1; } }
/* pulsing locator ring at the aircraft's most recent fix */
@keyframes findPulse { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
.find-pulse { position: relative; }
.find-pulse span { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; border: 2px solid var(--amber-bright, #ffcf4d); }
.find-pulse span.ring { animation: findPulse 1.3s ease-out infinite; }
.find-pulse span.core { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--amber-bright, #ffcf4d); border: none; }
.btn.live-btn { border-color: var(--amber-dim); color: var(--amber-bright); }
.btn.live-btn:hover { background: rgba(255, 176, 0, 0.14); }
.btn:disabled { opacity: 0.5; cursor: default; }
.readout .v.archive { color: var(--amber-bright); }
.win-select {
  background: var(--slate-700); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 6px; padding: 2px 4px; font-family: var(--font-mono); font-size: 12px;
  font-weight: 600; cursor: pointer; color-scheme: dark; margin-top: 1px;
}
.win-select:hover, .win-select:focus { outline: none; border-color: var(--amber); }
.auto-wrap { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.auto-lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-faint); }

/* ===========================================================================
   Sounding analysis (NSHARP-style parameter readout)
   ========================================================================== */
.snd-analysis { display: none; padding: 4px 12px 16px; }
.snd-analysis.show { display: block; }
.ana-group { margin-top: 12px; }
.ana-note { margin-top: 8px; padding: 7px 9px; border-radius: 7px;
  background: rgba(245, 166, 35, 0.10); border: 1px solid rgba(245, 166, 35, 0.30);
  font-size: 10.5px; line-height: 1.45; color: var(--text-dim); }
.ana-note b { color: var(--text); }
.ana-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--amber-bright); margin-bottom: 6px;
  border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.ana-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px 12px; }
.ana-cell { display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px; padding: 2px 0; }
.ana-k { color: var(--text-dim); white-space: nowrap; }
.ana-v { color: var(--text); font-weight: 600; text-align: right; white-space: nowrap; }
.ana-note { margin-top: 12px; font-size: 10px; color: var(--text-faint); font-style: italic; }

/* ===========================================================================
   Altitude filter (dual-handle range slider, floating top-left on the map)
   ========================================================================== */
#mapfilters {
  position: absolute; left: 14px; top: calc(var(--topbar-h) + 12px); z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}
.mapfilter {
  width: 212px;
  background: var(--slate-800); border: 1px solid var(--line-strong);
  border-radius: 9px; box-shadow: var(--bezel-shadow); padding: 10px 12px 8px;
  font-family: var(--font-mono); color: var(--text-dim);
}
.altf-top { display: flex; justify-content: space-between; align-items: center; }
.altf-title { font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--amber-bright); }
.altf-reset { background: none; border: 1px solid var(--line-strong); color: var(--text-dim);
  font-size: 9.5px; padding: 1px 7px; border-radius: 5px; cursor: pointer;
  font-family: var(--font-mono); line-height: 1.5; }
.altf-reset:hover { color: var(--text); border-color: var(--amber); }
.altf-val { font-size: 12px; color: var(--text); font-weight: 600; margin: 7px 0 9px;
  letter-spacing: 0.02em; }
.altf-val.on { color: var(--amber-bright); }
.altf-slider { position: relative; height: 22px; }
.altf-rail { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px;
  background: var(--line-strong); }
.altf-fill { position: absolute; top: 9px; height: 4px; border-radius: 2px;
  background: var(--amber); box-shadow: 0 0 6px rgba(255, 176, 0, 0.4); }
.altf-slider input[type=range] {
  position: absolute; left: 0; top: 0; width: 100%; height: 22px; margin: 0;
  -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none;
}
.altf-slider input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 22px; }
.altf-slider input[type=range]::-moz-range-track { background: transparent; height: 22px; }
.altf-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; height: 15px; width: 15px; margin-top: 3.5px;
  border-radius: 50%; background: var(--amber-bright); border: 2px solid #14100a; cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.altf-slider input[type=range]::-moz-range-thumb {
  pointer-events: auto; height: 15px; width: 15px; border-radius: 50%;
  background: var(--amber-bright); border: 2px solid #14100a; cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.altf-slider input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; }
.altf-scale { display: flex; justify-content: space-between; font-size: 9px;
  color: var(--text-faint); margin-top: 4px; }
.dens-tag { margin: 0; font-size: 11.5px; color: var(--amber-bright); }
@media (max-width: 720px) { .mapfilter { width: 170px; } }

/* ---- Text-data view of a sounding --------------------------------------- */
.snd-text { padding: 4px 2px 10px; }
.snd-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono);
  font-size: 12px; color: var(--text); }
.snd-table thead th { position: sticky; top: 0; background: var(--slate-800);
  color: var(--text-dim); font-weight: 600; text-align: right; padding: 6px 8px;
  border-bottom: 1px solid var(--line-strong); line-height: 1.15; }
.snd-table thead th span { color: var(--text-faint); font-weight: 400; font-size: 10px; }
.snd-table td { text-align: right; padding: 3px 8px; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums; }
.snd-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.snd-table tr.qcbad { background: rgba(255,92,92,0.12); }
.snd-table tr.qcbad td { color: #ff9a9a; }
.snd-table-foot { margin-top: 8px; font-family: var(--font-mono); font-size: 11px;
  color: var(--text-faint); }
.snd-table-foot .qcbad-key { color: #ff9a9a; }

/* ---- Penalty box (bad-dewpoint aircraft) -------------------------------- */
#find-box .find-sep { width: 1px; align-self: stretch; background: var(--line-strong); margin: 0 2px; }
#penalty-panel { position: absolute; top: calc(100% + 8px); right: 0; min-width: 340px;
  max-width: 440px; max-height: 60vh; overflow-y: auto; z-index: 1200;
  background: var(--slate-800); border: 1px solid var(--line-strong); border-radius: 9px;
  box-shadow: var(--bezel-shadow); padding: 10px 12px; font-family: var(--font-mono); }
.pen-h { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px;
  margin: 2px 0 6px; }
.pen-h.watch { margin-top: 12px; }
.pen-empty { color: var(--text-faint); font-size: 12px; line-height: 1.6; }
.pen-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 7px; border-radius: 6px;
  cursor: pointer; border: 1px solid transparent; }
.pen-row:hover { background: rgba(255,255,255,0.04); border-color: var(--line-strong); }
.pen-tail { font-size: 13px; font-weight: 700; color: #ff9a9a; white-space: nowrap; }
.pen-row.watch .pen-tail { color: var(--amber-bright); }
.pen-stat { font-size: 10.5px; color: var(--text-faint); flex: 1; line-height: 1.35; }
.pen-foot { margin-top: 10px; font-size: 10px; color: var(--text-faint); line-height: 1.5;
  border-top: 1px solid var(--line); padding-top: 8px; }

/* ---- Penalty box: clear controls ---------------------------------------- */
.pen-clear { margin-left: auto; background: transparent; border: 1px solid transparent;
  color: var(--text-faint); width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
  font-size: 12px; line-height: 1; flex: none; }
.pen-row:hover .pen-clear { color: var(--text-dim); border-color: var(--line-strong); }
.pen-clear:hover { color: #ff9a9a; border-color: #ff5c5c; background: rgba(255,92,92,0.12); }
.pen-clearall { display: block; margin-top: 8px; background: var(--slate-700);
  border: 1px solid var(--line-strong); color: var(--text-dim); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-family: var(--font-mono); font-size: 11px; }
.pen-clearall:hover { border-color: #ff5c5c; color: #ff9a9a; }

/* ---- Current AIRMETs & SIGMETs ------------------------------------------ */
#airsig-legend { position: absolute; left: 12px; bottom: 12px; z-index: 1100;
  background: var(--slate-800); border: 1px solid var(--line-strong); border-radius: 9px;
  box-shadow: var(--bezel-shadow); padding: 9px 11px; font-family: var(--font-mono);
  font-size: 11px; color: var(--text); max-width: 230px; }
#airsig-legend .asl-h { font-size: 10.5px; color: var(--amber-bright); text-transform: uppercase;
  letter-spacing: 0.4px; margin-bottom: 6px; }
#airsig-legend .asl-row { display: flex; align-items: center; gap: 7px; padding: 2px 0; color: var(--text-dim); }
#airsig-legend .asl-sw { width: 14px; height: 10px; border-radius: 2px; flex: none; opacity: 0.85; }
#airsig-legend .asl-foot { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line);
  font-size: 9.5px; color: var(--text-faint); line-height: 1.4; }
.airsig-popup .leaflet-popup-content { font-family: var(--font-mono); font-size: 12px; }
.airsig-popup .airsig-note { color: var(--text-faint); font-size: 10.5px; }
/* international SIGMETs name the phenomenon ("ERUPTION MT SEMERU", a cyclone's
   name); shown beside the hazard rather than buried in the raw bulletin */
.airsig-popup .airsig-qual { color: var(--amber-bright); font-size: 11px; }

/* ---- Stale-data banner (hosted resilience) ------------------------------ */
/* archive scope notice — same shape as the stale banner, amber not orange,
   and offset below it so both can show at once */
#arc-banner { position: fixed; top: calc(var(--topbar-h) + 8px); left: 50%;
  transform: translateX(-50%); z-index: 1249; background: rgba(255, 176, 0, 0.14);
  border: 1px solid rgba(255, 176, 0, 0.55); color: var(--amber-bright);
  border-radius: 8px; padding: 6px 14px; font-family: var(--font-mono);
  font-size: 12px; box-shadow: var(--bezel-shadow); pointer-events: none; }
#stale-banner ~ #arc-banner { top: calc(var(--topbar-h) + 44px); }

#stale-banner { position: fixed; top: calc(var(--topbar-h) + 8px); left: 50%;
  transform: translateX(-50%); z-index: 1250; background: rgba(255, 159, 67, 0.16);
  border: 1px solid rgba(255, 159, 67, 0.6); color: #ffcf9a; border-radius: 8px;
  padding: 6px 14px; font-family: var(--font-mono); font-size: 12px;
  box-shadow: var(--bezel-shadow); pointer-events: none; }
