:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: #0c1822;
  --line: rgba(148, 177, 192, 0.24);
  --lime: #b8ed35;
  --cyan: #5ed6e8;
  --white: #f5f8fa;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body { color: var(--white); }

#program {
  width: 100vw;
  height: 100vh;
  min-width: 960px;
  min-height: 540px;
  padding: 12px;
  background:
    radial-gradient(circle at 30% 0%, rgba(39, 100, 115, 0.16), transparent 35%),
    linear-gradient(135deg, #08131c 0%, #050b10 100%);
}

.masthead {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(15, 34, 46, 0.98), rgba(7, 17, 25, 0.98));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
}

.brand-mark {
  width: 58px;
  height: 44px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
  color: var(--lime);
}

.brand-mark svg { width: 100%; height: 100%; fill: currentColor; }

.titles { min-width: 390px; }

.titles h1 {
  margin: 0;
  font-size: clamp(19px, 1.55vw, 30px);
  line-height: 1;
  letter-spacing: 0.105em;
  font-weight: 820;
}

.titles p {
  margin: 7px 0 0;
  color: #9db1bc;
  font-size: clamp(10px, 0.69vw, 14px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.weather {
  display: flex;
  align-items: center;
  flex: 1 1 520px;
  min-width: 220px;
  max-width: 760px;
  height: 42px;
  margin-left: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(2, 10, 15, .38);
}

.weather.stale { opacity: .65; }

.flight-category {
  display: grid;
  align-self: stretch;
  place-items: center;
  min-width: 66px;
  padding: 0 10px;
  color: #061017;
  background: #7e9099;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .08em;
}

.flight-category.vfr { background: #76db62; }
.flight-category.mvfr { color: white; background: #298ee8; }
.flight-category.ifr { color: white; background: #e84b4b; }
.flight-category.lifr { color: white; background: #b140cf; }

.metar-copy {
  display: block;
  min-width: 0;
  padding: 0 11px;
}

.metar-copy small, .metar-copy > span { display: block; }
.metar-copy small { color: #7f949f; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.metar-copy > span {
  margin-top: 3px;
  overflow: hidden;
  color: #cbd6db;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(8px, .58vw, 11px);
  font-weight: 650;
  letter-spacing: .015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 158px;
  height: 46px;
  padding: 0 14px;
  margin-left: 0;
  border: 1px solid currentColor;
  background: rgba(232, 75, 75, .1);
  color: #f05c5c;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.audio-status.on { background: rgba(184, 237, 53, .1); color: var(--lime); }
.audio-status.off { background: rgba(232, 75, 75, .1); color: #f05c5c; }
.audio-status:disabled { cursor: default; opacity: .72; }
.audio-status[hidden] { display: none; }

.pulse, .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 0 rgba(184, 237, 53, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(184, 237, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(184, 237, 53, 0); }
}

.audio-status small, .audio-status strong { display: block; }
.audio-status strong { font-size: 17px; font-weight: 900; letter-spacing: .12em; line-height: 1; }
.audio-status small { margin-top: 4px; color: currentColor; font-size: 8px; font-weight: 850; letter-spacing: .12em; line-height: 1; white-space: nowrap; }

.audio-bars { display: flex; align-items: end; gap: 2px; height: 20px; }
.audio-bars i { width: 3px; background: currentColor; animation: level 0.8s ease-in-out infinite alternate; }
.audio-bars i:nth-child(1) { height: 30%; animation-delay: -0.4s; }
.audio-bars i:nth-child(2) { height: 75%; animation-delay: -0.2s; }
.audio-bars i:nth-child(3) { height: 48%; animation-delay: -0.65s; }
.audio-bars i:nth-child(4) { height: 92%; animation-delay: -0.1s; }
.audio-status.off i { animation: none; height: 3px; }
@keyframes level { to { height: 25%; } }

.clock-block {
  min-width: 94px;
  margin-left: auto;
  text-align: right;
}

.clock-block[hidden] { display: none; }

#clock {
  display: block;
  color: #b9c6cc;
  font-variant-numeric: tabular-nums;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.clock-block small {
  display: block;
  margin-top: 3px;
  color: #71848d;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .08em;
  white-space: nowrap;
}

.content {
  height: calc(100% - 78px);
  display: grid;
  grid-template-columns: minmax(290px, .68fr) minmax(0, 1.82fr) minmax(385px, 1.25fr);
  gap: 10px;
}

.panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
}

.map-panel iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0a131a;
}

.stats-rail {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(15, 34, 46, .98), rgba(7, 18, 26, .98)),
    var(--panel);
  font-variant-numeric: tabular-nums;
}

.stats-rail.stale { border-color: rgba(232, 164, 75, .45); }

.stats-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.stats-heading small, .stats-heading strong { display: block; }
.stats-heading small { color: #778d98; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.stats-heading strong { margin-top: 3px; font-size: 14px; letter-spacing: .09em; }
.stats-live { color: var(--lime); font-size: 9px; font-weight: 850; letter-spacing: .1em; white-space: nowrap; }
.stats-live i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.stats-rail.stale .stats-live { color: #e8a44b; }

.stats-heroes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 10px 0;
}

.hero-stat {
  min-width: 0;
  padding: 9px 9px 8px;
  border: 1px solid rgba(184, 237, 53, .2);
  border-top: 2px solid var(--lime);
  background: rgba(184, 237, 53, .055);
}
.hero-stat strong { display: block; color: var(--lime); font-size: clamp(25px, 1.72vw, 34px); line-height: .95; }
.hero-stat span { display: block; margin-top: 7px; color: #a4b5bd; font-size: 9px; font-weight: 800; letter-spacing: .07em; white-space: nowrap; }
.hero-stat span b { color: #6f858f; font-weight: 800; }

.stats-section {
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.stats-heroes + .stats-section { border-top: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.section-title span { color: #a8bac2; font-size: 9px; font-weight: 850; letter-spacing: .11em; }
.section-title small { color: #657b85; font-size: 8px; font-weight: 800; letter-spacing: .09em; }

.today-grid, .spacing-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.today-grid > div, .spacing-grid > div { min-width: 0; padding: 0 8px; border-left: 1px solid var(--line); }
.today-grid > div:first-child, .spacing-grid > div:first-child { padding-left: 0; border-left: 0; }
.today-grid strong, .spacing-grid strong { display: block; color: var(--white); font-size: clamp(20px, 1.18vw, 24px); line-height: 1; }
.today-grid > div:first-child strong { color: var(--cyan); }
.today-grid span, .spacing-grid span { display: block; margin-top: 5px; color: #8398a1; font-size: 8px; font-weight: 800; letter-spacing: .055em; white-space: nowrap; }
.spacing-grid strong { font-size: clamp(19px, 1.08vw, 22px); }
.spacing-grid > div:last-child strong { color: var(--lime); }

.band-row {
  display: grid;
  grid-template-columns: 1fr auto 46px;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 8px;
  background: rgba(94, 214, 232, .055);
  border-left: 2px solid var(--cyan);
}
.band-row + .band-row { margin-top: 5px; }
.band-row.fast-band { background: rgba(184, 237, 53, .045); border-left-color: var(--lime); }
.band-row span b, .band-row span small { display: block; }
.band-row span b { color: #d8e2e6; font-size: 13px; }
.band-row span small { margin-top: 2px; color: #728994; font-size: 8px; font-weight: 800; letter-spacing: .06em; }
.band-row > strong { color: var(--cyan); font-size: 24px; }
.band-row.fast-band > strong { color: var(--lime); }
.band-speed { text-align: right; }

.runway-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.runway-card { min-width: 0; padding: 8px 10px; background: rgba(94, 214, 232, .055); border: 1px solid rgba(94, 214, 232, .13); border-left: 3px solid var(--cyan); }
.runway-card header { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(148, 177, 192, .18); }
.runway-card header span { color: var(--cyan); font-size: 15px; font-weight: 900; letter-spacing: .065em; }
.runway-card header strong { color: #8ea1aa; font-size: 10px; letter-spacing: .035em; white-space: nowrap; }
.runway-card header b { color: #edf3f5; font-size: 23px; line-height: 1; }
.runway-card ol { display: grid; gap: 4px; padding: 0; margin: 7px 0 0; list-style: none; }
.runway-card li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 8px; min-width: 0; color: #c1ced4; font-size: 12px; }
.runway-card li span { overflow: hidden; font-weight: 780; text-overflow: ellipsis; white-space: nowrap; }
.runway-card li time { color: #8298a2; font-size: 10px; font-weight: 700; }
.runway-empty { padding: 14px 8px; border: 1px dashed var(--line); color: #728894; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-align: center; }

.recent-section { padding-bottom: 8px; }
.recent-arrivals { display: grid; gap: 4px; padding: 0; margin: 0; list-style: none; }
.recent-arrivals li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; min-height: 21px; padding: 3px 6px; background: rgba(255, 255, 255, .025); }
.recent-arrivals li > span:first-child { overflow: hidden; color: #c5d2d7; font-size: 11px; font-weight: 780; text-overflow: ellipsis; white-space: nowrap; }
.recent-arrivals .runway-tag { padding: 2px 4px; color: var(--cyan); background: rgba(94, 214, 232, .08); font-size: 9px; font-weight: 900; white-space: nowrap; }
.recent-arrivals time { color: #7b919b; font-size: 9px; font-weight: 700; }

.speed-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; min-height: 20px; }
.speed-row > span { color: var(--lime); font-size: 9px; font-weight: 900; letter-spacing: .07em; }
.speed-row > strong { overflow: hidden; color: #dbe5e9; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.speed-row > b { color: var(--lime); font-size: 13px; }
.speed-row.slow > span, .speed-row.slow > b { color: var(--cyan); }

.types-section { flex: 1 1 auto; min-height: 99px; }
.top-types { display: grid; gap: 4px; padding: 0; margin: 0; list-style: none; counter-reset: type-rank; }
.top-types li { display: grid; grid-template-columns: 17px 1fr auto; align-items: center; min-width: 0; counter-increment: type-rank; color: #aebdc4; font-size: 11px; }
.top-types li::before { content: counter(type-rank); color: #607680; font-size: 9px; font-weight: 850; }
.top-types li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-types li b { color: #dbe5e9; }

.panel-label {
  position: absolute;
  z-index: 2;
  left: 10px;
  top: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 20px);
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(5, 13, 19, 0.9);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
  font-size: clamp(9px, 0.67vw, 13px);
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

a.panel-label {
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
}

a.panel-label::after {
  content: "↗";
  color: #8298a2;
  font-size: .9em;
}

a.panel-label:hover,
a.panel-label:focus-visible {
  border-color: rgba(184, 237, 53, .62);
  background: rgba(10, 25, 34, .97);
  color: white;
}

a.panel-label:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.map-label { border-left: 3px solid var(--lime); }
.map-corner {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 7px 9px;
  background: rgba(5, 13, 19, 0.85);
  color: #9fb1ba;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.camera-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.camera.featured { grid-column: 1 / -1; }

.camera iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.camera .panel-label {
  top: auto;
  bottom: 8px;
  left: 8px;
  padding: 6px 9px;
  border-left: 3px solid var(--cyan);
  font-size: clamp(8px, 0.57vw, 11px);
}

.camera.featured .panel-label { border-left-color: var(--lime); }

.camera-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: #6b7e88;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.standby {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(7, 16, 24, .9), rgba(7, 16, 24, .95)),
    repeating-linear-gradient(135deg, transparent 0 80px, rgba(184, 237, 53, .05) 80px 81px);
}

.standby[hidden] { display: none; }
.standby-plane { color: var(--lime); font-size: clamp(55px, 6vw, 110px); transform: rotate(-12deg); }
.standby p { margin: 26px 0 10px; color: var(--lime); font-size: 14px; font-weight: 850; letter-spacing: .36em; }
.standby h2 { margin: 0; font-size: clamp(32px, 3.4vw, 66px); font-weight: 780; letter-spacing: -.025em; }
.standby span { margin-top: 20px; color: #8ca0aa; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; }

@media (max-aspect-ratio: 3/2) {
  .titles { min-width: 270px; }
  .weather { max-width: none; }
  .content { grid-template-columns: minmax(275px, .8fr) minmax(0, 1.47fr) minmax(330px, 1fr); }
}

@media (max-width: 900px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #program {
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 100svh;
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .masthead {
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 12px;
    margin-bottom: 8px;
  }

  .brand-mark {
    width: 42px;
    height: 36px;
    padding-right: 8px;
  }

  .titles {
    min-width: 0;
  }

  .titles h1 {
    overflow: hidden;
    font-size: clamp(17px, 5vw, 25px);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .titles p {
    margin-top: 5px;
    overflow: hidden;
    font-size: clamp(8px, 2.45vw, 11px);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .weather {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 44px;
    margin: 0;
  }

  .flight-category {
    min-width: 62px;
  }

  .metar-copy > span {
    font-size: 10px;
  }

  .audio-status {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: center;
    width: 100%;
    min-width: 0;
    height: 48px;
    margin: 0;
    text-align: center;
  }

  .clock-block {
    min-width: 82px;
    margin: 0;
  }

  #clock {
    font-size: 16px;
  }

  .clock-block small {
    font-size: 7px;
  }

  .content {
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .stats-rail {
    order: 1;
    overflow: hidden;
    padding: 14px;
  }

  .stats-heading small,
  .section-title span,
  .stats-live {
    font-size: 10px;
  }

  .stats-heading strong {
    font-size: 16px;
  }

  .section-title small,
  .hero-stat span,
  .today-grid span,
  .spacing-grid span,
  .band-row span small {
    font-size: 9px;
  }

  .hero-stat strong {
    font-size: clamp(34px, 11vw, 48px);
  }

  .today-grid strong,
  .spacing-grid strong {
    font-size: clamp(25px, 7vw, 34px);
  }

  .band-row {
    min-height: 44px;
  }

  .band-row span b {
    font-size: 15px;
  }

  .band-row > strong {
    font-size: 27px;
  }

  .runway-card header span {
    font-size: 17px;
  }

  .runway-card header b {
    font-size: 26px;
  }

  .runway-card li,
  .speed-row > strong {
    font-size: 14px;
  }

  .runway-card li time,
  .recent-arrivals time,
  .recent-arrivals .runway-tag,
  .speed-row > span {
    font-size: 10px;
  }

  .recent-arrivals li {
    min-height: 28px;
    padding: 5px 7px;
  }

  .recent-arrivals li > span:first-child,
  .top-types li {
    font-size: 13px;
  }

  .speed-row {
    min-height: 27px;
  }

  .speed-row > b {
    font-size: 14px;
  }

  .types-section {
    min-height: 0;
  }

  .top-types {
    gap: 6px;
  }

  .map-panel {
    order: 2;
    height: min(72svh, 620px);
    min-height: 420px;
  }

  .panel-label {
    font-size: 10px;
  }

  .camera-rail {
    order: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: auto;
  }

  .camera {
    flex: none;
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .camera .panel-label {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .masthead {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 33px;
    padding-right: 6px;
  }

  .titles h1 {
    font-size: clamp(15px, 4.15vw, 18px);
    letter-spacing: .07em;
  }

  .titles p {
    letter-spacing: .045em;
  }

  #clock {
    font-size: 14px;
  }

  .clock-block {
    min-width: 72px;
  }

  .stats-rail {
    padding: 11px;
  }

  .hero-stat {
    padding: 9px 7px 8px;
  }

  .hero-stat span {
    letter-spacing: .04em;
  }

  .today-grid > div,
  .spacing-grid > div {
    padding: 0 5px;
  }

  .map-panel {
    height: 68svh;
    min-height: 380px;
  }
}
