:root {
  color-scheme: dark;
  --bg: #06141e;
  --panel: #0b1e2a;
  --panel-2: #0d2431;
  --line: rgba(158, 207, 224, .13);
  --muted: #77909e;
  --muted-2: #526d7b;
  --text: #e5f4f8;
  --cyan: #77d9ee;
  --cyan-2: #3aabc7;
  --ice: #b9f0fa;
  --green: #80d9bd;
  --amber: #e7c68b;
  --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 { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; background: radial-gradient(ellipse at 50% -20%, #153648 0, #081a25 38%, #04111a 100%); }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; max-width: 1800px; margin: 0 auto; padding: 0 24px 14px; }
.topbar { height: 86px; display: grid; grid-template-columns: 250px 1fr 180px; align-items: center; border-bottom: 1px solid var(--line); gap: 20px; }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 30px; height: 30px; border: 1px solid rgba(119,217,238,.35); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(45deg); }
.brand-mark span { width: 3px; height: 14px; border-radius: 5px; background: var(--cyan); opacity: .9; }
.brand-mark span:nth-child(2) { height: 20px; opacity: .55; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .35; }
.brand-name { font-size: 12px; font-weight: 800; letter-spacing: .17em; color: #d8eef3; }
.brand-name span { color: #7eb7c8; font-weight: 500; }
.brand-sub { color: #65808e; font-size: 8px; letter-spacing: .18em; margin-top: 4px; }
.top-title { text-align: center; }
.eyebrow { color: #7093a3; font-size: 9px; letter-spacing: .19em; font-weight: 700; }
.top-title .eyebrow span { color: #5eb8ce; margin-left: 10px; }
.top-title h1 { margin: 6px 0 0; font-size: 21px; line-height: 1.1; font-weight: 620; letter-spacing: -.035em; color: #e6f7fa; }
.top-status { justify-self: end; display: flex; align-items: center; gap: 8px; color: #9db8c3; font-size: 9px; letter-spacing: .12em; }
.top-status b { padding: 5px 7px; border: 1px solid rgba(119,217,238,.25); color: var(--cyan); border-radius: 5px; font-size: 9px; }
.status-dot, .live-pill i, .view-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #74d7b6; box-shadow: 0 0 12px rgba(116,215,182,.75); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: 18px; padding-top: 18px; align-items: start; }
.stage-column { min-width: 0; }
.stage-frame { height: min(73vh, 760px); min-height: 560px; position: relative; overflow: hidden; border: 1px solid rgba(124,196,216,.17); border-radius: 17px; background: radial-gradient(ellipse at 50% 45%, #0b3040 0, #06202d 42%, #03131d 100%); box-shadow: 0 18px 60px rgba(0,0,0,.28), inset 0 0 60px rgba(82,190,219,.035); isolation: isolate; }
.scene-mount { position: absolute; inset: 0; z-index: 0; }
.scene-mount canvas { display: block; width: 100%; height: 100%; outline: none; }
.stage-vignette { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: linear-gradient(180deg, rgba(2,13,20,.42), transparent 22%, transparent 68%, rgba(2,13,20,.76)); }
.stage-topline, .stage-bottomline { position: absolute; z-index: 2; left: 22px; right: 22px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.stage-topline { top: 18px; }
.scene-tag { display: flex; align-items: center; gap: 9px; color: #c9e8ee; font-size: 9px; letter-spacing: .15em; font-weight: 750; }
.scene-tag small { font-size: 8px; color: #6e9aa8; border-left: 1px solid rgba(155,209,222,.25); padding-left: 9px; font-weight: 500; }
.tag-icon { color: var(--cyan); font-size: 15px; }
.scene-coordinates { color: #8aaab5; font-size: 8px; letter-spacing: .15em; background: rgba(4,20,29,.48); border: 1px solid rgba(137,194,210,.13); border-radius: 20px; padding: 7px 10px; backdrop-filter: blur(10px); }
.coord-sep { color: #4c8295; padding: 0 7px; }
.scene-label { position: absolute; z-index: 2; display: flex; align-items: center; gap: 7px; color: rgba(201,235,242,.75); font-size: 8px; letter-spacing: .15em; pointer-events: none; text-shadow: 0 1px 8px #03131d; }
.scene-label i { display: block; width: 5px; height: 5px; background: #8ee5f5; border-radius: 50%; box-shadow: 0 0 10px #8ee5f5; }
.label-ice { top: 21%; left: 9%; }
.label-tube { top: 47%; right: 8%; }
.label-brine { top: 64%; left: 9%; }
.label-floor { bottom: 23%; right: 9%; }
.stage-bottomline { bottom: 117px; }
.scale-readout { display: flex; align-items: center; gap: 7px; color: #a6c4cd; font-size: 9px; }
.scale-line { display: inline-block; width: 30px; height: 1px; border-top: 2px solid #a6d7e2; border-left: 1px solid #a6d7e2; border-right: 1px solid #a6d7e2; height: 6px; }
.scale-readout small { color: #6b8995; font-size: 7px; letter-spacing: .1em; margin-left: 5px; }
.orbit-hint { color: #6e8c98; font-size: 8px; letter-spacing: .1em; }
.orbit-hint span { color: #4b7382; padding: 0 4px; }
.mouse-glyph { font-size: 14px; vertical-align: -2px; }
.view-chip { color: #9ac6d2; font-size: 8px; letter-spacing: .12em; border: 1px solid rgba(122,197,216,.2); background: rgba(4,22,31,.5); border-radius: 5px; padding: 6px 8px; }
.view-dot { width: 5px; height: 5px; margin-right: 5px; background: #65c8e1; box-shadow: none; }
.readout-dock { position: absolute; z-index: 3; bottom: 16px; left: 16px; right: 16px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }
.readout-card { min-height: 78px; padding: 11px 12px 9px; border-radius: 9px; background: rgba(5,23,33,.78); border: 1px solid rgba(130,203,220,.14); backdrop-filter: blur(12px); box-shadow: 0 5px 18px rgba(0,0,0,.15); }
.readout-label { display: block; color: #7396a4; font-size: 7px; letter-spacing: .16em; font-weight: 700; white-space: nowrap; }
.readout-card strong { display: block; margin-top: 7px; font-size: clamp(17px, 1.55vw, 22px); line-height: 1; font-weight: 620; letter-spacing: -.04em; color: #e4f8fb; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-card strong small { font-size: 9px; color: #8fb5c2; font-weight: 500; letter-spacing: 0; }
.readout-card em { display: block; margin-top: 6px; color: #66b9ca; font-size: 7px; font-style: normal; letter-spacing: .12em; }
.cause-chain { display: flex; align-items: center; justify-content: center; gap: 15px; padding: 17px 12px 4px; }
.chain-step { display: flex; align-items: center; gap: 8px; }
.chain-number { color: #5db9ce; font-size: 9px; border: 1px solid rgba(100,191,212,.3); border-radius: 6px; width: 23px; height: 23px; display: grid; place-items: center; }
.chain-step b { display: block; font-size: 8px; color: #b8d8e0; letter-spacing: .14em; }
.chain-step small { display: block; margin-top: 3px; color: #66818d; font-size: 9px; }
.chain-arrow { color: #3f8294; font-size: 14px; }
.webgl-message, .context-message { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; background: rgba(3,17,25,.92); }
.webgl-message[hidden], .context-message[hidden] { display: none; }
.message-icon { font-size: 38px; color: var(--cyan); margin-bottom: 12px; }
.webgl-message strong, .context-message strong { font-size: 16px; }
.webgl-message p { max-width: 340px; color: #87a4b0; font-size: 12px; line-height: 1.6; }
.context-message { gap: 9px; background: rgba(3,17,25,.72); }
.context-message span { color: #88a9b6; font-size: 11px; }
.control-panel { max-height: calc(100vh - 112px); overflow: auto; overscroll-behavior: contain; padding: 17px 17px 14px; border: 1px solid rgba(133,192,210,.15); border-radius: 15px; background: linear-gradient(155deg, rgba(14,37,50,.98), rgba(7,25,36,.98)); box-shadow: 0 18px 45px rgba(0,0,0,.2); scrollbar-width: thin; scrollbar-color: #244758 transparent; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 5px 0 0; font-size: 20px; font-weight: 620; letter-spacing: -.04em; }
.live-pill { display: flex; align-items: center; gap: 6px; color: #82d6b8; font-size: 8px; letter-spacing: .12em; border: 1px solid rgba(128,217,189,.22); border-radius: 20px; padding: 6px 9px; }
.live-pill i { width: 5px; height: 5px; }
.section-label { color: #8fb0bc; font-size: 8px; font-weight: 750; letter-spacing: .17em; }
.transport-section { padding: 15px 0 14px; border-bottom: 1px solid var(--line); }
.transport-row { display: flex; align-items: center; gap: 7px; margin-top: 10px; }
.primary-control { height: 37px; min-width: 112px; border: 1px solid rgba(114,214,234,.4); border-radius: 8px; background: linear-gradient(120deg, #2c90a9, #236a83); display: flex; align-items: center; justify-content: center; gap: 9px; color: #f1fdff; font-size: 9px; font-weight: 800; letter-spacing: .1em; cursor: pointer; box-shadow: 0 4px 14px rgba(27,127,155,.18); transition: filter .18s ease, transform .18s ease; }
.primary-control:hover { filter: brightness(1.13); transform: translateY(-1px); }
.play-icon { font-size: 14px; }
.icon-control { width: 36px; height: 37px; border: 1px solid rgba(130,190,207,.2); border-radius: 8px; background: rgba(20,53,69,.65); color: #b8dce5; cursor: pointer; font-size: 14px; }
.icon-control:hover, .utility-button:hover { border-color: rgba(119,217,238,.48); background: rgba(32,76,94,.7); }
.elapsed { margin-left: auto; text-align: right; }
.elapsed span { display: block; color: #6e8e9a; font-size: 7px; letter-spacing: .16em; }
.elapsed b { display: block; margin-top: 4px; font-size: 11px; color: #d2e9ee; font-variant-numeric: tabular-nums; }
.speed-row, .parameter-top { display: flex; justify-content: space-between; align-items: baseline; }
.speed-row { margin-top: 14px; }
.speed-row label { color: #84a3af; font-size: 8px; letter-spacing: .14em; }
.speed-row strong, .parameter-top strong { color: #a9e9f3; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.parameter-top strong small { color: #7797a3; font-size: 8px; font-weight: 500; }
.range-input { appearance: none; -webkit-appearance: none; width: 100%; height: 3px; display: block; margin: 11px 0 7px; border-radius: 4px; background: linear-gradient(90deg, #3e9eb7, #28566a); outline: none; cursor: pointer; }
.range-input::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #c7f6fb; border: 2px solid #328ca6; box-shadow: 0 0 0 3px rgba(93,190,214,.12), 0 0 12px rgba(109,217,239,.35); }
.range-input::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #c7f6fb; border: 2px solid #328ca6; box-shadow: 0 0 0 3px rgba(93,190,214,.12); }
.range-input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(119,217,238,.3); }
.range-ends { display: flex; justify-content: space-between; color: #5f7e8a; font-size: 7px; letter-spacing: .1em; }
.preset-section { padding: 14px 0 13px; border-bottom: 1px solid var(--line); }
.preset-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-top: 10px; }
.preset-button { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 9px 8px 8px; min-height: 61px; border: 1px solid rgba(127,184,200,.16); border-radius: 8px; background: rgba(7,26,37,.55); text-align: left; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.preset-button:hover { border-color: rgba(119,217,238,.38); }
.preset-button.active { border-color: rgba(119,217,238,.5); background: rgba(34,89,108,.32); box-shadow: inset 0 0 0 1px rgba(119,217,238,.08); }
.preset-button b { font-size: 7px; line-height: 1.35; letter-spacing: .11em; color: #aacbd4; }
.preset-swatch { display: block; width: 22px; height: 3px; border-radius: 3px; }
.preset-swatch.polar { background: #83d9ed; box-shadow: 0 0 10px rgba(131,217,237,.45); }
.preset-swatch.diluted { background: #d4b77d; }
.preset-swatch.surge { background: #8dd9c4; }
.preset-description { color: #6f8d99; font-size: 9px; line-height: 1.45; margin: 9px 1px 0; min-height: 25px; }
.parameters-section { padding: 14px 0 2px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; }
.section-note { color: #5c8392; font-size: 7px; letter-spacing: .13em; }
.parameter { padding: 13px 0 9px; border-bottom: 1px solid rgba(142,190,205,.09); }
.parameter:last-child { border-bottom: 0; }
.parameter-top label { color: #c1d8de; font-size: 10px; }
.utility-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; padding: 13px 0; border-top: 1px solid var(--line); }
.utility-button { height: 32px; border: 1px solid rgba(130,190,207,.18); border-radius: 7px; background: rgba(16,46,61,.7); color: #91b6c2; font-size: 7px; font-weight: 750; letter-spacing: .11em; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.utility-button span { color: var(--cyan); font-size: 12px; margin-right: 5px; vertical-align: -1px; }
.utility-button.full { grid-column: 1 / -1; }
.validation-card { padding: 12px; border: 1px solid rgba(111,197,181,.2); border-radius: 9px; background: linear-gradient(140deg, rgba(19,63,66,.32), rgba(10,38,49,.36)); }
.validation-heading { display: flex; align-items: center; gap: 8px; }
.validation-icon { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; color: #8de1c6; border: 1px solid rgba(141,225,198,.35); font-size: 11px; }
.validation-heading b { display: block; color: #bce8db; font-size: 8px; letter-spacing: .14em; }
.validation-heading small { display: block; color: #6c9d94; font-size: 7px; margin-top: 3px; letter-spacing: .1em; }
.textbook-tag { margin-left: auto; border: 1px solid rgba(141,225,198,.2); color: #89cdb8; border-radius: 4px; padding: 4px 6px; font-size: 7px; letter-spacing: .1em; }
.validation-title { margin: 12px 0 9px; color: #c4dfe1; font-size: 9px; }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.validation-values small { display: block; color: #72928f; font-size: 6px; letter-spacing: .12em; }
.validation-values b { display: block; margin-top: 4px; color: #c5eee1; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.validation-card p { color: #769992; font-size: 8px; line-height: 1.5; margin: 9px 0 0; }
.science-panel { margin-top: 10px; border: 1px solid rgba(131,187,203,.14); border-radius: 9px; background: rgba(6,23,33,.45); }
.science-panel summary { display: flex; align-items: center; gap: 9px; padding: 11px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-symbol { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: rgba(77,152,173,.15); color: #8bd8e7; font-size: 14px; }
.science-panel summary b { display: block; color: #c5dfe5; font-size: 9px; }
.science-panel summary small { display: block; color: #6d8c98; font-size: 7px; margin-top: 3px; }
.chevron { margin-left: auto; color: #6e9aa7; font-size: 16px; transition: transform .18s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 13px; color: #8baab4; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 13px 0 5px; color: #b8dce4; font-size: 9px; letter-spacing: .06em; }
.science-content p { margin: 5px 0; }
.equation { padding: 8px 9px; margin: 7px 0; border-left: 2px solid #57b9d0; border-radius: 0 5px 5px 0; background: rgba(34,82,99,.25); color: #b9e9f0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.equation-note { color: #648693; font-size: 7px; }
.science-content ul { padding-left: 15px; margin: 6px 0; }
.science-content li { margin: 4px 0; }
.science-disclaimer { color: #85b6bf; border-top: 1px solid rgba(136,190,203,.12); padding-top: 9px; margin-top: 11px !important; font-size: 8px; }
.panel-footnote { color: #506f7b; font-size: 7px; letter-spacing: .1em; text-align: center; padding-top: 12px; }
.panel-footnote span { padding: 0 4px; color: #3c7183; }
.footer { display: flex; justify-content: space-between; padding: 17px 2px 0; color: #496976; font-size: 7px; letter-spacing: .14em; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0,1fr) 380px; gap: 22px; }
  .stage-frame { height: min(76vh, 850px); }
  .control-panel { padding: 19px; }
}
@media (max-width: 1100px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .workspace { grid-template-columns: minmax(0,1fr) 326px; gap: 12px; }
  .stage-frame { min-height: 540px; height: 70vh; }
  .readout-card { padding: 10px 9px; }
  .readout-label { font-size: 6px; }
  .readout-card strong { font-size: 17px; }
  .control-panel { padding: 14px; }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .stage-frame { height: 68vh; min-height: 500px; }
  .control-panel { max-height: none; overflow: visible; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; align-items: start; }
  .panel-heading, .parameters-section, .science-panel, .panel-footnote { grid-column: 1 / -1; }
  .transport-section, .preset-section { border-bottom: 0; }
  .parameters-section { display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; }
  .parameters-section .section-heading { grid-column: 1 / -1; }
  .utility-row, .validation-card { align-self: start; }
  .footer { padding-bottom: 10px; }
}
@media (max-width: 560px) {
  .app-shell { padding: 0 10px 12px; }
  .topbar { height: 70px; grid-template-columns: 1fr auto; gap: 8px; }
  .brand-mark { width: 25px; height: 25px; }
  .brand-name { font-size: 10px; }
  .brand-sub { font-size: 7px; }
  .top-title { display: none; }
  .top-status { font-size: 8px; }
  .workspace { padding-top: 10px; gap: 10px; }
  .stage-frame { height: 63vh; min-height: 480px; border-radius: 12px; }
  .stage-topline { left: 12px; right: 12px; top: 12px; }
  .scene-coordinates { font-size: 6px; padding: 6px 7px; }
  .scene-tag { font-size: 7px; gap: 6px; }
  .scene-tag small { font-size: 6px; padding-left: 6px; }
  .scene-label { font-size: 6px; }
  .label-ice { left: 5%; top: 22%; }
  .label-tube { right: 4%; top: 46%; }
  .label-brine { left: 5%; top: 63%; }
  .label-floor { right: 5%; bottom: 27%; }
  .stage-bottomline { display: none; }
  .readout-dock { left: 8px; right: 8px; bottom: 8px; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 5px; }
  .readout-card { min-height: 60px; padding: 8px 9px; }
  .readout-label { font-size: 6px; }
  .readout-card strong { margin-top: 5px; font-size: 17px; }
  .readout-card em { margin-top: 4px; font-size: 6px; }
  .cause-chain { gap: 6px; padding: 11px 2px 1px; justify-content: space-between; }
  .chain-step { gap: 5px; }
  .chain-number { width: 19px; height: 19px; font-size: 7px; }
  .chain-step b { font-size: 6px; }
  .chain-step small { font-size: 7px; max-width: 88px; }
  .chain-arrow { font-size: 10px; }
  .control-panel { display: block; padding: 13px; border-radius: 12px; }
  .transport-section, .preset-section { border-bottom: 1px solid var(--line); }
  .parameters-section { display: block; }
  .parameter { padding: 12px 0 8px; }
  .footer { gap: 10px; font-size: 6px; line-height: 1.4; }
  .footer span:last-child { text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
body.embed .topbar, body.embed .footer { display: none; }
body.embed .app-shell { padding-top: 8px; }
body.embed .workspace { padding-top: 0; }
body.embed .stage-frame { height: calc(100vh - 36px); min-height: 420px; }
body.embed .control-panel { max-height: calc(100vh - 36px); }
@media (max-width: 860px) {
  body.embed .stage-frame { height: 65vh; }
  body.embed .control-panel { max-height: none; }
}
