:root {
  --bg: #0a0c0f;
  --glow: #12161c;
  --board: #12151a;
  --edge: #23282f;
  --cell-top: #23282f;
  --cell-bot: #171b20;
  --seam: rgba(0, 0, 0, 0.55);
  --ink: #ece7d9;
  --accent: #ffb84d;
  --dim: #6f7680;
  --good: #7ddc8e;
  --bad: #ff6b6b;
  --ctl: #1a1f26;
  --ctl-edge: #2a3038;
  --input-bg: #14181d;
}

body.theme-phosphor {
  --bg: #040705;
  --glow: #0a130c;
  --board: #081009;
  --edge: #16281b;
  --cell-top: #122619;
  --cell-bot: #0b1a10;
  --seam: rgba(0, 0, 0, 0.6);
  --ink: #b7f0c3;
  --accent: #55ff88;
  --dim: #47664f;
  --good: #55ff88;
  --bad: #ff7a66;
  --ctl: #0d1a11;
  --ctl-edge: #1c3323;
  --input-bg: #0a150e;
}

body.theme-daylight {
  --bg: #cfc9ba;
  --glow: #e6e0d2;
  --board: #efe9dc;
  --edge: #c9c2af;
  --cell-top: #fbf7ee;
  --cell-bot: #e7e0cf;
  --seam: rgba(0, 0, 0, 0.18);
  --ink: #23262e;
  --accent: #a35c00;
  --dim: #8d8776;
  --good: #1e7c3d;
  --bad: #b8332a;
  --ctl: #e7e1d2;
  --ctl-edge: #c9c2af;
  --input-bg: #f4efe4;
}

body.theme-indigo {
  --bg: #06080f;
  --glow: #0d1322;
  --board: #0c1120;
  --edge: #1d2742;
  --cell-top: #1c2743;
  --cell-bot: #131a30;
  --seam: rgba(0, 0, 0, 0.55);
  --ink: #e2e8fb;
  --accent: #8ab0ff;
  --dim: #5c6788;
  --good: #79e0a0;
  --bad: #ff7b8a;
  --ctl: #131a2c;
  --ctl-edge: #263356;
  --input-bg: #0f1526;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, var(--glow) 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.hall {
  width: 100%;
  max-width: 1500px;
  padding: 24px;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 6px 14px;
  color: var(--accent);
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

.hdr-title { letter-spacing: 0.35em; font-size: clamp(14px, 2.2vw, 24px); }
.hdr-clock { letter-spacing: 0.2em; font-size: clamp(13px, 2vw, 21px); }

.colheads {
  display: flex;
  gap: 2px;
  padding: 0 18px 8px;
  color: var(--dim);
  font-size: clamp(7px, 1vw, 11px);
  letter-spacing: 0.14em;
}

.colheads span { overflow: hidden; white-space: nowrap; }

.board {
  background: var(--board);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.35),
    0 24px 70px rgba(0, 0, 0, 0.35);
}

.row { display: flex; gap: 2px; }

.cell {
  flex: 1;
  aspect-ratio: 0.72;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(var(--cell-top), var(--cell-bot));
  border-radius: 2px;
  font-size: clamp(5px, 1.05vw, 14px);
  font-weight: 600;
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* the split-flap seam */
.cell::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--seam);
}

.gap { margin-left: 1.1%; }

/* two identical animations under different names, so the script can
   restart the flip by alternating classes instead of forcing a reflow */
.cell.flip-a { animation: flap-a 70ms ease-out; }
.cell.flip-b { animation: flap-b 70ms ease-out; }

@keyframes flap-a {
  0%   { transform: scaleY(0.15); filter: brightness(1.7); }
  100% { transform: scaleY(1); }
}

@keyframes flap-b {
  0%   { transform: scaleY(0.15); filter: brightness(1.7); }
  100% { transform: scaleY(1); }
}

/* remark status colours */
.st-boarding  { color: var(--good); text-shadow: 0 0 9px color-mix(in srgb, var(--good) 40%, transparent); }
.st-delayed   { color: var(--accent); text-shadow: 0 0 9px color-mix(in srgb, var(--accent) 40%, transparent); }
.st-cancelled { color: var(--bad); text-shadow: 0 0 9px color-mix(in srgb, var(--bad) 40%, transparent); }
.st-departed  { color: var(--dim); }
.st-final     { color: var(--accent); animation: final-pulse 1.2s ease-in-out infinite; }

/* boarding marks: a round lamp per row in the boarding column, like the
   little green indicators on the real board — dark socket until the
   flight actually boards, blinking through the final call */
.lamp { position: relative; }

.lamp::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(4px, 0.55vw, 8px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cell-bot);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

body.marks .lamp.lit::after {
  background: var(--good);
  box-shadow: 0 0 9px color-mix(in srgb, var(--good) 70%, transparent);
}

body.marks .lamp.blink::after { animation: lamp-blink 1.1s steps(1) infinite; }

@keyframes lamp-blink { 50% { opacity: 0.3; } }

@keyframes final-pulse {
  50% {
    color: color-mix(in srgb, var(--accent) 55%, var(--ink));
    text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cell.flip-a, .cell.flip-b { animation: none; }
  .st-final { animation: none; }
  body.marks .lamp.blink::after { animation: none; }
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.controls .spacer { flex: 1; }

.controls button,
.controls select {
  background: var(--ctl);
  border: 1px solid var(--ctl-edge);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  padding: 10px 16px;
  cursor: pointer;
  letter-spacing: 0.06em;
}

.controls button:hover,
.controls select:hover { border-color: var(--accent); color: var(--accent); }

/* ambient display: in fullscreen the controls fade away until hovered */
:fullscreen .controls { opacity: 0.15; transition: opacity 0.4s; }
:fullscreen .controls:hover,
:fullscreen .controls:focus-within { opacity: 1; }

/* ---- small screens: shed columns so the flaps stay readable ---- */

/* tablets / phones in landscape: drop the origin column (it repeats
   the home airport anyway) */
@media (max-width: 900px) {
  .hall { padding: 14px 10px; }
  .board { padding: 10px; border-radius: 10px; }
  .f-origin { display: none; }
}

/* phones: drop the airline and check-in columns too, tighten spacing,
   and let the controls fill the width for comfortable touch targets */
@media (max-width: 640px) {
  .f-airline { display: none; }
  .f-check-in { display: none; }
  .board { gap: 4px; }
  .row { gap: 1px; }
  .cell { font-size: clamp(7px, 2.1vw, 14px); }
  .colheads { padding: 0 12px 6px; }
  .controls { gap: 8px; margin-top: 14px; }
  .controls .spacer { display: none; }
  .controls button,
  .controls select { flex: 1 1 auto; padding: 12px 8px; }
}

/* small phones in portrait: gate goes as well */
@media (max-width: 430px) {
  .f-gate { display: none; }
  .cell { font-size: clamp(6px, 2.6vw, 14px); }
  .board-header { padding-bottom: 10px; }
  .hdr-title { letter-spacing: 0.15em; }
}
