:root {
  color-scheme: dark;
  --bg: #07121a;
  --panel: #0b1a24;
  --panel-2: #10232e;
  --line: rgba(172, 206, 209, .13);
  --muted: #8399a2;
  --muted-2: #a9bac0;
  --text: #e7f0ed;
  --teal: #71d7c3;
  --teal-2: #38a99b;
  --gold: #d7b984;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; min-height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { font-size: 13px; letter-spacing: .01em; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.app-shell { width: 100%; height: 100dvh; display: flex; flex-direction: column; min-height: 0; background: radial-gradient(ellipse at 15% 0%, #102530 0%, transparent 48%), var(--bg); }
.topbar { height: 76px; flex: 0 0 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(7, 18, 26, .92); z-index: 3; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(113, 215, 195, .45); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-8deg); background: linear-gradient(145deg, rgba(113,215,195,.14), rgba(113,215,195,.02)); }
.brand-mark span { display: block; width: 4px; border-radius: 4px; background: var(--teal); transform: skewY(-28deg); }
.brand-mark span:nth-child(1) { height: 10px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .72; }
.eyebrow, .top-meta, .scene-chip, .scene-kicker, .section-index, .metric-label, .secondary-readouts span, .range-ends, .validation-label, .validation-status, .validation-values span, .panel-footer { font-family: var(--mono); letter-spacing: .09em; }
.eyebrow { font-size: 9px; color: var(--teal); margin-bottom: 4px; }
h1 { font-size: 19px; line-height: 1; font-weight: 560; margin: 0; letter-spacing: -.035em; }
.top-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #72d7b5; box-shadow: 0 0 12px rgba(113,215,195,.7); }
.meta-divider { width: 1px; height: 13px; background: var(--line); margin: 0 4px; }
.scale-label { color: var(--gold); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 370px; flex: 1; min-height: 0; }
.scene-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 52% 42%, #1c3840 0%, #10242d 50%, #09151e 100%); }
#sceneCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.scene-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(5,15,22,.46) 0%, transparent 24%, transparent 70%, rgba(5,15,22,.48) 100%), linear-gradient(90deg, rgba(5,15,22,.2), transparent 30%, transparent 75%, rgba(5,15,22,.08)); }
.scene-topline { position: absolute; top: 18px; left: 20px; right: 20px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.scene-chip { color: rgba(224,239,233,.72); font-size: 9px; padding: 8px 10px; border: 1px solid rgba(200,229,221,.13); border-radius: 7px; background: rgba(5,16,23,.38); backdrop-filter: blur(12px); }
.chip-icon { color: var(--teal); margin-right: 6px; }
.chip-separator { color: var(--teal); margin: 0 6px; }
.scene-title-block { position: absolute; top: 72px; left: 25px; max-width: 390px; pointer-events: none; text-shadow: 0 2px 20px rgba(0,0,0,.42); }
.scene-kicker { color: #a7d5c9; font-size: 9px; margin-bottom: 10px; }
.scene-title { font-size: clamp(21px, 2.2vw, 31px); line-height: 1.13; letter-spacing: -.04em; font-weight: 520; max-width: 370px; }
.scene-subtitle { max-width: 345px; margin-top: 10px; font-size: 11px; line-height: 1.55; color: rgba(225,239,234,.72); }
.annotation { position: absolute; display: flex; align-items: center; gap: 7px; color: rgba(220,238,229,.75); font: 9px var(--mono); letter-spacing: .1em; pointer-events: none; text-shadow: 0 2px 8px #07121a; }
.annotation-line { width: 28px; height: 1px; background: var(--teal); box-shadow: 0 0 8px rgba(113,215,195,.55); }
.annotation-one { left: 43%; top: 33%; }
.annotation-two { right: 11%; top: 58%; }
.annotation-three { left: 37%; bottom: 22%; }
.scene-legend { position: absolute; left: 24px; bottom: 20px; display: flex; flex-wrap: wrap; gap: 14px; color: rgba(220,236,229,.68); font-size: 10px; pointer-events: none; }
.scene-legend span { display: flex; align-items: center; gap: 6px; }
.scene-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.legend-water { background: #49b9bd; box-shadow: 0 0 8px rgba(73,185,189,.7); }
.legend-calcite { background: #d8c9a4; }
.legend-rock { background: #657a76; }
.context-lost { display: none; position: absolute; inset: 0; z-index: 5; align-items: center; justify-content: center; flex-direction: column; gap: 8px; background: rgba(5,14,20,.88); color: var(--text); text-align: center; }
.context-lost.visible { display: flex; }
.context-lost span { color: var(--muted); font-size: 12px; }
.control-panel { min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(13,30,40,.98), rgba(8,21,30,.98)); overflow: hidden; }
.panel-scroll { height: 100%; overflow: auto; padding: 20px 19px 18px; scrollbar-width: thin; scrollbar-color: #31505a transparent; }
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #31505a; border-radius: 8px; }
section { margin: 0 0 22px; }
.section-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-index { font-size: 9px; color: var(--teal); opacity: .9; }
.section-heading h2 { font-size: 12px; margin: 0; font-weight: 600; letter-spacing: .015em; white-space: nowrap; }
.section-rule { height: 1px; background: var(--line); flex: 1; margin-left: 4px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-card { min-height: 79px; padding: 11px 12px 9px; border: 1px solid rgba(174,207,202,.11); border-radius: 9px; background: linear-gradient(145deg, rgba(22,47,57,.72), rgba(11,29,39,.6)); }
.metric-primary { border-color: rgba(113,215,195,.28); background: linear-gradient(145deg, rgba(32,76,76,.54), rgba(12,33,42,.72)); }
.metric-label { font-size: 8px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.metric-mark { color: var(--teal); font-size: 8px; }
.metric-value { margin-top: 6px; font-size: 22px; line-height: 1; font-weight: 550; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-primary .metric-value { color: #a4efda; }
.metric-note { margin-top: 5px; font-size: 9px; color: #718991; }
.secondary-readouts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 9px; padding: 10px 2px 0; border-top: 1px solid var(--line); }
.secondary-readouts div { min-width: 0; }
.secondary-readouts span { display: block; font-size: 7px; color: var(--muted); white-space: nowrap; }
.secondary-readouts strong { display: block; margin-top: 5px; font: 11px var(--mono); color: #c5d7d2; white-space: nowrap; }
.controls-section { margin-bottom: 22px; }
.control-row { margin: 0 0 12px; }
.control-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.control-label label { font-size: 10px; color: #c7d6d2; }
.control-label output { font: 10px var(--mono); color: var(--teal); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; display: block; appearance: none; -webkit-appearance: none; height: 4px; margin: 0; border-radius: 10px; background: linear-gradient(90deg, rgba(113,215,195,.62), rgba(113,215,195,.17)); cursor: pointer; accent-color: var(--teal); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; border: 2px solid #b4eee0; border-radius: 50%; background: #1b716d; box-shadow: 0 0 0 3px rgba(113,215,195,.12), 0 0 10px rgba(113,215,195,.32); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #b4eee0; border-radius: 50%; background: #1b716d; box-shadow: 0 0 0 3px rgba(113,215,195,.12); }
.range-ends { display: flex; justify-content: space-between; color: #647c84; font-size: 8px; margin-top: 5px; letter-spacing: .03em; }
.preset-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.preset-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; text-align: left; border: 1px solid rgba(174,207,202,.1); border-radius: 8px; background: rgba(13,33,43,.68); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.preset-button:hover { border-color: rgba(113,215,195,.35); background: rgba(24,52,60,.75); }
.preset-button.active { border-color: rgba(113,215,195,.5); background: rgba(33,78,75,.25); }
.preset-symbol { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(113,215,195,.1); color: var(--teal); font-size: 14px; }
.preset-button strong, .preset-button small { display: block; }
.preset-button strong { font-size: 10px; font-weight: 600; }
.preset-button small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.transport-buttons { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.action-button { height: 34px; border: 1px solid rgba(174,207,202,.14); border-radius: 7px; background: rgba(18,39,49,.8); color: #c6d7d2; font-size: 10px; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.action-button:hover, .utility-button:hover { border-color: rgba(113,215,195,.42); background: rgba(34,68,73,.72); }
.primary-action { background: linear-gradient(120deg, #1b6c67, #245e61); border-color: rgba(113,215,195,.4); color: #e5fbf2; font-weight: 600; }
.primary-action:hover { background: linear-gradient(120deg, #24877c, #2b6f70); }
.primary-action span:first-child { margin-right: 5px; }
.speed-label { margin-top: 3px; }
.utility-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 11px; }
.utility-button { height: 30px; border: 1px solid rgba(174,207,202,.12); border-radius: 7px; background: rgba(13,31,41,.7); color: #9eb4b6; font-size: 9px; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.utility-button:last-child { grid-column: span 2; }
.validation-card { border: 1px solid rgba(113,215,195,.18); border-radius: 9px; padding: 11px 12px; background: linear-gradient(145deg, rgba(22,52,55,.42), rgba(10,28,38,.76)); }
.validation-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.validation-label { font-size: 8px; color: #a4c6bc; }
.validation-status { font-size: 8px; color: #8fe0c3; }
.validation-status i { display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; background: #8fe0c3; }
.validation-equation { padding: 10px 0 9px; color: #dcece5; font: 13px Georgia, serif; border-bottom: 1px solid var(--line); }
.validation-equation sup { font-size: 9px; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; padding-top: 9px; }
.validation-values span { display: block; font-size: 7px; color: var(--muted); }
.validation-values strong { display: block; margin-top: 5px; font: 10px var(--mono); color: #d3e4dc; white-space: nowrap; }
.validation-card p { margin: 9px 0 0; font-size: 9px; line-height: 1.45; color: #82989c; }
.science-section { border: 1px solid rgba(174,207,202,.13); border-radius: 9px; background: rgba(10,27,37,.7); overflow: hidden; margin-bottom: 15px; }
.science-section summary { display: flex; align-items: center; gap: 9px; list-style: none; padding: 12px; font-size: 11px; font-weight: 600; cursor: pointer; }
.science-section summary::-webkit-details-marker { display: none; }
.summary-plus { margin-left: auto; color: var(--teal); font-size: 17px; font-weight: 300; transition: transform .2s ease; }
.science-section[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 12px 13px; border-top: 1px solid var(--line); }
.science-content h3 { margin: 13px 0 8px; font-size: 10px; color: #c6ddd4; font-weight: 600; }
.cause-chain { margin: 0; padding: 0 0 0 17px; color: var(--teal); }
.cause-chain li { padding: 0 0 8px 3px; }
.cause-chain b { display: block; color: #d6e6df; font-size: 9px; }
.cause-chain span { display: block; margin-top: 3px; color: #91a7a7; font-size: 9px; line-height: 1.45; }
.equation-block { margin: 7px 0; padding: 8px; border-radius: 6px; background: rgba(20,43,51,.72); }
.equation-block span { display: block; margin-bottom: 5px; color: #91a9a7; font-size: 8px; }
.equation-block code { display: block; color: #d2e9de; font: 10px/1.6 var(--mono); white-space: normal; }
.science-list { margin: 0; padding-left: 15px; color: #91a7a7; font-size: 9px; line-height: 1.5; }
.science-list li { margin: 4px 0; }
.science-list b { color: #d3e6dc; }
.limitation-note { margin-top: 10px; padding: 9px; border-left: 2px solid var(--gold); background: rgba(215,185,132,.06); color: #9caaa4; font-size: 9px; line-height: 1.5; }
.limitation-note b { color: #ddc79f; }
.disclaimer { margin: 12px 0 14px; padding: 10px; border: 1px solid rgba(215,185,132,.16); border-radius: 7px; color: #a8a18e; font-size: 9px; line-height: 1.45; }
.panel-footer { display: flex; justify-content: space-between; gap: 5px; padding-top: 10px; border-top: 1px solid var(--line); color: #587078; font-size: 7px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 22px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; padding: 9px 13px; border: 1px solid rgba(113,215,195,.32); border-radius: 8px; background: rgba(9,30,37,.95); color: #d7eee5; font-size: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.3); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
body.embed .topbar { display: none; }
body.embed .workspace { grid-template-columns: minmax(0, 1fr) 320px; }
body.embed .scene-title-block { top: 55px; }
body.embed .annotation { display: none; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; }
  .panel-scroll { padding-left: 15px; padding-right: 15px; }
  .scene-title-block { max-width: 330px; }
  .scene-subtitle { max-width: 300px; }
}
@media (max-width: 760px) {
  html, body { overflow: auto; }
  .app-shell { min-height: 100dvh; height: auto; }
  .topbar { height: 62px; flex-basis: 62px; padding: 0 15px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 16px; }
  .eyebrow { font-size: 8px; }
  .top-meta { gap: 6px; font-size: 7px; }
  .meta-divider, .scale-label { display: none; }
  .workspace { display: flex; flex-direction: column; min-height: calc(100dvh - 62px); }
  .scene-panel { height: min(57dvh, 520px); min-height: 360px; flex: 0 0 auto; }
  .control-panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .panel-scroll { height: auto; max-height: none; overflow: visible; padding: 17px 15px 22px; }
  .scene-topline { top: 12px; left: 12px; right: 12px; }
  .scene-chip { padding: 7px 8px; font-size: 7px; }
  .scene-title-block { top: 60px; left: 16px; max-width: 280px; }
  .scene-title { font-size: 23px; max-width: 260px; }
  .scene-subtitle { font-size: 10px; max-width: 255px; }
  .annotation { font-size: 7px; }
  .annotation-one { left: 38%; top: 42%; }
  .annotation-two { right: 5%; top: 63%; }
  .annotation-three { left: 25%; bottom: 23%; }
  .scene-legend { left: 15px; bottom: 13px; gap: 9px; font-size: 8px; }
  .metric-card { min-height: 76px; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); }
  .preset-button { padding: 8px 7px; gap: 6px; align-items: flex-start; }
  .preset-symbol { width: 21px; height: 21px; flex: 0 0 21px; font-size: 11px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 7px; line-height: 1.25; }
  .science-section { margin-bottom: 14px; }
  body.embed .workspace { display: flex; }
  body.embed .scene-panel { height: 100dvh; min-height: 0; }
  body.embed .control-panel { position: absolute; left: 8px; right: 8px; bottom: 8px; max-height: 43dvh; border: 1px solid var(--line); border-radius: 12px; overflow: auto; background: rgba(8,23,31,.94); backdrop-filter: blur(15px); }
  body.embed .panel-scroll { max-height: 43dvh; overflow: auto; }
}
@media (max-width: 390px) {
  .topbar { padding: 0 11px; }
  .top-meta { font-size: 6px; }
  .scene-title-block { top: 55px; }
  .scene-title { font-size: 21px; }
  .scene-subtitle { max-width: 235px; }
  .metric-grid { gap: 6px; }
  .metric-card { padding: 10px; }
  .metric-value { font-size: 20px; }
  .secondary-readouts { gap: 5px; }
  .secondary-readouts strong { font-size: 9px; }
  .preset-grid { gap: 4px; }
  .preset-button { padding: 7px 5px; }
  .preset-button strong { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
