:root {
  --hall: #070806;
  --hall-2: #10140c;
  --panel: #12140f;
  --metal: #3a3832;
  --metal-hi: #7a7568;
  --flap: #17140f;
  --flap-face: #221e17;
  --ivory: #f0d392;
  --ivory-dim: #c9ae74;
  --phosphor: #8cff6a;
  --phosphor-dim: #2f6b2c;
  --amber: #ffbf40;
  --hot: #ff4b32;
  --crt: #031406;
  --line: #2a2e24;
  --tape-a: #c9a227;
  --tape-b: #1a1406;
  --muted: #8a8678;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1a2214 0%, transparent 55%),
    linear-gradient(180deg, var(--hall-2), var(--hall) 40%);
  color: var(--ivory);
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
}

body {
  font-size: 18px;
}

a {
  color: var(--phosphor);
  text-decoration: none;
  border-bottom: 1px dotted rgba(140, 255, 106, 0.4);
}
a:hover { border-bottom-style: solid; }

.hall {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.tape {
  display: flex;
  gap: 2.5rem;
  overflow: hidden;
  white-space: nowrap;
  margin: 0 -16px 18px;
  padding: 6px 0;
  background: repeating-linear-gradient(
    -45deg,
    var(--tape-a) 0 14px,
    var(--tape-b) 14px 28px
  );
  color: #1a1406;
  font-weight: 700;
  letter-spacing: 0.28em;
  font-size: 11px;
  text-transform: uppercase;
  animation: crawl 28s linear infinite;
}
.tape span {
  background: var(--tape-a);
  padding: 2px 10px;
}

@keyframes crawl {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.lintel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
  padding: 8px 4px 16px;
  border-bottom: 2px solid var(--metal);
}

.station {
  margin: 0;
  font-family: "Bebas Neue", "Barlow Condensed", sans-serif;
  letter-spacing: 0.22em;
  font-size: 22px;
  color: var(--amber);
}
.substation {
  margin: 4px 0 0;
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.mast {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(56px, 9vw, 92px);
  letter-spacing: 0.18em;
  line-height: 0.85;
  text-align: center;
  color: var(--ivory);
  text-shadow:
    0 2px 0 #000,
    0 0 24px rgba(240, 211, 146, 0.18);
}

.lintel-right { justify-self: end; }

.crt-clock {
  position: relative;
  background: var(--crt);
  border: 3px solid #1c2818;
  box-shadow:
    inset 0 0 24px #000,
    0 0 0 1px #6a8a4a;
  padding: 8px 12px 10px;
  min-width: 168px;
  overflow: hidden;
}
.crt-label {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--phosphor-dim);
  letter-spacing: 0.18em;
}
.crt-digits {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 28px;
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--phosphor);
  letter-spacing: 0.08em;
}
.crt-scan {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.28) 2px 3px
  );
  mix-blend-mode: multiply;
}
.crt-clock::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 18px;
  background: linear-gradient(to bottom, transparent, rgba(140, 255, 106, 0.08), transparent);
  animation: sweep 3.6s linear infinite;
}
@keyframes sweep {
  from { top: -18px; }
  to { top: 110%; }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 14px 2px 8px;
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 13px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}
.pill strong { font-size: 16px; }
.lamp {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #444;
  box-shadow: inset 0 0 2px #000;
}
.ontime .lamp { background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); }
.delayed .lamp { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.grounded .lamp { background: var(--hot); box-shadow: 0 0 8px var(--hot); }
.ontime { color: var(--phosphor); }
.delayed { color: var(--amber); }
.grounded { color: var(--hot); }
.total { color: var(--ivory-dim); }

.feed { margin-left: auto; display: flex; gap: 10px; align-items: baseline; }
.mode {
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 2px 8px;
  border: 1px solid currentColor;
}
.mode.live { color: var(--phosphor); }
.mode.fallback { color: var(--amber); }
.mode.unknown { color: var(--muted); }
.note { color: var(--muted); font-size: 11px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 8px 0 12px;
}
.sorts { display: flex; gap: 6px; }
.sorts button {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 5px 10px;
  cursor: pointer;
}
.sorts button.active,
.sorts button:hover {
  color: var(--ivory);
  border-color: var(--ivory-dim);
}
.rule {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.housing {
  position: relative;
  background:
    linear-gradient(#2a2924, #1a1916);
  border: 1px solid #4a473e;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 18px 12px 10px;
}

.screws i {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #bbb, #555 55%, #222);
  box-shadow: 0 0 0 1px #111;
}
.screws i:nth-child(1) { top: 8px; left: 8px; }
.screws i:nth-child(2) { top: 8px; right: 8px; }
.screws i:nth-child(3) { bottom: 8px; left: 8px; }
.screws i:nth-child(4) { bottom: 8px; right: 8px; }

.board-head,
.row {
  display: grid;
  grid-template-columns:
    64px minmax(140px, 1.4fr) 118px 88px 100px 64px 92px 92px 118px;
  gap: 6px;
  align-items: center;
  padding: 0 8px;
}

.board-head {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #8a8670;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid #3a382f;
}

.board { display: flex; flex-direction: column; gap: 5px; }

.row {
  padding: 4px 8px;
  background: linear-gradient(#14120e, #0e0c0a);
  border: 1px solid #2a261f;
}

.flaps {
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
}
.flap {
  --d: 0ms;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.72em;
  height: 1.22em;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ivory);
  background: linear-gradient(#2c281f, #16130f 49%, #0c0b09 50%, #1d1a14);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 1px #000;
  animation: flip 420ms var(--d) both;
}
.flap::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.55);
}
@keyframes flip {
  0% { transform: rotateX(90deg); filter: brightness(1.8); }
  100% { transform: rotateX(0deg); filter: brightness(1); }
}

.crt-num {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 14px;
  color: #b6ff9a;
  text-shadow: 0 0 6px rgba(140, 255, 106, 0.35);
}

.dest-link { border: 0; color: inherit; }
.dest-link:hover .flap { color: #fff3c8; }

.status-tag {
  justify-self: stretch;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 13px;
  padding: 4px 0;
}
.status-tag.ontime { color: var(--phosphor); background: rgba(140, 255, 106, 0.08); }
.status-tag.delayed { color: var(--amber); background: rgba(255, 191, 64, 0.1); }
.status-tag.grounded { color: var(--hot); background: rgba(255, 75, 50, 0.1); }
.status-tag.unknown { color: var(--muted); background: rgba(138, 134, 120, 0.08); }

.rain-housing { margin-top: 28px; }

.rain-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 0 8px 12px;
}
.rain-mast {
  font-family: "Bebas Neue", "Barlow Condensed", sans-serif;
  font-size: 26px;
  letter-spacing: 0.2em;
  color: var(--amber);
  text-shadow: 0 1px 0 #000;
}

.rain-head,
.rain-row {
  display: grid;
  grid-template-columns: 64px minmax(170px, 1.5fr) 62px 110px 130px 150px;
  gap: 6px;
  align-items: center;
  padding: 0 8px;
}

.rain-head {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #8a8670;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid #3a382f;
}

.rain-row {
  padding: 4px 8px;
  background: linear-gradient(#14120e, #0e0c0a);
  border: 1px solid #2a261f;
}

.rain-rule { padding: 10px 8px 4px; }
.rain-rule code { font-family: "Share Tech Mono", ui-monospace, monospace; font-size: 11px; }
.rain-win-sub { text-align: center; padding-top: 2px; }

.muted { color: var(--muted); }
.tiny {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.empty {
  text-align: center;
  padding: 24px;
  font-family: "Share Tech Mono", ui-monospace, monospace;
  color: var(--muted);
}
.hidden { display: none; }

.apron {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}
.apron p { margin: 0 0 6px; }
.fine { font-size: 11px; opacity: 0.85; }

.noscript {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--hot);
  color: #1a0400;
  padding: 8px;
  text-align: center;
  font-weight: 700;
}

@media (max-width: 860px) {
  .lintel { grid-template-columns: 1fr; text-align: center; }
  .lintel-right { justify-self: center; }
  .feed { margin-left: 0; }
  .housing { overflow-x: auto; }
  .board-head, .row { min-width: 980px; }
  .rain-head, .rain-row { min-width: 700px; }
}

@media (prefers-reduced-motion: reduce) {
  .tape, .crt-clock::after, .flap { animation: none; }
}
