:root {
  --bg: #04070e;
  --ink: #04070e;
  --panel: rgba(8, 14, 26, 0.38);
  --panel-2: rgba(10, 18, 32, 0.48);
  --panel-strong: rgba(8, 14, 26, 0.56);
  --chrome-blur: blur(16px) saturate(1.15);
  --chrome-top: 124px;
  --chrome-left: 232px;
  --chrome-right: 280px;
  --chrome-bottom: 160px;
  --line: rgba(150, 185, 220, 0.17);
  --line-soft: rgba(150, 185, 220, 0.09);
  --paper: #e7f0f8;
  --text: #e7f0f8;
  --muted: #c5d2de;
  --dim: #a8b8c6;
  --amber: #ffcf5a;
  --ion: #54d7ff;
  --ion-soft: #a7eeff;
  --risk: #ff5b63;
  --ok: #61e4af;
  --orange: #ff864b;
  --blue: #6596ff;
  --scroll-thumb: #3a4d62;
  --scroll-thumb-hover: #6a8498;
  --scroll-thumb-active: var(--ion);
  --chrome: rgba(4, 8, 16, 0.36);
  --hud: rgba(8, 14, 26, 0.72);
  --font: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

body.theme-day {
  --bg: #d7e3ee;
  --ink: #14202c;
  --panel: rgba(255, 255, 255, 0.46);
  --panel-2: rgba(255, 255, 255, 0.58);
  --panel-strong: rgba(248, 252, 255, 0.66);
  --line: rgba(20, 42, 64, 0.18);
  --line-soft: rgba(20, 42, 64, 0.1);
  --paper: #142433;
  --text: #142433;
  --muted: #3d5266;
  --dim: #5a6e80;
  --ion: #0a7ea8;
  --ion-soft: #066888;
  --amber: #8d6200;
  --risk: #c43b42;
  --ok: #1a8a5c;
  --orange: #c45c20;
  --blue: #2f5fbf;
  --scroll-thumb: #8aa0b4;
  --scroll-thumb-hover: #6a8498;
  --chrome: rgba(255, 255, 255, 0.52);
  --hud: rgba(255, 255, 255, 0.82);
}

* { box-sizing: border-box; }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:active {
  background: var(--scroll-thumb-active);
  background-clip: padding-box;
}
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.map-back {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.scan {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(110, 155, 200, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 155, 200, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
  z-index: 1;
}
body.theme-day .scan { opacity: 0.07; }

.top, footer, main { position: relative; z-index: 2; }

.top {
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto minmax(160px, 280px) auto;
  gap: 16px 20px;
  align-items: center;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--chrome);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  overflow: visible;
}

.top:has(#searchHome[hidden]),
body.globe-on .top,
body.china-on .top {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  padding: 5px 10px 5px 8px;
  background: rgba(236, 244, 252, 0.26);
  border: 1px solid rgba(150, 185, 220, 0.28);
}

.brand-logo img {
  display: block;
  height: 40px;
  width: auto;
}

body.theme-day .brand-logo {
  background: rgba(255, 255, 255, 0.86);
}

.brand-copy { min-width: 0; }

.eyebrow {
  margin: 0;
  color: var(--ion);
  letter-spacing: 0.8px;
  font-size: 12px;
  white-space: nowrap;
}

h1 {
  margin: 4px 0 0;
  font-size: 20px;
  letter-spacing: 2px;
  font-weight: 600;
  white-space: nowrap;
}

.brand-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 2px;
  white-space: nowrap;
}

.clock {
  font-size: 15px;
  letter-spacing: 1px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.role {
  margin: 4px 0 0;
  text-align: right;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(97, 228, 175, 0.28);
  background: rgba(97, 228, 175, 0.08);
  color: var(--ok);
  font-size: 11px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
  animation: pill-pulse 2.4s ease-in-out infinite;
}

@keyframes pill-pulse {
  50% { box-shadow: 0 0 4px var(--ok); opacity: 0.55; }
}

.token {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
}

.token select {
  min-width: 148px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--paper);
  padding: 6px 8px;
  font: inherit;
  cursor: pointer;
}

.token select option {
  background: var(--bg);
  color: var(--paper);
}

.head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-home {
  min-width: 0;
  justify-self: stretch;
}

.search-box {
  position: relative;
  z-index: 5;
  min-width: 0;
  justify-self: stretch;
}
.search-field { position: relative; }
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--paper);
  font: inherit;
  font-size: 12px;
  padding: 7px 10px;
}
.search-box.is-loading input { padding-right: 32px; }
.search-box input::placeholder { color: var(--dim); }
.search-spin {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid var(--line);
  border-top-color: var(--ion);
  border-radius: 50%;
  animation: search-spin 0.7s linear infinite;
  pointer-events: none;
}
.search-spin[hidden] { display: none; }
@keyframes search-spin {
  to { transform: rotate(360deg); }
}
.search-hits {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--hud);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
}
.search-hits li { margin: 0; padding: 0; }
.search-hits button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 12px;
  padding: 8px;
  cursor: pointer;
}
.search-hits button:hover,
.search-hits button.active {
  color: var(--ion-soft);
  background: rgba(84, 215, 255, 0.1);
}
.search-hits .hit-name { display: block; }
.search-hits .hit-meta { display: block; margin-top: 3px; color: var(--dim); font-size: 11px; }
.search-hits .empty { padding: 8px; color: var(--dim); font-size: 12px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.chips button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}
.chips button.on {
  color: var(--ion-soft);
  border-color: var(--ion);
  background: rgba(84, 215, 255, 0.1);
}

.bldg-popup .leaflet-popup-content-wrapper,
.bldg-popup .leaflet-popup-tip {
  background: var(--hud);
  color: var(--paper);
  border: 1px solid var(--line);
  box-shadow: none;
}
.bldg-popup .leaflet-popup-content { margin: 12px 14px; }
.bldg-popup a.leaflet-popup-close-button { color: var(--dim); }
.bldg-pop h4 {
  margin: 0 0 8px;
  font-size: 13px;
}
.bldg-pop dl { margin: 0; display: grid; gap: 6px; }
.bldg-pop dl div { display: grid; grid-template-columns: 56px 1fr; gap: 8px; font-size: 12px; }
.bldg-pop dt { color: var(--dim); }
.bldg-pop dd { margin: 0; }

main {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 268px;
  pointer-events: none;
}

.rail, .detail {
  pointer-events: auto;
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  padding: 16px 14px;
  overflow: auto;
  min-height: 0;
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
}

.rail {
  display: flex;
  flex-direction: column;
}

.detail { border-right: 0; border-left: 1px solid var(--line); }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.tab, button {
  font: inherit;
  cursor: pointer;
}

.tab {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 8px 4px;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
}

.tab.on {
  color: var(--ion-soft);
  background: rgba(84, 215, 255, 0.1);
  border-color: rgba(84, 215, 255, 0.45);
  box-shadow: 0 0 16px rgba(84, 215, 255, 0.08);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  flex: 1;
  overflow: auto;
}

.list li {
  position: relative;
  border: 1px solid var(--line);
  padding: 8px 10px 8px 12px;
  cursor: pointer;
  background: var(--panel-2);
}

.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}

.list li.tone-now::before,
.list li.on::before { background: var(--ion); }
.list li.tone-fcst::before { background: var(--amber); }
.list li.tone-obs::before { background: var(--blue); }
.list li.on { border-color: rgba(84, 215, 255, 0.55); box-shadow: inset 0 0 0 1px rgba(84, 215, 255, 0.12); }
.list li.empty { cursor: default; color: var(--dim); }
.list li.empty::before { display: none; }
.list li.duty-acked { border-color: rgba(255, 207, 90, 0.4); }
.list li.duty-acked::before { background: var(--amber); }
.list li.duty-dispatched { border-color: rgba(97, 228, 175, 0.4); }
.list li.duty-dispatched::before { background: var(--ok); }

.list .prod-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.list .prod-mark { color: var(--ion-soft); }
.list .prod-title { display: block; font-size: 12px; line-height: 1.4; }
.list small { display: block; color: var(--dim); margin-top: 4px; font-size: 11px; }

.duty-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 14px;
}

[hidden] { display: none !important; }

#btnAck, #btnDispatch, .ghost {
  border: 0;
  padding: 8px 10px;
}

#btnAck {
  background: rgba(255, 207, 90, 0.16);
  color: var(--amber);
  border: 1px solid rgba(255, 207, 90, 0.35);
}

#btnDispatch {
  background: rgba(84, 215, 255, 0.14);
  color: var(--ion-soft);
  border: 1px solid rgba(84, 215, 255, 0.4);
}

.ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
}

.hint, #mapMeta, #frameLabel, .story {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.55;
}

.story {
  color: var(--paper);
  margin: 0 0 14px;
}

.stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: 8px 12px 6px;
  min-width: 0;
}
.stage-head {
  pointer-events: auto;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  background: var(--chrome);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
}
.stage-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 1px;
  white-space: nowrap;
}
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.stage-tools { display: grid; justify-items: end; gap: 6px; }
#mapMeta {
  margin: 4px 0 0;
  max-width: 46ch;
  font-size: 11px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.horizons { display: flex; gap: 6px; }
.view-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.view-row .horizons { margin-top: 0; }
.field-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.field-ramp {
  width: 140px;
  height: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--ion), var(--amber), var(--orange), var(--risk));
}
.field-ramp.invert {
  background: linear-gradient(90deg, var(--risk), var(--orange), var(--amber), var(--ion));
}
.horizons button {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 5px 9px;
  font-size: 11px;
  white-space: nowrap;
}
.horizons button.on {
  color: var(--ion-soft);
  background: rgba(84, 215, 255, 0.12);
  border-color: rgba(84, 215, 255, 0.45);
}

.map-frame {
  position: relative;
  min-height: 0;
  margin-top: 12px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(150, 185, 220, 0.12);
}

.map-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 72px rgba(4, 7, 14, 0.28);
}
body.theme-day .map-frame::after {
  box-shadow: inset 0 0 56px rgba(215, 227, 238, 0.18);
}

.map-hud {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 7;
  pointer-events: auto;
}

.map-back:fullscreen .map-hud,
.map-back:-webkit-full-screen .map-hud {
  left: 16px;
  right: 16px;
  bottom: 16px;
}

#map {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
}

#globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: transparent;
  z-index: 1;
  touch-action: none;
  cursor: grab;
}
#globe:active { cursor: grabbing; }
body.globe-on #globe {
  display: block;
}

body.globe-on #map {
  visibility: hidden;
  pointer-events: none;
}

body.globe-on .scan,
body.china-on .scan {
  opacity: 0.06;
}

body.globe-on .layer-toggles,
body.globe-on .search-home,
body.china-on .search-home {
  display: none;
}

.globe-tip {
  position: fixed;
  z-index: 8;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  background: rgba(8, 14, 24, 0.88);
  border: 1px solid rgba(150, 185, 220, 0.28);
  pointer-events: none;
  white-space: nowrap;
}

.map-back:fullscreen,
.map-back:-webkit-full-screen {
  width: 100%;
  height: 100%;
}

.iono-hud.no-tecu .iono-tecu { display: none; }
.iono-hud {
  position: absolute;
  top: 12px;
  right: 54px;
  z-index: 5;
  display: flex;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}

.map-back:fullscreen .iono-hud,
.map-back:-webkit-full-screen .iono-hud {
  top: 12px;
  right: 54px;
}

.elev-hud {
  position: absolute;
  left: calc(var(--chrome-left) + 16px);
  bottom: calc(var(--chrome-bottom) + 72px);
  z-index: 8;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--hud);
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 0.04em;
  backdrop-filter: var(--chrome-blur);
  pointer-events: none;
}

.map-back:fullscreen .elev-hud,
.map-back:-webkit-full-screen .elev-hud {
  left: 16px;
  bottom: 18px;
}

.terrain-shade {
  mix-blend-mode: multiply;
}

.risk-field {
  mix-blend-mode: screen;
}
body.china-on .risk-field {
  mix-blend-mode: normal;
}
body.theme-day .risk-field {
  mix-blend-mode: multiply;
}
body.theme-day.china-on .risk-field {
  mix-blend-mode: normal;
}
.iono-tecu {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  justify-items: center;
  gap: 4px;
  min-height: 168px;
  padding: 8px 7px;
  border: 1px solid var(--line);
  background: var(--hud);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  color: var(--paper);
  font-size: 10px;
}
.iono-tecu-unit {
  color: var(--dim);
  letter-spacing: 0.06em;
}
.iono-tecu-ramp {
  width: 10px;
  min-height: 110px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--risk), var(--orange), var(--amber), var(--ion));
}
.iono-wx-panel {
  display: flex;
  flex-direction: column;
  min-width: 118px;
  max-width: 176px;
  border: 1px solid var(--line);
  background: var(--hud);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
}
.iono-wx {
  margin: 0;
  padding: 8px 10px 4px;
}
.iono-wx-note {
  margin: 0;
  padding: 0 10px 8px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.35;
}
.iono-wx div {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 6px;
  align-items: baseline;
  margin: 0 0 8px;
}
.iono-wx div:last-child { margin-bottom: 0; }
.iono-wx dt {
  margin: 0;
  color: var(--dim);
  font-size: 10px;
}
.iono-wx dd {
  margin: 0;
  color: var(--paper);
  font-size: 12px;
  text-align: right;
}

.map-full {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--paper);
}

.map-full svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.map-full .icon-collapse,
.map-full .icon-close { display: none; }
.map-full.on .icon-expand { display: none; }
.map-full.on .icon-collapse { display: block; }

.map-back > .map-full,
.map-back:fullscreen .map-full,
.map-back:-webkit-full-screen .map-full {
  top: 10px;
  right: 10px;
  z-index: 1100;
}

body.globe-on .map-back,
body.china-on .map-back,
.map-back:fullscreen,
.map-back:-webkit-full-screen {
  background:
    radial-gradient(ellipse 72% 58% at 50% 42%, rgba(62, 118, 188, 0.32), transparent 58%),
    radial-gradient(ellipse 100% 80% at 50% 108%, rgba(10, 36, 68, 0.96), #07111d 70%),
    #07111d;
}

body.china-on .leaflet-container {
  background: transparent;
}

body.china-on .leaflet-tile-pane {
  display: none;
}

body.globe-on .map-back::before,
body.china-on .map-back::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("/console/data/globe/stars.png") center / cover;
  opacity: 0.62;
}

.leaflet-container {
  background: var(--bg);
  font-family: var(--font);
}

.leaflet-container :focus,
.leaflet-interactive:focus,
.leaflet-image-layer:focus,
.leaflet-zoom-animated:focus {
  outline: none;
}

.china-plate {
  pointer-events: none;
}

.leaflet-tile-pane {
  filter: none;
}
body.theme-night .leaflet-tile-pane {
  filter: saturate(1.14) contrast(1.06);
}

.leaflet-control-zoom,
.leaflet-top.leaflet-left {
  display: none !important;
}

.city-dot {
  background: var(--amber);
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.city-name {
  position: absolute;
  left: 10px;
  top: -8px;
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 0.6px;
  text-shadow: 0 0 4px var(--ink), 0 1px 2px var(--ink);
  white-space: nowrap;
}
body.theme-day .city-name {
  text-shadow: 0 0 4px #fff, 0 1px 2px #fff;
}

.legend-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 10px;
  pointer-events: auto;
  border: 1px solid var(--line);
  background: var(--hud);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
}
.layer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-left: auto;
  color: var(--dim);
  font-size: 11px;
}
.layer-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.layer-group > span {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.layer-toggles label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--dim);
}
.layer-toggles label:has(input:checked) {
  color: var(--ion-soft);
  border-color: rgba(84, 215, 255, 0.45);
  background: rgba(84, 215, 255, 0.1);
}
.layer-toggles input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.legend-title {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  text-align: left;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 1px solid transparent;
  vertical-align: -2px;
}
.swatch.empty { background: transparent !important; }
.swatch.hatch.high {
  background: repeating-linear-gradient(-32deg, var(--orange) 0 2px, rgba(255, 134, 75, 0.2) 2px 6px) !important;
}
.swatch.hatch.very_high {
  background: repeating-linear-gradient(-32deg, var(--risk) 0 2px, rgba(255, 91, 99, 0.2) 2px 5px) !important;
}

.panel-kicker {
  margin: 0 0 6px;
  color: var(--ion);
  font-size: 9px;
  letter-spacing: 2px;
}

.detail h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text);
}

dl { margin: 0 0 16px; }
dt { color: var(--dim); font-size: 11px; }
dd { margin: 0 0 8px; }

#stats {
  display: grid;
  grid-template-columns: 4.2em minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 6px;
  align-items: start;
  margin: 0 0 16px;
}
#stats dt {
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
}
#stats dd {
  margin: 0;
  color: var(--paper);
  font-size: 12px;
  line-height: 1.4;
  min-width: 0;
}

#alerts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
#alerts li {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid rgba(255, 207, 90, 0.22);
  background: rgba(255, 207, 90, 0.06);
  color: var(--paper);
  font-size: 12px;
  line-height: 1.45;
}

.hint { margin: 14px 0 0; }

.mission-rail {
  grid-template-columns: minmax(0, 1fr);
}
.mission-span {
  position: absolute;
  top: 23px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 207, 90, 0.32);
  pointer-events: none;
  z-index: 1;
}
.mission-ticks {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  min-height: 46px;
}
.mission-ticks li {
  position: absolute;
  top: 22px;
  transform: translateX(-50%);
  z-index: 1;
}
.mission-ticks li:has(button.on) {
  z-index: 3;
}
.mission-forecasts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.mission-forecasts button {
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
}
.mission-forecasts button.on {
  color: var(--paper);
  border-color: rgba(255, 207, 90, 0.55);
  background: rgba(255, 207, 90, 0.12);
}
.mission-forecasts button.off {
  opacity: 0.4;
  cursor: default;
}
.mission-ticks button {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
.mission-ticks button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2px var(--bg);
}
.mission-ticks button.start::before { background: var(--ion); }
.mission-ticks button.release::before { background: var(--amber); }
.mission-ticks button.on {
  color: var(--paper);
}
.mission-ticks button.on::before {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--amber);
}
.mission-ticks button.off {
  opacity: 0.35;
  cursor: default;
}
.mission-ticks .mission-clock {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.clock-rail {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto minmax(72px, auto);
  column-gap: 12px;
  row-gap: 8px;
  align-items: center;
  margin-top: 6px;
  padding: 12px;
  pointer-events: auto;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
}

.clock-rail-main {
  display: contents;
}

.clock-rail-labels {
  grid-column: 2;
  grid-row: 1;
}

.clock-play {
  grid-column: 1;
  grid-row: 2;
}

.clock-rail-track {
  grid-column: 2;
  grid-row: 2;
}

.clock-rail.mission-rail {
  grid-template-columns: minmax(0, 1fr);
}

.clock-rail.mission-rail .clock-rail-labels,
.clock-rail.mission-rail .clock-rail-track,
.clock-rail.mission-rail .mission-forecasts {
  grid-column: 1;
}

.clock-rail.mission-rail .mission-labels {
  display: block;
  position: relative;
  height: 16px;
  margin: 0 28px;
  letter-spacing: 0;
}

.clock-rail.mission-rail .mission-labels span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
  letter-spacing: 0.04em;
}

.clock-rail.mission-rail .mission-labels span:first-child {
  transform: translateX(0);
  text-align: left;
}

.clock-rail.mission-rail .mission-labels span:last-child {
  transform: translateX(-100%);
  text-align: right;
}

.clock-rail.mission-rail .mission-labels span[hidden] {
  display: none;
}

.clock-rail.mission-rail .clock-rail-track {
  grid-row: 2;
  margin: 0 28px;
}

.clock-rail.mission-rail .mission-forecasts {
  grid-row: 3;
}

.clock-rail.mission-rail .clock-rail-track,
.clock-rail.mission-rail .mission-ticks {
  width: 100%;
  min-width: 0;
}

.clock-play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--paper);
}

.clock-play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.clock-play .icon-pause { display: none; }
.clock-play.on {
  background: rgba(84, 215, 255, 0.16);
  border-color: rgba(84, 215, 255, 0.55);
  color: var(--ion-soft);
}
.clock-play.on .icon-play { display: none; }
.clock-play.on .icon-pause { display: block; }

.clock-rail-labels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.clock-rail-labels span:first-child { color: var(--ion); }
.clock-rail-labels span:nth-child(2) {
  color: var(--amber);
  text-align: center;
  letter-spacing: 2px;
}
.clock-rail-labels span:last-child { color: var(--paper); text-align: right; }

.clock-rail-track {
  position: relative;
  min-height: 72px;
}

.clock-rail-axis {
  position: absolute;
  left: 1.6%;
  right: 1.6%;
  top: 25px;
  height: 2px;
  background: linear-gradient(90deg, var(--ion), var(--amber) 50%, var(--orange));
  opacity: 0.45;
}

.clock-rail.obs-only .clock-rail-axis {
  background: var(--ion);
}

.clock-rail.obs-only .clock-rail-labels span:nth-child(2) {
  color: var(--ion);
}

.clock-rail.obs-only .clock-rail-head {
  background: var(--ion);
  box-shadow: 0 0 0 3px rgba(84, 215, 255, 0.22);
}

.clock-rail-ticks button .clock-when {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}

.clock-rail-ticks button .clock-d,
.clock-rail-ticks button .clock-t {
  color: inherit;
}

.clock-rail-ticks button .clock-d {
  font-size: 9px;
  letter-spacing: 0;
}

.clock-rail-head {
  position: absolute;
  top: 19px;
  left: 2.94%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 207, 90, 0.22);
  pointer-events: none;
  z-index: 2;
  transition: left 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.clock-rail-head.jump { transition: none; }

.clock-rail-ticks {
  display: grid;
  grid-template-columns: repeat(49, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  width: 100%;
}

.clock-rail-ticks li { display: flex; justify-content: center; }

.clock-rail-ticks button {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  padding: 22px 0 10px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
  overflow: visible;
  transition: color 0.35s ease;
}
.clock-rail-ticks button.bare {
  color: transparent;
}
.clock-rail-ticks button.bare::before {
  width: 5px;
  height: 5px;
}

.clock-rail-ticks button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #243246;
  box-shadow: 0 0 0 2px var(--bg);
  transition: transform 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
}

.clock-rail-ticks button.past::before { background: var(--ion); }
.clock-rail-ticks button.now::before {
  width: 10px;
  height: 10px;
  background: var(--amber);
}
.clock-rail-ticks button.future::before { background: var(--orange); }

.clock-rail-ticks button.off {
  opacity: 0.35;
  cursor: default;
}

.clock-rail-ticks button.on {
  color: var(--paper);
}

.clock-rail-ticks button.on::before {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--amber);
}

.clock-rail-ticks button.now.on {
  color: var(--amber);
  font-size: 12px;
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 22px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  background: var(--chrome);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
}
footer span { white-space: nowrap; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 14, 0.72);
  backdrop-filter: var(--chrome-blur);
  -webkit-backdrop-filter: var(--chrome-blur);
  transition: opacity 0.28s ease;
}
.boot.off { opacity: 0; pointer-events: none; }
body.theme-day .boot { background: rgba(215, 227, 238, 0.78); }
.boot-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 260px;
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  background: var(--hud);
}
.boot-card img {
  height: 40px;
  width: auto;
  padding: 6px 12px;
  background: rgba(236, 244, 252, 0.26);
}
.boot-step {
  margin: 0;
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 1px;
}
.boot-track {
  width: 220px;
  height: 4px;
  background: var(--line-soft);
  overflow: hidden;
}
.boot-bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ion);
  transition: width 0.16s linear;
}
.boot-pct {
  margin: 0;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 1px;
}

.phone-tools,
.phone-tabs,
.chrome-mask,
.map-exit,
.drawer-toolbar,
.drawer-label { display: none; }

.drawer-scroll,
.drawer-block,
.drawer-slot { display: contents; }

@media (max-width: 900px) {
  :root {
    --phone-dock: env(safe-area-inset-bottom, 0px);
    --phone-clock: 82px;
    --phone-head-btn: 34px;
    --chrome-top: 52px;
    --chrome-left: 16px;
    --chrome-right: 16px;
    --chrome-bottom: 88px;
  }

  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    display: flex;
    flex-direction: column;
    font-size: 15px;
    padding:
      env(safe-area-inset-top, 0px)
      env(safe-area-inset-right, 0px)
      0
      env(safe-area-inset-left, 0px);
  }

  input, select, textarea { font-size: 16px; }
  button, .tab, a { -webkit-tap-highlight-color: transparent; }

  main { z-index: auto; }

  .top {
    z-index: 7;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 6px 10px;
  }

  .eyebrow,
  .brand-sub,
  .brand-copy,
  .status-pill,
  .role,
  .search-home,
  #tokenHome { display: none; }

  .head-meta {
    display: flex;
    justify-content: center;
    justify-self: stretch;
  }
  .clock {
    font-size: 14px;
    letter-spacing: 0.4px;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }

  .brand { gap: 6px; align-items: center; }
  .brand-logo {
    height: var(--phone-head-btn);
    padding: 4px 7px 4px 5px;
  }
  .brand-logo img { height: 100%; }
  h1 { display: none; }

  .head-tools { gap: 6px; }

  .phone-tools {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .phone-tools #btnOpenSearch,
  .phone-tools #btnOpenDetail { display: none; }
  .phone-tools .map-full,
  .phone-tools #btnOpenRail {
    position: static;
    top: auto;
    right: auto;
    display: grid;
    place-items: center;
    width: var(--phone-head-btn);
    height: var(--phone-head-btn);
    min-height: 0;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--paper);
  }
  .phone-tools .map-full svg,
  .phone-tools #btnOpenRail svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
  }
  body.rail-open #btnOpenRail {
    color: var(--ion-soft);
    border-color: rgba(84, 215, 255, 0.45);
    background: rgba(84, 215, 255, 0.1);
  }

  .chrome-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    border: 0;
    padding: 0;
    background: rgba(4, 7, 14, 0.45);
  }
  .chrome-mask[hidden] { display: none !important; }

  main {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: var(--phone-dock);
  }

  .drawer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--line-soft);
  }
  .drawer-kicker {
    margin: 0;
    color: var(--ion);
    font-size: 12px;
    letter-spacing: 0.14em;
  }
  .drawer-title {
    margin: 4px 0 0;
    font-size: 18px;
    letter-spacing: 1px;
  }
  .drawer-toolbar button {
    min-height: 32px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--paper);
    font-size: 13px;
  }
  .drawer-scroll {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 14px 16px 32px;
  }
  .drawer-block,
  .drawer-slot { display: block; }
  .drawer-block { margin: 0 0 20px; }
  .drawer-label {
    display: block;
    margin: 0 0 10px;
    color: var(--dim);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
  }

  .rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--phone-dock);
    z-index: 21;
    display: flex;
    flex-direction: column;
    width: min(88vw, 380px);
    max-width: 100%;
    padding: env(safe-area-inset-top, 0px) 0 0;
    border: 0;
    border-right: 1px solid var(--line);
    background: var(--hud);
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(-110%);
    transition: transform 0.22s ease;
  }
  body.rail-open .rail { transform: none; }

  .rail .tabs {
    display: grid;
    margin-bottom: 14px;
  }
  .rail .tabs .tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 6px;
    font-size: 12px;
  }
  .rail .list {
    flex: none;
    overflow: visible;
  }
  .rail .list li { padding: 12px 12px 12px 14px; }
  .rail .list .prod-top { font-size: 12px; }
  .rail .list .prod-title { font-size: 15px; }
  .rail .list small { font-size: 13px; }
  .rail .token {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 12px;
    white-space: normal;
  }
  .rail .token select {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 16px;
  }
  .rail .search-box { display: block; }
  .rail .search-box input {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 16px;
  }
  .rail .view-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  .rail .horizons { flex-wrap: wrap; gap: 6px; }
  .rail .horizons button,
  .rail .chips button {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 12px;
  }
  .rail .legend-title { display: none; }
  .rail .search-hits button {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
  }
  .rail #stats,
  .rail #stats dd { font-size: 14px; }
  .rail #alerts li {
    font-size: 14px;
    line-height: 1.5;
    padding: 10px 12px;
  }
  .rail .legend,
  .rail .layer-toggles {
    display: flex;
    margin-left: 0;
    width: 100%;
    font-size: 12px;
  }
  .rail .legend { flex-wrap: wrap; gap: 6px 10px; }
  .rail .layer-toggles {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .rail .layer-group { gap: 6px; }
  .rail .layer-group > span { font-size: 11px; }
  .rail .layer-toggles label {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 12px;
  }
  .rail .detail {
    position: static;
    inset: auto;
    transform: none;
    width: auto;
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .rail .detail h3 {
    margin: 18px 0 8px;
    font-size: 13px;
    letter-spacing: 0.12em;
    color: var(--dim);
  }
  .rail .detail h3:first-child { margin-top: 0; }
  .rail .story { font-size: 15px; line-height: 1.55; }
  .rail #btnAck,
  .rail #btnDispatch {
    min-height: 34px;
    font-size: 13px;
  }

  .phone-tabs { display: none !important; }

  .stage {
    display: block;
    position: relative;
    height: 100%;
    padding: 0;
    min-height: 0;
  }
  .map-frame {
    position: absolute;
    inset: 0;
    margin: 0;
  }
  .stage-head,
  .map-hud { display: none; }
  .map-frame::after { display: none; }

  .iono-hud {
    top: auto;
    bottom: calc(var(--phone-dock) + var(--phone-clock));
    right: 8px;
    left: auto;
    max-width: min(42vw, 140px);
  }
  .iono-tecu {
    min-height: 80px;
    padding: 4px 5px;
    gap: 2px;
  }
  .elev-hud {
    left: 8px;
    bottom: calc(var(--phone-dock) + var(--phone-clock));
  }
  body.map-full-on .top,
  body.map-full-on .clock-rail,
  body.map-full-on .rail,
  body.map-full-on .chrome-mask {
    visibility: hidden;
    pointer-events: none;
  }
  body.map-full-on .map-back { z-index: 40; }
  .map-exit {
    display: none;
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 10000;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--hud);
    color: var(--paper);
    place-items: center;
  }
  .map-exit svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
  }
  body.map-full-on .map-exit { display: grid; }
  .bldg-pop h4 { font-size: 15px; }
  .bldg-pop dl div { font-size: 13px; }
  .leaflet-popup-content { min-width: 0; }

  .clock-rail,
  .clock-rail.mission-rail {
    position: fixed;
    left: max(6px, env(safe-area-inset-left, 0px));
    right: max(6px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--phone-dock) + 6px);
    z-index: 5;
    margin: 0;
    gap: 6px;
    padding: 4px 6px 3px;
    background: rgba(8, 14, 26, 0.55);
  }
  body.rail-open .clock-rail { visibility: hidden; pointer-events: none; }
  .clock-rail.mission-rail .clock-rail-track { margin: 0 12px; }
  .clock-rail.mission-rail .mission-labels {
    display: block;
    margin: 0 12px;
    height: 14px;
  }
  .clock-rail-labels {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 10px;
    letter-spacing: 0;
  }
  .clock-rail-labels span {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .clock-play {
    width: 40px;
    height: 40px;
  }
  .clock-rail-ticks {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    grid-template-columns: none;
    padding-bottom: 2px;
  }
  .clock-rail-ticks.dense {
    display: grid;
    overflow-x: hidden;
  }
  .clock-rail-ticks li { flex: 0 0 36px; }
  .clock-rail-ticks.dense li { flex: none; }
  .clock-rail-ticks button { min-height: 40px; font-size: 12px; padding: 10px 0 4px; gap: 8px; }
  .clock-rail-ticks.dense button { min-height: 28px; font-size: 9px; padding: 6px 0 2px; gap: 4px; }
  .clock-rail-track { min-height: 48px; }
  .clock-rail-axis { top: 13px; }
  .clock-rail-head { top: 7px; }

  footer { display: none; }

  .boot-card { min-width: 0; width: min(88vw, 320px); }
}
