:root {
  color-scheme: dark;
  --bg: #07131e;
  --panel: #0b1b28;
  --panel-2: #0e2231;
  --line: rgba(156, 204, 220, 0.14);
  --line-strong: rgba(156, 204, 220, 0.24);
  --text: #e9f4f7;
  --muted: #8da7b2;
  --muted-2: #607c89;
  --accent: #69e1e2;
  --accent-dim: rgba(105, 225, 226, 0.12);
  --ice: #c8f4fb;
  --danger: #d8a68b;
  --radius: 12px;
  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 { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body { color: var(--text); }
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 68px minmax(0, 1fr); min-width: 0; overflow: hidden; background: radial-gradient(ellipse at 20% 0%, rgba(26, 75, 91, .18), transparent 48%), var(--bg); }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(6, 18, 28, .88); min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; position: relative; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; position: absolute; width: 2px; height: 26px; border-radius: 4px; background: var(--accent); opacity: .92; }
.brand-mark::before { transform: rotate(0deg); }
.brand-mark::after { transform: rotate(60deg); }
.brand-mark span:nth-child(1) { transform: rotate(120deg); }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { display: none; }
.brand-mark::before { box-shadow: 0 0 12px rgba(105,225,226,.28); }
.eyebrow { color: var(--muted-2); font-size: 9px; line-height: 1.3; letter-spacing: .17em; font-weight: 800; }
.eyebrow-divider { color: var(--accent); padding: 0 5px; }
.brand-copy h1 { margin: 3px 0 0; font-size: 15px; line-height: 1; letter-spacing: .15em; font-weight: 800; }
.brand-copy h1 span { color: #9ab7c1; font-weight: 500; }
.topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; letter-spacing: .13em; font-weight: 700; white-space: nowrap; }
.live-indicator, .run-state-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(105,225,226,.7); }
.topbar-separator { height: 14px; width: 1px; background: var(--line-strong); margin: 0 3px; }
.format-chip { border: 1px solid var(--line-strong); border-radius: 5px; padding: 5px 8px; color: #a7c2cb; font-size: 8px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 366px; min-height: 0; min-width: 0; }
.visual-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 38px minmax(0, 1fr) 76px; padding: 0 20px 18px 24px; position: relative; overflow: hidden; }
.stage-topline { display: flex; align-items: center; justify-content: space-between; padding: 0 7px; color: var(--muted); font-size: 9px; letter-spacing: .15em; font-weight: 800; }
.stage-index { color: var(--accent); margin-right: 8px; }
.scale-note { color: var(--muted-2); font-size: 8px; }
.micro-tag { color: #6f9aa8; font-size: 7px; font-style: normal; letter-spacing: .1em; font-weight: 800; white-space: nowrap; }
.canvas-wrap { min-height: 0; min-width: 0; position: relative; overflow: hidden; border: 1px solid rgba(142, 203, 218, .15); border-radius: 13px; background: #071d2b; box-shadow: 0 18px 70px rgba(0,0,0,.23), inset 0 0 60px rgba(34,93,113,.08); }
#scene { display: block; width: 100%; height: 100%; }
.scene-status { position: absolute; top: 15px; left: 16px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(159,216,227,.16); background: rgba(7,22,33,.72); border-radius: 999px; padding: 7px 10px; color: #b7d2db; font-size: 9px; letter-spacing: .06em; backdrop-filter: blur(10px); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.scene-status.failed .status-dot { background: var(--danger); box-shadow: 0 0 10px rgba(216,166,139,.5); }
.scene-annotation { position: absolute; color: rgba(197,229,236,.58); font-size: 8px; font-weight: 800; letter-spacing: .17em; pointer-events: none; }
.annotation-line { display: inline-block; width: 18px; height: 1px; background: rgba(105,225,226,.5); vertical-align: middle; margin-right: 7px; }
.annotation-ice { top: 19%; left: 8%; }
.annotation-water { top: 44%; right: 7%; }
.annotation-core { top: 55%; left: 58%; opacity: 0; transition: opacity .3s ease; }
.annotation-core.visible { opacity: 1; }
.scale-ruler { position: absolute; right: 17px; bottom: 80px; display: flex; align-items: center; gap: 6px; color: rgba(181,220,230,.65); font-size: 8px; writing-mode: horizontal-tb; }
.ruler-top, .ruler-bottom { width: 1px; height: 9px; background: rgba(105,225,226,.65); }
.ruler-label { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.ruler-label i { color: var(--muted-2); font-size: 6px; font-style: normal; letter-spacing: .08em; }
.scene-legend { position: absolute; left: 16px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 13px; padding: 8px 10px; background: rgba(7,22,33,.68); border: 1px solid rgba(159,216,227,.12); border-radius: 7px; color: #9cbac5; font-size: 8px; backdrop-filter: blur(8px); }
.scene-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.scene-legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.legend-ice { background: #c8f4fb; box-shadow: 0 0 7px rgba(200,244,251,.5); }
.legend-brine { background: #287d9d; }
.legend-current { background: var(--accent); }
.process-strip { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2vw, 25px); padding: 0 10px; }
.process-step { display: flex; align-items: center; gap: 9px; opacity: .45; transition: opacity .25s ease; min-width: 0; }
.process-step.active { opacity: 1; }
.process-number { width: 23px; height: 23px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(105,225,226,.3); border-radius: 50%; color: var(--accent); font-size: 8px; font-weight: 800; }
.process-step.active .process-number { background: var(--accent-dim); box-shadow: 0 0 14px rgba(105,225,226,.1); }
.process-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.process-copy b { color: #c7dce2; font-size: 8px; letter-spacing: .1em; white-space: nowrap; }
.process-copy small { color: var(--muted-2); font-size: 8px; white-space: nowrap; }
.process-connector { width: clamp(8px, 2vw, 28px); height: 1px; background: var(--line-strong); flex: 0 0 auto; }

.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(13,32,46,.98), rgba(8,23,34,.98)); padding: 19px 18px 12px; scrollbar-width: thin; scrollbar-color: #294657 transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #294657; border-radius: 5px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.03em; font-weight: 650; }
.run-state { display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.run-state.paused { color: #91aab5; }
.run-state.paused .run-state-dot { background: #8299a3; box-shadow: none; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; min-height: 72px; border: 1px solid var(--line); background: rgba(14,36,51,.72); border-radius: 8px; padding: 9px 10px 8px; }
.readout-heat { grid-column: 1 / -1; min-height: 53px; display: grid; grid-template-columns: 1fr auto; align-items: center; padding-top: 7px; padding-bottom: 7px; }
.readout-heat .readout-label { grid-column: 1; }
.readout-heat .readout-value { grid-column: 2; grid-row: 1 / 3; margin: 0; font-size: 19px; }
.readout-heat .readout-foot { grid-column: 1; margin-top: 2px; }
.readout-primary { border-color: rgba(105,225,226,.28); background: linear-gradient(135deg, rgba(23,75,87,.35), rgba(14,36,51,.76)); }
.readout-label { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: var(--muted); font-size: 7px; letter-spacing: .1em; font-weight: 800; white-space: nowrap; }
.readout-value { margin-top: 7px; font-size: 22px; line-height: 1; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: #eaf7f9; white-space: nowrap; }
.readout-primary .readout-value { color: var(--accent); }
.readout-value small { color: #9bb7c1; font-size: 10px; letter-spacing: 0; font-weight: 500; }
.readout-foot { margin-top: 5px; color: var(--muted-2); font-size: 8px; }
.caption-card { margin-top: 10px; padding: 10px 12px 11px; border-left: 2px solid var(--accent); background: rgba(105,225,226,.055); border-radius: 0 7px 7px 0; }
.caption-eyebrow { display: flex; align-items: center; gap: 7px; color: #8bb8c3; font-size: 7px; letter-spacing: .15em; font-weight: 800; }
.caption-pulse { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.caption-card p { margin: 6px 0 0; color: #c2d7de; font-size: 10px; line-height: 1.5; }
.conditions-section { margin-top: 17px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-heading h3 { margin: 0; font-size: 11px; font-weight: 750; letter-spacing: .02em; }
.section-heading > span { color: var(--muted-2); font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.section-heading > span i { color: #6f9aa8; font-style: normal; }
.control-row { margin: 0 0 12px; }
.control-label-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.control-label-line label { color: #c2d5dc; font-size: 9px; font-weight: 600; }
.control-label-line output { color: var(--accent); font-size: 9px; font-weight: 750; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(105,225,226,.68), rgba(105,225,226,.18)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(105,225,226,.68), rgba(105,225,226,.18)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #071923; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(105,225,226,.65), 0 0 9px rgba(105,225,226,.25); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #071923; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(105,225,226,.65); }
.range-ends { display: flex; justify-content: space-between; margin-top: 2px; color: #587582; font-size: 7px; font-variant-numeric: tabular-nums; }
.restart-note { margin: 0; color: #67838f; font-size: 8px; }
.preset-section { margin-top: 17px; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 49px; padding: 8px; text-align: left; border: 1px solid var(--line); border-radius: 7px; background: rgba(14,36,51,.52); color: var(--text); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: rgba(105,225,226,.4); }
.preset-button.active { border-color: rgba(105,225,226,.4); background: rgba(105,225,226,.08); }
.preset-icon { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 6px; color: var(--accent); background: rgba(105,225,226,.1); font-size: 14px; }
.preset-failed { color: #b9a59b; background: rgba(185,165,155,.1); }
.preset-button b { display: block; font-size: 8px; font-weight: 750; white-space: nowrap; }
.preset-button small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 7px; line-height: 1.2; }
.transport-section { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.transport-buttons { display: grid; grid-template-columns: 1.35fr 1fr 34px 34px; gap: 6px; }
.transport-buttons button { height: 34px; border-radius: 6px; cursor: pointer; }
.transport-main { display: flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid rgba(105,225,226,.45); background: var(--accent); color: #06202b; font-size: 9px; font-weight: 850; }
.transport-main:hover { background: #8af0ef; }
.play-symbol { font-size: 12px; line-height: 1; }
.transport-secondary { border: 1px solid var(--line-strong); background: rgba(17,43,59,.72); color: #c1d5dc; font-size: 8px; font-weight: 800; letter-spacing: .04em; }
.transport-secondary:hover { border-color: rgba(105,225,226,.4); color: var(--accent); }
.transport-secondary span { color: var(--muted); font-weight: 500; }
.icon-button { font-size: 17px; }
.transport-meta { display: flex; justify-content: space-between; margin-top: 8px; color: #64818d; font-size: 7px; letter-spacing: .1em; }
.transport-meta b { color: #a7c1ca; font-weight: 750; margin-left: 4px; }
.quality-section { display: flex; justify-content: space-between; align-items: center; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.quality-section label { color: #9ab2bc; font-size: 8px; font-weight: 650; }
.quality-section label span { display: block; margin-top: 3px; color: #587582; font-size: 6px; letter-spacing: .12em; }
.quality-section select { min-width: 83px; padding: 6px 25px 6px 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: #102838; color: #c7dce2; font-size: 8px; }
.science-panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(12,31,44,.72); }
.science-panel summary { display: flex; justify-content: space-between; align-items: center; min-height: 35px; padding: 0 11px; color: #c9dce2; font-size: 9px; font-weight: 750; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-chevron { color: var(--accent); font-size: 15px; transition: transform .2s ease; }
.science-panel[open] .science-chevron { transform: rotate(180deg); }
.science-content { padding: 0 11px 12px; color: #9bb4bd; font-size: 9px; line-height: 1.5; }
.science-content h4 { margin: 12px 0 5px; color: #d0e2e7; font-size: 9px; letter-spacing: .03em; }
.science-content p { margin: 5px 0 8px; }
.equation-card { padding: 8px; margin-top: 6px; border: 1px solid rgba(156,204,220,.1); border-radius: 5px; background: rgba(3,15,24,.32); }
.equation-card b { display: block; color: #b8d3dc; font-size: 8px; }
.equation-card code { display: block; margin: 5px 0 3px; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; white-space: normal; overflow-wrap: anywhere; }
.equation-card small { color: #718d98; font-size: 7px; }
.constant-list { list-style: none; padding: 0; margin: 6px 0 0; }
.constant-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 4px 0; border-bottom: 1px solid rgba(156,204,220,.07); font-size: 8px; }
.disclaimer { margin-top: 12px; padding: 8px; border-left: 2px solid var(--accent); background: rgba(105,225,226,.06); color: #b5d2d9; font-size: 8px; }
.source-note { color: #66828d; font-size: 7px; }
.check-strip { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 9px 10px; border: 1px solid rgba(105,225,226,.18); border-radius: 6px; background: rgba(105,225,226,.045); }
.check-strip > div { display: flex; flex-direction: column; gap: 4px; }
.check-label { color: #6f919d; font-size: 7px; letter-spacing: .1em; font-weight: 800; }
.check-label i { color: #75a5b0; font-style: normal; }
.check-strip b { color: #b8d4dc; font-size: 8px; font-weight: 650; font-variant-numeric: tabular-nums; }
.check-mark { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid rgba(105,225,226,.35); border-radius: 50%; color: var(--accent); font-size: 11px; }
.panel-footer { display: flex; justify-content: space-between; margin-top: 11px; color: #4f6b78; font-size: 6px; letter-spacing: .12em; }
.panel-footer i { color: var(--accent); font-style: normal; }

@media (max-width: 760px) {
  #app { grid-template-rows: 55px minmax(0, 1fr); }
  .topbar { padding: 0 13px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 24px; height: 24px; transform: scale(.82); }
  .eyebrow { font-size: 7px; }
  .brand-copy h1 { font-size: 12px; letter-spacing: .12em; }
  .topbar-meta { gap: 6px; font-size: 7px; }
  .format-chip { padding: 4px 5px; font-size: 6px; }
  .topbar-separator { height: 10px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(270px, 44dvh) minmax(0, 1fr); }
  .visual-panel { grid-template-rows: 29px minmax(0, 1fr) 53px; padding: 0 10px 7px; }
  .stage-topline { padding: 0 4px; font-size: 7px; }
  .scale-note { font-size: 6px; }
  .scene-status { top: 8px; left: 8px; padding: 5px 7px; font-size: 7px; }
  .scene-annotation { font-size: 6px; }
  .annotation-ice { top: 19%; left: 5%; }
  .annotation-water { top: 43%; right: 4%; }
  .annotation-core { top: 54%; left: 58%; }
  .scene-legend { left: 8px; bottom: 7px; gap: 8px; padding: 6px 7px; font-size: 6px; }
  .scene-legend i { width: 6px; height: 6px; }
  .scale-ruler { right: 9px; bottom: 54px; font-size: 6px; }
  .process-strip { gap: 7px; padding: 0 2px; }
  .process-step { gap: 5px; }
  .process-number { width: 18px; height: 18px; font-size: 7px; }
  .process-copy b { font-size: 6px; }
  .process-copy small { display: none; }
  .process-connector { width: 7px; }
  .control-panel { padding: 13px 13px 12px; }
  .panel-heading { margin-bottom: 10px; }
  .panel-heading h2 { font-size: 15px; }
  .readout-card { min-height: 62px; padding: 7px 8px; }
  .readout-label { font-size: 6px; }
  .readout-value { margin-top: 6px; font-size: 19px; }
  .readout-value small { font-size: 9px; }
  .readout-foot { font-size: 7px; margin-top: 4px; }
  .caption-card { margin-top: 8px; padding: 8px 10px; }
  .caption-card p { font-size: 9px; }
  .conditions-section { margin-top: 13px; }
  .control-row { margin-bottom: 10px; }
  .preset-section { margin-top: 13px; }
  .transport-section { margin-top: 13px; padding-top: 10px; }
  .quality-section { margin-top: 10px; padding-top: 9px; }
  .science-panel { margin-top: 10px; }
  .panel-footer { margin-bottom: 2px; }
}

@media (max-width: 370px) {
  .topbar-meta > span:nth-child(2), .topbar-separator { display: none; }
  .preset-button { padding: 6px; gap: 5px; }
  .preset-button b { font-size: 7px; }
  .preset-button small { font-size: 6px; }
  .process-copy b { font-size: 5px; }
}

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