:root {
  /* --accent is two things at once: (1) the "green" side of the
     highlight-callsign feature (pills/input border in
     #section-highlight, and the actual green aircraft icon/
     label/trail on the map — mapview.js's HIGHLIGHT_GREEN_HEX,
     hardcoded to match), and (2) had also been doing double duty as the
     generic "brand accent" for plain UI chrome (button hover, status-ok
     text, the clock, view-slot numbers, ...) that has nothing to do with
     the highlight feature. Neon green reads fine for (1) — it's a
     deliberate, meaningful color in a two-color (green/pink) highlight
     system — but was jarring for (2) once the sidebar went light, and a
     browser's own checkbox/radio accent-color is blue by default anyway,
     which this generic accent didn't match. --ui-accent below is the
     split-out version for (2); --accent stays untouched and keeps
     meaning "the green highlight" everywhere that's what it actually is. */
  --accent: #3bff00;
  --ui-accent: #2563eb;
  --bg: #eef0f3;
  --panel-bg: rgba(255, 255, 255, 0.97);
  --panel-border: #d7dbe2;
  --text: #1a1d23;
  --text-dim: #667085;
  --muted: #8a8a8a;
  /* Form fields / buttons / chips — previously plain dark hex literals
     inlined at each usage; pulled into named vars here since light mode
     needs a genuinely different value for all of them (a dark literal
     tuned to sit on a near-black panel doesn't have a light equivalent
     that falls out "for free" from just flipping --panel-bg). */
  --input-bg: #f3f4f6;
  --button-bg: #f3f4f6;
  --chip-bg: #e5e7eb;
  --control-bar-bg: rgba(255, 255, 255, 0.97);
  /* Default (non-highlighted, unknown-altitude) aircraft color — a
     light-medium neutral gray, not pure black: black silhouettes read
     fine against the light Positron basemap but nearly disappear against
     Dark Matter (the default basemap), which black-on-near-black is a
     bad match for. Gray holds up against both. In practice this is
     rarely seen at all — Color by altitude is always on now, so this
     only shows for aircraft with no altitude reading. */
  --ac-default: #b8c0cc;
  --danger: #dc2626; /* UI-chrome only (dropzone/mute-toggle borders, status-error text) — darker than a typical "danger red" since a lighter one loses too much contrast against the light panel */
  /* Airport pin: a neutral gray — deliberately desaturated so it never
     reads as traffic at a glance against the default black aircraft
     fill, the green/pink highlight colors, or the altitude-color
     gradient (which ranges blue at ground level through amber to red —
     the old blue pin here used to land almost exactly on that gradient's
     low end). Gray also holds up against both light and dark basemap
     tiles, unlike a fully saturated color tuned for just one. */
  --airport-pin: #9ca3af;
  --airport-pin-primary: #ff3ec8; /* the one airport actually searched for, vs. every other nearby one */
  --highlight-pink: #ff2ec0; /* second highlight color (traffic-alert style) — keep in sync with HIGHLIGHT_PINK_HEX in mapview.js */
  --panel-width: 340px;
  --waveform-bar-height: 48px;
  --data-bar-height: 22px;
  --media-bar-height: 44px;
  --bottom-timeline-height: calc(var(--data-bar-height) + var(--waveform-bar-height));
  /* #bottom-bars's fixed height (timeline + transport bar, now spanning
     the full width — Highlight callsign moved into the sidebar, see
     #section-highlight) — what the map's zoom control, the attribution
     footer, and the sidebar's own bottom padding all clear. */
  --bottom-bars-height: calc(var(--bottom-timeline-height) + var(--media-bar-height));
  /* User-adjustable display scale (Settings > Aircraft display sliders,
     wired in main.js) — multiplies the base sizes below, doesn't replace
     them. Kept in sync with each slider's own default `value` in
     index.html (only synced on the slider's `input` event, not on load,
     so these have to actually match rather than just being "1" for
     "unscaled"). Highlighted aircraft get their own independent pair so
     a highlighted aircraft can be made to stand out without touching
     everything else's size — see .ac-icon.highlighted-* below. */
  --ac-icon-scale: 0.6;
  --ac-label-scale: 0.9;
  --ac-icon-scale-highlight: 0.6;
  --ac-label-scale-highlight: 0.9;
  /* Same pattern as the aircraft scales above (Settings > Map & view >
     Caption size, wired in main.js) — multiplies #caption-overlay-text's
     base font-size. Kept in sync with #caption-size's own default
     `value` in index.html, same reason as the aircraft scales above. */
  --caption-font-scale: 1.5;
}

* { box-sizing: border-box; }

/* Native checkbox/radio tick color — browsers default this to their own
   system blue regardless of page theme; setting it explicitly keeps it
   exactly matching --ui-accent instead of an unrelated blue. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--ui-accent); }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#app { position: relative; width: 100%; height: 100%; }

/* right: var(--panel-width) (not inset:0/right:0) so the Leaflet
   container's actual box excludes the sidebar instead of just being
   overlaid by it — that's what makes Leaflet's own notion of "center"
   (setView, cursor-anchored zoom, getCenter, ...) match the visibly
   uncovered map area, and differ between sidebar shown/hidden, the same
   way #caption-overlay below mirrors this same right value. Toggling
   panel-hidden/presentation changes this value; main.js calls
   mapView.invalidateSize() after the transition so Leaflet picks up the
   new size. */
#map {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: var(--panel-width);
  background: #0b0d12;
  transition: right 0.15s ease;
}
body.panel-hidden #map { right: 0; }

/* ---- Overlay (top-left clock / highlight readout) ---- */
#overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 900;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

#clock-readout {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 22px;
  display: flex;
  gap: 14px;
  align-items: baseline;
}
#utc-clock { color: var(--ui-accent); font-weight: 600; }

#highlight-readout {
  margin-top: 6px;
  color: var(--accent);
  font-size: 16px;
}

/* ---- Caption overlay (subtitle-file feature) ----
   Sits over the map like a video player's captions, timed against audio
   elapsed time — see main.js's updateCaptionOverlay. Burned into the
   map itself (not a separate track) deliberately: a screen recording
   made from this app can skip through silent gaps (see the "next
   transmission" skip button), which desyncs any *externally* re-applied
   .srt from the recording's own timeline — captions rendered live off
   the same playback.currentTime driving everything else never have that
   problem, since whatever moment ends up on screen always shows its own
   correct line. Pinned to the *top* of the map (not bottom) so it stays
   clear of a video player's own bottom-docked scrub bar/controls once a
   recording of this is uploaded elsewhere (e.g. YouTube) — the bottom
   edge is exactly where a viewer's playback chrome shows up. Spans
   exactly the visible map area (mirrors #map's own `right`/panel-hidden-
   collapses-to-0 above) and centers its bubble inside that with flex,
   instead of centering against the whole viewport — otherwise the
   caption sits off-center relative to the map whenever the sidebar is
   open. */
#caption-overlay {
  position: absolute;
  left: 0;
  right: var(--panel-width);
  top: 64px;
  z-index: 900;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transition: right 0.15s ease;
}
body.panel-hidden #caption-overlay { right: 0; }
#caption-overlay-text {
  /* max-width has no effect on a plain inline element (the browser
     silently ignores it) — without this, a long line never wrapped, it
     just overflowed rightward past the viewport, invisible in normal
     use but sliced off wherever a screen recording's crop happened to
     land. */
  display: inline-block;
  max-width: min(70%, 720px);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: calc(18px * var(--caption-font-scale));
  line-height: 1.4;
  text-align: center;
  padding: 8px 16px;
  border-radius: 6px;
}

/* ---- Attribution footer ---- */
/* Legally required credit, not a UI element worth drawing attention to —
   no border/background, barely-there until you go looking for it. Was
   styled like an accent-green badge before, which fought with the app's
   actual highlight color for attention. Sits over the *map* (dark
   basemap), not the light sidebar, so it's a light color, not
   --text-dim — that's tuned for the light sidebar background and was
   near-illegible against the dark map underneath this. */
#attribution-footer {
  position: absolute;
  bottom: 6px;
  left: 16px;
  z-index: 900;
  font-size: 11px;
  color: #fff;
  opacity: 0.6;
  pointer-events: none;
}

/* ---- Top-right controls (ingest link, presentation toggle) ---- */
#top-right-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}
#top-right-controls a,
#top-right-controls button {
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  line-height: 1.4;
}
#top-right-controls a:hover,
#top-right-controls button:hover { border-color: var(--ui-accent); }

/* ---- Control panel ---- */
#panel {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--panel-width);
  height: 100%;
  overflow-y: auto;
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  padding: 56px 16px 16px;
  z-index: 950;
  font-size: 13px;
}

.panel-section {
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.panel-section h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* Settings groups: collapsible <details> — a border-top divider + dim
   uppercase-ish label per group, same visual weight .panel-section h3
   above uses, but click-to-expand. Settings has enough distinct groups
   (map/view, aircraft & labels, airport overlay, filters, layers) that
   showing every control in all of them at once reads as cluttered.
   Rarely-touched groups start closed; open/close state itself is never
   read by JS (purely presentational — every control inside still works
   identically whether its group is open or closed). */
#section-settings details {
  margin: 14px 0 0;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}
#section-settings details:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }
#section-settings summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
#section-settings summary::-webkit-details-marker { display: none; }
#section-settings summary:hover { color: var(--text); }
#section-settings summary::before {
  content: '▸';
  display: inline-block;
  font-size: 9px;
  color: var(--text-dim);
  transition: transform 0.15s ease;
}
#section-settings details[open] > summary::before { transform: rotate(90deg); }
#section-settings details > summary + * { margin-top: 10px; }

.filter-range-row { margin-bottom: 10px; }
.filter-range-inputs { display: flex; align-items: center; gap: 6px; }
.filter-range-inputs input { width: 0; flex: 1; text-align: center; }
.filter-range-inputs span { color: var(--text-dim); }

.dropzone {
  border: 1px dashed var(--panel-border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--ui-accent); }
.dropzone.loaded { border-style: solid; border-color: var(--ui-accent); }
/* Sync error (log/audio don't overlap) wins over the plain "loaded"
   green border — same signal as the sync-offset-readout text, but much
   harder to miss right where the files were just dropped. */
.dropzone.sync-error { border-style: solid; border-color: var(--danger); }
.dropzone .dz-label { font-weight: 600; }
.dropzone .dz-hint { color: var(--text-dim); font-size: 11px; font-style: italic; }
.dropzone .dz-status { color: var(--text-dim); font-size: 12px; }
.dropzone input[type="file"] { display: none; }

/* Small spinner shown in the "Traffic:" status line while a DB coverage
   check or query is actually in flight (main.js sets this class only
   for those transitional messages — "Checking…"/"Fetching…" — and every
   terminal state after it, success or error, fully reassigns className
   without it, so this disappears on its own once the request settles). */
.dz-status.dz-loading::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid var(--panel-border);
  border-top-color: var(--ui-accent);
  border-radius: 50%;
  animation: atsee-spin 0.7s linear infinite;
}
@keyframes atsee-spin { to { transform: rotate(360deg); } }

.field-label { display: block; margin: 8px 0 4px; color: var(--text-dim); }
.size-slider { display: block; width: 100%; margin-bottom: 4px; }

/* Settings > Aircraft display: two boxed groups (Normal / Highlighted),
   same boxed-subpanel treatment as #section-airport-inline so each reads
   as one coherent unit rather than a loose pile of sliders. The
   highlighted group gets an accent-colored left edge + title so it's
   visually distinct at a glance from the normal one right above it —
   these two are easy to mix up otherwise since every control inside is
   named identically save for "highlight". */
.aircraft-display-group {
  background: rgba(0, 0, 0, 0.035);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}
.aircraft-display-group .field-label:first-of-type { margin-top: 0; }
/* Small dim uppercase label naming a boxed group — reused wherever a box
   needs a "what is this" title without a full h4 (Aircraft display's
   Normal/Highlighted, Load files' Airport/Audio). */
.field-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.aircraft-display-group-highlight {
  border-left: 3px solid var(--ui-accent);
}
.aircraft-display-group-highlight .field-group-title { color: var(--ui-accent); }

/* Airport lookup nested inside "Load files", first — before the audio
   dropzone, since this input (Enter/Lookup) is the one authoritative way
   the airport gets set (see doIcaoLookup/applyAirport in main.js).
   Dropping an mp3 only cross-checks its filename against whatever's set
   here (or pre-fills this field if it's still empty) — it never sets the
   airport on its own. Boxed distinctly so it doesn't read as just
   another dropzone. */
#section-airport-inline {
  background: rgba(0, 0, 0, 0.035);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}
#section-airport-inline .field-label:first-of-type { margin-top: 0; }

#sync-readout, #info-readout {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
  word-break: break-word;
}
#sync-readout span, #info-readout span { color: var(--text); }
#sync-readout span.status-error { color: var(--danger); }

#panel select {
  display: block;
  width: 100%;
  margin: 4px 0 6px;
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 4px;
  padding: 5px 6px;
  font-family: inherit;
  font-size: 12.5px;
}
input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 4px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12.5px;
}

/* ---- Highlight callsign: two-color multi-select pills ----
   #highlight-input is a plain text field for typing (always adds to
   green); .highlight-tags-group are two distinct boxes below it holding
   already-committed pills, color-bordered so each visibly reads as its
   own "active selection" — separate from the box you're still typing
   into, and from each other. Pills are draggable between the two. */
#section-highlight:has(#highlight-tags-green:not(.hidden)) #highlight-input-green { border-color: var(--accent); }
#section-highlight:has(#highlight-tags-pink:not(.hidden)) #highlight-input-pink { border-color: var(--highlight-pink); }
.highlight-tags-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  border-radius: 4px;
  padding: 6px;
  border: 1px solid;
}
.highlight-tags-group.hl-green { border-color: var(--accent); background: rgba(59, 255, 0, 0.06); }
.highlight-tags-group.hl-pink { border-color: var(--highlight-pink); background: rgba(255, 46, 192, 0.06); }
.highlight-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--chip-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11.5px;
  white-space: nowrap;
  cursor: grab;
}
.highlight-pill-text:hover { text-decoration: underline; }
.highlight-pill-x { color: var(--text-dim); cursor: pointer; }
.highlight-pill-x:hover { color: var(--text); }
.highlight-clear-btn {
  margin-left: auto; /* pinned to the row's right edge regardless of pill count */
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  padding: 1px 4px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-dim);
}
.highlight-clear-btn:hover { color: var(--text); }

button {
  background: var(--button-bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12.5px;
}
button:hover { border-color: var(--ui-accent); }
button.active, .speed-btn.active { border-color: var(--ui-accent); color: var(--ui-accent); }
button:disabled, input:disabled { opacity: 0.4; cursor: not-allowed; }
button:disabled:hover { border-color: var(--panel-border); }

.hidden { display: none !important; }

#mute-toggle.active { border-color: var(--danger); color: var(--danger); }

.status-ok { color: var(--ui-accent); }
.status-error { color: var(--danger); }

.icao-lookup-row { display: flex; gap: 6px; }
.icao-lookup-row input { flex: 1; text-transform: uppercase; }
#icao-lookup-status { display: block; margin: 4px 0 10px; font-size: 12px; min-height: 1.4em; }

/* The transport bar spans the full width at the very bottom (map and
   sidebar both), so the sidebar's own content needs this bottom padding
   to keep scrolling clear of it instead of running underneath — the
   bottom bar's z-index (1100) is already above the sidebar's (950), so
   without this the last bit of sidebar content would render, just
   covered. */
body.has-bottom-bar #panel { padding-bottom: calc(var(--bottom-bars-height) + 16px); }
body.has-bottom-bar .leaflet-bottom { bottom: var(--bottom-bars-height); }
body.has-bottom-bar #attribution-footer { bottom: calc(var(--bottom-bars-height) + 6px); }

.coarse-row { display: flex; gap: 6px; margin-top: 6px; }
.coarse-row button { flex: 1; }

.view-slots { margin-top: 6px; }
.view-slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 4px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  cursor: pointer;
}
.view-slot-row:hover { border-color: var(--ui-accent); }
.view-slot-row:first-child { margin-top: 0; }
.view-slot-label {
  width: 16px;
  flex-shrink: 0;
  color: var(--ui-accent);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.view-slot-summary {
  color: var(--text-dim);
  font-size: 12px;
  font-family: monospace;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.view-slot-row.view-slot-empty { cursor: default; }
.view-slot-row.view-slot-empty:hover { border-color: var(--panel-border); }

kbd {
  display: inline-block;
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 11px;
  font-family: monospace;
}
.coarse-row input[type="number"] { flex: 1.2; min-width: 0; text-align: center; }

#section-settings label { display: block; margin-bottom: 6px; cursor: pointer; }

/* ---- Control panel show/hide (hamburger toggle) ----
   The setup sidebar (#panel — now including Highlight callsign, section
   3) and the two links beside the hamburger hide; #media-bar is a
   sibling of #panel, not nested in it, so it stays usable regardless —
   that's the one control you reach for constantly during playback. */
body.panel-hidden #panel { display: none; }
body.panel-hidden #ingest-link,
body.panel-hidden #presentation-toggle { display: none; }

/* Zoom control (+/-) sits bottom-right of the map. No horizontal offset
   of its own needed any more — Leaflet's own default (right: 0) already
   sits it flush against #map's right edge, and #map's own box now ends
   before the sidebar (see #map above), sliding the control along with it
   for free. The vertical offset that clears the transport bar is set
   earlier (body.has-bottom-bar .leaflet-bottom), since #map's height
   isn't resized. */

/* ---- Presentation mode: hide chrome ---- */
body.presentation #panel,
body.presentation #top-right-controls {
  display: none;
}
body.presentation #map { right: 0; }
body.presentation .leaflet-control-zoom { display: none; }
/* #bottom-bars (data/waveform/media bar, including #record-toggle) also
   hides here — a running recording is still stoppable via the browser's
   own "Stop sharing" indicator, which fires the same 'ended' handler our
   button's click does (see main.js's startRecording). */
body.presentation #bottom-bars { display: none; }
body.presentation.has-bottom-bar #panel { padding-bottom: 16px; }
body.presentation.has-bottom-bar .leaflet-bottom { bottom: 0; }
body.presentation.has-bottom-bar #attribution-footer { bottom: 6px; }

/* ---- Bottom bars: data timeline (log's own position) stacked on top of
   the audio waveform and the transport bar, to the left; the Highlight
   callsign column, same width as the sidebar, docked beside it, full
   height. Fixed full-width at the very bottom of the viewport, hidden in
   presentation mode along with the rest of the UI chrome. data-bar/
   waveform-bar show/hide independently (data-bar needs only a log;
   waveform-bar needs audio) — the transport bar is always present
   whenever anything is loaded, so the timeline column's rendered height
   only ever shrinks by however much of the optional pair is missing.
   ---- */
#bottom-bars {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  z-index: 1100;
  display: flex;
  /* Fixed height (not auto) is the point here: it caps #bottom-controls-
     highlight at exactly this height regardless of how much Highlight
     callsign content is in it (pills, checkboxes, ...) — that column
     scrolls internally past this instead of growing the bar and eating
     into the map, which needs to stay untouched for screen recording. */
  height: var(--bottom-bars-height);
}
#bottom-bars-timeline {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* When data-bar or waveform-bar is missing (log-only or audio-only
     load), pack from the bottom so #media-bar — always present — stays
     flush against the true bottom edge instead of floating above a gap;
     any slack lands above data-bar/waveform-bar instead. */
  justify-content: flex-end;
  /* Fills that same leftover space visually — the column is still
     stretched to the full fixed bar height, so this keeps the gap
     reading as bar rather than a see-through hole into the map. */
  background: var(--control-bar-bg);
}
#data-bar {
  position: relative;
  height: var(--data-bar-height);
  background: var(--control-bar-bg);
  border-top: 1px solid var(--panel-border);
  cursor: pointer;
  user-select: none;
}
#data-bar-canvas { display: block; width: 100%; height: 100%; }
#data-bar-status {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text);
  pointer-events: none;
}
#waveform-bar {
  position: relative;
  height: var(--waveform-bar-height);
  background: var(--control-bar-bg);
  border-top: 1px solid var(--panel-border);
  cursor: pointer;
  user-select: none;
}
#waveform-canvas { display: block; width: 100%; height: 100%; }
#waveform-status {
  position: absolute;
  top: 6px;
  left: 12px;
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
}

/* ---- Highlight callsign: now section 3 in the sidebar (#section-highlight,
   .panel-section — see index.html), not a separately-docked bottom column
   — that freed up #bottom-controls-highlight's width for the bottom bar
   (data-bar/waveform-bar/media-bar) to stretch full-width instead. Sidebar
   scrolling (#panel { overflow-y: auto } + the has-bottom-bar padding
   below) already keeps this section from ever sitting under the bottom
   bar, same as every other sidebar section. */
/* Green group on the left, pink on the right — side by side rather than
   stacked, so which callsigns are in which group reads at a glance
   without scrolling past one to see the other. Each column keeps a
   faint permanent tint (not just once it holds pills) so the L/R
   green/pink split is visible immediately, before typing anything. */
#highlight-columns {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.highlight-column {
  flex: 1;
  min-width: 0;
  padding: 6px;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
  /* Keeps a visible drop target below the input even with zero pills —
     #highlight-tags-green/-pink is display:none until the first term is
     added (see syncHighlight's `hidden` toggle), so without this the
     column would shrink to hug the input with nowhere to drop onto. */
  min-height: 60px;
}
.highlight-column-green { border-color: rgba(59, 255, 0, 0.3); background: rgba(59, 255, 0, 0.04); }
.highlight-column-pink { border-color: rgba(255, 46, 192, 0.3); background: rgba(255, 46, 192, 0.04); }
.highlight-column input[type="text"] { margin-bottom: 0; }

/* ---- Flash callsign: same two-column pill layout as #highlight-columns
   above, reusing its generic .highlight-column/.highlight-tags-group/
   .highlight-pill/.highlight-clear-btn classes — just its own pair of
   tint colors (not the green/pink highlight-brand ones, which stay
   reserved for the map highlight feature). "In Highlight" uses
   --ui-accent (generic UI blue); "Traffic alert" uses the same amber
   .subtitle-flagged's blink and the ingest-coverage circle use, since
   both are "flagged for attention" concepts. */
#subtitle-flag-columns { display: flex; gap: 8px; margin-bottom: 6px; }
.subtitle-flag-column-highlight { border-color: rgba(37, 99, 235, 0.3); background: rgba(37, 99, 235, 0.04); }
.subtitle-flag-column-alert { border-color: rgba(255, 179, 71, 0.4); background: rgba(255, 179, 71, 0.06); }
#section-highlight:has(#subtitle-flag-tags-highlight:not(.hidden)) #subtitle-flag-input-highlight { border-color: var(--ui-accent); }
#section-highlight:has(#subtitle-flag-tags-alert:not(.hidden)) #subtitle-flag-input-alert { border-color: #ffb347; }
.highlight-tags-group.sf-highlight { border-color: var(--ui-accent); background: rgba(37, 99, 235, 0.06); }
.highlight-tags-group.sf-alert { border-color: #ffb347; background: rgba(255, 179, 71, 0.08); }

/* ---- Media bar: compact playback-controls strip, music-player style —
   one row spanning the full width, flush along the very bottom. ---- */
#media-bar {
  position: relative;
  height: var(--media-bar-height);
  background: var(--control-bar-bg);
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}
#media-bar-left {
  min-width: 140px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#media-bar-left #utc-clock { color: var(--ui-accent); font-weight: 600; font-size: 13px; }
#media-bar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
#media-bar-center button {
  padding: 5px 8px;
  font-size: 11px;
  white-space: nowrap;
}
#media-bar-center #play-pause {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Record button: icon-only (no text), a plain red dot at rest — the
   familiar record-button shape apps use — that turns into a rounded red
   square (stop) and pulses once recording starts. Wrapped in
   #record-btn-wrap so #record-status can float above it as a tooltip-like
   label (position: absolute, out of flow) instead of taking up row space
   and shifting the other transport buttons. */
#record-btn-wrap { position: relative; display: inline-flex; }
/* Scoped via the wrapper (not a bare #record-toggle rule) so this beats
   #media-bar-center button's padding/font-size above on specificity —
   an id+id selector outranks that rule's id+element one. */
#record-btn-wrap #record-toggle {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#record-toggle::before {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--danger);
  transition: border-radius 0.15s ease;
}
#record-toggle.active {
  border-color: var(--danger);
  animation: atsee-record-pulse 1.4s ease-in-out infinite;
}
#record-toggle.active::before { border-radius: 3px; }
@keyframes atsee-record-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
#record-status {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 10px;
  color: var(--text-dim);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
}
#record-status:empty { display: none; }

#media-bar-right { display: flex; align-items: center; gap: 6px; position: relative; min-width: 140px; justify-content: flex-end; }
#offset-gear-btn { font-size: 14px; padding: 5px 8px; }

/* ---- Manual offset popover (opens above the gear button) ---- */
#offset-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  font-size: 12.5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 1200;
}
#offset-popover h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }

/* ---- Airport pin + range rings ---- */
.airport-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer; /* click opens the name/state popup — see MapView.setAirportPins */
}
.airport-pin-svg {
  width: 100%;
  height: 100%;
  fill: var(--airport-pin);
  /* stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 0.6px; */
}
.airport-icon-primary .airport-pin-svg { fill: var(--airport-pin-primary); }

/* Leaflet's popup chrome defaults to a white/black light theme —
   override to match the app. */
.leaflet-popup-content-wrapper {
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.leaflet-popup-content { margin: 8px 12px; font-size: 12.5px; line-height: 1.5; }
.leaflet-popup-tip { background: var(--panel-bg); border: 1px solid var(--panel-border); }
.leaflet-popup-close-button { color: var(--text-dim) !important; }
.airport-popup strong { color: var(--airport-pin); }

.range-ring-label {
  font-size: 10px;
  color: #8fb8ff;
  background: rgba(0, 0, 0, 0.5);
  padding: 0 4px;
  border-radius: 3px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.ingest-coverage-label {
  font-size: 10px;
  font-weight: 600;
  color: #ffb347;
  background: rgba(0, 0, 0, 0.5);
  padding: 0 4px;
  border-radius: 3px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

/* Mimics a real taxiway ID sign (black-on-yellow), placed at the ref'd
   OSM taxiway segment's midpoint — see buildTaxiwaySignPositions in
   mapview.js. */
.taxiway-sign {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #000;
  background: #f2c14e;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

/* Runway end numbers — white on red like a runway holding-position sign —
   placed just past each runway end (buildRunwayEndLabels in mapview.js).
   iconSize:null lets the box size to the text; the transform centers it on
   the point. Hidden when zoomed out far enough that they'd pile up. */
.runway-label {
  width: auto !important;
  height: auto !important;
  transform-origin: center;
  translate: -50% -50%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #c8102e;
  padding: 2px 3px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}
.runway-labels-hidden .runway-label,
.taxiway-labels-hidden .taxiway-sign {
  display: none;
}

/* ---- Aircraft icon ---- */
.ac-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
/* .ac-icon is a column flex container (see above), and `height: 100%` on
   a flex item's main axis doesn't resolve against the container the way
   it would in normal block layout — it used to work here only because
   the old inline <svg> child was a replaced element with its own
   intrinsic-size fallback; the new mask <div> has no such fallback and
   collapsed to 0 height (invisible) with the same CSS. flex-basis
   percentages, unlike plain height percentages, resolve reliably against
   a flex container's own (here: definite, from Leaflet's iconSize)
   height, so this now actually fills the icon's square regardless of
   what's inside it. */
.ac-plane { flex: 0 0 100%; min-height: 0; width: 100%; transition: transform 0.05s linear; }
/* The actual icon (icons/aircraft/*.svg — see aircraft-visuals.js's
   resolveAircraftIcon) is applied as a CSS mask, not inlined as SVG
   markup: every bundled icon is a flat single-color silhouette, so
   masking lets background-color recolor it per-aircraft (altitude ramp,
   highlight state) via plain JS style writes, exactly like the fill
   swaps below used to work on an inline <svg>, without needing to fetch
   or mutate the icon files themselves. mask-image itself is set inline
   per-marker in icons.js (buildAircraftIconHtml), since it varies by
   aircraft type. */
.ac-plane-svg {
  width: 100%;
  height: 100%;
  background-color: var(--ac-default);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  transform: scale(calc(1.5 * var(--ac-icon-scale)));
}
.ac-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  font-size: calc(14px * var(--ac-label-scale));
  /* Fixed light color, NOT var(--text) — this sits on its own dark
     semi-transparent pill (background below) regardless of the sidebar's
     light/dark theme, so it needs to stay light-on-dark independent of
     what --text currently means for the (now light) sidebar. Using
     --text here was the actual bug behind "labels are unreadable" once
     --text flipped dark for the light sidebar theme: dark text on this
     same dark pill. */
  color: #e8e8e8;
  background: rgba(0, 0, 0, 0.55);
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  transform: translateY(0);
}
/* em, not calc(12px * var(--ac-label-scale)) directly: this way it just
   follows whatever font-size .ac-label itself resolves to (base or the
   highlighted override below) instead of needing its own duplicate
   override per state. 12/14 = the same ratio the old calc() produced. */
.ac-label-details { font-size: 0.857em; opacity: 0.85; }

.ac-icon.highlighted-green .ac-plane-svg,
.ac-icon.highlighted-pink .ac-plane-svg {
  opacity: 1;
  transform: scale(calc(1.5 * var(--ac-icon-scale-highlight)));
  transform-origin: 50% 50%;
}
.ac-icon.highlighted-green .ac-plane-svg { background-color: var(--accent); }
.ac-icon.highlighted-pink .ac-plane-svg { background-color: var(--highlight-pink); }
.ac-icon.highlighted-green .ac-label,
.ac-icon.highlighted-pink .ac-label {
  font-size: calc(14px * var(--ac-label-scale-highlight));
}
.ac-icon.highlighted-green .ac-label { color: var(--accent); font-weight: 600; }
.ac-icon.highlighted-pink .ac-label { color: var(--highlight-pink); font-weight: 700; text-shadow: 0 0 2px rgba(0,0,0,0.8); }
/* Muted (a highlight is active, this isn't it): dim the same visible
   default color rather than switching to gray — keeps it readable
   against the map while still reading as clearly secondary. */
.ac-icon.muted .ac-plane-svg { opacity: 0.55; }
.ac-icon.muted .ac-label { color: var(--muted); opacity: 0.6; }
.ac-icon.stale { opacity: 0.4; }

/* Brief attention-flash (click a pill's text, or click an already-
   highlighted aircraft) — fast blink, doesn't touch highlight color. */
@keyframes atsee-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }
.ac-icon.flashing .ac-plane-svg { animation: atsee-flash 0.3s linear infinite; }
.ac-icon.flashing:not(.highlighted-green):not(.highlighted-pink) .ac-plane-svg { background-color: var(--highlight-pink); }

/* Subtitle callsign flag (Callsigns to flag input): the exact same
   opacity-blink effect as .flashing above (click-to-flash), just driven
   continuously by main.js's per-frame mapView.setSubtitleFlagTerms
   instead of a fixed-duration click response. Deliberately no color
   override, unlike .flashing's non-highlighted case — this blinks
   whatever color the aircraft already has (altitude color, or the
   highlight green/pink if it's also highlighted), never substituting a
   flash color of its own. */
.ac-icon.subtitle-flagged .ac-plane-svg { animation: atsee-flash 0.3s linear infinite; }
