:root {
  --bg: #050804;
  --crt: #07140a;
  --phosphor: #7cff6b;
  --phosphor-dim: #3a8a32;
  --phosphor-dead: #143318;
  --amber: #e6c15a;
  --red: #ff5a4a;
  --flap: #0c160c;
  --flap-edge: #1c331c;
  --scan: rgba(0, 0, 0, 0.18);
  --glow: 0 0 8px rgba(124, 255, 107, 0.45), 0 0 24px rgba(124, 255, 107, 0.15);
  --glow-amber: 0 0 8px rgba(230, 193, 90, 0.45), 0 0 24px rgba(230, 193, 90, 0.15);
  --glow-red: 0 0 8px rgba(255, 90, 74, 0.45), 0 0 24px rgba(255, 90, 74, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--phosphor);
  font-family: "IBM Plex Mono", "Share Tech Mono", ui-monospace, Menlo, monospace;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem 3rem;
}

.crt {
  position: relative;
  width: min(920px, 100%);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(124, 255, 107, 0.07), transparent 55%),
    var(--crt);
  border: 2px solid var(--phosphor-dead);
  border-radius: 18px;
  padding: 2rem 1.75rem 1.5rem;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.55),
    0 0 0 8px #020301,
    0 0 40px rgba(124, 255, 107, 0.08);
  overflow: hidden;
}

.crt::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    var(--scan) 3px,
    var(--scan) 3px
  );
  mix-blend-mode: multiply;
  z-index: 3;
}

.crt::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.45) 100%);
  z-index: 2;
}

header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--phosphor-dead);
  padding-bottom: 0.85rem;
  margin-bottom: 1.25rem;
}

h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  text-transform: uppercase;
  text-shadow: var(--glow);
}

.meta {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--phosphor-dim);
  text-transform: uppercase;
}

.meta a { color: var(--phosphor); }

.status-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.label {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  color: var(--phosphor-dim);
  text-transform: uppercase;
}

.flaps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.flaps.big { margin: 0.1rem 0; }

.flap {
  position: relative;
  width: 1.35rem;
  height: 1.9rem;
  background: linear-gradient(to bottom, #152215 0%, var(--flap) 48%, #050805 52%, #101c10 100%);
  border: 1px solid var(--flap-edge);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--phosphor);
  text-shadow: var(--glow);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.flaps.big .flap {
  width: clamp(1.25rem, 4.8vw, 2rem);
  height: clamp(1.9rem, 6.6vw, 2.8rem);
  font-size: clamp(1.05rem, 3.8vw, 1.7rem);
}

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

/* Status colors: green on time, red late/down, amber grounded/gate. */
#status.late .flap,
#status.down .flap { color: var(--red); text-shadow: var(--glow-red); }

#status.grounded .flap,
#status.gate .flap { color: var(--amber); text-shadow: var(--glow-amber); }

/* Blank cells stay dead in every state (equal specificity, listed last). */
#status .flap.blank { color: var(--phosphor-dead); text-shadow: none; }

.board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.cell .flaps { margin-top: 0.4rem; }

.graphs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.4rem;
}

.graph-cell {
  border: 1px solid var(--phosphor-dead);
  border-radius: 10px;
  padding: 0.75rem 0.85rem 0.65rem;
  background: rgba(0, 0, 0, 0.25);
}

.graph-cell.wide { grid-column: 1 / -1; }

.graph-cell canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0.45rem;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.45rem;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--phosphor-dim);
}

.lg::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.35rem;
  border-radius: 1px;
  vertical-align: middle;
}

.lg.remaining::before { background: var(--phosphor); box-shadow: var(--glow); }
.lg.escrow::before { background: var(--phosphor); box-shadow: var(--glow); }
.lg.fee::before { background: var(--amber); }
.lg.ticks::before { background: var(--phosphor-dim); }

.notes {
  position: relative;
  z-index: 1;
  margin-top: 1.6rem;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--phosphor-dim);
  letter-spacing: 0.04em;
}

.notes a { color: var(--phosphor); }

.foot {
  position: relative;
  z-index: 1;
  margin: 1.4rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--phosphor-dead);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--phosphor-dim);
}

@media (min-width: 640px) {
  .board { grid-template-columns: 1fr 1fr 1fr; }
  .graphs { grid-template-columns: 1fr 1fr; }
}
