/* Steppe main map. Values come from tokens.css; no raw colours outside the map drawing. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: grid; grid-template-rows: var(--bar-h) minmax(0, 1fr); background: var(--canvas); color: var(--ink); font: var(--w-regular) var(--text-sm)/var(--lh-sm) var(--font); font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.label { font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--w-medium); color: var(--muted); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: var(--s5); padding: 0 var(--s4); background: var(--ink); color: var(--on-ink); min-width: 0; position: relative; z-index: 3; }
.wordmark { font-size: var(--text-lg); font-weight: var(--w-bold); letter-spacing: -0.02em; color: var(--on-ink); text-decoration: none; }
.wordmark span { color: var(--p3); }
.nav { display: flex; height: 100%; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav a, .nav button { display: flex; align-items: center; padding: 0 var(--s3); color: var(--on-ink-muted); text-decoration: none; font-weight: var(--w-medium); border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover, .nav button:hover { color: var(--on-ink); }
.nav a[aria-current="page"] { color: var(--on-ink); border-bottom-color: var(--p3); }
.release { margin-left: auto; font-size: var(--text-xs); color: var(--on-ink-muted); white-space: nowrap; }
.release b { color: var(--on-ink); font-weight: var(--w-medium); }
.lang-switch { display: flex; flex: none; gap: 2px; padding: 2px; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.08); }
.lang-switch button { height: 28px; padding: 0 var(--s2); border-radius: 6px; font-size: var(--text-xs); font-weight: var(--w-medium); letter-spacing: 0.02em; color: var(--on-ink-muted); }
.lang-switch button:hover { color: var(--on-ink); }
.lang-switch button[aria-pressed="true"] { background: var(--on-ink); color: var(--ink); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); min-height: 0; }
.panel { background: var(--surface); border-right: 1px solid var(--line); padding: var(--s4); display: grid; gap: var(--s5); align-content: start; grid-template-columns: minmax(0, 1fr); overflow-y: auto; scrollbar-width: thin; }
.panel-head { display: grid; gap: var(--s1); }
.panel-head h1 { font-size: var(--text-lg); line-height: var(--lh-lg); font-weight: var(--w-bold); }
.panel-head p { color: var(--muted); }
.group { display: grid; gap: var(--s2); }
.group h2 { display: flex; justify-content: space-between; }
.panel-foot { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: 36px; padding: 0 var(--s3); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); font-weight: var(--w-medium); white-space: nowrap; }
.btn:hover { background: var(--surface-sunken); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.is-icon { width: 36px; padding: 0; }
.switches { display: grid; grid-template-columns: 1fr 0.8fr; gap: var(--s2); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 3px; background: var(--surface-sunken); border-radius: var(--r-md); }
.segmented button { height: 32px; border-radius: 6px; font-weight: var(--w-medium); color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented button:disabled { opacity: 0.45; cursor: default; }

.note { display: grid; grid-template-columns: 8px 1fr; gap: var(--s2) var(--s3); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-sunken); }
.note::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); margin-top: 6px; }
.note strong { display: block; font-weight: var(--w-bold); }
.note p { color: var(--ink-soft); }
.note.is-demo { background: var(--demo-soft); }
.note.is-demo::before { background: var(--demo); }
.note.is-verified { background: var(--verified-soft); }
.note.is-verified::before { background: var(--verified); }
.note.is-caution { background: var(--accent-soft); }
.note.is-caution::before { background: var(--accent); }
.model-row { margin-top: calc(-1 * var(--s1)); }
.caution-note { color: var(--accent) !important; }

.stats { display: grid; border-radius: var(--r-md); box-shadow: var(--shadow-1); background: var(--surface); }
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.stat-label { color: var(--muted); }
.stat-value { display: grid; justify-items: end; text-align: right; }
.stat-value strong { font-size: var(--text-md); line-height: var(--lh-md); font-weight: var(--w-bold); }
.stat-value strong.is-accent { color: var(--accent); }
.stat-value small { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }

.layer-option { width: 100%; display: grid; grid-template-columns: 28px 1fr 18px; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-align: left; }
.layer-option[aria-pressed="true"] { border-color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--ink-soft); }
.layer-option strong { display: block; font-weight: var(--w-medium); }
.layer-option small { display: block; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.layer-symbol { width: 28px; height: 28px; border-radius: var(--r-sm); }
.heat-symbol { background: linear-gradient(135deg, var(--p2), var(--p5) 60%, var(--p7)); }
.fire-symbol { background: radial-gradient(circle at 35% 40%, var(--p6) 0 3px, transparent 4px), radial-gradient(circle at 65% 62%, var(--p4) 0 3px, transparent 4px), radial-gradient(circle at 62% 28%, var(--p5) 0 2px, transparent 3px), var(--surface-sunken); }
.radio-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.layer-option[aria-pressed="true"] .radio-dot { border: 5px solid var(--ink); }
.history-options, .alert-profile { display: grid; gap: var(--s2); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-sunken); }
.history-options label, .alert-profile > label { font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--w-medium); color: var(--muted); }
select { width: 100%; height: 36px; padding: 0 var(--s2); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
select:disabled { opacity: 1; color: var(--ink); }
.alert-profile p { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.alert-profile #alert-profile-metrics { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--ink); font-weight: var(--w-medium); }
.alert-profile > a { font-size: var(--text-xs); font-weight: var(--w-medium); }

.toggle-row { display: grid; grid-template-columns: 1fr 36px; align-items: center; gap: var(--s3); padding: var(--s1) 0; cursor: pointer; position: relative; }
.toggle-row input { position: absolute; opacity: 0; width: 36px; height: 20px; right: 0; margin: 0; cursor: pointer; }
.toggle { width: 36px; height: 20px; border-radius: var(--r-pill); background: var(--line-strong); position: relative; transition: background 0.15s; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-1); transition: transform 0.15s; }
.toggle-row input:checked + .toggle { background: var(--ink); }
.toggle-row input:checked + .toggle::after { transform: translateX(16px); }
.toggle-row input:focus-visible + .toggle { outline: 2px solid var(--focus); outline-offset: 2px; }

.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search-wrap input { width: 100%; height: 36px; padding: 0 var(--s3) 0 36px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.region-list { display: grid; }
.region-item { display: grid; grid-template-columns: 8px 1fr auto; gap: var(--s3); align-items: center; padding: 7px var(--s2); border-bottom: 1px solid var(--line); text-align: left; border-radius: 0; }
.region-item:hover { background: var(--surface-sunken); }
.region-item.selected { background: var(--surface-sunken); font-weight: var(--w-medium); }
.region-circle { width: 8px; height: 8px; border-radius: 50%; background: var(--p4); }
.region-value { color: var(--muted); }
.blank-list { color: var(--muted); padding: var(--s3) 0; }
.basemap-row { display: grid; grid-template-columns: auto 1fr; gap: var(--s3); align-items: center; margin-bottom: var(--s1); }
.basemap-row > span { color: var(--ink-soft); }
.mk { display: inline-block; width: 14px; height: 14px; margin-right: var(--s2); vertical-align: -2px; flex: none; }
.mk-pred { border-radius: 50%; border: 2.5px solid var(--p7); background: radial-gradient(circle, var(--p7) 0 2.5px, var(--surface) 3px); box-shadow: 0 0 0 1.5px var(--surface); }
.mk-obs { width: 11px; height: 11px; margin: 0 10px 0 2px; transform: rotate(45deg); background: var(--surface); border: 1.6px solid var(--ink); }
.mk-obs.is-hit { background: #ffd166; }
.mk-pred.is-hit { box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 4px #ffd166; }
.points-summary { display: grid; gap: 2px; padding: var(--s3); border-radius: var(--r-md); background: var(--surface-sunken); }
.points-summary b { font-weight: var(--w-bold); }
.points-list { display: grid; }
.point-item { display: grid; grid-template-columns: 24px 1fr auto; gap: var(--s2); align-items: center; padding: 7px var(--s2); border-bottom: 1px solid var(--line); text-align: left; }
.point-item:hover { background: var(--surface-sunken); }
.point-item b { display: block; font-weight: var(--w-medium); }
.point-item small { display: block; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.point-value { font-weight: var(--w-bold); color: var(--accent); }
.points-note { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.points-legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--ink-soft); }
.points-legend span { display: inline-flex; align-items: center; }
.report-buttons { display: flex; flex-wrap: wrap; gap: var(--s2); }
.report-buttons button { height: 32px; padding: 0 var(--s3); border-radius: var(--r-pill); border: 1px solid var(--line-strong); font-weight: var(--w-medium); font-size: var(--text-xs); }
.report-buttons button:hover { background: var(--surface-sunken); }

/* ---------- map ---------- */
.workspace { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, #fbfbf6 0%, #eceee4 55%, #dfe4d8 100%); }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.workspace.is-3d #map { visibility: hidden; }
.relief-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; z-index: 0; }
.map-top, .map-status, .map-tools, .cell-card, .legend, .map-foot, .toast { z-index: 2; }
.relief-canvas.dragging { cursor: grabbing; }
.relief-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.relief-city { position: absolute; left: 0; top: 0; padding-left: 10px; margin-top: -8px; font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--w-medium); color: var(--ink); white-space: nowrap; text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface), 0 0 6px var(--surface); }
.relief-city::before { content: ''; position: absolute; left: -3px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--ink); }
.relief-marker { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--ink); box-shadow: 0 0 0 3px var(--surface); }

.map-top { position: absolute; top: var(--s4); left: var(--s4); right: var(--s4); display: flex; gap: var(--s3); align-items: flex-start; flex-wrap: wrap; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.datebar { display: flex; align-items: center; gap: var(--s1); padding: var(--s1); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.datebar .btn { border: 0; }
.date-input-wrap { position: relative; }
.date-input-wrap input { height: 36px; border: 0; background: none; padding: 0 var(--s2); font-size: var(--text-md); font-weight: var(--w-bold); color: var(--ink); cursor: pointer; }
.timeline-days { display: flex; gap: 2px; padding-left: var(--s2); margin-left: var(--s1); border-left: 1px solid var(--line); }
.timeline-day { width: 40px; height: 40px; display: grid; place-content: center; text-align: center; border-radius: var(--r-md); font-size: var(--text-xs); line-height: 14px; color: var(--muted); }
.timeline-day strong { display: block; font-size: var(--text-sm); line-height: var(--lh-xs); color: var(--ink); font-weight: var(--w-medium); }
.timeline-day:hover { background: var(--surface-sunken); }
.timeline-day.active { background: var(--ink); color: var(--on-ink-muted); }
.timeline-day.active strong { color: var(--on-ink); }
.chip { display: inline-flex; align-items: center; gap: var(--s2); min-height: 28px; padding: var(--s1) var(--s3); border-radius: var(--r-pill); font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--w-medium); background: var(--surface); color: var(--ink-soft); box-shadow: var(--shadow-1); margin-top: 10px; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.is-demo { background: var(--demo-soft); color: var(--demo); }
.chip.is-verified { background: var(--verified-soft); color: var(--verified); }
.chip-sep { width: 1px; height: 12px; background: currentColor; opacity: 0.3; }
.export-button { margin-left: auto; box-shadow: var(--shadow-2); border: 0; }

.map-status { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 32px)); display: grid; gap: var(--s2); }
.banner { display: grid; grid-template-columns: 20px 1fr; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-2); }
.banner strong { display: block; font-weight: var(--w-bold); }
.banner p { color: var(--ink-soft); margin: 2px 0 var(--s2); }
.banner.is-danger { background: var(--danger-soft); }
.banner.is-danger > svg { color: var(--danger); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--ink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.map-tools { position: absolute; right: var(--s4); top: 136px; display: grid; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-2); overflow: hidden; }
.map-tools .btn { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.map-tools .btn:last-child { border-bottom: 0; }

.cell-card { position: absolute; right: 68px; top: 136px; width: 296px; max-height: calc(100% - 96px); overflow-y: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: var(--s4); display: grid; gap: var(--s2); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-top .btn { border: 0; width: 28px; height: 28px; }
.cell-card h3 { font-size: var(--text-md); line-height: var(--lh-md); font-weight: var(--w-bold); }
.cell-coordinates { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.probability-row { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s1); }
.probability-row strong { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: var(--w-bold); color: var(--accent); }
.probability-row span { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--ink-soft); white-space: pre-line; }
.probability-meter { height: 6px; border-radius: var(--r-pill); background: var(--surface-sunken); overflow: hidden; }
.probability-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--p2), var(--p5), var(--p7)); border-radius: inherit; }
.cell-context { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.cell-card > .label { margin-top: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }
.factor { display: grid; grid-template-columns: 72px 1fr 36px; gap: var(--s2); align-items: center; font-size: var(--text-xs); line-height: var(--lh-xs); }
.factor-track { height: 4px; border-radius: 2px; background: var(--surface-sunken); overflow: hidden; }
.factor-track i { display: block; height: 100%; background: var(--p5); }
.factor-value { text-align: right; }
.empty-history { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--ink-soft); }
.cell-card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1) var(--s3); padding-top: var(--s2); border-top: 1px solid var(--line); font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.card-disclaimer { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }

.legend { position: absolute; left: var(--s4); bottom: var(--s4); width: 380px; max-width: calc(100% - 32px); background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: var(--s3); display: grid; gap: var(--s2); }
.legend-title { font-weight: var(--w-bold); }
.legend-ramp { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; position: relative; }
.legend-ramp i { height: 12px; }
.legend-ramp i:nth-child(1) { background: var(--p1); border-radius: 2px 0 0 2px; }
.legend-ramp i:nth-child(2) { background: var(--p2); }
.legend-ramp i:nth-child(3) { background: var(--p3); }
.legend-ramp i:nth-child(4) { background: var(--p4); }
.legend-ramp i:nth-child(5) { background: var(--p5); }
.legend-ramp i:nth-child(6) { background: var(--p6); }
.legend-ramp i:nth-child(7) { background: var(--p7); border-radius: 0 2px 2px 0; }
.legend-ramp .threshold { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); left: calc(600% / 7 - 1px); }
.legend-ticks, .legend-counts { display: grid; grid-template-columns: repeat(7, 1fr); font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.legend-ticks span { margin-left: -2px; white-space: nowrap; }
.legend-ticks span:first-child { margin-left: 0; }
.legend-counts { color: var(--ink-soft); }
.legend-note { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }

.map-foot { position: absolute; right: var(--s4); bottom: var(--s4); display: grid; gap: var(--s1); justify-items: end; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.map-scale { display: grid; justify-items: end; gap: 2px; }
.map-scale i { width: 64px; height: 6px; border: 1.5px solid var(--ink-soft); border-top: 0; }
.workspace.is-3d .map-scale { display: none; }
.workspace.is-satellite .map-foot { padding: var(--s1) var(--s2); border-radius: var(--r-md); background: rgb(255 254 250 / 85%); color: var(--ink-soft); }
.attribution { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: flex-end; }
.attribution a { color: inherit; }
.map-hint { color: var(--ink-soft); }
.toast { position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: var(--s2) var(--s4); border-radius: var(--r-pill); background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-2); font-weight: var(--w-medium); }

/* ---------- satellite detail view ---------- */
.btn.is-primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.is-primary:hover { background: var(--ink-soft); }
.card-place { width: 100%; margin-top: var(--s1); }
.detail-map { position: absolute; inset: 0; z-index: 1; background: #1d2a26; }
.detail-map .leaflet-top { top: 120px; }
.detail-map .leaflet-control-attribution { font: 11px/1.4 var(--font); background: rgb(255 254 250 / 85%); }
.detail-map .leaflet-control-scale-line { font: 12px var(--font); border-color: var(--ink); background: rgb(255 254 250 / 80%); }
.detail-map .leaflet-bar a { color: var(--ink); }
.workspace.is-detail .legend, .workspace.is-detail .map-tools, .workspace.is-detail .map-foot { display: none; }
.detail-bar { position: absolute; z-index: 2; top: 72px; left: var(--s4); right: 360px; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s1); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); max-width: 760px; }
.detail-bar .btn { border: 0; }
.detail-title { display: grid; padding: 0 var(--s2); min-width: 0; flex: 1; }
.detail-title b { font-weight: var(--w-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-title span { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--muted); }
.detail-bar .segmented { width: 200px; }
.detail-legend { position: absolute; z-index: 2; left: var(--s4); bottom: var(--s5); display: grid; gap: var(--s1); padding: var(--s3); background: rgb(255 254 250 / 94%); border-radius: var(--r-md); box-shadow: var(--shadow-2); font-size: var(--text-xs); line-height: var(--lh-xs); max-width: 300px; }
.detail-legend > span, .detail-check { display: inline-flex; align-items: center; gap: var(--s1); }
.detail-check { cursor: pointer; margin-top: var(--s1); color: var(--ink); font-weight: var(--w-medium); }
.detail-note { color: var(--muted); }
.mk-past { width: 10px; height: 10px; margin: 0 10px 0 2px; border-radius: 50%; background: #f2f5ef; border: 1.4px solid var(--ink); }
.mk-past.is-2024 { background: #c9e3ff; }
.mk-past.is-2026 { background: #ffd7a8; }
.mk-cell { width: 14px; height: 14px; border: 1.5px solid var(--p5); background: rgb(201 111 46 / 30%); }
.detail-diamond { display: block; width: 12px; height: 12px; margin: 2px; transform: rotate(45deg); background: #fffefa; border: 2px solid #193d35; box-shadow: 0 0 0 2px rgb(255 254 250 / 70%); }
.detail-diamond.is-hit { background: #ffd166; }
.detail-popup { display: grid; gap: var(--s1); font: var(--text-xs)/var(--lh-xs) var(--font); color: var(--ink); }
.detail-popup b { font-size: var(--text-sm); }
.detail-popup button { margin-top: var(--s1); height: 30px; border-radius: var(--r-md); background: var(--ink); color: var(--on-ink); font-weight: var(--w-medium); }
@media (max-width: 860px) {
  .detail-bar { top: 64px; left: var(--s3); right: var(--s3); }
  .detail-bar .segmented { width: 100%; }
  .detail-legend { left: var(--s3); right: var(--s3); bottom: 28px; max-width: none; grid-template-columns: 1fr 1fr; padding: var(--s2); }
  .detail-legend > span:nth-of-type(n+3) { display: none; }
  .detail-legend .detail-check { grid-column: 1 / -1; margin-top: 0; }
  .detail-title span { display: none; }
  .detail-map .leaflet-top { top: 180px; }
}

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: var(--r-lg); padding: var(--s5); max-width: 600px; width: calc(100% - 32px); max-height: 85dvh; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgb(25 61 53 / 30%); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading .btn { border: 0; }
dialog h2 { font-size: var(--text-lg); line-height: var(--lh-lg); font-weight: var(--w-bold); margin-top: var(--s3); }
dialog p { color: var(--ink-soft); margin-top: var(--s3); }
dialog .data-line { display: flex; gap: var(--s4); align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: var(--s3) 0; }
dialog .data-line span:last-child { font-size: var(--text-xs); font-weight: var(--w-medium); color: var(--muted); }
dialog .data-line .ready { color: var(--verified); }
dialog .data-line .pending { color: var(--demo); }
dialog .data-line .sealed { color: var(--ink-soft); }
dialog .method-step { display: flex; gap: var(--s4); margin-top: var(--s4); }
dialog .method-step > b { font-size: var(--text-xs); background: var(--surface-sunken); padding: var(--s1) var(--s2); height: 24px; border-radius: var(--r-sm); color: var(--ink-soft); }
dialog .method-step strong { font-weight: var(--w-bold); }
dialog .method-step p { margin-top: var(--s1); }
.metrics-scroll { overflow-x: auto; margin: var(--s4) 0; }
.metrics-table { border-collapse: collapse; width: 100%; min-width: 420px; text-align: right; }
.metrics-table th, .metrics-table td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.metrics-table th:first-child, .metrics-table td:first-child { text-align: left; padding-left: 0; }
.metrics-table th { font-size: var(--text-xs); font-weight: var(--w-medium); color: var(--muted); border-bottom-color: var(--line-strong); }
.chosen-model { background: var(--verified-soft); font-weight: var(--w-medium); }
.dialog-heading + div code { font-size: var(--text-xs); color: var(--muted); }

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

@media (max-width: 1520px) {
  .chip-sep, #stat-source { display: none; }
}

/* ---------- tablet ---------- */
@media (max-width: 1150px) {
  .release { display: none; }
  .lang-switch { margin-left: auto; }
  .timeline-days { display: none; }
  .legend { width: 330px; }
}

/* ---------- phone and small tablet: map first, controls below ---------- */
@media (max-width: 860px) {
  body { display: block; height: auto; }
  .topbar { position: sticky; top: 0; height: 48px; gap: var(--s3); }
  .nav a, .nav button { padding: 0 var(--s2); }
  .app { display: flex; flex-direction: column; }
  .workspace { order: -1; height: 66svh; min-height: 440px; }
  .panel { border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .map-top { top: var(--s3); left: var(--s3); right: var(--s3); }
  .datebar { flex: 1; justify-content: space-between; }
  .chip { display: none; }
  .export-button span { display: none; }
  .export-button { width: 44px; padding: 0; height: 44px; margin-top: 0; }
  .map-status { top: 72px; }
  .map-tools { top: auto; bottom: 150px; right: var(--s3); }
  .legend { left: var(--s3); right: var(--s3); bottom: var(--s3); width: auto; padding: var(--s2) var(--s3); }
  .legend-note, .legend-counts { display: none; }
  .map-foot, .map-hint { display: none; }
  .cell-card { left: var(--s3); right: var(--s3); top: auto; bottom: var(--s3); width: auto; max-height: 60%; z-index: 2; }
  .toast { bottom: 120px; }
}
