:root {
  color-scheme: dark;
  --bg: #071216;
  --panel: #101e22;
  --panel-2: #142328;
  --line: rgba(186, 216, 205, 0.11);
  --line-strong: rgba(186, 216, 205, 0.2);
  --text: #e8eee8;
  --muted: #8c9e99;
  --soft: #b8c6bd;
  --teal: #7ed2c1;
  --teal-2: #3eaa9e;
  --amber: #d7b57d;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { overflow: hidden; font-size: 13px; letter-spacing: 0.005em; }
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 { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 17% 7%, rgba(35, 84, 77, 0.18), transparent 34%), var(--bg); }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7, 18, 22, 0.88); }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 29px; height: 29px; border: 1px solid rgba(126,210,193,.55); border-radius: 9px; position: relative; display: flex; align-items: end; justify-content: center; gap: 2px; padding: 5px 5px 6px; transform: rotate(-3deg); }
.brand-mark span { display: block; width: 4px; border-radius: 4px 4px 1px 1px; background: var(--teal); box-shadow: 0 0 10px rgba(126,210,193,.24); }
.brand-mark span:nth-child(1) { height: 7px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 9px; opacity: .75; }
.eyebrow, .section-kicker { color: #82a39b; font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.4; }
.brand-lockup h1 { margin: 2px 0 0; font-size: 17px; line-height: 1; letter-spacing: -.035em; font-weight: 670; }
.brand-lockup h1 em { color: #a5cfc2; font-style: normal; font-weight: 430; }
.top-meta { display: flex; align-items: center; gap: 9px; color: #91a49e; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #79d7ae; box-shadow: 0 0 0 4px rgba(121,215,174,.1), 0 0 12px rgba(121,215,174,.7); }
.meta-divider { height: 14px; width: 1px; background: var(--line-strong); margin: 0 7px; }
.seed-label { color: #667d77; }

.workspace { flex: 1 1 auto; min-height: 0; height: calc(100vh - 98px); display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 0; padding: 0 0 0 20px; }
.visual-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding-right: 18px; }
.scene-toolbar { flex: 0 0 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 5px; }
.scene-title { display: flex; flex-direction: column; gap: 3px; }
.scene-title strong { font-size: 13px; font-weight: 610; letter-spacing: -.01em; color: #dce6de; }
.scene-tools { display: flex; gap: 7px; }
.icon-button { height: 31px; min-width: 34px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(20, 36, 39, .8); color: #b7c8c0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; font-size: 10px; font-weight: 760; letter-spacing: .08em; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.icon-button:hover { background: #1c3335; border-color: rgba(126,210,193,.42); transform: translateY(-1px); }
.camera-icon { font-size: 17px; line-height: 1; transform: rotate(-35deg); }
.export-button { color: var(--teal); }
.export-text { font-size: 9px; }

.scene-stage { position: relative; flex: 1 1 auto; min-height: 360px; overflow: hidden; border: 1px solid rgba(159, 197, 183, .16); border-radius: 16px; background: radial-gradient(ellipse at 50% 50%, #1a3434, #09171b 72%); box-shadow: 0 22px 70px rgba(0,0,0,.22), inset 0 0 50px rgba(0,0,0,.16); isolation: isolate; }
.scene-canvas { position: absolute; inset: 0; z-index: 0; }
.scene-canvas canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.scene-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(4,14,17,.3), transparent 23%, transparent 78%, rgba(4,14,17,.45)), linear-gradient(90deg, rgba(4,14,17,.2), transparent 16%, transparent 84%, rgba(4,14,17,.17)); }
.scene-caption { position: absolute; z-index: 2; display: flex; align-items: center; gap: 7px; color: rgba(220,234,225,.78); font-size: 8px; font-weight: 800; letter-spacing: .13em; text-shadow: 0 1px 8px rgba(0,0,0,.7); pointer-events: none; }
.caption-source { left: 5%; top: 27%; }
.caption-degas { left: 43%; top: 43%; }
.caption-calcite { right: 4%; bottom: 25%; }
.caption-dot { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 9px currentColor; }
.caption-dot.cyan { background: #67d0c6; color: #67d0c6; }
.caption-dot.amber { background: #e1b67c; color: #e1b67c; }
.caption-dot.ivory { background: #e5ddc5; color: #e5ddc5; }
.orientation-cube { position: absolute; right: 16px; top: 15px; z-index: 2; width: 50px; height: 52px; border: 1px solid rgba(183,211,197,.2); border-radius: 9px; background: rgba(7,19,21,.45); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #91b5aa; font-size: 8px; font-weight: 800; letter-spacing: .12em; pointer-events: none; }
.orientation-cube i { width: 1px; height: 13px; background: linear-gradient(#9ee1d1, #497e78); position: relative; }
.orientation-cube i::before { content: ""; position: absolute; top: -1px; left: -3px; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 4px solid #9ee1d1; }
.orientation-cube b { font-size: 7px; color: #d0c49e; }
.scene-bottomline { position: absolute; z-index: 2; left: 16px; bottom: 13px; display: flex; flex-wrap: wrap; gap: 15px; color: rgba(204,220,210,.68); font-size: 8px; font-weight: 750; letter-spacing: .1em; pointer-events: none; }
.scene-bottomline span { display: inline-flex; align-items: center; gap: 6px; }
.scene-bottomline i { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.legend-water { background: #55bdb3; box-shadow: 0 0 8px #55bdb3; }
.legend-calcite { background: #d9caa9; }
.legend-bubble { border: 1px solid #c2eee2; border-radius: 50% !important; }
.webgl-fallback { position: absolute; z-index: 5; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 9px; text-align: center; padding: 30px; background: rgba(5,15,18,.92); color: var(--text); }
.webgl-fallback[hidden] { display: none; }
.webgl-fallback strong { font-size: 16px; }
.webgl-fallback span { max-width: 330px; color: var(--muted); line-height: 1.6; }

.mechanism-strip { flex: 0 0 72px; display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2.1vw, 28px); border-bottom: 1px solid var(--line); }
.mechanism-step { display: flex; align-items: center; gap: 9px; min-width: 0; }
.step-number { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: rgba(126,210,193,.08); border: 1px solid rgba(126,210,193,.17); color: var(--teal); font-size: 9px; font-weight: 800; }
.mechanism-step b { display: block; font-size: 9px; letter-spacing: .12em; color: #c5d2c9; }
.mechanism-step small { display: block; margin-top: 3px; color: #71857d; font-size: 9px; white-space: nowrap; }
.mechanism-arrow { color: #52716a; font-size: 17px; }

.control-column { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 18px 0; scrollbar-width: thin; scrollbar-color: #29413e transparent; }
.control-column::-webkit-scrollbar { width: 5px; }
.control-column::-webkit-scrollbar-thumb { background: #29413e; border-radius: 10px; }
.panel { background: linear-gradient(145deg, rgba(19,36,40,.96), rgba(14,28,32,.96)); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; margin-bottom: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.09); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 15px; font-weight: 640; letter-spacing: -.025em; }
.state-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; border: 1px solid rgba(108,199,154,.2); background: rgba(83,174,130,.08); padding: 5px 8px; color: #91d7ac; font-size: 8px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.state-pill i { width: 5px; height: 5px; border-radius: 50%; background: #76d39f; box-shadow: 0 0 7px #76d39f; }
.state-pill.paused { color: #d6b982; border-color: rgba(214,185,130,.2); background: rgba(214,185,130,.08); }
.state-pill.paused i { background: #d6b982; box-shadow: none; }
.preset-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 13px; }
.preset-button { min-height: 32px; padding: 4px 5px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.018); color: #8ea19a; font-size: 9px; line-height: 1.25; cursor: pointer; transition: .18s ease; }
.preset-button:hover { border-color: rgba(126,210,193,.35); color: #d2e5db; }
.preset-button.active { color: #bfe6d8; background: rgba(70,157,142,.12); border-color: rgba(126,210,193,.35); }
.control-list { display: grid; gap: 10px; }
.control-item { padding-bottom: 1px; }
.control-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.control-label label { color: #b9c8c0; font-size: 10px; font-weight: 560; }
.control-label output { color: #d5e4da; font-size: 10px; font-weight: 690; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 13px; margin: 0; appearance: none; background: transparent; cursor: pointer; accent-color: var(--teal); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, #3d9b8e, #b2c7a9); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, #3d9b8e, #b2c7a9); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; margin-top: -4.5px; border: 2px solid #d9f0e4; background: #4da99a; box-shadow: 0 0 0 3px rgba(77,169,154,.14); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #d9f0e4; background: #4da99a; box-shadow: 0 0 0 3px rgba(77,169,154,.14); }
.range-ends { display: flex; justify-content: space-between; color: #617770; font-size: 8px; margin-top: -1px; }
.time-control { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 11px; }
.transport-controls { display: grid; grid-template-columns: 1.15fr .85fr .85fr; gap: 6px; margin-top: 12px; }
.transport-button { height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.025); color: #b8c8bf; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: 10px; font-weight: 650; transition: .18s ease; }
.transport-button:hover { border-color: rgba(126,210,193,.4); background: rgba(126,210,193,.07); }
.transport-button.primary { background: #2d887e; color: #f0fbf5; border-color: #3d9e91; box-shadow: 0 5px 18px rgba(45,136,126,.15); }
.transport-button.primary:hover { background: #36988c; }
.transport-button span:first-child { font-size: 13px; }
.reset-button { color: #c1b397; }

.compact-heading { margin-bottom: 10px; }
.compact-heading h2 { font-size: 14px; }
.data-tag { color: #7f9a8f; font-size: 8px; font-weight: 800; letter-spacing: .1em; border: 1px solid rgba(126,210,193,.16); border-radius: 5px; padding: 4px 6px; white-space: nowrap; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.readout-card { min-height: 74px; padding: 10px; border-radius: 9px; border: 1px solid rgba(174,204,190,.09); background: rgba(4,16,18,.27); display: flex; flex-direction: column; justify-content: space-between; }
.readout-name { color: #799088; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.readout-card strong { margin-top: 5px; color: #e0e9df; font-size: 21px; line-height: 1; font-weight: 570; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout-card small { margin-top: 4px; color: #687e76; font-size: 8px; }
.deposit-progress { margin-top: 12px; }
.deposit-progress > div:first-child { display: flex; align-items: center; justify-content: space-between; color: #80958d; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.deposit-progress b { color: #d3d9c6; font-size: 10px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; margin-top: 7px; border-radius: 5px; overflow: hidden; background: rgba(255,255,255,.07); }
.progress-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #5ba99c, #d2c49d); transition: width .18s linear; }
.deposit-progress > small { display: block; margin-top: 6px; color: #687e76; font-size: 8px; }

.validation-panel { padding-bottom: 12px; }
.validation-check { color: #8dd0a8; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.validation-copy { margin: -2px 0 10px; color: #849891; font-size: 9px; line-height: 1.5; }
.validation-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.validation-values > div { padding: 8px 6px; background: rgba(4,16,18,.26); border: 1px solid rgba(174,204,190,.08); border-radius: 7px; min-width: 0; }
.validation-values small { display: block; color: #6f877e; font-size: 7px; font-weight: 800; letter-spacing: .08em; white-space: nowrap; }
.validation-values b { display: block; margin-top: 5px; color: #d9e4d9; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.validation-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; color: #70877e; font-size: 8px; }

.science-panel { padding: 0; overflow: hidden; }
.science-panel summary { list-style: none; min-height: 55px; display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { display: flex; flex-direction: column; gap: 3px; }
.science-panel summary b { font-size: 13px; font-weight: 640; }
.details-chevron { color: #89a79b; font-size: 19px; transition: transform .2s ease; }
.science-panel[open] .details-chevron { transform: rotate(180deg); }
.science-content { padding: 0 15px 14px; border-top: 1px solid var(--line); }
.science-content h3 { margin: 13px 0 5px; color: #c6d6ca; font-size: 10px; letter-spacing: .025em; }
.science-content p, .science-content li { color: #8da097; font-size: 9px; line-height: 1.6; }
.science-content p { margin: 4px 0 7px; }
.science-content ul { padding-left: 16px; margin: 6px 0; }
.science-content li { margin: 3px 0; }
.equation { margin: 6px 0; padding: 8px 9px; border-left: 2px solid #579e8f; border-radius: 0 6px 6px 0; background: rgba(83,153,139,.08); color: #d1e0d4; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; overflow-wrap: anywhere; }
.disclaimer { padding-top: 9px; border-top: 1px solid var(--line); color: #9db8a9 !important; font-style: italic; }
.panel-footnote { padding: 4px 3px 10px; color: #60756e; font-size: 8px; letter-spacing: .1em; text-align: center; }
.footer { height: 30px; flex: 0 0 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 23px; border-top: 1px solid var(--line); color: #526b63; font-size: 8px; font-weight: 750; letter-spacing: .13em; }
.footer i { color: #87a79a; font-style: normal; margin: 0 3px; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 344px; padding-left: 14px; }
  .visual-column { padding-right: 12px; }
  .control-column { padding-right: 12px; }
  .mechanism-strip { gap: 10px; }
  .mechanism-step small { font-size: 8px; }
}

@media (max-width: 780px) {
  body { overflow: auto; }
  .app-shell { min-height: 100vh; }
  .topbar { height: 60px; flex-basis: 60px; padding: 0 14px; }
  .top-meta { font-size: 8px; gap: 7px; }
  .seed-label, .meta-divider { display: none; }
  .brand-lockup h1 { font-size: 15px; }
  .workspace { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 0 12px; gap: 0; }
  .visual-column { padding: 0; min-height: 0; }
  .scene-toolbar { flex-basis: 52px; }
  .scene-stage { height: min(58vh, 470px); min-height: 340px; flex: none; border-radius: 13px; }
  .scene-title strong { font-size: 12px; }
  .caption-source { top: 22%; left: 4%; }
  .caption-degas { left: 39%; top: 42%; }
  .caption-calcite { right: 3%; bottom: 24%; }
  .scene-caption { font-size: 7px; }
  .orientation-cube { transform: scale(.82); transform-origin: top right; right: 9px; top: 9px; }
  .scene-bottomline { left: 10px; bottom: 10px; gap: 9px; font-size: 7px; }
  .mechanism-strip { min-height: 65px; flex-basis: 65px; gap: 7px; justify-content: space-between; }
  .mechanism-step { gap: 6px; }
  .step-number { width: 22px; height: 22px; border-radius: 6px; font-size: 8px; }
  .mechanism-step b { font-size: 8px; }
  .mechanism-step small { font-size: 7px; white-space: normal; max-width: 86px; }
  .mechanism-arrow { font-size: 13px; }
  .control-column { overflow: visible; padding: 12px 0 16px; }
  .panel { margin-bottom: 9px; }
  .control-list { gap: 12px; }
  .control-item { padding-bottom: 2px; }
  .panel-heading h2 { font-size: 15px; }
  .control-label label { font-size: 11px; }
  .control-label output { font-size: 11px; }
  .preset-button { font-size: 10px; min-height: 35px; }
  .footer { height: 28px; flex-basis: 28px; padding: 0 13px; font-size: 7px; }
}

@media (max-width: 420px) {
  .top-meta { letter-spacing: .08em; }
  .scene-stage { height: 420px; min-height: 360px; }
  .mechanism-strip { gap: 4px; }
  .mechanism-step { gap: 4px; }
  .mechanism-step small { max-width: 78px; font-size: 6.8px; }
  .mechanism-arrow { font-size: 11px; }
  .scene-caption { font-size: 6.5px; letter-spacing: .09em; }
  .caption-degas { left: 38%; }
  .scene-bottomline { gap: 7px; font-size: 6.5px; }
  .panel { padding: 13px; }
  .science-panel { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

.embed-mode .topbar, .embed-mode .footer, .embed-mode .scene-toolbar, .embed-mode .mechanism-strip, .embed-mode .control-column { display: none !important; }
.embed-mode .workspace { display: block; height: 100vh; padding: 0; }
.embed-mode .visual-column { height: 100vh; padding: 0; }
.embed-mode .scene-stage { height: 100%; border: 0; border-radius: 0; }
