:root {
  color-scheme: dark;
  --bg: #07131f;
  --panel: #0b1b29;
  --panel-2: #102333;
  --panel-3: #132a3a;
  --line: rgba(166, 205, 226, .13);
  --line-strong: rgba(166, 205, 226, .23);
  --text: #e8f3f8;
  --muted: #8fa8b8;
  --dim: #5e788a;
  --accent: #72e2f4;
  --accent-soft: rgba(114, 226, 244, .12);
  --accent-deep: #1b7188;
  --warm: #d3a879;
  --danger: #e0a17f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#app { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 22% -20%, rgba(39, 91, 113, .22), transparent 44%), var(--bg); }
.topbar { height: 64px; min-height: 64px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(7, 19, 31, .94); }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); border: 1px solid rgba(114, 226, 244, .35); border-radius: 10px; background: linear-gradient(145deg, rgba(114, 226, 244, .15), rgba(114, 226, 244, .025)); font-size: 20px; box-shadow: 0 0 22px rgba(114, 226, 244, .07); }
.brand-copy { display: grid; gap: 2px; }
.eyebrow { color: #83a5b7; font-size: 9px; font-weight: 750; letter-spacing: .17em; line-height: 1.4; }
.brand-title { font-size: 14px; font-weight: 650; letter-spacing: .005em; color: #e6f1f6; }
.topbar-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; letter-spacing: .13em; font-weight: 700; }
.live-dot, .state-pip { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(114, 226, 244, .8); }
.topbar-divider { width: 1px; height: 16px; background: var(--line-strong); margin: 0 4px; }
.topbar-tag { padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 5px; color: #a8c1ce; font-size: 8px; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 374px; }
.stage-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 22px 24px 18px; gap: 14px; border-right: 1px solid var(--line); }
.stage-heading { min-height: 50px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.stage-heading h1 { margin: 4px 0 0; font-size: clamp(18px, 2vw, 25px); font-weight: 580; letter-spacing: -.035em; color: #eef7fa; }
.scene-state { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid rgba(114, 226, 244, .2); border-radius: 5px; color: #9fc5d3; font-size: 8px; letter-spacing: .12em; font-weight: 750; white-space: nowrap; background: rgba(114, 226, 244, .045); }
.canvas-wrap { flex: 1; min-height: 210px; position: relative; overflow: hidden; border: 1px solid rgba(140, 186, 210, .18); border-radius: 11px; background: #0b1b27; box-shadow: 0 14px 45px rgba(0,0,0,.19), inset 0 1px rgba(255,255,255,.025); }
#scene { display: block; width: 100%; height: 100%; }
.canvas-top-label { position: absolute; top: 13px; left: 15px; display: flex; align-items: center; gap: 7px; color: #c5dce6; font-size: 8px; font-weight: 750; letter-spacing: .14em; pointer-events: none; text-shadow: 0 1px 5px rgba(0,0,0,.5); }
.label-rule { width: 16px; height: 1px; background: var(--accent); }
.muted { color: #7893a3; }
.canvas-bottom-legend { position: absolute; bottom: 12px; left: 14px; display: flex; gap: 13px; flex-wrap: wrap; padding: 7px 9px; border: 1px solid rgba(157, 197, 215, .13); border-radius: 5px; background: rgba(5, 16, 25, .72); color: #b2c9d4; font-size: 7px; font-weight: 750; letter-spacing: .1em; backdrop-filter: blur(8px); pointer-events: none; }
.canvas-bottom-legend span { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend-swatch.frozen { background: #68b9d4; }
.legend-swatch.fringe { background: #9cf3ff; }
.legend-swatch.water { background: #3e91b7; }
.stage-footer { display: grid; gap: 12px; }
.causal-chain { display: grid; grid-template-columns: minmax(0,1fr) 20px minmax(0,1fr) 20px minmax(0,1fr); align-items: center; gap: 8px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: rgba(13, 31, 45, .66); }
.chain-step { min-width: 0; display: grid; gap: 3px; }
.chain-kicker { color: #77b7c8; font-size: 7px; font-weight: 800; letter-spacing: .16em; }
.chain-title { color: #e1edf2; font-size: 11px; font-weight: 680; }
.chain-copy { color: #829eae; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chain-arrow { color: #4c8397; text-align: center; font-size: 15px; }
.readouts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.readout-card { padding: 10px 12px 9px; border: 1px solid var(--line); border-radius: 7px; background: linear-gradient(145deg, rgba(18, 43, 60, .82), rgba(11, 27, 41, .82)); min-width: 0; }
.readout-card.accent-card { border-color: rgba(114, 226, 244, .26); background: linear-gradient(145deg, rgba(24, 71, 86, .5), rgba(11, 27, 41, .85)); }
.readout-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #9cb7c4; font-size: 7px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.readout-label span { color: #5f8798; font-size: 6px; letter-spacing: .08em; }
.readout-value { margin-top: 5px; color: #eef8fb; font-size: clamp(19px, 2.2vw, 26px); font-weight: 580; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.accent-card .readout-value { color: var(--accent); }
.readout-value small { color: #8ca9b8; font-size: 10px; font-weight: 550; letter-spacing: 0; }
.readout-sub { margin-top: 5px; color: #718b9b; font-size: 8px; }
.control-panel { min-width: 0; min-height: 0; background: linear-gradient(180deg, rgba(11, 27, 41, .96), rgba(8, 22, 34, .98)); }
.panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #244354 transparent; padding: 22px 18px 18px; }
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #244354; border-radius: 10px; }
.panel-section { padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.section-heading h2 { margin: 4px 0 0; font-size: 17px; font-weight: 620; letter-spacing: -.03em; }
.day-counter { display: grid; justify-items: end; gap: 1px; color: var(--accent); font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.day-counter small { color: #718d9d; font-size: 6px; letter-spacing: .12em; font-weight: 800; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 15px 0 16px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(16, 37, 53, .7); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.preset-button:hover { border-color: rgba(114, 226, 244, .42); background: rgba(24, 60, 75, .55); }
.preset-button:active { transform: translateY(1px); }
.preset-button.selected { border-color: rgba(114, 226, 244, .48); background: rgba(31, 83, 99, .28); box-shadow: inset 0 0 0 1px rgba(114, 226, 244, .06); }
.preset-icon { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: rgba(114, 226, 244, .1); font-size: 15px; }
.dry-icon { color: #d2b38f; background: rgba(210, 179, 143, .1); }
.preset-button b, .preset-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-button b { font-size: 9px; font-weight: 700; color: #dceaf0; }
.preset-button small { margin-top: 3px; color: #8099a8; font-size: 7px; }
.control-list { display: grid; gap: 15px; }
.control-block { display: grid; gap: 7px; }
.control-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.control-heading label { color: #c6d7df; font-size: 10px; font-weight: 620; }
.control-heading output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; width: 100%; height: 4px; margin: 2px 0; border-radius: 9px; background: linear-gradient(90deg, rgba(114,226,244,.85), rgba(114,226,244,.28)); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border: 2px solid #07131f; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(114,226,244,.75), 0 0 12px rgba(114,226,244,.3); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #07131f; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(114,226,244,.75); }
.range-meta { display: flex; justify-content: space-between; align-items: center; color: #6f8998; font-size: 7px; font-variant-numeric: tabular-nums; }
.range-tag { color: #587b8c; font-size: 6px; letter-spacing: .09em; font-weight: 800; }
.action-row { display: grid; grid-template-columns: minmax(0,1fr) 48px 48px 48px; gap: 6px; margin-top: 18px; }
.primary-action, .icon-action { min-height: 40px; border-radius: 6px; border: 1px solid var(--line-strong); cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.primary-action { display: flex; align-items: center; justify-content: center; gap: 9px; background: linear-gradient(110deg, #1a7388, #15556c); border-color: rgba(114,226,244,.3); color: #effcff; font-size: 10px; font-weight: 750; letter-spacing: .02em; box-shadow: 0 5px 18px rgba(20, 104, 127, .16); }
.primary-action:hover { background: linear-gradient(110deg, #22849b, #1b6379); }
.play-symbol { font-size: 13px; line-height: 1; }
.icon-action { display: grid; align-content: center; justify-items: center; gap: 1px; background: rgba(19, 42, 58, .8); color: #c6dce5; font-size: 18px; line-height: 1; }
.icon-action small { color: #7f9aaa; font-size: 6px; font-weight: 800; letter-spacing: .1em; }
.icon-action:hover { border-color: rgba(114,226,244,.4); background: rgba(27, 65, 81, .75); }
.primary-action:active, .icon-action:active { transform: translateY(1px); }
.quality-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.quality-label, .quality-note { color: #698594; font-size: 6px; font-weight: 800; letter-spacing: .11em; }
.quality-toggle { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 5px; background: rgba(4, 15, 23, .6); }
.quality-toggle button { padding: 4px 8px; border: 0; border-radius: 3px; background: transparent; color: #7f9aaa; font-size: 8px; cursor: pointer; }
.quality-toggle button.active { color: var(--accent); background: rgba(114,226,244,.12); }
.quality-note { margin-left: auto; }
.insight-card { margin-top: 14px; padding: 12px 12px 11px; border: 1px solid rgba(114,226,244,.19); border-radius: 7px; background: linear-gradient(140deg, rgba(21, 61, 77, .42), rgba(12, 30, 44, .72)); }
.insight-head { display: flex; align-items: center; gap: 7px; color: #8bbdcb; font-size: 7px; font-weight: 850; letter-spacing: .13em; }
.insight-icon { color: var(--accent); font-size: 12px; }
.insight-status { margin-left: auto; padding: 3px 5px; border: 1px solid rgba(114,226,244,.18); border-radius: 3px; color: var(--accent); font-size: 6px; }
.insight-card p { margin: 8px 0 10px; color: #c4d8e1; font-size: 10px; line-height: 1.5; }
.secondary-readouts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; padding-top: 9px; border-top: 1px solid var(--line); }
.secondary-readouts div { min-width: 0; display: grid; gap: 4px; }
.secondary-readouts span { color: #6e8b9b; font-size: 6px; font-weight: 800; letter-spacing: .08em; white-space: nowrap; }
.secondary-readouts b { color: #d9eef4; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.science-panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(12, 29, 43, .64); }
.science-panel summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; color: #d3e4eb; font-size: 10px; font-weight: 700; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { display: flex; align-items: center; gap: 8px; }
.science-glyph { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 5px; background: rgba(114,226,244,.1); color: var(--accent); font-size: 13px; }
.chevron { color: #7696a6; font-size: 16px; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 13px; }
.science-intro { margin: 1px 0 12px; color: #9eb7c3; font-size: 9px; line-height: 1.55; }
.equation-block { padding: 9px 0; border-top: 1px solid var(--line); }
.equation-label { display: flex; justify-content: space-between; gap: 8px; color: #8cb2c1; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.equation-label span { color: #638293; font-size: 6px; text-align: right; }
.equation { margin: 9px 0 6px; color: #e3f6fb; font-family: Georgia, "Times New Roman", serif; font-size: 17px; text-align: center; letter-spacing: .01em; }
.equation sub { font-size: 10px; }
.equation sup { font-size: 10px; }
.fraction { display: inline-block; vertical-align: middle; text-align: center; line-height: 1.2; padding: 0 3px; }
.fraction i { display: block; border-top: 1px solid rgba(218,244,250,.7); font-style: normal; }
.equation-block p { margin: 0; color: #819eac; font-size: 8px; line-height: 1.45; }
.constant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 10px 0; border-top: 1px solid var(--line); }
.constant-grid div { display: grid; gap: 2px; }
.constant-grid b { color: #d9edf3; font-size: 9px; font-weight: 700; }
.constant-grid span { color: #6f8d9d; font-size: 6px; letter-spacing: .04em; }
.simplification-note { padding: 9px; border: 1px solid rgba(210,168,121,.16); border-radius: 5px; background: rgba(110, 74, 43, .08); }
.simplification-note b { color: #d4b28e; font-size: 7px; letter-spacing: .12em; }
.simplification-note p { margin: 5px 0 0; color: #9b9b91; font-size: 8px; line-height: 1.5; }
.simplification-note .required-disclaimer { color: #b7cbd3; }
.audit-card { margin-top: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(8, 22, 33, .7); }
.audit-title { display: flex; justify-content: space-between; align-items: center; color: #8eabb9; font-size: 7px; font-weight: 850; letter-spacing: .13em; }
.audit-badge { color: #72b7c7; font-size: 6px; border: 1px solid rgba(114,226,244,.2); padding: 3px 5px; border-radius: 3px; }
.audit-equation { margin-top: 9px; color: #93acb9; font-size: 8px; }
.audit-equation b { color: #d9f4f8; font-size: 12px; font-weight: 650; }
.audit-comparison { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: #6d8a99; font-size: 6px; letter-spacing: .08em; }
.audit-comparison b { color: #a9dbe4; font-size: 9px; letter-spacing: 0; }
.audit-foot { margin-top: 7px; color: #617e8e; font-size: 7px; line-height: 1.4; }
.panel-footer { display: flex; justify-content: space-between; gap: 10px; padding: 12px 1px 1px; color: #536f7f; font-size: 6px; font-weight: 800; letter-spacing: .1em; }
@media (max-width: 980px) and (min-width: 701px) {
  .workspace { grid-template-columns: minmax(0,1fr) 340px; }
  .stage-column { padding: 18px 18px 15px; }
  .panel-scroll { padding: 18px 14px; }
  .readout-label { font-size: 6px; }
  .readout-label span { display: none; }
}
@media (max-width: 700px) {
  body { overflow: hidden; }
  .topbar { height: 54px; min-height: 54px; padding: 0 13px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 8px; font-size: 17px; }
  .brand-title { font-size: 11px; }
  .eyebrow { font-size: 7px; }
  .topbar-right { gap: 7px; font-size: 7px; }
  .topbar-tag, .topbar-divider { display: none; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(300px, 52%) minmax(0,1fr); }
  .stage-column { padding: 11px 11px 10px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-heading { min-height: 34px; align-items: center; }
  .stage-heading h1 { font-size: 15px; margin-top: 2px; }
  .scene-state { padding: 5px 7px; font-size: 6px; gap: 5px; }
  .state-pip { width: 5px; height: 5px; }
  .canvas-wrap { min-height: 0; border-radius: 7px; }
  .canvas-top-label { top: 8px; left: 9px; font-size: 6px; }
  .canvas-bottom-legend { left: 8px; bottom: 7px; gap: 8px; padding: 5px 6px; font-size: 6px; }
  .legend-swatch { width: 6px; height: 6px; }
  .stage-footer { gap: 7px; }
  .causal-chain { padding: 7px 8px; gap: 4px; border-radius: 6px; }
  .chain-kicker { font-size: 6px; }
  .chain-title { font-size: 9px; }
  .chain-copy { font-size: 7px; }
  .chain-arrow { font-size: 12px; }
  .readouts { gap: 5px; }
  .readout-card { padding: 7px 7px 6px; border-radius: 5px; }
  .readout-label { font-size: 6px; letter-spacing: .06em; }
  .readout-label span { display: none; }
  .readout-value { margin-top: 4px; font-size: 18px; }
  .readout-value small { font-size: 8px; }
  .readout-sub { margin-top: 3px; font-size: 6px; }
  .control-panel { min-height: 0; }
  .panel-scroll { padding: 13px 13px 18px; }
  .section-heading h2 { font-size: 15px; }
  .day-counter { font-size: 16px; }
  .preset-row { margin: 11px 0 13px; }
  .control-list { gap: 12px; }
  .control-heading label, .control-heading output { font-size: 9px; }
  .range-meta { font-size: 6px; }
  .action-row { margin-top: 14px; grid-template-columns: minmax(0,1fr) 43px 43px 43px; }
  .primary-action, .icon-action { min-height: 37px; }
  .insight-card { margin-top: 11px; }
}
@media (max-width: 380px) {
  .topbar-status { display: none; }
  .workspace { grid-template-rows: minmax(285px, 50%) minmax(0,1fr); }
  .stage-heading h1 { font-size: 13px; }
  .chain-copy { font-size: 6px; }
  .readout-value { font-size: 16px; }
  .readout-label { font-size: 5px; }
  .preset-button { padding: 7px 6px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
