:root {
  color-scheme: dark;
  --bg: #0a1117;
  --panel: #101b23;
  --panel-2: #13212b;
  --panel-3: #172833;
  --line: rgba(163, 190, 203, .14);
  --line-strong: rgba(163, 190, 203, .25);
  --text: #e8f1f3;
  --muted: #91a7b1;
  --dim: #5e7681;
  --accent: #57d6c3;
  --accent-2: #a0f0df;
  --water: #4aa9d8;
  --air: #f4c879;
  --warn: #e4a96b;
  --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-width: 320px; min-height: 100%; background: var(--bg); color: var(--text); }
body { 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 22% 8%, rgba(49, 109, 117, .12), transparent 42%), var(--bg); }
.topbar { height: 68px; min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(10, 17, 23, .94); gap: 18px; }
.brand-lockup, .top-actions, .brand-copy, .stage-heading, .transport-controls, .transport-note, .section-head, .slider-top, .check-heading, .check-values { display: flex; align-items: center; }
.brand-lockup { gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(87,214,195,.4); border-radius: 10px; position: relative; display: grid; place-items: center; background: linear-gradient(145deg, rgba(87,214,195,.18), rgba(87,214,195,.03)); flex: 0 0 auto; }
.brand-mark span { width: 13px; height: 18px; border: 1.5px solid var(--accent); border-radius: 8px 8px 6px 6px; transform: skewY(-12deg); position: absolute; }
.brand-mark i { width: 3px; height: 21px; background: var(--accent); border-radius: 3px; transform: rotate(25deg); opacity: .7; }
.brand-copy { display: block; min-width: 0; }
.eyebrow { color: #75909b; font-size: 9px; letter-spacing: .16em; font-weight: 750; line-height: 1.3; }
h1 { font-size: 16px; letter-spacing: -.025em; margin: 3px 0 0; font-weight: 650; white-space: nowrap; }
h1 span { color: #58717d; font-weight: 400; margin: 0 3px; }
.top-actions { gap: 16px; }
.quality-control { display: flex; align-items: center; gap: 3px; border: 1px solid var(--line); background: #0d171e; border-radius: 8px; padding: 3px; }
.quality-control > span { font-size: 8px; letter-spacing: .12em; color: var(--dim); padding: 0 7px 0 8px; font-weight: 750; }
.quality-btn { border: 0; background: transparent; border-radius: 5px; color: var(--muted); font-size: 10px; padding: 5px 8px; cursor: pointer; }
.quality-btn.is-active { color: var(--accent-2); background: rgba(87,214,195,.13); }
.icon-button { height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: #12212a; color: #c7d8dd; display: flex; align-items: center; gap: 8px; padding: 0 11px; cursor: pointer; font-size: 10px; font-weight: 650; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
button:hover { border-color: rgba(87,214,195,.55); }
button:focus-visible, input:focus-visible, summary:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 378px; gap: 0; flex: 1; min-height: 0; }
.stage-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px 16px 14px 20px; border-right: 1px solid var(--line); }
.stage-toolbar { height: 49px; min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 3px 12px; }
.stage-heading { gap: 10px; min-width: 0; }
.stage-heading > div { display: grid; gap: 2px; }
.stage-heading strong { font-size: 12px; font-weight: 650; letter-spacing: -.01em; }
.stage-heading small { color: var(--muted); font-size: 9px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(87,214,195,.1), 0 0 14px rgba(87,214,195,.5); flex: 0 0 auto; }
.view-tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: rgba(13,24,31,.8); flex: 0 0 auto; }
.view-tab { border: 0; background: transparent; color: #8399a3; padding: 6px 10px; border-radius: 5px; font-size: 9px; cursor: pointer; transition: background .2s ease, color .2s ease; }
.view-tab.is-active { color: #d8f8f1; background: rgba(87,214,195,.15); box-shadow: inset 0 0 0 1px rgba(87,214,195,.18); }
.canvas-wrap { position: relative; flex: 1; min-height: 270px; border: 1px solid rgba(124,166,181,.2); border-radius: 13px; overflow: hidden; background: radial-gradient(ellipse at 52% 54%, rgba(27,66,79,.42), rgba(11,22,30,.96) 72%), #0d1a22; box-shadow: 0 18px 44px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.025); }
.canvas-wrap::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; background-image: linear-gradient(rgba(129,167,180,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(129,167,180,.035) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(to bottom, rgba(0,0,0,.65), transparent 92%); }
#machineCanvas { width: 100%; height: 100%; display: block; position: relative; z-index: 0; }
.canvas-corner { position: absolute; z-index: 2; display: grid; gap: 4px; pointer-events: none; }
.canvas-corner-tl { top: 15px; left: 17px; }
.corner-label { color: #718b96; font-size: 8px; letter-spacing: .16em; font-weight: 750; }
.corner-value { color: #c8dbe0; font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.canvas-corner-br { right: 16px; bottom: 14px; }
.motion-key { display: flex; align-items: center; gap: 6px; color: #8398a2; font-size: 8px; letter-spacing: .1em; font-weight: 700; }
.motion-key i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-left: 5px; }
.key-water { background: var(--water); box-shadow: 0 0 8px rgba(74,169,216,.7); }
.key-air { background: var(--air); box-shadow: 0 0 8px rgba(244,200,121,.7); }
.canvas-caption { position: absolute; z-index: 2; bottom: 13px; left: 16px; max-width: min(70%, 500px); padding: 8px 11px; border: 1px solid rgba(137,174,188,.14); border-radius: 7px; background: rgba(8,17,23,.76); color: #a7bac1; font-size: 9px; line-height: 1.45; backdrop-filter: blur(8px); pointer-events: none; }
.transport-bar { min-height: 48px; display: flex; align-items: end; justify-content: space-between; gap: 10px; padding: 10px 3px 0; }
.transport-controls { gap: 6px; }
.transport-btn { height: 28px; border: 1px solid var(--line); background: #101e27; color: #9fb2ba; border-radius: 6px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; font-size: 9px; cursor: pointer; transition: all .18s ease; }
.transport-btn.primary { color: #d7f6ef; border-color: rgba(87,214,195,.28); background: rgba(87,214,195,.1); }
.pause-glyph { font-size: 10px; letter-spacing: -3px; margin-right: 2px; }
.transport-note { gap: 7px; color: #667e88; font-size: 8px; letter-spacing: .11em; font-weight: 750; }
.status-led { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(87,214,195,.7); }
.status-led.paused { background: var(--warn); box-shadow: 0 0 8px rgba(228,169,107,.5); }
.note-divider { color: #344b56; }
.control-panel { min-height: 0; overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, rgba(18,30,39,.95), rgba(13,23,30,.98)); scrollbar-width: thin; scrollbar-color: #2a4652 transparent; }
.results-section, .design-section { padding: 18px 18px 16px; border-bottom: 1px solid var(--line); }
.section-head { justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.section-head h2 { font-size: 13px; letter-spacing: -.02em; margin: 3px 0 0; font-weight: 650; }
.model-tag, .illustrative-tag { border: 1px solid rgba(87,214,195,.2); color: #79cabb; background: rgba(87,214,195,.06); border-radius: 4px; padding: 4px 6px; font-size: 7px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.illustrative-tag { color: #c5a26d; border-color: rgba(197,162,109,.2); background: rgba(197,162,109,.06); }
.readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.readout-card { min-width: 0; padding: 10px 10px 9px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(145deg, rgba(24,42,52,.82), rgba(15,28,36,.85)); }
.readout-card.featured { border-color: rgba(87,214,195,.25); background: linear-gradient(145deg, rgba(24,64,66,.5), rgba(15,31,39,.95)); }
.readout-label { color: #91a8b1; font-size: 9px; display: flex; justify-content: space-between; gap: 5px; white-space: nowrap; }
.readout-label span { color: #617b86; font: 8px ui-monospace, monospace; }
.readout-value { font: 650 22px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.06em; margin: 6px 0 4px; color: #e8f3f2; }
.featured .readout-value { color: var(--accent-2); }
.readout-foot { color: #708792; font-size: 8px; display: flex; align-items: center; gap: 5px; min-height: 10px; white-space: nowrap; }
.readout-indicator { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.power-strip { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; color: #78909a; font-size: 8px; }
.power-strip b { color: #c9d8dc; font: 600 9px ui-monospace, monospace; margin-left: 4px; }
.design-section { padding-top: 17px; }
.design-head { margin-bottom: 12px; }
.preset-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; margin-bottom: 16px; }
.preset-btn { min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #13232c; cursor: pointer; transition: all .18s ease; }
.preset-btn:hover { background: #182d37; }
.preset-btn:active { transform: translateY(1px); }
.preset-icon { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; font-size: 15px; }
.forge-icon { color: #e7bb79; background: rgba(231,187,121,.11); }
.mine-icon { color: #7cc6d9; background: rgba(124,198,217,.1); }
.preset-btn b, .preset-btn small { display: block; }
.preset-btn b { font-size: 9px; color: #d6e2e5; font-weight: 650; }
.preset-btn small { margin-top: 3px; color: #7d949d; font-size: 7px; white-space: nowrap; }
.slider-list { display: grid; gap: 14px; }
.slider-control { min-width: 0; }
.slider-top { justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.slider-top label { color: #b8c8ce; font-size: 9px; font-weight: 600; }
.slider-top output { color: #bce9df; font: 600 9px ui-monospace, monospace; }
input[type="range"] { width: 100%; height: 13px; margin: 0; display: block; appearance: none; background: transparent; cursor: pointer; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) 0%, rgba(87,214,195,.25) 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) 0%, rgba(87,214,195,.25) 100%); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; border: 2px solid #c5fff1; background: #3eaa9e; box-shadow: 0 0 0 3px rgba(87,214,195,.12); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; border: 2px solid #c5fff1; background: #3eaa9e; box-shadow: 0 0 0 3px rgba(87,214,195,.12); }
.range-ends { display: flex; justify-content: space-between; color: #5f7781; font: 7px ui-monospace, monospace; margin-top: 1px; }
.check-panel { margin-top: 17px; padding: 10px; border: 1px solid rgba(87,214,195,.18); border-radius: 8px; background: rgba(20,47,49,.27); }
.check-heading { gap: 8px; }
.check-icon { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(87,214,195,.13); color: var(--accent); font-size: 11px; font-weight: 800; flex: 0 0 auto; }
.check-heading > div { min-width: 0; display: grid; gap: 2px; }
.check-heading b { color: #cce3df; font-size: 9px; }
.check-heading small { color: #78949b; font-size: 7px; }
.check-diff { margin-left: auto; color: var(--accent-2); font: 600 10px ui-monospace, monospace; white-space: nowrap; }
.check-values { justify-content: space-between; gap: 8px; margin: 8px 0 0 26px; color: #77909a; font-size: 8px; }
.check-values b { color: #bdcdd1; font: 600 8px ui-monospace, monospace; margin-left: 3px; }
.science-panel { border-bottom: 1px solid var(--line); }
.science-panel summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 14px 18px; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { display: grid; gap: 3px; }
.science-panel summary b { font-size: 11px; font-weight: 650; }
.summary-plus { color: var(--accent); font-size: 19px; font-weight: 300; transition: transform .2s ease; }
.science-panel[open] .summary-plus { transform: rotate(45deg); }
.science-content { padding: 0 18px 16px; color: #9db0b7; font-size: 9px; line-height: 1.55; }
.science-content p { margin: 0 0 11px; }
.science-content h3 { color: #d0dfe2; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; margin: 15px 0 7px; }
.equation { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 6px 8px; border-left: 2px solid rgba(87,214,195,.45); background: rgba(24,43,51,.65); margin: 5px 0; }
.equation span { color: #78929c; font-size: 8px; }
.equation code { color: #d0e9e4; font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: normal; }
.equation-note, .history-source { color: #78909a; font-size: 8px; }
.assumption-list { padding-left: 14px; margin: 0; display: grid; gap: 6px; }
.assumption-list li { padding-left: 2px; }
.assumption-list b { color: #c3d5d8; }
.history-source { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 13px !important; }
.disclaimer { color: #a7c9c3; font-size: 8px; border-left: 2px solid var(--accent); padding-left: 8px; margin-top: 12px !important; }
.panel-footer { display: flex; justify-content: space-between; gap: 8px; padding: 11px 18px 14px; color: #506b76; font-size: 7px; letter-spacing: .13em; font-weight: 800; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100%; min-height: 0; }
body.embed-mode .workspace { min-height: 0; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0,1fr) 410px; } .stage-panel { padding: 20px 20px 16px 24px; } .results-section, .design-section { padding-left: 21px; padding-right: 21px; } }
@media (max-width: 980px) { .workspace { grid-template-columns: minmax(0,1fr) 340px; } .stage-panel { padding-left: 14px; padding-right: 14px; } .topbar { padding: 0 16px; } }
@media (max-width: 760px) {
  .topbar { height: 58px; min-height: 58px; padding: 0 12px; }
  .brand-mark { width: 29px; height: 29px; }
  h1 { font-size: 13px; }
  .eyebrow { font-size: 8px; }
  .top-actions { gap: 7px; }
  .quality-control > span { display: none; }
  .quality-btn { padding: 5px 7px; }
  .icon-button { width: 33px; height: 33px; justify-content: center; padding: 0; }
  .icon-button span { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(230px, 38dvh) minmax(0,1fr); gap: 0; }
  .stage-panel { padding: 8px 9px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-toolbar { height: 39px; min-height: 39px; padding: 0 2px 7px; gap: 5px; }
  .stage-heading { gap: 7px; }
  .stage-heading strong { font-size: 10px; }
  .stage-heading small { display: none; }
  .view-tabs { padding: 2px; }
  .view-tab { font-size: 8px; padding: 5px 7px; }
  .canvas-wrap { min-height: 0; border-radius: 9px; }
  .canvas-corner-tl { top: 8px; left: 9px; gap: 2px; }
  .corner-label { font-size: 6px; }
  .corner-value { font-size: 8px; }
  .canvas-caption { bottom: 7px; left: 8px; max-width: 76%; font-size: 7px; padding: 5px 7px; }
  .canvas-corner-br { right: 8px; bottom: 8px; }
  .motion-key { font-size: 6px; gap: 3px; }
  .motion-key i { width: 5px; height: 5px; margin-left: 2px; }
  .transport-bar { min-height: 34px; padding-top: 5px; align-items: center; }
  .transport-btn { height: 25px; font-size: 8px; padding: 0 8px; }
  .transport-note { font-size: 6px; gap: 4px; }
  .control-panel { display: block; overscroll-behavior: contain; }
  .results-section { padding: 12px 12px 10px; }
  .section-head { margin-bottom: 8px; }
  .section-head h2 { font-size: 12px; }
  .readout-grid { gap: 6px; }
  .readout-card { padding: 8px; }
  .readout-label { font-size: 8px; }
  .readout-value { font-size: 19px; margin: 4px 0 2px; }
  .readout-foot { font-size: 7px; }
  .power-strip { margin-top: 6px; padding: 6px 8px; }
  .design-section { padding: 12px; }
  .preset-row { margin-bottom: 12px; }
  .preset-btn { padding: 7px; gap: 6px; }
  .preset-btn b { font-size: 8px; }
  .preset-btn small { font-size: 6px; }
  .slider-list { gap: 12px; }
  .slider-top label { font-size: 8px; }
  .slider-top output { font-size: 8px; }
  .check-panel { margin-top: 13px; }
  .science-panel summary { padding: 12px; }
  .science-content { padding: 0 12px 13px; }
  .panel-footer { padding: 9px 12px 12px; }
}
@media (max-width: 380px) {
  .topbar { padding: 0 9px; }
  .brand-copy .eyebrow { display: none; }
  h1 { font-size: 12px; }
  h1 span { display: none; }
  .brand-lockup { gap: 8px; }
  .stage-panel { padding-left: 6px; padding-right: 6px; }
  .view-tab { padding: 5px 5px; }
  .transport-note { letter-spacing: .06em; }
  .model-tag, .illustrative-tag { font-size: 6px; padding: 3px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
