/* Live GNSS interference map.
   Dark-first ops-console palette, shared vocabulary with globe.css so the two
   apps read as one product. Light is its own palette, not an inversion. */

:root {
  --bg: #0b0f1a;
  --surface: rgba(17, 23, 38, 0.88);
  --surface-solid: #111726;
  --border: rgba(148, 163, 184, 0.16);
  --ink: #e6ebf4;
  --ink-2: #9aa7bd;
  --ink-3: #64748b;
  --accent: #38bdf8;
  --accent-wash: rgba(56, 189, 248, 0.16);
  --warn: #e8a13c;
  --warn-bg: rgba(232, 161, 60, 0.13);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --blur: saturate(1.2) blur(14px);
}
[data-theme="light"] {
  --bg: #eef1f6;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.12);
  --ink: #17233b;
  --ink-2: #52617c;
  --ink-3: #8a97ad;
  --accent: #0369a1;
  --accent-wash: rgba(3, 105, 161, 0.14);
  --warn: #b45309;
  --warn-bg: rgba(180, 83, 9, 0.11);
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; }
#mapstack, #mapstack canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#cv-hex { cursor: pointer; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--ink-3); font-size: 12.5px; }

.iconbtn {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px; color: var(--ink-2);
}
.iconbtn:hover { background: var(--accent-wash); color: var(--ink); }

/* ── top bar ─────────────────────────────────────────────────────────────── */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; padding-top: max(9px, env(safe-area-inset-top));
  background: var(--surface); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px;
  color: var(--warn);
}
.brand span { color: var(--ink); letter-spacing: 0.1em; }
.grow { flex: 1; }

#windowpick { display: flex; gap: 2px; background: rgba(127,140,170,0.13); padding: 3px; border-radius: 10px; }
.wbtn {
  padding: 5px 11px; border-radius: 7px; font-size: 12.5px; color: var(--ink-2);
  white-space: nowrap; transition: background 0.12s, color 0.12s;
}
.wbtn:hover { color: var(--ink); }
.wbtn.on { background: var(--surface-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.25); }

/* ── status strip ────────────────────────────────────────────────────────── */
#statusbar {
  position: absolute; z-index: 20; left: 12px; top: 58px;
  display: flex; align-items: center; gap: 9px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  font-size: 12px; color: var(--ink-2); pointer-events: none;
}
#statusbar .sep { width: 1px; height: 11px; background: var(--border); }
#st-window { color: var(--ink); font-weight: 600; }
#st-age.stale { color: var(--warn); }

/* ── cell inspector ──────────────────────────────────────────────────────── */
#panel {
  position: absolute; z-index: 30; right: 12px; top: 58px; width: 296px;
  max-height: calc(100% - 130px); overflow-y: auto;
  background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.p-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 9px 11px 14px; border-bottom: 1px solid var(--border);
}
#p-title { font-size: 17px; font-weight: 650; }
#p-body { padding: 13px 14px 15px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { display: flex; flex-direction: column; gap: 1px; }
.stats b { font-size: 16px; font-weight: 650; }
.stats span { font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.warn {
  margin-top: 11px; padding: 8px 10px; border-radius: 9px;
  background: var(--warn-bg); color: var(--warn); font-size: 12.5px; line-height: 1.4;
}
.cellid { margin-top: 12px; font-size: 11px; color: var(--ink-3); letter-spacing: 0.02em; }
#p-spark { margin-top: 12px; }
.spark { width: 100%; height: 42px; display: block; }
.sparkscale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }

/* ── worst-affected list ─────────────────────────────────────────────────── */
#listpanel {
  position: absolute; z-index: 25; left: 12px; bottom: 92px; width: 258px;
  background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.l-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 7px 9px 13px; font-size: 12.5px;
}
.l-head b { letter-spacing: 0.03em; }
#l-body { max-height: 244px; overflow-y: auto; padding: 0 5px 6px; }
#listpanel.collapsed #l-body { display: none; }
.lrow {
  display: grid; grid-template-columns: 9px 38px 1fr auto; align-items: center; gap: 8px;
  width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; font-size: 12.5px;
}
.lrow:hover { background: var(--accent-wash); }
.dot { width: 9px; height: 9px; border-radius: 2px; }
.lpct { font-weight: 650; }
.lname { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
         font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.ln { color: var(--ink-3); font-size: 11px; }
#l-body .muted { padding: 6px 8px; }

/* ── legend ──────────────────────────────────────────────────────────────── */
#legends {
  position: absolute; z-index: 25; right: 12px; bottom: 34px; width: 224px;
  padding: 11px 13px 12px;
  background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.lg-title { font-size: 11px; letter-spacing: 0.04em; color: var(--ink-2); margin-bottom: 8px; }
#lg-ramp { height: 11px; border-radius: 3px; border: 1px solid var(--border); }
.lg-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-3); margin-top: 4px; }
.lg-note { font-size: 10.5px; color: var(--ink-3); margin-top: 7px; line-height: 1.35; }

/* ── attribution ─────────────────────────────────────────────────────────── */
#attrib {
  position: absolute; z-index: 20; left: 12px; bottom: 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--ink-3); pointer-events: none;
}
#attrib a { pointer-events: auto; }
#attrib .sep { width: 1px; height: 9px; background: var(--border); }

/* ── about sheet ─────────────────────────────────────────────────────────── */
#aboutsheet {
  position: absolute; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 20px;
  background: rgba(4, 7, 14, 0.62); backdrop-filter: blur(3px);
}
.sheet {
  position: relative; max-width: 560px; max-height: 84vh; overflow-y: auto;
  padding: 26px 28px 28px;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow);
}
.sheet h1 { font-size: 21px; font-weight: 650; margin-bottom: 13px; letter-spacing: -0.01em; }
.sheet p { color: var(--ink-2); margin-bottom: 11px; line-height: 1.58; font-size: 14px; }
.sheet p:last-child { margin-bottom: 0; }
.sheet b { color: var(--ink); font-weight: 600; }
.sheet .credit { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; }
.sheet-x { position: absolute; top: 14px; right: 14px; }

/* ── narrow screens ──────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  #panel { left: 12px; right: 12px; width: auto; top: auto; bottom: 10px; max-height: 52%; }
  #listpanel { display: none; }
  #legends { width: auto; left: 12px; right: 12px; bottom: 10px; }
  #panel:not([hidden]) ~ #legends { display: none; }
  #attrib { display: none; }
  .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* cell inspector title block — the place name leads, the figure follows */
.p-titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
#p-sub { font-size: 11.5px; color: var(--ink-3); }
.lname.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
