:root {
  color-scheme: dark;
  --bg: #07131b;
  --panel: #0b1b24;
  --panel-2: #0e222c;
  --line: rgba(154, 202, 211, .12);
  --line-strong: rgba(154, 202, 211, .2);
  --text: #e7f1f2;
  --muted: #829da4;
  --faint: #526d76;
  --accent: #78e9df;
  --accent-soft: rgba(120, 233, 223, .12);
  --ice: #d8f7ff;
  --amber: #e3bd83;
  --danger: #e69a8c;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 55% -30%, rgba(35, 91, 105, .19), transparent 52%), var(--bg); }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(6, 17, 24, .94); }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; border: 1px solid rgba(120,233,223,.2); background: #0d2933; object-fit: cover; }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker, .mini-label, .stage-label, .overlay-top-left, .overlay-top-right, .readout-label, .interpretation-heading, .legend-note-title, .footerbar, .science-subhead, .check-title { font-size: 9px; font-weight: 750; letter-spacing: .15em; color: #78959d; }
.eyebrow { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.live-dot, .stamp-dot, .readout-pulse, .state-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(120,233,223,.7); display: inline-block; }
.eyebrow-sep { color: #38525a; }
h1 { font-size: 17px; letter-spacing: -.035em; margin: 3px 0 0; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.model-stamp { display: flex; align-items: center; gap: 8px; color: #78959d; font-size: 9px; letter-spacing: .12em; font-weight: 700; white-space: nowrap; }
.stamp-dot { width: 5px; height: 5px; background: #e3bd83; box-shadow: 0 0 8px rgba(227,189,131,.5); }
.stamp-divider { color: #405c64; }
.icon-button { border: 1px solid var(--line-strong); background: rgba(13,34,43,.8); color: var(--accent); border-radius: 9px; padding: 8px 10px; display: flex; align-items: center; gap: 7px; font-size: 9px; letter-spacing: .1em; font-weight: 800; cursor: pointer; transition: border-color .2s, background .2s; }
.icon-button:hover, .transport:hover, .screenshot-button:hover { border-color: rgba(120,233,223,.55); background: rgba(120,233,223,.08); }
.quality-glyph { font-size: 15px; line-height: 10px; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 274px minmax(0, 1fr) 252px; grid-template-rows: minmax(0, 1fr); gap: 12px; padding: 12px; align-items: stretch; }
.panel, .stage-card, .science-panel { background: linear-gradient(160deg, rgba(13,31,40,.98), rgba(8,23,31,.98)); border: 1px solid var(--line); border-radius: var(--radius); }
.panel { padding: 18px 16px 14px; min-width: 0; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(120,233,223,.22) transparent; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.section-kicker { color: var(--accent); font-size: 8px; margin-bottom: 7px; }
h2 { font-size: 15px; line-height: 1.2; margin: 0; font-weight: 620; letter-spacing: -.025em; }
.class-tag { display: inline-flex; align-items: center; padding: 3px 5px; border-radius: 4px; font-size: 7px; line-height: 1; letter-spacing: .1em; font-weight: 800; white-space: nowrap; }
.class-tag.illustrative { color: #b5a1d7; background: rgba(154,126,201,.12); border: 1px solid rgba(154,126,201,.18); }
.class-tag.textbook { color: #84d5c9; background: rgba(120,233,223,.08); border: 1px solid rgba(120,233,223,.16); }
.panel-intro { font-size: 10px; line-height: 1.55; color: var(--muted); margin: 9px 0 16px; max-width: 220px; }
.preset-block { padding: 11px 0 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mini-label { font-size: 8px; color: var(--faint); margin-bottom: 8px; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset-button { min-width: 0; padding: 9px 7px; border: 1px solid var(--line); background: #0a1a22; border-radius: 8px; font-size: 9px; font-weight: 650; color: #9cb2b8; text-align: left; cursor: pointer; transition: .2s ease; }
.preset-button span { color: #58747c; float: right; }
.preset-button.active { border-color: rgba(120,233,223,.48); background: rgba(120,233,223,.09); color: #d9fbf7; box-shadow: inset 0 0 0 1px rgba(120,233,223,.05); }
.preset-button.active span { color: var(--accent); }
.control-list { padding-top: 12px; display: grid; gap: 12px; }
.control-row { min-width: 0; }
.control-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.control-head label { color: #b6c9cd; font-size: 10px; font-weight: 570; }
.control-head output { color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
input[type=range] { display: block; width: 100%; height: 14px; margin: 0; background: transparent; accent-color: var(--accent); cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 8px; background: linear-gradient(90deg, rgba(120,233,223,.42), rgba(120,233,223,.12)); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 8px; background: linear-gradient(90deg, rgba(120,233,223,.42), rgba(120,233,223,.12)); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; border-radius: 50%; margin-top: -4px; background: var(--accent); border: 2px solid #14313a; box-shadow: 0 0 0 2px rgba(120,233,223,.17); }
input[type=range]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid #14313a; box-shadow: 0 0 0 2px rgba(120,233,223,.17); }
.range-ends { display: flex; justify-content: space-between; color: #5d7780; font-size: 8px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.control-footnote { display: flex; gap: 7px; align-items: flex-start; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 11px; color: #6e8991; font-size: 9px; line-height: 1.45; }
.info-icon { flex: 0 0 13px; height: 13px; border: 1px solid #55727a; border-radius: 50%; display: inline-grid; place-items: center; font-size: 8px; color: #9bb3b8; }
.stage-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 10px; }
.stage-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.stage-topline { flex: 0 0 43px; display: flex; justify-content: space-between; align-items: center; padding: 0 15px; border-bottom: 1px solid var(--line); }
.stage-label { color: #92aab0; font-size: 8px; }
.stage-index { color: var(--accent); font-weight: 900; margin-right: 8px; }
.stage-badges { display: flex; gap: 13px; align-items: center; }
.state-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid rgba(120,233,223,.18); border-radius: 5px; color: var(--accent); background: rgba(120,233,223,.06); font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.state-pill.failed { color: var(--amber); border-color: rgba(227,189,131,.2); background: rgba(227,189,131,.06); }
.state-pill.failed .state-dot { background: var(--amber); box-shadow: 0 0 8px rgba(227,189,131,.5); }
.time-readout { display: flex; align-items: center; gap: 7px; color: #617d85; font-size: 7px; letter-spacing: .12em; }
.time-readout strong { font-size: 10px; color: #c3d6d9; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.canvas-wrap { position: relative; flex: 1; min-height: 220px; overflow: hidden; background: #081a24; }
#scene { display: block; width: 100%; height: 100%; outline: none; }
#scene:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.canvas-overlay { position: absolute; pointer-events: none; color: rgba(174,211,215,.6); font-size: 7px; letter-spacing: .15em; font-weight: 800; }
.overlay-top-left { top: 16px; left: 16px; display: flex; align-items: center; gap: 7px; }
.overlay-line { width: 18px; height: 1px; background: var(--accent); opacity: .7; }
.overlay-top-right { top: 16px; right: 16px; color: rgba(120,233,223,.65); }
.canvas-legend { position: absolute; right: 14px; bottom: 13px; display: flex; gap: 11px; pointer-events: none; color: rgba(187,218,221,.68); font-size: 8px; }
.canvas-legend span { display: flex; align-items: center; gap: 5px; }
.legend-swatch { display: inline-block; width: 6px; height: 6px; border-radius: 2px; }
.legend-swatch.vapor { background: #78e9df; box-shadow: 0 0 7px #78e9df; }
.legend-swatch.brine { background: #e1b77d; }
.legend-swatch.crystal { background: #e8fbff; }
.canvas-hint { position: absolute; bottom: 12px; left: 15px; color: rgba(204,229,231,.65); font-size: 8px; letter-spacing: .03em; pointer-events: none; }
.stage-controls { flex: 0 0 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-top: 1px solid var(--line); background: rgba(6,18,25,.74); }
.transport-controls { display: flex; gap: 6px; align-items: center; }
.transport, .screenshot-button { border: 1px solid var(--line-strong); background: rgba(11,29,38,.9); border-radius: 7px; padding: 7px 10px; color: #91aab0; font-size: 8px; font-weight: 800; letter-spacing: .08em; cursor: pointer; transition: border-color .2s, background .2s; }
.transport.primary { color: #d6f7f3; border-color: rgba(120,233,223,.35); background: rgba(120,233,223,.09); min-width: 74px; letter-spacing: .02em; display: flex; align-items: center; justify-content: center; gap: 7px; }
.transport.primary span:first-child { font-size: 10px; }
.transport span { color: var(--accent); font-size: 11px; margin-left: 4px; }
.screenshot-button { color: #a8c0c5; letter-spacing: .03em; font-weight: 650; }
.screenshot-button span { color: var(--accent); margin-right: 5px; font-size: 12px; }
.science-panel { flex: 0 0 auto; overflow: hidden; }
.science-panel summary { min-height: 52px; display: flex; align-items: center; gap: 11px; padding: 8px 15px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid rgba(120,233,223,.2); border-radius: 7px; color: var(--accent); background: rgba(120,233,223,.07); font-size: 14px; }
.science-panel summary strong { display: block; font-size: 10px; font-weight: 650; }
.science-panel summary small { display: block; margin-top: 2px; font-size: 8px; color: #718d95; }
.summary-chevron { margin-left: auto; color: #7b989f; font-size: 16px; transition: transform .2s; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 15px; }
.science-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.science-subhead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 8px; }
.science-content p { color: #9ab0b5; font-size: 9px; line-height: 1.5; margin: 7px 0 4px; }
.science-content p b { color: #cbdcde; font-weight: 650; }
.science-content code { display: block; color: #8de3d9; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; line-height: 1.55; white-space: normal; overflow-wrap: anywhere; background: rgba(4,15,21,.55); border: 1px solid var(--line); border-radius: 5px; padding: 6px 7px; }
.science-content ul { margin: 0; padding-left: 14px; color: #91a8ad; font-size: 9px; line-height: 1.55; }
.science-content li { margin-bottom: 5px; }
.check-card { margin-top: 13px; border: 1px solid rgba(120,233,223,.18); border-radius: 8px; background: rgba(120,233,223,.035); padding: 10px; }
.check-title { display: flex; align-items: center; gap: 6px; color: #a5c7c8; font-size: 7px; }
.check-mark { color: var(--accent); font-size: 12px; }
.check-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.check-values small { display: block; color: #66858c; font-size: 6px; letter-spacing: .09em; line-height: 1.4; min-height: 16px; }
.check-values strong { display: block; margin-top: 2px; color: #d9f3f2; font-size: 11px; font-variant-numeric: tabular-nums; }
.check-card p { margin: 8px 0 0; font-size: 8px; color: #728f96; }
.disclaimer { color: #6f8990 !important; font-size: 8px !important; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 13px !important; }
.insights-panel { display: flex; flex-direction: column; gap: 14px; }
.insight-heading { align-items: center; }
.readout-pulse { width: 7px; height: 7px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; border: 1px solid var(--line); background: rgba(6,20,28,.68); border-radius: 9px; padding: 11px 9px 9px; }
.readout-card.featured { grid-column: 1 / -1; padding: 12px 11px 10px; background: linear-gradient(135deg, rgba(31,83,88,.2), rgba(7,23,31,.75)); border-color: rgba(120,233,223,.2); }
.readout-label { font-size: 7px; letter-spacing: .1em; color: #819ca2; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.readout-label .class-tag { font-size: 6px; padding: 2px 4px; }
.readout-number { display: flex; align-items: baseline; gap: 4px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.readout-number strong { font-size: 22px; line-height: 1; font-weight: 620; letter-spacing: -.05em; color: #e4f5f4; }
.readout-number span { color: #8aa7ad; font-size: 9px; }
.featured .readout-number strong { font-size: 27px; color: var(--accent); }
.readout-track { height: 3px; border-radius: 5px; background: rgba(120,233,223,.1); margin-top: 10px; overflow: hidden; }
.readout-track i { display: block; width: 50%; height: 100%; background: var(--accent); border-radius: inherit; box-shadow: 0 0 8px rgba(120,233,223,.5); transition: width .25s ease; }
.readout-foot { margin-top: 7px; color: #6f8a91; font-size: 8px; line-height: 1.35; }
.interpretation-card { border: 1px solid rgba(120,233,223,.16); background: linear-gradient(145deg, rgba(21,56,62,.25), rgba(7,21,29,.72)); border-radius: 10px; padding: 12px 11px; }
.interpretation-heading { display: flex; align-items: center; gap: 7px; color: #9ab9bb; font-size: 7px; }
.interpretation-icon { color: var(--accent); font-size: 13px; }
.interpretation-card p { margin: 9px 0 12px; color: #d0e0e1; font-size: 10px; line-height: 1.5; min-height: 45px; }
.mechanism-flow { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding-top: 9px; border-top: 1px solid var(--line); }
.mechanism-step { display: flex; flex-direction: column; gap: 3px; color: #8ea8ad; font-size: 7px; white-space: nowrap; }
.mechanism-number { color: var(--accent); font-size: 7px; letter-spacing: .1em; }
.flow-arrow { color: #526f77; font-size: 10px; }
.legend-note { padding: 11px 10px; border-radius: 8px; background: rgba(4,16,23,.46); border: 1px solid var(--line); }
.legend-note-title { display: flex; align-items: center; gap: 7px; font-size: 7px; }
.legend-note p { color: #7f9aa1; font-size: 8px; line-height: 1.55; margin: 8px 0 0; }
.footerbar { min-height: 28px; display: flex; justify-content: space-between; align-items: center; padding: 0 24px; border-top: 1px solid var(--line); font-size: 7px; color: #49636c; }
.footer-right { display: flex; align-items: center; gap: 8px; }
.footer-right i { width: 5px; height: 5px; border-radius: 50%; background: #6b9f91; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.embed-mode .workspace { min-height: 0; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 245px minmax(0, 1fr); grid-template-rows: minmax(440px, 1fr) auto; }
  .insights-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 180px minmax(0, 1fr) minmax(220px, .8fr); align-items: start; }
  .insight-heading { align-self: start; }
  .readout-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .readout-card.featured { grid-column: auto; }
  .interpretation-card { min-height: 100%; }
  .legend-note { display: none; }
}
@media (max-width: 720px) {
  .topbar { min-height: 60px; padding: 0 12px; }
  .brand-mark { width: 32px; height: 32px; }
  h1 { font-size: 14px; }
  .eyebrow { font-size: 7px; gap: 5px; }
  .model-stamp { display: none; }
  .topbar-right { gap: 8px; }
  .workspace { display: flex; flex-direction: column; gap: 9px; padding: 9px; overflow: auto; }
  .stage-column { order: 0; flex: 0 0 auto; }
  .workspace > .controls-panel, .workspace > .insights-panel { flex: 0 0 auto; }
  .stage-card { height: clamp(285px, 43dvh, 370px); flex: 0 0 auto; }
  .canvas-wrap { min-height: 180px; }
  .stage-topline { flex-basis: 39px; padding: 0 10px; }
  .stage-label { font-size: 7px; }
  .stage-badges { gap: 7px; }
  .canvas-overlay { font-size: 6px; }
  .overlay-top-left { top: 11px; left: 10px; }
  .overlay-top-right { top: 11px; right: 10px; }
  .canvas-legend { right: 9px; bottom: 9px; gap: 7px; font-size: 7px; }
  .canvas-hint { left: 10px; bottom: 10px; max-width: 48%; font-size: 7px; }
  .stage-controls { flex-basis: 45px; padding: 0 8px; }
  .transport, .screenshot-button { padding: 7px 8px; font-size: 7px; }
  .transport.primary { min-width: 66px; }
  .science-grid { grid-template-columns: 1fr; }
  .science-content { padding: 12px; }
  .controls-panel { order: 1; padding: 14px 13px; }
  .insights-panel { order: 2; display: flex; padding: 14px 13px; }
  .readout-grid { grid-template-columns: 1fr 1fr; }
  .readout-card.featured { grid-column: 1 / -1; }
  .interpretation-card { min-height: auto; }
  .legend-note { display: block; }
  .footerbar { min-height: 26px; padding: 0 12px; font-size: 6px; }
  .footerbar span:nth-child(2) { display: none; }
  body.embed-mode .workspace { overflow-y: auto; overscroll-behavior: contain; }
}
@media (max-width: 390px) {
  .stage-card { height: 300px; }
  .brand-lockup { gap: 8px; }
  .brand-mark { width: 29px; height: 29px; }
  h1 { font-size: 13px; }
  .icon-button { padding: 7px 8px; }
  .preset-button { font-size: 8px; }
  .readout-number strong { font-size: 20px; }
  .featured .readout-number strong { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.constant-note { color: #9a8fc1 !important; font-size: 8px !important; }
