:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --border: oklch(0.922 0 0);
  --accent: oklch(0.646 0.222 41.116);
  --accent-soft: oklch(0.646 0.222 41.116 / 12%);
  --shadow: 0 1px 2px oklch(0 0 0 / 5%);
  --none: oklch(0.87 0 0);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --border: oklch(1 0 0 / 10%);
    --accent-soft: oklch(0.646 0.222 41.116 / 18%);
    --shadow: none;
    --none: oklch(0.38 0 0);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --border: oklch(1 0 0 / 10%);
  --accent-soft: oklch(0.646 0.222 41.116 / 18%);
  --shadow: none;
  --none: oklch(0.38 0 0);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--border); }
a:hover { text-decoration-color: var(--accent); }

h1, h2 { letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(28px, 4.4vw, 44px); line-height: 1.1; font-weight: 600; max-width: 20ch; }
h2 { font-size: 18px; font-weight: 600; }
p { margin: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted-foreground); }

.top { border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; background: color-mix(in oklab, var(--background) 85%, transparent); backdrop-filter: blur(8px); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; font-family: "Geist Mono", ui-monospace, monospace; font-size: 14px; }
.brand-mark { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.links { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.links a { text-decoration: none; color: var(--muted-foreground); }
.links a:hover { color: var(--foreground); }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: pointer; }
.icon-btn:hover { background: var(--muted); }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: block; }
}

.hero { padding: 56px 0 28px; display: grid; gap: 14px; }
.eyebrow { color: var(--accent); font-weight: 500; font-size: 13px; font-family: "Geist Mono", ui-monospace, monospace; }
.lead { color: var(--muted-foreground); font-size: 17px; max-width: 62ch; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 18px 20px; display: grid; gap: 4px; }
.stat-label { font-size: 13px; color: var(--muted-foreground); }
.stat-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
.stat-sub { font-size: 13px; color: var(--muted-foreground); }

.map-section { padding: 28px 0 8px; }
.map-card { overflow: hidden; }
.map-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.map-head .muted { font-size: 14px; margin-top: 2px; }

.seg { display: inline-flex; padding: 3px; background: var(--muted); border-radius: var(--radius); flex-shrink: 0; }
.seg button { border: 0; background: transparent; color: var(--muted-foreground); font: inherit; font-size: 13px; font-weight: 500; padding: 5px 12px; border-radius: calc(var(--radius) - 3px); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px oklch(0 0 0 / 10%); }

.map-wrap { position: relative; }
#mapview { height: min(68vh, 640px); min-height: 380px; background: var(--muted); }

.legend { position: absolute; left: 12px; bottom: 12px; padding: 10px 12px; width: 220px; font-size: 12px; }
.legend-title { font-weight: 500; margin-bottom: 6px; }
.legend-bar { height: 10px; border-radius: 3px; }
.legend-ticks { display: flex; justify-content: space-between; color: var(--muted-foreground); font-variant-numeric: tabular-nums; margin-top: 3px; }
.legend-none { display: flex; align-items: center; gap: 6px; color: var(--muted-foreground); margin-top: 6px; }
.swatch { width: 12px; height: 10px; border-radius: 2px; background: var(--none); display: inline-block; }

.detail { padding: 16px 20px; border-top: 1px solid var(--border); min-height: 64px; }
.detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.detail-head b { font-family: "Geist Mono", ui-monospace, monospace; font-weight: 500; font-size: 13px; }
.badge { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.off { background: var(--muted); color: var(--muted-foreground); }
.facts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.fact span { display: block; font-size: 12px; color: var(--muted-foreground); }
.fact b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

.two { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; padding: 48px 0 0; }
.two > div:first-child { display: grid; gap: 6px; align-content: start; }
.two .muted { font-size: 14px; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding: 14px 16px 14px 52px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); background: var(--card); color: var(--muted-foreground); }
.steps li b { color: var(--foreground); font-weight: 600; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; display: grid; place-items: center; font-family: "Geist Mono", ui-monospace, monospace; }

.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 500; color: var(--muted-foreground); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { display: block; color: var(--muted-foreground); font-size: 12px; }
#top-body tr { cursor: pointer; }
#top-body tr:hover { background: var(--muted); }
#top-body td:first-child { font-family: "Geist Mono", ui-monospace, monospace; font-size: 13px; }

.foot { padding: 56px 16px 40px; color: var(--muted-foreground); font-size: 13px; display: grid; gap: 4px; }

.maplibregl-ctrl-attrib { font-family: "Geist", sans-serif; font-size: 11px; }
.maplibregl-ctrl-group { border-radius: calc(var(--radius) - 2px) !important; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; gap: 14px; padding-top: 40px; }
  .facts { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
  .hero { padding: 36px 0 20px; }
  .links a { display: none; }
  .map-head { flex-direction: column; align-items: stretch; }
  .seg { align-self: flex-start; }
  #mapview { height: 62vh; min-height: 340px; }
  .legend { width: 190px; left: 10px; top: 10px; bottom: auto; padding: 8px 10px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 24px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 9px 12px; }
  .checks thead { display: none; }
  .checks tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); padding: 4px 0; }
  .checks tbody tr:last-child { border-bottom: 0; }
  .checks td { border: 0; padding: 4px 12px; }
  .checks td:first-child { grid-column: 1 / -1; font-weight: 500; }
  .checks td.num { text-align: left; white-space: normal; }
  .checks td.num::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted-foreground); }
}
