:root {
  color-scheme: dark;
  --bg: #0b1017;
  --panel: #111923;
  --panel-2: #151f2b;
  --line: #263341;
  --line-soft: rgba(128, 153, 174, .16);
  --text: #e8edf1;
  --muted: #8c9aa8;
  --dim: #657483;
  --accent: #e7a85a;
  --accent-bright: #ffc477;
  --accent-soft: rgba(231, 168, 90, .12);
  --green: var(--accent);
  --radius: 14px;
  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 { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% -40%, rgba(39, 62, 81, .35), transparent 55%), var(--bg); }
.topbar { min-height: 72px; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); gap: 18px; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(231,168,90,.55); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-8deg); background: linear-gradient(145deg, rgba(231,168,90,.15), rgba(231,168,90,.02)); }
.brand-mark span { width: 3px; border-radius: 2px; background: var(--accent); display: block; }
.brand-mark span:nth-child(1) { height: 10px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .75; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .18em; line-height: 1.3; }
h1 { font-size: 18px; letter-spacing: -.035em; line-height: 1.25; margin: 3px 0 0; font-weight: 720; }
h1 span { color: #aab7c2; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.model-tag { color: #a7b2bd; font-size: 9px; letter-spacing: .12em; font-weight: 750; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.model-tag i { display: block; width: 6px; height: 6px; background: var(--green); border-radius: 50%; box-shadow: 0 0 10px rgba(231,168,90,.6); }
.icon-button { display: inline-flex; align-items: center; gap: 8px; background: #182330; border: 1px solid #334252; border-radius: 9px; padding: 8px 11px; color: #dbe3e9; font-size: 11px; font-weight: 650; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.icon-button:hover { background: #202e3c; border-color: #647586; transform: translateY(-1px); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 352px; grid-template-rows: minmax(0, 1fr); gap: 16px; padding: 16px 20px 12px; max-width: 1680px; width: 100%; margin: 0 auto; overflow: hidden; }
.exhibit-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a4b5a transparent; }
.stage-card { min-height: 0; flex: 1 1 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, #111b25, #0d151e 72%); box-shadow: 0 14px 40px rgba(0,0,0,.17); }
.stage-toolbar { min-height: 48px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
.view-switch { display: inline-flex; align-items: center; gap: 3px; background: #0b121a; padding: 3px; border: 1px solid #273442; border-radius: 9px; }
.view-button { border: 0; border-radius: 6px; background: transparent; color: #8291a0; padding: 6px 11px; font-size: 10px; font-weight: 650; cursor: pointer; transition: color .18s, background .18s; }
.view-button:hover { color: #e3eaf0; }
.view-button.active { background: #283442; color: var(--accent-bright); box-shadow: inset 0 0 0 1px rgba(231,168,90,.12); }
.stage-tools { display: flex; align-items: center; gap: 13px; }
.quiet-button { border: 1px solid #344353; background: #16212d; border-radius: 6px; padding: 5px 8px; color: #aebbc6; font-size: 9px; font-weight: 800; letter-spacing: .08em; cursor: pointer; }
.quiet-button:hover { border-color: var(--accent); color: var(--accent-bright); }
.stage-index { color: #687989; font-size: 9px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.stage-index b { color: var(--accent); padding: 0 4px; }
.canvas-wrap { flex: 1 1 auto; min-height: 220px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 48%, rgba(38,54,67,.3), transparent 70%), #0c141d; }
#machineCanvas { display: block; width: 100%; height: 100%; }
.canvas-corner { position: absolute; z-index: 1; color: #718292; font-size: 8px; font-weight: 750; letter-spacing: .13em; pointer-events: none; }
.corner-tl { top: 14px; left: 16px; display: flex; align-items: center; gap: 7px; }
.corner-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(231,168,90,.65); }
.corner-br { bottom: 12px; right: 16px; }
.corner-br span { color: var(--accent); padding: 0 4px; }
.stage-footer { min-height: 64px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line-soft); background: rgba(14,22,31,.8); }
.caption-icon { flex: 0 0 20px; height: 20px; border: 1px solid rgba(231,168,90,.45); border-radius: 50%; color: var(--accent); display: grid; place-items: center; font-family: Georgia, serif; font-size: 12px; font-style: italic; }
.stage-footer p { flex: 1; margin: 0; color: #a5b1bc; font-size: 11px; line-height: 1.5; max-width: 760px; }
.transport-controls { display: flex; gap: 5px; flex: 0 0 auto; }
.transport-button { width: 31px; height: 31px; border-radius: 8px; border: 1px solid #344454; background: #16222e; display: grid; place-items: center; color: #aab7c2; cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.transport-button:hover { background: #253443; color: var(--accent-bright); border-color: #7c6549; }
.transport-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.play-button { background: var(--accent); border-color: var(--accent); color: #1b1b1b; }
.play-button:hover { background: var(--accent-bright); color: #171717; border-color: var(--accent-bright); }
.readout-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.readout { min-width: 0; border: 1px solid var(--line); background: linear-gradient(145deg, #121c27, #101720); border-radius: 10px; padding: 10px 11px 9px; }
.readout-label { color: #8b9aa8; font-size: 8px; letter-spacing: .105em; font-weight: 800; white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.readout-label span { color: #667789; font-size: 7px; letter-spacing: .06em; }
.readout-value { display: flex; align-items: baseline; gap: 5px; margin-top: 7px; white-space: nowrap; }
.readout-value strong { font-size: clamp(17px, 1.8vw, 23px); letter-spacing: -.04em; font-weight: 700; font-variant-numeric: tabular-nums; }
.readout-value small { color: #8998a6; font-size: 10px; }
.readout-foot { margin-top: 4px; color: #6f8090; font-size: 8px; line-height: 1.3; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: #718392; }
.status-dot.running { background: var(--accent); box-shadow: 0 0 7px rgba(231,168,90,.5); }
.science-card { flex: 0 0 auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 11px; background: #101923; overflow: hidden; }
.science-toggle { width: 100%; border: 0; padding: 11px 14px; background: transparent; display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; }
.science-toggle:hover { background: rgba(255,255,255,.025); }
.science-symbol { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-family: Georgia,serif; font-size: 17px; }
.science-toggle span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.science-toggle strong { font-size: 11px; font-weight: 700; }
.science-toggle small { color: #7d8d9c; font-size: 9px; }
.chevron { width: 16px; height: 16px; fill: none; stroke: #8797a5; stroke-width: 1.7; transition: transform .2s; }
.science-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.science-body { border-top: 1px solid var(--line-soft); padding: 14px; }
.science-grid { display: grid; grid-template-columns: 1fr; gap: 9px; }
.equation-block { padding: 11px; border: 1px solid #263544; border-radius: 9px; background: #0d151e; }
.micro-label { color: #8797a5; font-size: 8px; font-weight: 800; letter-spacing: .1em; display: flex; justify-content: space-between; gap: 8px; }
.tag-text { color: var(--accent); font-size: 7px; white-space: nowrap; }
.equation { color: #f1c48c; font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.45; margin: 9px 0 7px; white-space: normal; overflow-wrap: anywhere; }
.equation sub { font-size: 10px; }
.equation-block p, .model-notes p { margin: 0; color: #91a0ad; font-size: 10px; line-height: 1.55; }
.model-notes { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
.model-notes > div { padding: 11px 12px; background: rgba(255,255,255,.025); border-radius: 8px; }
.model-notes strong { color: #c5d0d8; font-size: 9px; }
.model-notes p { margin-top: 5px; }
.verification-row { margin-top: 12px; padding: 11px 12px; border: 1px solid rgba(231,168,90,.22); border-radius: 8px; background: rgba(231,168,90,.055); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.verification-row span { color: #b49a79; font-size: 8px; letter-spacing: .1em; font-weight: 800; }
.verification-row strong { color: #f1c38c; font-size: 12px; font-variant-numeric: tabular-nums; }
.verification-row small { color: #8e7d67; font-size: 9px; margin-left: auto; }
.disclaimer { margin: 12px 0 0; color: #748391; font-size: 9px; }
.control-panel { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(165deg, #131d28, #0f1720 70%); padding: 17px 16px 14px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #3a4b5a transparent; }
.panel-heading h2 { margin: 5px 0 5px; font-size: 19px; letter-spacing: -.04em; }
.panel-heading p { margin: 0; color: #8b9aa7; font-size: 10px; line-height: 1.55; max-width: 290px; }
.preset-section { margin-top: 18px; }
.section-kicker { display: flex; align-items: center; justify-content: space-between; color: #8c9ba8; font-size: 8px; letter-spacing: .12em; font-weight: 800; margin-bottom: 9px; }
.section-kicker span { color: #647789; font-size: 7px; letter-spacing: .08em; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 8px; border-radius: 9px; border: 1px solid #2c3b49; background: #111b26; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.preset-button:hover { border-color: #68798a; }
.preset-button.selected { border-color: rgba(231,168,90,.7); background: rgba(231,168,90,.075); }
.preset-glyph { color: var(--accent); font-size: 18px; width: 19px; text-align: center; }
.preset-button span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.preset-button strong { color: #dbe2e8; font-size: 9px; font-weight: 700; white-space: nowrap; }
.preset-button small { color: #81909e; font-size: 8px; white-space: nowrap; }
.controls-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.control-row { margin-top: 12px; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.control-top label { color: #c7d0d8; font-size: 10px; font-weight: 620; }
.control-top output { color: var(--accent-bright); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 5px 0 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) 0 var(--range-pct, 50%), #526171 var(--range-pct, 50%) 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: #526171; }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--accent); border-radius: 3px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; margin-top: -5px; background: var(--accent-bright); border: 2px solid #2b3138; box-shadow: 0 0 0 2px rgba(231,168,90,.17); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-bright); border: 2px solid #2b3138; box-shadow: 0 0 0 2px rgba(231,168,90,.17); }
.range-ends { display: flex; justify-content: space-between; color: #657584; font-size: 8px; margin-top: 1px; }
.drive-section { margin-top: 17px; }
.panel-footnote { display: flex; gap: 9px; padding: 11px 10px; border: 1px solid #293846; border-radius: 9px; margin-top: 19px; background: rgba(255,255,255,.025); }
.footnote-mark { flex: 0 0 17px; width: 17px; height: 17px; border: 1px solid #6e5b43; border-radius: 50%; display: grid; place-items: center; color: var(--accent); font-family: Georgia,serif; font-style: italic; font-size: 10px; }
.panel-footnote p { margin: 0; color: #8493a0; font-size: 9px; line-height: 1.5; }
.panel-footnote strong { color: #c3ced7; }
.page-footer { min-height: 26px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px 8px; color: #586877; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.page-footer i { color: var(--accent); font-style: normal; padding: 0 3px; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0,1fr) 380px; padding-left: 26px; padding-right: 26px; }
  .readout { padding: 12px 14px; }
  .readout-label { font-size: 9px; }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0,1fr) 320px; padding: 12px; gap: 12px; }
  .readout-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .readout { padding: 9px 10px; }
  .canvas-wrap { min-height: 280px; }
}
@media (max-width: 760px) {
  .topbar { min-height: 62px; padding: 9px 12px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 16px; }
  .model-tag { display: none; }
  .topbar-right { gap: 7px; }
  .icon-button { padding: 7px 9px; }
  .workspace { display: flex; flex-direction: column; grid-template-rows: auto; padding: 10px; gap: 12px; overflow-y: auto; overflow-x: hidden; }
  .exhibit-column { display: contents; overflow: visible; }
  .stage-card { order: 0; flex: 0 0 auto; }
  .canvas-wrap { height: clamp(250px, 39dvh, 380px); min-height: 250px; flex: 0 0 auto; }
  .stage-toolbar { min-height: 45px; padding: 6px 8px; }
  .view-button { padding: 6px 8px; font-size: 9px; }
  .stage-index { display: none; }
  .stage-tools { gap: 0; }
  .stage-footer { min-height: 72px; padding: 9px; gap: 8px; }
  .stage-footer p { font-size: 10px; }
  .transport-button { width: 29px; height: 29px; }
  .readout-grid { order: 1; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .readout { padding: 10px 11px; }
  .readout-label { font-size: 8px; }
  .readout-value strong { font-size: 21px; }
  .science-card { order: 3; margin-top: 14px; }
  .control-panel { order: 2; flex: 0 0 auto; min-height: auto; overflow: visible; padding: 15px 14px; }
  .panel-heading h2 { font-size: 18px; }
  .preset-section { margin-top: 15px; }
  .controls-section { margin-top: 15px; }
  .control-row { margin-top: 13px; }
  .panel-footnote { margin-top: 16px; }
  .page-footer { padding: 2px 12px 9px; gap: 12px; font-size: 7px; }
  .science-grid { grid-template-columns: 1fr; }
  .model-notes { grid-template-columns: 1fr; }
  .verification-row { align-items: flex-start; flex-direction: column; gap: 5px; }
  .verification-row small { margin-left: 0; }
}
@media (max-width: 380px) {
  .view-button { padding: 6px 6px; font-size: 8px; }
  .stage-footer p { font-size: 9px; }
  .transport-controls { gap: 3px; }
  .transport-button { width: 26px; height: 27px; }
  .readout-label span { display: none; }
  .preset-button { gap: 5px; padding: 8px 6px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 7px; }
}
@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: 100%; min-height: 0; }
body.embed-mode .workspace { min-height: 0; }
@media (max-width: 760px) {
  body.embed-mode .workspace { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
  body.embed-mode .page-footer { flex: 0 0 24px; }
}
