:root {
  color-scheme: dark;
  --bg: #0b121a;
  --panel: #111b25;
  --panel-2: #15222e;
  --line: rgba(175, 199, 215, .13);
  --line-strong: rgba(175, 199, 215, .23);
  --text: #edf4f6;
  --muted: #8fa3af;
  --subtle: #607582;
  --accent: #55d6c2;
  --accent-dim: rgba(85, 214, 194, .12);
  --amber: #e9b66d;
  --water: #3daec4;
  --danger: #e38c75;
  --font: 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); font-family: var(--font); }
body { min-width: 320px; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 25% 0%, rgba(34, 71, 83, .14), transparent 40%), var(--bg); }
.topbar { height: 66px; flex: 0 0 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(11, 18, 26, .96); }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 30px; height: 30px; border: 1px solid rgba(85,214,194,.38); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-8deg); background: linear-gradient(145deg, rgba(85,214,194,.13), rgba(85,214,194,.02)); }
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--accent); transform: skewY(-20deg); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .6; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .78; }
.eyebrow, .section-kicker, .toolbar-label, .caption-index, .readout-label, .check-title, .quality-row > span:first-child, .page-footer, .topbar-note { font-size: 9px; font-weight: 750; letter-spacing: .14em; color: var(--muted); }
.eyebrow { font-size: 8px; margin-bottom: 3px; color: #78909c; }
h1 { margin: 0; font-size: 16px; line-height: 1.15; font-weight: 650; letter-spacing: -.025em; }
.topbar-right { display: flex; align-items: center; gap: 11px; }
.status-dot, .phase-pip { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(85,214,194,.65); }
.topbar-note { font-size: 8px; letter-spacing: .12em; }
.topbar-divider { height: 14px; width: 1px; background: var(--line-strong); margin: 0 3px; }
.workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 1px; background: var(--line); }
.stage-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0d151e; }
.stage-toolbar { height: 54px; flex: 0 0 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(15, 24, 34, .9); }
.toolbar-label { color: #9db0ba; }
.tiny-index { color: var(--subtle); margin-left: 6px; }
.view-tabs { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: rgba(4, 10, 15, .42); }
.view-tab { border: 0; background: transparent; color: var(--muted); border-radius: 5px; padding: 7px 11px; font-size: 10px; cursor: pointer; transition: background .18s ease, color .18s ease; }
.view-tab:hover { color: var(--text); background: rgba(255,255,255,.045); }
.view-tab.active { background: #20343c; color: #c9fff4; box-shadow: inset 0 0 0 1px rgba(85,214,194,.18); }
.canvas-stage { position: relative; flex: 1 1 auto; min-height: 260px; overflow: hidden; background: #0b141d; }
#machineCanvas { display: block; width: 100%; height: 100%; outline: none; }
.canvas-legend { position: absolute; bottom: 14px; left: 19px; display: flex; gap: 14px; pointer-events: none; padding: 7px 9px; border: 1px solid rgba(166,190,204,.12); border-radius: 6px; background: rgba(8,15,22,.72); backdrop-filter: blur(6px); }
.canvas-legend span { display: flex; align-items: center; gap: 6px; font-size: 8px; letter-spacing: .12em; color: #9aadb7; font-weight: 700; }
.canvas-legend i { display: block; width: 7px; height: 7px; border-radius: 2px; }
.legend-water { background: #50c4d4; }
.legend-pressure { background: #e9b66d; }
.phase-chip { position: absolute; top: 14px; right: 16px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(85,214,194,.24); border-radius: 6px; padding: 7px 9px; background: rgba(7,18,24,.78); color: #b8e9df; font-size: 8px; font-weight: 800; letter-spacing: .13em; backdrop-filter: blur(6px); pointer-events: none; }
.phase-chip.hammer { border-color: rgba(233,182,109,.45); color: #f3d4a7; }
.phase-chip.hammer .phase-pip { background: var(--amber); box-shadow: 0 0 10px rgba(233,182,109,.7); }
.stage-caption { flex: 0 0 auto; min-height: 66px; padding: 11px 22px 12px; border-top: 1px solid var(--line); background: #101a24; display: flex; align-items: center; gap: 17px; }
.caption-index { flex: 0 0 112px; color: #7f939f; font-size: 8px; }
.stage-caption p { margin: 0; font-size: 11px; line-height: 1.45; color: #c0cdd2; max-width: 850px; }
.side-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: #101923; padding: 20px 20px 16px; scrollbar-width: thin; scrollbar-color: #344653 transparent; }
.side-panel::-webkit-scrollbar { width: 7px; }
.side-panel::-webkit-scrollbar-thumb { background: #344653; border-radius: 10px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.section-kicker { display: block; color: #78919d; font-size: 8px; margin-bottom: 4px; }
h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; font-weight: 620; }
.model-tag { border: 1px solid rgba(85,214,194,.2); color: #8bcfc2; background: rgba(85,214,194,.06); border-radius: 4px; padding: 4px 6px; font-size: 7px; letter-spacing: .1em; font-weight: 800; white-space: nowrap; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout-card { min-width: 0; min-height: 82px; padding: 10px 11px 8px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(145deg, rgba(27,43,55,.88), rgba(17,28,39,.95)); }
.primary-readout { border-color: rgba(85,214,194,.26); background: linear-gradient(145deg, rgba(24,59,62,.55), rgba(17,30,40,.95)); }
.readout-label { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 7px; color: #94aab4; letter-spacing: .11em; white-space: nowrap; }
.readout-label span { color: #6b8f8f; font-size: 6px; letter-spacing: .06em; }
.readout-value { display: flex; align-items: baseline; gap: 5px; margin-top: 5px; }
.readout-value strong { font-size: 25px; font-weight: 560; letter-spacing: -.055em; font-variant-numeric: tabular-nums; line-height: 1; }
.primary-readout .readout-value strong { color: #8ff0dd; }
.readout-value small { font-size: 9px; color: #9bb0b9; }
.readout-foot { margin-top: 6px; font-size: 8px; color: #78909d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.efficiency-track { height: 3px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; margin-top: 9px; }
.efficiency-track span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
.check-strip { display: flex; align-items: center; gap: 9px; margin-top: 9px; padding: 9px 10px; border: 1px solid rgba(85,214,194,.14); border-radius: 7px; background: rgba(18,43,45,.34); }
.check-icon { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; border-radius: 6px; color: var(--accent); background: rgba(85,214,194,.12); font-size: 12px; }
.check-copy { min-width: 0; flex: 1; }
.check-title { font-size: 7px; color: #9eb3ba; }
.check-title span { color: #71b9ad; font-size: 6px; margin-left: 4px; }
.check-result { margin-top: 3px; font-size: 9px; color: #c6d5d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check-diff { font-size: 12px; color: #8ce1d1; font-variant-numeric: tabular-nums; }
.control-section { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.control-heading { margin-bottom: 11px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 15px; }
.preset-button { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: #14212b; color: #c4d0d5; font-size: 10px; font-weight: 650; cursor: pointer; text-align: left; transition: border-color .18s ease, background .18s ease; }
.preset-button span { color: #718a95; font-size: 6px; letter-spacing: .1em; font-weight: 800; }
.preset-button:hover { border-color: var(--line-strong); }
.preset-button.active { border-color: rgba(85,214,194,.34); background: rgba(33,69,69,.36); color: #d8fff6; }
.slider-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 13px; }
.slider-control { min-width: 0; }
.slider-top { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; margin-bottom: 6px; }
.slider-top label { font-size: 9px; color: #bdcbd0; line-height: 1.2; }
.slider-top output { color: #8fe0d2; font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; height: 13px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; display: block; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(85,214,194,.66), rgba(85,214,194,.18)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, rgba(85,214,194,.66), rgba(85,214,194,.18)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; margin-top: -4px; background: #a3f2e5; border: 2px solid #1d4547; box-shadow: 0 0 0 2px rgba(85,214,194,.18); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #a3f2e5; border: 2px solid #1d4547; box-shadow: 0 0 0 2px rgba(85,214,194,.18); }
input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.slider-scale { display: flex; justify-content: space-between; margin-top: 1px; color: #647b87; font-size: 7px; font-variant-numeric: tabular-nums; }
.transport-section { margin-top: 19px; padding-top: 15px; border-top: 1px solid var(--line); }
.transport-controls { display: grid; grid-template-columns: 1.1fr .75fr .75fr 1fr; gap: 6px; }
.transport-button { min-width: 0; height: 34px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: #182632; color: #b9c8cf; font-size: 9px; font-weight: 650; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.transport-button:hover { background: #203440; border-color: rgba(85,214,194,.28); }
.transport-button:active { transform: translateY(1px); }
.transport-button:focus-visible, .view-tab:focus-visible, .preset-button:focus-visible, .quality-toggle button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.main-transport { border-color: rgba(85,214,194,.34); background: rgba(35,83,79,.5); color: #aef2e5; }
.main-transport:hover { background: rgba(40,103,96,.56); }
.pause-glyph { font-size: 11px; }
.transport-button span:last-child { color: #7fa1aa; font-size: 13px; }
.screenshot-button { background: transparent; }
.quality-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.quality-row > span:first-child { font-size: 7px; color: #8197a1; }
.quality-toggle { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 5px; background: #0d1720; }
.quality-toggle button { padding: 4px 7px; border: 0; border-radius: 3px; background: transparent; color: #81949d; font-size: 8px; cursor: pointer; }
.quality-toggle button.selected { background: #263c45; color: #d5fff7; }
.quality-note { margin-left: auto; color: #607985; font-size: 7px; letter-spacing: .08em; }
.science-panel { margin-top: 17px; border: 1px solid var(--line); border-radius: 7px; background: rgba(15,25,35,.75); }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; font-size: 11px; font-weight: 650; }
.summary-plus { color: var(--accent); font-size: 17px; font-weight: 300; transition: transform .18s ease; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 12px 13px; border-top: 1px solid var(--line); color: #aabac1; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 12px 0 7px; color: #d8e4e7; font-size: 10px; font-weight: 650; }
.science-content h3 em { margin-left: 5px; color: #7cb8ae; font-size: 6px; font-style: normal; letter-spacing: .1em; }
.science-content p { margin: 7px 0 4px; }
.equation { padding: 7px 8px; border: 1px solid rgba(85,214,194,.12); border-radius: 4px; background: rgba(85,214,194,.045); color: #b9e9df; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; overflow-wrap: anywhere; }
.science-content ul { margin: 6px 0 8px; padding-left: 16px; }
.science-content li { margin: 4px 0; }
.constants-note { color: #91a8b1; }
.disclaimer { margin-top: 10px !important; padding-top: 8px; border-top: 1px solid var(--line); color: #718a95; font-size: 8px; }
.page-footer { flex: 0 0 28px; height: 28px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-top: 1px solid var(--line); background: #0b121a; color: #617784; font-size: 7px; }

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100%; min-height: 0; overflow: hidden; }
body.embed-mode .workspace { min-height: 0; }
body.embed-mode .page-footer { display: none; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; }
  .side-panel { padding: 16px 14px; }
  .stage-toolbar { padding: 0 16px; }
  .view-tab { padding: 7px 8px; }
}
@media (max-width: 720px) {
  .topbar { height: 55px; flex-basis: 55px; padding: 0 14px; }
  .brand-mark { width: 26px; height: 26px; }
  h1 { font-size: 14px; }
  .eyebrow { font-size: 7px; }
  .topbar-right { gap: 7px; }
  .topbar-note { font-size: 6px; }
  .topbar-divider { margin: 0 1px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(275px, 46%) minmax(0,1fr); }
  .stage-toolbar { height: 45px; flex-basis: 45px; padding: 0 10px; }
  .toolbar-label { font-size: 7px; }
  .tiny-index { margin-left: 2px; }
  .view-tabs { gap: 1px; padding: 2px; }
  .view-tab { padding: 6px 7px; font-size: 8px; }
  .canvas-stage { min-height: 0; }
  .stage-caption { min-height: 56px; padding: 8px 11px; gap: 9px; }
  .caption-index { flex-basis: 78px; font-size: 7px; }
  .stage-caption p { font-size: 9px; line-height: 1.35; }
  .canvas-legend { bottom: 8px; left: 8px; gap: 8px; padding: 5px 6px; }
  .canvas-legend span { font-size: 6px; }
  .phase-chip { top: 8px; right: 8px; padding: 5px 7px; font-size: 7px; }
  .side-panel { padding: 13px 13px 18px; }
  .section-heading { margin-bottom: 9px; }
  .readout-card { min-height: 75px; padding: 8px 9px 7px; }
  .readout-value strong { font-size: 22px; }
  .control-section { margin-top: 16px; padding-top: 13px; }
  .slider-list { row-gap: 11px; }
  .transport-section { margin-top: 15px; padding-top: 12px; }
  .science-panel { margin-top: 14px; }
  .page-footer { display: none; }
}
@media (max-width: 380px) {
  .topbar-right .topbar-note:last-child, .topbar-divider { display: none; }
  .view-tab { padding: 6px 5px; }
  .toolbar-label { letter-spacing: .08em; }
  .readout-label { font-size: 6px; }
  .readout-label span { font-size: 5px; }
  .slider-list { column-gap: 11px; }
  .transport-controls { grid-template-columns: 1fr  .72fr .72fr; }
  .screenshot-button { grid-column: 1 / -1; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
