:root {
  color-scheme: dark;
  --bg: #090d0d;
  --panel: #111817;
  --panel-raised: #151e1c;
  --line: rgba(220, 232, 214, .11);
  --line-strong: rgba(220, 232, 214, .18);
  --text: #edf1e7;
  --muted: #8f9b91;
  --subtle: #65716a;
  --accent: #d5f56b;
  --accent-dim: rgba(213, 245, 107, .13);
  --warm: #c9a879;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
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-root { min-height: 100vh; padding: 0 28px 24px; background: radial-gradient(ellipse at 16% -15%, rgba(76, 105, 81, .13), transparent 45%), var(--bg); }
body.embed-mode .app-root { height: 100%; min-height: 0; display: flex; flex-direction: column; padding-bottom: 16px; }
.topbar { width: min(1600px, 100%); margin: 0 auto; min-height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 20px; flex: 0 0 auto; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(213,245,107,.36); border-radius: 12px; color: var(--accent); font-size: 23px; background: rgba(213,245,107,.06); }
.brand-copy { min-width: 0; }
.eyebrow, .section-label, .caption-marker { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.3; text-transform: uppercase; }
.eyebrow-divider { color: var(--accent); padding: 0 5px; }
h1 { margin: 4px 0 0; font-size: clamp(19px, 2.2vw, 25px); letter-spacing: -.045em; line-height: 1.05; font-weight: 650; }
.header-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.header-chip { border: 1px solid rgba(213,245,107,.22); border-radius: 999px; color: var(--accent); padding: 7px 10px; font-size: 9px; font-weight: 750; letter-spacing: .11em; white-space: nowrap; }
.muted-chip { color: var(--muted); border-color: var(--line); }
.workspace { width: min(1600px, 100%); margin: 0 auto; padding-top: 18px; display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(350px, .78fr); gap: 18px; flex: 1 1 auto; min-height: 0; }
.stage-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-card { position: relative; min-height: 0; flex: 1 1 auto; overflow: hidden; background: #101817; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.stage-topline { height: 42px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(220,232,214,.08); flex: 0 0 auto; }
.stage-kicker { color: #b3bdb2; font-size: 9px; font-weight: 750; letter-spacing: .14em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.live-dot, .overlay-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--accent); box-shadow: 0 0 12px rgba(213,245,107,.6); }
.stage-separator { color: var(--subtle); }
.status-pill { padding: 5px 8px; border-radius: 999px; background: var(--accent-dim); color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.status-pill.quiet { color: #9aa59d; background: rgba(151,165,157,.12); }
.canvas-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #111a18; }
#scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.canvas-overlay { position: absolute; left: 16px; right: 16px; z-index: 2; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.canvas-overlay-top { top: 13px; }
.canvas-overlay-bottom { bottom: 13px; justify-content: flex-start; gap: 16px; }
.overlay-label, .overlay-scale { color: rgba(221,230,215,.62); font-size: 8px; font-weight: 700; letter-spacing: .13em; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.overlay-label { display: flex; align-items: center; gap: 7px; }
.overlay-dot { width: 5px; height: 5px; }
.overlay-scale span { color: var(--accent); padding: 0 3px; }
.legend-item { display: flex; align-items: center; gap: 6px; color: rgba(232,238,227,.72); font-size: 9px; text-shadow: 0 1px 8px rgba(0,0,0,.7); }
.legend-grain { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 800; }
.fine-grain { background: rgba(213,245,107,.2); border: 1px solid var(--accent); color: var(--accent); }
.coarse-grain { background: rgba(220,209,185,.15); border: 1px solid rgba(220,209,185,.7); color: #e4d5b7; }
.legend-line { width: 18px; height: 1px; display: inline-block; background: var(--accent); box-shadow: 0 0 7px rgba(213,245,107,.7); }
.caption-bar { min-height: 62px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(17,24,23,.82); display: grid; grid-template-columns: 138px minmax(0,1fr); gap: 12px; align-items: start; }
.caption-marker { color: var(--accent); padding-top: 2px; font-size: 8px; }
.caption-bar p { margin: 0; color: #b7c1b6; font-size: 12px; line-height: 1.5; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(213,245,107,.24) transparent; background: linear-gradient(155deg, rgba(21,30,28,.95), rgba(14,20,19,.98)); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 17px 14px; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: rgba(213,245,107,.22); border-radius: 10px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.035em; font-weight: 630; }
.panel-index { color: var(--subtle); font-size: 9px; letter-spacing: .12em; font-weight: 700; }
.section-label { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 8px; letter-spacing: .15em; }
.preset-section { margin-bottom: 17px; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-button { min-width: 0; min-height: 53px; padding: 8px 9px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.preset-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.04); }
.preset-button.active { border-color: rgba(213,245,107,.5); background: rgba(213,245,107,.075); }
.preset-icon { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; color: var(--accent); border-radius: 8px; background: rgba(213,245,107,.11); font-size: 20px; }
.quiet-icon { color: #b4bcb4; background: rgba(180,188,180,.08); }
.preset-button strong { display: block; color: var(--text); font-size: 10px; font-weight: 700; }
.preset-button small { display: block; color: var(--muted); font-size: 8px; margin-top: 3px; white-space: nowrap; }
.sliders-section { padding-top: 13px; border-top: 1px solid var(--line); }
.control-row { margin: 0 0 13px; }
.control-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.control-head label { color: #dce4d8; font-size: 10px; font-weight: 590; }
.symbol { color: var(--muted); font-size: 9px; margin-left: 3px; }
.control-head output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, rgba(213,245,107,.55), rgba(213,245,107,.18)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, rgba(213,245,107,.55), rgba(213,245,107,.18)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; border: 2px solid #101715; background: var(--accent); box-shadow: 0 0 0 1px rgba(213,245,107,.7), 0 0 10px rgba(213,245,107,.22); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #101715; background: var(--accent); box-shadow: 0 0 0 1px rgba(213,245,107,.7); }
.range-ends { display: flex; justify-content: space-between; color: var(--subtle); font-size: 8px; margin-top: 1px; }
.playback-section { padding: 13px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.playback-buttons { display: grid; grid-template-columns: 1.25fr 1fr 36px 36px; gap: 7px; }
.action-button { height: 34px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.025); color: #c9d2c7; font-size: 10px; font-weight: 650; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.action-button:hover { background: rgba(255,255,255,.07); border-color: rgba(213,245,107,.34); color: var(--text); }
.primary-action { background: var(--accent); border-color: var(--accent); color: #18200e; }
.primary-action:hover { background: #e2ff8a; border-color: #e2ff8a; color: #18200e; }
.button-symbol { font-size: 11px; font-weight: 900; }
.icon-action { font-size: 17px; }
.quality-control { margin-top: 11px; display: flex; align-items: center; justify-content: space-between; }
.quality-control > span { color: var(--subtle); font-size: 8px; font-weight: 750; letter-spacing: .13em; }
.quality-switch { padding: 2px; display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0,0,0,.18); }
.quality-switch button { padding: 4px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 8px; font-weight: 700; cursor: pointer; }
.quality-switch button.selected { background: rgba(213,245,107,.14); color: var(--accent); }
.readouts-section { padding-top: 14px; }
.textbook-tag, .illustrative-tag { margin-left: auto; color: var(--subtle); font-size: 7px; letter-spacing: .1em; font-weight: 700; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-height: 77px; padding: 10px 10px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); }
.accent-readout { border-color: rgba(213,245,107,.22); background: rgba(213,245,107,.035); }
.readout-label { color: var(--muted); font-size: 8px; font-weight: 600; display: flex; justify-content: space-between; gap: 4px; }
.readout-label span { color: var(--subtle); }
.readout-value { margin-top: 6px; color: var(--text); font-size: 21px; line-height: 1; font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.accent-readout .readout-value { color: var(--accent); }
.readout-value small { font-size: 9px; letter-spacing: 0; font-weight: 550; color: var(--muted); }
.accent-readout .readout-value small { color: rgba(213,245,107,.7); }
.readout-note { margin-top: 5px; color: var(--subtle); font-size: 7px; }
.audit-section { padding-top: 14px; }
.illustrative-tag { color: #bda47d; }
.audit-card { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.12); }
.audit-topline { display: flex; justify-content: space-between; gap: 8px; color: #cbd3c8; font-size: 9px; font-weight: 650; }
.audit-status { color: var(--subtle); font-size: 7px; letter-spacing: .08em; text-transform: uppercase; }
.audit-values { display: grid; grid-template-columns: 1fr 1px 1fr auto; gap: 9px; align-items: center; margin-top: 10px; }
.audit-values small { display: block; color: var(--subtle); font-size: 7px; white-space: nowrap; }
.audit-values strong { display: block; margin-top: 3px; color: var(--text); font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-divider { height: 28px; background: var(--line-strong); }
.audit-delta { text-align: right; }
.audit-delta span { color: var(--accent); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.audit-note { margin: 8px 0 0; color: var(--subtle); font-size: 8px; line-height: 1.45; }
.science-panel { margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.science-panel summary { list-style: none; min-height: 42px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: #dfe6da; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-chevron { color: var(--accent); font-size: 16px; transition: transform .18s ease; }
.science-panel[open] .science-chevron { transform: rotate(45deg); }
.science-content { padding: 0 0 13px; }
.science-block { padding: 9px 0; border-top: 1px solid rgba(220,232,214,.07); }
.science-block h3 { margin: 0 0 6px; color: #dce4d8; font-size: 10px; font-weight: 700; }
.science-block p { margin: 5px 0; color: #98a49a; font-size: 9px; line-height: 1.55; }
.science-block b { color: #d6dfd2; }
.equation { padding: 4px 7px; margin: 4px 0; border-left: 2px solid rgba(213,245,107,.45); background: rgba(213,245,107,.035); color: #dce7c9; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; line-height: 1.5; overflow-wrap: anywhere; }
.equation-note { font-size: 8px !important; }
.references-block p { font-size: 8px; }
.disclaimer { margin: 8px 0 0; color: #79857b; font-size: 8px; line-height: 1.45; }
.panel-footnote { margin-top: 12px; color: var(--subtle); font-size: 8px; line-height: 1.5; }
.panel-footnote span { color: #849187; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1.72fr) minmax(370px, .78fr); } }
@media (max-width: 900px) {
  .app-root { padding-left: 16px; padding-right: 16px; }
  .workspace { grid-template-columns: minmax(0, 1.35fr) minmax(315px, .9fr); gap: 12px; }
  .control-panel { padding: 14px; }
  .caption-bar { grid-template-columns: 112px minmax(0,1fr); }
}
@media (max-width: 680px) {
  .app-root { padding: 0 10px 10px; }
  body.embed-mode .app-root { padding-bottom: 8px; }
  .topbar { min-height: 66px; gap: 8px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; font-size: 18px; }
  .eyebrow { font-size: 7px; letter-spacing: .12em; }
  h1 { font-size: 19px; }
  .header-meta { gap: 5px; }
  .header-chip { padding: 5px 7px; font-size: 7px; letter-spacing: .08em; }
  .muted-chip { display: none; }
  .workspace { padding-top: 9px; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(270px, 41dvh) minmax(0,1fr); gap: 9px; }
  .stage-column { gap: 7px; }
  .stage-card { border-radius: 12px; }
  .stage-topline { height: 34px; padding: 0 11px; }
  .stage-kicker { font-size: 7px; gap: 6px; }
  .status-pill { font-size: 7px; padding: 4px 6px; }
  .canvas-overlay { left: 10px; right: 10px; }
  .canvas-overlay-top { top: 9px; }
  .canvas-overlay-bottom { bottom: 9px; gap: 10px; }
  .overlay-label, .overlay-scale { font-size: 6px; letter-spacing: .08em; }
  .legend-item { gap: 4px; font-size: 7px; }
  .legend-grain { width: 13px; height: 13px; font-size: 8px; }
  .legend-line { width: 13px; }
  .caption-bar { min-height: 48px; padding: 8px 10px; border-radius: 9px; grid-template-columns: 88px minmax(0,1fr); gap: 7px; }
  .caption-marker { font-size: 6px; }
  .caption-bar p { font-size: 9px; line-height: 1.4; }
  .control-panel { border-radius: 12px; padding: 13px 12px 12px; }
  .panel-heading { margin-bottom: 12px; }
  .panel-heading h2 { font-size: 15px; }
  .preset-button { min-height: 48px; padding: 7px; }
  .preset-icon { width: 24px; height: 24px; }
  .preset-button strong { font-size: 9px; }
  .preset-button small { font-size: 7px; }
  .control-row { margin-bottom: 12px; }
  .control-head label, .control-head output { font-size: 9px; }
  .readout-value { font-size: 19px; }
}
@media (max-width: 380px) {
  .app-root { padding-left: 8px; padding-right: 8px; }
  .header-chip { display: none; }
  .caption-bar { grid-template-columns: 76px minmax(0,1fr); }
  .caption-bar p { font-size: 8px; }
  .audit-values { gap: 6px; }
  .audit-values strong { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
