:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #1b2740;
  --text: #eef2f8;
  --muted: #8d9bb5;
  --accent: #4fb3ff;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --mil: #b5c96a;
  --mil-bg: #182314;
  --vip: #fcd34d;
  --rare: #c4a1ff;
  --radius: 18px;
}

/* Night mode: dark, warm and low-contrast so it doesn't light up a bedroom. */
body.night {
  --bg: #000;
  --panel: #0c0a08;
  --panel-2: #17130f;
  --text: #c8a27c;
  --muted: #7a6450;
  --accent: #c8783c;
  --good: #8a9a5b;
  --warn: #c8923c;
  --bad: #b5574b;
}
body.night .card-map { filter: brightness(0.55) sepia(0.6); }
/* Used only when the backlight can't be dimmed directly. */
body.dim > header, body.dim > main { filter: brightness(var(--dim, 0.4)); }

.sleep { position: fixed; inset: 0; background: #000; z-index: 100; cursor: none; display: flex; align-items: center; justify-content: center; }
/* Sleep clock: deep red reads at the lowest backlight level without lighting up the room. */
.sleep-clock { color: #6b1a0e; font-size: 300px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; transition: transform 2s; }
.sleep-clock .ampm { color: inherit; }
.sleep.no-clock .sleep-clock { display: none; }
/* No backlight control: the page itself has to be the dimmer. */
.sleep.no-backlight .sleep-clock { color: #2e0a05; }
@media (max-width: 900px) { .sleep-clock { font-size: 28vw; } }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; user-select: none; -webkit-tap-highlight-color: transparent;
}
body { display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; height: 72px; flex: none;
}
.tabs { display: flex; gap: 8px; }
.tab {
  background: transparent; border: 0; border-radius: 999px;
  padding: 0 24px; height: 52px; font-size: 20px; color: var(--muted);
}
.tab.active { background: var(--panel-2); color: var(--text); }
.status { display: flex; align-items: center; gap: 20px; color: var(--muted); font-size: 20px; font-variant-numeric: tabular-nums; }
.clock-btn { background: transparent; border: 0; padding: 8px 4px; font-size: 26px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

main { flex: 1; position: relative; min-height: 0; }
.view { display: none; position: absolute; inset: 0; padding: 0 16px 16px; }
.view.active { display: flex; flex-direction: column; gap: 14px; }

.card {
  flex: 1; min-height: 0; background: var(--panel); border-radius: var(--radius);
  padding: 20px; display: grid; grid-template-columns: 1fr 42%; grid-template-rows: 1fr auto; gap: 16px 20px;
}
#main-card { position: relative; }
.rotation {
  position: absolute; top: 12px; left: 28px; z-index: 500;
  display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted);
}
.rotation .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: 0.35; }
.rotation .dot.on { background: var(--accent); opacity: 1; }
.rotation .held { font-size: 14px; }
.card-info { grid-column: 1; grid-row: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-evenly; gap: 8px; padding-left: 8px; }
.card-map { isolation: isolate; grid-column: 2; grid-row: 1; border-radius: 14px; overflow: hidden; background: #0e1626; min-height: 0; }
.card .stats { grid-column: 1 / -1; grid-row: 2; }
.card.no-map .card-info { grid-column: 1 / -1; }
.card.no-map .card-map, .card.no-map .stats:empty { display: none; }
.flight-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.flight-no { font-size: 56px; font-weight: 700; letter-spacing: 0.02em; }
.airline { font-size: 26px; color: var(--muted); }
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 8px;
  background: var(--panel-2); color: var(--accent); font-weight: 600; font-size: 20px;
}
.route { display: flex; align-items: center; gap: 22px; margin: 6px 0 4px; }
.airport .code { font-size: 64px; font-weight: 800; line-height: 1; }
.airport .city { font-size: 20px; color: var(--muted); margin-top: 4px; max-width: 300px; }
.route .arrow { font-size: 44px; color: var(--accent); }
.route.unknown { color: var(--muted); font-size: 24px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat { background: var(--panel-2); border-radius: 14px; padding: 12px 16px; }
.stat .label { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat .value { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; white-space: nowrap; }
.stat .unit { font-size: 18px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.heading-arrow { display: inline-block; transition: transform 0.5s; color: var(--accent); }
.aircraft-line { font-size: 22px; color: var(--muted); }
.info-body { display: flex; align-items: center; gap: 20px; min-width: 0; }
.info-text { flex: 1; min-width: 0; }
.photo { flex: none; width: 240px; margin: 0; }
.photo img { display: block; width: 240px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; background: var(--panel-2); }
.photo figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex: none; }
.chip {
  background: var(--panel); border: 2px solid transparent; border-radius: 14px;
  padding: 12px 16px; text-align: left; min-height: 92px;
}
.chip.selected { border-color: var(--accent); }
.chip .cs { font-size: 24px; font-weight: 700; }
.chip.military { background: var(--mil-bg); border-left-color: var(--mil); }
.chip.military.selected { border-color: var(--mil); }
.chip .sub { font-size: 17px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: 24px; text-align: center; }
.empty-clock-wrap { margin-bottom: 12px; }
.empty-clock { font-size: 180px; font-weight: 200; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.empty-date { font-size: 30px; color: var(--muted); margin-top: 8px; }
.ampm { font-size: 0.3em; font-weight: 400; margin-left: 0.15em; color: var(--muted); letter-spacing: 0.04em; }

/* Full-screen bedside clock. Colors come from the theme variables so it follows night mode. */
.bedside {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.bedside-time { font-size: 300px; font-weight: 200; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.bedside-date { font-size: 40px; color: var(--muted); margin-top: 12px; }
.bedside-planes { position: absolute; bottom: 28px; font-size: 22px; color: var(--muted); }
.hint { font-size: 18px; }

#radar { flex: 1; width: 100%; min-height: 0; }
.radar3d { position: relative; z-index: 0; flex: 1; width: 100%; min-height: 0; overflow: hidden; touch-action: none; }
.radar3d canvas { display: block; width: 100%; height: 100%; }
.radar3d-labels { position: absolute; inset: 0; pointer-events: none; }
.radar3d-label { position: absolute; top: 0; left: 0; white-space: nowrap; text-shadow: 0 0 4px #000, 0 0 2px #000, 0 1px 1px #000; }
.radar3d-label .cs { display: inline-block; font-weight: 600; font-size: 16px; line-height: 20px; }
.radar3d-north { position: absolute; top: 0; left: 0; color: #fff; font-size: 16px; font-weight: 600; text-shadow: 0 0 4px #000; }
.radar3d-label .alt { font-size: 14px; color: #d5dde8; }
.radar-style { position: absolute; top: 4px; right: 28px; z-index: 2; display: flex; background: var(--panel); border-radius: 12px; padding: 4px; gap: 4px; }
.radar-style button { min-width: 64px; height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 18px; font-weight: 600; }
.radar-style button.active { background: var(--panel-2); color: var(--text); }
.radar-legend { position: absolute; top: 8px; left: 28px; color: var(--muted); font-size: 18px; }
/* Full card for a plane tapped on the radar, laid over it. */
.radar-card { position: absolute; inset: 0 16px 16px; z-index: 5; }
.card-actions { position: absolute; top: 28px; right: 28px; z-index: 1000; display: flex; gap: 10px; }
.card-actions .btn { background: rgba(11, 18, 32, 0.85); box-shadow: 0 0 0 1px var(--panel-2); }
.card-actions .close-btn { width: 64px; padding: 0; font-size: 26px; }

.track-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; min-height: 100%; color: var(--muted); font-size: 24px; text-align: center; }
.progress-row { display: flex; align-items: center; gap: 18px; margin: 4px 0; }
.progress { position: relative; flex: 1; height: 10px; background: var(--panel-2); border-radius: 999px; margin: 0 13px; }
.progress .fill { height: 100%; background: var(--accent); border-radius: 999px; }
.progress-plane { position: absolute; top: 50%; transform: translate(-50%, -50%); color: var(--text); display: flex; filter: drop-shadow(0 0 3px var(--bg)); }
.progress-text { font-size: 22px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.track-status { font-size: 26px; font-weight: 600; }
.track-status.late { color: var(--warn); }
.track-status.cancelled { color: var(--bad); }
.track-status.ontime { color: var(--good); }
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.track-actions { display: flex; gap: 12px; margin-top: 8px; }

/* Stats screen */
#stats-totals { grid-template-columns: repeat(4, 1fr); flex: none; }
.stats-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.highlights { display: grid; grid-auto-rows: 1fr; gap: 14px; min-height: 0; }
.highlight { background: var(--panel); border-radius: var(--radius); padding: 14px 20px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.highlight .label, .week-card .label { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.h-title { font-size: 30px; font-weight: 700; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-sub { font-size: 19px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.highlight.notable-vip { box-shadow: inset 0 0 0 3px var(--vip); }
.highlight.notable-notable { box-shadow: inset 0 0 0 3px var(--rare); }
.highlight.notable-vip .h-title { color: var(--vip); }
.highlight.notable-notable .h-title { color: var(--rare); }
.highlight.empty-stats { color: var(--muted); font-size: 22px; text-align: center; }
.week-card { background: var(--panel); border-radius: var(--radius); padding: 14px 20px; display: flex; flex-direction: column; min-height: 0; }
.week-chart { flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 8px; margin-top: 10px; }
.week { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.week-col { flex: 1; width: 100%; position: relative; }
.week-bar { position: absolute; bottom: 0; width: 100%; min-height: 3px; background: var(--accent); opacity: 0.45; border-radius: 6px 6px 2px 2px; }
.week.current .week-bar { opacity: 1; }
.week-n { position: absolute; width: 100%; text-align: center; margin-bottom: 4px; font-size: 15px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.week.current .week-n { color: var(--text); }
.week-label { font-size: 13px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

/* Collection screen */
#view-collection.active { flex-direction: row; }
.sets-panel { width: 300px; flex: none; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.collection-total { background: var(--panel); border-radius: var(--radius); padding: 14px 20px; flex: none; }
.collection-total .label { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.collection-count { font-size: 48px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 2px 0 8px; }
.collection-count .of { font-size: 26px; color: var(--muted); font-weight: 500; }
.collection-pct { font-size: 15px; color: var(--muted); margin-top: 8px; }
.set-bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.set-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.collection-sets { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.set-row { background: transparent; border: 0; border-radius: 12px; padding: 8px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; text-align: left; flex: none; }
.set-row .set-bar { grid-column: 1 / -1; height: 4px; }
.set-row.active { background: var(--panel-2); }
.set-name { font-size: 19px; }
.set-n { font-size: 17px; color: var(--muted); font-variant-numeric: tabular-nums; }
.set-row.done .set-n { color: var(--good); }
.set-row.done .set-fill { background: var(--good); }
.collection-grid { flex: 1; min-width: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 146px; gap: 10px; align-content: start; }
.type-tile { position: relative; background: var(--panel); border-radius: 14px; padding: 8px 12px 10px; display: flex; flex-direction: column; align-items: center; min-width: 0; color: var(--muted); }
.type-tile.got { background: var(--panel-2); color: var(--text); }
.type-sil { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.type-sil img { max-width: 100%; max-height: 72px; }
.type-name { font-size: 19px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-sub { font-size: 14px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-badge { position: absolute; top: 8px; right: 8px; background: var(--accent); color: #04121f; font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.collection-empty { grid-column: 1 / -1; color: var(--muted); font-size: 22px; text-align: center; padding: 60px 20px; }

.btn { background: var(--panel-2); border: 0; border-radius: 14px; height: 64px; padding: 0 28px; font-size: 22px; }
.btn.primary { background: var(--accent); color: #04121f; font-weight: 700; }

.error {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: #3b1720; color: var(--bad); padding: 10px 20px; border-radius: 12px; font-size: 18px;
}

.keypad { position: fixed; inset: 0; background: rgba(4, 8, 16, 0.85); display: flex; align-items: center; justify-content: center; z-index: 10; }
.keypad-box { background: var(--panel); border-radius: var(--radius); padding: 18px; width: min(1000px, 96vw); }
.keypad-display { font-size: 44px; font-weight: 700; height: 60px; letter-spacing: 0.08em; }
.caret { display: inline-block; width: 3px; height: 44px; background: var(--accent); vertical-align: middle; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.keypad-hint { color: var(--muted); font-size: 17px; margin-bottom: 10px; }
.keypad-keys { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.keypad-keys button { height: 58px; border: 0; border-radius: 10px; background: var(--panel-2); font-size: 24px; font-weight: 600; }
.keypad-keys button:active, .btn:active, .chip:active { filter: brightness(1.3); }
.keypad-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* Military aircraft: olive card, khaki accents, stencil-style badge */
.card.military {
  background: linear-gradient(135deg, var(--mil-bg), var(--panel) 70%);
  box-shadow: inset 0 0 0 2px rgba(181, 201, 106, 0.45);
}
.card.military .stat { background: #1f2c1b; }
.card.military .heading-arrow, .card.military .route .arrow { color: var(--mil); }
.mil-badge {
  background: var(--mil); color: #111a0c; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800;
}
.mil-star { color: var(--mil); }
.route.mil-operator { color: var(--mil); font-size: 30px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.map-plane.military { color: var(--mil); }

/* Notable flights: red for emergencies, gold for VIPs, violet for rare types and the watchlist */
.notable-line { margin-top: -2px; }
.notable-badge { font-size: 22px; font-weight: 800; letter-spacing: 0.02em; }
.notable-badge.emergency { background: var(--bad); color: #2a0a0f; animation: pulse 1.6s ease-in-out infinite; }
.notable-badge.vip { background: var(--vip); color: #2a1f04; }
.notable-badge.notable { background: var(--rare); color: #1c1033; }
@keyframes pulse { 50% { filter: brightness(1.35); } }
.card.notable-emergency { box-shadow: inset 0 0 0 3px var(--bad); }
.card.notable-vip { box-shadow: inset 0 0 0 3px var(--vip); }
.card.notable-notable { box-shadow: inset 0 0 0 3px var(--rare); }
.chip.notable-emergency { border-color: var(--bad); }
.chip.notable-vip { border-color: var(--vip); }
.chip.notable-notable { border-color: var(--rare); }
.chip.notable-emergency .notable-icon { color: var(--bad); }
.chip.notable-vip .notable-icon { color: var(--vip); }
.chip.notable-notable .notable-icon { color: var(--rare); }

/* Portrait or smaller screens */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .strip { grid-template-columns: repeat(2, 1fr); }
  .card { grid-template-columns: 1fr; grid-template-rows: auto 220px auto; }
  .card-map { grid-column: 1; grid-row: 2; }
  .card .stats { grid-row: 3; }
  .flight-no { font-size: 44px; }
  .airport .code { font-size: 48px; }
  .photo, .photo img { width: 160px; }
  .bedside-time { font-size: 30vw; }
  .stats-body { grid-template-columns: 1fr; }
  #stats-totals { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 0 14px; font-size: 18px; }
  #count { display: none; } /* no room next to five tabs */
  #view-collection.active { flex-direction: column; }
  .sets-panel { width: auto; max-height: 40%; }
  .collection-grid { grid-template-columns: repeat(3, 1fr); }
  .empty-clock { font-size: 24vw; }
}

/* Map markers */
.leaflet-container { background: #0e1626; font-family: inherit; }
.leaflet-control-attribution { background: rgba(11, 18, 32, 0.7) !important; color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.map-label { color: var(--text); font-weight: 700; font-size: 15px; text-shadow: 0 0 4px #000, 0 0 8px #000; white-space: nowrap; }
.map-plane { color: #fbbf24; filter: drop-shadow(0 0 4px #000); }
.map-plane svg { display: block; transform-origin: center; }
.radar3d-chase { position: absolute; left: 16px; bottom: 26px; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 14px; background: rgba(11, 18, 32, 0.72); }
.radar3d-chase .chase-title { font-size: 20px; font-weight: 700; }
.radar3d-chase .chase-sub { font-size: 15px; color: #d5dde8; }
.radar3d-chase .chase-exit { width: 48px; height: 48px; border: 0; border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 22px; }
.radar3d-credit { position: absolute; right: 10px; bottom: 6px; font-size: 11px; color: rgba(255, 255, 255, 0.7); text-shadow: 0 0 3px #000; pointer-events: none; }
#view-radar .radar-legend { z-index: 2; background: rgba(11, 18, 32, 0.7); padding: 4px 10px; border-radius: 8px; }

/* Live globe, also the screensaver (body.screensaver hides the top bar). */
#view-globe { padding: 0; }
.globe { position: relative; flex: 1; width: 100%; min-height: 0; overflow: hidden; touch-action: none; background: #000; }
.globe canvas { display: block; width: 100%; height: 100%; }
.globe-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.globe-label { position: absolute; top: 0; left: 0; white-space: pre; font-size: 16px; font-weight: 600; text-shadow: 0 0 4px #000, 0 0 2px #000, 0 1px 1px #000; }
.globe-home { color: #5eead4; }
.globe-credit { position: absolute; right: 10px; bottom: 6px; font-size: 11px; color: rgba(255, 255, 255, 0.6); text-shadow: 0 0 3px #000; pointer-events: none; }
.globe-controls { position: absolute; top: 10px; right: 16px; z-index: 2; display: flex; background: rgba(19, 28, 46, 0.8); border-radius: 12px; padding: 4px; gap: 4px; }
.globe-controls button { min-width: 84px; height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font-size: 18px; font-weight: 600; }
.globe-controls button:active { background: var(--panel-2); }
.globe-clock { display: none; position: absolute; left: 28px; bottom: 22px; z-index: 2; pointer-events: none; color: #fff; font-size: 64px; font-weight: 600; font-variant-numeric: tabular-nums; text-shadow: 0 0 12px #000, 0 0 3px #000; }
.globe-clock .ampm { font-size: 0.45em; margin-left: 6px; }
body.screensaver > header { display: none; }
body.screensaver .globe-controls, body.screensaver .globe-credit { display: none; }
body.screensaver .globe-clock { display: block; }

/* Airport board: split-flap departures and arrivals. Oswald (OFL) is a
   condensed face close to the lettering on Solari boards. */
@font-face { font-family: "Oswald"; font-weight: 500; src: url("vendor/oswald/oswald-500.woff2") format("woff2"); }
@font-face { font-family: "Oswald"; font-weight: 600; src: url("vendor/oswald/oswald-600.woff2") format("woff2"); }
#view-board { padding: 0 16px 14px; }
.board {
  --sign: #ffcc00; --flap: #1c1d20; --flap-hi: #26272b; --ink: #f2efe6;
  --on: #57e389; --amber: #ffb627; --red: #ff5a4e; --dim-ink: #a6a39b;
  flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #17181b 0%, #0b0b0c 70%); box-shadow: inset 0 0 0 1px #2a2b30, inset 0 2px 30px rgba(0, 0, 0, 0.8);
  font-family: "Oswald", "DejaVu Sans Condensed", "Arial Narrow", sans-serif;
}
.board-head { flex: none; display: flex; align-items: center; gap: 22px; height: 76px; white-space: nowrap; padding: 0 14px 0 22px; background: var(--sign); color: #111; }
.board-sign { display: flex; align-items: center; gap: 14px; font-size: 40px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.board-icon svg { display: block; width: 48px; height: 48px; fill: #111; }
.board-airport { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; padding-left: 20px; border-left: 3px solid rgba(0, 0, 0, 0.75); }
.board-code { font-size: 34px; font-weight: 600; letter-spacing: 0.06em; }
.board-name { font-family: system-ui, sans-serif; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-switch { display: flex; gap: 4px; padding: 4px; background: rgba(0, 0, 0, 0.82); border-radius: 12px; }
.board-switch button { height: 46px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: #cfcab9; font-family: inherit; font-size: 19px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.board-switch button.active { background: var(--sign); color: #111; }
.board-cols { flex: none; display: flex; gap: calc(var(--cw, 24px) * 0.6); padding: 12px 22px 6px; color: var(--sign); font-size: 15px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.col-label { flex: none; white-space: nowrap; overflow: hidden; }
.col-label.col-time { text-align: right; }
.board-rows { flex: 1; min-height: 0; padding: 4px 22px 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.board-row { display: flex; align-items: center; gap: calc(var(--cw) * 0.6); }
.field { display: flex; gap: calc(var(--cw) * 0.08); flex: none; }

.flap {
  position: relative; width: var(--cw); height: var(--ch); perspective: calc(var(--ch) * 5);
  border-radius: calc(var(--cw) * 0.12); background: #000;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.7), inset 0 0 0 1px #000;
  font-size: calc(var(--ch) * 0.8); font-weight: 500; color: var(--ink);
}
.half { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; backface-visibility: hidden; }
.half.top { top: 0; border-radius: calc(var(--cw) * 0.12) calc(var(--cw) * 0.12) 0 0; background: linear-gradient(180deg, var(--flap-hi), var(--flap)); border-bottom: 1px solid #000; }
.half.bottom { bottom: 0; border-radius: 0 0 calc(var(--cw) * 0.12) calc(var(--cw) * 0.12); background: linear-gradient(180deg, #151618, var(--flap) 60%); }
.half i { position: absolute; left: 0; right: 0; height: var(--ch); line-height: var(--ch); text-align: center; font-style: normal; white-space: pre; }
.half.top i { top: 0; }
.half.bottom i { bottom: 0; }
/* The hinge: a dark seam with a pin either side. */
.flap::after { content: ""; position: absolute; left: -1px; right: -1px; top: calc(50% - 1px); height: 2px; background: linear-gradient(90deg, #555 0 2px, #000 2px calc(100% - 2px), #555 calc(100% - 2px)); z-index: 3; }
.half.fall { z-index: 2; transform-origin: 50% 100%; animation: flap-fall 70ms ease-in forwards; }
.half.rise { z-index: 2; transform-origin: 50% 0%; transform: rotateX(90deg); animation: flap-rise 70ms ease-out 70ms forwards; }
@keyframes flap-fall { to { transform: rotateX(-90deg); filter: brightness(0.6); } }
@keyframes flap-rise { from { transform: rotateX(90deg); filter: brightness(1.4); } to { transform: rotateX(0); filter: none; } }

.board-row.tone-good .col-remarks .flap { color: var(--on); }
.board-row.tone-warn .col-remarks .flap { color: var(--amber); }
.board-row.tone-bad .col-remarks .flap { color: var(--red); }
.board-row.tone-dim .flap { color: var(--dim-ink); }
.board-row.tone-bad .col-time .flap, .board-row.tone-bad .col-flight .flap, .board-row.tone-bad .col-city .flap { color: var(--dim-ink); }
.light { flex: none; width: calc(var(--cw) * 0.55); height: calc(var(--cw) * 0.55); margin-left: calc(var(--cw) * 0.1); border-radius: 50%; background: #222; box-shadow: inset 0 1px 2px #000; }
.light.good { background: var(--on); box-shadow: 0 0 10px var(--on); }
.light.warn { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.light.bad { background: var(--red); box-shadow: 0 0 10px var(--red); }
.light.dim, .light:not(.good):not(.warn):not(.bad) { background: #2a2a2a; box-shadow: inset 0 1px 2px #000; }
.light:not(.blink) { opacity: 0.85; }
.light.good:not(.blink), .light.warn:not(.blink), .light.bad:not(.blink) { box-shadow: none; opacity: 0.55; }
.light.blink { animation: light-blink 1.1s steps(1) infinite; }
@keyframes light-blink { 50% { opacity: 0.12; box-shadow: none; } }

/* Fixed height so a longer note never changes how many rows fit. */
.board-foot { flex: none; height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; color: #8b887e; font-family: system-ui, sans-serif; font-size: 14px; }
.board-foot .err { color: var(--amber); }
#board-note { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#board-note.err { color: var(--amber); }
#board-page { white-space: nowrap; color: var(--sign); }

body.night .board { --sign: #a8741c; --ink: #c8a27c; --on: #8a9a5b; --amber: #c8923c; --red: #b5574b; --dim-ink: #7a6450; --flap: #141210; --flap-hi: #1a1714; }
body.night .board-head { color: #000; }

@media (max-width: 900px) {
  .tab { padding: 0 11px; font-size: 17px; }
  .board-head { flex-wrap: wrap; height: auto; padding: 12px 14px; gap: 10px 16px; }
  .board-sign { font-size: 32px; }
  .board-airport { order: 3; flex-basis: 100%; padding-left: 0; border-left: 0; }
  .board-switch { margin-left: auto; }
  .board-switch button { padding: 0 12px; font-size: 16px; }
  .board-cols, .board-rows, .board-foot { padding-left: 14px; padding-right: 14px; }
}
