:root {
  color-scheme: dark;
  --bg: #0b1115;
  --panel: #111a20;
  --panel-2: #152129;
  --panel-3: #192831;
  --line: #263740;
  --line-soft: rgba(131, 164, 174, .14);
  --text: #e8f0f1;
  --muted: #91a4aa;
  --muted-2: #657980;
  --accent: #70dfcf;
  --accent-dim: rgba(112, 223, 207, .13);
  --accent-line: rgba(112, 223, 207, .34);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--text); }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 12px; padding: 12px; max-width: 1920px; margin: 0 auto; }
.topbar { height: 58px; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 6px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid var(--accent-line); border-radius: 11px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; padding: 7px; transform: rotate(-8deg); }
.brand-mark span { display: block; border: 1.5px solid var(--accent); border-radius: 3px 7px 3px 7px; opacity: .9; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { opacity: .45; }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker, .caption-heading { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.3; }
.eyebrow-dot { color: var(--accent); padding: 0 4px; }
h1 { margin: 2px 0 0; font-size: 19px; line-height: 1.1; letter-spacing: -.035em; font-weight: 690; }
.history-chip { display: flex; align-items: center; gap: 8px; color: #b3c2c5; border: 1px solid var(--line); border-radius: 99px; padding: 7px 11px; font-size: 9px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.history-chip em { color: var(--muted-2); font-style: normal; font-size: 8px; letter-spacing: .12em; border-left: 1px solid var(--line); padding-left: 8px; }
.chip-dot, .status-led, .live-pulse { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(112,223,207,.45); }
.top-status { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .14em; min-width: 74px; justify-content: flex-end; }
.status-led.paused { background: #71838a; box-shadow: none; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 12px; min-height: 0; flex: 1; }
.stage-panel, .control-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; min-height: 0; overflow: hidden; }
.stage-panel { display: flex; flex-direction: column; padding: 10px; gap: 9px; }
.stage-toolbar { height: 38px; min-height: 38px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.view-switch { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #0d151a; }
.view-btn { background: transparent; border: 0; color: var(--muted); padding: 7px 11px; border-radius: 6px; font-size: 9px; font-weight: 800; letter-spacing: .1em; cursor: pointer; transition: background .22s ease, color .22s ease, transform .22s ease; }
.view-btn:hover { color: var(--text); }
.view-btn.active { background: var(--accent-dim); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(112,223,207,.16); }
.stage-actions { display: flex; align-items: center; gap: 7px; }
.quiet-btn, .icon-btn { height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #121c22; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .11em; cursor: pointer; transition: .2s ease; }
.quiet-btn:hover, .icon-btn:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-dim); }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.stage-wrap { flex: 1; min-height: 0; position: relative; overflow: hidden; border: 1px solid rgba(119,154,164,.17); border-radius: 11px; background: #0d171c; isolation: isolate; }
#machineCanvas { display: block; width: 100%; height: 100%; }
.canvas-topline { position: absolute; top: 15px; left: 17px; right: 17px; display: flex; align-items: flex-start; justify-content: space-between; pointer-events: none; }
.scene-label { display: flex; flex-direction: column; gap: 4px; }
.scene-kicker { color: #c3d0d1; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.scene-sub { color: var(--muted-2); font-size: 8px; letter-spacing: .13em; font-weight: 750; }
.live-indicator { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid rgba(112,223,207,.18); background: rgba(8,18,22,.72); border-radius: 99px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.live-pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .45; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.2); } }
.canvas-legend { position: absolute; left: 17px; bottom: 14px; display: flex; gap: 14px; color: #8ea1a7; font-size: 8px; font-weight: 750; letter-spacing: .11em; pointer-events: none; }
.canvas-legend span { display: flex; align-items: center; gap: 6px; }
.legend-water, .legend-metal { width: 13px; height: 3px; border-radius: 2px; background: var(--accent); display: inline-block; box-shadow: 0 0 8px rgba(112,223,207,.3); }
.legend-metal { background: #8c9da2; box-shadow: none; }
.orientation-mark { position: absolute; right: 19px; bottom: 13px; color: #72868d; font-size: 8px; font-weight: 800; display: flex; align-items: center; flex-direction: column; gap: 4px; pointer-events: none; }
.orientation-mark i { display: block; width: 1px; height: 16px; background: linear-gradient(var(--accent), transparent); position: relative; }
.orientation-mark i:before { content: ""; position: absolute; top: -1px; left: -3px; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 5px solid var(--accent); }
.caption-bar { min-height: 54px; display: flex; align-items: center; gap: 11px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(17,28,34,.8); }
.caption-icon { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--accent-line); border-radius: 8px; background: var(--accent-dim); }
.caption-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.caption-heading { font-size: 8px; margin-bottom: 3px; }
.caption-bar p { margin: 0; color: #c3d0d1; font-size: 10px; line-height: 1.35; }
.control-panel { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #31444d transparent; padding: 13px; display: flex; flex-direction: column; gap: 13px; }
.control-panel::-webkit-scrollbar { width: 6px; }
.control-panel::-webkit-scrollbar-thumb { background: #31444d; border-radius: 8px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-bottom: 9px; }
.section-heading h2, .check-head h2 { margin: 3px 0 0; font-size: 13px; letter-spacing: -.02em; font-weight: 680; }
.section-kicker { font-size: 8px; letter-spacing: .15em; }
.derived-tag, .illustrative-tag { border: 1px solid var(--line); border-radius: 5px; color: var(--muted-2); padding: 4px 6px; font-size: 7px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.illustrative-tag { color: #b6c5c7; border-color: rgba(174,196,200,.22); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; padding: 9px 10px 8px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 9px; }
.metric-card.metric-accent { border-color: rgba(112,223,207,.26); background: linear-gradient(135deg, rgba(112,223,207,.1), rgba(21,33,41,.9) 65%); }
.metric-label { color: var(--muted); font-size: 7px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.metric-value { display: flex; align-items: baseline; gap: 5px; margin-top: 4px; white-space: nowrap; }
.metric-value strong { font-size: 23px; line-height: 1; letter-spacing: -.045em; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric-value span { color: var(--muted); font-size: 9px; }
.metric-accent .metric-value strong { color: var(--accent); }
.metric-foot { margin-top: 5px; color: var(--muted-2); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.parameter-section { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.control-list { display: grid; grid-template-columns: 1fr; gap: 9px; }
.range-control { display: block; cursor: pointer; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #d4dfe0; font-size: 10px; font-weight: 600; }
.control-top small { color: var(--muted-2); font-size: 8px; font-weight: 550; }
.control-top output { color: var(--accent); font-size: 9px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 13px; margin: 5px 0 1px; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, var(--accent) 0%, rgba(112,223,207,.35) 100%); border-radius: 4px; }
input[type="range"]::-moz-range-track { height: 3px; background: rgba(112,223,207,.35); border-radius: 4px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #0c171b; 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 #0c171b; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.range-ends { display: flex; justify-content: space-between; color: #62757b; font-size: 7px; font-variant-numeric: tabular-nums; }
.preset-section { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.compact-heading { margin-bottom: 8px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-btn { display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer; transition: .2s ease; }
.preset-btn:hover { border-color: var(--accent-line); background: var(--accent-dim); }
.preset-symbol { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 6px; color: var(--accent); background: var(--accent-dim); font-size: 11px; flex: 0 0 23px; }
.preset-btn strong, .preset-btn small { display: block; }
.preset-btn strong { font-size: 9px; font-weight: 750; }
.preset-btn small { color: var(--muted); margin-top: 3px; font-size: 7px; line-height: 1.2; }
.transport-section { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.transport-buttons { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 7px; }
.primary-btn, .transport-btn { height: 34px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: #c5d2d4; font-size: 8px; font-weight: 850; letter-spacing: .13em; cursor: pointer; transition: .2s ease; }
.primary-btn { border-color: var(--accent-line); background: var(--accent-dim); color: var(--accent); }
.primary-btn:hover, .transport-btn:hover { border-color: var(--accent); color: var(--accent); }
.pause-glyph { font-size: 11px; letter-spacing: -.12em; }
.key-hint { text-align: center; color: var(--muted-2); margin-top: 7px; font-size: 8px; }
.key-hint span { color: #aab9bc; border: 1px solid var(--line); border-radius: 3px; padding: 2px 4px; font-size: 7px; font-weight: 800; }
.key-hint i { font-style: normal; padding: 0 4px; color: #52656c; }
.check-card { padding: 10px; border: 1px solid rgba(112,223,207,.2); border-radius: 9px; background: linear-gradient(145deg, rgba(112,223,207,.07), rgba(18,29,35,.95) 55%); }
.check-head { display: flex; align-items: center; gap: 8px; }
.check-mark { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: var(--accent-dim); color: var(--accent); font-size: 13px; font-weight: 800; }
.check-head h2 { font-size: 11px; }
.check-values { display: grid; grid-template-columns: 1fr 1fr .8fr; gap: 6px; padding: 10px 0 7px; }
.check-values div { min-width: 0; }
.check-values span { display: block; color: var(--muted); font-size: 7px; letter-spacing: .06em; }
.check-values strong { display: block; margin-top: 3px; color: #dbe6e7; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.check-values .check-delta strong { color: var(--accent); }
.check-card p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.science-panel { border: 1px solid var(--line); border-radius: 9px; background: #0f181d; }
.science-panel summary { display: flex; align-items: center; gap: 9px; list-style: none; padding: 10px; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 7px; color: var(--accent); font-size: 13px; }
.science-panel summary strong, .science-panel summary small { display: block; }
.science-panel summary strong { font-size: 10px; }
.science-panel summary small { color: var(--muted); font-size: 8px; margin-top: 3px; }
.chevron { margin-left: auto; color: var(--muted); transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line-soft); padding: 10px; }
.science-content h3 { margin: 8px 0 6px; color: #dce6e7; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.science-content h3:first-child { margin-top: 0; }
.science-content p { margin: 5px 0; color: var(--muted); font-size: 8px; line-height: 1.55; }
.science-content b { color: #cbd8da; font-weight: 650; }
.science-content code { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 8px; white-space: normal; }
.science-content .disclaimer { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-soft); color: #aab9bc; font-style: italic; }
.panel-foot { display: flex; justify-content: space-between; color: #586b72; font-size: 7px; font-weight: 800; letter-spacing: .13em; padding: 0 2px 2px; }
@media (max-width: 850px) {
  .app-shell { gap: 8px; padding: 8px; }
  .topbar { height: 50px; min-height: 50px; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  h1 { font-size: 17px; }
  .history-chip { padding: 6px 8px; gap: 6px; font-size: 7px; }
  .history-chip em { font-size: 7px; padding-left: 6px; }
  .top-status { min-width: 62px; font-size: 8px; }
  .layout { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(250px, 41dvh) minmax(0,1fr); gap: 8px; }
  .stage-panel { padding: 7px; gap: 6px; }
  .stage-toolbar { height: 32px; min-height: 32px; }
  .view-btn { padding: 6px 8px; font-size: 8px; }
  .quiet-btn, .icon-btn { height: 27px; padding: 0 7px; font-size: 7px; }
  .stage-wrap { border-radius: 8px; }
  .canvas-topline { top: 9px; left: 10px; right: 10px; }
  .scene-kicker { font-size: 8px; }
  .scene-sub { font-size: 7px; }
  .canvas-legend { left: 10px; bottom: 8px; gap: 9px; font-size: 7px; }
  .orientation-mark { right: 11px; bottom: 8px; }
  .caption-bar { min-height: 39px; padding: 5px 8px; gap: 8px; }
  .caption-icon { width: 23px; height: 23px; flex-basis: 23px; }
  .caption-heading { font-size: 7px; margin-bottom: 2px; }
  .caption-bar p { font-size: 8px; line-height: 1.25; }
  .control-panel { padding: 11px; gap: 11px; }
  .metric-card { padding: 8px 9px 7px; }
  .metric-value strong { font-size: 21px; }
  .control-list { grid-template-columns: 1fr 1fr; column-gap: 13px; row-gap: 9px; }
  .control-top { font-size: 9px; }
  .range-ends { font-size: 6px; }
}
@media (max-width: 430px) {
  .app-shell { padding: 6px; gap: 6px; }
  .topbar { min-height: 47px; height: 47px; }
  .brand-lockup { gap: 8px; }
  .brand-mark { width: 27px; height: 27px; padding: 6px; }
  .eyebrow { font-size: 7px; letter-spacing: .12em; }
  h1 { font-size: 16px; }
  .history-chip { max-width: 118px; overflow: hidden; font-size: 6px; padding: 5px 6px; }
  .history-chip em { display: none; }
  .top-status { min-width: 48px; font-size: 7px; gap: 5px; }
  .layout { grid-template-rows: minmax(240px, 40dvh) minmax(0,1fr); gap: 6px; }
  .view-switch { gap: 1px; padding: 2px; }
  .view-btn { padding: 6px 6px; font-size: 7px; letter-spacing: .07em; }
  .stage-actions { gap: 4px; }
  .quiet-btn { font-size: 6px; padding: 0 5px; }
  .icon-btn { gap: 4px; font-size: 6px; padding: 0 5px; }
  .icon-btn svg { width: 13px; }
  .canvas-legend { gap: 7px; font-size: 6px; }
  .caption-bar p { font-size: 7px; }
  .control-panel { padding: 9px; gap: 10px; }
  .section-heading h2 { font-size: 12px; }
  .metric-grid { gap: 6px; }
  .metric-card { padding: 7px 8px; }
  .metric-label { font-size: 6px; }
  .metric-value strong { font-size: 20px; }
  .metric-foot { font-size: 7px; }
  .control-list { column-gap: 10px; }
  .control-top { font-size: 8px; }
  .control-top small { font-size: 7px; }
  .control-top output { font-size: 8px; }
  .preset-btn { padding: 7px 6px; gap: 6px; }
  .preset-btn small { font-size: 6px; }
  .check-values strong { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
