/* ── Base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 13px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; color: inherit; }
h1, h2, h3, p, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }

::selection { background: color-mix(in srgb, var(--focus) 40%, transparent); }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.eyebrow {
  font: 500 10.5px/1.2 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kbd {
  font: 500 10.5px/1 var(--font-mono);
  color: var(--ink-3);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 3px 5px 2px;
  min-width: 20px;
  text-align: center;
}

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .25); }

/* ── Surfaces ─────────────────────────────────────────────────────────── */

.glass, .glass-solid {
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(135%);
  backdrop-filter: blur(26px) saturate(135%);
}
.glass-solid {
  background: var(--glass-solid);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}

/* ── Stage ────────────────────────────────────────────────────────────── */

.app { position: fixed; inset: 0; overflow: hidden; }

.stage {
  position: absolute; inset: 0;
  background:
    radial-gradient(1100px 760px at 58% 42%, var(--stage-a) 0%, var(--stage-b) 52%, var(--stage-c) 100%);
}
.stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.4px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 58% 45%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 75% 70% at 58% 45%, #000 30%, transparent 100%);
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { cursor: grab; touch-action: none; }
#overlay.is-dragging { cursor: grabbing; }
#overlay.is-hot { cursor: pointer; }

.is-booting .stage canvas { opacity: 0; }
.stage canvas { transition: opacity 900ms var(--ease); }

/* ── Buttons & small controls ─────────────────────────────────────────── */

.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--ink-2);
  transition: color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { color: var(--ink); }
.icon-btn.glass:hover { background: var(--glass-solid); }
.icon-btn.ghost { width: 32px; height: 32px; border-radius: var(--r-sm); }
.icon-btn.ghost:hover { background: var(--fill-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[aria-pressed="true"] { color: var(--ink); background: var(--fill-3); }

.seg { display: inline-flex; padding: 3px; border-radius: var(--r-md); height: 38px; }
.seg button {
  min-width: 38px; padding: 0 10px; border-radius: 9px;
  font-weight: 500; font-size: 12.5px; color: var(--ink-3);
  transition: color var(--t-fast), background var(--t-fast);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--on-ink); }

.mini-seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--fill-1); border: 1px solid var(--line); flex: none; }
.mini-seg button {
  padding: 4px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.mini-seg button:hover { color: var(--ink); }
.mini-seg button[aria-checked="true"] { background: var(--fill-3); color: var(--ink); }

.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  border: 1px solid var(--line); color: var(--ink-2);
  font-size: 11.5px; font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.chip-btn .icon { width: 13px; height: 13px; }
.chip-btn:hover { color: var(--ink); background: var(--fill-2); border-color: var(--line-2); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: transparent; }

.text-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 9px; margin: 0 -9px; border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast);
}
.text-btn:hover { color: var(--ink); background: var(--fill-2); }
.text-btn .icon { width: 15px; height: 15px; }

/* ── Sidebar ──────────────────────────────────────────────────────────── */

.sidebar {
  position: absolute; z-index: 30;
  top: var(--gap); left: var(--gap); bottom: var(--gap);
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 16px 18px;
  display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin; scrollbar-color: transparent transparent;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
}
.sidebar-scroll > * { flex: none; }
.sidebar:hover .sidebar-scroll { scrollbar-color: var(--fill-3) transparent; }
.is-booting .sidebar, .is-booting .timeline, .is-booting .utilities, .is-booting .map-tools { visibility: hidden; }
.app:not(.is-booting) .sidebar, .app:not(.is-booting) .timeline, .app:not(.is-booting) .utilities, .app:not(.is-booting) .map-tools { animation: rise 800ms var(--ease) 120ms backwards; }
.sidebar { transition: transform var(--t-slow) var(--ease), opacity var(--t-med); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-text { flex: 1; min-width: 0; }
.brand h1 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.brand p { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.only-mobile { display: none; }
#btn-sheet .icon-close, #btn-sheet[aria-expanded="true"] .icon-open { display: none; }
#btn-sheet[aria-expanded="true"] .icon-close { display: block; }

.search { position: relative; display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 10px 0 12px; border-radius: var(--r-md); background: var(--fill-1); border: 1px solid var(--line); transition: border-color var(--t-fast), background var(--t-fast); }
.search:focus-within { border-color: var(--line-2); background: var(--fill-2); }
.search > .icon { color: var(--ink-3); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: 13px; }
.search input::placeholder { color: var(--ink-3); }
.search:focus-within .kbd { opacity: 0; }

.search-results {
  position: absolute; z-index: 5; left: -1px; right: -1px; top: calc(100% + 6px);
  max-height: min(380px, 52vh); overflow-y: auto;
  padding: 5px; border-radius: var(--r-md);
  background: var(--panel-head);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
}
.sr { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.sr[aria-selected="true"] { background: var(--fill-3); }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sr-main b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-main i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.sr-val { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px var(--font-mono); color: var(--ink-2); }
.sr-empty { padding: 14px 10px; color: var(--ink-3); font-size: 12.5px; }

/* Readout */
.readout { min-height: 136px; }
.ro-title { font-size: 15px; font-weight: 500; letter-spacing: -.01em; margin: 7px 0 12px; line-height: 1.3; }
.ro-hero { display: flex; align-items: flex-start; gap: 3px; }
.ro-value { font-size: 56px; font-weight: 600; letter-spacing: -.045em; line-height: .92; font-feature-settings: "ss01"; }
.ro-unit { font-size: 19px; font-weight: 500; color: var(--ink-2); margin-top: 3px; }
.ro-caption { margin-top: 10px; color: var(--ink-2); font-size: 12.5px; }
.ro-note { margin-top: 3px; color: var(--ink-3); font-size: 12px; min-height: 17px; }

.group { display: flex; flex-direction: column; gap: 9px; }

.measure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.measure-grid button {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  color: var(--ink-2); font-weight: 500; font-size: 12.5px; text-align: left;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.measure-grid button:hover { color: var(--ink); background: var(--fill-1); border-color: var(--line-2); }
.measure-grid button[aria-checked="true"] { color: var(--ink); background: var(--fill-3); border-color: var(--line-2); box-shadow: inset 0 1px 0 var(--glass-hi); }
.measure-grid button .icon { color: var(--ink-3); transition: color var(--t-fast); }
.measure-grid button[aria-checked="true"] .icon { color: var(--ink); }

.lens-tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--fill-1); border: 1px solid var(--line); }
.lens-tabs button {
  height: 32px; border-radius: 9px;
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  transition: color var(--t-fast), background var(--t-fast);
}
.lens-tabs button:hover { color: var(--ink); background: var(--fill-1); }
.lens-tabs button[aria-checked="true"] { background: var(--ink); color: var(--on-ink); }
.lens-help { font-size: 12px; color: var(--ink-3); min-height: 17px; line-height: 1.4; }

/* Legend */
.legend-head, .extremes-head { display: flex; align-items: center; justify-content: space-between; min-height: 24px; gap: 8px; }
.legend-body { position: relative; padding-top: 2px; }
.legend-hist { display: block; width: 100%; height: 34px; }
.legend-bar-wrap { position: relative; height: 12px; margin-top: 3px; cursor: crosshair; touch-action: none; }
.legend-bar { display: block; width: 100%; height: 12px; border-radius: 4px; }
.legend-range { position: absolute; top: -40px; bottom: -3px; border-left: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); border-radius: 3px; pointer-events: none; }
.legend-marker { position: absolute; top: -40px; bottom: -3px; width: 1.5px; margin-left: -.75px; background: var(--ink); pointer-events: none; opacity: .9; }
.legend-pin { position: absolute; top: -5px; width: 0; height: 0; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--ink); pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.legend-ticks { position: relative; height: 18px; margin-top: 5px; font: 500 10.5px/1 var(--font-mono); color: var(--ink-3); }
.legend-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.legend-ticks span::before { content: ""; position: absolute; left: 50%; top: -5px; width: 1px; height: 3px; background: var(--ink-4); }
.legend-ticks span.is-mark { color: var(--ink-2); }
.legend-hint { font-size: 11.5px; color: var(--ink-3); }

/* Ranked lists */
.rank-list { display: flex; flex-direction: column; margin: 0 -8px; }
.rank-row { width: 100%; display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-sm); text-align: left; transition: background var(--t-fast); }
.rank-row:hover { background: var(--fill-2); }
.rank-n { width: 15px; font: 500 10.5px var(--font-mono); color: var(--ink-3); }
.rank-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.rank-name i { font-style: normal; font-weight: 400; color: var(--ink-3); margin-left: 5px; font-size: 12px; }
.rank-val { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--font-mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rank-empty { padding: 10px 8px; color: var(--ink-3); font-size: 12px; }

.sidebar-foot { flex: none; padding: 7px 16px 8px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }

/* ── Utilities (top right) ────────────────────────────────────────────── */

.utilities {
  position: absolute; z-index: 25;
  top: var(--gap); right: var(--gap);
  display: flex; gap: 8px; align-items: flex-start;
}
.has-panel .utilities { right: calc(var(--panel-w) + var(--gap) * 2); }
.utilities, .map-tools, .timeline { transition: right var(--t-slow) var(--ease), left var(--t-slow) var(--ease); }
.utilities .icon-btn.glass, .utilities .seg.glass { border-radius: var(--r-md); box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi); }

.popover {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 322px; padding: 6px 14px;
  border-radius: var(--r-md);
  animation: pop var(--t-med) var(--ease);
}
.pop-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.pop-row + .pop-row { border-top: 1px solid var(--line); }
.pop-label { font-weight: 500; }
.pop-sub { font-size: 11.5px; color: var(--ink-3); }

@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ── Map tools ────────────────────────────────────────────────────────── */

.map-tools {
  position: absolute; z-index: 20;
  right: var(--gap); bottom: calc(var(--tl-h, 110px) + var(--gap) * 2);
  display: flex; flex-direction: column; padding: 3px; gap: 1px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi);
}
.has-panel .map-tools { right: calc(var(--panel-w) + var(--gap) * 2); }

/* ── Timeline ─────────────────────────────────────────────────────────── */

.timeline {
  position: absolute; z-index: 20;
  left: calc(var(--sidebar-w) + var(--gap) * 2); right: var(--gap); bottom: var(--gap);
  max-width: 920px; margin-inline: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px 12px 14px;
}
.has-panel .timeline { right: calc(var(--panel-w) + var(--gap) * 2); }

.play-btn {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 0 0 5px var(--fill-1), 0 8px 22px -6px rgba(0, 0, 0, .6);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-med);
}
.play-btn:hover { transform: scale(1.05); box-shadow: 0 0 0 6px var(--fill-2), 0 8px 22px -6px rgba(0, 0, 0, .6); }
.play-btn:active { transform: scale(.95); }
.play-btn .icon { width: 20px; height: 20px; grid-area: 1 / 1; }
.play-btn .icon-play { margin-left: 2px; }
.play-btn .icon-pause, .is-playing .play-btn .icon-play { display: none; }
.is-playing .play-btn .icon-pause { display: block; }

.tl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.tl-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; }
.tl-caption { font: 500 11px/1.2 var(--font-mono); letter-spacing: .04em; color: var(--ink-3); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chips { display: flex; gap: 4px; flex: none; }
.chips button {
  height: 26px; padding: 0 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  border: 1px solid transparent;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.chips button:hover { color: var(--ink); background: var(--fill-2); }
.chips button[aria-checked="true"] { color: var(--on-ink); background: var(--ink); }

.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.month {
  position: relative; height: 38px; border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--ink-2);
  background: var(--fill-1);
  transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.month:hover { color: var(--ink); background: var(--fill-2); }
.month .bar { display: block; width: calc(100% - 14px); height: 4px; border-radius: 2px; background: var(--ink-4); }
.month.in-season { background: var(--fill-3); color: var(--ink); }
.month[aria-checked="true"] { background: var(--fill-3); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }

.years { display: flex; flex-direction: column; gap: 4px; padding-top: 16px; }
.years-track { position: relative; height: 30px; border-radius: 7px; cursor: ew-resize; touch-action: none; }
.years-track canvas { display: block; width: 100%; height: 100%; border-radius: 7px; }
.years-head { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 2px; box-shadow: 0 0 0 1.5px var(--glass-solid); pointer-events: none; }
.years-head span {
  position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  font: 600 11px/1 var(--font-mono); padding: 4px 6px; border-radius: 6px;
  background: var(--ink); color: var(--on-ink); white-space: nowrap;
}
.years-range { position: absolute; top: -3px; bottom: -3px; border: 1.5px solid var(--ink); border-radius: 6px; pointer-events: none; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.years-axis { position: relative; height: 13px; font: 500 10px/1 var(--font-mono); color: var(--ink-3); }
.years-axis span { position: absolute; top: 2px; transform: translateX(-50%); }
.years-track.is-loading { opacity: .45; }

/* ── Panel (county details, finder) ───────────────────────────────────── */

.panel {
  position: absolute; z-index: 28;
  top: var(--gap); right: var(--gap); bottom: var(--gap);
  width: var(--panel-w);
  display: flex; flex-direction: column; overflow: hidden;
  animation: panel-in var(--t-slow) var(--ease);
}
@keyframes panel-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--fill-3) transparent; }

.p-head { position: sticky; top: 0; z-index: 3; padding: 18px 18px 12px; margin-bottom: 4px; background: var(--panel-head); }
.p-head::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; background: linear-gradient(var(--panel-head), transparent); pointer-events: none; }
.p-head .eyebrow { padding-right: 110px; }
.p-title { font-size: 25px; font-weight: 600; letter-spacing: -.03em; line-height: 1.12; margin-top: 6px; padding-right: 8px; }
.p-sub { margin-top: 5px; color: var(--ink-2); font-size: 12.5px; }
.p-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; }

.p-pins { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 12px; }
.pin-chip { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 4px 0 9px; border-radius: var(--r-pill); border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--ink-2); }
.pin-chip.is-current { color: var(--ink); border-color: var(--line-2); background: var(--fill-2); }
.pin-chip .pin-name { display: inline-flex; align-items: center; gap: 7px; height: 100%; font-weight: 500; }
.pin-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.pin-chip .x { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.pin-chip .x:hover { background: var(--fill-3); color: var(--ink); }
.pin-chip .x .icon { width: 11px; height: 11px; }

.p-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 18px 4px; }
.tile { padding: 12px 13px; border-radius: var(--r-md); background: var(--fill-1); border: 1px solid var(--line); min-width: 0; }
.tile-hero { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px 12px; padding: 14px 15px; }
.tile-label { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.tile-hero .tile-label { grid-column: 1 / -1; }
.tile-value { font-size: 20px; font-weight: 600; letter-spacing: -.025em; margin-top: 3px; line-height: 1.1; }
.tile-hero .tile-value { font-size: 50px; letter-spacing: -.045em; line-height: .95; margin-top: 6px; }
.tile-value small { font-size: .4em; font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-left: 2px; vertical-align: top; position: relative; top: .25em; }
.tile-value.sm small { font-size: .62em; top: 0; vertical-align: baseline; }
.tile-foot { margin-top: 5px; font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; line-height: 1.35; }
.tile-hero .tile-foot { grid-column: 1 / -1; margin-top: 8px; }
.tile-spark { width: 132px; height: 44px; align-self: end; margin-bottom: 4px; }

.p-sec { padding: 20px 18px 4px; }
.p-sec + .p-sec { border-top: 1px solid var(--line); margin-top: 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; }
.sec-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.012em; }
.sec-tools { display: flex; gap: 5px; }
.sec-sub { margin-top: 3px; font-size: 12px; color: var(--ink-3); line-height: 1.45; }

.chart { position: relative; margin-top: 12px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart canvas { display: block; width: 100%; }
.chart text { font: 500 10.5px var(--font-mono); fill: var(--chart-muted); }
.chart .tick-line { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--chart-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; pointer-events: none; shape-rendering: crispEdges; }
.chart .focus-band { fill: var(--fill-3); pointer-events: none; }
.chart .ink-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .soft-line { fill: none; stroke: var(--ink-2); stroke-width: 1.25; stroke-linejoin: round; }
.chart .ref-line { fill: none; stroke: var(--chart-neutral); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--ink); stroke: var(--glass-solid); stroke-width: 2; }
.chart .label-ink { fill: var(--ink); font: 600 11px var(--font-sans); }
.chart .label-soft { fill: var(--ink-2); font: 500 11px var(--font-sans); }
.chart .label-ink, .chart .label-soft { paint-order: stroke; stroke: var(--panel-head); stroke-width: 3px; stroke-linejoin: round; }
.chart-tip {
  position: absolute; z-index: 4; pointer-events: none;
  padding: 8px 10px; border-radius: 10px; min-width: 124px;
  font-size: 12px; white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.chart-tip .ct-title { font: 500 10.5px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.chart-tip .ct-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; line-height: 1.55; }
.chart-tip .ct-row span { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chart-tip .ct-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip .key { width: 12px; height: 2px; border-radius: 1px; background: var(--ink); display: inline-block; }

.keys { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 11.5px; color: var(--ink-2); }
.keys span { display: inline-flex; align-items: center; gap: 6px; }
.keys .k-line { width: 14px; height: 2px; border-radius: 1px; background: var(--ink); }
.keys .k-band { width: 14px; height: 9px; border-radius: 2px; background: linear-gradient(#f0843a, #f3e08a, #63b3e6); opacity: .9; }
.keys .k-bar { width: 6px; height: 10px; border-radius: 2px 2px 0 0; background: var(--chart-neutral); }
.keys .k-ref { width: 14px; height: 2px; border-radius: 1px; background: var(--chart-neutral); }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.fact { padding: 9px 10px; border-radius: var(--r-sm); background: var(--fill-1); min-width: 0; }
button.fact { text-align: left; transition: background var(--t-fast); }
button.fact:hover { background: var(--fill-2); }
.fact .f-label { font-size: 11px; color: var(--ink-3); }
.fact .f-value { font-size: 14px; font-weight: 600; letter-spacing: -.015em; margin-top: 1px; }
.fact .f-sub { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.scale-key { display: flex; align-items: center; gap: 8px; margin-top: 9px; font: 500 10.5px var(--font-mono); color: var(--ink-3); }
.scale-key i { flex: 1; height: 6px; border-radius: 3px; }

.data-table-wrap { margin-top: 12px; max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); scrollbar-width: thin; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 6px 10px; text-align: right; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { position: sticky; top: 0; background: var(--glass-solid); font: 500 10.5px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.data-table tbody tr + tr td { border-top: 1px solid var(--line); }
.data-table tbody tr.is-current td { background: var(--fill-2); }

.p-foot { padding: 20px 18px 22px; margin-top: 18px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.p-foot a, .modal a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; }
.p-foot a:hover, .modal a:hover { color: var(--ink); }

.skeleton { height: 120px; margin-top: 12px; border-radius: var(--r-sm); background: linear-gradient(100deg, var(--fill-1) 30%, var(--fill-2) 50%, var(--fill-1) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; display: grid; place-items: center; color: var(--ink-3); font-size: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Finder */
.finder-row { padding: 16px 18px 6px; }
.finder-row + .finder-row { border-top: 1px solid var(--line); }
.fr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.fr-title { font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; }
.fr-val { font: 500 12px var(--font-mono); color: var(--ink-2); }
.fr-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.range { position: relative; height: 62px; margin-top: 8px; }
.range canvas { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 40px; }
.range .rail { position: absolute; left: 0; right: 0; top: 44px; height: 4px; border-radius: 2px; background: var(--fill-3); }
.range .fill { position: absolute; top: 44px; height: 4px; border-radius: 2px; background: var(--ink); }
.range input[type="range"] { position: absolute; left: -9px; right: -9px; top: 36px; width: calc(100% + 18px); height: 20px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.range input[type="range"]::-webkit-slider-runnable-track { background: none; height: 20px; }
.range input[type="range"]::-moz-range-track { background: none; height: 20px; }
.range input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--ink); border: 3px solid var(--glass-solid); box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(0, 0, 0, .4); cursor: grab; }
.range input[type="range"]::-moz-range-thumb { pointer-events: auto; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 3px solid var(--glass-solid); box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(0, 0, 0, .4); cursor: grab; }
.range input[type="range"]:focus-visible { outline: none; }
.range input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--focus); }
.range input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--focus); }
.finder-result { padding: 18px 18px 6px; border-top: 1px solid var(--line); margin-top: 10px; }
.finder-result .big { font-size: 44px; font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.finder-result .cap { color: var(--ink-2); margin-top: 6px; font-size: 12.5px; }
.finder-list { padding: 8px 18px 0; }
.finder-foot { padding: 12px 18px 18px; display: flex; justify-content: space-between; align-items: center; color: var(--ink-3); font-size: 11.5px; }

/* ── Tooltip & toast ──────────────────────────────────────────────────── */

.tooltip {
  position: absolute; z-index: 60; left: 0; top: 0; pointer-events: none;
  min-width: 190px; max-width: 280px; padding: 11px 13px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi);
  will-change: transform;
}
.tt-name { font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; line-height: 1.25; }
.tt-state { font-size: 11.5px; color: var(--ink-3); }
.tt-main { display: flex; align-items: center; gap: 9px; margin-top: 9px; }
.tt-main .swatch { width: 12px; height: 12px; border-radius: 4px; }
.tt-value { font-size: 26px; font-weight: 600; letter-spacing: -.035em; line-height: 1; }
.tt-spark { margin-left: auto; width: 76px; height: 26px; overflow: visible; }
.tt-spark path { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.tt-spark circle { fill: var(--ink); stroke: var(--glass-solid); stroke-width: 2; }
.tt-label { margin-top: 6px; font-size: 11.5px; color: var(--ink-2); }
.tt-rows { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 3px 14px; font-size: 12px; }
.tt-rows span { color: var(--ink-3); }
.tt-rows b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }

.toast {
  position: absolute; z-index: 70; left: 50%; bottom: calc(var(--tl-h, 110px) + var(--gap) * 2 + 6px);
  transform: translateX(-50%);
  padding: 9px 14px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 500;
  box-shadow: var(--shadow-sm);
  animation: pop var(--t-med) var(--ease);
}

/* ── Modals ───────────────────────────────────────────────────────────── */

.modal {
  color: var(--ink);
  width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px));
  padding: 0; overflow: hidden;
  border-radius: 20px;
}
.modal[open] { display: flex; flex-direction: column; animation: pop var(--t-med) var(--ease); }
.modal::backdrop { background: rgba(2, 4, 8, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 10px 24px; }
.modal-head h2 { font-size: 21px; font-weight: 600; letter-spacing: -.025em; margin-top: 5px; }
.modal-body { padding: 4px 24px 24px; overflow-y: auto; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); scrollbar-width: thin; }
.modal-body h3 { font-size: 13px; font-weight: 600; color: var(--ink); margin: 18px 0 4px; }
.modal-body p + p { margin-top: 8px; }
.modal-body ul { list-style: disc; padding-left: 18px; }
.modal-body li + li { margin-top: 4px; }
.modal-body strong { color: var(--ink); font-weight: 500; }
.keys-grid { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; align-items: center; margin-top: 6px; }
.keys-grid dt { display: flex; gap: 4px; }
.keys-grid dd { margin: 0; color: var(--ink-2); }

/* ── Boot screen ──────────────────────────────────────────────────────── */

.boot { position: absolute; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--bg); transition: opacity 600ms var(--ease), visibility 600ms; }
.app:not(.is-booting) .boot { opacity: 0; visibility: hidden; }
.boot p { font: 500 11px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.boot-mark { width: 120px; height: 60px; }
.boot-mark .iso { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 150; stroke-dashoffset: 150; animation: draw 1.8s var(--ease) infinite; }
.boot-mark .iso-1 { stroke: #6ea0ff; }
.boot-mark .iso-2 { stroke: #f6e7a1; animation-delay: .12s; }
.boot-mark .iso-3 { stroke: #ff6b52; animation-delay: .24s; }
@keyframes draw { 0% { stroke-dashoffset: 150; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -150; } }
.boot.is-error p { color: var(--ink); text-transform: none; letter-spacing: 0; font: 400 14px/1.5 var(--font-sans); max-width: 420px; text-align: center; }
.boot.is-error .iso { animation: none; stroke-dashoffset: 0; opacity: .35; }

/* ── Sidebar collapsed (focus mode) ───────────────────────────────────── */

.sidebar-off .sidebar { transform: translateX(calc(-100% - var(--gap) * 2)); opacity: 0; pointer-events: none; }
.sidebar-off .timeline { left: var(--gap); }

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 1240px) {
  :root { --sidebar-w: 292px; --panel-w: 380px; }
  .ro-value { font-size: 50px; }
}

@media (max-height: 800px) and (min-width: 761px) {
  .sidebar-scroll { gap: 16px; }
  .readout { min-height: 128px; }
  .ro-value { font-size: 46px; }
  .lens-help { min-height: 0; }
}

@media (max-width: 1040px) and (min-width: 761px) {
  .has-panel .timeline { display: none; }
  .has-panel .map-tools { bottom: var(--gap); }
}

@media (max-width: 760px) {
  :root { --gap: 8px; --sidebar-w: 100vw; --panel-w: 100vw; }

  .only-mobile { display: inline-grid; }
  .sidebar { right: var(--gap); bottom: auto; width: auto; max-height: calc(100dvh - var(--gap) * 2); border-radius: 16px; }
  .sidebar-scroll { padding: 10px 12px; gap: 0; }
  .brand p { display: none; }
  .brand-mark { width: 28px; height: 28px; }
  .search { margin-top: 10px; }
  .search .kbd { display: none; }
  .sidebar .group, .sidebar .sidebar-foot { display: none; }
  .sheet-open .sidebar .group { display: flex; flex-direction: column; margin-top: 16px; }
  .sheet-open .sidebar .sidebar-foot { display: flex; }
  .sidebar-scroll { -webkit-mask-image: none; mask-image: none; }
  .sheet-open .sidebar .readout { display: block; min-height: 0; margin-top: 16px; }
  .ro-value { font-size: 40px; }
  /* with the sheet closed, the readout shrinks to one line saying what the map shows */
  .app:not(.sheet-open) .readout { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 0; margin-top: 9px; padding: 0 2px; }
  .app:not(.sheet-open) .readout .eyebrow, .app:not(.sheet-open) .ro-caption, .app:not(.sheet-open) .ro-note { display: none; }
  .app:not(.sheet-open) .ro-title { margin: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app:not(.sheet-open) .ro-hero { flex: none; align-items: baseline; }
  .app:not(.sheet-open) .ro-value { font-size: 19px; letter-spacing: -.02em; line-height: 1.2; }
  .app:not(.sheet-open) .ro-unit { font-size: 12px; margin: 0; }

  .utilities { top: auto; right: var(--gap); bottom: calc(var(--tl-h, 120px) + var(--gap) * 2); flex-direction: column; align-items: flex-end; }
  .has-panel .utilities, .has-panel .map-tools { display: none; }
  #btn-help { display: none; }
  .popover { top: auto; bottom: 0; right: calc(100% + 8px); width: min(300px, calc(100vw - 80px)); }
  .map-tools { display: none; }

  .timeline { left: var(--gap); right: var(--gap); padding: 10px; gap: 10px; align-items: flex-end; border-radius: 16px; }
  .has-panel .timeline { display: none; }
  .play-btn { width: 40px; height: 40px; }
  .tl-top { flex-wrap: wrap; }
  .tl-caption { display: none; }
  .chips { overflow-x: auto; scrollbar-width: none; flex: 1; }
  .chips button { padding: 0 9px; white-space: nowrap; flex: none; }
  .month { height: 34px; font-size: 10.5px; border-radius: 7px; }
  .month .bar { width: calc(100% - 6px); }
  .month .long { display: none; }

  .panel { left: var(--gap); right: var(--gap); top: auto; width: auto; height: min(62dvh, 600px); border-radius: 18px; animation-name: sheet-in; }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  .p-title { font-size: 22px; }
  .tile-hero .tile-value { font-size: 42px; }
  .toast { bottom: calc(var(--tl-h, 120px) + 24px); }
}

@media (min-width: 761px) { .month .short { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
