:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a63; /* darkened from #898781: that was 3.5:1 on --surface, fails WCAG AA's 4.5:1 for normal text. Dark theme's --muted is unchanged, already passes at 4.85:1. */
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --wash: rgba(11, 11, 11, 0.05);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --tooltip-bg: #ffffff;
  --shadow: 0 6px 24px rgba(11, 11, 11, 0.12);
  /* Flight markers: deliberately outside the series-1..6 hue family so they read as an
     annotation layer, not a 4th/5th data series. */
  --flight-arrival: #7c6fd1;
  --flight-departure: #0e8f8f;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --wash: rgba(255, 255, 255, 0.06);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --tooltip-bg: #242423;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    --flight-arrival: #a79ef0;
    --flight-departure: #2dd4d4;
  }
}

.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;
}

/* The browser's own [hidden] default is a normal-priority UA-stylesheet rule, so it loses to
   ANY author rule that sets display on the same element (e.g. .seg's display: inline-flex on
   #flights-group / #typical-group) regardless of selector specificity — author rules always
   beat user-agent rules at equal importance. Reasserted here so el.hidden = true actually
   hides things everywhere on the page, not just where no other rule happens to set display. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 28px clamp(16px, 4vw, 48px) 40px;
  max-width: 1180px;
  margin-inline: auto;
}
h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.125rem; font-weight: 600; margin: 0; }
.sub { color: var(--ink-2); margin: 2px 0 0; font-size: 0.9375rem; }
a { color: inherit; text-decoration-color: var(--muted); }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.source-line { margin: 0; color: var(--ink-2); font-size: 0.9375rem; text-align: right; }
.source-line .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--status-good); margin-right: 6px; vertical-align: 1px;
}
.source-line .dot.bad { background: var(--status-critical); }
.source-line .dot.stale { background: var(--status-warning); }
/* Same content as the header's source-line, rendered a second time so it can sit below the
   tiles on mobile instead of the header — the header and the tiles section aren't siblings
   in a layout flex/grid `order` could reorder across. Only one of the two is ever visible;
   see the max-width media query below. */
.source-line-mobile { display: none; text-align: left; margin: 2px 0 18px; }

/* Stat tiles */
.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px;
  margin-bottom: 18px;
}
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px 14px; display: grid; gap: 6px;
  border-top: 3px solid var(--lot-color, var(--axis));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tile-stale .tile-mid, .tile-stale .meter, .tile-stale .hour-bars { opacity: 0.5; }
.stale-note {
  display: flex; gap: 8px; align-items: flex-start; font-size: 0.875rem; line-height: 1.35; color: var(--ink-2);
  padding: 6px 10px; border-radius: 8px;
  background: color-mix(in oklab, var(--status-warning) 14%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--status-warning) 45%, var(--surface));
}
.stale-note.stale-offline {
  background: color-mix(in oklab, var(--status-critical) 10%, var(--surface));
  border-color: color-mix(in oklab, var(--status-critical) 40%, var(--surface));
}
.stale-note .glyph { flex: none; font-size: 0.875rem; line-height: 1.35; }
.stale-note strong { display: block; color: var(--ink); font-weight: 600; }
.tile .label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: 0.9375rem; }
.tile .detail { color: var(--ink-2); font-size: 0.875rem; display: flex; justify-content: space-between; gap: 8px; }
.tile .info {
  color: var(--muted); font-size: 0.875rem; margin: 6px 0 0; padding-top: 6px;
  border-top: 1px solid var(--border); display: grid; gap: 2px;
}
/* Middle row: ring | free-of-total count | trend. */
.tile-mid { display: flex; align-items: center; gap: 12px; margin: 2px 0; }
.tile-ring { flex: none; }
.tile-value { flex: 1; min-width: 0; }
.tile-value .value-main { display: block; font-size: 2.375rem; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
.tile-value .value-main small { display: block; font-size: 0.9375rem; font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-top: 2px; }
.tile-trend { flex: none; }
/* Direction is carried by glyph shape + word, not color, so contrast holds in both themes. */
.tile .trend { display: flex; align-items: center; gap: 4px; font-size: 0.875rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tile .trend-steady { font-weight: 500; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.875rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; color: var(--ink);
  background: color-mix(in oklab, var(--chip-color) 18%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--chip-color) 45%, var(--surface));
}
.chip .glyph { color: var(--chip-color); font-size: 0.8125rem; }
.meter { height: 6px; border-radius: 3px; background: color-mix(in oklab, var(--chip-color) 22%, var(--surface)); overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; background: var(--chip-color); border-radius: 3px; }
.ring-track { fill: none; stroke: var(--grid); stroke-width: 8; }
.ring-value { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray 0.3s ease; }
.ring-label { fill: var(--ink); font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.hour-bars {
  display: flex; align-items: flex-end; gap: 2px; height: 40px; margin-top: 4px;
  border-bottom: 1px solid var(--border); padding-bottom: 1px;
}
.hour-bars .bar { flex: 1; background: var(--lot-color, var(--axis)); border-radius: 1px 1px 0 0; min-height: 2px; opacity: 0.7; }
.hour-bars .bar-empty { background: var(--grid); opacity: 1; }

/* Where to park: the one-line answer and the When picker above the tiles */
.plan-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 12px; }
.verdict { margin: 0; flex: 1 1 320px; display: flex; flex-direction: column; gap: 2px; }
.verdict:empty { display: none; }
.verdict-q { font-size: 0.875rem; color: var(--ink-2); }
.verdict-a { font-size: 1.125rem; color: var(--ink); line-height: 1.35; }
.verdict-a strong { font-weight: 700; }
.verdict-a strong::before {
  content: ''; display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: var(--verdict-color, var(--muted)); margin-right: 7px; vertical-align: 1px;
}
.when { display: flex; gap: 8px; flex-wrap: wrap; }
.when label { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--ink-2); }
.when label[hidden] { display: none; }
.when select {
  font: inherit; font-size: 0.9375rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
}
.when select:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.when-note { color: var(--muted); font-size: 0.875rem; margin: 8px 0 0; }
.when-note[hidden] { display: none; }

/* A tile showing usual numbers, not a live reading: dashed edge. */
.tile-usual { border-style: dashed; border-color: color-mix(in oklab, var(--ink) 28%, var(--surface)); }
.tile .vs-usual { margin: 0; color: var(--ink-2); font-size: 0.875rem; }

/* Day strip: today's actual hours solid, later usual hours faint, current or picked hour full. */
.day-strip .bar { padding: 0; border: 0; font: inherit; }
.day-strip .bar-actual { opacity: 0.7; }
.day-strip .bar-usual { opacity: 0.3; }
.day-strip .bar-now, .day-strip .bar-picked { opacity: 1; }
.day-strip button.bar { cursor: pointer; }
.day-strip button.bar:hover { opacity: 0.6; }
.day-strip button.bar:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.strip-axis { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* History chart as a disclosure: collapsed on phones by default. */
.viz-summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; margin-bottom: 8px; }
.viz-summary::-webkit-details-marker { display: none; }
.viz-summary::before { content: '▸'; color: var(--ink-2); font-size: 1rem; transition: transform 0.15s ease; }
details[open] > .viz-summary::before { transform: rotate(90deg); }
.viz-summary h2 { margin: 0; font-size: 1rem; }
.viz-root:not([open]) { padding-bottom: 8px; }
.viz-root:not([open]) > .viz-summary { margin-bottom: 0; }

/* Flag-shaped tooltip for hour bars: a small pointed tail under a centered, two-line label.
   position:fixed + appended to <body> so it floats above every tile regardless of scroll or
   any tile's own hover transform/stacking context. */
.bar-tooltip {
  position: fixed; transform: translate(-50%, -100%); z-index: 50; pointer-events: none;
  background: var(--tooltip-bg); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow); padding: 6px 10px; text-align: center; white-space: nowrap;
}
.bar-tooltip::before, .bar-tooltip::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent;
}
.bar-tooltip::before { border-top-color: var(--border); }
.bar-tooltip::after { border-top-color: var(--tooltip-bg); margin-top: -1px; }
.bar-tooltip .bt-hour { color: var(--ink-2); font-size: 0.8125rem; }
.bar-tooltip .bt-value { color: var(--ink); font-size: 0.875rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Footer: the old inline "about this data" callout now lives behind a disclosure so the page
   ends with the flight board, not a wall of caveats. */
.page-foot { margin-top: 8px; padding-top: 4px; }
.about-data {
  background: var(--wash); border: 1px solid var(--border); border-left: 3px solid var(--axis);
  border-radius: 8px; padding: 12px 16px; color: var(--ink-2); font-size: 0.875rem; line-height: 1.5;
}
.about-data summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.about-data[open] summary { margin-bottom: 8px; }
.about-data p { margin: 6px 0; }
.about-data p:last-child { margin-bottom: 0; }
.about-data strong { color: var(--ink); }
.tracker-status { margin-top: 10px; }
.tracker-error { display: block; margin-top: 4px; font-size: 0.875rem; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.flights-col td .sched { display: block; color: var(--muted); font-size: 0.8125rem; }
/* Status colors as a dot, not text color: the orange and green fail contrast as text on the light theme. */
.flights-col td[class^="status-"] { font-weight: 600; }
.flights-col td[class^="status-"]::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px; background: var(--dot-color);
}
.flights-col td.status-delayed { --dot-color: var(--status-serious); }
.flights-col td.status-early { --dot-color: var(--status-good); }
.flights-col td.status-canceled { --dot-color: var(--status-critical); }
.built-by { margin: 14px 0 0; color: var(--muted); font-size: 0.875rem; text-align: center; }
.built-by a { color: inherit; }

/* Controls: now live in the viz card's own header, upper-left, in place of a title. */
.viz-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-head-right { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: var(--page); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  font: inherit; font-size: 0.875rem; font-weight: 500; color: var(--ink-2); background: transparent; border: 0;
  padding: 5px 11px; border-radius: 6px; cursor: pointer;
}
.seg button:hover { background: var(--wash); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.seg button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.seg button:disabled { color: var(--muted); cursor: not-allowed; opacity: 0.6; }
.seg button:disabled:hover { background: transparent; }
.typical-group { font-size: 0.875rem; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px 12px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.875rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend .key { width: 18px; height: 2px; background: var(--c); border-radius: 1px; }
.legend .key-dashed { background: none; border-top: 2px dashed var(--c); height: 0; }

.chart-wrap { position: relative; }
#chart { display: block; width: 100%; height: 340px; overflow: visible; }
#chart:focus-visible { outline: 2px solid var(--series-1); outline-offset: 4px; border-radius: 4px; }
.chart-wrap.loading { opacity: 0.55; transition: opacity 0.15s; }
.gridline { stroke: var(--grid); stroke-width: 1; }
/* Outage bands: a neutral wash with a dashed edge, not a hue, so they read as "no data here"
   and never as another series. */
.gap-band { fill: var(--wash); stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
.gap-label { fill: var(--ink-2); font-size: 0.8125rem; font-weight: 600; }
.gap-sub { fill: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.baseline { stroke: var(--axis); stroke-width: 1; }
.threshold { stroke: var(--axis); stroke-width: 1; }
.tick-label { fill: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.note-label { fill: var(--muted); font-size: 0.8125rem; }
.series { fill: none; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; transition: opacity 0.15s; }
/* Baseline reference lines: same lot color, faint and dashed so the real reading always reads
   as the foreground line. Two distinct dash rhythms so day + same-weekday stay tellable apart
   when both are on at once. */
.series.typical { stroke-width: 1.5; pointer-events: none; }
.series.typical-day { opacity: 0.4; stroke-dasharray: 6 4; }
.series.typical-dow { opacity: 0.6; stroke-dasharray: 1.5 3.5; }
/* Hovering a stat tile applies this to every other lot's lines. Overrides whatever opacity
   the line already had (full-strength main line or a faint typical baseline alike) so the
   hovered lot reads as clearly stronger than either. */
.series.dimmed { opacity: 0.3 !important; }
/* Flight markers: thin dashed verticals, quiet enough to sit behind the lot lines. Direction
   is told apart by color and by the native <title> tooltip on hover, not by dash rhythm —
   two different dash patterns at this thinness read as noise, not signal. */
.flight-line { stroke-width: 1; opacity: 0.55; stroke-dasharray: 3 3; pointer-events: stroke; cursor: help; }
.flight-arrival { stroke: var(--flight-arrival); }
.flight-departure { stroke: var(--flight-departure); }
.end-marker { stroke: var(--surface); stroke-width: 2; }
.end-label { fill: var(--ink-2); font-size: 0.875rem; }
.crosshair { stroke: var(--ink-2); stroke-width: 1; pointer-events: none; }
.hover-dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.hit { fill: transparent; cursor: crosshair; }

.tooltip {
  position: absolute; top: 8px; pointer-events: none; z-index: 2;
  background: var(--tooltip-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 0.875rem; min-width: 190px;
}
.tooltip .when { color: var(--ink-2); margin-bottom: 6px; }
.tooltip .row { display: grid; grid-template-columns: 14px auto 1fr; gap: 6px; align-items: center; padding: 1px 0; white-space: nowrap; }
.tooltip .row .k { height: 2px; background: var(--c); border-radius: 1px; }
.tooltip .row .v { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.tooltip .row .n { color: var(--ink-2); }

.empty { color: var(--ink-2); font-size: 0.9375rem; margin: 8px 0 12px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; font-variant-numeric: tabular-nums; }
th { color: var(--ink-2); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
th:first-child, td:first-child { text-align: left; }
th .key { display: inline-block; width: 12px; height: 2px; background: var(--c); border-radius: 1px; margin-right: 6px; vertical-align: middle; }
/* Flights board is almost entirely text (airline, city, status), not numbers, so left-align
   every column rather than fighting the readings table's numeric-right default. */
.flights-table th, .flights-table td { text-align: left; }
.flights-table tfoot td { color: var(--muted); font-size: 0.875rem; white-space: normal; border-bottom: none; }

.flights-cols { display: flex; gap: 24px; flex-wrap: wrap; }
.flights-col { flex: 1; min-width: 420px; }
.flights-col h3 { display: flex; align-items: center; gap: 6px; font-size: 0.9375rem; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }
.flights-col .flight-icon { flex: none; }


@media (max-width: 560px) {
  body { padding-top: 20px; }
  .tile-value .value-main { font-size: 2rem; }
  #chart { height: 280px; }
  .source-line { display: none; }
  .source-line-mobile { display: block; }
}
@media print {
  body { background: #fff; color: #000; }
  .controls, .tooltip { display: none !important; }
  .card, .tile { break-inside: avoid; box-shadow: none; }
}

/* API docs page (api.html): reading width, code blocks that scroll instead of widening the page. */
.docs { max-width: 760px; }
.docs main > p, .docs main > h2 { margin: 0 0 12px; }
.docs main > h2 { margin-top: 28px; }
.docs code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.docs pre {
  background: var(--wash); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin: 0 0 16px; overflow-x: auto;
}
.docs .table-wrap { overflow-x: auto; margin: 0 0 16px; }
.docs table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.docs th, .docs td { text-align: left; vertical-align: top; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--grid); }
.docs th { color: var(--ink-2); font-weight: 600; }
.docs th, .docs td { white-space: normal; background: none; }
.docs td:first-child { white-space: nowrap; }
.docs h2 code { font-size: inherit; font-weight: 600; }
.data-link { margin: 14px 0 0; font-size: 0.875rem; text-align: center; }

.docs .usage { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.docs .agents {
  border: 1px solid var(--border); border-left: 3px solid var(--axis); border-radius: 8px;
  padding: 14px 16px 2px; margin: 0 0 20px; background: var(--surface);
}
.docs .agents p { margin: 6px 0 10px; color: var(--ink-2); font-size: 0.9375rem; }
.docs .agents-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.docs .agents h2 { margin: 0; }
.docs #copy-prompt {
  font: inherit; font-size: 0.875rem; font-weight: 600; color: var(--ink);
  background: var(--wash); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; min-height: 32px;
}
.docs #copy-prompt:hover { border-color: var(--axis); }
.docs #agent-prompt { max-height: 320px; overflow: auto; }
.docs #agent-prompt code { white-space: pre-wrap; }

/* Flight board tools: search, Filters modal, chips (flight-board.js). */
.fb-day { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--ink-2); }
.fb-day select,
.fb-search-input,
.fb-filters-btn {
  font: inherit; font-size: 0.9375rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.fb-tools { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; }
.fb-search { position: relative; flex: 1; min-width: 0; max-width: 420px; }
/* 16px keeps iOS Safari from zooming the page when the field takes focus. */
.fb-search-input { width: 100%; font-size: 1rem; padding-right: 32px; }
.fb-search-input::-webkit-search-cancel-button { display: none; }
.fb-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--ink-2); font-size: 1.125rem; line-height: 1;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
}
.fb-clear:hover, .fb-filters-btn:hover { background: var(--wash); }
.fb-filters-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; flex: none; }
.fb-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 0.8125rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; background: var(--ink); color: var(--surface);
}
.fb-day select:focus-visible, .fb-search-input:focus-visible, .fb-filters-btn:focus-visible,
.fb-clear:focus-visible, .fb-chip:focus-visible, .linkish:focus-visible {
  outline: 2px solid var(--series-1); outline-offset: 1px;
}
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.fb-chip {
  font: inherit; font-size: 0.875rem; color: var(--ink); background: var(--wash); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fb-chip:hover { border-color: var(--axis); }
.linkish {
  font: inherit; font-size: 0.875rem; color: var(--ink-2); background: none; border: 0; padding: 0;
  text-decoration: underline; text-decoration-color: var(--muted); cursor: pointer;
}
.fb-dialog {
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 18px 20px; width: min(720px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px));
}
.fb-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.fb-dialog[open] { display: flex; }
/* Only the option lists scroll, so Reset and Done stay in reach on a phone. */
.fb-dialog form { display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1; }
.fb-dialog-body { overflow-y: auto; min-height: 0; }
.fb-dialog h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.fb-dialog-body { display: flex; flex-direction: column; gap: 12px; }
.fb-dialog fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0; padding: 8px 12px 10px; }
.fb-dialog legend { padding: 0 4px; font-size: 0.875rem; font-weight: 600; }
.fb-dialog label { display: flex; align-items: center; gap: 6px; font-size: 0.9375rem; padding: 3px 0; cursor: pointer; }
.fb-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); column-gap: 16px; }
.fb-options label { align-items: flex-start; }
.fb-options input[type="checkbox"] { margin-top: 0.3em; flex: none; }
.fb-dialog input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.fb-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.fb-dialog-actions button {
  font: inherit; font-size: 0.9375rem; border-radius: 8px; padding: 6px 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.fb-dialog-actions .fb-done { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.fb-code { color: var(--muted); font-size: 0.8125rem; }
.fb-gate-label { display: none; }

/* Phones: each flight is two short lines instead of a five-column row that scrolls sideways.
     6:30 PM   United 5632      On time
     sched …   San Francisco SFO  Gate 4 */
@media (max-width: 560px) {
  .flights-cols { flex-direction: column; }
  .flights-col { min-width: 0; }
  .flights-table thead { display: none; }
  .flights-table, .flights-table tbody { display: block; }
  .flights-table tr {
    display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; column-gap: 10px;
    padding: 7px 0; border-bottom: 1px solid var(--grid);
  }
  .flights-table td { border: 0; padding: 0; white-space: normal; }
  .flights-table .fb-time { grid-row: 1 / 3; }
  .flights-table .fb-flight { grid-column: 2; grid-row: 1; font-weight: 500; }
  .flights-table .fb-status { grid-column: 3; grid-row: 1; text-align: right; }
  .flights-table .fb-city { grid-column: 2; grid-row: 2; color: var(--ink-2); }
  .flights-table .fb-gate { grid-column: 3; grid-row: 2; text-align: right; color: var(--ink-2); }
  .fb-gate-label { display: inline; }
}

/* Flights page header: status line plus the hop over to parking. */
.park-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.9375rem; font-weight: 500; text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px;
}
.park-btn:hover { background: var(--wash); }
.park-btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }

/* Flights page timeline (flight-timeline.js). */
.tl-svg { display: block; }
.tl-axis { stroke: var(--axis); stroke-width: 1.5; }
.tl-ticks line { stroke: var(--grid); }
.tl-sides text { fill: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.tl-ticks text { fill: var(--muted); font-size: 0.8125rem; }
.tl-slope { fill: none; stroke-width: 1.25; opacity: 0.35; }
.tl-slope.tl-arrival { stroke: var(--flight-arrival); }
.tl-slope.tl-departure { stroke: var(--flight-departure); }
.tl-slip { stroke: var(--status-good); stroke-width: 3; stroke-linecap: round; opacity: 0.7; }
.tl-slip.is-late { stroke: var(--status-serious); }
.tl-now line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.tl-now text { fill: var(--ink-2); font-size: 0.8125rem; font-weight: 600; }
.tl-plane { cursor: pointer; }
.tl-plane text { font-size: 1.0625rem; }
.tl-svg.is-narrow .tl-plane text { font-size: 0.875rem; }
.tl-hit { fill: transparent; }
.tl-plane[data-state="waiting"], .tl-plane[data-state="landed"] { opacity: 0.35; }
.tl-plane[data-state="gone"] { display: none; }
.tl-plane.is-canceled { opacity: 0.2; }
.tl-bob { animation: tl-bob 4s ease-in-out infinite; }
.tl-plane[data-state="air"] .tl-bob { animation-duration: 2.6s; animation-name: tl-bob-air; }
@keyframes tl-bob { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(0.6px, -1.5px); } }
@keyframes tl-bob-air { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(1.5px, -3px); } }
@media (prefers-reduced-motion: reduce) {
  .tl-bob, .tl-plane[data-state="air"] .tl-bob { animation: none; }
}
.tl-callout {
  position: absolute; z-index: 2; pointer-events: none; min-width: 160px; max-width: 240px;
  background: var(--tooltip-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 0.875rem; line-height: 1.35;
}
.tl-callout strong { display: block; font-size: 0.9375rem; }
.tl-callout-status { font-weight: 600; }
.tl-callout-status.is-delayed { color: var(--status-serious); }
.tl-callout-status.is-canceled { color: var(--status-critical); }
.tl-callout-miles { color: var(--muted); font-size: 0.875rem; }

/* Scrubber under the timeline: play, a time-of-day slider, the time it's set to, and Live. */
.tl-scrub { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.tl-play, .tl-live {
  font: inherit; font-size: 0.875rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer; flex: none;
}
.tl-play { width: 44px; padding: 7px 0; text-align: center; }
.tl-play:hover, .tl-live:hover:not(:disabled) { background: var(--wash); }
.tl-live[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tl-live:disabled:not([aria-pressed="true"]) { opacity: 0.5; cursor: default; }
.tl-play:focus-visible, .tl-live:focus-visible, .tl-range:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.tl-clock { font-variant-numeric: tabular-nums; font-size: 0.875rem; color: var(--ink-2); min-width: 64px; text-align: right; }
.tl-range {
  flex: 1; min-width: 0; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.tl-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--flight-departure) var(--fill, 0%), var(--grid) var(--fill, 0%));
}
.tl-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--grid); }
.tl-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--flight-departure); }
.tl-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--flight-departure); box-shadow: var(--shadow);
}
.tl-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--flight-departure);
}
@media (max-width: 560px) {
  /* Phones: the slider gets its own full-width row, controls below it. */
  .tl-scrub { flex-wrap: wrap; }
  .tl-range { flex-basis: 100%; order: -1; }
  .tl-clock { flex: 1; text-align: left; }
}

/* "In the air" card (flight-sky.js): tabs, a stage both views draw into, the shared callout. */
.sky .card-head { align-items: center; }
.sky-stage { position: relative; }
.sky-view[hidden] { display: none; }
.sky-note { margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }
.map-view { position: relative; }
.map-canvas { touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-canvas:active { cursor: grabbing; }
.map-controls { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.map-controls button {
  width: 40px; height: 40px; font: inherit; font-size: 1.0625rem; line-height: 1; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; box-shadow: var(--shadow);
}
.map-controls button:hover:not(:disabled) { background: var(--wash); }
.map-controls button:disabled { opacity: 0.4; cursor: default; }
.map-controls button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.map-svg { display: block; }
.map-states { fill: var(--wash); stroke: var(--axis); stroke-width: 0.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map-routes polyline { fill: none; stroke: var(--muted); opacity: 0.35; stroke-linecap: round; }
.map-labels circle { fill: var(--ink-2); }
.map-labels text, .map-edges text { fill: var(--ink-2); font-size: 0.8125rem; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.map-edges path { fill: var(--ink-2); }
.map-home circle { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.map-home text { fill: var(--ink); font-size: 0.875rem; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.map-plane text { font-size: 1.125rem; }
/* Flights page: the board header carries "Checked N min ago" on its right. */
.fb-checked { margin: 0 0 0 auto; align-self: center; color: var(--ink-2); font-size: 0.875rem; text-align: right; }
/* The parking link: top right of the page on wide screens, a full-width bar between the map
   and the board on phones. */
.park-btn-wide { display: none; }
@media (max-width: 560px) {
  .park-btn-head { display: none; }
  .park-btn-wide { display: flex; justify-content: center; text-align: center; width: 100%; margin: 0 0 18px; padding: 10px 12px; border-radius: 12px; }
}
.fb-days { font-size: 0.875rem; }
.sky-head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sky-days { font-size: 0.875rem; }
@media (max-width: 560px) {
  /* Room for two lines either way, so switching Today/Tomorrow doesn't shove the page down. */
  .sky .card-head .sub { min-height: 2.9em; }
}
.fb-dir-tabs { display: none; }
@media (max-width: 560px) {
  /* One column at a time behind a tab bar, instead of a long arrivals list then departures. */
  .fb-dir-tabs { display: flex; width: 100%; margin: 0 0 10px; }
  .fb-dir-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 7px 8px; font-size: 0.9375rem; }
  .fb-dir-tabs button[aria-pressed="true"] .flight-icon path { fill: currentColor; }
  .flights-cols[data-show="arrival"] .flights-col[data-kind="departure"],
  .flights-cols[data-show="departure"] .flights-col[data-kind="arrival"] { display: none; }
  .flights-col h3 { display: none; }
}
.title-short { display: none; }
@media (max-width: 560px) {
  /* The full airport name wraps to three lines on a phone. */
  .title-long { display: none; }
  .title-short { display: inline; }
}
/* Type scale. Everything is in rem so it follows the reader's browser text size; wide
   screens step the whole scale up, since there's room and no reason to keep it small. */
@media (min-width: 1200px) {
  /* Wide screens: content spans 80% of the window instead of a fixed column. */
  body { max-width: 80vw; padding-inline: 0; }
}
/* The bigger type waits a little longer, so two five-column flight tables still fit side by side. */
@media (min-width: 1360px) {
  html { font-size: 112.5%; }
}
@media (min-width: 1600px) {
  html { font-size: 125%; }
}
/* With the bigger type, two board columns side by side ran out of room and clipped Status.
   Flight and city may wrap instead, and cells sit a little closer. */
.flights-table th, .flights-table td { padding: 6px 8px; }
.flights-table td.fb-city { white-space: normal; }
@media (max-width: 560px) { .flights-col { min-width: 0; } }
/* Flights page, wide screens: the full-width map above, then Arrivals and Departures as two
   columns (the default board layout). A map-beside-board split was tried and read as cluttered.
   The footer sits on one line. */
@media (min-width: 1200px) {
  .flights-page .page-foot { display: flex; align-items: center; justify-content: center; gap: 18px; }
  .flights-page .page-foot > * { margin: 0; }
}
.about-btn {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; display: block; margin: 0 auto;
}
.about-btn:hover { background: var(--wash); }
.about-btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.about-dialog { max-width: min(560px, 92vw); margin: auto !important; } /* the footer zeroes child margins */
.about-dialog p { margin: 0; color: var(--ink-2); line-height: 1.5; }
/* Finished flights stay listed, quieter, so the evening board still shows the whole day. */
.flights-table tr.fb-row-done td { color: var(--muted); }
.flights-table tr.fb-row-done a { color: var(--ink-2); }
@media (min-width: 561px) and (max-width: 1359px) {
  .flights-table td.fb-flight { white-space: normal; }
}
