/* ==========================================================================
   Crooli Flights — built on the crooli.com design tokens.
   Ink on ivory. Fraunces (soft) for voice, Instrument Sans for interface. Lapis is the only
   accent and is reserved for focus, selection, and state. Light by default; dark is opt-in.
   ========================================================================== */

:root {
  --ivory: #f6f4ee;
  --oat: #ece7dc;
  --oat-deep: #e2dccf;
  --card: #fbfaf7;
  --ink: #1b1714;
  --ink-soft: #4a443e;
  --ink-muted: #675f56;
  --rule: #dcd6ca;
  --rule-strong: #c9c2b4;
  --lapis: #3e5ba9;
  --lapis-soft: #e3e8f4;
  --danger: #a3372b;
  --danger-bg: #f6e3df;
  --success: #3d6b45;
  --success-bg: #e4ece2;
  --amber: #8a6410;
  --amber-bg: #f3e9cf;

  --ivory-rgb: 246 244 238;
  --ink-rgb: 27 23 20;
  --card-rgb: 251 250 247;
  --ink-hover: #3a332d;
  --field-bg: #fff;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 50px -22px rgba(27, 23, 20, 0.4), inset 0 0 0 1px var(--rule);

  color: var(--ink);
  background: var(--ivory);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  font-synthesis: none;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 100, "WONK" 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] {
  --ivory: #151210;
  --oat: #201c19;
  --oat-deep: #2a2521;
  --card: #1b1714;
  --ink: #f2efe8;
  --ink-soft: #cbc5b9;
  --ink-muted: #968f83;
  --rule: #2d2823;
  --rule-strong: #403a33;
  --lapis: #8aa2e6;
  --lapis-soft: #222a42;
  --danger: #e8867a;
  --danger-bg: #3a1f1b;
  --success: #86c293;
  --success-bg: #1f2f22;
  --amber: #e2bf62;
  --amber-bg: #34290f;
  --ivory-rgb: 21 18 16;
  --ink-rgb: 242 239 232;
  --card-rgb: 27 23 20;
  --ink-hover: #fff;
  --field-bg: #231f1b;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.7), inset 0 0 0 1px var(--rule);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--ivory); min-width: 320px; }
h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--lapis); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--lapis-soft); color: var(--ink); }
[hidden] { display: none !important; }

.eyebrow {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---------- Map ---------- */

#map, #map3d { position: fixed; inset: 0; background: var(--oat); z-index: 0; font-family: var(--sans); transition: opacity 600ms var(--ease); }
#map3d { opacity: 0; pointer-events: none; z-index: 1; }
body.is-3d #map3d { opacity: 1; pointer-events: auto; }
body.is-3d #map { opacity: 0; pointer-events: none; }
.horizon { position: fixed; z-index: 2; left: 0; right: 0; top: 0; height: 26vh; pointer-events: none; opacity: 0; transition: opacity 600ms var(--ease); background: linear-gradient(var(--oat) 0%, rgb(var(--ivory-rgb) / 0) 100%); }
body.is-3d .horizon { opacity: 0.85; }
#map3d .maplibregl-canvas { outline: 0; }
#map3d .maplibregl-ctrl-bottom-left, #map3d .maplibregl-ctrl-bottom-right { display: none; }
.leaflet-container { background: var(--oat); outline: 0; }
.leaflet-pane.radar-pane { z-index: 230; pointer-events: none; opacity: 0.62; }
.leaflet-fade-anim .leaflet-tile { will-change: opacity; }
.ac-canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
#map.is-grab { cursor: pointer; }

/* ---------- Mark (same drawing as crooli.com) ---------- */

.mark { width: 28px; height: 28px; flex: none; overflow: visible; color: var(--ink); }
.mark-arc { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.mark-dot { fill: var(--lapis); }
.mark-animated > .mark-dot { animation: plane-in 0.7s var(--ease) 1.2s both; }
@keyframes plane-in { from { opacity: 0; transform: translate(16px, 16px) rotate(45deg) scale(0.2) translate(-12px, -12px); } }
.brand:hover .mark-dot { transition: transform 600ms var(--ease); }
.mark-animated .mark-spin { transform-box: fill-box; transform-origin: center; animation: mark-spin 1.3s var(--ease) 0.13s both; }
.mark-animated .mark-arc { stroke-dasharray: 19.25 40; animation: mark-draw 1.2s cubic-bezier(0.65, 0, 0.35, 1) 0.2s both; }
@keyframes mark-spin { from { transform: rotate(-140deg); } }
@keyframes mark-draw { 0% { stroke-dashoffset: 19.25; opacity: 0; } 4% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 1; } }
@keyframes mark-pop { 0% { transform: scale(0); } 55% { transform: scale(1.25); } 80% { transform: scale(0.95); } 100% { transform: scale(1); } }

/* ---------- Top bar: crooli's floating pill ---------- */

.bar {
  position: fixed;
  z-index: 60;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 24px), 1000px);
  height: 56px;
  padding: 0 8px 0 18px;
  border-radius: 999px;
  background: rgb(var(--ivory-rgb) / 0.86);
  backdrop-filter: saturate(1.5) blur(18px);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  box-shadow: 0 12px 34px -16px rgba(27, 23, 20, 0.35), inset 0 0 0 1px var(--rule);
  animation: bar-in 700ms var(--ease) both;
}
@keyframes bar-in { from { opacity: 0; transform: translate(-50%, -14px); } }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand .mark { transition: transform 600ms var(--ease); }
.brand:hover .mark, .brand:focus-visible .mark { transform: rotate(180deg); }
.brand__word {
  font-family: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.bar__slash { width: 1px; height: 22px; background: var(--rule-strong); transform: rotate(18deg); margin: 0 2px; }
.bar__title { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 1.3rem; letter-spacing: -0.01em; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  max-width: 400px;
  height: 38px;
  margin-left: auto;
  padding: 0 8px 0 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--rule-strong);
  color: var(--ink-muted);
  font-size: 0.875rem;
  text-align: left;
  transition: box-shadow 160ms ease, background-color 160ms ease;
}
.search-trigger:hover { box-shadow: inset 0 0 0 1px var(--ink); background: rgb(var(--ink-rgb) / 0.03); }
.search-trigger svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.search-trigger__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { padding: 1px 6px; border-radius: 6px; background: var(--oat); color: var(--ink-muted); font: inherit; font-size: 0.75rem; }

.bar__end { display: flex; align-items: center; gap: 6px; margin-left: 4px; }

.live { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 34px; font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; }
.live__dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); flex: none; }
.live.is-live .live__dot { background: var(--success); }
.live.is-live .live__dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--success); animation: live-ping 2.4s var(--ease) infinite; }
.live.is-error .live__dot { background: var(--danger); }
@keyframes live-ping { 0% { transform: scale(1); opacity: 0.55; } 80%, 100% { transform: scale(3.2); opacity: 0; } }

.chip-btn { height: 34px; padding: 0 12px; border-radius: 999px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft); white-space: nowrap; transition: background-color 160ms ease, color 160ms ease; }
.chip-btn:hover { background: var(--oat); color: var(--ink); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--ink);
  transition: background-color 160ms ease, transform 300ms var(--ease);
}
.icon-btn:hover { background: var(--oat); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Sun and moon in one icon (as on crooli.com). */
.theme-toggle svg { width: 20px; height: 20px; stroke-width: 1.7; }
.theme-toggle__body { fill: currentColor; stroke: none; transition: transform 500ms var(--ease); transform-origin: 12px 12px; }
.theme-toggle__bite { transition: transform 500ms var(--ease); transform: translate(8px, -8px); }
.theme-toggle__rays { transition: transform 500ms var(--ease), opacity 300ms ease; transform-origin: 12px 12px; }
:root[data-theme="dark"] .theme-toggle__bite { transform: translate(0, 0); }
:root[data-theme="dark"] .theme-toggle__rays { transform: rotate(45deg) scale(0.4); opacity: 0; }
:root[data-theme="dark"] .theme-toggle__body { transform: rotate(-20deg) scale(1.25); }

/* ---------- Cards ---------- */

.card { background: rgb(var(--card-rgb) / 0.94); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border: 1px solid transparent; border-radius: 999px;
  font-size: 0.9375rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn-primary { background: var(--ink); color: var(--ivory); }
.btn-primary:hover { background: var(--ink-hover); }
.btn-primary.is-on { background: var(--lapis); color: #fff; }
.btn-ghost { border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); background: rgb(var(--ink-rgb) / 0.03); }

/* ---------- In view ---------- */

.stats {
  transition: opacity 300ms ease, transform 500ms var(--ease);
  position: fixed;
  z-index: 40;
  top: 82px;
  left: 16px;
  width: 308px;
  max-height: calc(100% - 170px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: card-in 700ms var(--ease) 200ms both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }

.stats__head { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 16px 18px 12px; text-align: left; }
.stats__head .eyebrow { align-self: center; margin-right: auto; }
.stats__count { font-family: var(--serif); font-size: 2rem; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats__sub { font-size: 0.8125rem; color: var(--ink-muted); }
.chev { width: 16px; height: 16px; align-self: center; fill: none; stroke: var(--ink-muted); stroke-width: 1.6; stroke-linecap: round; transition: transform 400ms var(--ease); }
.stats.is-collapsed .chev { transform: rotate(-90deg); }
.stats__body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 480ms var(--ease); min-height: 0; overflow-y: auto; padding: 0 18px 16px; }
.stats.is-collapsed .stats__body { display: none; }

.split { height: 6px; border-radius: 99px; background: var(--oat-deep); overflow: hidden; }
.split i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--lapis); transition: width 700ms var(--ease); }
.split__legend { display: flex; justify-content: space-between; margin: 8px 0 14px; font-size: 0.8125rem; color: var(--ink-muted); }
.split__legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.kpis > div { padding: 10px 10px 9px; border-radius: var(--radius-sm); background: var(--oat); }
.kpis dt { font-size: 0.6875rem; color: var(--ink-muted); }
.kpis dd { margin-top: 2px; font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--oat); margin-bottom: 8px; }
.tabs button { flex: 1; height: 30px; border-radius: 999px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-muted); transition: background-color 160ms ease, color 160ms ease; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }

.list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px; margin: 0 -8px; border-radius: var(--radius-sm); cursor: pointer; transition: background-color 160ms ease; animation: row-in 400ms var(--ease) both; }
.list li:hover { background: var(--oat); }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } }
.list .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.list .nm { font-weight: 500; font-size: 0.875rem; }
.list .sub { color: var(--ink-muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .l { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.list .v { font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; }
.list .bar-mini { height: 4px; border-radius: 99px; background: var(--lapis); margin-top: 4px; transition: width 600ms var(--ease); opacity: 0.8; }
.list .empty { color: var(--ink-muted); font-size: 0.8125rem; cursor: default; }
.list .empty:hover { background: none; }

.sos { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); font-size: 0.8125rem; }
.sos b { display: block; margin-bottom: 4px; font-weight: 600; }
.sos button { display: block; padding: 2px 0; text-align: left; text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }

/* ---------- Detail panels ---------- */

.detail {
  position: fixed;
  z-index: 45;
  top: 82px;
  right: 16px;
  bottom: 16px;
  width: 408px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(calc(100% + 24px));
  visibility: hidden;
  transition: transform 560ms var(--ease), visibility 0s linear 560ms;
}
.detail.is-open { transform: none; visibility: visible; transition: transform 560ms var(--ease), visibility 0s; }
.airport { z-index: 46; }
.detail__grab { display: none; }
.detail__close { position: absolute; z-index: 3; top: 10px; right: 10px; background: rgb(var(--card-rgb) / 0.85); box-shadow: inset 0 0 0 1px var(--rule); backdrop-filter: blur(8px); }
.detail__scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 20px; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
.detail__scroll > * { animation: row-in 560ms var(--ease) both; }
.detail__scroll > *:nth-child(2) { animation-delay: 50ms; }
.detail__scroll > *:nth-child(3) { animation-delay: 100ms; }
.detail__scroll > *:nth-child(4) { animation-delay: 150ms; }
.detail__scroll > *:nth-child(5) { animation-delay: 200ms; }
.detail__scroll > *:nth-child(n+6) { animation-delay: 250ms; }
.detail__foot { display: flex; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--rule); }
.detail__foot .btn { flex: 1; }

.photo { position: relative; margin: 0 -20px 16px; aspect-ratio: 16 / 9; background: var(--oat); overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity 700ms ease, transform 1200ms var(--ease); }
.photo.is-loaded img { opacity: 1; transform: none; }
.photo figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 14px 8px; font-size: 0.6875rem; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); opacity: 0; transition: opacity 400ms ease; }
.photo.is-loaded figcaption { opacity: 1; }
.photo figcaption a { text-decoration: underline; text-underline-offset: 2px; }
.photo.is-empty { aspect-ratio: auto; height: 56px; background: transparent; }
.photo.is-empty img, .photo.is-empty figcaption { display: none; }

.detail__head { margin-bottom: 14px; }
.detail__head .eyebrow { margin-bottom: 2px; }
.callsign { font-family: var(--serif); font-weight: 400; font-size: 2.5rem; line-height: 1.05; letter-spacing: -0.025em; padding-right: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--oat); color: var(--ink-soft); font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.chip.is-lapis { background: var(--lapis-soft); color: var(--lapis); }
.chip.is-danger { background: var(--danger-bg); color: var(--danger); }
.chip.is-ok { background: var(--success-bg); color: var(--success); }
.chip.is-amber { background: var(--amber-bg); color: var(--amber); }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.route { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 16px 0 6px; border-top: 1px solid var(--rule); }
.route__end b { display: block; font-family: var(--serif); font-weight: 400; font-size: 2rem; line-height: 1; letter-spacing: -0.02em; }
.route__end span { display: block; margin-top: 4px; max-width: 110px; font-size: 0.75rem; color: var(--ink-muted); line-height: 1.3; }
.route__end.right { text-align: right; }
.route__end.right span { margin-left: auto; }
.route__mid { padding-top: 10px; min-width: 0; }
.route__track { position: relative; height: 2px; border-radius: 2px; background: var(--rule-strong); margin: 8px 12px 0; }
.route__track::before, .route__track::after { content: ""; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--ink); }
.route__track::before { left: -3.5px; }
.route__track::after { right: -3.5px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--ink); }
.route__fill { position: absolute; left: 0; top: 0; height: 100%; width: 0; border-radius: 2px; background: var(--lapis); transition: width 1000ms var(--ease); }
.route__plane { position: absolute; top: 50%; left: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; fill: var(--lapis); transform: rotate(90deg); transition: left 1000ms var(--ease); filter: drop-shadow(0 0 0 var(--card)) drop-shadow(0 0 3px rgb(var(--card-rgb))); }
.route__mid small { display: block; margin-top: 14px; text-align: center; font-size: 0.75rem; color: var(--ink-muted); }

.trip { display: grid; grid-template-columns: repeat(3, 1fr); padding: 10px 0 16px; border-bottom: 1px solid var(--rule); margin-bottom: 16px; }
.trip dt, .tile dt { font-size: 0.6875rem; color: var(--ink-muted); }
.trip dd { font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.trip > div:nth-child(2) { text-align: center; }
.trip > div:nth-child(3) { text-align: right; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tile { padding: 12px 14px 11px; border-radius: var(--radius); background: var(--oat); }
.tile dd { display: flex; align-items: baseline; gap: 5px; margin-top: 3px; font-family: var(--serif); font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.tile dd small { font-family: var(--sans); font-size: 0.75rem; color: var(--ink-muted); letter-spacing: 0; }
.tile .sub { display: block; margin-top: 2px; font-size: 0.6875rem; color: var(--ink-muted); }
.tile.wide { grid-column: span 2; }
.tile .arrow { display: inline-block; width: 14px; height: 14px; margin-right: 2px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile.up .arrow { color: var(--success); }
.tile.down .arrow { color: var(--danger); }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.chart { padding: 12px 14px 10px; border-radius: var(--radius); background: var(--oat); }
.chart .eyebrow { display: block; margin-bottom: 6px; }
.chart svg { width: 100%; height: 44px; overflow: visible; }
.chart path.line { fill: none; stroke: var(--lapis); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart path.area { fill: var(--lapis); opacity: 0.1; }
.chart circle { fill: var(--lapis); }
.chart .none { display: block; height: 44px; font-size: 0.75rem; color: var(--ink-muted); }

.more { margin-top: 12px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--rule); }
.more summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-size: 0.875rem; font-weight: 500; cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--ink-muted); border-bottom: 1.5px solid var(--ink-muted); transform: rotate(45deg); transition: transform 300ms var(--ease); margin-right: 3px; }
.more[open] summary::after { transform: rotate(-135deg); }
.kv { padding: 0 14px 8px; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 0.8125rem; }
.kv dt { color: var(--ink-muted); }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.kv dd.mono { font-family: var(--mono); font-size: 0.75rem; }
.note { margin-top: 12px; font-size: 0.75rem; color: var(--ink-muted); }
.note:empty { display: none; }

/* Airport */
.ap__head { padding-top: 22px; margin-bottom: 14px; }
.ap__codes { display: flex; align-items: baseline; gap: 10px; }
.ap__codes h2 { font-family: var(--serif); font-weight: 400; font-size: 3rem; line-height: 1; letter-spacing: -0.03em; }
.ap__codes span { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-muted); }
.ap__name { margin-top: 6px; font-size: 0.9375rem; color: var(--ink-soft); }
.wx { padding: 16px; border-radius: var(--radius); background: var(--oat); margin-bottom: 8px; }
.wx__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wx__temp { font-family: var(--serif); font-size: 2.5rem; line-height: 1; letter-spacing: -0.03em; }
.wx__temp small { font-size: 1rem; color: var(--ink-muted); margin-left: 2px; }
.wx__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; margin-top: 14px; }
.wx__grid dt { font-size: 0.6875rem; color: var(--ink-muted); }
.wx__grid dd { font-size: 0.9375rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.wx__raw { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--card); font-family: var(--mono); font-size: 0.6875rem; line-height: 1.55; color: var(--ink-soft); word-break: break-word; }
.ap__traffic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 6px; }
.ap__sec { margin: 18px 0 4px; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(100deg, var(--oat) 30%, var(--oat-deep) 50%, var(--oat) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* ---------- Dock ---------- */

.dock { position: fixed; z-index: 40; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px; animation: card-in 700ms var(--ease) 350ms both; }
.dock__group { display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgb(var(--card-rgb) / 0.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.dock .icon-btn[aria-expanded="true"] { background: var(--lapis-soft); color: var(--lapis); }
.legend { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: 999px; background: rgb(var(--card-rgb) / 0.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow); font-size: 0.6875rem; color: var(--ink-muted); white-space: nowrap; }
.legend__bar { width: 110px; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--ramp, #c4622d, #3e5ba9)); }

.layers { position: absolute; left: 0; bottom: 58px; width: 262px; padding: 16px 18px 18px; animation: palette-in 180ms var(--ease); }
.layers .eyebrow { margin-bottom: 8px; }
.switch { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 0.875rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; order: 2; margin-left: auto; width: 34px; height: 20px; border-radius: 99px; background: var(--rule-strong); transition: background-color 200ms ease; flex: none; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 300ms var(--ease); }
.switch input:checked + i { background: var(--lapis); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--lapis); outline-offset: 3px; }
.range { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--rule); }
.range__row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.875rem; }
.range__row b { font-weight: 500; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.range input { width: 100%; accent-color: var(--lapis); }

.toast { position: fixed; z-index: 70; left: 50%; top: 86px; transform: translate(-50%, -8px); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--ivory); font-size: 0.875rem; opacity: 0; pointer-events: none; transition: opacity 300ms ease, transform 500ms var(--ease); max-width: calc(100% - 32px); text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.credit-line { position: fixed; z-index: 30; right: 16px; bottom: 6px; font-size: 0.625rem; color: var(--ink-muted); text-shadow: 0 0 6px rgb(var(--ivory-rgb)), 0 0 2px rgb(var(--ivory-rgb)); transition: right 560ms var(--ease); }
.credit-line a:hover { text-decoration: underline; }
body.has-detail .credit-line { right: 440px; }

/* ---------- Search palette (same shape as crooli.com's command palette) ---------- */

.palette { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: clamp(56px, 12vh, 140px) 16px 16px; background: rgba(27, 23, 20, 0.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.palette__panel { width: min(620px, 100%); max-height: min(580px, 100%); display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-lg); background: var(--card); box-shadow: 0 30px 80px -20px rgba(27, 23, 20, 0.5), inset 0 0 0 1px var(--rule); animation: palette-in 180ms var(--ease); }
@keyframes palette-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.palette__input { width: 100%; padding: 20px 24px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; font-size: 1.0625rem; outline: none; }
.palette__input::placeholder { color: var(--ink-muted); }
.palette__list { padding: 8px; overflow-y: auto; }
.palette__list li { display: flex; align-items: baseline; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); cursor: pointer; }
.palette__list li.is-active { background: var(--lapis-soft); }
.palette__list li.palette__section { padding: 12px 14px 4px; cursor: default; font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-muted); background: none; }
.palette__list li.palette__empty { cursor: default; color: var(--ink-muted); font-size: 0.9375rem; }
.palette__label { flex: 0 1 auto; min-width: 0; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.palette__code { flex: none; font-family: var(--mono); font-size: 0.75rem; padding: 1px 7px; border-radius: 6px; background: var(--oat); color: var(--ink-soft); }
.palette__hint { flex: 1; min-width: 0; overflow: hidden; color: var(--ink-muted); font-size: 0.8125rem; text-overflow: ellipsis; white-space: nowrap; }
.palette__foot { display: flex; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--rule); font-size: 0.75rem; color: var(--ink-muted); }
.palette__foot kbd { margin-right: 4px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .bar__title, .bar__slash { display: none; }
}

@media (max-width: 760px) {
  .bar { top: 8px; height: 52px; padding-left: 14px; gap: 6px; }
  .brand__word { display: none; }
  .search-trigger kbd { display: none; }
  .live__text { display: none; }
  .live { padding: 0 6px; }
  .stats { top: 68px; left: 8px; width: min(300px, calc(100% - 16px)); max-height: calc(100% - 200px); }
  .dock { left: 8px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .legend { display: none; }
  .layers { bottom: 58px; }
  .detail { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: min(78vh, 680px); transform: translateY(calc(100% + 24px)); border-radius: 28px; }
  .detail.is-open { transform: none; }
  .detail__grab { display: block; position: absolute; z-index: 3; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 99px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); }
  .callsign { font-size: 2.1rem; }
  body.has-detail .dock { opacity: 0; pointer-events: none; transform: translateY(20px); }
  body.has-detail .stats { opacity: 0; pointer-events: none; }
  body.has-detail .credit-line { right: 16px; opacity: 0; }
  .credit-line { right: 8px; left: 8px; text-align: center; bottom: 2px; }
  .palette { padding-top: 64px; }
  .palette__foot { display: none; }
}

@media (min-width: 761px) and (max-width: 1100px) {
  body.has-detail .stats { opacity: 0; pointer-events: none; transform: translateX(-16px); }
  .detail { width: 372px; }
  body.has-detail .credit-line { right: 404px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* Hover tip on the map */
.tip { position: fixed; z-index: 55; left: 0; top: 0; display: flex; flex-direction: column; padding: 7px 11px; border-radius: 12px; background: var(--ink); color: var(--ivory); font-size: 0.75rem; line-height: 1.35; pointer-events: none; opacity: 0; transition: opacity 140ms ease; white-space: nowrap; }
.tip.is-on { opacity: 1; }
.tip b { font-weight: 600; font-size: 0.8125rem; }
.tip span { opacity: 0.72; }

.gauge { display: block; height: 4px; margin-top: 9px; border-radius: 99px; background: var(--oat-deep); overflow: hidden; }
.gauge b { display: block; height: 100%; width: 0; border-radius: 99px; transition: width 900ms var(--ease), background-color 900ms ease; }
.stats__count { min-width: 2ch; }
.list li { transition: background-color 160ms ease, transform 300ms var(--ease); }
.list li:hover { transform: translateX(2px); }
.tile { transition: transform 300ms var(--ease); }
.tile:hover { transform: translateY(-1px); }
.leaflet-container { cursor: grab; }
.leaflet-dragging .leaflet-container, .leaflet-dragging #map { cursor: grabbing; }

/* ---------- Detail footer with three actions ---------- */
.detail__foot .btn { min-height: 42px; padding: 8px 12px; font-size: 0.875rem; }

/* ---------- Replay bar ---------- */
.replay { position: fixed; z-index: 48; bottom: 16px; left: 50%; width: min(760px, calc(100% - 32px)); transform: translate(-50%, 24px); opacity: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 10px; border-radius: 28px; transition: transform 560ms var(--ease), opacity 300ms ease; }
.replay.is-open { transform: translate(-50%, 0); opacity: 1; }
body.has-detail .replay { left: 16px; right: 440px; width: auto; transform: translateY(24px); }
body.has-detail .replay.is-open { transform: none; }
.dock { transition: bottom 560ms var(--ease), opacity 300ms ease, transform 500ms var(--ease); }
body.is-replay .dock { bottom: 112px; }
.replay__play { background: var(--ink); color: var(--ivory); width: 44px; height: 44px; flex: none; }
.replay__play:hover { background: var(--ink-hover); }
.replay__play svg { width: 18px; height: 18px; }
.replay__play .i-play { fill: currentColor; stroke: none; }
.replay__play .i-pause { display: none; stroke-width: 2.4; }
.replay.is-playing .i-play { display: none; }
.replay.is-playing .i-pause { display: block; }
.replay__main { flex: 1; min-width: 0; }
.replay__read { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; font-size: 0.8125rem; white-space: nowrap; overflow: hidden; }
.replay__read b { font-family: var(--serif); font-weight: 400; font-size: 1.125rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.replay__read span { color: var(--ink-muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.replay__chart { position: relative; height: 44px; border-radius: 10px; background: var(--oat); overflow: hidden; }
.replay__chart svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.replay__chart .line { fill: none; stroke: var(--lapis); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.replay__chart .area { fill: var(--lapis); opacity: 0.13; }
.replay__chart .cursor { stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.replay__chart input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
@media (max-width: 760px) {
  .replay { bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 24px; gap: 6px; }
  body.has-detail .replay { left: 8px; right: 8px; }
  body.is-replay .dock { bottom: 16px; }
  body.is-replay .detail { transform: translateY(calc(100% + 24px)); }
  body.is-replay .stats { opacity: 0; pointer-events: none; }
}
body.is-replay .legend { display: none; }

/* ---------- Share ---------- */
.share { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 16px; gap: 14px; }
.share__img { border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px var(--rule); background: var(--oat); aspect-ratio: 1200 / 630; }
.share__img img { width: 100%; height: 100%; display: block; }
.share__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share__actions .btn { flex: 1 1 140px; }

/* ---------- Airport boards ---------- */
.board-tabs { margin: 16px 0 6px; }
.board .b { display: flex; align-items: center; gap: 12px; }
.board li { align-items: center; }
.board .when { text-align: right; line-height: 1.25; }
.board .when b { display: block; font-weight: 600; font-size: 0.875rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.board .when i { font-style: normal; font-size: 0.6875rem; color: var(--ink-muted); }
.board .when.ok i { color: var(--success); }
.board .when.warn i { color: var(--amber); }
.board .code { flex: none; min-width: 44px; font-family: var(--serif); font-size: 1.125rem; letter-spacing: -0.01em; }
.board-note { margin: 8px 0 0; font-size: 0.75rem; color: var(--ink-muted); }

/* ---------- 3D ---------- */
body.is-3d .legend { opacity: 1; }
.dock .icon-btn[aria-pressed="true"] { background: var(--lapis-soft); color: var(--lapis); }
