:root {
  color-scheme: dark;
  --bg: #080d16;
  --panel: #0d1522;
  --panel-2: #111c2b;
  --line: rgba(166, 190, 220, .13);
  --line-strong: rgba(166, 190, 220, .22);
  --text: #e8f0fb;
  --muted: #8d9db2;
  --dim: #62748b;
  --accent: #62e4cf;
  --accent-soft: rgba(98, 228, 207, .12);
  --accent-glow: rgba(98, 228, 207, .24);
  --warm: #f2bd82;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 10% 0%, rgba(40, 78, 102, .13), transparent 34%), var(--bg); }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(8, 13, 22, .92); }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(98, 228, 207, .4); border-radius: 11px; position: relative; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-8deg); background: linear-gradient(145deg, rgba(98, 228, 207, .13), rgba(98, 228, 207, .015)); }
.brand-mark span { width: 3px; border-radius: 4px; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .75; }
.brand-copy { min-width: 0; }
.eyebrow { color: #71859d; font-size: 9px; line-height: 1.25; font-weight: 800; letter-spacing: .16em; }
h1 { font-size: 16px; line-height: 1.25; letter-spacing: -.025em; margin: 3px 0 0; font-weight: 680; }
.topbar-meta { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; color: #b4c8d7; }
.live-indicator i { width: 6px; height: 6px; display: block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.topbar-divider { width: 1px; height: 17px; background: var(--line-strong); }
.model-tag { color: #70839a; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 12px; padding: 12px; }
.stage-card, .control-card { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, rgba(18, 30, 46, .96), rgba(10, 17, 28, .98)); box-shadow: 0 16px 44px rgba(0, 0, 0, .19); overflow: hidden; }
.stage-card { display: flex; flex-direction: column; position: relative; }
.stage-head { min-height: 66px; padding: 14px 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(166, 190, 220, .08); }
.stage-title { font-size: 14px; font-weight: 650; margin-top: 5px; letter-spacing: -.015em; }
.stage-head-right { display: flex; align-items: center; gap: 10px; }
.scale-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 8px; font-weight: 800; letter-spacing: .12em; color: #8195aa; white-space: nowrap; }
.scale-chip b { width: 5px; height: 5px; border-radius: 50%; background: var(--warm); }
.icon-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; color: #8193a9; background: rgba(255,255,255,.018); font-size: 9px; letter-spacing: .1em; font-weight: 800; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.icon-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-toggle.active { border-color: rgba(98, 228, 207, .35); color: var(--accent); background: var(--accent-soft); }
.canvas-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#scene { width: 100%; height: 100%; display: block; }
.canvas-corner-note { position: absolute; right: 16px; top: 12px; display: flex; align-items: center; gap: 7px; color: #71849b; font-size: 8px; letter-spacing: .13em; font-weight: 800; pointer-events: none; }
.corner-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 8px rgba(242,189,130,.4); }
.stage-caption { min-height: 67px; flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 11px 18px 12px; border-top: 1px solid rgba(166, 190, 220, .09); background: rgba(8, 14, 23, .42); }
.caption-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; color: var(--accent); border: 1px solid rgba(98,228,207,.2); background: rgba(98,228,207,.07); border-radius: 9px; font-size: 14px; }
.caption-label { color: #72869d; font-size: 8px; font-weight: 850; letter-spacing: .14em; margin-bottom: 4px; }
.stage-caption p { margin: 0; color: #b9c7d7; font-size: 11px; line-height: 1.45; }
.control-card { background: linear-gradient(180deg, rgba(15, 24, 38, .98), rgba(10, 17, 28, .98)); }
.control-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #2b3d52 transparent; }
.control-section { padding: 15px 16px 16px; border-bottom: 1px solid var(--line); }
.transport-section { padding-top: 16px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
h2 { margin: 4px 0 0; font-size: 13px; font-weight: 680; letter-spacing: -.01em; }
.state-pill { padding: 5px 7px; border-radius: 5px; border: 1px solid rgba(98,228,207,.22); background: rgba(98,228,207,.07); color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.state-pill.paused { border-color: rgba(242,189,130,.25); background: rgba(242,189,130,.07); color: var(--warm); }
.transport-row { display: flex; align-items: center; gap: 7px; margin-bottom: 13px; }
.transport-btn { width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.025); color: #a5b6c9; cursor: pointer; transition: .2s ease; }
.transport-btn:hover, .screenshot-btn:hover { border-color: rgba(98,228,207,.42); color: var(--accent); }
.transport-btn.primary { background: var(--accent); border-color: var(--accent); color: #07201d; box-shadow: 0 4px 16px rgba(98,228,207,.16); }
.transport-btn svg, .screenshot-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.transport-btn.primary svg { stroke-width: 2.1; }
.transport-spacer { flex: 1; }
.screenshot-btn { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 9px; display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.025); color: #9aadc2; cursor: pointer; font-size: 8px; font-weight: 850; letter-spacing: .12em; transition: .2s ease; }
.range-control { margin-top: 15px; }
.compact-range { margin-top: 0; }
.range-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.range-label label { color: #c0ccda; font-size: 10px; font-weight: 580; }
.range-label output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 8px; background: linear-gradient(90deg, rgba(98,228,207,.62), rgba(98,228,207,.18)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 8px; background: linear-gradient(90deg, rgba(98,228,207,.62), rgba(98,228,207,.18)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; margin-top: -4.5px; border: 2px solid #0c1925; background: var(--accent); box-shadow: 0 0 0 2px rgba(98,228,207,.25), 0 0 12px rgba(98,228,207,.2); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #0c1925; background: var(--accent); box-shadow: 0 0 0 2px rgba(98,228,207,.25); }
.range-ends { display: flex; justify-content: space-between; margin-top: 3px; color: #64778e; font-size: 8px; font-variant-numeric: tabular-nums; }
.units-note { color: #72859a; font-size: 8px; font-weight: 850; letter-spacing: .11em; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 2px 0 15px; }
.preset-btn { min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); color: #9aacc0; cursor: pointer; transition: .2s ease; }
.preset-btn.selected { border-color: rgba(98,228,207,.36); background: rgba(98,228,207,.07); color: var(--text); }
.preset-swatch { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 7px; position: relative; overflow: hidden; background: #132635; }
.preset-swatch::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 4px, rgba(98,228,207,.85) 4px 5px, transparent 5px 8px); }
.preset-swatch.washed::before { background: linear-gradient(90deg, transparent, rgba(98,228,207,.2), rgba(98,228,207,.5), rgba(98,228,207,.2), transparent); filter: blur(2px); }
.preset-btn b { display: block; font-size: 9px; font-weight: 720; }
.preset-btn small { display: block; color: #71849a; font-size: 7px; margin-top: 3px; white-space: nowrap; }
.readout-section { padding-bottom: 14px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout { min-width: 0; padding: 9px 10px 8px; border: 1px solid rgba(166,190,220,.1); border-radius: 9px; background: rgba(255,255,255,.018); }
.readout span { display: block; color: #8194aa; font-size: 8px; font-weight: 650; }
.readout strong { display: block; margin-top: 5px; color: #e9f5f6; font-size: 17px; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout strong small { color: #91a6b7; font-size: 9px; font-weight: 600; letter-spacing: 0; }
.readout i { display: block; margin-top: 4px; color: #5f738a; font-size: 8px; font-style: normal; }
.check-line { display: flex; align-items: center; gap: 9px; padding: 9px 10px; margin-top: 8px; border: 1px solid rgba(98,228,207,.16); border-radius: 9px; background: rgba(98,228,207,.045); }
.check-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 20px; border-radius: 6px; background: rgba(98,228,207,.12); color: var(--accent); font-size: 11px; }
.check-line span { display: block; color: #83a99f; font-size: 7px; font-weight: 850; letter-spacing: .12em; }
.check-line strong { display: block; margin-top: 4px; color: #c2d5d8; font-size: 9px; font-weight: 600; font-variant-numeric: tabular-nums; }
.quality-section { padding-top: 12px; padding-bottom: 12px; }
.quality-section .section-heading { margin-bottom: 9px; }
.quality-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.15); }
.quality-btn { padding: 6px; border: 0; border-radius: 6px; background: transparent; color: #74879d; font-size: 8px; font-weight: 850; letter-spacing: .12em; cursor: pointer; }
.quality-btn.active { background: #1a2b3b; color: var(--accent); box-shadow: inset 0 0 0 1px rgba(98,228,207,.14); }
.science-panel { border-bottom: 1px solid var(--line); }
.science-panel summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary b { display: block; margin-top: 3px; font-size: 12px; font-weight: 680; }
.chevron { color: #7e91a7; font-size: 18px; transition: transform .2s; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 16px 15px; }
.science-content h3 { margin: 12px 0 6px; color: #b9c9d9; font-size: 9px; text-transform: uppercase; letter-spacing: .11em; }
.science-content h3:first-child { margin-top: 0; }
.science-content p { margin: 0 0 7px; }
.equation { padding: 7px 8px; border: 1px solid rgba(166,190,220,.1); border-radius: 7px; background: rgba(255,255,255,.025); color: #bde9e2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.5; }
.science-small { color: #8597aa; font-size: 9px; line-height: 1.55; }
.disclaimer { margin-top: 11px !important; padding-top: 9px; border-top: 1px solid var(--line); color: #70849a; font-size: 8px; line-height: 1.5; }
.footer-note { display: flex; justify-content: space-between; gap: 8px; padding: 11px 16px 14px; color: #52657a; font-size: 7px; font-weight: 850; letter-spacing: .12em; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 700px) {
  .topbar { height: 56px; flex-basis: 56px; padding: 0 13px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 14px; }
  .eyebrow { font-size: 8px; }
  .topbar-meta { gap: 8px; font-size: 8px; }
  .model-tag, .topbar-divider { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(270px, 42dvh) minmax(0,1fr); gap: 8px; padding: 8px; height: calc(100dvh - 56px); }
  .stage-card { border-radius: 13px; }
  .stage-head { min-height: 47px; padding: 8px 11px 7px; }
  .stage-title { font-size: 11px; margin-top: 3px; }
  .scale-chip { display: none; }
  .icon-toggle { padding: 6px 7px; font-size: 8px; }
  .icon-toggle svg { width: 12px; height: 12px; }
  .canvas-corner-note { top: 8px; right: 10px; font-size: 7px; }
  .stage-caption { min-height: 47px; padding: 7px 11px; gap: 8px; }
  .caption-icon { width: 23px; height: 23px; flex-basis: 23px; font-size: 11px; }
  .caption-label { font-size: 7px; margin-bottom: 2px; }
  .stage-caption p { font-size: 9px; line-height: 1.35; }
  .control-card { border-radius: 13px; }
  .control-scroll { padding-bottom: env(safe-area-inset-bottom); }
  .control-section { padding: 12px 13px 13px; }
  .transport-section { padding-top: 12px; }
  .section-heading { margin-bottom: 10px; }
  h2 { font-size: 12px; }
  .range-control { margin-top: 13px; }
  .preset-row { margin-bottom: 12px; }
  .readout strong { font-size: 16px; }
  .science-panel summary { padding: 11px 13px; }
  .science-content { padding: 0 13px 13px; }
  .footer-note { padding: 10px 13px 13px; }
}
@media (max-width: 380px) {
  .topbar-meta { display: none; }
  .stage-head-right { gap: 5px; }
  .stage-title { max-width: 220px; }
  .preset-btn { gap: 6px; padding: 8px 6px; }
  .preset-btn small { font-size: 6.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; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.embed-mode .workspace { min-height: 0; }
@media (max-width: 700px) {
  body.embed-mode .workspace { height: calc(100dvh - 56px); flex: 1 1 auto; }
}
