:root {
  color-scheme: dark;
  --bg: #0b100e;
  --panel: #111815;
  --panel-2: #151e19;
  --panel-3: #0e1512;
  --line: rgba(190, 216, 198, .105);
  --line-strong: rgba(190, 216, 198, .17);
  --text: #e8efe9;
  --muted: #87968c;
  --dim: #58675d;
  --accent: #b7f36e;
  --accent-2: #91d44f;
  --accent-wash: rgba(183, 243, 110, .11);
  --radius: 16px;
  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%; min-width: 320px; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, canvas:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 30% 5%, rgba(64, 93, 65, .11), transparent 42%), var(--bg); }
.topbar { height: 68px; flex: 0 0 68px; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(11, 16, 14, .92); position: relative; z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 3px; padding: 5px; border: 1px solid rgba(183,243,110,.25); border-radius: 10px; background: rgba(183,243,110,.055); transform: rotate(-8deg); }
.brand-mark span { background: var(--accent); border-radius: 2px; opacity: .82; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(4), .brand-mark span:nth-child(8) { opacity: .38; }
.brand-mark span:nth-child(3), .brand-mark span:nth-child(6) { opacity: .6; }
.brand-copy { min-width: 0; }
.eyebrow, .section-kicker { color: #91a096; font-size: 9px; font-weight: 750; letter-spacing: .16em; line-height: 1.3; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.eyebrow-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(183,243,110,.6); }
h1 { margin: 0; font-size: 19px; line-height: 1.1; font-weight: 660; letter-spacing: -.045em; }
h1 span { color: var(--accent); font-weight: 550; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: #a6b4a9; font-size: 9px; letter-spacing: .13em; font-weight: 750; }
.live-pulse, .mini-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(183,243,110,.10), 0 0 10px rgba(183,243,110,.45); }
.icon-button { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: #121a15; color: #c4d0c6; cursor: pointer; font-size: 11px; font-weight: 650; transition: border-color .2s, background .2s, transform .2s; }
.icon-button:hover { border-color: rgba(183,243,110,.45); background: #19231b; transform: translateY(-1px); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 365px; gap: 14px; padding: 14px 16px 16px; max-width: 1680px; width: 100%; margin: 0 auto; }
.visual-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) 188px; gap: 12px; }
.stage-card, .chart-card, .control-card, .metrics-card, .science-card { background: linear-gradient(145deg, rgba(20,29,24,.98), rgba(15,22,18,.98)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.13); }
.stage-card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.stage-head { flex: 0 0 58px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.stage-title { font-size: 14px; font-weight: 620; letter-spacing: -.025em; margin-top: 3px; }
.stage-meta { display: flex; align-items: center; gap: 10px; color: #91a096; font-size: 10px; white-space: nowrap; }
.threshold-chip { padding: 5px 8px; border: 1px solid rgba(183,243,110,.22); background: rgba(183,243,110,.06); border-radius: 6px; color: #a7b99e; font-size: 8px; font-weight: 750; letter-spacing: .11em; }
.threshold-chip b { color: var(--accent); font-size: 10px; margin-left: 3px; }
.stage-meta-sep { height: 14px; width: 1px; background: var(--line-strong); }
.canvas-wrap { flex: 1; min-height: 160px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 45%, rgba(44,66,46,.23), rgba(10,16,13,.96) 70%), #0c120f; }
#pileCanvas { width: 100%; height: 100%; display: block; touch-action: manipulation; cursor: crosshair; }
.canvas-overlay { position: absolute; pointer-events: none; }
.top-left { left: 17px; top: 15px; display: flex; flex-direction: column; gap: 8px; }
.overlay-label { color: #7f9084; font-size: 8px; font-weight: 750; letter-spacing: .16em; }
.height-legend { display: flex; align-items: center; gap: 9px; color: #9eaea2; font-size: 9px; }
.height-legend span { display: inline-flex; align-items: center; gap: 4px; }
.height-swatch { width: 8px; height: 8px; display: inline-block; border-radius: 2px; border: 1px solid rgba(255,255,255,.08); }
.h0 { background: #1a2820; } .h1 { background: #405b39; } .h2 { background: #7eaa4c; } .h3 { background: #c0ee7b; }
.bottom-left { left: 17px; bottom: 14px; }
.pointer-hint { color: #718076; font-size: 8px; letter-spacing: .035em; }
kbd { color: #a6b5a8; border: 1px solid rgba(190,216,198,.18); border-radius: 3px; padding: 2px 4px; font: 700 7px ui-monospace, SFMono-Regular, Consolas, monospace; }
.hint-divider { color: #526157; padding: 0 4px; }
.bottom-right { right: 15px; bottom: 14px; display: flex; align-items: center; gap: 7px; color: #8fa08f; font-size: 8px; font-weight: 750; letter-spacing: .12em; }
.bottom-right .mini-pulse { width: 5px; height: 5px; }
.stage-foot { flex: 0 0 auto; min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 9px 19px; border-top: 1px solid var(--line); background: rgba(8,13,10,.38); }
.stage-caption-mark { flex: 0 0 3px; height: 23px; border-radius: 4px; background: var(--accent); opacity: .85; }
.stage-foot p { margin: 0; color: #aab8ad; font-size: 10px; line-height: 1.45; }
.chart-card { min-height: 0; padding: 12px 17px 9px; display: flex; flex-direction: column; overflow: hidden; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex: 0 0 auto; }
.chart-title { margin-top: 3px; font-size: 13px; font-weight: 650; letter-spacing: -.025em; }
.chart-scale { display: inline-block; margin-left: 6px; color: #748478; font-size: 7px; font-weight: 750; letter-spacing: .13em; vertical-align: 2px; }
.chart-legend { display: flex; align-items: center; gap: 6px; color: #7f9084; font-size: 8px; white-space: nowrap; }
.legend-line { display: inline-block; width: 15px; height: 2px; background: var(--accent); border-radius: 3px; margin-left: 5px; }
.legend-marker { display: inline-block; width: 7px; height: 7px; border: 1px solid var(--accent); background: rgba(183,243,110,.14); border-radius: 50%; margin-left: 8px; }
.chart-wrap { flex: 1; min-height: 65px; margin-top: 5px; }
#distributionCanvas { width: 100%; height: 100%; display: block; }
.chart-foot { display: flex; justify-content: space-between; color: #617166; font-size: 7px; font-weight: 750; letter-spacing: .12em; margin-top: 2px; }
.control-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2d3b30 transparent; padding-right: 1px; }
.control-card { padding: 16px 16px 12px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.045em; font-weight: 640; }
.control-glyph { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(183,243,110,.18); border-radius: 8px; color: var(--accent); background: rgba(183,243,110,.06); font-size: 15px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 16px; }
.preset-button { min-width: 0; min-height: 50px; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: #101712; text-align: left; cursor: pointer; transition: .2s ease; }
.preset-button:hover { border-color: rgba(183,243,110,.32); background: #162019; }
.preset-button.selected { border-color: rgba(183,243,110,.42); background: linear-gradient(120deg, rgba(183,243,110,.10), rgba(183,243,110,.035)); box-shadow: inset 0 0 0 1px rgba(183,243,110,.04); }
.preset-icon { flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: rgba(183,243,110,.09); font-size: 15px; }
.leaky-icon { color: #c3d49c; background: rgba(169,190,124,.09); }
.preset-button b { display: block; color: #dce7dd; font-size: 9px; font-weight: 700; }
.preset-button small { display: block; margin-top: 3px; color: #819085; font-size: 7px; }
.slider-stack { display: flex; flex-direction: column; gap: 5px; }
.control-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 1px; }
.control-label-row label { color: #c8d3ca; font-size: 10px; font-weight: 620; }
.control-label-row output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.range-input { width: 100%; height: 14px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
.range-input::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) 0%, rgba(183,243,110,.32) 100%); }
.range-input::-moz-range-track { height: 3px; border-radius: 4px; background: rgba(183,243,110,.3); }
.range-input::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #23311e; box-shadow: 0 0 0 2px rgba(183,243,110,.16); margin-top: -4.5px; }
.range-input::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid #23311e; box-shadow: 0 0 0 2px rgba(183,243,110,.16); }
.range-scale { display: flex; justify-content: space-between; margin-top: -3px; margin-bottom: 5px; color: #68776c; font-size: 7px; }
.action-row { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 7px; margin-top: 10px; }
.action-button, .reset-button { height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; cursor: pointer; transition: .18s ease; }
.action-button { padding: 0 9px; font-size: 9px; font-weight: 700; }
.action-button svg, .reset-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary-action { border: 1px solid rgba(183,243,110,.42); color: #172012; background: var(--accent); }
.primary-action:hover { background: #c7ff83; transform: translateY(-1px); }
.secondary-action { border: 1px solid var(--line-strong); color: #c6d1c8; background: #19221b; }
.secondary-action:hover, .reset-button:hover { border-color: rgba(183,243,110,.38); color: var(--accent); background: #1c281e; }
.reset-button { border: 1px solid var(--line-strong); color: #a9b6ab; background: #141d17; }
.quality-row { display: flex; justify-content: space-between; align-items: center; padding-top: 11px; margin-top: 10px; border-top: 1px solid var(--line); color: #78877c; font-size: 7px; font-weight: 750; letter-spacing: .14em; }
.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: #0c130f; gap: 2px; }
.segmented button { min-width: 39px; padding: 4px 7px; border: 0; border-radius: 4px; color: #839087; background: transparent; font-size: 8px; cursor: pointer; }
.segmented button.active { color: #192216; background: var(--accent); font-weight: 750; }
.metrics-card { padding: 13px 15px 10px; }
.metrics-head { display: flex; justify-content: space-between; align-items: center; }
.metrics-live { display: flex; align-items: center; gap: 5px; color: #78887c; font-size: 7px; font-weight: 750; letter-spacing: .1em; }
.metrics-live i { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 7px rgba(183,243,110,.4); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 12px 0 10px; }
.metric { min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 6px; }
.metric-name { color: #8c9b90; font-size: 8px; }
.metric strong { color: #e5eee6; font-size: 17px; font-weight: 630; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric small { grid-column: 1 / -1; margin-top: 1px; color: #647368; font-size: 7px; }
.audit-row { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid rgba(183,243,110,.13); border-radius: 8px; background: rgba(183,243,110,.045); }
.audit-icon { width: 19px; height: 19px; flex: 0 0 19px; display: grid; place-items: center; border-radius: 50%; background: rgba(183,243,110,.12); color: var(--accent); font-size: 11px; font-weight: 800; }
.audit-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.audit-copy b { color: #c9d7c8; font-size: 8px; }
.audit-tag { color: #8fa57e; font-size: 6px; letter-spacing: .09em; margin-left: 4px; }
.audit-copy span { color: #819083; font-size: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-percent { color: var(--accent); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.loss-strip { display: flex; justify-content: space-between; gap: 5px; padding-top: 9px; color: #78877d; font-size: 7px; }
.loss-strip b { display: block; margin-top: 3px; color: #b7c5b8; font-size: 9px; font-weight: 650; }
.science-card { overflow: hidden; }
.science-card summary { list-style: none; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.science-card summary::-webkit-details-marker { display: none; }
.science-card summary > span:first-child { display: flex; flex-direction: column; gap: 3px; }
.science-card summary b { font-size: 11px; font-weight: 650; }
.details-chevron { color: var(--accent); font-size: 17px; transition: transform .2s; }
.science-card[open] .details-chevron { transform: rotate(180deg); }
.science-content { padding: 0 14px 13px; color: #93a196; font-size: 8px; line-height: 1.55; }
.science-content p { margin: 8px 0; }
.science-intro { color: #b2c0b4; }
.equation-block { display: flex; flex-direction: column; gap: 4px; padding: 8px 9px; margin: 7px 0; border: 1px solid var(--line); border-radius: 7px; background: rgba(5,10,7,.3); }
.equation-label { color: #7f9083; font-size: 6px; font-weight: 750; letter-spacing: .14em; }
.equation-block code { color: #c8e8a7; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.model-disclaimer { padding-top: 7px; border-top: 1px solid var(--line); color: #7c8b80; font-style: italic; }
.footer-note { display: flex; justify-content: space-between; gap: 6px; padding: 0 4px 2px; color: #4e5d52; font-size: 6px; font-weight: 750; letter-spacing: .12em; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1fr) 390px; padding-left: 22px; padding-right: 22px; } .visual-column { grid-template-rows: minmax(0,1fr) 205px; } }
@media (max-width: 900px) and (min-width: 601px) { .workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 10px; padding: 10px; } .topbar { padding: 0 16px; } .visual-column { grid-template-rows: minmax(0,1fr) 170px; } .control-card { padding: 13px 12px 10px; } .stage-head { padding: 0 14px; } }
@media (max-width: 600px) {
  html, body { min-width: 320px; }
  body { overflow: hidden; }
  .app-shell { height: 100vh; height: 100dvh; }
  .topbar { height: 58px; flex-basis: 58px; padding: 0 12px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 29px; height: 29px; padding: 4px; gap: 2px; }
  .eyebrow { font-size: 7px; letter-spacing: .12em; margin-bottom: 2px; }
  h1 { font-size: 16px; }
  .topbar-right { gap: 8px; }
  .live-indicator { font-size: 7px; gap: 5px; }
  .icon-button { width: 31px; height: 31px; padding: 0; justify-content: center; }
  .icon-button span { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 9px; padding: 9px 9px 10px; overflow: hidden; }
  .visual-column { flex: 0 0 48%; min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) 112px; gap: 8px; }
  .stage-card { min-height: 0; }
  .stage-head { flex-basis: 43px; padding: 0 11px; }
  .stage-head .section-kicker { font-size: 7px; }
  .stage-title { font-size: 11px; margin-top: 2px; }
  .stage-meta { font-size: 8px; gap: 6px; }
  .threshold-chip { padding: 4px 6px; font-size: 6px; }
  .threshold-chip b { font-size: 8px; }
  .stage-meta-sep { height: 11px; }
  .canvas-wrap { min-height: 80px; }
  .top-left { top: 9px; left: 9px; gap: 5px; }
  .overlay-label { font-size: 6px; }
  .height-legend { gap: 6px; font-size: 7px; }
  .height-swatch { width: 6px; height: 6px; }
  .bottom-left { left: 9px; bottom: 8px; }
  .pointer-hint { font-size: 6px; }
  kbd { font-size: 5px; padding: 1px 3px; }
  .bottom-right { right: 8px; bottom: 8px; font-size: 6px; gap: 5px; }
  .stage-foot { min-height: 34px; padding: 6px 10px; gap: 7px; }
  .stage-caption-mark { height: 18px; }
  .stage-foot p { font-size: 8px; line-height: 1.3; }
  .chart-card { padding: 8px 10px 6px; }
  .chart-head .section-kicker { font-size: 6px; }
  .chart-title { font-size: 10px; margin-top: 2px; }
  .chart-scale { font-size: 6px; }
  .chart-legend { font-size: 6px; gap: 4px; }
  .legend-line { width: 10px; }
  .chart-wrap { min-height: 38px; margin-top: 2px; }
  .chart-foot { font-size: 5px; margin-top: 1px; }
  .control-column { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; gap: 8px; padding-right: 0; }
  .control-card { padding: 11px 12px 9px; }
  .panel-heading { margin-bottom: 8px; }
  .panel-heading .section-kicker { font-size: 7px; }
  .panel-heading h2 { font-size: 15px; margin-top: 2px; }
  .control-glyph { width: 23px; height: 23px; font-size: 12px; }
  .preset-row { margin-bottom: 10px; gap: 6px; }
  .preset-button { min-height: 41px; padding: 5px 7px; gap: 6px; }
  .preset-icon { width: 22px; height: 22px; flex-basis: 22px; font-size: 12px; }
  .preset-button b { font-size: 8px; }
  .preset-button small { font-size: 6px; margin-top: 2px; }
  .slider-stack { gap: 3px; }
  .control-label-row label, .control-label-row output { font-size: 8px; }
  .range-input { height: 11px; }
  .range-input::-webkit-slider-thumb { width: 10px; height: 10px; margin-top: -3.5px; }
  .range-input::-moz-range-thumb { width: 8px; height: 8px; }
  .range-scale { font-size: 6px; margin-bottom: 2px; }
  .action-row { margin-top: 6px; grid-template-columns: 1fr 1fr 32px; gap: 6px; }
  .action-button, .reset-button { height: 31px; }
  .action-button { font-size: 8px; }
  .action-button svg, .reset-button svg { width: 13px; height: 13px; }
  .quality-row { padding-top: 7px; margin-top: 7px; font-size: 6px; }
  .segmented button { min-width: 32px; padding: 3px 5px; font-size: 7px; }
  .metrics-card { padding: 10px 12px 8px; }
  .metrics-head .section-kicker { font-size: 7px; }
  .metric-grid { gap: 8px 12px; padding: 9px 0 8px; }
  .metric-name { font-size: 7px; }
  .metric strong { font-size: 14px; }
  .metric small { font-size: 6px; }
  .audit-row { padding: 6px 7px; gap: 6px; }
  .audit-icon { width: 16px; height: 16px; flex-basis: 16px; font-size: 9px; }
  .audit-copy b { font-size: 7px; }
  .audit-copy span { font-size: 6px; }
  .audit-tag { font-size: 5px; }
  .audit-percent { font-size: 9px; }
  .loss-strip { padding-top: 7px; font-size: 6px; }
  .loss-strip b { font-size: 8px; }
  .science-card summary { padding: 9px 12px; }
  .science-card summary .section-kicker { font-size: 6px; }
  .science-card summary b { font-size: 9px; }
  .science-content { font-size: 7px; padding: 0 12px 10px; }
  .equation-block code { font-size: 9px; }
  .footer-note { font-size: 5px; padding-bottom: 4px; }
}
@media (max-width: 380px) {
  .visual-column { flex-basis: 46%; grid-template-rows: minmax(0,1fr) 100px; }
  .stage-meta { font-size: 7px; }
  .pointer-hint { letter-spacing: 0; }
  .bottom-right { font-size: 5px; }
  .chart-legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
.threshold-chip i { margin-left: 3px; color: #8fa77c; font-style: normal; font-size: 6px; letter-spacing: .08em; }
.overlay-note { color: #607365; font-size: 6px; letter-spacing: .10em; margin-left: 3px; }
.value-origin { color: #637466; font-size: 6px; font-weight: 750; letter-spacing: .09em; margin-left: 3px; }
@media (max-width: 600px) { .threshold-chip i { font-size: 5px; } .value-origin { font-size: 5px; } }
.control-column > * { flex-shrink: 0; }
