/* SakaSAR — full-bleed map with floating glass sheets (panel, toolbar, timeline, legend, inspector).
   Logo green = controls and selection. Floodwater blue = anything wet. Storm red = the typhoon. */
:root {
  --glass: rgba(255, 255, 255, 0.86);
  --glass-strong: rgba(255, 255, 255, 0.95);
  --surface: rgba(15, 40, 28, 0.045);
  --surface-2: rgba(15, 40, 28, 0.08);
  --edge: rgba(15, 40, 28, 0.09);
  --ink: #0f1f17;
  --ink-2: #33473c;
  --muted: #66796e;
  --green: #1f8a4c;
  --green-dark: #136a38;
  --green-soft: rgba(31, 138, 76, 0.1);
  --water: #2f9fd3;
  --water-dark: #1b5fa8;
  --storm: #e2533c;
  --shadow: 0 0 0 1px rgba(15, 40, 28, 0.06), 0 2px 4px rgba(15, 40, 28, 0.04), 0 12px 32px -8px rgba(15, 40, 28, 0.22);
  --ui: "Geist", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --panel-w: 344px;
  --gap: 12px;
  --tl-h: 104px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font: 400 14px/1.45 var(--ui); color: var(--ink); background: #1c3a4a; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
ol, ul { margin: 0; padding: 0; list-style: none; }
[data-lucide] { width: 16px; height: 16px; stroke-width: 1.9; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); }

/* ---------- frame: the map is the page ---------- */
.app { position: fixed; inset: 0; }
.stage { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; }

/* ---------- top: brand chip + toolbar ---------- */
.topbar { position: absolute; z-index: 6; top: var(--gap); left: var(--gap); right: var(--gap); display: flex; align-items: flex-start; gap: var(--gap); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brandchip { display: flex; align-items: center; gap: 10px; width: var(--panel-w); padding: 6px 14px 6px 6px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); }
.logo { border-radius: 50%; }
.brand h1 { font: 800 19px/1 var(--display); color: var(--green-dark); letter-spacing: -0.02em; }
.brand p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.toolbar { margin-left: auto; display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 14px; background: var(--glass); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); }
.tb-sep { width: 1px; height: 20px; background: var(--edge); margin: 0 4px; }
.tool { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 32px; border: 0; background: none; border-radius: 9px; padding: 0 11px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: background 0.15s, color 0.15s; }
.tool.icon-only { width: 32px; padding: 0; justify-content: center; }
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool:active { transform: scale(0.96); }
.icon-btn { position: relative; width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; border-radius: 9px; cursor: pointer; color: var(--muted); transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
/* tooltips */
[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: #fff; font-size: 12px; font-weight: 500; padding: 4px 8px; border-radius: 7px; pointer-events: none; z-index: 20; }

/* segmented control with a sliding pill (pill is injected by JS) */
.seg { position: relative; display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; isolation: isolate; }
.seg button { position: relative; z-index: 1; border: 0; background: none; border-radius: 7px; height: 26px; padding: 0 12px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); transition: color 0.2s; }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg-pill { position: absolute; z-index: 0; top: 3px; height: calc(100% - 6px); left: 0; border-radius: 7px; background: #fff; box-shadow: 0 1px 2px rgba(15, 40, 28, 0.15), 0 0 0 1px rgba(15, 40, 28, 0.04); transition: transform 0.32s var(--ease), width 0.32s var(--ease); }
.seg.tiny button { height: 20px; padding: 0 8px; font-size: 11px; }
#ai-seg { display: flex; }
#ai-seg button { flex: 1; height: 30px; }

/* ---------- side panel ---------- */
.panel { position: absolute; z-index: 5; left: var(--gap); top: calc(var(--gap) + 54px); bottom: calc(var(--tl-h) + var(--gap) * 2); width: var(--panel-w); display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-radius: 18px;
  background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow);
  transition: transform 0.38s var(--ease), opacity 0.25s; }
.app.no-panel .panel { transform: translateX(calc(-100% - var(--gap) * 2)); opacity: 0; pointer-events: none; }
.tabs { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); margin: 8px 8px 0; padding: 3px; border-radius: 12px; background: var(--surface-2); isolation: isolate; }
.tab-ind { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 6); border-radius: 9px; background: #fff; box-shadow: 0 1px 2px rgba(15, 40, 28, 0.15); transition: transform 0.34s var(--ease); }
.tabs button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; height: 44px; cursor: pointer; font-size: 11px; font-weight: 500; color: var(--muted); transition: color 0.2s; }
.tabs button [data-lucide] { width: 16px; height: 16px; }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tab-body { flex: 1; overflow-y: auto; padding: 14px 14px 20px; scrollbar-width: thin; scrollbar-color: rgba(15, 40, 28, 0.2) transparent; }
.tab-body.enter { animation: tabIn 0.28s var(--ease); }
@keyframes tabIn { from { opacity: 0; transform: translateY(6px); } }
.h { font-size: 12px; font-weight: 600; color: var(--muted); margin: 20px 2px 8px; letter-spacing: 0.01em; }
.h:first-child { margin-top: 2px; }
.h-row { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 8px; }
.h-row .h { margin: 0; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.lead { font-size: 14px; line-height: 1.5; margin: 12px 2px 10px; color: var(--ink-2); }
.lead strong { color: var(--ink); font-weight: 600; }
.link-btn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--green-dark); font-size: 12px; font-weight: 600; cursor: pointer; padding: 3px 7px; border-radius: 7px; }
.link-btn:hover { background: var(--green-soft); }
.link-btn [data-lucide] { width: 14px; height: 14px; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 0; color: #fff; background: var(--ink); border-radius: 10px; height: 34px; padding: 0 14px; cursor: pointer; font-size: 13px; font-weight: 500; margin: 12px 0 8px; transition: transform 0.15s, background 0.15s; }
.btn:hover { background: var(--green-dark); }
.btn:active { transform: scale(0.97); }

/* layer rows */
.lgroup { margin-bottom: 4px; }
.fields { display: grid; gap: 4px; }
.field-opt { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 11px; cursor: pointer; transition: background 0.15s, box-shadow 0.2s; }
.field-opt:hover { background: var(--surface); }
.field-opt[aria-checked="true"] { background: #fff; box-shadow: 0 0 0 1.5px var(--green), 0 4px 12px -4px rgba(31, 138, 76, 0.35); }
.field-opt .sw { height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(15, 40, 28, 0.08); }
.field-opt .sw.none { background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(15, 40, 28, 0.08) 5px 6px); }
.field-opt b { display: block; font-weight: 500; font-size: 13px; }
.field-opt small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.toggle { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 8px; border-radius: 11px; cursor: pointer; transition: background 0.15s; }
.toggle:hover { background: var(--surface); }
.toggle b { display: block; font-weight: 500; font-size: 13px; }
.toggle small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 36px; height: 21px; border-radius: 99px; background: rgba(15, 40, 28, 0.16); transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.28s var(--ease); }
.toggle input:checked + .switch { background: var(--green); }
.toggle input:checked + .switch::after { transform: translateX(15px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--green); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px; }
.chip { border: 0; background: var(--surface-2); color: var(--ink-2); border-radius: 99px; height: 30px; padding: 0 12px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 0.15s, color 0.15s; }
.chip:hover { background: rgba(15, 40, 28, 0.12); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip-note { margin: 6px 6px 0; }
.basemaps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 2px 4px; }
.bm { position: relative; border: 0; padding: 0; height: 64px; border-radius: 12px; overflow: hidden; cursor: pointer; background: #ddd center / cover; box-shadow: inset 0 0 0 1px rgba(15, 40, 28, 0.1); transition: box-shadow 0.2s, transform 0.15s; }
.bm:active { transform: scale(0.98); }
.bm span { position: absolute; left: 6px; bottom: 6px; background: rgba(255, 255, 255, 0.92); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; }
.bm[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--green), 0 6px 14px -6px rgba(31, 138, 76, 0.5); }
.slider-row { display: grid; grid-template-columns: 64px 1fr 40px; align-items: center; gap: 10px; padding: 6px 8px; font-size: 12px; color: var(--muted); }
.slider-row output { text-align: right; color: var(--ink-2); font-weight: 500; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--green) var(--p, 50%), rgba(15, 40, 28, 0.14) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(15, 40, 28, 0.14); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--green); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--green), 0 2px 4px rgba(0, 0, 0, 0.2); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--green), 0 2px 4px rgba(0, 0, 0, 0.2); }
.callout { display: grid; grid-template-columns: 16px 1fr; gap: 8px; background: rgba(226, 83, 60, 0.08); border-radius: 11px; padding: 9px 10px; font-size: 12px; line-height: 1.45; color: #6d3226; margin: 4px 4px 2px; }
.callout [data-lucide] { width: 15px; height: 15px; color: var(--storm); margin-top: 1px; }

/* towns */
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 4px 4px 14px; }
.summary .big { grid-column: 1 / -1; }
.summary b { display: block; font: 700 20px/1.15 var(--display); letter-spacing: -0.01em; }
.summary .big b { font-size: 40px; color: var(--water-dark); letter-spacing: -0.03em; line-height: 1; }
.summary .big b small { font-size: 18px; font-weight: 600; margin-left: 2px; }
.summary > div > span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.provinces { display: grid; gap: 7px; padding: 0 4px; }
.provinces li { display: grid; grid-template-columns: 112px 1fr 62px; gap: 10px; align-items: center; font-size: 12.5px; }
.provinces .bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.provinces .bar i { display: block; height: 100%; background: var(--water); border-radius: 4px; transform-origin: left; animation: grow 0.7s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.provinces .v { text-align: right; font-weight: 600; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 0 10px; margin: 0 2px 6px; color: var(--muted); transition: box-shadow 0.15s, background 0.15s; }
.search:focus-within { background: #fff; box-shadow: 0 0 0 1.5px var(--green); }
.search input { border: 0; outline: 0; background: none; height: 34px; flex: 1; color: var(--ink); }
.towns { display: grid; }
.town { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 10px; cursor: pointer; transition: background 0.15s; }
.town:hover { background: var(--surface); }
.town.active { background: var(--green-soft); }
.town .rk { font: 600 12px var(--display); color: var(--muted); text-align: right; }
.town b { display: block; font-weight: 500; font-size: 13px; }
.town small { color: var(--muted); font-size: 11.5px; }
.town .val { text-align: right; font-size: 13px; font-weight: 600; }
.town .val small { display: block; color: var(--water-dark); font-weight: 500; }

/* forecast */
.chart-box { position: relative; height: 170px; margin: 0 2px; }
.chart-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11.5px; color: var(--muted); margin: 6px 2px 0; }
.chart-key i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* events */
.events { position: relative; display: grid; gap: 0; margin-top: 10px; }
.events::before { content: ""; position: absolute; left: 12px; top: 10px; bottom: 10px; width: 1.5px; background: var(--edge); }
.events button { position: relative; display: grid; grid-template-columns: 10px 1fr; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 10px; cursor: pointer; transition: background 0.15s; }
.events button:hover { background: var(--surface); }
.events button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-top: 5px; box-shadow: 0 0 0 3px #fff; }
.events time { display: block; font-size: 11.5px; color: var(--muted); }
.events p { font-size: 13px; line-height: 1.45; }
.events li.future { opacity: 0.4; }
.events li.now p { font-weight: 600; }

/* ---------- legend, readout, inspector ---------- */
.legend { position: absolute; z-index: 4; left: calc(var(--rail-w, 60px) + var(--gap) * 2); bottom: calc(var(--tl-h) + var(--gap) * 2 + 30px); display: grid; gap: 10px; width: 232px; border-radius: 14px; padding: 11px 12px; font-size: 12px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); transition: left 0.38s var(--ease); }
.app.no-panel .legend, .app.no-panel .readout { left: var(--gap); }
.legend:empty { display: none; }
.legend b { display: block; font-weight: 600; font-size: 12px; }
.legend small { color: var(--muted); font-size: 11px; }
.legend .ramp { height: 8px; border-radius: 4px; margin: 6px 0 3px; }
.legend .ticks-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.legend .sw { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.legend .sw i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.readout { position: absolute; z-index: 4; left: calc(var(--rail-w, 60px) + var(--gap) * 2); bottom: calc(var(--tl-h) + var(--gap) * 2); height: 24px; display: flex; align-items: center; border-radius: 8px; padding: 0 9px; font-size: 12px; color: var(--muted); max-width: 52vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow); transition: left 0.38s var(--ease); }
.readout b { color: var(--ink); font-weight: 600; }
.readout span { color: rgba(15, 40, 28, 0.25); margin: 0 6px; }

.inspector { position: absolute; z-index: 6; top: calc(var(--gap) + 54px); right: 58px; width: 324px; max-height: calc(100% - var(--tl-h) - var(--gap) * 3 - 54px); display: flex; flex-direction: column; border-radius: 18px;
  background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); transform-origin: var(--ox, 100%) var(--oy, 0%); }
.inspector.pop { animation: pop 0.34s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(0.92); } }
.insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 2px 14px; cursor: grab; touch-action: none; user-select: none; }
.insp-head span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.insp-head b { font: 700 15px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-head [data-lucide] { color: var(--green); }
.insp-body { padding: 2px 14px 14px; overflow-y: auto; scrollbar-width: thin; }
.insp-body .coord { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 12px 0 4px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.kv .sec { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--edge); margin-top: 2px; }
.pill { display: inline-block; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.pill.wet { background: rgba(47, 159, 211, 0.14); color: var(--water-dark); }
.pill.dry { background: var(--green-soft); color: var(--green-dark); }
.pill.na { background: var(--surface-2); color: var(--muted); }
.actions { display: grid; gap: 7px; margin-top: 4px; font-size: 13px; line-height: 1.45; }
.actions li { display: grid; grid-template-columns: 14px 1fr; gap: 8px; }
.actions li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin: 7px 0 0 4px; }
.actions li.warn::before { background: var(--storm); box-shadow: 0 0 0 3px rgba(226, 83, 60, 0.18); }
.insp-chart { position: relative; height: 110px; margin-top: 8px; }

/* ---------- map markers & controls ---------- */
.storm-marker { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; pointer-events: none;
  background: radial-gradient(circle, var(--sc, #e2533c) 0 34%, color-mix(in srgb, var(--sc, #e2533c) 25%, transparent) 35% 100%); }
.storm-marker svg { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }
.storm-tag { position: absolute; top: 42px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: #fff; color: var(--ink); border-radius: 7px; padding: 2px 8px; font: 600 11px/1.4 var(--ui); box-shadow: var(--shadow); }
.track-label { font: 500 11px/1.2 var(--ui); color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); white-space: nowrap; transform: translate(10px, -10px); pointer-events: none; }
.track-label b { font-weight: 700; }
.ref-label { font: 600 11px/1.2 var(--ui); background: rgba(15, 31, 23, 0.82); color: #fff; padding: 3px 7px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.pin { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; background: var(--ink); box-shadow: 0 0 0 2px var(--ink), 0 0 0 8px rgba(15, 31, 23, 0.18); animation: ping 0.5s var(--ease); }
@keyframes ping { from { box-shadow: 0 0 0 2px var(--ink), 0 0 0 22px rgba(15, 31, 23, 0); } }
.maplibregl-ctrl-top-right { top: calc(var(--gap) + 54px); right: calc(var(--gap) - 10px); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--tl-h) + var(--gap) * 2 - 10px); right: calc(var(--gap) - 10px); }
.maplibregl-ctrl-group { border-radius: 12px !important; box-shadow: var(--shadow) !important; background: var(--glass-strong) !important; overflow: hidden; }
.maplibregl-ctrl-scale { border-color: var(--ink-2); color: var(--ink); font: 11px var(--ui); background: rgba(255, 255, 255, 0.85); border-radius: 0 0 4px 4px; }
.maplibregl-ctrl-attrib.maplibregl-compact { border-radius: 10px; }

/* ---------- timeline ---------- */
.timeline { position: absolute; z-index: 5; left: var(--gap); right: var(--gap); bottom: var(--gap); height: var(--tl-h); display: grid; grid-template-columns: 50px 176px 1fr 430px; gap: 16px; align-items: center; padding: 10px 16px 10px 14px; border-radius: 20px;
  background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); }
.play { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; display: grid; place-items: center; transition: transform 0.15s, background 0.2s; }
.play:hover { background: var(--green-dark); }
.play:active { transform: scale(0.94); }
.play [data-lucide] { width: 20px; height: 20px; fill: currentColor; }
.play.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--green); opacity: 0.5; }
.tl-date b { display: block; font: 700 22px/1.05 var(--display); letter-spacing: -0.02em; }
.tl-date > span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; margin: 3px 0 5px; min-height: 30px; }
.scrub { position: relative; height: 80px; cursor: ew-resize; touch-action: none; user-select: none; border-radius: 10px; }
.ticks { position: absolute; left: 0; right: 0; top: 0; height: 12px; }
.ticks i { position: absolute; top: 2px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #fff; transition: transform 0.15s; }
.ticks i:hover { transform: scale(1.6); }
.bars { position: absolute; left: 0; right: 0; top: 15px; height: 46px; display: flex; align-items: flex-end; gap: 2px; }
.bars i { flex: 1; min-height: 3px; border-radius: 3px 3px 1px 1px; background: rgba(47, 159, 211, 0.22); transform-origin: bottom; transition: background 0.25s; }
.bars i.storm { background: rgba(27, 95, 168, 0.3); }
.bars i.past { background: var(--water); }
.bars i.past.storm { background: var(--water-dark); }
.bars i.pass { box-shadow: inset 0 -3px 0 var(--green); }
.bars.intro i { animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--i) * 18ms); }
@keyframes rise { from { transform: scaleY(0); } }
.days { position: absolute; left: 0; right: 0; bottom: 0; height: 14px; font-size: 10.5px; color: var(--muted); }
.days span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.head { position: absolute; top: 10px; bottom: 15px; width: 2px; margin-left: -1px; background: var(--storm); border-radius: 1px; pointer-events: none; }
.head::before { content: ""; position: absolute; top: -5px; left: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--storm); box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0, 0, 0, 0.25); }
.tl-stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.tl-stats div { padding: 2px 12px; border-left: 1px solid var(--edge); line-height: 1.25; }
.tl-stats b { display: block; font: 700 18px/1.15 var(--display); letter-spacing: -0.01em; white-space: nowrap; }
.tl-stats span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 12px; font-size: 13px; box-shadow: var(--shadow); animation: toastIn 0.3s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- fields (30 m pilot) ---------- */
.pilot-head { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 2px 2px 12px; }
.pilot-head h2 { font: 700 18px/1.15 var(--display); letter-spacing: -0.01em; }
.pilot-head p { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.btn.ghost { background: var(--surface-2); color: var(--ink); margin: 0; height: 32px; padding: 0 11px; }
.btn.ghost:hover { background: rgba(15, 40, 28, 0.13); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--edge); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--edge); }
.metrics > div { background: #fff; padding: 10px 12px; }
.metrics b { display: block; font: 700 22px/1.1 var(--display); letter-spacing: -0.02em; }
.metrics b.hit { color: var(--green-dark); }
.metrics span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; color: #8a5a00; background: rgba(238, 159, 39, 0.16); border-radius: 5px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.brgys { display: grid; gap: 6px; }
.brgys li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; background: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.brgys .n { font: 700 13px var(--display); color: var(--muted); }
.brgys small { display: block; font-size: 11.5px; color: var(--muted); }
.brgys .v { text-align: right; font-weight: 600; }
.plot-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.plot-chip { display: inline-flex; align-items: center; gap: 6px; border: 0; height: 30px; padding: 0 10px; border-radius: 99px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s; }
.plot-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--rc); }
.plot-chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.plot-card { margin-top: 10px; background: #fff; border-radius: 16px; padding: 14px; box-shadow: 0 0 0 1px var(--edge), 0 6px 18px -10px rgba(15, 40, 28, 0.35); animation: tabIn 0.28s var(--ease); }
.plot-card h3 { font: 700 16px/1.2 var(--display); margin: 0; }
.plot-card .sub2 { font-size: 12px; color: var(--muted); margin-top: 2px; }
.score { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin: 14px 0 6px; }
.score .num { font: 800 44px/0.9 var(--display); letter-spacing: -0.03em; color: var(--rc); }
.score .num small { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.cls { display: inline-block; font-size: 12px; font-weight: 700; color: #fff; background: var(--rc); border-radius: 6px; padding: 1px 8px; }
.scale { position: relative; height: 8px; border-radius: 4px; margin-top: 8px; background: linear-gradient(90deg, #7cc69a 0 40%, #ee9f27 40% 70%, #e2533c 70% 100%); }
.scale i { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px #fff; transition: left 0.5s var(--ease); }
.scale-l { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.why { margin: 12px 0 4px; }
.why-bar { display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.why-bar i { height: 100%; transform-origin: left; animation: grow 0.6s var(--ease) both; }
.why-rows { display: grid; gap: 4px; margin-top: 8px; font-size: 12px; }
.why-rows div { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.why-rows i { width: 10px; height: 10px; border-radius: 3px; }
.why-rows b { font-weight: 600; }
.soilbar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; font-size: 10.5px; font-weight: 600; color: #fff; margin-top: 6px; }
.soilbar span { display: grid; place-items: center; white-space: nowrap; overflow: hidden; }
.steps { position: relative; display: grid; gap: 10px; margin-top: 8px; }
.steps li { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 10px; }
.steps li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; margin: 4px 0 0 4px; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.steps li:first-child::before { background: var(--storm); box-shadow: 0 0 0 3px rgba(226, 83, 60, 0.18); }
.steps b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.steps p { font-size: 13px; line-height: 1.45; }
.steps small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.src { display: inline-block; font-size: 10.5px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border-radius: 5px; padding: 0 5px; margin: 3px 4px 0 0; }
.sms { position: relative; margin-top: 8px; background: #e9f6ee; border-radius: 16px 16px 16px 4px; padding: 10px 12px 8px; font-size: 13px; line-height: 1.45; }
.sms-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.rot-now { display: grid; grid-template-columns: 1fr auto; gap: 8px; background: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; margin: 8px 0; }
.rot-now b { font-weight: 600; }
.rots { display: grid; gap: 8px; }
.rot { display: grid; grid-template-columns: 26px 1fr; gap: 10px; background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: 0 0 0 1px var(--edge); }
.rot.first { box-shadow: 0 0 0 1.5px var(--green), 0 6px 14px -8px rgba(31, 138, 76, 0.45); }
.rot .rk { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font: 700 13px var(--display); background: var(--surface-2); }
.rot.first .rk { background: var(--green); color: #fff; }
.rot h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.rot .crops { font-size: 12px; color: var(--muted); }
.fit { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 5px; padding: 0 6px; margin-top: 4px; }
.fit.good { background: var(--green-soft); color: var(--green-dark); }
.fit.caution { background: rgba(238, 159, 39, 0.16); color: #8a5a00; }
.fit.poor { background: rgba(226, 83, 60, 0.14); color: #a0321f; }
.rot p { font-size: 12px; line-height: 1.45; margin-top: 4px; color: var(--ink-2); }
.rot p b { color: var(--ink); }
.prio { margin: 4px 0 10px; }

/* data tab */
.formula { background: var(--ink); color: #e9f2ec; border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.6; }
.formula b { color: #fff; }
.formula .w { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 10px 0 6px; }
.formula .wl { display: flex; justify-content: space-between; font-size: 11px; color: #a9bdb2; }
.ds { display: grid; gap: 2px; }
.ds li { display: grid; grid-template-columns: 8px 1fr; gap: 10px; padding: 6px 4px; font-size: 12.5px; line-height: 1.4; }
.ds li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-top: 6px; }
.ds.future li::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.ds b { font-weight: 600; }
.ds small { display: block; color: var(--muted); font-size: 11.5px; }
.hitbox { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; background: var(--green-soft); border-radius: 14px; padding: 12px; }
.hitbox b { font: 800 34px/1 var(--display); color: var(--green-dark); }
.hitbox p { font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.limits { display: grid; gap: 6px; font-size: 12.5px; line-height: 1.45; }
.limits li { background: var(--surface); border-radius: 10px; padding: 8px 10px; }
.facts2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.facts2 div { background: var(--surface); border-radius: 10px; padding: 8px 10px; }
.facts2 b { display: block; font: 700 17px/1.2 var(--display); }
.facts2 span { font-size: 11.5px; color: var(--muted); }

/* story mode */
.story { position: absolute; z-index: 7; left: 50%; bottom: calc(var(--tl-h) + var(--gap) * 2 + 8px); transform: translateX(-50%); width: min(560px, calc(100% - 24px)); border-radius: 18px; padding: 14px 16px 12px;
  background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); animation: storyIn 0.35s var(--ease); }
@keyframes storyIn { from { opacity: 0; transform: translate(-50%, 10px); } }
.story-steps { display: flex; gap: 4px; margin-bottom: 10px; }
.story-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); transition: background 0.3s; }
.story-steps i.on { background: var(--green); }
.story h2 { font: 700 19px/1.2 var(--display); letter-spacing: -0.01em; }
.story p { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); margin-top: 4px; }
.story-nav { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.story-nav .spacer { flex: 1; }
.story-nav .btn { margin: 0; }
.story-btn { background: var(--ink); color: #fff; }
.story-btn:hover { background: var(--green-dark); color: #fff; }

.plot-label { display: flex; flex-direction: column; align-items: center; border: 0; background: #fff; border-radius: 8px; padding: 2px 8px 3px; font: 600 11px/1.15 var(--ui); color: var(--ink-2); box-shadow: var(--shadow), inset 0 3px 0 var(--rc); cursor: pointer; }
.plot-label b { font: 700 12px/1.2 var(--display); color: var(--ink); }
/* ================= brand (from the logo: night green, radar gold, field lime) ================= */
:root { --night: #0c2620; --gold: #e9b234; --lime: #8fd16b; --rail-w: 60px; }
.brandchip { width: auto; gap: 10px; padding: 5px 16px 5px 5px; border-radius: 999px; text-decoration: none; color: inherit; }
.brandchip .logo { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(233, 178, 52, 0.55), 0 4px 10px -2px rgba(12, 38, 32, 0.45); transition: transform 0.4s var(--ease); }
.brandchip:hover .logo { transform: rotate(-12deg) scale(1.06); }
.wordmark { font: 800 22px/1 var(--display); letter-spacing: -0.035em; color: var(--night); }

/* ================= launcher rail ================= */
.dock { position: absolute; z-index: 8; left: var(--gap); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 18px;
  background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow); }
.dock-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 13px; color: var(--ink-2); cursor: pointer; transition: background 0.18s, color 0.18s, transform 0.18s; }
.dock-btn [data-lucide] { width: 20px; height: 20px; }
.dock-btn:hover { background: var(--surface-2); color: var(--ink); transform: translateX(2px); }
.dock-btn.open { background: var(--green-soft); color: var(--green-dark); }
.dock-btn .dot { position: absolute; left: -3px; top: 50%; width: 4px; height: 0; border-radius: 2px; background: var(--green); transform: translateY(-50%); transition: height 0.25s var(--ease); }
.dock-btn.open .dot { height: 18px; }
.dock-btn.min .dot { height: 6px; background: var(--muted); }
.dock-btn.ai { color: var(--night); }
.dock-btn.ai::before { content: ""; position: absolute; inset: 6px; border-radius: 10px; background: conic-gradient(from 0deg, var(--gold), var(--lime), var(--water), var(--gold)); opacity: 0.22; }
.dock-sep { height: 1px; background: var(--edge); margin: 4px 6px; }
.dock [data-tip]:hover::after { top: 50%; left: calc(100% + 12px); transform: translateY(-50%); }

/* ================= windows ================= */
.sections { display: none; }
.win { position: absolute; z-index: 20; display: flex; flex-direction: column; width: 372px; height: min(560px, calc(100vh - var(--tl-h) - 110px)); min-width: 300px; min-height: 180px; max-width: calc(100vw - 24px);
  border-radius: 18px; overflow: hidden; resize: both; background: var(--glass-strong); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5); box-shadow: var(--shadow); }
.win.focused { box-shadow: 0 0 0 1px rgba(31, 138, 76, 0.25), 0 2px 4px rgba(15, 40, 28, 0.05), 0 22px 48px -12px rgba(15, 40, 28, 0.38); }
.win-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 6px 0 14px; cursor: grab; touch-action: none; user-select: none; flex-shrink: 0; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.win.scrolled .win-head { border-bottom-color: var(--edge); }
.win.dragging .win-head { cursor: grabbing; }
.win.dragging { opacity: 0.92; }
.win-title { display: inline-flex; align-items: center; gap: 9px; font: 700 14.5px/1 var(--display); letter-spacing: -0.01em; color: var(--ink); }
.win-title [data-lucide] { color: var(--green); }
.win-ctl { display: inline-flex; gap: 2px; }
.wbtn { position: relative; width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; border-radius: 9px; cursor: pointer; color: var(--muted); transition: background 0.15s, color 0.15s; }
.wbtn:hover { background: var(--surface-2); color: var(--ink); }
.wbtn[data-act="close"]:hover { background: rgba(226, 83, 60, 0.12); color: var(--storm); }
.wbtn [data-lucide] { width: 15px; height: 15px; }
.win-body { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(15, 40, 28, 0.2) transparent; }
.win .tab-body { overflow: visible; padding: 4px 16px 20px; }

/* ================= workspace (teleport target) ================= */
.workspace { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: #f6f8f6; }
.ws-head { display: flex; align-items: center; gap: 16px; height: 68px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--edge); flex-shrink: 0; }
.ws-brand { display: inline-flex; align-items: center; gap: 10px; }
.ws-brand img { border-radius: 50%; box-shadow: 0 0 0 2px rgba(233, 178, 52, 0.55); }
.ws-nav { margin: 0 auto; }
.ws-nav button { height: 32px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; }
.ws-nav button [data-lucide] { width: 15px; height: 15px; }
#ws-back { margin: 0; }
.ws-body { flex: 1; overflow-y: auto; }
.ws-body .tab-body { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; column-width: 380px; column-gap: 32px; overflow: visible; }
.ws-body .tab-body > * { break-inside: avoid; }
.ws-body .tab-body .h:first-child { margin-top: 0; }
.ws-body .chart-box { height: 260px; }
.ws-body #tab-ai { column-width: auto; max-width: 860px; }
.ws-enter > .tab-body > * { animation: wsIn 0.5s var(--ease) both; }
.ws-enter > .tab-body > *:nth-child(2) { animation-delay: 40ms; }
.ws-enter > .tab-body > *:nth-child(3) { animation-delay: 80ms; }
.ws-enter > .tab-body > *:nth-child(4) { animation-delay: 120ms; }
.ws-enter > .tab-body > *:nth-child(n+5) { animation-delay: 160ms; }
@keyframes wsIn { from { opacity: 0; transform: translateY(14px); } }

/* ================= intro ================= */
.splash { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; align-content: center; gap: 22px; background: radial-gradient(120% 90% at 50% 45%, #134034 0%, var(--night) 60%, #071a15 100%); transition: opacity 0.6s var(--ease); }
.splash.out { opacity: 0; pointer-events: none; }
.splash-mark { position: relative; width: 148px; height: 148px; }
.splash-mark img { position: relative; z-index: 1; border-radius: 50%; box-shadow: 0 0 0 3px rgba(233, 178, 52, 0.5), 0 20px 50px rgba(0, 0, 0, 0.45); }
.splash .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--lime); opacity: 0; animation: radar 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite; }
.splash .ring:nth-child(2) { animation-delay: 0.8s; border-color: var(--gold); }
.splash .ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes radar { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(2.6); opacity: 0; } }
.splash-word { font: 800 44px/1 var(--display); letter-spacing: -0.04em; color: #fff; animation: wordIn 0.8s var(--ease) 0.15s both; }
@keyframes wordIn { from { opacity: 0; transform: translateY(10px); letter-spacing: 0.1em; } }
.fly-logo { position: fixed; z-index: 70; border-radius: 50%; pointer-events: none; }

/* ================= SakaSAR AI ================= */
.ai-ctx { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.ai-ctx span { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; background: var(--surface-2); border-radius: 99px; padding: 3px 9px; color: var(--ink-2); }
.ai-ctx [data-lucide] { width: 12px; height: 12px; }
.chat { display: grid; gap: 10px; }
.msg { max-width: 92%; font-size: 13.5px; line-height: 1.5; padding: 10px 12px; border-radius: 16px; animation: msgIn 0.35s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.msg.user { justify-self: end; background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.msg.bot { justify-self: start; background: #fff; box-shadow: 0 0 0 1px var(--edge); border-bottom-left-radius: 5px; }
.msg.bot .who { display: flex; align-items: center; gap: 7px; font: 700 12px var(--display); color: var(--night); margin-bottom: 4px; }
.msg.bot .who img { width: 18px; height: 18px; border-radius: 50%; }
.msg.bot ul { margin: 6px 0 0; padding-left: 18px; }
.msg.bot li { margin: 3px 0; }
.msg.bot .srcs { margin-top: 6px; }
.msg.typing { color: var(--muted); }
.msg.typing i { display: inline-block; width: 6px; height: 6px; margin: 0 1px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.msg.typing i:nth-child(2) { animation-delay: 0.15s; }
.msg.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 50% { opacity: 0.25; } }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.suggest button { border: 0; background: var(--green-soft); color: var(--green-dark); border-radius: 99px; padding: 6px 11px; font-size: 12.5px; font-weight: 500; cursor: pointer; text-align: left; transition: background 0.15s; }
.suggest button:hover { background: rgba(31, 138, 76, 0.18); }
.ask { display: flex; gap: 6px; position: sticky; bottom: 0; padding-top: 8px; background: linear-gradient(transparent, var(--glass-strong) 30%); }
.ask input { flex: 1; height: 38px; border: 0; border-radius: 12px; padding: 0 12px; background: var(--surface-2); outline: 0; color: var(--ink); }
.ask input:focus { background: #fff; box-shadow: 0 0 0 1.5px var(--green); }
.ask .btn { margin: 0; height: 38px; width: 38px; padding: 0; justify-content: center; }
.ai-note { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ================= v3: calmer surfaces, Inter, short timeline, new intro ================= */
:root {
  --ui: "Inter", system-ui, sans-serif;
  --brand: #17643a;
  --glass: rgba(255, 255, 255, 0.96);
  --glass-strong: #ffffff;
  --edge: rgba(15, 40, 28, 0.1);
  --shadow: 0 0 0 1px rgba(15, 40, 28, 0.08), 0 8px 24px -10px rgba(15, 40, 28, 0.28);
  --tl-h: 60px;
}
body { font-feature-settings: "cv11", "ss01"; letter-spacing: -0.005em; }
/* solid surfaces instead of heavy glass */
.brandchip, .toolbar, .dock, .win, .legend, .readout, .timeline, .story, .inspector, .panel { backdrop-filter: none; -webkit-backdrop-filter: none; }
.brandchip { border-radius: 14px; padding: 5px 14px 5px 5px; gap: 9px; }
.brandchip .logo { width: 36px; height: 36px; box-shadow: none; }
.brandchip:hover .logo { transform: rotate(-8deg); }
.wordmark { font: 800 21px/1 var(--ui); letter-spacing: -0.045em; color: var(--night); }
.toolbar { border-radius: 12px; padding: 4px; }
.tool { border-radius: 8px; height: 30px; }
.story-btn { background: var(--green-soft); color: var(--green-dark); }
.story-btn:hover { background: rgba(31, 138, 76, 0.18); color: var(--green-dark); }
.dock { border-radius: 14px; padding: 5px; }
.dock-btn { border-radius: 10px; width: 42px; height: 42px; }
.dock-btn.ai::before { display: none; }
.dock-btn.ai { color: var(--brand); }
.win { border-radius: 14px; }
.win-head { height: 42px; border-bottom: 1px solid var(--edge); }
.win-title { font: 600 14px/1 var(--ui); letter-spacing: -0.01em; }
.chip { border-radius: 8px; height: 28px; }
.suggest button { border-radius: 8px; background: var(--surface); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--edge); }
.suggest button:hover { background: var(--green-soft); color: var(--green-dark); box-shadow: inset 0 0 0 1px rgba(31, 138, 76, 0.3); }
.callout { background: var(--surface); color: var(--ink-2); box-shadow: inset 3px 0 0 var(--storm); border-radius: 8px; }
.field-opt { border-radius: 10px; }
.legend { border-radius: 12px; }
.readout { border-radius: 8px; }
.inspector, .story { border-radius: 14px; }
.msg { border-radius: 12px; }
.msg.bot .who img { width: 18px; height: 18px; }
.summary .big b, .metrics b, .tl-stats b, .score .num, .hitbox b, .facts2 b, .town-big, .tl-date b { font-family: var(--display); }
h2, h3, h4, .pilot-head h2, .plot-card h3, .story h2, .insp-head b { font-family: var(--ui); letter-spacing: -0.02em; }

/* ---------- short timeline: centred, one row ---------- */
.timeline { left: 50%; right: auto; transform: translateX(-50%); width: min(860px, calc(100% - 2 * (var(--rail-w) + var(--gap) * 2))); height: var(--tl-h);
  grid-template-columns: 38px 124px 1fr auto; gap: 12px; padding: 6px 12px 6px 8px; border-radius: 14px; }
.play { width: 38px; height: 38px; }
.play [data-lucide] { width: 16px; height: 16px; }
.play.on::after { inset: -4px; }
.tl-date b { font-size: 16px; }
.tl-date > span { font-size: 11px; min-height: 0; margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .seg.tiny { display: none; }
.scrub { height: 44px; }
.ticks { height: 8px; }
.ticks i { width: 5px; height: 5px; margin-left: -2.5px; top: 1px; box-shadow: 0 0 0 1.5px #fff; }
.bars { top: 9px; height: 22px; gap: 1.5px; }
.days { height: 11px; font-size: 9.5px; }
.head { top: 6px; bottom: 11px; }
.head::before { width: 9px; height: 9px; left: -3.5px; top: -3px; box-shadow: 0 0 0 2px #fff; }
.tl-stats { display: flex; align-items: center; gap: 0; }
.tl-stats div { padding: 0 10px; }
.tl-stats div:nth-child(2), .tl-stats div:nth-child(3) { display: none; }
.tl-stats b { font-size: 15px; }
.tl-stats span { font-size: 10.5px; white-space: nowrap; }
.tl-speed { height: 26px; min-width: 34px; border: 0; border-radius: 7px; background: var(--surface-2); font: 600 12px var(--ui); color: var(--ink-2); cursor: pointer; margin-left: 4px; }
.tl-speed:hover { background: rgba(15, 40, 28, 0.13); }
.legend { bottom: calc(var(--tl-h) + var(--gap) * 2 + 30px); }
.readout { bottom: calc(var(--tl-h) + var(--gap) * 2); }
.story { bottom: calc(var(--tl-h) + var(--gap) * 2 + 8px); }

/* ---------- intro ---------- */
.splash, .splash-mark, .splash-word { display: none; }
.intro { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: var(--brand); color: #fff; cursor: pointer; }
.intro-inner { display: grid; justify-items: center; gap: 14px; }
.intro-svg { width: 132px; height: 132px; overflow: visible; }
.intro-svg circle:first-child { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.2; }
.intro-svg .d { stroke-dasharray: 1; stroke-dashoffset: 1; animation: trace 0.9s cubic-bezier(0.6, 0, 0.2, 1) forwards; }
.intro-svg .d:nth-child(1), .intro-svg .d:nth-child(2) { animation-delay: 0.05s; }
.intro-svg .d:nth-child(3), .intro-svg .d:nth-child(4), .intro-svg .d:nth-child(5) { animation-delay: 0.18s; }
.intro-svg .d:nth-child(6) { animation-delay: 0.36s; }
.intro-svg .d:nth-child(7) { animation-delay: 0.46s; }
.intro-svg .d:nth-child(8) { animation-delay: 0.56s; }
.intro-svg .d:nth-child(9) { animation-delay: 0.66s; }
.intro-svg .d:nth-child(10) { animation-delay: 0.74s; }
.intro-svg .d:nth-child(11) { animation-delay: 0.82s; }
.intro-svg .d:nth-child(12) { animation-delay: 0.9s; }
.intro-svg g > circle { opacity: 0; animation: fadeIn 0.3s ease 1.1s forwards; }
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
.intro-word { font: 800 46px/1 var(--ui); letter-spacing: -0.05em; clip-path: inset(0 100% 0 0); animation: reveal 0.7s cubic-bezier(0.7, 0, 0.2, 1) 0.75s forwards; }
.intro-line { font: 500 14px/1.4 var(--ui); color: rgba(255, 255, 255, 0.72); opacity: 0; transform: translateY(6px); animation: lineIn 0.5s ease 1.25s forwards; }
@keyframes reveal { to { clip-path: inset(0 0 0 0); } }
@keyframes lineIn { to { opacity: 1; transform: none; } }
.intro-scan { position: fixed; z-index: 61; top: 0; bottom: 0; left: 0; width: 2px; background: #fff; box-shadow: 0 0 18px 4px rgba(255, 255, 255, 0.55), 0 0 60px 12px rgba(143, 209, 107, 0.35); opacity: 0; pointer-events: none; }
.fly-logo { display: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 1280px) {
  .timeline { grid-template-columns: 50px 160px 1fr 300px; }
  .tl-stats div:nth-child(4) { display: none; }
  .tl-stats { grid-template-columns: repeat(3, 1fr); }
  .tool span { display: none; }
  .tool { width: 32px; padding: 0; justify-content: center; }
}
@media (max-width: 760px) {
  .dock { top: auto; transform: none; bottom: var(--gap); left: var(--gap); right: var(--gap); flex-direction: row; justify-content: space-around; padding: 4px; border-radius: 16px; }
  .dock-sep { display: none; }
  .dock-btn { width: 40px; height: 40px; }
  .dock-btn .dot { left: 50%; top: auto; bottom: -2px; transform: translateX(-50%); width: 0; height: 3px !important; }
  .dock-btn.open .dot { width: 14px; }
  .dock [data-tip]:hover::after { display: none; }
  .timeline { bottom: calc(var(--gap) * 2 + 48px) !important; }
  .legend, .app.no-panel .legend { bottom: calc(var(--tl-h) + var(--gap) * 3 + 52px) !important; left: var(--gap) !important; }
  .maplibregl-ctrl-bottom-right { bottom: calc(var(--tl-h) + var(--gap) * 3 + 40px) !important; }
  .story { bottom: calc(var(--tl-h) + var(--gap) * 3 + 48px) !important; }
  .wordmark { font-size: 19px; }
  .ws-head { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .ws-nav { order: 3; width: 100%; overflow-x: auto; margin: 0; }
  .ws-nav button span { display: none; }
  #ws-back { margin-left: auto; height: 34px; }
  #ws-back span { display: none; }
  .ws-body .tab-body { padding: 16px 14px 40px; column-width: auto; }
  :root { --gap: 8px; --tl-h: 76px; --panel-w: calc(100vw - 16px); }
  .brandchip { width: auto; padding-right: 12px; }
  .brand p, .tb-sep, #btn-link, .toolbar .seg { display: none; }
  .panel { top: auto; height: 50vh; bottom: calc(var(--tl-h) + var(--gap) * 2); }
  .app.no-panel .panel { transform: translateY(calc(100% + 120px)); }
  .legend, .readout, .app.no-panel .legend { left: var(--gap); }
  .legend { width: 180px; bottom: calc(var(--tl-h) + var(--gap) * 2 + 4px); padding: 8px 10px; }
  .legend > div:not(:first-child), .readout { display: none; }
  .app:not(.no-panel) .legend { display: none; }
  .timeline { grid-template-columns: 40px 1fr; grid-template-rows: auto 1fr; gap: 2px 10px; padding: 8px 12px; border-radius: 16px; }
  .play { width: 40px; height: 40px; grid-row: 1 / 3; }
  .tl-date { display: flex; align-items: center; gap: 8px; }
  .tl-date b { font-size: 17px; }
  .tl-date > span, .tl-stats, .ticks, .days { display: none; }
  .scrub { height: 30px; }
  .bars { top: 2px; height: 26px; }
  .head { top: 0; bottom: 0; }
  .story, .app:not(.no-panel) .story { left: var(--gap); right: var(--gap); width: auto; transform: none; bottom: calc(var(--tl-h) + var(--gap) * 2); }
  .inspector { left: var(--gap); right: var(--gap); width: auto; top: calc(var(--gap) + 50px); max-height: 55%; }
  .maplibregl-ctrl-top-right { top: calc(var(--gap) + 50px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* v3 phone overrides (last so they win) */
@media (max-width: 760px) {
  :root { --tl-h: 52px; }
  .timeline { left: var(--gap); right: var(--gap); transform: none; width: auto; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; gap: 0 10px; height: auto; padding: 6px 10px; }
  .play { width: 34px; height: 34px; grid-row: 1 / 3; }
  .tl-date b { font-size: 14px; }
  .scrub { height: 24px; }
  .bars { top: 2px; height: 18px; }
  .tl-speed { display: none; }
  .intro-word { font-size: 38px; }
  .intro-line { font-size: 13px; padding: 0 24px; text-align: center; }
}

/* ================= brand: original logo on a green chip, white wordmark ================= */
.brandchip { background: var(--brand); box-shadow: 0 0 0 1px rgba(12, 38, 32, 0.25), 0 8px 22px -10px rgba(12, 38, 32, 0.6); }
.brandchip .logo { width: 38px; height: 38px; }
.brandchip .wordmark { color: #fff; }
.ws-brand { background: var(--brand); border-radius: 12px; padding: 4px 12px 4px 4px; }
.ws-brand img { box-shadow: none; }
.ws-brand .wordmark { color: #fff; font-size: 19px; }
.intro { background: radial-gradient(70% 70% at 50% 42%, #134a36 0%, var(--night) 70%); }
.intro-logo { width: 150px; height: 150px; border-radius: 50%; opacity: 0; transform: scale(0.86); animation: logoIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s forwards; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45)); }
@keyframes logoIn { to { opacity: 1; transform: none; } }

/* ================= final layout pass ================= */
/* brand: white chip, green wordmark, original logo */
.brandchip { background: #fff; box-shadow: var(--shadow); }
.brandchip .wordmark { color: var(--brand); }
/* rail on the right */
.dock { left: auto; right: var(--gap); }
.dock-btn .dot { left: auto; right: -3px; }
.dock-btn:hover { transform: translateX(-2px); }
.dock [data-tip]:hover::after { left: auto; right: calc(100% + 12px); }
/* legend + readout bottom-left, clear of the centred timeline */
.legend, .app.no-panel .legend { left: var(--gap); bottom: calc(var(--gap) + 32px); width: 228px; max-height: calc(100vh - 220px); overflow-y: auto; }
.readout, .app.no-panel .readout { left: var(--gap); bottom: var(--gap); max-width: calc(50vw - 460px + 300px); }
/* map controls, scale and info: bottom-right corner */
.maplibregl-ctrl-top-right { top: calc(var(--gap) + 54px); right: var(--gap); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--gap) - 10px); right: calc(var(--gap) - 10px); display: flex; flex-direction: column; align-items: flex-end; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { margin-bottom: 6px; }
.inspector { right: calc(var(--rail-w) + var(--gap) * 2); }
.timeline { width: min(820px, calc(100% - 2 * (240px + var(--gap) * 2))); }

/* intro on white */
.intro { background: #fff; }
.intro-word { color: var(--brand); }
.intro-line { color: var(--muted); }
.intro-logo { filter: drop-shadow(0 14px 28px rgba(12, 38, 32, 0.25)); }
.intro-scan { background: var(--brand); box-shadow: 0 0 16px 3px rgba(23, 100, 58, 0.45), 0 0 50px 10px rgba(143, 209, 107, 0.35); }

/* full-screen workspace: sidebar + titled page + card */
.workspace { display: grid; grid-template-columns: 248px 1fr; background: #f4f6f4; }
.workspace[hidden] { display: none !important; }
.ws-head { display: none; }
.ws-side { display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; background: #fff; border-right: 1px solid var(--edge); min-height: 0; }
.ws-brand { background: none; padding: 2px 4px; gap: 10px; }
.ws-brand .wordmark { color: var(--brand); font-size: 20px; }
.ws-nav { display: grid; gap: 2px; margin: 0; background: none; padding: 0; border-radius: 0; }
.ws-nav button { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px; border: 0; background: none; border-radius: 9px; font: 500 13.5px var(--ui); color: var(--ink-2); cursor: pointer; text-align: left; transition: background 0.15s, color 0.15s; }
.ws-nav button [data-lucide] { width: 17px; height: 17px; color: var(--muted); }
.ws-nav button:hover { background: var(--surface); color: var(--ink); }
.ws-nav button[aria-current="page"] { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }
.ws-nav button[aria-current="page"] [data-lucide] { color: var(--green); }
#ws-back { margin: auto 0 0; width: 100%; justify-content: center; height: 40px; }
.ws-main { overflow-y: auto; min-width: 0; }
.ws-title { max-width: 1180px; margin: 0 auto; padding: 32px 36px 18px; }
.ws-title h1 { font: 700 26px/1.15 var(--ui); letter-spacing: -0.03em; color: var(--ink); }
.ws-title p { font-size: 14px; color: var(--muted); margin-top: 6px; max-width: 70ch; }
.ws-body { max-width: 1180px; margin: 0 auto; padding: 0 36px 56px; overflow: visible; }
.ws-body .tab-body { max-width: none; margin: 0; padding: 26px 28px 30px; background: #fff; border-radius: 16px; box-shadow: 0 0 0 1px var(--edge); column-width: 340px; column-gap: 36px; column-rule: 1px solid var(--edge); }
.ws-body .tab-body > * { break-inside: avoid; }
.ws-body .tab-body .h:first-child, .ws-body .tab-body > :first-child { margin-top: 0; }
.ws-body #tab-ai { column-width: auto; column-rule: none; max-width: 820px; }
.ws-body #tab-ai .ask { background: linear-gradient(transparent, #fff 30%); }
.ws-body .chart-box { height: 260px; }
.ws-body .plot-card { box-shadow: 0 0 0 1px var(--edge); }

@media (max-width: 760px) {
  .dock { left: var(--gap); right: var(--gap); }
  .dock-btn .dot { right: auto; left: 50%; }
  .dock-btn:hover { transform: none; }
  .timeline { width: auto; }
  .maplibregl-ctrl-bottom-right { bottom: calc(var(--tl-h) + var(--gap) * 3 + 44px) !important; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ws-side { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--edge); overflow-x: auto; }
  .ws-brand .wordmark, #ws-back span { display: none; }
  .ws-nav { display: flex; gap: 2px; }
  .ws-nav button { width: auto; height: 36px; padding: 0 10px; }
  .ws-nav button span { display: none; }
  #ws-back { margin: 0 0 0 auto; width: 40px; height: 36px; padding: 0; flex-shrink: 0; }
  .ws-title { padding: 18px 16px 10px; }
  .ws-title h1 { font-size: 21px; }
  .ws-body { padding: 0 10px 40px; }
  .ws-body .tab-body { padding: 16px; column-width: auto; column-rule: none; }
}
.dock { top: calc(50% - 34px); }
@media (max-width: 760px) { .dock { top: auto; } }
/* legend fold + town hover card */
.legend-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none; padding: 0; font: 600 11.5px var(--ui); color: var(--muted); cursor: pointer; }
.legend-toggle [data-lucide] { width: 14px; height: 14px; }
.town-pop .maplibregl-popup-content { font: 400 12px/1.45 var(--ui); padding: 8px 10px; border-radius: 10px; }
.town-pop .maplibregl-popup-content small { color: var(--muted); }
.town-pop .maplibregl-popup-tip { display: none; }
