:root {
  color-scheme: dark;
  --bg: #0b1118;
  --panel: #111a24;
  --panel-2: #15212d;
  --panel-3: #1a2835;
  --line: rgba(191, 209, 224, .12);
  --line-strong: rgba(191, 209, 224, .2);
  --text: #e9f0f5;
  --muted: #91a1ae;
  --faint: #667786;
  --accent: #e9ad5b;
  --accent-2: #f2c47e;
  --water: #62b8d5;
  --air: #c5d5df;
  --danger: #d47b64;
  --radius: 13px;
  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%; 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; }
.app { display: grid; grid-template-columns: minmax(0, 1fr) 370px; width: 100%; height: 100vh; height: 100dvh; background: var(--bg); overflow: hidden; }
.visual-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at 48% 46%, #152633 0%, #0d1822 48%, #0a1118 100%); }
#machine { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-top { position: absolute; z-index: 2; top: 22px; left: 26px; right: 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; pointer-events: none; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(233,173,91,.52); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: rgba(18,29,39,.76); box-shadow: 0 4px 20px rgba(0,0,0,.2); flex: 0 0 auto; }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--accent); display: block; }
.brand-mark span:nth-child(1) { height: 10px; opacity: .6; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .8; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .17em; line-height: 1.3; }
h1 { margin: 0; font-size: clamp(18px, 2.1vw, 25px); letter-spacing: -.035em; font-weight: 650; line-height: 1.12; }
.stage-subtitle { margin: 4px 0 0; color: #a7b6c2; font-size: 11px; letter-spacing: .01em; }
.stage-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; background: rgba(13,22,30,.84); border: 1px solid var(--line-strong); border-radius: 30px; color: #dce6ed; font-size: 9px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; box-shadow: 0 6px 22px rgba(0,0,0,.18); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--water); box-shadow: 0 0 0 4px rgba(98,184,213,.12); }
.stage-status.pulse .status-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(233,173,91,.13); }
.stage-bottom { position: absolute; left: 25px; right: 24px; bottom: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: #90a0ac; font-size: 9px; letter-spacing: .04em; }
.legend-item i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.legend-water { background: var(--water); box-shadow: 0 0 9px rgba(98,184,213,.55); }
.legend-air { background: #d2dce2; }
.legend-pulse { background: var(--accent); box-shadow: 0 0 9px rgba(233,173,91,.55); }
.stage-time { color: #738391; font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; white-space: nowrap; }
.canvas-hint { display: none; }
.panel { min-width: 0; min-height: 0; background: linear-gradient(180deg, #111b25 0%, #101923 100%); border-left: 1px solid var(--line); overflow: hidden; }
.panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 22px 20px 18px; scrollbar-width: thin; scrollbar-color: #314251 transparent; }
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #314251; border-radius: 8px; }
.panel-heading, .section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-heading { margin-bottom: 15px; }
.panel-heading h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.model-tag, .tiny-note { color: #8393a0; font-size: 8px; letter-spacing: .1em; font-weight: 750; white-space: nowrap; }
.model-tag { padding: 5px 7px; border: 1px solid rgba(233,173,91,.22); border-radius: 5px; color: #cda66f; background: rgba(233,173,91,.055); }
.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.readout { min-width: 0; background: linear-gradient(145deg, rgba(27,41,54,.9), rgba(20,31,42,.9)); border: 1px solid var(--line); border-radius: 10px; padding: 11px 11px 9px; min-height: 88px; }
.primary-readout { border-color: rgba(233,173,91,.3); background: linear-gradient(145deg, rgba(62,49,35,.36), rgba(25,35,44,.96)); }
.readout-top { display: flex; justify-content: space-between; gap: 5px; color: #9eacb8; font-size: 8px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.readout-mark { color: #687d8c; font: 9px ui-monospace, monospace; }
.readout-value { display: flex; align-items: baseline; gap: 5px; margin-top: 8px; white-space: nowrap; }
.readout-value strong { font-size: 25px; font-weight: 650; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.primary-readout .readout-value strong { color: var(--accent-2); }
.readout-value small { color: #94a4b0; font-size: 10px; }
.readout-foot { margin-top: 3px; color: #728391; font-size: 8px; line-height: 1.3; }
.state-caption { display: grid; gap: 4px; margin-top: 10px; padding: 9px 10px; border-left: 2px solid rgba(233,173,91,.62); border-radius: 0 7px 7px 0; background: rgba(233,173,91,.055); }
.caption-kicker { color: #b58e5d; font-size: 7px; font-weight: 850; letter-spacing: .13em; }
.caption-copy { color: #b7c4cd; font-size: 9px; line-height: 1.45; }
.section-block { margin-top: 18px; }
.section-title-row { margin-bottom: 10px; }
.section-title-row h3 { margin: 0; color: #dce5eb; font-size: 12px; font-weight: 700; letter-spacing: .015em; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 13px; }
.control { display: block; min-width: 0; }
.control-line { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; color: #aebbc5; font-size: 9px; line-height: 1.3; }
.control-line output { color: var(--accent-2); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; margin: 9px 0 4px; appearance: none; height: 3px; border-radius: 10px; background: linear-gradient(90deg, var(--accent) 0%, #435363 0%); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border: 2px solid #0e1720; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #0e1720; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.range-ends { display: flex; justify-content: space-between; color: #667887; font-size: 8px; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset { display: flex; align-items: center; gap: 9px; text-align: left; padding: 9px 10px; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: #172430; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.preset:hover { border-color: rgba(233,173,91,.4); background: #1b2b38; }
.preset:active { transform: translateY(1px); }
.preset.active { border-color: rgba(233,173,91,.48); background: rgba(233,173,91,.08); }
.preset-icon { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 auto; border-radius: 7px; background: rgba(233,173,91,.12); color: var(--accent); font-size: 16px; }
.preset b { display: block; color: #dfe7ed; font-size: 9px; font-weight: 750; }
.preset small { display: block; margin-top: 3px; color: #81919e; font-size: 8px; }
.view-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #0d151d; }
.view-button { border: 0; border-radius: 6px; padding: 8px 3px; background: transparent; color: #8595a2; font-size: 9px; cursor: pointer; transition: background .18s ease, color .18s ease; }
.view-button:hover { color: #dce5eb; }
.view-button.active { background: #263442; color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(233,173,91,.16); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.transport { margin-top: 16px; padding: 12px 0 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.transport-buttons { display: grid; grid-template-columns: 1.2fr .9fr .9fr; gap: 7px; }
.transport-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: #192733; color: #bdc9d2; font-size: 9px; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.transport-button:hover { background: #223442; border-color: rgba(233,173,91,.35); }
.play-button { border-color: rgba(233,173,91,.45); background: rgba(233,173,91,.12); color: var(--accent-2); font-weight: 750; }
#playIcon { font-size: 12px; }
.transport-bottom { display: flex; justify-content: space-between; margin-top: 9px; }
.text-button { border: 0; padding: 2px 0; background: transparent; color: #81919e; font-size: 8px; cursor: pointer; }
.text-button:hover { color: var(--accent-2); }
.text-button b { color: #bdc9d2; font-weight: 700; }
.check-panel { margin-top: 13px; padding: 10px 11px; border: 1px solid rgba(98,184,213,.18); border-radius: 9px; background: rgba(31,61,75,.18); }
.check-heading { display: flex; align-items: center; gap: 8px; }
.check-icon { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 6px; background: rgba(98,184,213,.12); color: #83c4d8; font-size: 12px; }
.check-heading b { display: block; color: #cddbe3; font-size: 9px; }
.check-heading small { display: block; margin-top: 2px; color: #7e929f; font-size: 8px; }
.check-values { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; margin-top: 9px; color: #80919d; font-size: 8px; }
.check-values b { display: block; margin-top: 2px; color: #d6e1e7; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.check-values strong { grid-column: 1 / -1; color: #86c4d7; font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; }
.science-panel { margin-top: 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(16,26,36,.55); }
.science-panel summary { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; cursor: pointer; color: #d9e3e9; font-size: 10px; font-weight: 750; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary::after { content: "+"; color: var(--accent); font-size: 15px; font-weight: 400; }
.science-panel[open] summary::after { content: "−"; }
.summary-meta { margin-left: auto; margin-right: 10px; color: #748694; font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.science-content { padding: 0 12px 12px; color: #9cabb6; font-size: 9px; line-height: 1.55; }
.science-content h4 { margin: 12px 0 5px; color: #d7e1e8; font-size: 9px; letter-spacing: .03em; }
.science-content p { margin: 5px 0 8px; }
.equation { padding: 7px 8px; margin: 5px 0; border-left: 2px solid rgba(233,173,91,.45); background: rgba(30,44,56,.52); }
.equation b { display: block; color: #b7c5ce; font-size: 8px; margin-bottom: 2px; }
.equation code { color: #e4bb7e; font-size: 9px; white-space: normal; }
.science-content ul { padding-left: 15px; margin: 5px 0 9px; }
.science-content li { margin: 4px 0; }
.science-disclaimer { padding-top: 8px; border-top: 1px solid var(--line); color: #7f909c; font-style: italic; }
.panel-footer { display: flex; justify-content: space-between; padding: 13px 1px 2px; color: #5f7180; font: 7px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .1em; }
@media (max-width: 900px) and (min-width: 701px) {
  .app { grid-template-columns: minmax(0, 1fr) 340px; }
  .panel-scroll { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(270px, 45dvh) minmax(0, 1fr); }
  .visual-stage { grid-row: 1; min-height: 0; border-bottom: 1px solid var(--line); }
  .panel { grid-row: 2; border-left: 0; min-height: 0; }
  .panel-scroll { padding: 14px 15px 18px; }
  .stage-top { top: 12px; left: 13px; right: 12px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 8px; }
  .brand-lockup { gap: 9px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 17px; }
  .stage-subtitle { font-size: 9px; margin-top: 2px; }
  .stage-status { padding: 6px 8px; font-size: 7px; gap: 6px; }
  .status-dot { width: 6px; height: 6px; }
  .stage-bottom { left: 13px; right: 12px; bottom: 9px; }
  .legend { gap: 8px; }
  .legend-item { font-size: 7px; gap: 4px; }
  .legend-item i { width: 6px; height: 6px; }
  .stage-time { font-size: 7px; }
  .canvas-hint { display: none; }
  .panel-heading { margin-bottom: 11px; }
  .panel-heading h2 { font-size: 15px; }
  .readout { min-height: 76px; padding: 9px 10px 8px; }
  .readout-value { margin-top: 6px; }
  .readout-value strong { font-size: 22px; }
  .section-block { margin-top: 15px; }
  .state-caption { margin-top: 8px; padding: 8px 9px; }
  .caption-copy { font-size: 8px; }
  .controls-grid { gap: 12px 11px; }
  .control-line { font-size: 8px; }
  .control-line output { font-size: 9px; }
  .preset { padding: 8px; gap: 7px; }
  .preset-icon { width: 22px; height: 22px; }
  .transport { margin-top: 13px; }
}
@media (max-width: 380px) {
  .model-tag { display: none; }
  .readout-value strong { font-size: 20px; }
  .tiny-note { font-size: 7px; }
  .legend-item { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
