:root {
  --bg: #000;
  --bg-glow: #0d0d10;
  --panel: #101114;
  --panel-edge: #1d1e23;
  --flap: #1b1c20;
  --flap-hi: #26272c;
  --split: #050506;
  --ink: #f3eee2;
  --ink-dim: #8a8c93;
  --amber: #ffb02e;
  --amber-glow: rgba(255, 176, 46, 0.55);
  --slot-w: 0.6em;
  --slot-h: 1.25em;
  --flap-size: 26px;
  --font-flap: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-text: "Barlow", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.45;
  background:
    radial-gradient(120% 70% at 50% 0%, var(--bg-glow) 0%, var(--bg) 60%);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: rgba(243, 238, 226, 0.35); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

.masthead { text-align: center; margin: 0 0 22px; }
.masthead h1 {
  font-family: var(--font-flap);
  font-weight: 600;
  font-size: clamp(34px, 7vw, 56px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  margin: 0 0 12px;
}
.lede {
  margin: 0 auto;
  max-width: 34em;
  color: var(--ink-dim);
  font-size: 15px;
}

/* ---- the board ---- */
.board {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 12px 14px 12px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.03);
}
.board-head, .board-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-flap);
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim);
}
.board-head { padding: 0 2px 10px; border-bottom: 1px solid var(--panel-edge); }
.board-foot { padding: 10px 2px 0; border-top: 1px solid var(--panel-edge); min-height: 30px; gap: 12px; }
.board-foot .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row {
  display: grid;
  grid-template-columns: auto auto auto auto auto 1fr;
  gap: 14px 18px;
  padding: 16px 2px 14px;
  font-size: var(--flap-size);
}
.cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cell-route .flap, .cell-status .flap { font-size: 0.8em; }
.label {
  font-family: var(--font-flap);
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-dim); line-height: 1;
}
.label em { font-style: normal; color: var(--amber); }

.flap {
  display: inline-flex; gap: 2px;
  font-family: var(--font-flap); font-weight: 500;
  line-height: 1;
}
.flap-amber { color: var(--amber); }
.slot {
  position: relative; display: block; flex: none;
  width: var(--slot-w); height: var(--slot-h);
  perspective: 240px;
  border-radius: 3px;
  background: var(--split);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03);
}
.slot .half, .slot .leaf {
  position: absolute; left: 0; right: 0; height: 50%; overflow: hidden;
  background: var(--flap);
  backface-visibility: hidden;
}
.slot .half.top, .slot .leaf-top { top: 0; border-radius: 3px 3px 0 0; background: linear-gradient(var(--flap-hi), var(--flap)); }
.slot .half.bottom, .slot .leaf-bottom { bottom: 0; border-radius: 0 0 3px 3px; }
.slot .half span, .slot .leaf span {
  position: absolute; left: 0; right: 0; text-align: center;
  height: var(--slot-h); line-height: var(--slot-h);
}
.slot .top span, .slot .leaf-top span { top: 0; }
.slot .bottom span, .slot .leaf-bottom span { bottom: 0; }
.slot .leaf { visibility: hidden; z-index: 2; }
.slot .leaf-top { transform-origin: 50% 100%; }
.slot .leaf-bottom { transform-origin: 50% 0%; }
.slot::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  background: var(--split); z-index: 3; transform: translateY(-0.5px);
}

/* ---- map ---- */
.map-wrap { margin: 22px 0 8px; }
.map-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 0 2px 10px;
  font-family: var(--font-flap); font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim);
}
.leg { min-height: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leg b { color: var(--ink); font-weight: 500; }
.view-toggle { display: flex; border: 1px solid var(--panel-edge); border-radius: 4px; overflow: hidden; flex: none; }
.view-toggle button {
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  color: var(--ink-dim); background: transparent; border: 0; padding: 6px 12px; cursor: pointer;
}
.view-toggle button + button { border-left: 1px solid var(--panel-edge); }
.view-toggle button[aria-pressed="true"] { color: var(--amber); background: rgba(255,176,46,0.08); }
#map { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; background: #08090b; }
.map-wrap.world #map { aspect-ratio: 2 / 1; background: transparent; }

.progress { padding: 14px 2px 4px; }
.progress-track { position: relative; height: 2px; background: var(--panel-edge); border-radius: 1px; }
.progress-fill { height: 100%; width: 0; background: var(--amber); border-radius: 1px; transition: width 0.6s ease; }
.progress-dot {
  position: absolute; top: 50%; left: 0; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber-glow);
  transition: left 0.6s ease;
}
.readouts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin: 12px 0 0; padding: 0 2px;
}
.readouts div { min-width: 0; }
.readouts dt {
  font-family: var(--font-flap); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-dim); line-height: 1; margin-bottom: 6px;
}
.readouts dt em { font-style: normal; color: var(--amber); }
.readouts dd {
  margin: 0; font-family: var(--font-flap); font-weight: 500; font-size: 24px; line-height: 1;
  letter-spacing: 0.03em; white-space: nowrap;
}
.readouts dd small { font-size: 0.6em; color: var(--ink-dim); letter-spacing: 0.08em; margin-left: 3px; }
.map-wrap.world .progress, .map-wrap.world .readouts { display: none; }

/* ---- below the board ---- */
.held { text-align: center; margin: 8px 0 28px; }
.held-line {
  font-family: var(--font-flap);
  font-size: clamp(18px, 3.4vw, 24px);
  letter-spacing: 0.12em; text-transform: uppercase;
  margin: 0 0 14px; min-height: 1.4em;
}
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.actions button, .sound {
  font-family: var(--font-flap); font-size: 17px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink); background: transparent;
  border: 1px solid var(--ink-dim); border-radius: 4px;
  padding: 10px 18px; cursor: pointer;
}
.actions button.primary { border-color: var(--amber); color: var(--amber); }
.actions button:hover, .sound:hover { border-color: var(--ink); }
.notice { color: var(--ink-dim); font-size: 14px; margin: 12px 0 0; }

.foot { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 8px; }
.sound { font-size: 13px; padding: 7px 12px; color: var(--ink-dim); border-color: var(--panel-edge); }
.sound[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }
.credits { max-width: 60em; text-align: center; color: var(--ink-dim); font-size: 12.5px; margin: 0; }

/* ---- phones ---- */
@media (max-width: 960px) {
  :root { --flap-size: 26px; }
  .row { grid-template-columns: auto auto auto; justify-content: start; gap: 16px 18px; }
  .cell-flight, .cell-route, .cell-status { grid-column: 1 / -1; }
  .cell-route .flap, .cell-status .flap { font-size: 0.8em; }
  .board { padding: 10px 12px; }
  .board-foot { flex-direction: column; align-items: flex-start; gap: 2px; }
  #map { aspect-ratio: 4 / 3; }
  .map-head { flex-wrap: wrap; }
  .leg { flex: 1 0 100%; order: 2; padding-top: 10px; white-space: normal; }
  .view-toggle { margin-left: auto; }
  .readouts { grid-template-columns: 1fr 1fr; gap: 14px 10px; }
  .readouts dd { font-size: 22px; }
}
@media (max-width: 380px) {
  :root { --flap-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .slot { perspective: none; }
}
