:root {
  color-scheme: dark;
  --bg: #101416;
  --panel: #171d20;
  --panel-raised: #1d2528;
  --panel-soft: #20292c;
  --line: #303a3e;
  --line-soft: #273135;
  --text: #e8e7df;
  --muted: #a0aaa8;
  --dim: #74817f;
  --accent: #d9a653;
  --accent-soft: rgba(217,166,83,.14);
  --accent-line: rgba(217,166,83,.42);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-width: 320px; 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; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { width: 100%; height: 100vh; height: 100dvh; display: grid; grid-template-rows: 68px minmax(0,1fr); overflow: hidden; background: radial-gradient(ellipse at 18% 0%, rgba(95,111,109,.09), transparent 38%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(16,20,22,.96); z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid var(--accent-line); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--accent-soft); transform: rotate(-5deg); }
.brand-mark span { width: 3px; height: 15px; border-radius: 2px; background: var(--accent); transform: skew(-15deg); }
.brand-mark span:nth-child(2) { height: 21px; }
.brand-mark span:nth-child(3) { height: 11px; }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker, .subsection-label { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .15em; line-height: 1.4; }
.eyebrow-dot { color: var(--accent); padding: 0 4px; }
h1 { margin: 2px 0 0; font-size: 19px; line-height: 1.2; letter-spacing: -.035em; font-weight: 640; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.status-pill { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; letter-spacing: .12em; font-weight: 750; }
.status-led, .live-dot, .readout-live i { width: 6px; height: 6px; border-radius: 50%; background: #8a9591; display: inline-block; }
.status-pill.running .status-led { background: var(--accent); box-shadow: 0 0 12px rgba(217,166,83,.65); }
.icon-button { height: 36px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--text); cursor: pointer; font-size: 11px; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.icon-button:hover { border-color: var(--accent-line); background: var(--panel-raised); transform: translateY(-1px); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 16px; padding: 16px 16px 16px 20px; }
.stage-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 44px minmax(0,1fr) 68px; gap: 10px; }
.stage-toolbar { display: flex; justify-content: space-between; align-items: center; min-width: 0; gap: 14px; }
.stage-heading { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stage-subtitle { color: var(--dim); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.view-tabs { display: flex; gap: 3px; padding: 3px; background: #171e21; border: 1px solid var(--line-soft); border-radius: 9px; flex-shrink: 0; }
.view-tab { border: 0; background: transparent; border-radius: 6px; padding: 8px 12px; color: var(--muted); font-size: 10px; cursor: pointer; transition: color .18s ease, background .18s ease; }
.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--panel-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(217,166,83,.18); }
.quality-toggle { height: 31px; padding: 0 9px; border: 1px solid var(--accent-line); border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .1em; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.quality-toggle:hover { background: rgba(217,166,83,.22); border-color: var(--accent); }
.canvas-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #2c3639; border-radius: 14px; background: radial-gradient(ellipse at 50% 48%, #20292b 0%, #151c1f 57%, #12181a 100%); box-shadow: 0 16px 48px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.025); }
.canvas-stage::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .28; background-image: linear-gradient(rgba(155,169,164,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(155,169,164,.06) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(to bottom, black, transparent 95%); }
#machineCanvas { display: block; width: 100%; height: 100%; position: relative; z-index: 1; }
.canvas-corner { position: absolute; z-index: 2; top: 15px; display: flex; align-items: center; gap: 8px; color: #87928f; font-size: 8px; font-weight: 750; letter-spacing: .13em; pointer-events: none; }
.canvas-corner-left { left: 17px; }
.canvas-corner-right { right: 17px; }
.corner-line { width: 15px; height: 1px; background: var(--accent); }
.live-dot { width: 5px; height: 5px; background: var(--accent); }
.canvas-legend { position: absolute; z-index: 2; left: 17px; bottom: 15px; display: flex; flex-wrap: wrap; gap: 14px; color: #87928f; font-size: 8px; font-weight: 700; letter-spacing: .09em; pointer-events: none; }
.canvas-legend span { display: flex; align-items: center; gap: 6px; }
.canvas-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.legend-metal { background: #87918e; }
.legend-stock { background: #77847f; }
.legend-accent { background: var(--accent); }
.observation-strip { display: grid; grid-template-columns: 154px minmax(0,1fr); align-items: center; gap: 16px; padding: 10px 16px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(25,32,35,.8); min-width: 0; }
.observation-mark { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.observation-icon { width: 17px; height: 17px; border: 1px solid var(--accent-line); border-radius: 50%; display: grid; place-items: center; font-family: Georgia, serif; font-size: 11px; font-style: italic; }
.observation-strip p { margin: 0; color: #b9c0bc; font-size: 10px; line-height: 1.55; }
.control-panel { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(180deg, rgba(28,36,39,.98), rgba(21,28,31,.98)); scrollbar-width: thin; scrollbar-color: #46514f transparent; }
.panel-intro { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 15px; }
.panel-intro h2 { margin: 3px 0 0; font-size: 18px; font-weight: 620; letter-spacing: -.035em; }
.model-tag { margin-top: 3px; padding: 4px 6px; border: 1px solid rgba(217,166,83,.25); border-radius: 4px; color: var(--accent); background: var(--accent-soft); font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.subsection-label { display: flex; align-items: center; justify-content: space-between; font-size: 8px; letter-spacing: .13em; }
.subsection-label span { color: #7d8985; font-size: 7px; letter-spacing: .08em; }
.preset-section { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; background: #1a2225; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: #65706d; }
.preset-button.selected { border-color: var(--accent-line); background: var(--accent-soft); }
.preset-icon { flex: 0 0 25px; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid #4b5754; border-radius: 7px; color: #b2b9b3; font-size: 17px; }
.selected .preset-icon { border-color: var(--accent-line); color: var(--accent); }
.preset-button strong { display: block; color: var(--text); font-size: 9px; line-height: 1.3; font-weight: 650; }
.preset-button small { display: block; margin-top: 3px; color: var(--dim); font-size: 8px; line-height: 1.2; }
.parameter-section { padding: 14px 0 12px; border-bottom: 1px solid var(--line-soft); }
.control-row { margin-top: 13px; }
.control-label-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.control-label-line label { color: #d7d9d2; font-size: 10px; font-weight: 600; }
.control-label-line output { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 10px; font-weight: 700; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 7px 0 1px; 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%, #68716e 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: #68716e; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #1c2325; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #1c2325; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.range-ends { display: flex; justify-content: space-between; color: #788480; font-size: 7px; font-variant-numeric: tabular-nums; }
.run-section { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr) minmax(0,.7fr); gap: 7px; padding: 13px 0 14px; border-bottom: 1px solid var(--line-soft); }
.run-button, .transport-button { min-width: 0; height: 35px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 7px; cursor: pointer; font-size: 9px; font-weight: 700; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.run-button { border: 1px solid #e0b56f; color: #1a1c1b; background: var(--accent); }
.run-button:hover { background: #e7b96f; transform: translateY(-1px); }
.run-symbol { font-size: 10px; }
.transport-button { border: 1px solid var(--line); background: #20292c; color: #c8cfca; }
.transport-button:hover { border-color: #697470; background: #263135; }
.reset-button { color: var(--muted); }
.readout-section { padding: 14px 0 12px; border-bottom: 1px solid var(--line-soft); }
.readout-heading { display: flex; justify-content: space-between; align-items: center; }
.readout-live { display: flex; align-items: center; gap: 5px; color: #7e8a85; font-size: 7px; font-weight: 750; letter-spacing: .09em; }
.readout-live i { width: 5px; height: 5px; background: var(--accent); }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.readout-card { min-width: 0; min-height: 61px; padding: 8px 9px 7px; border: 1px solid #303b3e; border-radius: 8px; background: rgba(16,22,24,.52); }
.readout-name { display: block; color: #8d9994; font-size: 8px; }
.readout-card strong { display: block; margin-top: 4px; color: #ece9df; font-size: 17px; line-height: 1.05; font-weight: 620; font-variant-numeric: tabular-nums; letter-spacing: -.03em; white-space: nowrap; }
.readout-card strong small { color: #a3ada8; font-size: 9px; font-weight: 500; letter-spacing: 0; }
.readout-provenance { display: block; margin-top: 4px; color: #697671; font-size: 6px; font-weight: 750; letter-spacing: .09em; }
.progress-wrap { margin-top: 11px; }
.progress-meta { display: flex; justify-content: space-between; align-items: center; color: #899590; font-size: 8px; }
.progress-meta strong { color: #c5cbc4; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; margin-top: 7px; border-radius: 4px; background: #313c3e; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 12px rgba(217,166,83,.35); transition: width .2s linear; }
.science-panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(16,22,24,.38); }
.science-panel summary { min-height: 42px; padding: 0 11px; display: flex; align-items: center; gap: 9px; list-style: none; cursor: pointer; color: #d6dbd4; font-size: 10px; font-weight: 650; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-symbol { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--accent-line); border-radius: 6px; color: var(--accent); font-family: Georgia, serif; font-size: 13px; }
.summary-hint { margin-left: auto; color: #73807b; font-size: 7px; font-weight: 750; letter-spacing: .1em; }
.science-content { padding: 0 12px 13px; color: #aeb8b1; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 11px 0 5px; color: #d7dcd4; font-size: 9px; letter-spacing: .04em; }
.science-content p { margin: 5px 0 8px; }
.equation-block { display: grid; gap: 4px; padding: 9px; border: 1px solid #303b3e; border-radius: 7px; background: #12191b; }
.equation-block code { color: #e2c18a; font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; white-space: normal; }
.audit-card { margin-top: 9px; padding: 9px; border: 1px solid rgba(217,166,83,.23); border-radius: 7px; background: rgba(217,166,83,.055); }
.audit-title { display: flex; justify-content: space-between; align-items: center; color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.audit-chip { padding: 3px 5px; border-radius: 4px; background: rgba(217,166,83,.12); color: #d8bd8e; font-size: 6px; }
.audit-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 9px; }
.audit-values small { display: block; color: #85918b; font-size: 7px; }
.audit-values strong { display: block; margin-top: 3px; color: #e8e5da; font-size: 10px; font-variant-numeric: tabular-nums; }
.audit-note { margin: 7px 0 0 !important; color: #87928c; font-size: 7px; }
.science-list { margin: 5px 0 9px; padding-left: 16px; }
.science-list li { margin: 4px 0; }
.science-list b { color: #d7dcd4; }
.science-disclaimer { margin-top: 10px !important; padding-top: 8px; border-top: 1px solid var(--line); color: #c3c9c0; font-style: italic; }

@media (max-width: 900px) {
  .app-shell { grid-template-rows: 58px minmax(0,1fr); }
  .workspace { grid-template-columns: minmax(0,1fr) 320px; gap: 10px; padding: 10px; }
  .control-panel { padding: 13px; }
  .stage-panel { grid-template-rows: 42px minmax(0,1fr) 64px; }
  .view-tab { padding: 7px 9px; }
  .quality-toggle { padding: 0 7px; height: 29px; }
}
@media (max-width: 700px) {
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { height: 100vh; height: 100dvh; grid-template-rows: 54px minmax(0,1fr); }
  .topbar { padding: 0 12px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 7px; }
  .brand-mark span { height: 12px; }
  .brand-mark span:nth-child(2) { height: 17px; }
  .brand-mark span:nth-child(3) { height: 9px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 16px; }
  .topbar-actions { gap: 8px; }
  .status-pill { font-size: 7px; gap: 5px; }
  .icon-button { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .icon-button span { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 8px; }
  .stage-panel { flex: 1 1 auto; min-height: 270px; grid-template-rows: 38px minmax(0,1fr) 54px; gap: 7px; }
  .stage-toolbar { gap: 6px; }
  .stage-heading { max-width: 34%; }
  .section-kicker { font-size: 7px; }
  .stage-subtitle { font-size: 8px; }
  .toolbar-actions { gap: 4px; }
  .view-tabs { gap: 1px; padding: 2px; }
  .view-tab { padding: 7px 7px; font-size: 8px; }
  .quality-toggle { height: 27px; padding: 0 6px; font-size: 6px; }
  .canvas-stage { border-radius: 10px; }
  .canvas-corner { top: 10px; font-size: 6px; }
  .canvas-corner-left { left: 10px; }
  .canvas-corner-right { right: 10px; }
  .canvas-legend { left: 10px; bottom: 9px; gap: 8px; font-size: 6px; }
  .canvas-legend i { width: 6px; height: 6px; }
  .observation-strip { grid-template-columns: 1fr; gap: 4px; padding: 7px 10px; border-radius: 8px; }
  .observation-mark { font-size: 7px; }
  .observation-icon { width: 14px; height: 14px; font-size: 9px; }
  .observation-strip p { font-size: 8px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .control-panel { flex: 0 0 39%; max-height: 39%; min-height: 245px; overflow: auto; padding: 11px 12px 14px; border-radius: 10px; }
  .panel-intro { margin-bottom: 10px; }
  .panel-intro h2 { font-size: 15px; }
  .model-tag { font-size: 6px; }
  .preset-section { padding-bottom: 10px; }
  .preset-row { margin-top: 7px; gap: 6px; }
  .preset-button { padding: 7px 6px; gap: 6px; }
  .preset-icon { flex-basis: 21px; width: 21px; height: 21px; font-size: 14px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 7px; }
  .parameter-section { padding: 10px 0 9px; }
  .control-row { margin-top: 9px; }
  .control-label-line label, .control-label-line output { font-size: 9px; }
  .range-ends { font-size: 6px; }
  .run-section { padding: 10px 0; }
  .run-button, .transport-button { height: 32px; font-size: 8px; }
  .readout-section { padding: 11px 0 10px; }
  .readout-card { min-height: 55px; padding: 7px; }
  .readout-card strong { font-size: 15px; }
  .science-panel { margin-top: 10px; }
}
@media (max-width: 380px) {
  .stage-heading { max-width: 28%; }
  .view-tab { padding: 7px 5px; }
  .quality-toggle { padding: 0 5px; }
  .control-panel { flex-basis: 42%; max-height: 42%; }
  .stage-panel { min-height: 250px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
