:root {
  color-scheme: dark;
  --bg: #071116;
  --panel: #0c1a20;
  --panel-2: #102229;
  --line: rgba(165, 202, 204, .13);
  --line-strong: rgba(165, 202, 204, .24);
  --text: #e6f0ec;
  --muted: #8da5a5;
  --faint: #607777;
  --cyan: #73d4d1;
  --cyan-soft: rgba(115, 212, 209, .14);
  --gold: #e4b36a;
  --gold-soft: rgba(228, 179, 106, .14);
  --red: #d98562;
  --radius: 13px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(ellipse at 18% -20%, rgba(40, 105, 111, .19), transparent 42%), var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { max-width: 1720px; margin: 0 auto; padding: 0 24px 14px; }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(115,212,209,.45); border-radius: 50%; position: relative; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; position: absolute; border: 1px solid rgba(115,212,209,.62); border-radius: 50%; }
.brand-mark::before { width: 23px; height: 23px; }
.brand-mark::after { width: 12px; height: 12px; }
.brand-mark span { width: 4px; height: 4px; background: var(--gold); border: 0; }
.eyebrow, .micro-label { font-size: 9px; font-weight: 800; letter-spacing: .16em; color: var(--cyan); line-height: 1.4; }
.eyebrow-divider { color: #496467; margin: 0 5px; }
h1 { margin: 3px 0 0; font-size: clamp(16px, 1.7vw, 21px); line-height: 1.2; letter-spacing: -.035em; font-weight: 680; white-space: nowrap; }
h1 span { color: #91a9a7; font-weight: 440; }
.header-meta { display: flex; align-items: center; gap: 17px; flex: 0 0 auto; }
.seed-chip { border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 9px; font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; color: #9bb0af; }
.live-indicator { font-size: 9px; letter-spacing: .12em; color: #9cb2ae; font-weight: 750; display: flex; align-items: center; gap: 7px; }
.live-indicator i, .state-dot, .footer-pulse { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(115,212,209,.65); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(330px, .83fr); gap: 16px; padding-top: 16px; align-items: start; }
.visual-column { min-width: 0; }
.scene-frame { height: clamp(450px, 57vw, 650px); min-height: 450px; position: relative; overflow: hidden; border: 1px solid rgba(141,184,184,.18); border-radius: var(--radius); background: radial-gradient(ellipse at 50% 42%, #16333a 0%, #0c2027 43%, #08151b 100%); isolation: isolate; }
.scene-frame::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(4,13,17,.42), transparent 17%, transparent 78%, rgba(4,13,17,.56)); }
.scene-host { position: absolute; inset: 0; z-index: 0; }
.scene-host canvas { width: 100%; height: 100%; display: block; outline: none; touch-action: pan-y; }
.scene-topline, .scene-bottomline { position: absolute; z-index: 3; left: 18px; right: 18px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.scene-topline { top: 17px; }
.scene-topline strong { display: block; margin-top: 3px; font-size: 12px; letter-spacing: -.01em; font-weight: 650; }
.scene-state { font: 800 9px/1 ui-monospace, monospace; letter-spacing: .13em; color: #9bb0ae; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid rgba(147,183,182,.18); background: rgba(5,16,21,.52); border-radius: 20px; backdrop-filter: blur(8px); }
.scene-state.is-playing .state-dot { background: #e4b36a; box-shadow: 0 0 12px rgba(228,179,106,.8); }
.scene-bottomline { bottom: 15px; gap: 12px; }
.legend { display: flex; gap: 13px; flex-wrap: wrap; }
.legend span, .scene-hint { font-size: 9px; font-weight: 650; color: #a4b7b4; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-dot.reactant { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.legend-dot.precipitate { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.legend-dot.gel { background: #83a9a4; }
.scene-hint { color: #78908e; font-size: 8px; letter-spacing: .1em; }
.mouse-icon { font-size: 14px; color: var(--cyan); }
.hint-sep { color: #40595a; }
.annotation { position: absolute; z-index: 2; font: 800 8px/1 ui-monospace, monospace; letter-spacing: .12em; color: rgba(184,215,206,.68); pointer-events: none; display: flex; align-items: center; gap: 6px; }
.annotation-line { width: 24px; height: 1px; background: linear-gradient(90deg, transparent, rgba(115,212,209,.8)); }
.annotation-source { top: 34%; left: 8%; }
.annotation-bands { top: 55%; right: 7%; flex-direction: row-reverse; }
.annotation-bands .annotation-line { background: linear-gradient(90deg, rgba(228,179,106,.85), transparent); }
.webgl-message, .context-message { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%,-50%); max-width: 82%; padding: 14px 17px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(5,15,20,.9); color: #d8e7e2; font-size: 12px; line-height: 1.5; text-align: center; box-shadow: 0 16px 48px rgba(0,0,0,.3); }
.context-message { top: auto; bottom: 54px; transform: translateX(-50%); color: #f2c88d; }
.data-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.metric-card { min-width: 0; padding: 12px 13px 11px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(16,36,42,.9), rgba(10,24,30,.94)); }
.metric-label { display: flex; justify-content: space-between; align-items: center; gap: 4px; color: #8da6a3; font-size: 8px; letter-spacing: .08em; font-weight: 800; white-space: nowrap; }
.metric-label span { font-size: 7px; color: #6c8b88; letter-spacing: .06em; font-weight: 700; }
.metric-value { margin-top: 8px; display: flex; align-items: baseline; gap: 5px; }
.metric-value strong { font: 650 clamp(20px, 2vw, 26px)/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -.07em; color: #edf4ef; }
.metric-value small { color: #89a29e; font-size: 10px; }
.metric-sub { margin-top: 6px; color: #718986; font-size: 8px; line-height: 1.35; }
.control-column { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(14,31,37,.97), rgba(9,22,28,.98)); padding: 15px; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 15px; letter-spacing: -.025em; font-weight: 650; }
.panel-index { font: 700 9px/1 ui-monospace, monospace; color: #68817f; }
.preset-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
.preset-button { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 5px; background: rgba(6,17,22,.42); color: #92a9a5; font-size: 9px; font-weight: 650; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: border-color .18s, background .18s, color .18s; }
.preset-button:hover { border-color: var(--line-strong); color: var(--text); }
.preset-button.active { border-color: rgba(115,212,209,.46); color: #d7f0e9; background: var(--cyan-soft); }
.preset-icon { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: 0 0 auto; border: 1px solid currentColor; opacity: .85; }
.preset-icon.quiet { background: radial-gradient(circle, #76c7c4 0 20%, transparent 24%); }
.preset-icon.classic { background: repeating-radial-gradient(circle, transparent 0 2px, #e4b36a 2px 3px); }
.preset-icon.dense { background: repeating-radial-gradient(circle, #d99561 0 1px, transparent 1px 2px); }
.transport-row { display: grid; grid-template-columns: 1.4fr 1fr 38px; gap: 7px; margin-top: 11px; }
.transport-button { min-height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(6,17,22,.5); color: #a5bab5; font-size: 9px; font-weight: 800; letter-spacing: .08em; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 8px; transition: background .18s, border-color .18s, transform .18s; }
.transport-button:hover { border-color: rgba(115,212,209,.45); color: #e5f1eb; }
.transport-button:active, .preset-button:active { transform: translateY(1px); }
.transport-button.primary { background: linear-gradient(110deg, #3b9a98, #277878); border-color: #4da6a2; color: #f0fbf6; }
.transport-button.primary:hover { background: linear-gradient(110deg, #48aaa6, #328985); }
.transport-button.primary span:first-child { font-size: 11px; }
.transport-button.icon-only { font-size: 18px; letter-spacing: 0; }
.time-control { margin-top: 14px; }
.control-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.control-heading label { color: #c2d1ca; font-size: 10px; font-weight: 600; }
.control-heading output { color: var(--cyan); font: 700 10px/1 ui-monospace, monospace; white-space: nowrap; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; display: block; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(115,212,209,.72), rgba(115,212,209,.16)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(115,212,209,.72), rgba(115,212,209,.16)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; background: #d5f1e8; border: 2px solid #4d9e9b; box-shadow: 0 0 0 3px rgba(115,212,209,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d5f1e8; border: 2px solid #4d9e9b; box-shadow: 0 0 0 3px rgba(115,212,209,.12); }
input[type="range"]:focus-visible { outline: 1px solid var(--cyan); outline-offset: 5px; border-radius: 5px; }
.range-ends { display: flex; justify-content: space-between; color: #5f7976; font-size: 8px; margin-top: -1px; }
.divider { height: 1px; background: var(--line); margin: 13px 0 12px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.section-heading h3 { margin: 0; font-size: 11px; font-weight: 700; color: #d4e1da; }
.section-heading span { color: #67827e; font: 700 8px/1 ui-monospace, monospace; letter-spacing: .09em; }
.parameter-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 15px; row-gap: 10px; }
.parameter { min-width: 0; }
.parameter .control-heading label { font-size: 9px; }
.parameter .control-heading output { font-size: 9px; }
.parameter .range-ends { font-size: 7px; }
.panel-footnote { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: flex-start; gap: 7px; color: #708986; font-size: 8px; line-height: 1.45; }
.footnote-icon { width: 13px; height: 13px; flex: 0 0 auto; display: inline-grid; place-items: center; border: 1px solid rgba(115,212,209,.4); border-radius: 50%; color: var(--cyan); font: 700 8px/1 Georgia, serif; }
.validation-panel { padding: 13px 15px 12px; }
.panel-heading.compact { margin-bottom: 9px; }
.validation-status { color: #82d5c4; font: 800 8px/1 ui-monospace, monospace; letter-spacing: .1em; border: 1px solid rgba(130,213,196,.25); border-radius: 5px; padding: 5px 6px; }
.validation-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.validation-values div { min-width: 0; padding: 8px; border-radius: 7px; background: rgba(4,14,18,.42); }
.validation-values span { display: block; color: #6f8984; font: 700 7px/1.2 ui-monospace, monospace; letter-spacing: .08em; }
.validation-values strong { display: block; margin-top: 5px; color: #dbe9e2; font: 650 12px/1 ui-monospace, monospace; }
.validation-panel p { margin: 8px 0 0; color: #748c88; font-size: 8px; line-height: 1.45; }
.science-panel { padding: 0; overflow: hidden; }
.science-panel summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; margin-top: 3px; font-size: 13px; font-weight: 650; }
.chevron { color: var(--cyan); font-size: 19px; transition: transform .2s; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 13px 15px 15px; }
.science-content h3 { margin: 12px 0 6px; color: #cde0d8; font-size: 10px; }
.science-content h3:first-child { margin-top: 0; }
.science-content p, .science-content li { color: #91a8a1; font-size: 9px; line-height: 1.55; }
.science-content p { margin: 0 0 8px; }
.science-content ul { padding-left: 16px; margin: 5px 0 10px; }
.science-content li { margin: 3px 0; }
.science-content b { color: #d0e0d7; }
.equation { margin: 6px 0; padding: 7px 8px; background: rgba(4,14,18,.44); border-left: 2px solid rgba(115,212,209,.46); border-radius: 0 5px 5px 0; }
.equation span { display: block; color: #6f8d88; font-size: 8px; margin-bottom: 4px; }
.equation code { color: #d3e7dc; font-size: 9px; white-space: normal; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.validation-note { margin-top: 9px; padding: 9px; background: rgba(115,212,209,.07); border: 1px solid rgba(115,212,209,.15); border-radius: 7px; color: #90aaa2; font-size: 8px; line-height: 1.5; }
.validation-note b { color: var(--cyan); }
.footerbar { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #5f7775; font: 700 8px/1.4 ui-monospace, monospace; letter-spacing: .055em; padding: 9px 2px 0; }
.footerbar b { color: #91aaa5; }
.footer-pulse { width: 5px; height: 5px; margin-right: 5px; }
.footer-sep { margin: 0 6px; color: #405958; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
body.embed .app-shell { padding: 0; }
body.embed .topbar, body.embed .footerbar { display: none; }
body.embed .workspace { padding: 0; grid-template-columns: minmax(0, 1fr) 330px; gap: 10px; }
body.embed .scene-frame { border-radius: 0; }
body.embed .data-strip { margin: 8px; }
@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0, 1.9fr) minmax(360px, .8fr); }
  .scene-frame { height: min(67vh, 760px); }
  .parameter-list { row-gap: 13px; }
}
@media (max-width: 1100px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .workspace { grid-template-columns: minmax(0, 1.35fr) minmax(310px, .9fr); gap: 11px; }
  .scene-frame { height: 540px; }
  .data-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { padding: 10px 12px; }
  .metric-value strong { font-size: 23px; }
  .parameter-list { column-gap: 10px; }
  h1 span { display: none; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 10px 12px; }
  .topbar { min-height: 70px; align-items: center; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-lockup { gap: 10px; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 16px; white-space: normal; }
  .header-meta { gap: 7px; }
  .seed-chip { padding: 6px; font-size: 8px; }
  .live-indicator { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
  .visual-column, .control-column { width: 100%; }
  .scene-frame { height: min(112vw, 470px); min-height: 340px; }
  .scene-topline { left: 12px; right: 12px; top: 12px; }
  .scene-topline strong { font-size: 11px; }
  .scene-bottomline { left: 12px; right: 12px; bottom: 11px; }
  .legend { gap: 8px; }
  .legend span { font-size: 8px; }
  .scene-hint { display: none; }
  .annotation { font-size: 7px; }
  .annotation-source { left: 4%; top: 37%; }
  .annotation-bands { right: 3%; top: 59%; }
  .data-strip { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; margin-top: 8px; }
  .metric-card { padding: 10px; }
  .metric-label { font-size: 7px; }
  .metric-label span { font-size: 6px; }
  .metric-value strong { font-size: 22px; }
  .panel { padding: 13px; }
  .parameter-list { grid-template-columns: 1fr 1fr; column-gap: 14px; row-gap: 12px; }
  .parameter .control-heading label { font-size: 9px; }
  .footerbar { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 7px; }
  body.embed .workspace { display: flex; flex-direction: column; }
  body.embed .scene-frame { height: 58vh; min-height: 340px; }
}
@media (max-width: 390px) {
  .app-shell { padding-left: 8px; padding-right: 8px; }
  .seed-chip { display: none; }
  .scene-frame { min-height: 325px; }
  .parameter-list { column-gap: 9px; }
  .parameter .control-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .parameter .control-heading output { font-size: 8px; }
  .preset-button { font-size: 8px; gap: 4px; }
  .validation-values strong { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.scene-camera-button, .scene-quality-button, .scene-screenshot-button { position: absolute; z-index: 4; bottom: 50px; border: 1px solid rgba(147,190,184,.2); border-radius: 6px; padding: 6px 8px; background: rgba(6,18,23,.7); color: #a9c1b8; font: 800 8px/1 ui-monospace, monospace; letter-spacing: .08em; cursor: pointer; backdrop-filter: blur(7px); }
.scene-camera-button { right: 17px; }
.scene-quality-button { right: 88px; }
.scene-screenshot-button { right: 140px; }
.scene-camera-button:hover, .scene-quality-button:hover, .scene-screenshot-button:hover { color: #eaf6ef; border-color: rgba(115,212,209,.55); }
@media (max-width: 760px) {
  .scene-camera-button, .scene-quality-button, .scene-screenshot-button { bottom: 45px; padding: 5px 6px; font-size: 7px; }
  .scene-camera-button { right: 10px; }
  .scene-quality-button { right: 72px; }
  .scene-screenshot-button { right: 118px; }
}
