:root {
  color-scheme: dark;
  --bg: #07131f;
  --panel: #0d1d2a;
  --panel-2: #102333;
  --line: rgba(164, 201, 220, 0.12);
  --line-strong: rgba(164, 201, 220, 0.22);
  --text: #eaf4f8;
  --muted: #89a1b0;
  --faint: #607989;
  --cyan: #71d6f6;
  --cyan-2: #39a9d4;
  --amber: #e7b67d;
  --radius: 15px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  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;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 44% -15%, rgba(46, 103, 131, 0.18), transparent 42%),
    linear-gradient(180deg, #091724 0%, #07131f 62%, #081521 100%);
  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(--cyan); outline-offset: 3px; }
.app-shell { width: min(1600px, 100%); margin: 0 auto; padding: 0 28px 18px; }
.topbar {
  height: 66px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); gap: 20px;
}
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 29px; height: 29px; border: 1px solid rgba(113,214,246,.38); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(45deg); background: rgba(57,169,212,.08); }
.brand-mark span { width: 3px; border-radius: 4px; background: var(--cyan); display: block; transform: rotate(-45deg); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 14px; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .72; }
.brand-name { font-size: 11px; letter-spacing: .15em; font-weight: 800; }
.brand-name span { color: #7290a2; font-weight: 500; }
.brand-subtitle { color: #678295; font-size: 8px; letter-spacing: .18em; margin-top: 4px; }
.topbar-meta { display: flex; align-items: center; gap: 18px; }
.field-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(113,214,246,.18); border-radius: 999px; color: #9cc8d9; font-size: 9px; font-weight: 700; letter-spacing: .1em; background: rgba(30,87,112,.12); }
.field-pill i, .live-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: #70d9e9; box-shadow: 0 0 11px rgba(112,217,233,.75); }
.seed-label { color: #698295; font-size: 9px; letter-spacing: .14em; }
.seed-label b { color: #bdd4df; font-weight: 700; margin-left: 5px; }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 26px 2px 22px; }
.eyebrow { color: #6f9aaf; font-size: 9px; letter-spacing: .18em; font-weight: 800; }
.intro-copy .eyebrow span { color: var(--cyan); padding: 0 4px; }
h1 { margin: 8px 0 7px; font-size: clamp(24px, 2.45vw, 34px); line-height: 1.13; letter-spacing: -.045em; font-weight: 670; }
h1 span { color: var(--cyan); }
.intro-copy p { margin: 0; color: #9aafbd; font-size: 12px; max-width: 720px; line-height: 1.55; }
.intro-note { min-width: 245px; max-width: 280px; border-left: 1px solid var(--line-strong); padding: 3px 0 3px 14px; color: #7896a7; font-size: 10px; display: grid; grid-template-columns: 19px 1fr; column-gap: 8px; align-items: center; }
.note-icon { color: var(--cyan); font-size: 18px; grid-row: span 2; }
.intro-note b { color: #c0d2dc; font-size: 10px; font-weight: 600; line-height: 1.4; margin-top: 4px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.stage-column { min-width: 0; }
.stage-card, .panel, .readout-card { background: linear-gradient(145deg, rgba(16,36,51,.96), rgba(10,26,39,.98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stage-card { overflow: hidden; }
.stage-toolbar { height: 43px; display: flex; justify-content: space-between; align-items: center; padding: 0 13px 0 16px; border-bottom: 1px solid var(--line); background: rgba(10, 25, 37, .75); }
.stage-label { display: flex; align-items: center; gap: 8px; color: #c3d7e1; font-size: 9px; letter-spacing: .14em; font-weight: 800; }
.stage-label em { color: #6c91a3; font-style: normal; font-size: 8px; font-weight: 600; margin-left: 4px; }
.stage-tools { display: flex; align-items: center; gap: 7px; }
.scale-tag { color: #7895a6; font-size: 8px; letter-spacing: .1em; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; margin-right: 4px; }
.icon-button { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line-strong); background: rgba(20,45,61,.75); color: #9dbbc9; border-radius: 7px; cursor: pointer; transition: .18s ease; }
.icon-button:hover { border-color: rgba(113,214,246,.45); color: var(--cyan); background: rgba(41,108,136,.22); }
.icon-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.scene-wrap { height: clamp(430px, 45vw, 590px); min-height: 410px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #173143, #07131f 74%); }
#simulationCanvas { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.scene-vignette { pointer-events: none; position: absolute; inset: 0; box-shadow: inset 0 0 90px rgba(0,0,0,.24); background: linear-gradient(180deg, rgba(4,14,22,.1), transparent 20%, transparent 76%, rgba(4,13,21,.22)); }
.scene-caption { position: absolute; bottom: 11px; left: 13px; right: 13px; display: flex; justify-content: space-between; color: rgba(159,190,206,.56); font-size: 8px; letter-spacing: .15em; pointer-events: none; }
.scene-callout { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 3px; pointer-events: none; padding: 7px 9px; border: 1px solid rgba(133,198,223,.2); border-radius: 7px; background: rgba(5,19,29,.78); backdrop-filter: blur(8px); box-shadow: 0 5px 22px rgba(0,0,0,.2); transition: opacity .2s ease; }
.scene-callout b { color: #bfe9f5; font-size: 8px; letter-spacing: .12em; }
.scene-callout small { color: #7797a9; font-size: 8px; }
.callout-line { width: 19px; height: 1px; background: #66c9ed; opacity: .8; position: absolute; top: 50%; }
.callout-cold { left: 4%; top: 42%; }
.callout-cold .callout-line { left: 100%; }
.callout-lens { right: 4%; top: 58%; }
.callout-lens .callout-line { right: 100%; }
.callout-water { left: 4%; bottom: 22%; }
.callout-water .callout-line { left: 100%; }
.scene-error, .context-lost { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; background: rgba(4,13,22,.88); padding: 25px; }
.scene-error[hidden], .context-lost[hidden] { display: none; }
.error-symbol { font-size: 34px; color: var(--cyan); margin-bottom: 12px; }
.scene-error b { font-size: 14px; }
.scene-error p { color: var(--muted); font-size: 11px; max-width: 260px; line-height: 1.6; }
.context-lost { inset: auto 12px 12px; padding: 12px; border: 1px solid rgba(113,214,246,.3); border-radius: 9px; color: #bde9f7; font-size: 10px; }
.scene-legend { height: 38px; display: flex; align-items: center; gap: 17px; padding: 0 15px; border-top: 1px solid var(--line); background: rgba(10,25,37,.78); color: #8099a8; font-size: 9px; }
.scene-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend-swatch.frozen { background: #7bb8ce; }
.legend-swatch.lens { background: #a4e8fa; box-shadow: 0 0 8px rgba(113,214,246,.5); }
.legend-swatch.flow { background: #3daee1; border-radius: 50%; }
.legend-swatch.warm { background: #8d674b; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 11px; }
.readout-card { padding: 11px 12px 10px; min-height: 83px; box-shadow: none; }
.readout-top { display: flex; align-items: center; justify-content: space-between; color: #6f91a4; font-size: 8px; letter-spacing: .14em; font-weight: 800; }
.readout-top i { font-style: normal; color: #49677a; font-size: 8px; }
.readout-value { color: #e7f5fa; font-size: clamp(19px, 2vw, 24px); line-height: 1.25; font-weight: 650; letter-spacing: -.04em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.readout-value small { color: #84a6b7; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.readout-foot { color: #607b8c; font-size: 8px; margin-top: 2px; }
.readout-wide { display: none; }
.model-footnote { display: flex; align-items: center; gap: 7px; color: #607c8e; font-size: 8px; line-height: 1.5; padding: 10px 4px 0; letter-spacing: .035em; }
.tiny-info { width: 13px; height: 13px; display: grid; place-items: center; border: 1px solid rgba(113,214,246,.3); color: #7dbbd0; border-radius: 50%; font-size: 8px; font-weight: 700; flex: 0 0 auto; }
.control-column { display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.panel { padding: 15px; box-shadow: 0 12px 32px rgba(0,0,0,.14); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.panel-count { color: #607f91; font-size: 8px; letter-spacing: .13em; white-space: nowrap; }
.preset-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 14px 0 15px; }
.preset-button { min-height: 32px; border: 1px solid var(--line); background: rgba(6,19,29,.42); color: #829aa8; border-radius: 7px; font-size: 8px; font-weight: 650; padding: 5px 4px; cursor: pointer; transition: .18s ease; white-space: nowrap; }
.preset-button:hover { border-color: rgba(113,214,246,.3); color: #c1e2ec; }
.preset-button.active { background: rgba(45,129,159,.16); border-color: rgba(113,214,246,.36); color: #c8edf7; }
.preset-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; background: #7c9eaf; }
.preset-dot.gentle { background: #90aab8; }
.preset-dot.active-dot { background: #71d6f6; box-shadow: 0 0 7px rgba(113,214,246,.55); }
.preset-dot.extreme { background: #e6a56e; }
.control-list { display: flex; flex-direction: column; gap: 13px; }
.control-item { min-width: 0; }
.control-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.control-label label, .speed-row label { color: #b8cbd5; font-size: 10px; font-weight: 550; }
.control-label output, .speed-row output { color: #8edcf2; font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; height: 4px; display: block; appearance: none; -webkit-appearance: none; border-radius: 999px; background: linear-gradient(90deg, #3b9fc2, #294759); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #dff7ff; border: 2px solid #4caed0; box-shadow: 0 0 0 3px rgba(72,178,215,.12); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #dff7ff; border: 2px solid #4caed0; box-shadow: 0 0 0 3px rgba(72,178,215,.12); }
.range-hint { display: flex; justify-content: space-between; color: #526e80; font-size: 8px; margin-top: 5px; }
.micro-note { color: #587688; font-size: 7px; margin-top: 4px; letter-spacing: .015em; }
.panel-divider { height: 1px; background: var(--line); margin: 15px 0 13px; }
.panel-divider.compact { margin: 11px 0 10px; }
.playback-heading { display: flex; justify-content: space-between; align-items: end; }
.playback-heading h3 { margin: 4px 0 0; font-size: 12px; font-weight: 650; }
.elapsed-time { color: #9dc7d6; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.playback-controls { display: grid; grid-template-columns: minmax(0,1fr) 55px 55px; gap: 7px; margin-top: 11px; }
.primary-play, .square-button { min-height: 37px; border-radius: 8px; cursor: pointer; transition: .18s ease; }
.primary-play { border: 1px solid rgba(113,214,246,.4); background: linear-gradient(110deg, rgba(43,132,165,.33), rgba(27,81,104,.4)); color: #d9f5fc; display: flex; justify-content: center; align-items: center; gap: 9px; font-size: 10px; font-weight: 750; }
.primary-play:hover { background: rgba(51,151,185,.36); border-color: rgba(113,214,246,.62); }
.play-icon { font-size: 13px; line-height: 1; }
.square-button { border: 1px solid var(--line-strong); background: rgba(8,23,34,.72); color: #9cb7c5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 17px; line-height: 15px; }
.square-button small { font-size: 6px; letter-spacing: .12em; color: #678294; }
.square-button:hover { color: var(--cyan); border-color: rgba(113,214,246,.42); }
.speed-row { display: flex; justify-content: space-between; align-items: center; margin: 13px 0 8px; }
.speed-range { margin-bottom: 1px; }
.utility-row { display: flex; justify-content: space-between; align-items: center; gap: 7px; }
.quality-switch { display: flex; align-items: center; gap: 3px; }
.quality-switch > span { color: #607e90; font-size: 7px; letter-spacing: .13em; font-weight: 800; margin-right: 3px; }
.quality-button { border: 1px solid transparent; background: transparent; border-radius: 5px; color: #668394; font-size: 7px; padding: 5px 6px; cursor: pointer; }
.quality-button.active { color: #bce8f4; background: rgba(53,132,161,.16); border-color: rgba(113,214,246,.2); }
.utility-button { border: 1px solid var(--line); background: rgba(8,23,34,.65); border-radius: 6px; color: #8ca8b7; font-size: 8px; padding: 6px 9px; cursor: pointer; }
.utility-button:hover { border-color: rgba(113,214,246,.36); color: var(--cyan); }
.validation-panel { padding-bottom: 12px; }
.check-mark { color: #83d8d0; border: 1px solid rgba(131,216,208,.25); background: rgba(47,137,127,.12); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; }
.validation-equation { color: #d7edf5; font-family: ui-serif, Georgia, serif; font-size: 15px; letter-spacing: .015em; padding: 13px 0 11px; text-align: center; }
.validation-equation sub { font-size: 9px; }
.validation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 9px 0 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.validation-grid div { display: flex; flex-direction: column; gap: 4px; }
.validation-grid span { color: #668596; font-size: 7px; letter-spacing: .12em; }
.validation-grid b { color: #c9e5ee; font-size: 10px; font-variant-numeric: tabular-nums; }
.validation-grid div:last-child b { color: #8ad9ce; }
.validation-foot { display: flex; align-items: center; gap: 6px; color: #668495; font-size: 8px; padding-top: 9px; }
.validation-dot { width: 5px; height: 5px; border-radius: 50%; background: #7fd3c7; }
.science-panel { padding: 0; overflow: hidden; }
.science-panel summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { display: flex; flex-direction: column; gap: 4px; }
.science-panel summary b { font-size: 12px; font-weight: 650; }
.chevron { color: #7d9bac; font-size: 17px; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 13px 15px 15px; }
.science-content h3 { color: #c3e2ed; font-size: 10px; margin: 11px 0 6px; }
.science-content h3:first-child { margin-top: 0; }
.equation-block { padding: 9px 10px; border-radius: 6px; background: rgba(3,14,23,.48); border: 1px solid rgba(113,214,246,.12); color: #aee6f4; text-align: center; font-family: ui-serif, Georgia, serif; font-size: 12px; }
.science-content p { color: #8199a8; font-size: 9px; line-height: 1.55; margin: 7px 0; }
.science-facts { margin-top: 12px; border-top: 1px solid var(--line); }
.science-facts div { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.science-facts b { color: #a8c6d3; font-size: 9px; }
.science-facts span { color: #718c9d; font-size: 8px; line-height: 1.5; }
.science-disclaimer { color: #627f91 !important; font-style: italic; margin-top: 11px !important; }
.footer-bar { display: flex; justify-content: space-between; gap: 16px; padding: 18px 2px 0; color: #4e6c7e; font-size: 7px; letter-spacing: .15em; }
.footer-bar b { color: #7898a9; font-weight: 800; }
.footer-bar i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: #74c9df; vertical-align: 1px; margin: 0 6px; }
.embed-mode .topbar, .embed-mode .intro-row, .embed-mode .footer-bar { display: none; }
.embed-mode .app-shell { padding-top: 0; }
.embed-mode .workspace { padding-top: 0; }
@media (min-width: 1450px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 385px; }
  .scene-wrap { height: 610px; }
  .control-column { gap: 13px; }
  .panel { padding: 17px; }
}
@media (max-width: 1120px) {
  .app-shell { padding: 0 18px 16px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; }
  .scene-wrap { height: 500px; }
  .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout-wide { display: block; }
  .intro-note { display: none; }
  .panel { padding: 13px; }
}
@media (max-width: 820px) {
  .app-shell { padding: 0 13px 15px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .scene-wrap { height: min(66vw, 510px); min-height: 360px; }
  .control-column { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; }
  .control-panel { grid-row: span 2; }
  .science-panel { grid-column: 2; }
  .validation-panel { grid-column: 2; }
  .intro-row { padding: 20px 2px 17px; }
  h1 { font-size: clamp(23px, 4vw, 30px); }
  .footer-bar { padding-top: 14px; }
}
@media (max-width: 560px) {
  .app-shell { padding: 0 10px 13px; }
  .topbar { height: 56px; }
  .brand-mark { width: 25px; height: 25px; }
  .brand-name { font-size: 9px; }
  .brand-subtitle { font-size: 7px; }
  .topbar-meta { gap: 7px; }
  .field-pill { font-size: 7px; padding: 6px 7px; }
  .seed-label { display: none; }
  .intro-row { padding: 18px 1px 15px; }
  .intro-copy .eyebrow { font-size: 8px; }
  h1 { font-size: 24px; max-width: 370px; }
  .intro-copy p { font-size: 10px; max-width: 350px; }
  .workspace { gap: 10px; }
  .stage-toolbar { height: 39px; padding: 0 9px 0 11px; }
  .stage-label { font-size: 8px; gap: 6px; }
  .stage-label em { font-size: 7px; }
  .scale-tag { font-size: 7px; padding: 4px 5px; }
  .icon-button { width: 25px; height: 25px; }
  .scene-wrap { height: 390px; min-height: 350px; }
  .scene-callout { padding: 5px 6px; }
  .scene-callout b { font-size: 7px; }
  .scene-callout small { font-size: 7px; }
  .callout-cold { left: 2%; top: 35%; }
  .callout-lens { right: 2%; top: 56%; }
  .callout-water { left: 2%; bottom: 19%; }
  .scene-legend { gap: 10px; padding: 0 9px; font-size: 7px; overflow: hidden; }
  .scene-legend span { gap: 4px; }
  .legend-swatch { width: 6px; height: 6px; }
  .readout-grid { gap: 7px; margin-top: 8px; }
  .readout-card { min-height: 75px; padding: 9px 10px; }
  .readout-top { font-size: 7px; }
  .readout-value { font-size: 21px; margin-top: 5px; }
  .readout-foot { font-size: 7px; }
  .model-footnote { font-size: 7px; padding-top: 8px; }
  .control-column { display: flex; gap: 9px; }
  .panel { padding: 13px; }
  .control-panel { order: 1; }
  .validation-panel { order: 2; }
  .science-panel { order: 3; }
  .panel-heading h2 { font-size: 14px; }
  .preset-button { font-size: 8px; }
  .control-list { gap: 14px; }
  .control-label label { font-size: 10px; }
  .control-label output { font-size: 9px; }
  .footer-bar { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
