:root {
  color-scheme: dark;
  --bg: oklch(13% 0.005 260);
  --panel: oklch(18% 0.01 260);
  --panel-hover: oklch(21% 0.01 260);
  --panel-selected: oklch(23% 0.03 75);
  --text: oklch(92% 0.005 260);
  --muted: oklch(60% 0.01 260);
  --muted-dim: oklch(45% 0.005 260);
  --amber: oklch(78% 0.15 75);
  --blue: oklch(78% 0.15 230);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Off-screen holding pen for live-status probe players — not display:none, so the
   embedded player still loads and plays long enough to report real state. */
.probe-pool {
  position: absolute;
  width: 2px;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  top: 0;
  left: 0;
}

/* ---------- sticky "now showing" video pane ---------- */

.video-pane {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 20px 32px 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.video-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.master-clock {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
}

.master-clock #master-time {
  font-size: 26px;
  font-weight: 700;
  color: var(--blue);
}

.master-tz {
  font-size: 12px;
  color: var(--muted);
}

.video-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 58vh;
  border-radius: 10px;
  overflow: hidden;
  background: #050403;
}

.video-frame-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 1;
  visibility: visible;
}

/* v5 (experimental): with a persistent pool of warm players, multiple .video-frame-wraps can
   be mounted at once — one per camera, all full-size, all genuinely playing. Whichever one
   is ".active" sits on top (still below .click-guard and .video-placeholder); every other
   camera's wrap stays exactly where it was, still playing, just occluded by whichever one
   IS on top. This is a different situation from concealing an iframe mid-startup (which
   didn't work reliably) — these are already-settled, idle-in-the-background players, not
   mid-render ones, so ordinary stacking is the normal, well-supported case. */
.video-frame-wrap.active {
  z-index: 2;
}

.video-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* V3: the iframe itself no longer participates in the conceal/reveal lifecycle at all — no
   clipping, no opacity, no visibility toggling. Every one of those (tried in that order) still
   showed YouTube's startup chrome; the common thread is that each of them conceals the iframe
   in some way, and a browser may deprioritize rendering/animation work for concealed content
   regardless of which specific technique does the concealing — which would explain why
   YouTube's own chrome-fade-out never got to actually run in any of them. So now the iframe
   renders normally and fully visible from creation onward, and .video-placeholder (a
   completely separate, always-fully-rendered element, z-index 4, above every wrap) is
   the only thing that hides them — see docs/youtube-startup-chrome-mitigation-v3.md. */

.video-placeholder {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: oklch(9% 0 0);
}

.video-placeholder.hidden { display: none; }

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0px, rgba(255, 255, 255, .025) 1px, transparent 1px, transparent 3px);
}

.placeholder-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted-dim);
}

.placeholder-msg span {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Sits directly over every iframe (including whichever is .active) and absorbs every mouse
   event, so YouTube's own player never receives a hover/click and its own title bar,
   controls, and branding link can never activate — controls=0 alone still leaves a minimal
   branding affordance active. z-index 3: above every .video-frame-wrap (1, or 2 if active),
   below .video-placeholder (4). */
.click-guard {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: transparent;
}

/* Never shown, in any state (live, connecting, or offline) — the airport's identity is
   already on the flight board below. This used to be conditional on ".live", which left a
   gap during the brief "Connecting…" phase before playback is confirmed; unconditional is
   the only way to guarantee it never appears. */
.video-overlay {
  display: none;
}

.video-code {
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.video-meta { display: flex; flex-direction: column; gap: 2px; }
.video-name { font-size: 15px; font-weight: 600; color: #fff; }
.video-city { font-size: 11px; color: rgba(255, 255, 255, 0.7); text-transform: uppercase; letter-spacing: 0.06em; }

.status-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
}

.status-chip.live { background: oklch(30% 0.06 75 / .5); color: oklch(90% 0.13 75); }
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .6; }
.status-chip.live .dot { background: oklch(85% 0.15 75); box-shadow: 0 0 8px oklch(78% 0.15 75 / .8); animation: pulse 1.6s ease-in-out infinite; }

/* ---------- flight board ---------- */

.board {
  padding: 24px 32px 56px;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-loading { color: var(--muted); text-align: center; padding: 40px 0; }

.row {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.row:hover { background: var(--panel-hover); }
.row.selected { background: var(--panel-selected); border-color: oklch(78% 0.15 75 / .5); }

.flap { display: flex; gap: 3px; flex: none; }

.flap-char {
  width: 34px;
  height: 44px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  position: relative;
  background: linear-gradient(180deg, #191919, #101010);
  color: var(--muted-dim);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .6);
}

.flap-char::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%; height: 1px;
  background: rgba(0, 0, 0, .55);
}

.row.live .flap-char {
  background: linear-gradient(180deg, #1c1408, #0f0b04);
  color: var(--amber);
}

.row-meta { display: flex; align-items: center; gap: 20px; min-width: 220px; flex: 1; }
.row-name { flex: none; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; }
.row-city { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Phase 1 flight arrival/departure block — mock data, layout-only (see
   docs/flight-arrival-departure-row-phase1.md). Sits to the right of the airport name on
   desktop; the mobile media query below switches it to stack underneath instead and swaps
   the full labels/detail for compact ones. */
.flight-pair {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.flight-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}

.flight-label {
  flex: none;
  width: 66px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.flight-label-compact { display: none; }

.flight-number {
  flex: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.flight-detail-full {
  font-size: 12px;
  color: var(--muted-dim);
  overflow: hidden;
  text-overflow: ellipsis;
}

.flight-detail-compact { display: none; }

.row-time { display: flex; flex-direction: column; gap: 2px; min-width: 80px; flex: none; }
.row-time-label { font-size: 9px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.row-time-value { font-family: var(--mono); font-size: 18px; font-weight: 600; color: var(--blue); }

.row-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  min-width: 120px;
  justify-content: center;
  background: oklch(22% 0.005 260);
  color: var(--muted);
}

.row-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-dim); }
.row.live .row-status { background: oklch(30% 0.06 75 / .4); color: oklch(88% 0.13 75); }
.row.live .row-status .dot { background: var(--amber); box-shadow: 0 0 7px oklch(78% 0.15 75 / .8); animation: pulse 1.6s ease-in-out infinite; }

.row-action {
  flex: none;
  width: 90px;
  text-align: right;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted-dim);
}

.row.selected .row-action { color: var(--amber); }

footer {
  text-align: center;
  color: var(--muted);
  padding: 0 1rem 3rem;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .video-screen { max-height: 40vh; }
  .video-code { font-size: 24px; }
  .row { flex-wrap: wrap; gap: 10px; }
  .row-meta { flex-direction: column; align-items: flex-start; gap: 4px; min-width: 140px; }
  .row-name { white-space: normal; }

  /* Phase 1 flight block, compact form: ARR/DEP + flight + IATA route, no aircraft type. */
  .flight-pair { gap: 1px; }
  .flight-line { font-size: 11px; }
  .flight-label { width: auto; }
  .flight-label-full { display: none; }
  .flight-label-compact { display: inline; }
  .flight-detail-full { display: none; }
  .flight-detail-compact { display: inline; font-size: 11px; color: var(--muted-dim); }
}
