:root {
  color-scheme: dark;
  --bg: #0b1118;
  --panel: #111a24;
  --panel-2: #141f2a;
  --line: #263341;
  --line-soft: #1d2a37;
  --text: #e7edf1;
  --muted: #8b9aa7;
  --dim: #61717f;
  --accent: #d5a75c;
  --accent-soft: rgba(213,167,92,.13);
  --accent-line: rgba(213,167,92,.35);
  --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; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 48% -18%, rgba(41,59,74,.34), transparent 48%), var(--bg); }
.topbar { height: 64px; flex: 0 0 64px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); background: rgba(11,17,24,.88); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 26px; height: 26px; border: 1px solid var(--accent-line); border-radius: 50%; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-24deg); }
.brand-mark span { width: 2px; height: 12px; border-radius: 2px; background: var(--accent); opacity: .9; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 8px; }
.brand-kicker { font-size: 10px; letter-spacing: .19em; color: #c7d0d7; font-weight: 700; }
.brand-sub { margin-top: 3px; font-size: 9px; letter-spacing: .14em; color: var(--dim); }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.era-tag, .offline-tag { font-size: 9px; letter-spacing: .12em; color: var(--muted); white-space: nowrap; }
.era-tag b { color: var(--accent); font-weight: 700; }
.offline-tag { display: flex; align-items: center; gap: 7px; color: #a6b3bd; }
.offline-tag i, .live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(213,167,92,.5); }
.workspace { width: min(1500px, 100%); margin: 0 auto; padding: 22px 28px 16px; display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(330px, .86fr); gap: 16px; flex: 1; min-height: 0; }
.stage-panel, .control-panel { min-width: 0; background: linear-gradient(180deg, rgba(20,31,42,.96), rgba(15,24,33,.98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 50px rgba(0,0,0,.18); }
.stage-panel { padding: 20px; display: flex; flex-direction: column; min-height: 0; }
.stage-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 0 1px 16px; }
.eyebrow { color: var(--accent); font-size: 9px; letter-spacing: .19em; font-weight: 800; }
h1 { margin: 6px 0 4px; font-size: clamp(21px, 2.1vw, 29px); line-height: 1.1; letter-spacing: -.035em; font-weight: 620; }
.stage-heading p { margin: 0; font-size: 11px; color: var(--muted); letter-spacing: .01em; }
.view-switch { display: flex; flex-shrink: 0; gap: 3px; padding: 3px; background: #0c141c; border: 1px solid #263341; border-radius: 8px; }
.view-button { border: 0; border-radius: 5px; padding: 8px 10px; background: transparent; color: #8796a3; font-size: 10px; cursor: pointer; transition: background .18s ease, color .18s ease; }
.view-button:hover { color: var(--text); }
.view-button.active { background: #28313a; color: var(--accent); box-shadow: inset 0 0 0 1px rgba(213,167,92,.2); }
.canvas-frame { position: relative; flex: 1 1 auto; min-height: 265px; max-height: 520px; overflow: hidden; border: 1px solid #2b3946; border-radius: 9px; background: radial-gradient(ellipse at 52% 42%, #172532 0%, #111d28 50%, #0e1720 100%); }
#machineCanvas { display: block; width: 100%; height: 100%; }
.canvas-overlay { position: absolute; z-index: 2; top: 12px; display: flex; align-items: center; gap: 7px; font-size: 8px; letter-spacing: .13em; color: #9aabb8; pointer-events: none; }
.overlay-left { left: 14px; }
.overlay-right { right: 14px; color: #7d8d99; }
.overlay-divider { color: #4e5e6b; }
.canvas-corner { position: absolute; width: 10px; height: 10px; pointer-events: none; opacity: .55; }
.corner-tl { top: 6px; left: 6px; border-top: 1px solid var(--accent); border-left: 1px solid var(--accent); }
.corner-tr { top: 6px; right: 6px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); }
.corner-bl { bottom: 6px; left: 6px; border-bottom: 1px solid var(--accent); border-left: 1px solid var(--accent); }
.corner-br { bottom: 6px; right: 6px; border-bottom: 1px solid var(--accent); border-right: 1px solid var(--accent); }
.readout-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding-top: 12px; }
.readout-card { min-width: 0; padding: 10px 11px 9px; background: rgba(9,16,23,.48); border: 1px solid #25323e; border-radius: 7px; }
.readout-label { color: #8393a0; font-size: 8px; letter-spacing: .1em; white-space: nowrap; }
.readout-label span { color: var(--accent); margin-left: 3px; font-size: 9px; }
.readout-value { margin-top: 5px; display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.readout-value strong { font-size: 20px; font-weight: 550; letter-spacing: -.04em; color: #e7edf1; }
.readout-value small { font-size: 10px; color: var(--accent); }
.readout-foot { margin-top: 3px; color: #647583; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caption-bar { margin-top: 10px; padding: 10px 12px; display: flex; align-items: flex-start; gap: 10px; background: rgba(213,167,92,.055); border: 1px solid rgba(213,167,92,.18); border-radius: 7px; }
.caption-icon { width: 19px; height: 19px; flex: 0 0 19px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-size: 12px; }
.caption-title { margin-bottom: 3px; color: var(--accent); font-size: 8px; letter-spacing: .16em; font-weight: 800; }
.caption-bar p { margin: 0; color: #a8b5bf; font-size: 10px; line-height: 1.45; }
.control-panel { padding: 19px 18px 14px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #364552 transparent; }
.control-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
h2 { margin: 5px 0 0; font-size: 18px; letter-spacing: -.025em; font-weight: 620; }
.model-chip { padding: 5px 7px; border: 1px solid var(--accent-line); border-radius: 4px; color: var(--accent); font-size: 7px; letter-spacing: .11em; white-space: nowrap; }
.section-label { margin-bottom: 8px; color: #a8b5bf; font-size: 9px; letter-spacing: .14em; font-weight: 800; }
.section-label span { color: #657582; font-weight: 500; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 9px 9px; text-align: left; background: #0e1720; border: 1px solid #293743; border-radius: 7px; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: #52606a; }
.preset-button.selected { border-color: var(--accent-line); background: linear-gradient(120deg, rgba(213,167,92,.1), rgba(14,23,32,.96)); }
.preset-icon { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; color: var(--accent); border-radius: 5px; background: rgba(213,167,92,.1); font-size: 18px; }
.preset-button b { display: block; font-size: 10px; font-weight: 650; color: #dce3e8; }
.preset-button small { display: block; margin-top: 3px; color: #7e8e9a; font-size: 8px; white-space: nowrap; }
.controls-block { display: flex; flex-direction: column; gap: 11px; }
.control-row { padding-bottom: 8px; border-bottom: 1px solid #202d38; }
.control-row:last-child { border-bottom: 0; padding-bottom: 0; }
.control-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.control-meta label { color: #c4ced5; font-size: 10px; }
.control-meta output { color: var(--accent); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 6px 0 2px; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, var(--accent) var(--range-fill, 50%), #48545d var(--range-fill, 50%)); border-radius: 4px; }
input[type="range"]::-moz-range-track { height: 3px; background: #48545d; border-radius: 4px; }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--accent); border-radius: 4px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border: 2px solid #101821; 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 #101821; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.range-ends { display: flex; justify-content: space-between; color: #62727e; font-size: 7px; }
.transport-controls { margin-top: auto; padding-top: 10px; border-top: 1px solid #293642; }
.transport-main { display: flex; align-items: center; gap: 6px; }
.primary-action, .icon-action, .quality-button, .text-action { border: 1px solid #34434f; background: #17232e; border-radius: 6px; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.primary-action:hover, .icon-action:hover, .quality-button:hover { background: #202f3b; border-color: #596773; }
.primary-action:active, .icon-action:active { transform: translateY(1px); }
.primary-action { height: 34px; min-width: 88px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; background: var(--accent); color: #1b1a16; border-color: var(--accent); font-size: 10px; font-weight: 750; }
.primary-action:hover { background: #e5bb78; border-color: #e5bb78; }
.play-symbol { font-size: 11px; }
.icon-action { width: 34px; height: 34px; color: #d1dbe2; font-size: 14px; }
.transport-divider { height: 20px; width: 1px; margin: 0 3px; background: #34424e; }
.quality-button { height: 31px; display: flex; align-items: center; gap: 7px; padding: 0 9px; margin-left: auto; color: #b9c4cb; font-size: 8px; letter-spacing: .12em; }
.quality-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.quality-button[aria-pressed="false"] .quality-dot { background: #73818c; }
.transport-sub { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; color: #758591; font-size: 8px; }
.text-action { padding: 5px 7px; color: var(--accent); border-color: transparent; background: transparent; font-size: 9px; }
.text-action:hover { background: var(--accent-soft); }
.science-panel { border-top: 1px solid #293642; padding-top: 11px; }
.science-panel summary { display: flex; justify-content: space-between; align-items: center; list-style: none; cursor: pointer; color: #c7d1d8; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-right { color: #73838f; font-size: 7px; font-weight: 500; }
.summary-right i { margin-left: 6px; color: var(--accent); font-style: normal; font-size: 12px; }
.science-panel[open] .summary-right i { display: inline-block; transform: rotate(45deg); }
.science-content { padding-top: 11px; }
.science-intro { margin: 0 0 9px; color: #9cabb6; font-size: 9px; line-height: 1.5; }
.equation-card { padding: 8px 9px; margin-bottom: 6px; background: #0d161e; border: 1px solid #263440; border-radius: 5px; }
.equation-label { color: var(--accent); font-size: 7px; letter-spacing: .13em; font-weight: 800; }
.equation { margin: 6px 0 4px; color: #e1e8ed; font-family: Georgia, "Times New Roman", serif; font-size: 14px; letter-spacing: .015em; }
.equation-note { color: #7f8f9a; font-size: 8px; line-height: 1.4; }
.science-facts { display: grid; gap: 7px; margin: 9px 0; }
.science-facts div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.science-facts b { color: #aab7c0; font-size: 7px; letter-spacing: .08em; }
.science-facts span { color: #7f8e99; font-size: 8px; line-height: 1.45; }
.audit-card { padding: 9px; border: 1px solid var(--accent-line); background: rgba(213,167,92,.045); border-radius: 6px; }
.audit-head { display: flex; justify-content: space-between; gap: 6px; color: var(--accent); font-size: 7px; letter-spacing: .1em; font-weight: 800; }
.audit-status { color: #8e9ba4; font-weight: 500; }
.audit-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0 6px; }
.audit-values div { min-width: 0; }
.audit-values small { display: block; color: #778691; font-size: 7px; }
.audit-values b { display: block; margin-top: 3px; color: #e2e9ed; font-size: 10px; font-variant-numeric: tabular-nums; }
.audit-card p { margin: 0; color: #788893; font-size: 7px; line-height: 1.45; }
.disclaimer { margin: 9px 0 1px; color: #697985; font-size: 7px; }
.footer { width: min(1500px, 100%); margin: 0 auto; padding: 0 28px 12px; display: flex; justify-content: space-between; gap: 10px; color: #53626e; font-size: 7px; letter-spacing: .12em; }
.footer i { color: var(--accent); font-style: normal; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.embed-mode .workspace { min-height: 0; overflow: hidden; }
@media (min-width: 1500px) { .workspace { padding-top: 26px; padding-bottom: 18px; } .stage-panel { padding: 23px; } }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1.35fr) minmax(310px, .9fr); padding: 16px; gap: 12px; }
  .stage-panel { padding: 15px; }
  .control-panel { padding: 15px 13px 12px; }
  .readout-card { padding: 8px; }
  .readout-value strong { font-size: 18px; }
  .view-button { padding: 7px 8px; }
}
@media (max-width: 760px) {
  .topbar { height: 54px; flex-basis: 54px; padding: 0 14px; }
  .brand-mark { width: 23px; height: 23px; }
  .brand-kicker { font-size: 9px; }
  .brand-sub { font-size: 8px; }
  .topbar-right { gap: 0; }
  .era-tag { font-size: 8px; }
  .offline-tag { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 10px 10px 12px; gap: 10px; overflow-y: auto; }
  body.embed-mode .workspace { overflow-y: auto; }
  .stage-panel { flex: 0 0 auto; padding: 12px; }
  .stage-heading { display: block; padding-bottom: 10px; }
  h1 { font-size: 21px; }
  .stage-heading p { font-size: 9px; }
  .view-switch { margin-top: 10px; width: max-content; max-width: 100%; }
  .view-button { padding: 7px 10px; font-size: 9px; }
  .canvas-frame { height: clamp(220px, 39vh, 315px); min-height: 220px; max-height: 315px; flex: none; }
  .canvas-overlay { top: 9px; font-size: 7px; }
  .overlay-left { left: 10px; }
  .overlay-right { right: 10px; }
  .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding-top: 8px; }
  .readout-card { padding: 8px 9px; }
  .readout-value strong { font-size: 17px; }
  .caption-bar { margin-top: 8px; padding: 8px 9px; }
  .caption-bar p { font-size: 9px; }
  .control-panel { flex: 0 0 auto; overflow: visible; padding: 14px 13px; gap: 13px; }
  .controls-block { gap: 10px; }
  .footer { display: none; }
  body.embed-mode .app-shell { overflow: hidden; }
  body.embed-mode .workspace { flex: 1 1 auto; min-height: 0; }
}
@media (max-width: 420px) {
  .workspace { padding: 8px; }
  .stage-panel { padding: 10px; }
  .canvas-frame { height: clamp(210px, 35vh, 285px); min-height: 210px; }
  .readout-label { font-size: 7px; }
  .readout-foot { font-size: 7px; }
  .preset-button { padding: 8px 6px; gap: 6px; }
  .preset-button b { font-size: 9px; }
  .preset-button small { font-size: 7px; }
  .model-chip { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
