:root {
  color-scheme: dark;
  --bg: #0b1015;
  --panel: #111820;
  --panel-2: #151e27;
  --panel-3: #0e151c;
  --line: #29343e;
  --line-soft: #202a33;
  --text: #e9edf0;
  --muted: #8e9ba6;
  --dim: #64727e;
  --accent: #d6a653;
  --accent-soft: rgba(214,166,83,.14);
  --accent-line: rgba(214,166,83,.42);
  --wood: #684a31;
  --radius: 9px;
  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-width: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 32% 34%, rgba(61,75,84,.16), transparent 48%), var(--bg); }
.topbar { height: 72px; flex: 0 0 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(12,18,24,.96); z-index: 2; }
.identity { min-width: 0; display: flex; align-items: center; gap: 14px; }
.seal { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border: 1px solid var(--accent-line); border-radius: 50%; color: var(--accent); background: radial-gradient(circle, rgba(214,166,83,.12), transparent 72%); font-family: Georgia, serif; font-size: 23px; font-style: italic; }
.heading-group { min-width: 0; }
.eyebrow, .panel-kicker, .caption-label, .section-heading, .readout-name, .hud-kicker, .check-header, .panel-footer, .date-stamp span { font-size: 9px; letter-spacing: .15em; font-weight: 700; color: var(--muted); }
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.eyebrow-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
h1 { margin: 0; font-size: clamp(17px, 1.7vw, 21px); letter-spacing: -.035em; line-height: 1.1; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.date-stamp { display: flex; align-items: baseline; gap: 6px; padding-right: 16px; border-right: 1px solid var(--line); }
.date-stamp strong { color: var(--accent); font-family: Georgia, serif; font-size: 17px; font-weight: 500; }
.date-stamp span { font-size: 8px; }
.icon-button { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: #141d25; color: #cbd3d9; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.icon-button:hover { border-color: var(--accent-line); color: var(--accent); background: #1a232b; }
.icon-button svg, .transport-bar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 352px; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.stage-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0 18px 0 22px; border-right: 1px solid var(--line); }
.stage-toolbar { height: 52px; flex: 0 0 52px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.view-switch { display: flex; align-items: center; gap: 4px; min-width: 0; }
.view-tab { position: relative; border: 0; background: transparent; padding: 9px 12px 10px; border-radius: 5px; color: var(--muted); cursor: pointer; font-size: 11px; white-space: nowrap; transition: color .18s ease, background .18s ease; }
.view-tab:hover { color: var(--text); background: rgba(255,255,255,.035); }
.view-tab.active { color: var(--accent); background: var(--accent-soft); }
.view-tab.active::after { content: ""; position: absolute; height: 2px; bottom: 0; left: 12px; right: 12px; background: var(--accent); border-radius: 2px; }
.quality-switch { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 6px; }
.quality-switch > span { margin: 0 5px 0 6px; color: var(--dim); font-size: 8px; letter-spacing: .12em; font-weight: 700; }
.quality-btn { border: 0; border-radius: 4px; background: transparent; padding: 5px 8px; color: var(--muted); cursor: pointer; font-size: 10px; }
.quality-btn.active { background: #29333b; color: var(--text); }
.stage-wrap { position: relative; min-height: 0; flex: 1 1 auto; overflow: hidden; background: radial-gradient(ellipse at 50% 44%, #17212a 0%, #101820 48%, #0c1319 100%); border-bottom: 1px solid var(--line-soft); }
#machineCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; }
.stage-hud { position: absolute; z-index: 1; display: flex; flex-direction: column; gap: 3px; pointer-events: none; padding: 8px 10px; border: 1px solid rgba(143,157,169,.15); border-radius: 5px; background: rgba(9,14,19,.58); backdrop-filter: blur(6px); min-width: 104px; }
.stage-hud strong { color: #e2e6e9; font-size: 11px; letter-spacing: .04em; font-weight: 650; }
.stage-hud em { font-style: normal; font-size: 7px; letter-spacing: .13em; color: var(--accent); }
.hud-kicker { font-size: 7px; letter-spacing: .14em; color: #8997a1; }
.hud-top-left { top: 15px; left: 15px; }
.hud-top-right { top: 15px; right: 15px; text-align: right; }
.hud-bottom-left { bottom: 14px; left: 15px; }
.hud-bottom-right { bottom: 14px; right: 15px; text-align: right; }
.caption-row { flex: 0 0 auto; min-height: 66px; display: flex; align-items: center; gap: 12px; padding: 9px 4px 10px; border-bottom: 1px solid var(--line-soft); }
.caption-marker { width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid var(--accent-line); border-radius: 50%; display: grid; place-items: center; }
.caption-marker span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(214,166,83,.55); }
.caption-copy { min-width: 0; }
.caption-label { color: var(--accent); font-size: 8px; margin-bottom: 3px; }
.caption-copy p { margin: 0; color: #b5c0c8; font-size: 11px; line-height: 1.42; max-width: 860px; }
.transport-bar { flex: 0 0 54px; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.transport-controls { display: flex; align-items: center; gap: 7px; }
.transport-primary, .transport-secondary { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border-radius: 5px; cursor: pointer; font-size: 10px; transition: all .18s ease; }
.transport-primary { border: 1px solid var(--accent); background: var(--accent); color: #19150e; font-weight: 700; }
.transport-primary:hover { background: #e6bb70; border-color: #e6bb70; }
.transport-primary svg { stroke: currentColor; fill: currentColor; }
.transport-secondary { border: 1px solid var(--line); background: #131c24; color: #b7c1c8; }
.transport-secondary:hover { border-color: var(--accent-line); color: var(--accent); }
.cycle-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .09em; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #687680; }
.status-dot.running { background: var(--accent); box-shadow: 0 0 9px rgba(214,166,83,.7); }
.status-divider { width: 1px; height: 13px; margin: 0 3px; background: var(--line); }
.cycle-status #angleValue { color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.cycle-status small { color: var(--accent); font-size: 7px; letter-spacing: .1em; }
.control-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 19px 17px 15px; background: linear-gradient(180deg, rgba(20,29,38,.96), rgba(15,22,29,.98)); scrollbar-width: thin; scrollbar-color: #39444d transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #39444d; border-radius: 4px; }
.panel-kicker { color: var(--accent); font-size: 8px; }
.panel-intro h2 { margin: 5px 0 5px; font-size: 17px; letter-spacing: -.025em; font-weight: 620; }
.panel-intro p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 14px 0 17px; }
.readout-card { min-width: 0; padding: 10px 10px 9px; border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(135deg, rgba(31,42,52,.92), rgba(18,26,34,.95)); }
.readout-name { display: block; color: #93a0aa; font-size: 7px; letter-spacing: .12em; white-space: nowrap; }
.readout-card strong { display: block; margin: 5px 0 1px; color: #f0f1ed; font-size: 19px; line-height: 1.05; letter-spacing: -.035em; font-weight: 560; font-variant-numeric: tabular-nums; }
.readout-unit { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; }
.readout-unit i { color: var(--accent); font-style: normal; font-size: 6px; letter-spacing: .1em; }
.section-heading { display: flex; align-items: center; gap: 8px; color: #c1cbd2; font-size: 8px; margin: 0 0 13px; }
.section-rule { height: 1px; flex: 1; background: var(--line); }
.control-group { margin: 0 0 13px; }
.control-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.control-label-row label { color: #d4dbe0; font-size: 10px; font-weight: 550; }
.control-label-row output { color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; background: transparent; }
input[type="range"]:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.range-foot { display: flex; align-items: center; justify-content: space-between; color: #687783; font-size: 8px; margin-top: 1px; }
.value-tag { color: var(--accent); font-size: 7px; letter-spacing: .1em; white-space: nowrap; }
select { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: #111a22; color: #d6dce0; font-size: 10px; cursor: pointer; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 4px 0 13px; }
.preset-btn { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px; text-align: left; border: 1px solid var(--line); border-radius: 6px; background: #131c24; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-btn:hover { border-color: var(--accent-line); background: #1a242d; }
.preset-mark { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; border: 1px solid var(--accent-line); border-radius: 4px; color: var(--accent); font-family: Georgia, serif; font-size: 12px; }
.preset-btn strong, .preset-btn small { display: block; }
.preset-btn strong { font-size: 8px; color: #d9e0e5; font-weight: 600; }
.preset-btn small { margin-top: 3px; color: var(--muted); font-size: 7px; line-height: 1.25; }
.check-card { padding: 11px 11px 9px; margin: 0 0 12px; border: 1px solid rgba(214,166,83,.34); border-radius: 6px; background: linear-gradient(125deg, rgba(214,166,83,.09), rgba(16,23,29,.8) 68%); }
.check-header { display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 7px; }
.check-icon { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: rgba(214,166,83,.17); font-size: 10px; }
.check-equation { margin: 8px 0 7px; color: #aeb9c1; font-size: 9px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.check-equation strong { color: #f0d19b; font-weight: 650; }
.check-result { display: flex; justify-content: space-between; gap: 8px; padding-top: 7px; border-top: 1px solid rgba(214,166,83,.16); color: #94a1aa; font-size: 8px; }
.check-result strong { color: #e7ecef; font-variant-numeric: tabular-nums; }
#checkDifference { color: var(--accent); white-space: nowrap; }
.check-foot { margin-top: 6px; color: #7f8b94; font-size: 7px; letter-spacing: .02em; }
.science-panel { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; color: #d1d9de; cursor: pointer; list-style: none; font-size: 8px; letter-spacing: .13em; font-weight: 700; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-plus { color: var(--accent); font-size: 16px; font-weight: 300; transition: transform .2s ease; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 0 12px; color: #9ba8b1; font-size: 9px; line-height: 1.5; }
.science-content h3 { margin: 10px 0 4px; color: #d6dce0; font-size: 9px; font-weight: 650; }
.science-content p { margin: 4px 0 7px; }
.equation { margin: 7px 0; padding: 8px 9px; border-left: 2px solid var(--accent); background: rgba(214,166,83,.055); color: #e4c38e; font-family: Georgia, serif; font-size: 12px; letter-spacing: .015em; }
.source-note { color: #82909a; font-size: 8px; }
.required-disclaimer { color: #d1b37d; font-size: 8px; }
.panel-footer { display: flex; justify-content: space-between; gap: 8px; padding-top: 11px; color: #667580; font-size: 6px; letter-spacing: .11em; }
@media (max-width: 800px) {
  .topbar { height: 62px; flex-basis: 62px; padding: 0 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 315px; }
  .stage-column { padding: 0 12px; }
  .control-panel { padding-left: 13px; padding-right: 13px; }
}
@media (max-width: 680px) {
  .topbar { height: 58px; flex-basis: 58px; padding: 0 11px; gap: 8px; }
  .seal { width: 32px; height: 32px; flex-basis: 32px; font-size: 19px; }
  .identity { gap: 9px; }
  .eyebrow { font-size: 7px; gap: 6px; margin-bottom: 3px; }
  h1 { font-size: 14px; max-width: 230px; }
  .top-actions { gap: 7px; }
  .date-stamp { padding-right: 8px; gap: 4px; }
  .date-stamp strong { font-size: 14px; }
  .date-stamp span { font-size: 6px; }
  .icon-button { min-height: 31px; padding: 0 8px; font-size: 9px; }
  .icon-button svg { width: 14px; height: 14px; }
  .workspace { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .stage-column { flex: 0 0 53%; min-height: 315px; padding: 0 9px; border-right: 0; }
  .stage-toolbar { height: 39px; flex-basis: 39px; }
  .view-tab { padding: 7px 8px 8px; font-size: 9px; }
  .view-tab.active::after { left: 8px; right: 8px; }
  .quality-switch { gap: 1px; padding: 2px; }
  .quality-switch > span { display: none; }
  .quality-btn { padding: 4px 6px; font-size: 8px; }
  .stage-hud { padding: 5px 6px; min-width: 80px; gap: 2px; }
  .hud-top-left { top: 8px; left: 8px; }
  .hud-top-right { top: 8px; right: 8px; }
  .hud-bottom-left { bottom: 8px; left: 8px; }
  .hud-bottom-right { bottom: 8px; right: 8px; }
  .hud-kicker { font-size: 5px; }
  .stage-hud strong { font-size: 8px; }
  .stage-hud em { font-size: 5px; }
  .caption-row { min-height: 48px; padding: 5px 2px; gap: 8px; }
  .caption-marker { width: 20px; height: 20px; flex-basis: 20px; }
  .caption-copy p { font-size: 8px; line-height: 1.32; }
  .caption-label { font-size: 6px; margin-bottom: 2px; }
  .transport-bar { min-height: 42px; flex-basis: 42px; gap: 5px; }
  .transport-controls { gap: 4px; }
  .transport-primary, .transport-secondary { min-height: 29px; padding: 0 8px; gap: 5px; font-size: 8px; }
  .transport-bar svg { width: 13px; height: 13px; }
  .cycle-status { gap: 5px; font-size: 7px; }
  .cycle-status small { font-size: 5px; }
  .control-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 11px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .panel-intro h2 { font-size: 14px; margin: 3px 0; }
  .panel-intro p { font-size: 8px; }
  .panel-kicker { font-size: 7px; }
  .readout-grid { margin: 9px 0 11px; gap: 5px; }
  .readout-card { padding: 7px 8px 6px; }
  .readout-name { font-size: 6px; }
  .readout-card strong { font-size: 16px; margin: 4px 0 1px; }
  .readout-unit { font-size: 7px; }
  .readout-unit i { font-size: 5px; }
  .section-heading { font-size: 7px; margin-bottom: 9px; }
  .control-group { margin-bottom: 9px; }
  .control-label-row { margin-bottom: 4px; }
  .control-label-row label { font-size: 9px; }
  .control-label-row output { font-size: 9px; }
  .range-foot { font-size: 7px; }
  .value-tag { font-size: 6px; }
  input[type="range"] { height: 13px; }
  select { height: 30px; font-size: 9px; }
  .preset-row { margin: 3px 0 9px; gap: 5px; }
  .preset-btn { padding: 6px; gap: 6px; }
  .preset-mark { width: 18px; height: 18px; flex-basis: 18px; font-size: 10px; }
  .preset-btn strong { font-size: 7px; }
  .preset-btn small { font-size: 6px; }
  .check-card { padding: 8px 9px 7px; margin-bottom: 8px; }
  .check-header { font-size: 6px; }
  .check-equation { margin: 6px 0; font-size: 8px; }
  .check-result { padding-top: 5px; font-size: 7px; }
  .check-foot { font-size: 6px; }
  .science-panel summary { padding: 9px 0; font-size: 7px; }
  .science-content { font-size: 8px; }
  .science-content h3 { font-size: 8px; }
  .equation { font-size: 10px; padding: 6px 8px; }
  .panel-footer { padding-top: 8px; font-size: 5px; }
}
@media (max-width: 380px) {
  h1 { max-width: 190px; font-size: 13px; }
  .screenshot-button span { display: none; }
  .view-tab { padding-left: 6px; padding-right: 6px; }
  .cycle-status { gap: 3px; }
  .cycle-status small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
