:root {
  color-scheme: dark;
  --bg: #07111a;
  --panel: #0c1822;
  --panel-2: #101f2b;
  --panel-3: #132632;
  --line: rgba(170, 202, 209, 0.13);
  --line-strong: rgba(170, 202, 209, 0.22);
  --text: #e7f0ef;
  --muted: #8ea3a8;
  --quiet: #647a82;
  --accent: #5de0cf;
  --accent-soft: rgba(93, 224, 207, 0.12);
  --sand: #c49a63;
  --radius: 13px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { 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 46% -24%, rgba(46, 93, 105, .16), transparent 52%), var(--bg); }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100%; min-height: 0; }
.topbar { height: 62px; flex: 0 0 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(8, 19, 28, .92); }
.brand-lockup, .topbar-right, .stage-tags, .transport-main, .transport-tools, .panel-heading-row, .check-heading { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-mark { width: 28px; height: 28px; border: 1px solid rgba(93,224,207,.4); border-radius: 50%; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-28deg); }
.brand-mark span { width: 2px; border-radius: 2px; background: var(--accent); display: block; }
.brand-mark span:nth-child(1) { height: 8px; opacity: .5; }
.brand-mark span:nth-child(2) { height: 14px; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .72; }
.brand-kicker { color: #c5d7d8; font-size: 9px; letter-spacing: .19em; font-weight: 750; }
.brand-kicker span { color: var(--accent); padding: 0 3px; }
.brand-name { color: var(--muted); font-size: 10px; letter-spacing: .025em; margin-top: 3px; }
.topbar-right { gap: 22px; }
.live-indicator, .topbar-index { color: #93a9ad; font-size: 9px; letter-spacing: .13em; font-weight: 700; }
.live-indicator { display: flex; align-items: center; gap: 7px; }
.live-indicator i, .state-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(93,224,207,.55); }
.topbar-index { color: #627982; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 354px; gap: 12px; padding: 12px; }
.stage-panel, .control-panel { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17,33,44,.96), rgba(9,21,30,.98)); box-shadow: 0 16px 45px rgba(0,0,0,.12); }
.stage-panel { display: flex; flex-direction: column; overflow: hidden; }
.stage-toolbar { min-height: 86px; flex: 0 0 86px; display: flex; justify-content: space-between; align-items: center; padding: 15px 21px 12px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 8px; letter-spacing: .17em; color: #80989d; font-weight: 800; }
.eyebrow-rule { display: inline-block; vertical-align: middle; width: 22px; height: 1px; margin: 0 5px; background: rgba(93,224,207,.45); }
.stage-heading h1 { margin: 5px 0 2px; font-size: clamp(23px, 2.5vw, 31px); line-height: 1; font-weight: 650; letter-spacing: -.045em; }
.stage-heading p { margin: 0; color: #8ea4a9; font-size: 11px; }
.stage-tags { gap: 8px; align-self: flex-start; padding-top: 6px; }
.outline-tag, .state-tag { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 4px; color: #9fb3b7; font-size: 8px; letter-spacing: .11em; font-weight: 750; white-space: nowrap; }
.state-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); border-color: rgba(93,224,207,.3); background: rgba(93,224,207,.06); }
.state-tag.stable { color: #b2c3c5; border-color: var(--line-strong); background: rgba(255,255,255,.025); }
.state-tag.stable i { background: #90a8ae; box-shadow: none; }
.state-tag.near { color: #d9c18c; border-color: rgba(217,193,140,.3); background: rgba(217,193,140,.06); }
.state-tag.near i { background: #d9c18c; box-shadow: none; }
.visual-wrap { position: relative; flex: 1 1 auto; min-height: 200px; overflow: hidden; background: #0a1720; }
#scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.canvas-corner { position: absolute; top: 13px; color: rgba(184,207,208,.58); font-size: 8px; letter-spacing: .13em; font-weight: 750; pointer-events: none; }
.canvas-corner-left { left: 16px; }
.canvas-corner-left span { color: var(--accent); padding: 0 4px; }
.canvas-corner-right { right: 16px; text-align: right; }
.canvas-legend { position: absolute; bottom: 12px; left: 15px; display: flex; gap: 13px; pointer-events: none; color: rgba(198,216,215,.72); font-size: 7px; letter-spacing: .1em; font-weight: 750; }
.canvas-legend span { display: flex; align-items: center; gap: 5px; }
.canvas-legend i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.legend-water { background: #53c9d3; }
.legend-grain { background: #c99e68; }
.legend-flow { width: 12px !important; height: 2px !important; border-radius: 0 !important; background: var(--accent); }
.explain-strip { flex: 0 0 auto; min-height: 61px; display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(10,24,33,.8); }
.explain-marker { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border: 1px solid rgba(93,224,207,.28); border-radius: 50%; }
.explain-marker span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(93,224,207,.5); }
.explain-copy { min-width: 0; flex: 1; }
.explain-label { color: var(--accent); font-size: 7px; letter-spacing: .16em; font-weight: 800; margin-bottom: 3px; }
.explain-copy p { margin: 0; color: #b5c6c8; font-size: 10px; line-height: 1.42; }
.explain-state { flex: 0 0 auto; color: #799097; font-size: 8px; letter-spacing: .1em; font-weight: 800; }
.transport-bar { flex: 0 0 51px; min-height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 13px; background: rgba(8,19,28,.65); }
.transport-main, .transport-tools { gap: 6px; }
.control-button { height: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(255,255,255,.025); color: #b7c8ca; font-size: 9px; font-weight: 700; cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease; }
.control-button:hover { background: rgba(255,255,255,.07); border-color: rgba(170,202,209,.38); color: #fff; }
.control-button:active, .preset-button:active { transform: translateY(1px); }
.control-button:focus-visible, .preset-button:focus-visible, .quality-switch button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary-button { background: var(--accent); border-color: var(--accent); color: #06201f; min-width: 82px; }
.primary-button:hover { background: #7cebdd; border-color: #7cebdd; color: #06201f; }
.button-icon { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.primary-button .button-icon { stroke-width: 2; }
.quality-switch { display: flex; align-items: center; gap: 7px; padding-left: 9px; border-left: 1px solid var(--line); }
.quality-switch span { color: #748a90; font-size: 7px; letter-spacing: .13em; font-weight: 800; }
.quality-switch button { min-width: 42px; height: 25px; border: 1px solid rgba(93,224,207,.28); border-radius: 4px; background: rgba(93,224,207,.08); color: var(--accent); font-size: 8px; letter-spacing: .08em; font-weight: 800; cursor: pointer; }
.control-panel { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #29424b transparent; padding: 16px 15px 12px; }
.panel-heading-row { justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-heading-row h2, .check-heading h2 { margin: 3px 0 0; font-size: 16px; letter-spacing: -.025em; font-weight: 650; }
.panel-index, .unit-note { color: #647c83; font-size: 7px; letter-spacing: .1em; font-weight: 800; white-space: nowrap; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 15px; }
.preset-button { min-width: 0; min-height: 54px; display: flex; align-items: center; gap: 7px; padding: 8px 7px; text-align: left; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.018); cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.preset-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.045); }
.preset-button.active { border-color: rgba(93,224,207,.42); background: rgba(93,224,207,.065); }
.preset-icon { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 5px; background: rgba(255,255,255,.055); color: #a9bdc0; font-size: 14px; }
.active .preset-icon { background: rgba(93,224,207,.12); color: var(--accent); }
.preset-button strong { display: block; color: #d9e4e3; font-size: 9px; font-weight: 700; line-height: 1.25; }
.preset-button small { display: block; margin-top: 3px; color: #82979b; font-size: 7px; line-height: 1.2; }
.preset-arrow { margin-left: auto; align-self: flex-start; color: #627a80; font-size: 10px; }
.slider-stack { display: flex; flex-direction: column; gap: 12px; }
.slider-control { min-width: 0; }
.slider-topline { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.slider-topline label { color: #c7d5d5; font-size: 10px; font-weight: 600; }
.slider-topline label span { color: #82999e; font-size: 9px; font-weight: 500; margin-left: 3px; }
.slider-topline output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; display: block; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(93,224,207,.75), rgba(93,224,207,.22)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(93,224,207,.75), rgba(93,224,207,.22)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #09202a; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(93,224,207,.2); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #09202a; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(93,224,207,.2); }
.slider-foot { display: flex; justify-content: space-between; align-items: center; color: #60777e; font-size: 7px; font-variant-numeric: tabular-nums; }
.slider-foot span:nth-child(2) { color: #617c80; font-size: 6px; letter-spacing: .1em; font-weight: 800; }
.readouts-section { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.compact-heading { margin-bottom: 9px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.metric-card { min-width: 0; min-height: 72px; padding: 9px 10px 8px; border: 1px solid rgba(170,202,209,.1); border-radius: 7px; background: rgba(255,255,255,.022); }
.metric-wide { grid-column: 1 / -1; min-height: 65px; }
.metric-label { color: #7f979b; font-size: 7px; letter-spacing: .105em; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-label span { color: #5f7b80; font-size: 6px; letter-spacing: .07em; margin-left: 3px; }
.metric-value { margin-top: 5px; color: #edf7f4; font-size: 22px; line-height: 1; font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-unit { margin-top: 3px; color: #789096; font-size: 8px; }
.metric-wide .metric-value { display: inline-block; font-size: 19px; margin-right: 7px; }
.metric-wide .metric-unit { display: inline; }
.check-section { margin-top: 15px; padding: 12px 11px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); }
.check-heading { justify-content: space-between; }
.check-heading h2 { font-size: 14px; }
.check-pass { color: var(--accent); font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.check-description { margin: 8px 0 9px; color: #8ca2a6; font-size: 8px; line-height: 1.4; }
.check-values { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.check-values div { display: flex; flex-direction: column; gap: 4px; }
.check-values span { color: #6d858b; font-size: 6px; letter-spacing: .1em; font-weight: 800; }
.check-values strong { color: #dbe8e6; font-size: 12px; font-variant-numeric: tabular-nums; }
.check-values .check-difference { grid-column: 1 / -1; padding-top: 7px; margin-top: 2px; border-top: 1px solid var(--line); flex-direction: row; justify-content: space-between; align-items: center; }
.check-values .check-difference strong { color: var(--accent); }
.check-equation { margin-top: 8px; padding: 7px 8px; border-radius: 5px; background: rgba(93,224,207,.055); color: #a9c5c3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; text-align: center; }
.science-panel { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.015); }
.science-panel summary { min-height: 47px; padding: 8px 11px; display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary strong { display: block; margin-top: 3px; font-size: 13px; font-weight: 650; }
.summary-mark { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent); font-size: 15px; transition: transform .16s ease; }
.science-panel[open] .summary-mark { transform: rotate(45deg); }
.science-content { padding: 0 11px 12px; }
.science-lead { color: #b7c9c8; font-size: 9px; line-height: 1.5; margin: 0 0 10px; }
.equation-list { display: flex; flex-direction: column; gap: 6px; }
.equation-list div { display: flex; justify-content: space-between; gap: 9px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(170,202,209,.07); }
.equation-list span { color: #81979b; font-size: 8px; }
.equation-list code { color: #cde1de; font-size: 8px; text-align: right; white-space: nowrap; }
.assumption-block { margin-top: 11px; }
.assumption-block h3 { margin: 0 0 5px; color: var(--accent); font-size: 8px; letter-spacing: .13em; text-transform: uppercase; }
.assumption-block p { color: #84999e; font-size: 8px; line-height: 1.55; margin: 5px 0; }
.assumption-block strong { color: #c6d8d5; font-weight: 650; }
.disclaimer { padding-top: 8px; margin: 9px 0 0; border-top: 1px solid var(--line); color: #71888e; font-size: 7px; line-height: 1.4; }
.panel-footer { display: flex; justify-content: space-between; gap: 8px; padding: 10px 2px 0; color: #60777e; font-size: 6px; letter-spacing: .1em; font-weight: 800; }

@media (max-width: 980px) and (min-width: 761px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 9px; padding: 9px; }
  .control-panel { padding: 13px 12px 10px; }
  .stage-toolbar { padding-left: 16px; padding-right: 16px; }
  .canvas-legend { gap: 8px; }
  .canvas-legend span { font-size: 6px; }
  .explain-state { display: none; }
}
@media (max-width: 760px) {
  .topbar { height: 52px; flex-basis: 52px; padding: 0 13px; }
  .brand-mark { width: 24px; height: 24px; }
  .brand-kicker { font-size: 8px; }
  .brand-name { font-size: 9px; }
  .topbar-right { gap: 0; }
  .live-indicator { font-size: 7px; letter-spacing: .08em; }
  .topbar-index { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 8px; padding: 8px; overflow: hidden; }
  .stage-panel { flex: 0 0 auto; overflow: hidden; }
  .stage-toolbar { min-height: 64px; flex-basis: 64px; padding: 10px 12px 8px; }
  .stage-heading h1 { font-size: 23px; margin-top: 4px; }
  .stage-heading p { font-size: 9px; }
  .eyebrow { font-size: 7px; }
  .stage-tags { gap: 5px; padding-top: 2px; }
  .outline-tag, .state-tag { padding: 5px 6px; font-size: 6px; }
  .visual-wrap { flex: 0 0 clamp(220px, 34vh, 300px); min-height: 220px; }
  .canvas-corner { top: 10px; font-size: 6px; }
  .canvas-corner-left { left: 10px; }
  .canvas-corner-right { right: 10px; max-width: 45%; }
  .canvas-legend { left: 10px; bottom: 9px; gap: 9px; }
  .canvas-legend span { font-size: 6px; }
  .explain-strip { min-height: 56px; padding: 8px 10px; gap: 8px; }
  .explain-marker { width: 18px; height: 18px; flex-basis: 18px; }
  .explain-label { font-size: 6px; margin-bottom: 2px; }
  .explain-copy p { font-size: 8px; line-height: 1.35; }
  .explain-state { display: none; }
  .transport-bar { min-height: 43px; flex-basis: 43px; padding: 5px 7px; gap: 4px; }
  .transport-main, .transport-tools { gap: 4px; }
  .control-button { height: 29px; padding: 0 7px; gap: 4px; font-size: 8px; }
  .button-icon { width: 12px; height: 12px; }
  .primary-button { min-width: 68px; }
  .screenshot-button { padding: 0 6px; }
  .quality-switch { gap: 4px; padding-left: 5px; }
  .quality-switch span { font-size: 6px; }
  .quality-switch button { min-width: 34px; height: 23px; font-size: 7px; }
  .control-panel { flex: 1 1 auto; overflow-y: auto; padding: 13px 12px 10px; }
  .panel-heading-row { margin-bottom: 10px; }
  .panel-heading-row h2 { font-size: 15px; }
  .preset-button { min-height: 48px; }
  .slider-stack { gap: 10px; }
  .slider-topline label { font-size: 9px; }
  .slider-topline output { font-size: 9px; }
  .readouts-section { margin-top: 14px; padding-top: 12px; }
  .metric-card { min-height: 67px; }
  .check-section { margin-top: 12px; }
}
@media (max-width: 390px) {
  .brand-name { display: none; }
  .live-indicator { font-size: 6px; }
  .stage-heading h1 { font-size: 21px; }
  .stage-heading p { font-size: 8px; }
  .outline-tag { display: none; }
  .transport-bar { padding-left: 5px; padding-right: 5px; }
  .control-button { padding: 0 6px; }
  .screenshot-button { font-size: 0; width: 30px; padding: 0; }
  .screenshot-button .button-icon { width: 14px; height: 14px; }
  .quality-switch span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
