/* ============================================================================
   Dengue Simulation For Surveillance — styles
   ========================================================================== */
:root {
  color-scheme: light;
  --page: #eef2f4;
  --surface-1: #fcfcfb;
  --surface-2: #f3f4f2;
  --border: rgba(11, 11, 11, 0.10);
  --text-1: #0b0b0b;
  --text-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #184f95;
  --accent-2: #2a78d6;
  --accent-ink: #ffffff;
  --warn-bg: #fff4d6;
  --warn-ink: #5c4200;
  --warn-line: #f0c75a;
  /* case classes (validated; shapes provide secondary encoding) */
  --c-susp: #7a6ad8;
  --c-prob: #d99400;
  --c-conf: #d63c3b;
  /* Rt */
  --rt: #2a78d6;
  --rt-band: rgba(42, 120, 214, 0.20);
  --model: #6f6d68;
  /* scenarios: categorical slots 1–4 */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  /* status */
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --font-h: 'Kanit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-b: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d1114; --surface-1: #1a1a19; --surface-2: #222220; --border: rgba(255,255,255,0.10);
    --text-1: #ffffff; --text-2: #c3c2b7; --muted: #9a988f; --grid: #2c2c2a; --axis: #383835;
    --accent: #3987e5; --accent-2: #3987e5; --accent-ink: #ffffff;
    --warn-bg: #3a2f10; --warn-ink: #ffe3a3; --warn-line: #8a6a15;
    --c-susp: #9085e9; --c-prob: #c98500; --c-conf: #e34948;
    --rt: #3987e5; --rt-band: rgba(57, 135, 229, 0.25); --model: #a8a69c;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d1114; --surface-1: #1a1a19; --surface-2: #222220; --border: rgba(255,255,255,0.10);
  --text-1: #ffffff; --text-2: #c3c2b7; --muted: #9a988f; --grid: #2c2c2a; --axis: #383835;
  --accent: #3987e5; --accent-2: #3987e5; --accent-ink: #ffffff;
  --warn-bg: #3a2f10; --warn-ink: #ffe3a3; --warn-line: #8a6a15;
  --c-susp: #9085e9; --c-prob: #c98500; --c-conf: #e34948;
  --rt: #3987e5; --rt-band: rgba(57, 135, 229, 0.25); --model: #a8a69c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--text-1);
  font: 14px/1.5 var(--font-b);
  display: flex; flex-direction: column; min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-h); font-weight: 500; margin: 0; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 36px; height: 36px; flex: none; }
.logo rect { fill: var(--accent); }
.logo path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; }
.logo circle { fill: #e34948; }
.brand h1 { font-size: 18px; line-height: 1.2; }
.brand p { margin: 0; font-size: 13px; color: var(--text-2); }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.chip-sim { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); font-weight: 600; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-1); cursor: pointer; display: inline-grid; place-items: center; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); }
.disclaimer {
  display: flex; gap: 10px; align-items: flex-start; padding: 7px 16px; font-size: 13px;
  background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--warn-line);
}
.warn-ico { font-size: 15px; line-height: 1.3; }

/* ---------------------------------------------------------------- layout */
.layout {
  flex: 1; display: grid; gap: 10px; padding: 10px;
  grid-template-columns: 300px minmax(0, 1fr) 400px;
  height: calc(100vh - 100px); min-height: 620px;
}
.panel {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.tabs { display: flex; border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; }
.tabs button {
  flex: 1; padding: 10px 6px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  color: var(--text-2); border-bottom: 2px solid transparent; font-family: var(--font-h); font-size: 14px;
}
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabpane { padding: 12px 14px 18px; overflow-y: auto; flex: 1; min-height: 0; }

/* ---------------------------------------------------------------- controls */
.ctl { margin-bottom: 12px; }
.ctl label { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; color: var(--text-2); margin-bottom: 3px; }
.ctl output { font-weight: 600; color: var(--text-1); font-variant-numeric: tabular-nums; }
.ctl.two { display: flex; gap: 10px; align-items: flex-end; }
.ctl.two > div { flex: 1; min-width: 0; }
.ctl.two > .grow { flex: 2; }
.ctl.two > .end { flex: none; }
input[type="range"] { width: 100%; accent-color: var(--accent-2); }
input[type="number"], input[type="date"], input[type="text"], select {
  width: 100%; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2);
}
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.hint.top { margin: 0 0 12px; }
.btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.measure { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px 2px; margin-bottom: 10px; background: var(--surface-2); }
.measure.off .ctl, .measure.off .switch.small { opacity: .45; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; cursor: pointer; }
.switch.small { font-weight: 400; font-size: 13px; }
.switch input { width: 16px; height: 16px; accent-color: var(--accent-2); }
h3.sub { font-size: 14px; margin: 14px 0 6px; color: var(--text-2); }
.env-now { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 4px; }
.env-now div { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.env-now b { font-size: 18px; font-family: var(--font-h); font-weight: 500; }
.env-now span { display: block; font-size: 12px; color: var(--muted); }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset-grid .btn { white-space: normal; text-align: left; font-size: 12.5px; line-height: 1.3; padding: 7px 9px; }
.scen-list { list-style: none; padding: 0; margin: 0 0 12px; }
.scen-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.scen-list li .nm { flex: 1; min-width: 0; }
.scen-list li .nm small { display: block; color: var(--muted); font-size: 11.5px; }
.scen-list .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.scen-list button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; }

/* ---------------------------------------------------------------- stage */
.stage {
  position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  box-shadow: var(--shadow); background: var(--surface-1); min-height: 0;
}
.scene { position: absolute; inset: 0 0 58px 0; }
.scene canvas { display: block; }
.label-layer { position: absolute; inset: 0; }
.overlay { position: absolute; z-index: 3; }
.overlay.tl { top: 10px; left: 10px; }
.overlay.tr { top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.overlay.bl { bottom: 68px; left: 10px; }
.overlay.br { bottom: 68px; right: 10px; }
.layer-box, .seg, .legend, .stage-note, .view-btns {
  background: color-mix(in srgb, var(--surface-1) 90%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow);
}
.layer-box { font-size: 13px; max-width: 250px; }
.layer-box summary { padding: 6px 10px; cursor: pointer; font-family: var(--font-h); }
.layer-list { padding: 0 10px 8px; display: grid; gap: 2px; max-height: 46vh; overflow: auto; }
.layer-list label { display: flex; gap: 7px; align-items: center; cursor: pointer; white-space: nowrap; }
.layer-list input { accent-color: var(--accent-2); }
.layer-list .grp { font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: none; }
.seg { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 13px; }
.seg label { color: var(--text-2); white-space: nowrap; }
.seg select { width: auto; padding: 3px 6px; }
.view-btns { display: flex; gap: 4px; padding: 4px; }
.legend { padding: 8px 10px; font-size: 12px; max-width: 290px; }
.legend summary { cursor: pointer; font: 500 12.5px var(--font-h); }
.legend[open] summary { margin-bottom: 4px; }
.legend h4 { margin: 0 0 4px; font: 500 12.5px var(--font-h); }
.legend .row { display: flex; align-items: center; gap: 6px; line-height: 1.6; }
.legend .ramp { height: 8px; border-radius: 4px; margin: 2px 0; }
.legend .ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.legend .sym { width: 13px; height: 13px; flex: none; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.stage-note { padding: 5px 10px; font-size: 11.5px; color: var(--text-2); max-width: 340px; }
.cell-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 200px; max-width: 280px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 12.5px;
}
.cell-tip h4 { margin: 0 0 2px; font: 500 13.5px var(--font-h); }
.kv { display: grid; grid-template-columns: auto auto; gap: 1px 12px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.lbl { font-family: var(--font-b); pointer-events: none; white-space: nowrap; }
.lbl-village { font-size: 13px; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--surface-1) 85%, transparent); border: 1px solid var(--border); color: var(--text-1); }
.lbl-village b { font-family: var(--font-h); font-weight: 500; }
.lbl-place { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: color-mix(in srgb, var(--surface-1) 75%, transparent); color: var(--text-2); }
.lbl-rt { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); border: 1px solid var(--border); color: var(--text-1); }
.lbl-rt span { font-weight: 400; color: var(--muted); }
.busy { position: absolute; z-index: 6; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.busy[hidden] { display: none; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--grid); border-top-color: var(--accent-2); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* timeline */
.timeline {
  position: absolute; left: 0; right: 0; bottom: 0; height: 58px; z-index: 4;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--surface-1); border-top: 1px solid var(--border);
}
.timeline .play { background: var(--accent); color: #fff; border-color: transparent; }
.tl-track { flex: 1; position: relative; min-width: 80px; }
.tl-track input { position: relative; z-index: 2; }
.tl-marks { position: absolute; left: 7px; right: 7px; top: -6px; height: 6px; pointer-events: none; }
.tl-marks i { position: absolute; top: 0; width: 2px; height: 6px; background: var(--axis); }
.tl-marks i.peak { background: var(--critical); }
.tl-date { display: flex; flex-direction: column; line-height: 1.15; min-width: 104px; }
.tl-date b { font-family: var(--font-h); font-weight: 500; font-size: 15px; }
.tl-date span { font-size: 11.5px; color: var(--muted); }
.timeline select { width: auto; }

/* ---------------------------------------------------------------- indicators */
.asof { font-size: 13px; margin-bottom: 8px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.kpi { background: var(--surface-2); border-radius: 9px; padding: 8px 10px; min-width: 0; }
.kpi .k { font-size: 12px; color: var(--text-2); }
.kpi .v { font: 500 22px/1.2 var(--font-h); }
.kpi .v small { font-size: 12px; color: var(--muted); font-family: var(--font-b); font-weight: 400; }
.kpi .d { font-size: 11.5px; color: var(--muted); }
.rt-card { border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--border); }
.rt-card .top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rt-card .big { font: 500 28px/1 var(--font-h); }
.rt-card .cri { color: var(--text-2); font-size: 13px; }
.rt-card .status { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.status.up { background: color-mix(in srgb, var(--critical) 16%, transparent); color: var(--text-1); }
.status.up .ic { color: var(--critical); }
.status.down { background: color-mix(in srgb, var(--good) 16%, transparent); }
.status.down .ic { color: var(--good); }
.status.flat { background: color-mix(in srgb, var(--warning) 22%, transparent); }
.status.flat .ic { color: #b07900; }
.status.na { background: var(--surface-2); color: var(--muted); }
.rt-card .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.rt-card .warn { font-size: 12px; margin-top: 6px; padding: 5px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-ink); }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 10px 6px; margin-bottom: 10px; }
.card h3 { font-size: 14.5px; margin-bottom: 4px; }
.card h3 .muted { font-family: var(--font-b); font-size: 12px; font-weight: 400; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.legend-row span { display: inline-flex; align-items: center; gap: 5px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.lg.ln-rt { height: 3px; background: var(--rt); }
.lg.band-rt { background: var(--rt-band); }
.lg.ln-model { height: 0; border-top: 2px dashed var(--model); border-radius: 0; }
.lg.c-conf, .sw.c-conf { background: var(--c-conf); }
.lg.c-prob, .sw.c-prob { background: var(--c-prob); }
.lg.c-susp, .sw.c-susp { background: var(--c-susp); }
.seg-mini { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg-mini button { border: 0; background: none; padding: 2px 9px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.seg-mini button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--axis); padding: 4px 6px; white-space: nowrap; }
.tbl td { padding: 5px 6px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .na { color: var(--muted); font-size: 11.5px; }
.badge { display: inline-flex; gap: 4px; align-items: center; padding: 0 7px; border-radius: 999px; font-size: 11.5px; white-space: nowrap; }
.badge i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cell-detail { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.cell-detail h4 { margin: 0 0 4px; font: 500 14px var(--font-h); }
.cell-detail .reasons { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.empty { text-align: center; padding: 30px 10px; }
.prose h3 { font-size: 15px; margin: 16px 0 6px; }
.prose h3:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 13.5px; color: var(--text-1); }
.prose ul, .prose ol { padding-left: 20px; margin: 4px 0; }
.prose ul.cols { columns: 2; column-gap: 18px; }
.prose .callout { background: var(--warn-bg); color: var(--warn-ink); padding: 8px 10px; border-radius: 8px; }
.status-list { list-style: none; padding: 0 !important; }
.status-list li { display: flex; gap: 8px; align-items: baseline; }
.st { font-size: 12px; }
.st-up { color: var(--critical); } .st-down { color: var(--good); } .st-flat { color: #b07900; }
.roadmap li { margin-bottom: 4px; }
.roadmap li.done::marker { color: var(--good); }
.refs li { font-size: 12.5px !important; color: var(--text-2) !important; }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; }
svg.viz { display: block; overflow: visible; font-family: var(--font-b); }
.viz .grid { stroke: var(--grid); stroke-width: 1; }
.viz .baseline { stroke: var(--axis); stroke-width: 1; }
.viz .tick { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.viz .tick.strong { fill: var(--text-2); font-weight: 600; }
.viz .dlabel { fill: var(--text-2); font-size: 11px; }
.viz .c-susp { fill: var(--c-susp); } .viz .c-prob { fill: var(--c-prob); } .viz .c-conf { fill: var(--c-conf); }
.viz .prelim { fill: var(--surface-2); stroke: var(--axis); stroke-dasharray: 3 3; }
.viz .prelim-lbl { fill: var(--muted); font-size: 10px; }
.viz .today { stroke: var(--text-1); stroke-width: 1.2; stroke-dasharray: 2 3; }
.viz .cross { stroke: var(--text-2); stroke-width: 1; }
.viz .ref1 { stroke: var(--text-2); stroke-width: 1.2; }
.viz .near1 { fill: var(--grid); opacity: .7; }
.viz .cri { fill: var(--rt-band); }
.viz .rt-line { fill: none; stroke: var(--rt); stroke-width: 2; stroke-linejoin: round; }
.viz .rt-line.dashed { stroke-dasharray: 4 3; }
.viz .rt-dot { fill: var(--rt); stroke: var(--surface-1); stroke-width: 2; }
.viz .model-line { fill: none; stroke: var(--model); stroke-width: 1.5; stroke-dasharray: 5 4; }
.viz .ln-1 { fill: none; stroke: var(--s1); stroke-width: 2; }
.viz .ln-2 { fill: none; stroke: var(--s2); stroke-width: 2; }
.viz .ln-3 { fill: none; stroke: var(--s3); stroke-width: 2; }
.viz rect.ln-1 { fill: var(--s1); stroke: none; }
.viz .future { opacity: .35; }
.viz .band { stroke: none; opacity: .16; }
.viz .band.s1 { fill: var(--s1); } .viz .band.s2 { fill: var(--s2); } .viz .band.s3 { fill: var(--s3); } .viz .band.s4 { fill: var(--s4); }
.viz .sline { fill: none; stroke-width: 2; }
.viz .sline.s1 { stroke: var(--s1); } .viz .sline.s2 { stroke: var(--s2); } .viz .sline.s3 { stroke: var(--s3); } .viz .sline.s4 { stroke: var(--s4); }
.sw.s1, .lg.s1 { background: var(--s1); } .sw.s2, .lg.s2 { background: var(--s2); } .sw.s3, .lg.s3 { background: var(--s3); } .sw.s4, .lg.s4 { background: var(--s4); }
.sw.ln-rt { background: var(--rt); height: 3px; } .sw.ln-model { border-top: 2px dashed var(--model); height: 0; }
.viz-tip {
  position: fixed; z-index: 50; pointer-events: none; display: none; min-width: 170px;
  background: var(--surface-1); color: var(--text-1); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 7px 10px; font-size: 12.5px;
}
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.tip-row.tot { border-top: 1px solid var(--grid); margin-top: 3px; padding-top: 3px; }
.viz-tip .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }

/* ---------------------------------------------------------------- dialog */
.intro { max-width: 560px; border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; background: var(--surface-1); color: var(--text-1); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.intro::backdrop { background: rgba(10, 14, 18, .55); }
.intro h2 { font-size: 20px; margin-bottom: 8px; }
.intro ul { padding-left: 20px; }
.intro .end { display: flex; justify-content: flex-end; margin-top: 10px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: auto auto; height: auto; min-height: 0; }
  .panel.left { grid-row: 1; height: calc(100vh - 120px); min-height: 560px; }
  .stage { grid-row: 1; height: calc(100vh - 120px); min-height: 560px; }
  .panel.right { grid-column: 1 / -1; }
  .panel.right .tabpane { max-height: none; }
  .panel.right [data-pane="overview"] { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: start; }
  .panel.right [data-pane="overview"][hidden] { display: none; }
  .panel.right [data-pane="overview"] .asof { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .layout { display: flex; flex-direction: column; padding: 8px; height: auto; }
  .stage { order: 1; height: 68vh; min-height: 420px; }
  .panel.right { order: 2; }
  .panel.left { order: 3; height: auto; min-height: 0; }
  .panel.right [data-pane="overview"] { display: block; }
  .brand p, #phaseChip, .stage-note { display: none; }
  .brand h1 { font-size: 15px; }
  .disclaimer { padding: 6px 16px; font-size: 12px; }
  .legend { max-width: 200px; font-size: 11px; }
  .overlay.tr .seg:nth-child(2) { display: none; }
  .tl-date { min-width: 80px; }
  #btnShot { display: none; }
  .overlay.tr { max-width: 60%; }
  #speed { display: none; }
  .prose ul.cols { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
