/* Valley Under Pressure — light design matching the NISAR Vision site (web/style.css palette, Inter). */
:root {
  --bg: #f3f5f8; --panel: #ffffff; --line: #dfe4ec; --line2: #eef1f5;
  --text: #1a1f29; --mut: #4a5568; --dim: #6b7687;
  --acc: #0b3d91; --acc-soft: #e8eef8; --acc-mid: #c9d6ea;
  --hot: #c8321f; --ok: #1f7a35; --warn: #a86b00;
  --water: #2f7fd1; --water-deep: #0b3d91;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --ease: cubic-bezier(.22, .9, .3, 1);
  --top: 56px; --panel-w: 340px; --dock-h: 190px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font-family: inherit; }
.mono { font-family: var(--mono); }
.color-perm { color: var(--hot) !important; } .color-ok { color: var(--ok) !important; } .color-warn { color: var(--warn) !important; } .color-elast { color: var(--water) !important; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.ring { background: transparent; border: 2px solid #e69f00; }
:focus-visible { outline: 3px solid #9cc3ff; outline-offset: 2px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px/1 var(--font); padding: 5px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--mut); white-space: nowrap; }
.pill.provisional { background: #fff6dd; border-color: #f0d68a; color: #7a5200; }
.pill.wy-wet { background: #e7f4ec; border-color: #b9dcc5; color: var(--ok); }
.pill.wy-above { background: var(--acc-soft); border-color: var(--acc-mid); color: var(--acc); }
.pill.wy-below { background: #eef3f9; border-color: #d3dfee; color: #2c4f80; }
.pill.wy-dry { background: #fbf1e2; border-color: #ecd2a8; color: #8a4b00; }
.pill.wy-critical { background: #fbe9e6; border-color: #f0c2ba; color: var(--hot); }
.pill.illustrative { background: #eef0f3; border-color: #d5dae2; color: #4a5568; font-size: 10.5px; padding: 4px 8px; }

/* ---------- segmented control (tube with a sliding bar) ---------- */
.seg { position: relative; display: inline-flex; padding: 3px; gap: 2px; background: #e9edf3; border-radius: 999px; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .08); }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 999px; background: var(--acc); box-shadow: 0 2px 8px rgba(11, 61, 145, .3); transition: transform .38s var(--ease), width .38s var(--ease), opacity .2s; pointer-events: none; }
.seg.none .seg-thumb { opacity: 0; }
.seg-btn { position: relative; z-index: 1; border: 0; background: none; color: var(--mut); font: 600 12.5px/1 var(--font); padding: 7px 13px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: color .3s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { color: #fff; }
.seg-wide { display: flex; width: 100%; } .seg-wide .seg-btn { flex: 1; }

/* ---------- top bar ---------- */
.app-shell { height: 100vh; display: flex; flex-direction: column; }
.topbar { height: var(--top); flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; background: #fff; border-bottom: 1px solid var(--line); z-index: 10; }
.brand-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { display: inline-flex; align-items: center; gap: 8px; line-height: 1; text-decoration: none; }
.brand-logo img { display: block; height: 34px; width: 34px; }
.brand-logo .logo-word { font: 300 1.08rem/1 Montserrat, system-ui, sans-serif; color: #001429; letter-spacing: -.01em; white-space: nowrap; }
.brand-logo .logo-word b { font-weight: 800; }
.brand-logo:hover .logo-word { color: #0b3d91; }
.brand-title { margin: 0 6px 0 0; font-size: 16px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; color: var(--acc); transition: background .2s, border-color .2s; flex: none; }
.icon-btn:hover { background: var(--acc-soft); border-color: var(--acc-mid); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); grid-template-rows: minmax(0, 1fr) var(--dock-h); gap: 12px; padding: 12px; }
.map-stage { grid-column: 1; grid-row: 1; position: relative; border-radius: var(--r); overflow: hidden; background: #0a0f16; box-shadow: var(--shadow); }
#map { position: absolute; inset: 0; }
.dock { grid-column: 1; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; }
.control-panel { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-right: 2px; }

.dock-card, .panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 11px 14px; min-height: 0; }
.dock-card { display: flex; flex-direction: column; }
.control-panel > * { flex-shrink: 0; }
@media (max-height: 820px) { :root { --dock-h: 140px; } .levers { min-height: 250px; } .vs-track { min-height: 120px; } #stratCanvas { height: 110px; } .event-list { max-height: 110px; } .card-hint { display: none; } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-title { margin: 0; font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-hint { font-size: 11.5px; color: var(--dim); white-space: nowrap; }

/* ---------- map overlays ---------- */
.fx-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.map-stage.tremor { animation: tremor .24s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes tremor { 0%, 100% { transform: none; } 20% { transform: translate(-2px, 1px); } 45% { transform: translate(2px, -1px); } 70% { transform: translate(-1px, 1px); } }
.crack-line { fill: none; stroke: var(--hot); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(200, 50, 31, .8)); stroke-dasharray: 220; stroke-dashoffset: 220; animation: crack .9s var(--ease) forwards; }
@keyframes crack { 75% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }

.glass { background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .7); box-shadow: 0 6px 24px rgba(0, 0, 0, .22); }
.layer-switch { position: absolute; z-index: 5; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 5px; }
.layer-btn { text-align: left; border: 1px solid rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); color: var(--text); font: 600 12px/1 var(--font); padding: 7px 12px; border-radius: 999px; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); transition: background .25s, color .25s, transform .2s; }
.layer-btn:hover { transform: translateX(2px); }
.layer-btn.active { background: var(--acc); color: #fff; border-color: var(--acc); }
.seg-map { position: absolute; z-index: 5; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.map-legend { position: absolute; z-index: 5; left: 12px; bottom: 28px; display: flex; flex-direction: column; gap: 5px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); box-shadow: 0 6px 24px rgba(0, 0, 0, .22); font-size: 11.5px; color: var(--mut); }
.map-legend strong { color: var(--text); font-size: 12px; }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.map-legend .dot { width: 8px; height: 8px; }
.map-legend span[hidden] { display: none; }
.date-stamp { position: absolute; z-index: 5; right: 18px; bottom: 44px; text-align: right; pointer-events: none; color: #ffb547; text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .55); font-family: var(--mono); }
.date-stamp span { display: block; font-size: 20px; font-weight: 600; letter-spacing: .08em; line-height: 1; }
.date-stamp small { display: block; margin-top: 5px; font-size: 11px; letter-spacing: .04em; color: #ffe3b0; }
.maplibregl-ctrl-group { border-radius: 10px !important; overflow: hidden; }
.maplibregl-ctrl-top-right { top: 6px; right: 6px; }

/* ---------- chart + readout ---------- */
.timeline-canvas-wrap { position: relative; flex: 1; min-height: 0; cursor: grab; touch-action: pan-y; }
.timeline-canvas-wrap.dragging { cursor: grabbing; }
.chart-key { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--mut); white-space: nowrap; }
.chart-key i { width: 14px; height: 3px; border-radius: 2px; margin-left: 8px; }
.chart-key i:first-child { margin-left: 0; }
.chart-key i.dash { background: repeating-linear-gradient(90deg, #a86b00 0 5px, transparent 5px 8px); }
.readout { overflow: hidden; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex: 1; min-height: 0; }
.kpi { display: flex; flex-direction: column; justify-content: center; gap: 2px; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 12px; min-width: 0; }
.kpi-label { font-size: 11.5px; font-weight: 600; color: var(--mut); }
.kpi-value { font: 600 20px/1.15 var(--mono); color: var(--text); letter-spacing: -.02em; white-space: nowrap; }
.kpi-sub { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- vertical sliders ---------- */
.levers { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 280px; }
.vsliders { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-height: 0; }
.vs { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; }
.vs-val { font: 600 17px/1 var(--mono); color: var(--text); letter-spacing: -.02em; }
.vs-track { position: relative; flex: 1; width: 44px; min-height: 140px; border-radius: 12px; background: #edf1f6; box-shadow: inset 0 2px 6px rgba(16, 24, 40, .12); overflow: hidden; cursor: ns-resize; touch-action: none; }
.vs-track:focus-visible { outline: 3px solid #9cc3ff; outline-offset: 3px; }
.vs-water { position: absolute; inset: 0; width: 100%; height: 100%; }
.vs-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; }
.vs[data-kind="canal"] .vs-fill { background: linear-gradient(180deg, #7fb4e6, #4a8fd4); }
.vs[data-kind="land"] .vs-fill { background: linear-gradient(180deg, #c9a97a, #a8834f); }
.vs-cap { position: absolute; left: 0; right: 0; top: 0; height: 0; background: repeating-linear-gradient(135deg, #dde2ea 0 6px, #c3cad6 6px 12px); }
.vs-handle { position: absolute; left: 5px; right: 5px; height: 5px; margin-top: -2.5px; border-radius: 3px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); pointer-events: none; }
.vs-label { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.25; color: var(--mut); cursor: default; }

/* ---------- underground + events ---------- */
#stratCanvas { width: 100%; height: 130px; display: block; border-radius: 8px; }
.strat-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 11.5px; color: var(--mut); }
.strat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.events { flex: 0 0 auto; }
.event-list { max-height: 170px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.event-item { font-size: 12px; color: var(--mut); padding: 7px 10px; border-radius: 8px; background: var(--bg); border-left: 3px solid var(--acc); }
.event-item.warn { border-left-color: #e69f00; background: #fdf7ec; }
.event-item.danger { border-left-color: var(--hot); background: #fdf1ef; }
.event-title { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.event-src { display: none; }

/* ---------- buttons ---------- */
.turn-actions { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 6px; padding-top: 2px; background: var(--bg); }
.btn-primary { border: 0; background: var(--acc); color: #fff; font: 600 14px/1 var(--font); padding: 12px 16px; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 8px rgba(11, 61, 145, .28); transition: transform .15s, filter .2s, box-shadow .2s; }
.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 6px 20px rgba(11, 61, 145, .35); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #9aa6b8; box-shadow: none; cursor: default; }
.btn-lg { font-size: 13px; padding: 10px 16px; }
.turn-secondary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.btn-quiet { border: 1px solid var(--line); background: #fff; color: var(--text); font: 600 13px/1 var(--font); padding: 9px 14px; border-radius: 4px; cursor: pointer; transition: background .2s, border-color .2s; }
.btn-quiet:hover { background: var(--acc-soft); border-color: var(--acc-mid); }
.btn-quiet:disabled { color: var(--dim); cursor: default; background: #fff; }

/* ---------- modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(10, 18, 32, .55); backdrop-filter: blur(6px); overflow-y: auto; }
.modal-backdrop[hidden] { display: none; }
.modal-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; background: #fff; border-radius: 18px; padding: 34px 38px; box-shadow: 0 24px 80px rgba(0, 0, 0, .35); animation: modal-in .35s var(--ease); }
.modal-card-wide { width: min(980px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal-card h2 { margin: 0 0 8px; font-size: clamp(26px, 3.2vw, 36px); letter-spacing: -.025em; line-height: 1.1; }
.modal-sub { color: var(--mut); font-size: 15.5px; margin: 0 0 18px; }
.kicker { margin: 0 0 8px; font: 700 10.5px/1.3 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--acc); }
.modal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-top h2 { margin: 0; font-size: 26px; }

/* welcome */
.start-card { width: min(640px, 100%); padding: 26px 30px 22px; border-radius: 14px; }
.start-card h2 { font-size: clamp(24px, 2.8vw, 30px); margin-bottom: 10px; }
.start-lede { font-size: 14px; line-height: 1.55; color: #2d3748; margin: 0 0 16px; max-width: 42em; }
.start-steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.start-steps li { font-size: 12px; color: var(--mut); line-height: 1.4; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.start-steps li span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--acc); color: #fff; font: 700 11px/1 var(--mono); margin-bottom: 6px; }
.start-steps li b { display: block; color: var(--text); font-size: 13px; margin-bottom: 1px; }
.basin-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.basin-card { position: relative; text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--line); background: #fff; cursor: pointer; color: var(--text); transition: border-color .2s, box-shadow .2s, transform .15s; }
.basin-card:hover { border-color: var(--acc-mid); transform: translateY(-1px); }
.basin-card.active { border-color: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft); }
.basin-card b { font-size: 15px; letter-spacing: -.01em; }
.bc-place { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.bc-num { font: 500 13px var(--mono); color: var(--mut); margin-top: 4px; }
.bc-num em { font-style: normal; font-size: 22px; font-weight: 600; color: var(--hot); letter-spacing: -.02em; }
.bc-note { font-size: 12px; color: var(--mut); }
.bc-check { position: absolute; top: 16px; right: 16px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); transition: all .2s; }
.basin-card.active .bc-check { border-color: var(--acc); background: var(--acc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center/14px no-repeat; }
.model-details { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; margin-bottom: 14px; }
.model-details summary { cursor: pointer; padding: 9px 0; font-weight: 600; font-size: 12.5px; color: var(--acc); list-style: none; display: flex; align-items: center; gap: 8px; }
.model-details summary::-webkit-details-marker { display: none; }
.model-details summary::before { content: "+"; font: 700 17px/1 var(--mono); width: 14px; }
.model-details[open] summary::before { content: "−"; }
.model-details-note { font-size: 12.5px; color: var(--mut); margin: 0 0 10px; }
.calibration-box { font-size: 12px; color: var(--mut); padding: 12px 14px; background: #eef7f0; border-radius: 10px; margin-bottom: 14px; line-height: 1.55; }
.calibration-box strong { color: var(--ok); }
.start-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.start-foot > span { font-size: 11px; color: var(--dim); max-width: 26em; }

/* end */
.end-chart-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.end-chart-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 8px; }
.end-chart-head span { color: var(--dim); font-size: 12.5px; }
.end-chart-wrap { position: relative; height: 230px; }
.end-chart-credit { font-size: 12px; color: var(--dim); margin-top: 8px; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare-col { background: var(--bg); border-radius: 12px; padding: 14px 18px; }
.compare-col h3 { margin: 0 0 8px; font-size: 15px; }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--mut); }
.stat-line:last-child { border-bottom: 0; }
.stat-line strong { color: var(--text); font-weight: 600; }
.end-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* sources & verification */
.info-pane { margin-top: 18px; }
.info-pane[hidden] { display: none; }
.sources-ref-box { font-size: 14px; color: var(--mut); line-height: 1.6; background: var(--bg); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.sources-ref-box h3 { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.sources-ref-box ul { margin: 8px 0 0; padding-left: 1.2em; } .sources-ref-box li { margin: .4em 0; }
.sources-ref-box a, .param-table a { color: var(--acc); }
.param-table, .test-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.param-table th, .param-table td, .test-table th, .test-table td { text-align: left; vertical-align: top; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.param-table th, .test-table th { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); background: var(--bg); }
.param-table td span[style] { font-size: 12px !important; }
.test-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.test-head div { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.test-head span { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.test-head b { display: block; margin-top: 4px; font: 600 18px/1.2 var(--mono); }
.test-group td { background: #fafbfd; font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--acc); padding: 8px 10px; }
.test-id { font-family: var(--mono); color: var(--dim); white-space: nowrap; }
.test-crit { color: var(--mut); font-size: 13px; }
.test-res { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.badge { display: inline-block; font: 700 11px/1 var(--font); letter-spacing: .08em; padding: 5px 8px; border-radius: 6px; }
.badge.pass { background: #e4f3e8; color: var(--ok); } .badge.fail { background: #fbe4e0; color: var(--hot); }
.test-note { font-size: 12.5px; color: var(--dim); margin: 12px 0 0; }

/* ---------- map markers ---------- */
.dmark { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; border: 2px solid transparent; background: rgba(255, 255, 255, .95); color: var(--text); font: 700 11.5px/1 var(--font); cursor: pointer; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.dmark.sel { border-color: var(--acc); background: #fff; }
.dmark .mval { font: 600 11px var(--mono); }
.refmark { padding: 4px 8px; border-radius: 6px; background: rgba(255, 255, 255, .9); border: 1px dashed var(--ok); color: var(--ok); font: 600 11px var(--mono); }

/* ---------- classroom mode ---------- */
.classroom-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.classroom-scen-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; min-height: 44px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-family: var(--font); color: var(--text); transition: border-color .2s, background .2s, box-shadow .2s; }
.classroom-scen-btn:hover { border-color: var(--acc-mid); background: var(--acc-soft); }
.classroom-scen-btn.active { border-color: var(--acc); background: var(--acc-soft); box-shadow: 0 0 0 1px var(--acc); }
.classroom-scen-btn .cs-kicker { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--acc); }
.classroom-scen-btn strong { font-size: 15px; font-weight: 700; line-height: 1.2; }
.classroom-scen-btn .cs-meta { font-size: 12px; line-height: 1.4; color: var(--dim); }
.classroom-q-list { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--text); }
.classroom-q-list code { font-family: var(--mono); font-size: 12px; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }
.end-classroom-box { margin: 16px 0 6px; padding: 14px 16px; background: var(--acc-soft); border: 1px solid var(--acc-mid); border-radius: 10px; }
.end-classroom-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { :root { --panel-w: 320px; } .seg-btn { padding: 7px 11px; font-size: 12px; } }
@media (max-width: 1100px) {
  body { overflow-x: hidden; overflow-y: auto; }
  .app-shell { height: auto; }
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: 62vh auto auto; }
  .workspace > *, .dock > *, .control-panel > * { min-width: 0; max-width: 100%; }
  .control-panel { grid-column: 1; grid-row: 3; overflow: visible; }
  .dock { grid-row: 2; height: auto; grid-template-columns: 1fr; }
  .timeline-dock { height: 260px; }
  .turn-actions { position: static; }
}
@media (max-width: 640px) {
  .brand-group .pill { display: none; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .topbar-meta { width: 100%; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
  .seg { max-width: 100%; }
  #presetSeg { width: 100%; }
  #presetSeg .seg-btn { flex: 1; padding: 10px 6px; font-size: 11.5px; }
  .seg-map { top: auto; bottom: 10px; left: 10px; max-width: calc(100% - 20px); }
  .seg-map .seg-btn { padding: 10px 8px; font-size: 11.5px; }
  .map-legend { display: none; }
  .date-stamp { top: auto; bottom: 64px; right: 10px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 12px; }
  .modal-card, .start-card { width: 100%; max-width: 100%; padding: 20px 16px; }
  .start-steps, .basin-cards, .compare-grid, .test-head, .classroom-grid { grid-template-columns: 1fr; }
  .start-foot { flex-direction: column; align-items: stretch; }
  .btn-primary, .btn-quiet, .btn-lg { min-height: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .seg-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .layer-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .model-details > summary { min-height: 44px; display: flex; align-items: center; }
  .dmark { min-height: 44px; min-width: 44px; padding: 8px 10px; display: inline-flex; align-items: center; }
  .maplibregl-ctrl-group button { width: 44px !important; height: 44px !important; }
  .maplibregl-ctrl-attrib-button { min-width: 44px !important; min-height: 44px !important; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* static map fallback without WebGL (PC1) */
.map-static{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:12px;background:#0b1220}
.map-static img{max-width:100%;max-height:82%;object-fit:contain}
.map-static p{margin:0;color:#c3cee0;font-size:.8rem;text-align:center;max-width:56ch}

/* first-time hint: the main button pulses until the player presses it once (PC1) */
@keyframes nvPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(11,61,145,.45); } 50% { box-shadow: 0 0 0 8px rgba(11,61,145,0); } }
#nextMonthBtn.hint { animation: nvPulse 1.6s ease-in-out infinite; }

@media (max-width: 640px) {
  /* basin switch sat on top of the map attribution and was cut off (PC1) */
  .seg-map { bottom: 34px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); }
  .seg-map .seg-btn { padding: 8px 10px; font-size: 11px; white-space: nowrap; }
}
@media (max-width: 640px) { .date-stamp { bottom: 80px; } }
