:root {
  color-scheme: dark;
  --bg: #0b1118;
  --panel: #111a24;
  --panel-2: #141f2b;
  --panel-3: #182431;
  --line: rgba(168, 190, 204, .13);
  --line-strong: rgba(168, 190, 204, .22);
  --text: #e8edf0;
  --muted: #8e9ca7;
  --dim: #647480;
  --accent: #d8a65d;
  --accent-soft: rgba(216, 166, 93, .13);
  --teal: #79b9ae;
  --good: #85b99d;
  --warn: #d9a45c;
  --bad: #d4776d;
  --grid: 8px;
  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-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: 64px minmax(480px, 1fr) 132px; background: radial-gradient(ellipse at 20% 0%, rgba(36, 57, 69, .25), transparent 42%), var(--bg); }
body.embed-mode .app-shell { height: 100%; min-height: 0; grid-template-rows: 64px minmax(0, 1fr) 132px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(10, 16, 23, .94); z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(216,166,93,.45); border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); flex: 0 0 auto; }
.brand-mark svg { width: 21px; height: 21px; fill: none; stroke: var(--accent); stroke-width: 1.3; stroke-linecap: round; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .17em; font-weight: 750; }
.eyebrow span { color: var(--accent); padding: 0 4px; }
.brand-title { margin-top: 3px; font-size: 15px; font-weight: 650; letter-spacing: -.025em; }
.top-meta { display: flex; align-items: center; gap: 16px; }
.history-tag { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; color: #b9c4c9; font-size: 9px; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
.tag-dot, .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(216,166,93,.5); }
.quality-button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 5px; background: transparent; padding: 7px 10px; font-size: 9px; font-weight: 750; letter-spacing: .1em; color: var(--muted); cursor: pointer; }
.quality-button:hover { border-color: var(--line-strong); color: var(--text); }
.quality-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.workbench { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 354px; gap: 0; }
.stage-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: 52px minmax(0,1fr); border-right: 1px solid var(--line); }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(15, 23, 32, .65); }
.view-tabs { display: flex; align-items: center; gap: 4px; }
.view-tab { border: 1px solid transparent; background: transparent; color: var(--dim); font-size: 9px; font-weight: 800; letter-spacing: .12em; padding: 9px 11px; border-radius: 4px; cursor: pointer; transition: color .18s ease, background .18s ease, border-color .18s ease; }
.view-tab:hover { color: var(--text); }
.view-tab.active { color: var(--accent); border-color: rgba(216,166,93,.27); background: var(--accent-soft); }
.stage-actions { display: flex; align-items: center; gap: 14px; }
.stage-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .13em; }
.screenshot-button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.02); padding: 7px 9px; color: #aebbc1; font-size: 8px; font-weight: 800; letter-spacing: .1em; cursor: pointer; }
.screenshot-button:hover { border-color: rgba(216,166,93,.45); color: var(--accent); }
.stage-status.paused .live-dot { background: var(--dim); box-shadow: none; }
.canvas-wrap { min-height: 0; position: relative; overflow: hidden; background: radial-gradient(ellipse at 55% 48%, rgba(36, 57, 69, .3), transparent 62%), linear-gradient(180deg, #0e1720 0%, #0b131b 100%); }
#machineCanvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-corner { position: absolute; display: flex; align-items: center; gap: 8px; color: rgba(163,180,188,.56); font-size: 8px; font-weight: 750; letter-spacing: .14em; pointer-events: none; }
.corner-tl { top: 15px; left: 18px; }
.corner-br { bottom: 52px; right: 18px; }
.corner-rule { width: 18px; height: 1px; background: rgba(216,166,93,.55); }
.canvas-caption { position: absolute; bottom: 13px; left: 18px; max-width: min(70%, 570px); padding: 9px 12px; border: 1px solid rgba(168,190,204,.12); border-left: 2px solid var(--accent); border-radius: 3px; background: rgba(9,15,21,.72); backdrop-filter: blur(8px); color: #b5c0c5; font-size: 10px; line-height: 1.45; pointer-events: none; }
.control-column { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 16px; background: linear-gradient(180deg, rgba(18,27,37,.97), rgba(15,23,32,.98)); scrollbar-width: thin; scrollbar-color: #344653 transparent; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-heading h1 { margin: 4px 0 0; font-size: 17px; font-weight: 650; letter-spacing: -.035em; }
.model-pill { color: var(--teal); border: 1px solid rgba(121,185,174,.25); background: rgba(121,185,174,.07); border-radius: 4px; padding: 5px 7px; font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 17px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255,255,255,.015); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: var(--line-strong); }
.preset-button.active { border-color: rgba(216,166,93,.42); background: var(--accent-soft); }
.preset-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; color: var(--accent); background: rgba(216,166,93,.11); font-size: 16px; flex: 0 0 auto; }
.preset-button b { display: block; font-size: 9px; font-weight: 700; white-space: nowrap; }
.preset-button small { display: block; margin-top: 3px; color: var(--dim); font-size: 8px; white-space: nowrap; }
.control-group { padding: 13px 0 12px; border-top: 1px solid var(--line); }
.group-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: #aebbc1; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.group-index { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid rgba(216,166,93,.3); border-radius: 4px; color: var(--accent); font-size: 8px; }
.slider-control { margin-bottom: 13px; }
.slider-control:last-child { margin-bottom: 0; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.slider-head label { color: #d0d8dc; font-size: 10px; font-weight: 600; }
.slider-head output { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 10px; font-weight: 750; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 0; appearance: none; background: transparent; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) 0%, rgba(145,162,172,.28) 0%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(145,162,172,.28); }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #101821; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(216,166,93,.55); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #101821; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(216,166,93,.55); }
.range-ends { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; color: var(--dim); font-size: 8px; font-variant-numeric: tabular-nums; }
.range-ends em { color: #71838b; font-style: normal; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.switch-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.switch-label { min-width: 0; position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.switch-label b { display: block; color: #cbd4d8; font-size: 9px; font-weight: 700; }
.switch-label small { display: block; margin-top: 3px; color: var(--dim); font-size: 7px; white-space: nowrap; }
.switch-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: 0 0 auto; width: 28px; height: 16px; border-radius: 20px; background: #293744; border: 1px solid #3a4a55; transition: background .18s ease; }
.switch-ui::after { content: ""; display: block; width: 10px; height: 10px; margin: 2px; border-radius: 50%; background: #83919a; transition: transform .18s ease, background .18s ease; }
.switch-label input:checked + .switch-ui { background: rgba(216,166,93,.3); border-color: rgba(216,166,93,.6); }
.switch-label input:checked + .switch-ui::after { transform: translateX(12px); background: var(--accent); }
.switch-label input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 3px; }
.transport-row { display: grid; grid-template-columns: 1.1fr 1fr .8fr; gap: 7px; padding: 2px 0 14px; }
.transport-button { min-width: 0; height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 4px; background: rgba(255,255,255,.025); color: #aab7bd; font-size: 8px; font-weight: 800; letter-spacing: .1em; cursor: pointer; transition: border-color .16s ease, background .16s ease, color .16s ease; }
.transport-button:hover { color: var(--text); border-color: rgba(216,166,93,.45); }
.transport-button.primary { border-color: rgba(216,166,93,.45); background: var(--accent-soft); color: var(--accent); }
.science-wrap { border-top: 1px solid var(--line); }
.science-wrap details { padding-top: 12px; }
.science-wrap summary { display: flex; align-items: center; gap: 8px; color: #c2cdd1; cursor: pointer; list-style: none; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.science-wrap summary::-webkit-details-marker { display: none; }
.science-icon { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: rgba(121,185,174,.1); color: var(--teal); font-size: 13px; }
.summary-note { margin-left: auto; color: var(--dim); font-size: 7px; letter-spacing: .1em; }
.science-content { padding: 12px 0 4px; color: #9cabb2; font-size: 9px; line-height: 1.55; }
.science-content h2 { margin: 12px 0 5px; color: #d2dadd; font-size: 10px; font-weight: 700; }
.science-content p { margin: 5px 0; }
.science-content b { color: #cdd6da; }
.equation { color: #e2bb7d; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }
.constant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.constant-grid span { padding: 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 8px; }
.constant-grid b { display: block; margin-top: 3px; font-size: 9px; font-variant-numeric: tabular-nums; }
.constant-grid em { display: block; margin-top: 3px; color: #778a91; font-style: normal; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.disclaimer { padding-top: 8px; border-top: 1px solid var(--line); color: #788992; font-style: italic; }
.telemetry { min-height: 0; display: grid; grid-template-rows: 19px 1fr 22px; padding: 8px 20px 7px; border-top: 1px solid var(--line); background: #0d151e; }
.telemetry-head { display: flex; align-items: center; justify-content: space-between; }
.stability-state { display: inline-flex; align-items: center; gap: 6px; color: var(--good); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.stability-state i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stability-state.warning { color: var(--warn); }
.stability-state.danger { color: var(--bad); }
.readout-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); align-items: center; gap: 10px; padding: 2px 0 4px; }
.readout { min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); }
.readout:first-child { padding-left: 0; border-left: 0; }
.readout-label { display: block; color: var(--dim); font-size: 7px; font-weight: 800; letter-spacing: .14em; white-space: nowrap; }
.readout div { display: flex; align-items: baseline; gap: 5px; margin-top: 2px; white-space: nowrap; }
.readout strong { color: #e4ebed; font-size: 20px; line-height: 1.1; font-weight: 550; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout small { color: var(--muted); font-size: 8px; }
.readout em { display: block; margin-top: 3px; color: #62747e; font-style: normal; font-size: 6px; font-weight: 800; letter-spacing: .12em; }
.audit-line { min-width: 0; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); color: var(--dim); font-size: 8px; white-space: nowrap; overflow: hidden; }
.audit-line b { color: #aebbc0; font-size: 7px; letter-spacing: .11em; }
.audit-mark { display: grid; place-items: center; width: 14px; height: 14px; border: 1px solid rgba(121,185,174,.35); border-radius: 50%; color: var(--teal); font-size: 9px; flex: 0 0 auto; }
.audit-line strong { margin-left: auto; color: var(--teal); font-size: 8px; font-weight: 800; letter-spacing: .06em; }
.audit-line em { color: #62747e; font-style: normal; font-size: 6px; font-weight: 800; letter-spacing: .1em; }
@media (max-width: 900px) {
  .app-shell { grid-template-rows: 58px minmax(520px,1fr) 124px; }
  body.embed-mode .app-shell { grid-template-rows: 56px minmax(0,1fr) 116px; }
  .topbar { padding: 0 14px; }
  .brand-title { font-size: 13px; }
  .history-tag { display: none; }
  .workbench { grid-template-columns: minmax(0,1fr) 310px; }
  .stage-toolbar { padding: 0 12px; }
  .control-column { padding: 14px 13px; }
  .telemetry { padding-left: 14px; padding-right: 14px; }
  .readout-grid { gap: 6px; }
  .readout strong { font-size: 18px; }
}
@media (max-width: 640px) {
  .app-shell { height: 100vh; height: 100dvh; min-height: 0; grid-template-rows: 54px minmax(0,1fr) 112px; }
  body.embed-mode .app-shell { grid-template-rows: 54px minmax(0,1fr) 112px; }
  .topbar { padding: 0 11px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-mark svg { width: 18px; height: 18px; }
  .eyebrow { font-size: 7px; }
  .brand-title { font-size: 12px; }
  .top-meta { gap: 7px; }
  .quality-button { padding: 6px 7px; font-size: 7px; }
  .workbench { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(205px, 42%) minmax(0,1fr); }
  .stage-column { grid-template-rows: 40px minmax(0,1fr); border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-toolbar { padding: 0 8px; }
  .view-tab { padding: 7px 8px; font-size: 8px; }
  .stage-status { font-size: 7px; }
  .stage-actions { gap: 7px; }
  .screenshot-button { padding: 6px 7px; font-size: 7px; }
  .canvas-corner { font-size: 6px; gap: 5px; }
  .corner-tl { top: 8px; left: 9px; }
  .corner-br { bottom: 38px; right: 9px; }
  .canvas-caption { bottom: 7px; left: 8px; max-width: 78%; padding: 6px 8px; font-size: 8px; }
  .control-column { padding: 11px 12px 14px; }
  .panel-heading { margin-bottom: 9px; }
  .panel-heading h1 { font-size: 15px; }
  .preset-row { margin-bottom: 10px; gap: 6px; }
  .preset-button { padding: 7px 6px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 7px; }
  .control-group { padding: 9px 0; }
  .group-heading { margin-bottom: 8px; font-size: 8px; }
  .slider-control { margin-bottom: 9px; }
  .slider-head { margin-bottom: 4px; }
  .slider-head label, .slider-head output { font-size: 9px; }
  .range-ends { font-size: 7px; }
  .switch-row { padding: 9px 0; }
  .transport-row { padding-bottom: 10px; }
  .science-wrap details { padding-top: 9px; }
  .telemetry { grid-template-rows: 15px 1fr 20px; padding: 6px 9px 5px; }
  .telemetry-head .eyebrow { font-size: 7px; }
  .stability-state { font-size: 7px; }
  .readout-grid { gap: 2px; padding: 2px 0; }
  .readout { padding-left: 5px; }
  .readout-label { font-size: 5.5px; letter-spacing: .08em; }
  .readout strong { font-size: 14px; }
  .readout small { font-size: 6px; }
  .readout em { font-size: 5px; letter-spacing: .06em; }
  .audit-line { gap: 5px; font-size: 6px; }
  .audit-line b { font-size: 5.5px; }
  .audit-line strong { font-size: 6px; }
  .audit-line em { display: none; }
}
@media (max-width: 360px) {
  .readout strong { font-size: 12px; }
  .readout-label { font-size: 5px; }
  .readout em { letter-spacing: 0; }
  .view-tab { padding-left: 6px; padding-right: 6px; }
  .stage-status { letter-spacing: .06em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
