:root {
  color-scheme: dark;
  --bg: #0b1118;
  --panel: #101923;
  --panel-2: #121e29;
  --panel-3: #172430;
  --line: #263541;
  --line-soft: rgba(126, 157, 177, .15);
  --text: #e7eef2;
  --muted: #93a5b1;
  --dim: #657986;
  --accent: #55d7d0;
  --accent-soft: rgba(85, 215, 208, .12);
  --accent-line: rgba(85, 215, 208, .36);
  --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 { min-width: 320px; 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 18% -15%, rgba(43, 80, 91, .16), transparent 42%), var(--bg); }
.topbar { height: 70px; min-height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(11, 17, 24, .92); position: relative; z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--accent-line); border-radius: 11px; background: linear-gradient(145deg, rgba(85,215,208,.15), rgba(85,215,208,.025)); }
.brand-mark svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { color: var(--muted); font-size: 9px; letter-spacing: .17em; font-weight: 700; line-height: 1.4; }
.eyebrow span { color: var(--accent); padding: 0 4px; }
.brand-title { color: var(--text); font-size: 16px; font-weight: 650; letter-spacing: -.025em; line-height: 1.4; }
.topbar-right { display: flex; align-items: center; gap: 17px; color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.live-state { display: flex; align-items: center; gap: 8px; font-size: 9px; font-weight: 750; letter-spacing: .14em; color: #b8c8d0; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(85,215,208,.45); }
.live-state.paused .live-dot { background: #6f8491; box-shadow: none; }
.topbar-divider { width: 1px; height: 22px; background: var(--line); }
.topbar-note { color: #8396a2; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: 14px; padding: 14px; }
.stage-panel { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(155deg, #111c26, #0d151d 68%); display: grid; grid-template-rows: 47px minmax(220px, 1fr) auto auto; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.14); }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line-soft); gap: 12px; }
.stage-label { display: flex; align-items: center; gap: 9px; color: #aabac3; font-size: 9px; font-weight: 750; letter-spacing: .15em; white-space: nowrap; }
.stage-index { display: inline-grid; place-items: center; width: 21px; height: 21px; border: 1px solid var(--line); border-radius: 6px; color: var(--accent); font-size: 9px; letter-spacing: 0; }
.view-switch { display: flex; align-items: center; gap: 3px; padding: 3px; background: #0a1219; border: 1px solid #23323e; border-radius: 8px; }
.view-btn { padding: 6px 10px; border: 0; border-radius: 5px; color: #80939f; background: transparent; font-size: 10px; cursor: pointer; transition: background .2s ease, color .2s ease; }
.view-btn:hover { color: var(--text); }
.view-btn.active { color: #d9f8f5; background: rgba(85,215,208,.13); box-shadow: inset 0 0 0 1px rgba(85,215,208,.19); }
.canvas-wrap { min-height: 0; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 52%, rgba(27, 50, 62, .36), rgba(11, 18, 25, .15) 62%, rgba(7, 13, 18, .4)); }
#machineCanvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-topline { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.diagram-tag, .scale-tag { font-size: 8px; font-weight: 750; letter-spacing: .14em; color: #8499a5; }
.diagram-tag { display: flex; align-items: center; gap: 7px; }
.tag-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(85,215,208,.55); }
.scale-tag { color: #617681; }
.phase-chip { position: absolute; bottom: 13px; right: 15px; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(85,215,208,.2); border-radius: 7px; color: #a7c7c8; background: rgba(9, 20, 26, .8); backdrop-filter: blur(8px); font-size: 8px; letter-spacing: .14em; font-weight: 750; pointer-events: none; }
.phase-mark { width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--line); }
.readout-card { min-width: 0; padding: 11px 14px 9px; background: #101a23; }
.readout-label { color: #7f929e; font-size: 8px; font-weight: 750; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout-value { margin-top: 4px; color: #e3edf1; font-size: 20px; font-weight: 620; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { color: #9cafb8; font-size: 10px; font-weight: 550; letter-spacing: 0; }
.accent-readout .readout-value { color: var(--accent); }
.readout-foot { margin-top: 2px; color: #607480; font-size: 7px; letter-spacing: .11em; }
.caption-bar { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 10px 16px; background: rgba(11, 19, 27, .68); }
.caption-symbol { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; gap: 2px; border-radius: 7px; background: rgba(85,215,208,.09); border: 1px solid rgba(85,215,208,.15); flex: 0 0 auto; }
.caption-symbol span { width: 2px; border-radius: 3px; background: var(--accent); animation: wave 1.2s ease-in-out infinite; }
.caption-symbol span:nth-child(1) { height: 7px; animation-delay: -.25s; }
.caption-symbol span:nth-child(2) { height: 13px; animation-delay: -.08s; }
.caption-symbol span:nth-child(3) { height: 9px; animation-delay: -.4s; }
.caption-title { color: #8296a2; font-size: 7px; letter-spacing: .16em; font-weight: 800; }
.caption-bar p { margin: 3px 0 0; color: #c4d0d6; font-size: 11px; line-height: 1.45; }
.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #111b25, #0e1720); scrollbar-width: thin; scrollbar-color: #30424e transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #30424e; border-radius: 8px; }
.panel-section { padding: 15px 15px 14px; border-bottom: 1px solid var(--line-soft); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-kicker { color: #b5c4cb; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.section-note { color: #637783; font-size: 7px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-btn { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 9px 8px; text-align: left; border: 1px solid #293a46; border-radius: 9px; background: #121f29; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.preset-btn:hover { border-color: #45616c; transform: translateY(-1px); }
.preset-btn.selected { border-color: var(--accent-line); background: linear-gradient(125deg, rgba(85,215,208,.12), rgba(85,215,208,.035)); }
.preset-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 7px; background: #1b2b36; flex: 0 0 auto; }
.preset-icon svg { width: 21px; height: 21px; fill: none; stroke: var(--accent); stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.preset-btn strong { display: block; font-size: 10px; font-weight: 700; color: #dbe5e9; }
.preset-btn small { display: block; margin-top: 3px; color: #81949f; font-size: 8px; white-space: nowrap; }
.control-list { display: grid; gap: 13px; }
.control-row { min-width: 0; }
.control-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.control-head label { color: #c0cdd3; font-size: 10px; font-weight: 550; }
.control-head output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, var(--accent) 0%, #3b6069 0%, #2b3c47 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: #2b3c47; }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 5px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; border: 2px solid #0d171e; background: var(--accent); box-shadow: 0 0 0 2px rgba(85,215,208,.18); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #0d171e; background: var(--accent); box-shadow: 0 0 0 2px rgba(85,215,208,.18); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 5px; }
.range-ends { display: flex; justify-content: space-between; color: #5f7380; font-size: 8px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.parameter-footnote { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: #728793; font-size: 8px; }
.info-dot { width: 13px; height: 13px; display: inline-grid; place-items: center; border: 1px solid #48616d; border-radius: 50%; color: #8da5b1; font-size: 8px; font-weight: 700; }
.motion-section { padding-bottom: 13px; }
.transport-row { display: grid; grid-template-columns: 1fr 1fr 38px; gap: 7px; }
.transport-btn { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 0 10px; border: 1px solid #2c3e49; border-radius: 7px; color: #b9c7ce; background: #15222c; font-size: 10px; font-weight: 650; cursor: pointer; transition: border-color .2s, background .2s; }
.transport-btn:hover { border-color: #526b76; background: #1a2b36; }
.transport-btn.primary { border-color: rgba(85,215,208,.4); color: #d7f7f4; background: rgba(85,215,208,.12); }
.transport-btn.primary:hover { background: rgba(85,215,208,.18); }
.play-icon { color: var(--accent); font-size: 13px; line-height: 1; }
.step-icon { color: var(--accent); font-size: 22px; line-height: 10px; }
.transport-btn svg, .screenshot-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-only { padding: 0; }
.utility-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.quality-control { display: flex; align-items: center; gap: 3px; color: #718692; font-size: 7px; letter-spacing: .12em; font-weight: 750; }
.quality-control span { margin-right: 4px; }
.quality-control button { border: 1px solid transparent; border-radius: 5px; padding: 4px 7px; background: transparent; color: #7f929d; font-size: 8px; cursor: pointer; }
.quality-control button.quality-active { color: var(--accent); border-color: rgba(85,215,208,.2); background: rgba(85,215,208,.08); }
.screenshot-btn { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid #2b3e49; border-radius: 6px; color: #a9bac3; background: #14212b; font-size: 8px; cursor: pointer; }
.screenshot-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.screenshot-btn svg { width: 14px; height: 14px; }
.science-section { padding: 0 15px; }
.science-section details { border-bottom: 1px solid var(--line-soft); }
.science-section summary { min-height: 58px; display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; }
.science-section summary::-webkit-details-marker { display: none; }
.science-mark { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; border: 1px solid rgba(85,215,208,.19); background: rgba(85,215,208,.08); color: var(--accent); font-size: 15px; }
.science-section summary strong { display: block; color: #d5e0e5; font-size: 10px; font-weight: 700; }
.science-section summary small { display: block; margin-top: 3px; color: #778b97; font-size: 8px; }
.chevron { margin-left: auto; color: #7c909b; font-size: 17px; transition: transform .2s; }
.science-section details[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 0 15px; color: #a8b8c0; font-size: 9px; line-height: 1.55; }
.science-intro { color: #b5c4cb; font-size: 9px; line-height: 1.6; padding: 0 0 11px; }
.science-content h3 { margin: 12px 0 7px; color: #d3e0e5; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.equation-card { margin: 6px 0; padding: 8px 9px; border: 1px solid #263a46; border-radius: 7px; background: #111f29; }
.eq-label { display: block; color: #7e969f; font-size: 7px; letter-spacing: .1em; font-weight: 750; }
.equation { margin: 5px 0 3px; color: #d9e9ec; font-family: Georgia, "Times New Roman", serif; font-size: 14px; letter-spacing: .01em; }
.equation sub, .equation sup { font-size: 9px; }
.equation-card small { color: #879aa4; font-size: 8px; }
.check-card { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 8px; padding: 10px; border: 1px solid rgba(85,215,208,.2); border-radius: 8px; background: rgba(85,215,208,.045); }
.check-card span { display: block; color: #80959e; font-size: 7px; font-weight: 750; letter-spacing: .1em; }
.check-card strong { display: block; margin-top: 4px; color: var(--accent); font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.check-divider { background: #2b414b; }
.check-difference { grid-column: 1 / -1; padding-top: 7px; border-top: 1px solid rgba(85,215,208,.13); color: #9db2b9; font-size: 8px; }
.check-explain { color: #8498a2; font-size: 8px; line-height: 1.55; }
.science-list { padding-left: 15px; margin: 6px 0 10px; color: #8ea0a9; font-size: 8px; }
.science-list li { margin: 4px 0; }
.science-list b { color: #b9c8ce; }
.science-disclaimer { padding-top: 8px; border-top: 1px solid var(--line-soft); color: #8ca1aa; font-size: 8px; font-style: italic; }
.sidebar-footer { display: flex; justify-content: space-between; gap: 8px; padding: 12px 15px; color: #536975; font-size: 7px; letter-spacing: .12em; font-weight: 700; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@keyframes wave { 0%,100% { transform: scaleY(.55); opacity: .65; } 50% { transform: scaleY(1.1); opacity: 1; } }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1fr) 380px; padding: 18px; gap: 18px; } .topbar { padding: 0 30px; } }
@media (max-width: 900px) { .workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 10px; padding: 10px; } .topbar { padding: 0 17px; } .topbar-note { display: none; } .topbar-divider { display: none; } .stage-panel { grid-template-rows: 44px minmax(210px,1fr) auto auto; } .readout-card { padding: 9px 9px 8px; } .readout-value { font-size: 17px; } }
@media (max-width: 680px) {
  html, body { min-height: 100%; }
  .app-shell { min-height: 100vh; }
  .topbar { height: 58px; min-height: 58px; padding: 0 12px; }
  .brand-mark { width: 33px; height: 33px; border-radius: 9px; }
  .brand-mark svg { width: 24px; height: 24px; }
  .eyebrow { font-size: 7px; letter-spacing: .13em; }
  .brand-title { font-size: 14px; }
  .topbar-right { gap: 8px; }
  .live-state { font-size: 8px; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(285px, 43dvh) minmax(0,1fr); gap: 9px; padding: 9px; min-height: 0; }
  .stage-panel { grid-template-rows: 42px minmax(0,1fr) auto auto; border-radius: 11px; }
  .stage-toolbar { padding: 0 9px; gap: 6px; }
  .stage-label { font-size: 7px; gap: 6px; letter-spacing: .11em; }
  .stage-index { width: 18px; height: 18px; }
  .view-switch { gap: 1px; padding: 2px; }
  .view-btn { padding: 5px 7px; font-size: 8px; }
  .canvas-topline { top: 8px; left: 10px; right: 10px; }
  .diagram-tag, .scale-tag { font-size: 6px; }
  .phase-chip { right: 8px; bottom: 7px; padding: 5px 7px; font-size: 6px; }
  .readout-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .readout-card { padding: 7px 6px 6px; }
  .readout-label { font-size: 6px; letter-spacing: .08em; }
  .readout-value { font-size: 14px; margin-top: 3px; }
  .readout-value small { font-size: 8px; }
  .readout-foot { font-size: 5px; letter-spacing: .06em; }
  .caption-bar { min-height: 48px; padding: 7px 9px; gap: 8px; }
  .caption-symbol { width: 21px; height: 21px; }
  .caption-title { font-size: 6px; }
  .caption-bar p { font-size: 9px; line-height: 1.3; margin-top: 2px; }
  .control-panel { border-radius: 11px; min-height: 0; }
  .panel-section { padding: 12px 12px 11px; }
  .section-heading { margin-bottom: 10px; }
  .section-kicker { font-size: 8px; }
  .section-note { font-size: 6px; }
  .control-list { gap: 11px; }
  .control-head label, .control-head output { font-size: 9px; }
  .preset-btn { padding: 8px 7px; }
  .preset-btn strong { font-size: 9px; }
  .preset-btn small { font-size: 7px; }
  .science-section { padding: 0 12px; }
  .science-section summary { min-height: 52px; }
  .sidebar-footer { padding: 10px 12px; font-size: 6px; }
}
@media (max-width: 380px) {
  .topbar { padding: 0 9px; }
  .brand-title { font-size: 13px; }
  .view-btn { padding: 5px 5px; font-size: 7px; }
  .readout-value { font-size: 12px; }
  .readout-label { font-size: 5.5px; }
  .caption-bar p { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
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; }
@media (max-width: 680px) {
  body.embed-mode .workspace { grid-template-rows: minmax(270px, 43dvh) minmax(0,1fr); }
}
