:root {
  color-scheme: dark;
  --bg: #07101d;
  --surface: #0e1726;
  --surface-2: #132036;
  --line: rgba(148, 178, 214, 0.14);
  --line-strong: rgba(148, 178, 214, 0.28);
  --text: #eef3f9;
  --text-2: #9fb0c6;
  --text-3: #6f8199;
  --accent: #38bdf8;

  /* series (validated against --surface, dark mode) */
  --s1: #338ced;
  --s2: #e76624;
  --s3: #00a888;
  --s4: #d28e05;

  /* status - always paired with an icon and a word */
  --go: #0aac23;
  --caution: #fbb315;
  --nogo: #dc3c3d;

  --radius: 18px;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(56, 189, 248, 0.13), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(20, 184, 166, 0.08), transparent 60%),
    linear-gradient(180deg, #081426 0%, var(--bg) 60%);
}
a { color: inherit; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(7, 16, 29, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.brand em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.2em; color: var(--text-2); margin-left: 2px; }
.days { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.days button {
  appearance: none; border: 0; background: none; color: var(--text-2);
  font: 500 13px var(--sans); padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.days button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.days button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main { max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 40px; outline: none; }
.loading, .error { color: var(--text-2); padding: 80px 0; text-align: center; }

/* ---------- home ---------- */
.hero-title { font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 6vw, 64px); line-height: 1.02; margin: 12px 0 6px; letter-spacing: -0.01em; }
.hero-title i { color: var(--accent); }
.lede { color: var(--text-2); margin: 0 0 28px; max-width: 60ch; }
.demo-note { display: inline-block; font-size: 12px; color: var(--caution); border: 1px solid rgba(251, 179, 21, 0.4); border-radius: 999px; padding: 3px 10px; margin-bottom: 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  position: relative; display: block; text-decoration: none;
  background: linear-gradient(180deg, rgba(19, 32, 54, 0.9), rgba(14, 23, 38, 0.9));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 20px 16px; overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7); outline: none; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1; margin: 0 0 4px; }
.card .area { color: var(--text-3); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 14px; }
.stat .k { display: block; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat .v { font-size: 20px; font-weight: 600; }
.stat .u { color: var(--text-2); font-size: 12px; font-weight: 500; margin-left: 2px; }
.stat .arrow { display: inline-block; width: 14px; height: 14px; vertical-align: -1px; margin-left: 4px; }

/* status pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-weight: 600; font-size: 13px; padding: 5px 11px 5px 7px; border-radius: 999px;
  background: color-mix(in oklab, var(--c) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c) 45%, transparent);
  color: var(--text);
}
.pill svg { width: 16px; height: 16px; flex: none; }
.pill.lg { font-size: 16px; padding: 8px 16px 8px 10px; }
.pill.lg svg { width: 20px; height: 20px; }
.st-go { --c: var(--go); }
.st-caution { --c: var(--caution); }
.st-nogo { --c: var(--nogo); }

.strip { display: grid; gap: 2px; grid-auto-flow: column; grid-auto-columns: 1fr; }
.strip i { display: block; height: 8px; border-radius: 3px; background: var(--c); opacity: 0.9; }
.strip i.dim { opacity: 0.28; }
.strip-axis { display: flex; justify-content: space-between; color: var(--text-3); font-size: 11px; margin-top: 4px; }

/* ---------- region page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--text); }
.region-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: end; margin: 10px 0 24px; }
.region-hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 7vw, 76px); line-height: 0.95; margin: 0; }
.region-hero .area { color: var(--text-2); margin: 6px 0 16px; }
.verdict { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.summary { color: var(--text-2); font-size: 16px; line-height: 1.6; margin: 0; }
.summary b { color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 12px; color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

.panel {
  background: rgba(14, 23, 38, 0.85); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 14px; margin-bottom: 16px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.panel h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel .sub { color: var(--text-3); font-size: 12.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 16px; height: 0; border-top: 2px solid var(--c); }
.legend .sw.dash { border-top-style: dashed; }
.legend .sw.band { height: 10px; border: 0; border-radius: 3px; background: color-mix(in oklab, var(--c) 30%, transparent); }
.legend .sw.dot { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--c); }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-3); font: 11px var(--sans); font-feature-settings: "tnum" 1; }
.chart .grid line { stroke: var(--line); }
.chart .thr line { stroke-dasharray: 3 4; stroke-width: 1; }
.chart .thr text { font-size: 10.5px; }
.chart .win { fill: rgba(56, 189, 248, 0.06); }
.chart .win-label { fill: var(--accent); font-size: 10.5px; }
.chart .cross { stroke: var(--line-strong); }
.chart .hit { fill: transparent; cursor: crosshair; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two .panel { margin-bottom: 0; }

.ops { display: grid; gap: 3px; grid-auto-flow: column; grid-auto-columns: 1fr; }
.ops .cell { border-radius: 8px; background: color-mix(in oklab, var(--c) 20%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c) 45%, transparent); padding: 8px 0 6px; text-align: center; font-size: 12px; cursor: default; }
.ops .cell svg { width: 14px; height: 14px; display: block; margin: 0 auto 2px; }
.ops .cell.ret { box-shadow: inset 0 0 0 1.5px var(--accent); }
.ops .cell .h { color: var(--text-2); }

.sites { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#map { height: 320px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.site-list { list-style: none; margin: 0; padding: 0; }
.site-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.site-list li:last-child { border-bottom: 0; }
.verify { font-size: 11px; color: var(--caution); border: 1px solid rgba(251, 179, 21, 0.35); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.muted { color: var(--text-3); font-size: 12.5px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--text-3); font-weight: 500; font-size: 12px; }
.table-wrap { overflow-x: auto; }
details summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
details[open] summary { margin-bottom: 10px; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 180px;
  background: rgba(10, 18, 32, 0.96); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 10px 12px; font-size: 12.5px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8);
}
.tip .t { font-weight: 600; margin-bottom: 4px; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.tip .row b { color: var(--text); font-weight: 600; }
.tip .row .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }

.foot { max-width: 1180px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 40px; color: var(--text-3); font-size: 12.5px; }
.foot p { margin: 4px 0; }

.fade { animation: fade 0.45s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade { animation: none; } .card { transition: none; } }

@media (max-width: 820px) {
  .region-hero, .two, .sites { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; }
  .days { width: 100%; justify-content: space-between; }
  .days button { flex: 1; padding: 7px 6px; }
  .ops .cell { font-size: 10px; padding: 6px 0 4px; }
  .ops .cell svg { width: 11px; height: 11px; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

.leaflet-container { background: var(--surface-2); font: 12px var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-2); color: var(--text); }
