:root {
  color-scheme: dark;
  --bg: #0a141a;
  --panel: #101c22;
  --panel-2: #15242a;
  --line: rgba(153, 177, 178, .15);
  --line-strong: rgba(153, 177, 178, .25);
  --text: #e8efed;
  --muted: #9aadae;
  --subtle: #6d8284;
  --cyan: #84c8c5;
  --mint: #a9dfca;
  --amber: #e6b27b;
  --orange: #e58d62;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 32% 0%, rgba(77, 70, 53, .16), transparent 44%), var(--bg); }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; gap: 14px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(8, 18, 23, .9); position: relative; z-index: 5; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: var(--amber); border: 1px solid rgba(230, 178, 123, .25); border-radius: 10px; background: rgba(230, 178, 123, .06); flex: 0 0 auto; }
.brand-mark svg { width: 28px; height: 28px; }
.brand-copy { min-width: 0; }
.eyebrow, .panel-eyebrow, .stage-kicker { color: var(--amber); font-size: 9px; letter-spacing: .17em; font-weight: 750; }
.eyebrow span { color: #687e80; padding: 0 4px; }
.brand-copy h1 { font-size: 15px; line-height: 1.25; margin: 4px 0 0; font-weight: 620; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-copy h1 span { color: var(--subtle); font-weight: 400; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.field-chip, .status-live { font-size: 9px; letter-spacing: .11em; font-weight: 750; padding: 7px 9px; border-radius: 6px; white-space: nowrap; }
.field-chip { color: #c4d0cc; background: rgba(141, 159, 153, .09); border: 1px solid var(--line); }
.field-chip i { color: var(--amber); font-style: normal; padding: 0 3px; }
.status-live { color: var(--mint); background: rgba(111, 177, 145, .1); border: 1px solid rgba(139, 206, 171, .2); }
.status-live.paused { color: var(--amber); background: rgba(230, 178, 123, .08); border-color: rgba(230, 178, 123, .22); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 0; min-height: 0; flex: 1 1 auto; }
.stage-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 14px 16px 8px 20px; }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; flex: 0 0 48px; padding: 0 2px 9px; }
.stage-kicker { color: #c4b19a; letter-spacing: .13em; }
.stage-subtitle { color: var(--muted); font-size: 11px; margin-top: 5px; }
.stage-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.regime-badge { font-size: 9px; letter-spacing: .12em; font-weight: 800; border-radius: 5px; padding: 5px 8px; }
.regime-badge.hot { color: #f0bd91; background: rgba(229, 141, 98, .12); border: 1px solid rgba(229, 141, 98, .24); }
.regime-badge.cool { color: #9dc9d0; background: rgba(107, 163, 174, .12); border: 1px solid rgba(107, 163, 174, .24); }
.regime-badge.warm { color: #b8dfc9; background: rgba(111, 177, 145, .1); border: 1px solid rgba(111, 177, 145, .22); }
.time-readout { color: var(--subtle); font-size: 9px; font-variant-numeric: tabular-nums; }
.viewport { min-height: 280px; flex: 1 1 auto; position: relative; overflow: hidden; border: 1px solid rgba(156, 166, 150, .2); border-radius: 13px; background: radial-gradient(ellipse at 54% 24%, #3a3530 0%, #20292a 46%, #0a151b 100%); box-shadow: 0 18px 55px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(255,255,255,.015); }
.canvas-host { position: absolute; inset: 0; }
.canvas-host canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.scene-vignette { pointer-events: none; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 10, 13, .2), transparent 22%, transparent 76%, rgba(3, 10, 13, .32)); }
.scene-label { position: absolute; z-index: 2; display: flex; align-items: center; gap: 6px; color: #e4e9e3; font-size: 8px; letter-spacing: .1em; font-weight: 800; text-shadow: 0 2px 8px #071014; pointer-events: none; }
.scene-label small { display: block; position: absolute; top: 14px; left: 13px; color: #b1b8ad; font-size: 8px; letter-spacing: .02em; font-weight: 500; white-space: nowrap; }
.label-dot { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.label-dot.cyan { color: var(--cyan); background: var(--cyan); }
.label-dot.mint { color: var(--mint); background: var(--mint); }
.label-dot.amber { color: var(--amber); background: var(--amber); }
.label-dot.orange { color: var(--orange); background: var(--orange); }
.label-surface { top: 15%; left: 6%; }
.label-columns { top: 25%; left: 44%; }
.label-front { bottom: 25%; left: 48%; }
.label-core { bottom: 13%; right: 7%; }
.heat-direction { position: absolute; z-index: 2; top: 14px; right: 17px; color: #c0b5a6; font-size: 8px; letter-spacing: .1em; text-align: right; pointer-events: none; }
.heat-direction b { color: var(--amber); font-size: 8px; display: block; margin-top: 5px; }
.heat-arrow-line { width: 82px; height: 1px; background: linear-gradient(90deg, transparent, var(--amber)); margin: 6px 0 0 auto; position: relative; }
.heat-arrow-line::after { content: ""; position: absolute; right: 0; top: -3px; border: 4px solid transparent; border-left-color: var(--amber); }
.scene-legend { position: absolute; z-index: 2; left: 15px; bottom: 13px; display: flex; gap: 13px; color: #bdc4ba; font-size: 8px; letter-spacing: .02em; pointer-events: none; }
.scene-legend span { display: flex; align-items: center; gap: 5px; }
.scene-legend i { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
.legend-crust { background: #78817e; }
.legend-core { background: #8a4936; }
.legend-front { background: #e58d62; }
.context-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(3, 9, 12, .74); backdrop-filter: blur(6px); }
.context-overlay[hidden] { display: none; }
.context-card { max-width: 330px; padding: 24px; display: grid; justify-items: center; gap: 9px; text-align: center; border: 1px solid var(--line-strong); border-radius: 12px; background: #111f23; box-shadow: 0 15px 50px #0008; }
.context-icon { font-size: 24px; color: var(--amber); }
.context-card strong { font-size: 14px; }
.context-card span:last-child { font-size: 11px; line-height: 1.5; color: var(--muted); }
.cause-strip { flex: 0 0 64px; display: flex; align-items: center; gap: 12px; margin: 8px 0 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(18, 29, 31, .82); }
.cause-step { display: flex; align-items: center; gap: 8px; min-width: 112px; }
.cause-number { width: 24px; height: 24px; display: grid; place-items: center; color: var(--amber); font-size: 9px; font-weight: 800; border-radius: 7px; background: rgba(230, 178, 123, .09); border: 1px solid rgba(230, 178, 123, .18); }
.cause-step b { display: block; color: #c5d0c9; font-size: 8px; letter-spacing: .13em; }
.cause-step small { display: block; color: var(--muted); font-size: 9px; margin-top: 3px; white-space: nowrap; }
.cause-connector { height: 1px; flex: 1 1 12px; max-width: 36px; background: linear-gradient(90deg, rgba(230,178,123,.38), rgba(230,178,123,.06)); }
.cause-note { margin-left: auto; max-width: 190px; color: #c5b8a8; font-size: 9px; line-height: 1.4; text-align: right; }
.stage-footer { flex: 0 0 23px; display: flex; align-items: end; gap: 15px; color: var(--subtle); font-size: 8px; letter-spacing: .03em; }
.stage-footer kbd { color: #b4c0b8; font: inherit; font-weight: 750; border: 1px solid var(--line-strong); border-radius: 3px; padding: 2px 4px; margin-right: 3px; background: rgba(255,255,255,.025); }
.drag-hint { margin-left: auto; color: #78908f; letter-spacing: .12em; }
.drag-hint i { color: var(--amber); font-style: normal; padding: 0 4px; }
.control-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 24px; border-left: 1px solid var(--line); background: linear-gradient(180deg, rgba(17, 29, 33, .98), rgba(10, 22, 27, .98)); scrollbar-width: thin; scrollbar-color: #34484a transparent; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 13px; border-bottom: 1px solid var(--line); }
.panel-eyebrow { font-size: 8px; letter-spacing: .16em; }
.panel-heading h2 { font-size: 15px; margin: 4px 0 0; font-weight: 640; letter-spacing: -.02em; }
.panel-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px rgba(169,223,202,.48); }
.panel-section { padding: 13px 0 14px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: #c1cbc4; font-size: 8px; letter-spacing: .14em; font-weight: 800; }
.tiny-tag { color: #829492; font-size: 7px; letter-spacing: .12em; border: 1px solid var(--line); padding: 3px 5px; border-radius: 4px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
.preset-button { position: relative; min-width: 0; text-align: left; padding: 8px 7px 7px 27px; border-radius: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.018); cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.preset-button:hover { background: rgba(230,178,123,.06); border-color: rgba(230,178,123,.3); }
.preset-button.active { border-color: rgba(230,178,123,.46); background: rgba(230,178,123,.09); box-shadow: inset 0 0 0 1px rgba(230,178,123,.06); }
.preset-index { position: absolute; top: 9px; left: 8px; color: var(--amber); font-size: 8px; font-weight: 800; }
.preset-button b { display: block; color: #e2e9e3; font-size: 9px; font-weight: 700; white-space: nowrap; }
.preset-button small { display: block; color: var(--muted); font-size: 8px; margin-top: 4px; }
.preset-note { color: #8da09b; font-size: 8px; margin-top: 8px; }
.slider-row { margin: 0 0 10px; }
.slider-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.slider-label label { color: #d0dad3; font-size: 10px; font-weight: 560; }
.slider-label label em { color: #a3b0a8; font-style: normal; font-size: 9px; margin-left: 3px; }
.slider-label output { color: var(--amber); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; width: 100%; height: 4px; display: block; margin: 7px 0 3px; border-radius: 99px; background: linear-gradient(90deg, rgba(230,178,123,.65), rgba(230,178,123,.16)); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #f6d5ad; background: #8e5d3c; box-shadow: 0 0 0 3px rgba(230,178,123,.13); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #f6d5ad; background: #8e5d3c; box-shadow: 0 0 0 3px rgba(230,178,123,.13); }
.range-hints { display: flex; justify-content: space-between; color: #758986; font-size: 7px; }
.compact-row { margin-bottom: 8px; }
.compact-row input[type="range"] { margin-top: 6px; }
.two-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.playback-section { padding-bottom: 12px; }
.playback-buttons { display: grid; grid-template-columns: minmax(0,1fr) repeat(4, 35px); gap: 6px; }
.play-button, .icon-button { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 7px; cursor: pointer; transition: .18s ease; }
.play-button { background: rgba(230,178,123,.13); color: #f0d3b0; border-color: rgba(230,178,123,.32); font-size: 10px; font-weight: 750; }
.play-button:hover { background: rgba(230,178,123,.22); }
.icon-button { background: rgba(255,255,255,.025); color: #c0cbc4; font-size: 15px; }
.icon-button:hover { background: rgba(230,178,123,.08); border-color: rgba(230,178,123,.35); color: #f0d3b0; }
.time-slider { margin-top: 11px; margin-bottom: 8px; }
.quality-row { display: flex; align-items: center; justify-content: space-between; color: #a1b0a9; font-size: 8px; letter-spacing: .11em; font-weight: 800; }
.quality-toggle { display: flex; padding: 2px; gap: 2px; background: rgba(0,0,0,.18); border: 1px solid var(--line); border-radius: 6px; }
.quality-toggle button { border: 0; background: transparent; color: #81918b; border-radius: 4px; padding: 4px 8px; font-size: 7px; font-weight: 800; letter-spacing: .08em; cursor: pointer; }
.quality-toggle button.active { color: #f3d4b0; background: rgba(230,178,123,.15); }
.quality-note, .export-status { color: #81938c; font-size: 8px; margin-top: 6px; }
.export-status { color: #657d78; margin-top: 4px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.metric-card { min-width: 0; padding: 9px 9px 8px; border-radius: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.022); }
.metric-card.metric-primary { background: linear-gradient(135deg, rgba(230,178,123,.105), rgba(230,178,123,.025)); border-color: rgba(230,178,123,.2); }
.metric-name { display: block; color: #93a39b; font-size: 7px; letter-spacing: .12em; font-weight: 800; }
.metric-card strong { display: block; margin-top: 5px; color: #e7eee8; font-size: 19px; line-height: 1.1; font-weight: 620; letter-spacing: -.035em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-primary strong { color: #f0c18f; font-size: 22px; }
.metric-card small { display: block; color: #728680; font-size: 7px; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-wide { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.metric-wide .metric-name { min-width: 120px; }
.metric-wide strong { font-size: 14px; margin: 0; }
.metric-wide small { margin: 0 0 0 auto; }
.validation-section { padding-bottom: 13px; }
.verified-tag { color: var(--mint); border-color: rgba(169,223,202,.18); }
.validation-title { color: #d0d9d2; font-size: 9px; font-weight: 650; margin: 1px 0 9px; }
.validation-title span { margin-left: 5px; color: #a7d5c0; font-size: 7px; letter-spacing: .1em; }
.validation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.validation-grid > div { padding: 7px 8px; border-radius: 6px; background: rgba(255,255,255,.025); border: 1px solid var(--line); }
.validation-grid small { display: block; color: #84978e; font-size: 7px; letter-spacing: .06em; }
.validation-grid b { display: block; margin-top: 4px; color: #e0e9e2; font-size: 12px; font-variant-numeric: tabular-nums; }
.validation-diff { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.validation-diff b { color: var(--mint); margin: 0; }
.validation-formula { color: #a6b8af; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; text-align: center; margin-top: 8px; }
.science-panel { border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); margin-top: 12px; overflow: hidden; }
.science-panel summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 11px 10px; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: rgba(230,178,123,.1); color: var(--amber); font-size: 15px; }
.science-panel summary b { display: block; font-size: 10px; color: #e0e8e1; }
.science-panel summary small { display: block; font-size: 8px; color: #8b9e95; margin-top: 3px; }
.chevron { margin-left: auto; color: #90a19a; font-size: 17px; transition: transform .2s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 11px 12px; border-top: 1px solid var(--line); }
.science-block { padding-top: 11px; }
.science-block h3 { color: #d1c0a9; font-size: 9px; letter-spacing: .08em; margin: 0 0 6px; text-transform: uppercase; }
.science-block p, .science-block li { color: #9eaea5; font-size: 9px; line-height: 1.55; margin: 0; }
.science-block b { color: #e0e9e2; }
.science-block code { display: block; color: #c7e3d4; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.045); border-radius: 5px; padding: 6px 7px; margin: 5px 0; white-space: normal; overflow-wrap: anywhere; font-size: 8px; }
.science-block ul { margin: 0; padding-left: 15px; }
.science-block li { margin: 3px 0; }
.science-footnote { color: #81958d; font-size: 8px; line-height: 1.5; border-top: 1px solid var(--line); margin-top: 11px; padding-top: 9px; }
.app-footer { flex: 0 0 22px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: #637b76; border-top: 1px solid rgba(153,177,178,.08); font-size: 7px; letter-spacing: .13em; }
.app-footer i { color: var(--amber); font-style: normal; padding: 0 3px; }
body.embed .topbar, body.embed .control-panel, body.embed .app-footer { display: none; }
body.embed .workspace { display: block; }
body.embed .stage-column { height: 100vh; padding: 0; }
body.embed .stage-head, body.embed .cause-strip, body.embed .stage-footer { display: none; }
body.embed .viewport { border: 0; border-radius: 0; height: 100%; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 350px; }
  .control-panel { padding-left: 13px; padding-right: 13px; }
  .stage-column { padding-left: 14px; padding-right: 12px; }
  .cause-note { max-width: 150px; }
  .cause-step { min-width: 100px; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { min-height: 100vh; }
  .workspace { display: flex; flex-direction: column; }
  .stage-column { min-height: 690px; padding: 12px 12px 7px; }
  .viewport { min-height: 420px; }
  .control-panel { overflow: visible; border-left: 0; border-top: 1px solid var(--line); padding: 16px 16px 28px; }
  .panel-section { padding-top: 14px; padding-bottom: 14px; }
  .metric-card strong { font-size: 21px; }
  .app-footer { min-height: 26px; }
}
@media (max-width: 560px) {
  .topbar { height: 60px; flex-basis: 60px; padding: 0 12px; gap: 9px; }
  .brand-mark { width: 33px; height: 33px; }
  .brand-mark svg { width: 25px; height: 25px; }
  .eyebrow { font-size: 7px; }
  .brand-copy h1 { max-width: 205px; font-size: 12px; }
  .topbar-right { gap: 5px; }
  .field-chip { display: none; }
  .status-live { font-size: 7px; padding: 6px; }
  .stage-column { min-height: 635px; padding: 10px 9px 6px; }
  .stage-head { min-height: 54px; flex-basis: 54px; gap: 8px; }
  .stage-kicker { font-size: 8px; }
  .stage-subtitle { max-width: 205px; font-size: 9px; line-height: 1.35; }
  .regime-badge { font-size: 7px; padding: 4px 6px; }
  .time-readout { font-size: 8px; }
  .viewport { min-height: 360px; }
  .scene-label { font-size: 7px; }
  .scene-label small { font-size: 7px; }
  .label-columns { left: 38%; top: 22%; }
  .label-front { left: 43%; bottom: 26%; }
  .label-core { bottom: 12%; right: 4%; }
  .heat-direction { top: 11px; right: 10px; font-size: 7px; }
  .heat-arrow-line { width: 58px; }
  .scene-legend { left: 9px; bottom: 9px; gap: 8px; font-size: 7px; }
  .cause-strip { flex-wrap: wrap; gap: 6px; padding: 8px; flex-basis: auto; min-height: 70px; }
  .cause-step { min-width: 0; flex: 1 1 28%; gap: 5px; }
  .cause-number { width: 20px; height: 20px; font-size: 8px; }
  .cause-step b { font-size: 7px; }
  .cause-step small { font-size: 7px; white-space: normal; }
  .cause-connector { display: none; }
  .cause-note { width: 100%; max-width: none; text-align: left; margin: 0 0 0 26px; font-size: 8px; }
  .stage-footer { flex-wrap: wrap; gap: 7px 11px; min-height: 28px; height: auto; align-items: center; font-size: 7px; }
  .drag-hint { display: none; }
  .control-panel { padding: 15px 12px 24px; }
  .preset-button { padding-left: 24px; }
  .preset-button b { font-size: 8px; }
  .two-sliders { gap: 10px; }
  .metric-card { padding: 9px 8px; }
  .metric-card strong { font-size: 19px; }
  .metric-primary strong { font-size: 22px; }
  .metric-wide strong { font-size: 13px; }
  .metric-wide small { flex-basis: 100%; margin-left: 0; }
  .app-footer { padding: 0 10px; font-size: 6px; letter-spacing: .07em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
