:root {
  color-scheme: dark;
  --bg: #091119;
  --panel: #101b25;
  --panel-2: #0d1720;
  --line: #253542;
  --line-soft: rgba(130, 157, 177, .16);
  --text: #e7edf2;
  --muted: #91a4b3;
  --quiet: #617584;
  --accent: #e6a05b;
  --accent-soft: rgba(230, 160, 91, .13);
  --water: #6cb8ca;
  --air: #c4dce3;
  --danger: #e18b72;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 68px minmax(0, 1fr) 25px; gap: 0; padding: 0 20px; max-width: 1920px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; border: 1px solid rgba(230,160,91,.65); border-radius: 8px; display: flex; align-items: end; justify-content: center; gap: 3px; padding: 6px; transform: rotate(-4deg); }
.brand-mark span { display: block; width: 3px; border-radius: 2px; background: var(--accent); }
.brand-mark span:nth-child(1) { height: 7px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 9px; opacity: .8; }
.eyebrow, .section-kicker, .readout-label, .transport-label, .footerbar, .canvas-corner { letter-spacing: .12em; text-transform: uppercase; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 700; line-height: 1.2; }
.brand-name { font-size: 12px; letter-spacing: .16em; font-weight: 750; margin-top: 4px; white-space: nowrap; }
.brand-name span { color: var(--accent); padding: 0 3px; }
.topbar-right { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; letter-spacing: .12em; font-weight: 700; white-space: nowrap; }
.status-dot, .live-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(230,160,91,.6); }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; padding: 14px 0 10px; }
.stage-card, .control-card { min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.13); }
.stage-card { display: flex; flex-direction: column; }
.stage-head { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 10px; border-bottom: 1px solid var(--line-soft); }
.stage-heading { min-width: 0; }
h1 { margin: 5px 0 0; font-size: clamp(18px, 2vw, 23px); letter-spacing: -.035em; font-weight: 690; line-height: 1.08; }
.view-tabs { display: flex; gap: 4px; padding: 4px; background: #0a141c; border: 1px solid var(--line); border-radius: 9px; flex-shrink: 0; }
.view-tab { border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 7px 10px; font-size: 10px; font-weight: 650; cursor: pointer; transition: color .18s ease, background .18s ease, transform .18s ease; }
.view-tab:hover { color: var(--text); }
.view-tab.active { color: #1b1712; background: var(--accent); box-shadow: 0 2px 12px rgba(230,160,91,.15); }
.canvas-wrap { position: relative; flex: 1; min-height: 180px; background: #0b151e; overflow: hidden; }
#machineCanvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-corner { position: absolute; bottom: 11px; display: flex; align-items: center; gap: 7px; color: rgba(178,197,209,.72); font-size: 8px; font-weight: 700; pointer-events: none; }
.canvas-corner-left { left: 14px; }
.canvas-corner-right { right: 14px; }
.corner-line { width: 17px; height: 1px; background: var(--accent); }
.live-indicator { width: 5px; height: 5px; }
.state-caption { min-height: 30px; display: flex; align-items: center; padding: 0 15px; border-top: 1px solid var(--line-soft); color: #b3c4ce; background: rgba(7,14,20,.2); font-size: 9px; line-height: 1.35; }
.transport-bar { height: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 13px; border-top: 1px solid var(--line-soft); background: rgba(7,14,20,.38); }
.transport-controls, .transport-right { display: flex; align-items: center; gap: 6px; }
.icon-button, .capture-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #111e28; color: #c4d0d8; font-size: 10px; font-weight: 650; cursor: pointer; transition: border-color .16s ease, background .16s ease, color .16s ease; }
.icon-button:hover, .capture-button:hover { border-color: rgba(230,160,91,.7); color: var(--text); background: #182632; }
.pause-glyph { width: 9px; height: 10px; border-left: 2px solid currentColor; border-right: 2px solid currentColor; }
.play-glyph { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid currentColor; }
.step-glyph { width: 10px; height: 10px; border-right: 2px solid currentColor; position: relative; }
.step-glyph::before { content: ""; position: absolute; left: 0; top: 1px; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid currentColor; }
.reset-glyph { font-size: 16px; line-height: 1; }
.transport-label { color: var(--quiet); font-size: 8px; font-weight: 750; margin-right: 2px; }
.quality-switch { display: flex; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: #0b151d; }
.quality-switch button { border: 0; border-radius: 5px; background: transparent; color: var(--muted); padding: 4px 7px; font-size: 9px; cursor: pointer; }
.quality-switch button.selected { background: #273541; color: var(--text); }
.capture-button { color: var(--accent); }
.capture-button span { font-size: 13px; }
.control-card { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #354957 transparent; padding: 14px 14px 10px; }
.control-card::-webkit-scrollbar { width: 6px; }
.control-card::-webkit-scrollbar-thumb { background: #354957; border-radius: 8px; }
.section-kicker { color: var(--muted); font-size: 9px; font-weight: 760; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-index { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.readout { min-width: 0; padding: 9px 10px 8px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(5,12,18,.26); }
.primary-readout { grid-column: 1 / -1; border-color: rgba(230,160,91,.26); background: linear-gradient(120deg, rgba(230,160,91,.09), rgba(5,12,18,.2)); }
.readout-label { color: var(--muted); font-size: 7px; font-weight: 750; white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.readout-label span { color: var(--quiet); margin-left: 0; font-size: 5.5px; letter-spacing: .08em; flex-shrink: 0; }
.readout-value { margin-top: 4px; color: var(--text); font-size: 22px; line-height: 1; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.primary-readout .readout-value { color: var(--accent); font-size: 27px; }
.readout-value small { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0; margin-left: 2px; }
.readout-sub { color: var(--quiet); font-size: 8px; margin-top: 5px; }
.readout-track { height: 3px; margin-top: 8px; background: #253440; border-radius: 4px; overflow: hidden; }
.readout-track span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s ease; }
.power-line { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px 0; color: var(--quiet); font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.power-line strong { color: #d0dbe2; font-size: 11px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.kind-note { color: var(--quiet); font-size: 7px; letter-spacing: .1em; margin-left: auto; }
.panel-divider { height: 1px; background: var(--line-soft); margin: 13px 0; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.preset-button { display: flex; align-items: center; gap: 7px; text-align: left; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #0d1720; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.preset-button:hover { border-color: rgba(230,160,91,.5); }
.preset-button.selected { border-color: rgba(230,160,91,.65); background: var(--accent-soft); }
.preset-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 6px; background: rgba(230,160,91,.12); color: var(--accent); font-size: 17px; }
.preset-button strong { display: block; color: var(--text); font-size: 9px; line-height: 1.25; }
.preset-button small { display: block; color: var(--quiet); font-size: 8px; margin-top: 3px; }
.control-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.range-control { min-width: 0; }
.range-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.range-heading label { color: #d1dce3; font-size: 10px; font-weight: 600; }
.range-heading output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 5px 0 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 50%), #344653 var(--fill, 50%), #344653 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: #344653; }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; border: 2px solid #0d1720; background: var(--accent); box-shadow: 0 0 0 1px rgba(230,160,91,.7); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; border: 2px solid #0d1720; background: var(--accent); box-shadow: 0 0 0 1px rgba(230,160,91,.7); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.range-scale { display: flex; justify-content: space-between; color: var(--quiet); font-size: 8px; margin-top: -1px; }
.model-warning { display: flex; align-items: flex-start; gap: 7px; margin-top: 10px; padding: 8px; border: 1px solid rgba(225,139,114,.35); border-radius: 7px; color: #e8b5a6; background: rgba(225,139,114,.08); font-size: 9px; line-height: 1.4; }
.model-warning[hidden] { display: none; }
.warning-mark { display: grid; place-items: center; width: 14px; height: 14px; flex: 0 0 14px; border-radius: 50%; background: rgba(225,139,114,.18); color: var(--danger); font-weight: 800; }
.check-card { padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(5,12,18,.26); }
.check-title { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: #d2dce3; font-size: 9px; font-weight: 650; }
.check-tag { padding: 3px 5px; border-radius: 4px; background: rgba(108,184,202,.1); color: var(--water); font-size: 7px; letter-spacing: .1em; }
.check-equation { color: var(--accent); font-size: 16px; font-weight: 650; letter-spacing: .02em; margin: 6px 0 8px; }
.check-values { display: flex; justify-content: space-between; gap: 8px; color: var(--quiet); font-size: 8px; }
.check-values strong { display: block; color: var(--text); font-size: 11px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.check-difference { display: flex; justify-content: space-between; border-top: 1px solid var(--line-soft); margin-top: 8px; padding-top: 7px; color: var(--quiet); font-size: 8px; }
.check-difference strong { color: #a9d0bd; font-size: 10px; font-variant-numeric: tabular-nums; }
.science-panel { margin-top: 13px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.science-panel summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; color: var(--muted); font-size: 9px; letter-spacing: .12em; font-weight: 750; user-select: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-chevron { margin-left: auto; color: var(--accent); font-size: 16px; transition: transform .18s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 10px 1px 3px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.science-content h3 { color: var(--text); font-size: 12px; margin: 0 0 5px; }
.science-content h4 { color: #d4dfe6; font-size: 9px; margin: 11px 0 5px; letter-spacing: .04em; }
.science-content p { margin: 5px 0; }
.science-content ul { margin: 5px 0; padding-left: 16px; }
.science-content li { margin: 3px 0; }
.science-content b { color: #d7e1e7; }
.historical-note { border-left: 2px solid var(--accent); padding-left: 8px; margin-top: 10px !important; color: #bac8d1; }
.model-disclaimer { color: var(--quiet); font-style: italic; margin-top: 9px !important; }
.footerbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #627684; font-size: 7px; font-weight: 700; white-space: nowrap; }
.footerbar span:last-child { color: #a9c9b7; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 980px) and (min-width: 761px) {
  .app-shell { padding: 0 12px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 310px; gap: 10px; }
  .control-card { padding: 12px 11px 9px; }
  .stage-head { padding-left: 12px; padding-right: 12px; }
  .view-tab { padding: 7px 8px; }
}
@media (max-width: 760px) {
  body { overflow: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { padding: 0 9px; grid-template-rows: 57px minmax(0, 1fr) 22px; }
  .topbar { gap: 8px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-name { font-size: 10px; letter-spacing: .12em; }
  .topbar-right { font-size: 7px; letter-spacing: .08em; gap: 6px; }
  .workspace { display: flex; flex-direction: column; gap: 9px; padding: 9px 0 7px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .stage-card { flex: 0 0 auto; }
  .stage-head { min-height: 61px; padding: 9px 10px; flex-wrap: wrap; }
  h1 { font-size: 18px; }
  .stage-heading .eyebrow { font-size: 8px; }
  .view-tabs { gap: 2px; padding: 3px; }
  .view-tab { padding: 6px 8px; font-size: 9px; }
  .canvas-wrap { height: clamp(235px, 34vh, 310px); flex: none; }
  .state-caption { min-height: 31px; padding: 0 10px; font-size: 8px; }
  .transport-bar { height: 43px; padding: 0 8px; }
  .icon-button, .capture-button { height: 28px; padding: 0 7px; font-size: 9px; }
  .transport-label { display: none; }
  .control-card { flex: 0 0 auto; overflow: visible; padding: 12px 11px 10px; }
  .readout-grid { gap: 6px; }
  .readout { padding: 8px; }
  .readout-value { font-size: 19px; }
  .primary-readout .readout-value { font-size: 24px; }
  .control-list { grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 11px; }
  .range-heading label { font-size: 9px; }
  .range-heading output { font-size: 9px; }
  .range-scale { font-size: 7px; }
  .footerbar { font-size: 6px; gap: 5px; }
  .footerbar span:nth-child(2) { display: none; }
}
@media (max-width: 390px) {
  .topbar-right { max-width: 108px; white-space: normal; line-height: 1.35; }
  .stage-head { gap: 7px; }
  .view-tab { padding: 6px 6px; font-size: 8px; }
  .capture-button { font-size: 8px; }
  .readout-label { font-size: 7px; }
  .readout-value { font-size: 17px; }
  .primary-readout .readout-value { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
