:root {
  color-scheme: dark;
  --bg: #0b1218;
  --panel: #111a22;
  --panel-raised: #16212b;
  --panel-soft: #192630;
  --border: #2a3945;
  --border-soft: #202e38;
  --text: #edf2f4;
  --muted: #9eabb4;
  --dim: #6f7e88;
  --accent: #e5a65a;
  --accent-soft: rgba(229, 166, 90, .14);
  --gel: #6d8da0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; min-height: 0; display: flex; flex-direction: column; background: radial-gradient(ellipse at 40% -25%, rgba(80, 110, 130, .12), transparent 48%), var(--bg); }
.topbar { height: 58px; flex: 0 0 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--border-soft); background: rgba(12, 19, 25, .96); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 24px; height: 24px; display: flex; align-items: flex-end; gap: 3px; padding: 4px; border: 1px solid rgba(229,166,90,.55); border-radius: 7px; }
.brand-mark span { display: block; width: 4px; border-radius: 3px; background: var(--accent); }
.brand-mark span:nth-child(1) { height: 7px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 12px; opacity: .8; }
.brand-mark span:nth-child(3) { height: 16px; }
.brand-name { font-size: 11px; font-weight: 800; letter-spacing: .14em; line-height: 1.2; }
.brand-name span { color: var(--accent); font-weight: 650; margin-left: 5px; }
.brand-sub { color: var(--dim); font-size: 9px; letter-spacing: .13em; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; letter-spacing: .14em; font-weight: 700; }
.live-dot, .meta-dot, .chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(229,166,90,.55); }
.topbar-divider { width: 1px; height: 14px; background: var(--border); margin: 0 5px; }
.model-tag { color: var(--accent); }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 374px; }
.stage-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 22px 24px 18px; border-right: 1px solid var(--border-soft); }
.stage-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 0 2px 16px; }
.eyebrow { color: var(--accent); font-size: 9px; line-height: 1.3; font-weight: 800; letter-spacing: .16em; }
.eyebrow-line { display: inline-block; width: 22px; height: 1px; vertical-align: middle; margin: 0 0 3px 7px; background: rgba(229,166,90,.6); }
h1 { margin: 6px 0 0; font-size: clamp(19px, 2vw, 25px); letter-spacing: -.035em; line-height: 1.15; font-weight: 720; }
.stage-heading-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; padding-bottom: 4px; }
.stage-viewport { flex: 1; min-height: 280px; position: relative; overflow: hidden; border: 1px solid #293a46; border-radius: 13px; background: #101921; box-shadow: 0 18px 50px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.035); }
#sceneCanvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.scene-chip { position: absolute; top: 14px; left: 15px; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid rgba(160,180,193,.18); border-radius: 6px; background: rgba(9,16,22,.7); color: #c4d0d6; font-size: 9px; font-weight: 750; letter-spacing: .12em; backdrop-filter: blur(8px); pointer-events: none; }
.scene-chip .chip-dot { width: 5px; height: 5px; }
.scene-readout { position: absolute; top: 13px; right: 15px; min-width: 78px; text-align: right; padding: 5px 0; pointer-events: none; }
.scene-readout-label { display: block; color: var(--dim); font-size: 8px; letter-spacing: .14em; font-weight: 800; }
.scene-readout strong { display: block; margin-top: 2px; font-size: 15px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.scene-scale { position: absolute; left: 12px; bottom: 48px; display: flex; flex-direction: column; gap: 5px; color: rgba(190,203,211,.55); font-size: 8px; letter-spacing: .06em; pointer-events: none; }
.scene-bottom-label { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 7px; color: #9eacb5; font-size: 8px; letter-spacing: .11em; font-weight: 750; pointer-events: none; }
.legend-swatch { width: 12px; height: 4px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 8px rgba(229,166,90,.45); }
.legend-gel { width: 12px; height: 7px; border-radius: 2px; border: 1px solid rgba(125,160,179,.7); background: rgba(86,123,145,.35); }
.legend-divider { width: 1px; height: 11px; margin: 0 2px; background: var(--border); }
.quality-control { position: absolute; right: 14px; top: 51px; }
.quiet-button { border: 1px solid rgba(160,180,193,.18); background: rgba(9,16,22,.58); border-radius: 5px; padding: 6px 8px; color: #aab8c0; font-size: 8px; font-weight: 800; letter-spacing: .12em; cursor: pointer; }
.quiet-button:hover { border-color: rgba(229,166,90,.55); color: var(--accent); }
.stage-caption { min-height: 65px; display: flex; align-items: flex-start; gap: 11px; padding: 14px 3px 0; }
.caption-mark { flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid rgba(229,166,90,.48); border-radius: 50%; color: var(--accent); font-size: 11px; font-family: Georgia, serif; font-style: italic; }
.caption-title { color: var(--accent); font-size: 8px; letter-spacing: .15em; font-weight: 800; }
.stage-caption p { margin: 4px 0 0; color: #b4c0c7; font-size: 11px; line-height: 1.5; max-width: 760px; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 14px; background: rgba(16,25,33,.9); scrollbar-width: thin; scrollbar-color: #34434d transparent; }
.panel-section { padding: 0 0 17px; margin: 0 0 17px; border-bottom: 1px solid var(--border-soft); }
.panel-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-section-head h2 { margin: 4px 0 0; font-size: 15px; letter-spacing: -.025em; font-weight: 700; }
.section-index { color: #596a75; font-size: 9px; font-weight: 800; letter-spacing: .12em; padding-bottom: 2px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-card { position: relative; min-height: 67px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; padding: 9px 9px 8px 35px; text-align: left; border: 1px solid var(--border); border-radius: 7px; background: #141f28; cursor: pointer; transition: border-color .16s, background .16s, transform .16s; }
.preset-card:hover { border-color: #60707b; background: #192630; }
.preset-card.selected { border-color: rgba(229,166,90,.72); background: linear-gradient(120deg, rgba(229,166,90,.13), rgba(229,166,90,.035)); }
.preset-number { position: absolute; left: 10px; top: 10px; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 4px; color: var(--accent); background: rgba(229,166,90,.13); font-size: 9px; font-weight: 800; }
.preset-card strong { font-size: 10px; line-height: 1.2; font-weight: 750; }
.preset-card small { color: var(--muted); font-size: 9px; line-height: 1.25; }
.parameter-list { display: flex; flex-direction: column; gap: 13px; }
.parameter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.parameter-top label { color: #d4dce1; font-size: 10px; font-weight: 650; }
.parameter-top output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; height: 4px; margin: 0; appearance: none; border-radius: 99px; background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--progress, 50%), #34434d var(--progress, 50%), #34434d 100%); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border: 2px solid #0f171d; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #0f171d; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.range-ends { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; color: #73828c; font-size: 8px; font-variant-numeric: tabular-nums; }
.parameter-note { display: flex; gap: 7px; margin-top: 13px; padding: 9px 10px; border: 1px solid rgba(229,166,90,.18); border-radius: 6px; background: rgba(229,166,90,.045); color: #9eabb3; font-size: 9px; line-height: 1.45; }
.note-glyph { color: var(--accent); font-weight: 800; }
.run-controls { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 7px; }
.primary-button, .secondary-button { height: 35px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 6px; cursor: pointer; font-size: 10px; font-weight: 750; transition: .16s; }
.primary-button { color: #21170c; background: var(--accent); border: 1px solid var(--accent); }
.primary-button:hover { background: #f0b66d; }
.secondary-button { color: #d1dbe0; background: #17232c; border: 1px solid var(--border); }
.secondary-button:hover { border-color: #667782; background: #1b2933; }
.button-icon { font-size: 13px; line-height: 1; }
.speed-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.speed-row select { min-width: 68px; height: 27px; padding: 0 7px; color: var(--text); border: 1px solid var(--border); border-radius: 5px; background: #17232c; font-size: 10px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-height: 67px; padding: 9px 10px 7px; border: 1px solid var(--border); border-radius: 7px; background: #141f28; }
.readout-card > span { display: block; color: #8e9da7; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.readout-card strong { display: block; margin-top: 5px; color: #edf2f4; font-size: 18px; line-height: 1; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.readout-card strong small { color: #9eabb4; font-size: 9px; font-weight: 600; letter-spacing: 0; }
.readout-kind { display: block; margin-top: 4px; color: #6f7e88; font-size: 8px; font-style: normal; }
.experiment-box { margin-top: 10px; padding: 12px; border: 1px solid rgba(229,166,90,.28); border-radius: 8px; background: linear-gradient(145deg, rgba(229,166,90,.075), rgba(20,31,40,.75) 65%); }
.experiment-box-top { display: flex; align-items: center; justify-content: space-between; }
.experiment-box h3 { margin: 4px 0 0; font-size: 12px; font-weight: 750; }
.experiment-icon { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(229,166,90,.35); border-radius: 6px; color: var(--accent); font-size: 15px; }
.experiment-box p { margin: 8px 0 10px; color: #aab6be; font-size: 9px; line-height: 1.5; }
.measure-button { width: 100%; height: 31px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border: 1px solid rgba(229,166,90,.55); border-radius: 5px; background: rgba(229,166,90,.12); color: var(--accent); font-size: 9px; font-weight: 800; cursor: pointer; }
.measure-button:hover { background: rgba(229,166,90,.2); }
.measure-result { min-height: 22px; margin-top: 8px; color: #c0cbd1; font-size: 9px; line-height: 1.45; }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-row { display: grid; grid-template-columns: 19px 1fr auto; align-items: center; gap: 8px; }
.check-symbol { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid rgba(229,166,90,.4); border-radius: 50%; color: var(--accent); font-size: 10px; }
.check-copy strong { display: block; color: #d9e1e5; font-size: 9px; font-weight: 700; }
.check-copy small { display: block; margin-top: 2px; color: #7f8e98; font-size: 8px; }
.check-row output { color: #d7e1e5; font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
.check-footnote { margin-top: 10px; color: #778691; font-size: 8px; line-height: 1.45; }
.science-panel { margin: 0 0 14px; border: 1px solid var(--border); border-radius: 8px; background: #141f28; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; margin-top: 3px; font-size: 12px; }
.science-chevron { color: var(--accent); font-size: 18px; transition: transform .2s; }
.science-panel[open] .science-chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 13px; color: #aebbc3; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 10px 0 4px; color: #e3e9ec; font-size: 10px; }
.science-content p { margin: 5px 0 8px; }
.equation { margin: 6px 0; padding: 7px 8px; border-left: 2px solid var(--accent); background: #101920; color: #e6c08f; font-family: Georgia, serif; font-size: 11px; letter-spacing: .01em; }
.science-label { color: #7f8e98; font-style: italic; }
.panel-footer { padding: 2px 0 4px; color: #64737d; font-size: 7px; letter-spacing: .13em; text-align: center; }
.panel-footer span { color: var(--accent); padding: 0 4px; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
body.embed-mode .topbar { display: none; }
body.embed-mode .workspace { height: 100%; flex: 1; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; }
  .stage-panel { padding: 18px 17px 14px; }
  .control-panel { padding: 16px 14px 12px; }
}
@media (max-width: 720px) {
  .app-shell { height: auto; min-height: 100vh; }
  .topbar { height: 48px; flex-basis: 48px; padding: 0 13px; }
  .topbar-right { font-size: 8px; gap: 6px; }
  .topbar-right .model-tag, .topbar-divider { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 410px auto; }
  .stage-panel { padding: 13px 12px 10px; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .stage-heading { padding: 0 1px 10px; align-items: flex-end; }
  h1 { font-size: 18px; }
  .eyebrow { font-size: 8px; }
  .stage-heading-meta { font-size: 7px; gap: 5px; }
  .stage-viewport { min-height: 250px; border-radius: 9px; }
  .stage-caption { min-height: 58px; padding-top: 9px; gap: 8px; }
  .stage-caption p { font-size: 10px; line-height: 1.35; }
  .control-panel { overflow: visible; padding: 16px 13px 24px; }
  body.embed-mode .workspace { height: 100%; grid-template-rows: minmax(270px, 42dvh) minmax(0, 1fr); }
  body.embed-mode .control-panel { overflow-y: auto; padding-bottom: 24px; }
  body.embed-mode .stage-panel { min-height: 0; }
  body.embed-mode .stage-viewport { min-height: 0; }
}
@media (max-width: 420px) {
  .brand-name { font-size: 10px; }
  .brand-sub { font-size: 8px; }
  .stage-heading-meta { display: none; }
  .scene-chip { top: 9px; left: 9px; padding: 6px 7px; font-size: 7px; }
  .scene-readout { top: 8px; right: 9px; }
  .scene-readout strong { font-size: 13px; }
  .quality-control { right: 9px; top: 43px; }
  .quiet-button { padding: 5px 6px; font-size: 7px; }
  .scene-scale { left: 8px; bottom: 39px; font-size: 7px; }
  .scene-bottom-label { right: 9px; bottom: 10px; font-size: 7px; gap: 5px; }
  .preset-card { min-height: 61px; }
  .panel-section-head h2 { font-size: 14px; }
}
