:root {
  color-scheme: dark;
  --bg: #06131e;
  --panel: #0b1d2a;
  --panel-2: #102737;
  --line: rgba(151, 203, 219, .13);
  --line-strong: rgba(151, 203, 219, .24);
  --text: #e7f3f5;
  --muted: #8eaab5;
  --faint: #5d7b89;
  --accent: #69e3dc;
  --accent-soft: rgba(105, 227, 220, .13);
  --ice: #b8f4f6;
  --warning: #efc982;
  --danger: #ef8c8c;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(ellipse at 18% -18%, rgba(41, 105, 126, .22), transparent 42%),
    radial-gradient(ellipse at 94% 10%, rgba(31, 91, 112, .12), transparent 35%),
    var(--bg);
  font-size: 13px;
  line-height: 1.45;
}
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-shell { width: min(1480px, 100%); margin: 0 auto; padding: 20px 24px 14px; display: flex; flex-direction: column; gap: 14px; }
.topbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; position: relative; flex: 0 0 auto; border: 1px solid rgba(105,227,220,.3); border-radius: 11px; background: linear-gradient(145deg, rgba(105,227,220,.14), rgba(105,227,220,.025)); }
.brand-mark span { position: absolute; left: 16px; top: 5px; width: 1.5px; height: 22px; background: var(--accent); border-radius: 2px; transform-origin: center; }
.brand-mark span:nth-child(2) { transform: rotate(60deg); }
.brand-mark span:nth-child(3) { transform: rotate(-60deg); }
.eyebrow { color: #79a4b1; font-size: 9px; font-weight: 750; letter-spacing: .17em; line-height: 1.4; }
.eyebrow-dot { display: inline-block; width: 4px; height: 4px; margin: 0 5px 2px; border-radius: 50%; background: var(--accent); }
h1 { margin: 2px 0 0; font-size: clamp(16px, 1.7vw, 20px); line-height: 1.2; font-weight: 650; letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 span { color: #8eabb6; font-weight: 450; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.quality-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(4, 17, 27, .65); }
.quality-btn { border: 0; background: transparent; color: var(--muted); padding: 5px 9px; border-radius: 7px; font-size: 10px; cursor: pointer; }
.quality-btn.active { color: #d9ffff; background: rgba(105,227,220,.14); box-shadow: inset 0 0 0 1px rgba(105,227,220,.16); }
.icon-button { height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(10, 31, 43, .82); color: #c6dfe4; font-size: 11px; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.icon-button:hover { background: rgba(105,227,220,.1); border-color: rgba(105,227,220,.42); transform: translateY(-1px); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 276px; gap: 14px; min-height: 390px; }
.scene-panel, .readout-panel, .control-panel, .science-panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, rgba(15, 39, 54, .96), rgba(8, 25, 37, .98)); box-shadow: 0 12px 36px rgba(0,0,0,.16); }
.scene-panel { position: relative; overflow: hidden; min-width: 0; min-height: 390px; background: #071c2a; isolation: isolate; }
.scene-panel::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; border-radius: inherit; box-shadow: inset 0 0 60px rgba(0, 7, 15, .18); }
#sceneCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.scene-topline { position: absolute; z-index: 2; top: 14px; left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.scene-kicker, .scene-depth { display: flex; align-items: center; gap: 7px; color: #9ebbc5; font-size: 9px; letter-spacing: .13em; font-weight: 700; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(105,227,220,.8); }
.scene-depth { color: #6e919f; font-weight: 600; }
.process-ribbon { position: absolute; z-index: 2; top: 43px; left: 16px; display: flex; align-items: center; gap: 8px; color: rgba(202, 228, 234, .72); font-size: 9px; letter-spacing: .025em; pointer-events: none; }
.process-ribbon span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid rgba(160, 218, 224, .13); border-radius: 7px; background: rgba(5, 21, 32, .55); backdrop-filter: blur(8px); }
.process-ribbon b { color: var(--accent); font-size: 8px; letter-spacing: .08em; }
.process-ribbon i { color: #5b8593; font-style: normal; font-size: 14px; }
.scene-legend { position: absolute; z-index: 2; left: 16px; bottom: 36px; display: flex; align-items: center; gap: 13px; padding: 7px 9px; border: 1px solid rgba(163, 212, 222, .13); border-radius: 8px; background: rgba(4, 17, 27, .55); color: #8ba9b4; font-size: 8px; font-weight: 700; letter-spacing: .1em; backdrop-filter: blur(8px); }
.scene-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.scene-legend i { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.legend-ice { background: #b8f4f6; box-shadow: 0 0 7px rgba(184,244,246,.65); }
.legend-brine { background: #1b708b; }
.legend-flow { background: #6de5dc; border-radius: 50% !important; }
.scene-footer { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 12px; display: flex; justify-content: space-between; color: #5f8190; font-size: 8px; font-weight: 700; letter-spacing: .11em; pointer-events: none; }
.scene-footer b, .page-foot b { color: var(--accent); padding: 0 3px; }
.readout-panel { padding: 17px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.panel-heading h2, .controls-head h2 { margin: 3px 0 0; font-size: 15px; font-weight: 630; letter-spacing: -.025em; }
.instrument-mark { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid rgba(105,227,220,.22); border-radius: 9px; color: var(--accent); font-size: 20px; background: rgba(105,227,220,.07); }
.readout-card { position: relative; min-width: 0; padding: 10px 11px 9px; border: 1px solid rgba(150, 200, 215, .1); border-radius: 11px; background: rgba(4, 20, 31, .47); }
.primary-readout { border-color: rgba(105,227,220,.22); background: linear-gradient(115deg, rgba(16, 58, 70, .52), rgba(5, 24, 36, .65)); }
.readout-label { display: flex; align-items: center; justify-content: space-between; color: #8ba9b4; font-size: 8px; font-weight: 750; letter-spacing: .13em; }
.unit-tag { color: #557987; font-size: 8px; letter-spacing: .04em; }
.readout-value { margin-top: 3px; color: #e5f6f7; font-size: 25px; font-weight: 620; letter-spacing: -.05em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.readout-value small { color: #8db1bb; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.readout-note { margin-top: 3px; color: #668895; font-size: 9px; }
.meter-track { height: 3px; margin-top: 8px; border-radius: 9px; background: rgba(137, 190, 203, .12); overflow: hidden; }
.meter-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #45b9bd, #a5f2e9); box-shadow: 0 0 10px rgba(105,227,220,.5); transition: width .35s ease; }
.check-card { margin-top: auto; padding: 10px 11px; border: 1px solid rgba(105,227,220,.2); border-radius: 11px; background: rgba(31, 88, 89, .12); }
.check-head { display: flex; align-items: center; gap: 7px; color: #8bcac8; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.check-icon { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 5px; color: #062b2d; background: var(--accent); font-size: 10px; font-weight: 900; }
.check-values { display: flex; align-items: baseline; gap: 7px; margin-top: 6px; color: #e0f5f3; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.check-values b { color: #5e8c92; font-size: 9px; font-weight: 500; }
.check-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; color: #648b91; font-size: 8px; }
.check-foot strong { color: var(--accent); font-size: 9px; font-variant-numeric: tabular-nums; }
.control-panel { padding: 14px 16px 12px; }
.controls-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.controls-head h2 { font-size: 14px; }
.preset-group { display: flex; align-items: center; gap: 5px; }
.preset-btn { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: #91adb7; background: rgba(4, 19, 29, .45); font-size: 9px; cursor: pointer; transition: border-color .2s, background .2s, color .2s; white-space: nowrap; }
.preset-btn span { color: #688895; }
.preset-btn.active { color: #d8f7f5; border-color: rgba(105,227,220,.36); background: rgba(105,227,220,.1); }
.preset-btn.active span { color: #86c8c5; }
.sliders-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 13px; }
.control { display: block; min-width: 0; cursor: pointer; }
.control-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; color: #aac1c8; font-size: 10px; }
.control-top output { color: #d6eeee; font-size: 10px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.control input[type="range"] { display: block; width: 100%; height: 16px; margin: 7px 0 3px; appearance: none; background: transparent; cursor: ew-resize; }
.control input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 8px; background: linear-gradient(90deg, rgba(105,227,220,.5), rgba(105,227,220,.14)); }
.control input[type="range"]::-moz-range-track { height: 4px; border-radius: 8px; background: linear-gradient(90deg, rgba(105,227,220,.5), rgba(105,227,220,.14)); }
.control input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4px; border: 2px solid #c8ffff; border-radius: 50%; background: #3e9fa2; box-shadow: 0 0 0 3px rgba(105,227,220,.12), 0 0 8px rgba(105,227,220,.4); }
.control input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #c8ffff; border-radius: 50%; background: #3e9fa2; box-shadow: 0 0 0 3px rgba(105,227,220,.12), 0 0 8px rgba(105,227,220,.4); }
.range-ends { display: flex; justify-content: space-between; color: #587b88; font-size: 8px; }
.control-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.physics-hint { display: flex; align-items: center; gap: 8px; min-width: 0; color: #87aab4; font-size: 10px; }
.hint-mark { display: grid; place-items: center; width: 17px; height: 17px; flex: 0 0 auto; border: 1px solid rgba(105,227,220,.3); border-radius: 50%; color: var(--accent); font-family: Georgia, serif; font-size: 11px; font-style: italic; }
.transport-controls { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.transport-btn, .play-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 31px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(4, 18, 28, .58); color: #9cb9c2; cursor: pointer; transition: .2s ease; }
.transport-btn { min-width: 32px; padding: 0 8px; font-size: 9px; }
.transport-btn:hover { border-color: rgba(105,227,220,.4); color: var(--accent); }
.transport-btn svg, .play-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.play-btn { min-width: 82px; padding: 0 11px; border-color: rgba(105,227,220,.35); color: #d8ffff; background: rgba(65, 164, 164, .16); font-size: 10px; font-weight: 650; }
.play-btn:hover { background: rgba(65, 164, 164, .25); }
.science-panel { overflow: hidden; }
.science-panel summary { display: flex; align-items: center; gap: 9px; min-height: 39px; padding: 0 15px; list-style: none; cursor: pointer; color: #c4dce1; font-size: 10px; font-weight: 650; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; color: var(--accent); background: rgba(105,227,220,.1); font-size: 12px; }
.science-summary { color: #6e8f9b; font-weight: 450; }
.summary-chevron { margin-left: auto; color: #79a1ac; font-size: 16px; transition: transform .2s; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 14px 15px 16px; border-top: 1px solid var(--line); }
.science-block h3 { margin: 0 0 6px; color: #b9d9de; font-size: 10px; font-weight: 650; }
.science-block p { margin: 0 0 7px; color: #7798a4; font-size: 9px; line-height: 1.55; }
.science-block code { display: block; margin-top: 5px; padding: 5px 6px; border-radius: 5px; background: rgba(2, 14, 23, .6); color: #8dd7d2; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 8px; line-height: 1.5; overflow-wrap: anywhere; }
.constants-line { color: #9bb9c2 !important; }
.science-block .disclaimer { margin-top: 7px; color: #a3c9ca; font-style: italic; }
.page-foot { display: flex; justify-content: space-between; gap: 12px; padding: 0 3px; color: #4d707d; font-size: 8px; font-weight: 700; letter-spacing: .12em; }

@media (max-width: 1050px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .main-grid { grid-template-columns: minmax(0, 1fr) 245px; }
  .readout-panel { padding: 13px; }
  .sliders-grid { gap: 9px; }
  .control-top { font-size: 9px; }
  .control-top output { font-size: 9px; }
}
@media (max-width: 760px) {
  .app-shell { gap: 10px; padding: 12px 12px 10px; }
  .topbar { min-height: 40px; gap: 8px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 9px; }
  .brand-mark span { left: 13px; top: 4px; height: 19px; }
  h1 { max-width: 54vw; font-size: 15px; }
  h1 span { display: none; }
  .eyebrow { font-size: 8px; }
  .top-actions { gap: 6px; }
  .quality-switch { padding: 2px; }
  .quality-btn { padding: 4px 6px; font-size: 9px; }
  .icon-button { width: 34px; padding: 0; justify-content: center; }
  .icon-button span { display: none; }
  .main-grid { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
  .scene-panel { height: clamp(250px, 37vh, 340px); min-height: 250px; flex: 0 0 auto; border-radius: 13px; }
  .scene-topline { top: 10px; left: 11px; right: 11px; }
  .scene-kicker, .scene-depth { font-size: 8px; }
  .process-ribbon { top: 35px; left: 10px; gap: 4px; }
  .process-ribbon span { gap: 4px; padding: 4px 5px; font-size: 7px; }
  .process-ribbon b { font-size: 7px; }
  .process-ribbon i { font-size: 11px; }
  .scene-legend { left: 10px; bottom: 32px; gap: 8px; padding: 6px 7px; font-size: 7px; }
  .scene-footer { left: 11px; right: 11px; bottom: 10px; font-size: 7px; }
  .readout-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .panel-heading { display: none; }
  .readout-card { padding: 7px 7px 6px; border-radius: 9px; }
  .readout-label { font-size: 7px; letter-spacing: .08em; }
  .readout-value { font-size: 17px; margin-top: 4px; }
  .readout-value small { font-size: 8px; }
  .readout-note { font-size: 7px; line-height: 1.25; }
  .meter-track { margin-top: 5px; height: 2px; }
  .check-card { grid-column: 1 / -1; margin: 0; padding: 7px 9px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
  .check-head { font-size: 7px; white-space: nowrap; }
  .check-icon { width: 13px; height: 13px; font-size: 9px; }
  .check-values { margin: 0; justify-content: center; font-size: 11px; }
  .check-foot { margin: 0; display: block; text-align: right; font-size: 7px; }
  .check-foot strong { display: block; }
  .control-panel { padding: 10px 11px 9px; border-radius: 13px; }
  .controls-head { margin-bottom: 8px; gap: 8px; }
  .controls-head h2 { font-size: 12px; }
  .preset-group { gap: 4px; }
  .preset-btn { padding: 6px 7px; font-size: 8px; }
  .preset-btn span { display: none; }
  .sliders-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
  .control-top { font-size: 8px; gap: 3px; }
  .control-top output { font-size: 8px; }
  .control input[type="range"] { margin: 5px 0 1px; height: 14px; }
  .range-ends { font-size: 7px; }
  .control-foot { margin-top: 7px; padding-top: 7px; gap: 7px; }
  .physics-hint { font-size: 8px; line-height: 1.25; }
  .hint-mark { width: 15px; height: 15px; }
  .transport-controls { gap: 4px; }
  .transport-btn, .play-btn { min-height: 28px; }
  .transport-btn { min-width: 28px; padding: 0 6px; }
  .transport-btn span { display: none; }
  .play-btn { min-width: 69px; padding: 0 7px; font-size: 9px; }
  .science-panel summary { min-height: 34px; padding: 0 11px; font-size: 9px; }
  .science-summary { display: none; }
  .science-content { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  .science-block h3 { font-size: 9px; }
  .science-block p { font-size: 8px; }
  .science-block code { font-size: 7px; }
  .page-foot { font-size: 7px; }
  .page-foot span:last-child { display: none; }
}
@media (max-width: 390px) {
  .readout-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .check-card { grid-column: 1 / -1; }
  .scene-panel { height: 265px; }
  .process-ribbon { gap: 3px; }
  .process-ribbon span { padding: 4px; font-size: 6.5px; }
  .process-ribbon b { font-size: 6px; }
  .scene-legend { gap: 6px; font-size: 6px; }
  .sliders-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls-head { align-items: flex-start; }
  .preset-group { flex-direction: column; align-items: stretch; }
  .control-foot { align-items: flex-end; }
  .physics-hint { max-width: 58%; }
}

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100%; max-height: 100%; overflow: hidden; }
body.embed-mode .main-grid { flex: 1 1 auto; min-height: 0; }
body.embed-mode .scene-panel { min-height: 0; }
body.embed-mode .control-panel { flex: 0 0 auto; }
body.embed-mode .science-panel { flex: 0 0 auto; }
body.embed-mode .page-foot { flex: 0 0 auto; }
@media (max-width: 760px) {
  body.embed-mode .main-grid { flex: 1 1 auto; min-height: 0; }
  body.embed-mode .scene-panel { height: auto; min-height: 0; flex: 1 1 auto; }
  body.embed-mode .readout-panel { flex: 0 0 auto; }
  body.embed-mode .app-shell { gap: 7px; padding: 9px 10px 7px; }
  body.embed-mode .control-panel { padding-top: 8px; padding-bottom: 7px; }
  body.embed-mode .sliders-grid { gap: 5px 9px; }
  body.embed-mode .control input[type="range"] { margin-top: 3px; }
  body.embed-mode .control-foot { margin-top: 5px; padding-top: 5px; }
  body.embed-mode .science-panel summary { min-height: 30px; }
  body.embed-mode .page-foot { display: none; }
}
@media (max-width: 390px) {
  body.embed-mode .main-grid { gap: 5px; }
  body.embed-mode .scene-panel { min-height: 0; }
  body.embed-mode .readout-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.embed-mode .readout-card { padding: 5px 7px; }
  body.embed-mode .readout-value { font-size: 15px; }
  body.embed-mode .check-card { padding: 5px 7px; }
  body.embed-mode .control-panel { padding: 7px 9px 6px; }
  body.embed-mode .controls-head { margin-bottom: 5px; }
  body.embed-mode .sliders-grid { gap: 3px 8px; }
  body.embed-mode .range-ends { display: none; }
  body.embed-mode .control input[type="range"] { height: 12px; margin: 2px 0 0; }
  body.embed-mode .physics-hint { font-size: 7px; }
  body.embed-mode .science-panel summary { min-height: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
