:root {
  color-scheme: dark;
  --bg: #0b1015;
  --panel: #111820;
  --panel-raised: #151f28;
  --panel-soft: #0f171e;
  --line: rgba(221, 230, 235, .105);
  --line-strong: rgba(221, 230, 235, .17);
  --text: #edf0ed;
  --muted: #9ba8ad;
  --dim: #6e7c82;
  --accent: #e8ad57;
  --accent-soft: rgba(232, 173, 87, .13);
  --accent-line: rgba(232, 173, 87, .42);
  --green: #a5c5a2;
  --radius: 14px;
  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; background: var(--bg); color: var(--text); overflow-x: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: 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: grid; grid-template-rows: 72px minmax(600px, 1fr) auto; background: radial-gradient(ellipse at 42% 8%, rgba(45, 61, 67, .18), transparent 45%), var(--bg); }
body.embed-mode .app-shell { height: 100%; min-height: 0; grid-template-rows: 72px minmax(0, 1fr) auto; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(11, 16, 21, .94); z-index: 2; }
.identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 31px; height: 31px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 6px 5px; border: 1px solid var(--accent-line); border-radius: 9px; background: var(--accent-soft); transform: rotate(-7deg); }
.brand-mark span { display: block; width: 4px; border-radius: 5px; background: var(--accent); transform: skew(-16deg); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 14px; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .8; }
.identity-copy { min-width: 0; }
.eyebrow { margin: 0 0 3px; color: var(--dim); font-size: 9px; font-weight: 800; letter-spacing: .16em; line-height: 1.2; }
.eyebrow-divider { color: var(--accent); padding: 0 4px; }
h1 { margin: 0; color: var(--text); font-size: 20px; line-height: 1.15; letter-spacing: -.035em; font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 17px; }
.model-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .13em; white-space: nowrap; }
.chip-dot, .live-dot-label i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(165,197,162,.45); }
.icon-button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 650; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.icon-button:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 374px; min-height: 0; }
.stage-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 58px minmax(260px, 1fr) auto; padding: 0 22px 18px 24px; border-right: 1px solid var(--line); }
.stage-topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.scene-label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.scene-kicker { color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .17em; }
.scene-subtitle { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-pill { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 99px; background: rgba(16,24,30,.82); color: var(--muted); font-size: 8px; font-weight: 850; letter-spacing: .12em; }
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: #7c8a8e; }
.state-pill[data-state="singing"] { border-color: var(--accent-line); color: #f0c887; background: rgba(232,173,87,.08); }
.state-pill[data-state="singing"] .state-dot { background: var(--accent); box-shadow: 0 0 12px rgba(232,173,87,.65); }
.state-pill[data-state="silent"] .state-dot { background: #82959a; }
.canvas-wrap { position: relative; min-height: 0; overflow: hidden; border: 1px solid rgba(216,226,227,.09); border-radius: 16px; background: #0d151b; box-shadow: 0 18px 50px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.025); }
#scene { display: block; width: 100%; height: 100%; }
.canvas-corner-note { position: absolute; top: 15px; left: 17px; display: flex; align-items: center; gap: 8px; color: rgba(218,225,220,.66); font-size: 8px; font-weight: 850; letter-spacing: .14em; pointer-events: none; }
.corner-line { display: inline-block; width: 18px; height: 1px; background: var(--accent); }
.scaled-tag { padding: 4px 6px; border: 1px solid rgba(220,226,224,.13); border-radius: 4px; color: #8c9999; font-size: 7px; letter-spacing: .12em; }
.canvas-legend { position: absolute; right: 16px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 13px; padding: 8px 10px; border: 1px solid rgba(223,230,228,.11); border-radius: 8px; background: rgba(8,14,18,.7); color: #a9b3b1; font-size: 7px; font-weight: 800; letter-spacing: .1em; pointer-events: none; }
.canvas-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-grain { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px rgba(232,173,87,.5); }
.legend-wave { width: 13px; height: 2px; border-radius: 4px; background: #d8c08e; box-shadow: 0 0 7px rgba(216,192,142,.45); }
.stage-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 2px 0; }
.what-seeing { max-width: 620px; margin: 0; color: #b5c0c0; font-size: 11px; line-height: 1.55; }
.causal-chain { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; color: #879397; font-size: 7px; font-weight: 850; letter-spacing: .1em; white-space: nowrap; }
.causal-chain b { color: var(--accent); font-size: 11px; font-weight: 500; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 19px 18px 16px; background: linear-gradient(180deg, rgba(20,29,37,.72), rgba(13,20,26,.72)); scrollbar-width: thin; scrollbar-color: #33414a transparent; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 17px; }
.panel-heading h2 { margin: 2px 0 0; font-size: 17px; letter-spacing: -.035em; font-weight: 650; }
.tag-illustrative { padding: 5px 6px; border: 1px solid rgba(232,173,87,.2); border-radius: 5px; color: #c9a66e; font-size: 7px; font-weight: 850; letter-spacing: .1em; white-space: nowrap; }
.section-label { margin: 0; color: #8c9a9f; font-size: 8px; font-weight: 850; letter-spacing: .15em; }
.preset-block { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 47px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(9,15,20,.4); text-align: left; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.preset-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.025); }
.preset-button:active { transform: translateY(1px); }
.preset-button.selected { border-color: var(--accent-line); background: var(--accent-soft); }
.preset-icon { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 27px; border-radius: 7px; background: rgba(232,173,87,.1); color: var(--accent); font-size: 16px; }
.preset-icon-wet { color: #9bb7c0; background: rgba(133,170,185,.1); }
.preset-icon-mixed { color: #b8a7a0; background: rgba(185,167,160,.1); }
.preset-icon-slope { color: #9aa8a1; background: rgba(154,168,161,.1); }
.preset-button strong { display: block; overflow: hidden; color: #dfe5e1; font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.preset-button small { display: block; margin-top: 3px; overflow: hidden; color: #819096; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.controls-block { padding: 15px 0 14px; border-bottom: 1px solid var(--line); }
.control-row { margin-top: 12px; }
.control-row label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #d9e0dc; font-size: 10px; font-weight: 620; }
.control-row label span { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.control-row label em { color: #79878b; font-size: 6px; font-style: normal; font-weight: 850; letter-spacing: .08em; }
.control-row output { color: #f0c887; font-variant-numeric: tabular-nums; font-size: 10px; font-weight: 750; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 5px 0 0; padding: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(232,173,87,.72), rgba(232,173,87,.18)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(232,173,87,.72), rgba(232,173,87,.18)); }
input[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4.5px; appearance: none; -webkit-appearance: none; border: 2px solid #f0c887; border-radius: 50%; background: #171d20; box-shadow: 0 0 0 3px rgba(232,173,87,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #f0c887; border-radius: 50%; background: #171d20; box-shadow: 0 0 0 3px rgba(232,173,87,.12); }
.range-ends { display: flex; justify-content: space-between; color: #66757b; font-size: 7px; font-variant-numeric: tabular-nums; }
.live-block { padding: 14px 0 13px; border-bottom: 1px solid var(--line); }
.live-heading { display: flex; align-items: center; justify-content: space-between; }
.live-dot-label { display: flex; align-items: center; gap: 6px; color: #84958f; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.live-dot-label i { width: 5px; height: 5px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.readout-card { min-width: 0; min-height: 67px; padding: 9px 9px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(8,14,19,.44); }
.readout-label { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: #89969a; font-size: 7px; font-weight: 850; letter-spacing: .08em; white-space: nowrap; }
.readout-label small { color: #6f7b7e; font-size: 5px; letter-spacing: .06em; }
.readout-card strong { display: block; margin-top: 5px; color: #f0d2a0; font-size: 18px; font-weight: 640; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.readout-card strong small { color: #a4afb0; font-size: 9px; font-weight: 550; letter-spacing: 0; }
.readout-track { height: 2px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: rgba(210,220,220,.09); }
.readout-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .12s linear; }
.check-card { border-color: rgba(165,197,162,.18); }
.check-card strong { color: #b8d0b4; font-size: 16px; }
.check-card p { margin: 5px 0 0; color: #77868a; font-size: 7px; font-variant-numeric: tabular-nums; }
.transport-block { padding-top: 14px; }
.transport-buttons { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: 6px; }
.primary-button, .small-control { min-height: 36px; border-radius: 8px; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border: 1px solid rgba(232,173,87,.58); background: var(--accent); color: #1a1711; font-size: 10px; font-weight: 850; }
.primary-button:hover { background: #f2c27c; }
.play-glyph { font-size: 9px; }
.small-control { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 36px; padding: 0 9px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.02); color: #b4c0bf; font-size: 10px; font-weight: 700; }
.small-control:hover { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }
.square-control { width: 36px; padding: 0; font-size: 16px; }
.utility-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.audio-button { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 5px 0; border: 0; background: transparent; color: #9ba9aa; cursor: pointer; font-size: 8px; }
.audio-button:hover, .audio-button[aria-pressed="true"] { color: #e9c17f; }
.audio-icon { font-size: 13px; }
.quality-toggle { display: inline-flex; align-items: center; gap: 3px; color: #77868a; font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.quality-toggle span { margin-right: 3px; }
.quality-toggle button { padding: 4px 7px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #849195; cursor: pointer; font-size: 8px; }
.quality-toggle button[aria-pressed="true"] { border-color: var(--line-strong); background: rgba(255,255,255,.05); color: #e1e6e2; }
.audio-note { margin: 4px 0 0; color: #5f6c71; font-size: 7px; }
.science-panel { position: relative; z-index: 1; border-top: 1px solid var(--line); background: #0e151b; }
.science-panel summary { display: flex; align-items: center; gap: 10px; min-height: 47px; padding: 0 24px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-summary-icon { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--accent-line); border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.science-panel summary strong { display: block; color: #dce3de; font-size: 10px; font-weight: 750; }
.science-panel summary small { display: block; margin-top: 2px; color: #78878b; font-size: 8px; }
.summary-chevron { margin-left: auto; color: #89969a; font-size: 17px; transition: transform .18s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { display: grid; grid-template-columns: 1fr 1.05fr 1fr; gap: 28px; padding: 4px 24px 22px; border-top: 1px solid rgba(220,230,230,.06); }
.science-column { min-width: 0; padding-top: 14px; }
.science-column h3 { margin: 0 0 8px; color: #dce4df; font-size: 10px; font-weight: 750; }
.science-column p, .science-column li { color: #9aa8a9; font-size: 9px; line-height: 1.6; }
.science-column p { margin: 0 0 8px; }
.science-column ul { margin: 0 0 9px; padding-left: 15px; }
.science-column li { margin-bottom: 4px; }
.equation { color: #edc786 !important; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px !important; letter-spacing: .01em; }
.equation-caption { color: #78878b !important; font-size: 8px !important; }
.disclaimer { padding-top: 6px; color: #c1c9c2 !important; }
.reference-line { color: #65747a !important; font-size: 7px !important; overflow-wrap: anywhere; }
@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 410px; }
  .control-panel { padding: 22px 22px 18px; }
  .stage-panel { padding-left: 28px; padding-right: 26px; }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 344px; }
  .stage-panel { padding-left: 16px; padding-right: 16px; }
  .control-panel { padding-left: 14px; padding-right: 14px; }
  .causal-chain { gap: 5px; font-size: 6px; }
  .science-content { gap: 18px; }
}
@media (max-width: 760px) {
  body.embed-mode .app-shell { grid-template-rows: 58px minmax(0, 1fr) 45px; }
  .app-shell { grid-template-rows: 58px auto auto; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-mark { width: 27px; height: 27px; }
  .identity { gap: 9px; }
  .eyebrow { font-size: 7px; letter-spacing: .12em; }
  h1 { font-size: 17px; }
  .top-actions { gap: 8px; }
  .model-chip { display: none; }
  .icon-button { min-height: 32px; padding: 0 8px; font-size: 9px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(270px, 1fr) minmax(0, auto); min-height: 0; }
  .stage-panel { grid-template-rows: 47px minmax(190px,1fr) auto; padding: 0 10px 10px; border-right: 0; }
  .stage-topline { gap: 6px; }
  .scene-kicker { font-size: 8px; }
  .scene-subtitle { max-width: 230px; font-size: 9px; }
  .state-pill { padding: 6px 7px; font-size: 6px; letter-spacing: .08em; }
  .canvas-wrap { border-radius: 11px; }
  .canvas-corner-note { top: 10px; left: 10px; font-size: 7px; }
  .canvas-legend { right: 8px; bottom: 8px; gap: 8px; padding: 6px 7px; font-size: 6px; }
  .stage-bottom { display: block; padding-top: 8px; }
  .what-seeing { max-width: none; font-size: 9px; line-height: 1.4; }
  .causal-chain { justify-content: flex-start; gap: 6px; margin-top: 6px; font-size: 6px; }
  .control-panel { max-height: 285px; padding: 12px 12px 13px; border-top: 1px solid var(--line); overflow-y: auto; }
  .panel-heading { margin-bottom: 10px; }
  .panel-heading h2 { font-size: 15px; }
  .preset-block { padding-bottom: 11px; }
  .preset-grid { gap: 5px; margin-top: 7px; }
  .preset-button { min-height: 39px; padding: 5px 6px; gap: 6px; }
  .preset-icon { width: 23px; height: 23px; flex-basis: 23px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 6px; }
  .controls-block { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; padding: 10px 0; }
  .controls-block > .section-label { grid-column: 1 / -1; }
  .control-row { margin-top: 9px; }
  .control-row label { font-size: 8px; }
  .control-row label em { font-size: 5px; }
  .control-row output { font-size: 9px; }
  .range-ends { font-size: 6px; }
  .live-block { padding: 10px 0; }
  .readout-grid { gap: 5px; margin-top: 7px; }
  .readout-card { min-height: 54px; padding: 7px; }
  .readout-label { font-size: 6px; }
  .readout-label small { font-size: 4px; }
  .readout-card strong { font-size: 15px; margin-top: 4px; }
  .readout-card strong small { font-size: 8px; }
  .readout-track { margin-top: 6px; }
  .check-card strong { font-size: 14px; }
  .check-card p { font-size: 6px; }
  .transport-block { padding-top: 10px; }
  .primary-button, .small-control { min-height: 32px; }
  .primary-button { font-size: 9px; }
  .small-control { min-width: 32px; padding: 0 7px; font-size: 9px; }
  .square-control { width: 32px; }
  .utility-row { margin-top: 6px; }
  .science-panel summary { min-height: 45px; padding: 0 12px; }
  .science-content { grid-template-columns: 1fr; gap: 4px; padding: 0 14px 15px; }
  .science-column { padding-top: 12px; }
  .science-column p, .science-column li { font-size: 8px; }
  body.embed-mode .science-panel[open] { max-height: 42%; overflow-y: auto; }
  body.embed-mode .science-panel[open] .science-content { padding-bottom: 12px; }
}
@media (max-width: 390px) {
  .control-panel { max-height: 300px; }
  .preset-button small { font-size: 5px; }
  .readout-label { letter-spacing: .04em; }
  .readout-label small { display: none; }
  .quality-toggle span { display: none; }
  .scene-subtitle { max-width: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
