:root {
  color-scheme: dark;
  --bg: #07131c;
  --panel: #0b1b25;
  --panel-2: #0e202b;
  --line: rgba(145, 184, 201, .13);
  --line-strong: rgba(145, 184, 201, .24);
  --text: #e5f0f3;
  --muted: #91a8b3;
  --dim: #5c7480;
  --cyan: #6de2df;
  --cyan-soft: #2c9da4;
  --sand: #d9b47b;
  --amber: #e4b66c;
  --green: #78d9bd;
  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 { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 18% 0%, rgba(34,91,103,.15), transparent 40%), var(--bg); }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(6,17,25,.9); }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 31px; height: 31px; border: 1px solid rgba(109,226,223,.38); border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 3px; transform: rotate(-8deg); background: rgba(32,117,126,.12); }
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--cyan); transform: skewY(-26deg); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .72; }
.brand-name { font-size: 11px; font-weight: 800; letter-spacing: .15em; color: #d7e7eb; }
.brand-name span { color: var(--cyan); margin: 0 4px; }
.brand-sub { margin-top: 4px; font-size: 9px; color: var(--dim); letter-spacing: .16em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.live-indicator { display: flex; align-items: center; gap: 8px; margin-right: 9px; color: #8ca9b3; font-size: 9px; letter-spacing: .14em; }
.live-indicator i, .live-mini i, .clock-dot, .chip-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 11px rgba(120,217,189,.65); }
.icon-button { height: 34px; min-width: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.025); color: #b6cbd2; font-size: 12px; cursor: pointer; transition: .2s ease; }
.icon-button:hover, .transport-button:hover { border-color: rgba(109,226,223,.5); color: var(--cyan); background: rgba(109,226,223,.06); }
.export-button { display: flex; align-items: center; gap: 7px; color: var(--cyan); border-color: rgba(109,226,223,.35); }
.export-button span { font-size: 9px; letter-spacing: .1em; font-weight: 800; }
.workspace { width: 100%; max-width: 1920px; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 14px; padding: 14px; margin: 0 auto; min-height: 0; }
.stage-column { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stage-frame { position: relative; flex: 1; min-height: 400px; overflow: hidden; border: 1px solid rgba(126,174,192,.2); border-radius: 12px; background: radial-gradient(ellipse at 50% 52%, #142b36 0%, #091923 64%, #07131c 100%); box-shadow: 0 18px 60px rgba(0,0,0,.22), inset 0 0 80px rgba(64,142,155,.05); }
.scene-host { position: absolute; inset: 0; z-index: 1; }
.scene-host canvas { display: block; width: 100%; height: 100%; outline: none; }
.stage-vignette { position: absolute; z-index: 2; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(4,14,21,.66) 0%, transparent 22%, transparent 69%, rgba(4,14,21,.62) 100%), linear-gradient(90deg, rgba(4,14,21,.32), transparent 24%, transparent 76%, rgba(4,14,21,.16)); }
.stage-topline { position: absolute; z-index: 3; top: 17px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.phenomenon-chip, .scale-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 27px; padding: 0 10px; border: 1px solid rgba(150,190,205,.2); border-radius: 5px; background: rgba(5,17,25,.68); backdrop-filter: blur(10px); color: #a9c0c9; font-size: 9px; letter-spacing: .13em; font-weight: 700; }
.phenomenon-chip .chip-dot { background: var(--cyan); box-shadow: 0 0 10px rgba(109,226,223,.7); }
.scale-chip { color: #7d9aa6; }
.scale-chip b { color: var(--cyan); font-size: 11px; }
.scale-chip span { color: #607984; }
.stage-title-block { position: absolute; z-index: 3; left: 23px; top: 82px; pointer-events: none; text-shadow: 0 2px 22px rgba(0,0,0,.4); }
.eyebrow { font-size: 9px; font-weight: 800; letter-spacing: .17em; color: #76b9bc; }
.stage-title-block h1 { margin: 9px 0 2px; font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -.045em; font-weight: 620; color: #f0f7f8; }
.stage-title-block p { margin: 8px 0 0; font-size: 13px; color: #a8c0c8; letter-spacing: .015em; }
.stage-annotation { position: absolute; z-index: 3; display: flex; flex-direction: column; gap: 3px; padding: 7px 10px; border: 1px solid rgba(124,190,196,.22); border-radius: 5px; background: rgba(6,20,28,.68); backdrop-filter: blur(7px); pointer-events: none; }
.stage-annotation b { color: #d0e7e8; font-size: 8px; letter-spacing: .12em; }
.stage-annotation small { color: #78939e; font-size: 9px; }
.annotation-bed { right: 23%; top: 46%; }
.annotation-water { right: 8%; top: 27%; }
.annotation-line { position: absolute; width: 22px; height: 1px; background: var(--cyan); left: -22px; top: 16px; opacity: .7; }
.annotation-water .annotation-line { background: #4cb8d0; }
.flow-direction { position: absolute; z-index: 3; left: 23px; bottom: 63px; display: flex; align-items: center; gap: 7px; color: var(--cyan); font-size: 9px; letter-spacing: .14em; font-weight: 800; }
.flow-direction .flow-arrow { font-size: 23px; line-height: 10px; }
.flow-direction small { color: #72929e; font-size: 8px; letter-spacing: .12em; }
.stage-legend { position: absolute; z-index: 3; right: 18px; bottom: 20px; display: flex; gap: 13px; color: #819aa4; font-size: 8px; letter-spacing: .1em; }
.stage-legend span { display: flex; align-items: center; gap: 5px; }
.stage-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.legend-water { background: #5bcbd1; box-shadow: 0 0 8px rgba(91,203,209,.55); }
.legend-bed { background: #b88a5c; }
.legend-grain { background: #e5c38d; border-radius: 50% !important; }
.stage-clock { position: absolute; z-index: 3; left: 23px; bottom: 22px; display: flex; align-items: center; gap: 7px; color: #7f9aa5; font-size: 8px; letter-spacing: .12em; }
.clock-dot { width: 5px; height: 5px; background: var(--cyan); }
.engine-error { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; background: rgba(5,15,22,.96); text-align: center; }
.engine-error[hidden], .context-loss[hidden] { display: none; }
.error-icon { width: 40px; height: 40px; border: 1px solid rgba(228,182,108,.5); border-radius: 50%; display: grid; place-items: center; color: var(--amber); font-size: 20px; }
.engine-error h2 { margin: 15px 0 7px; font-size: 18px; }
.engine-error p { max-width: 470px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.engine-error code { color: var(--cyan); }
.context-loss { position: absolute; z-index: 9; top: 50%; left: 50%; transform: translate(-50%,-50%); padding: 12px 16px; border: 1px solid rgba(228,182,108,.4); border-radius: 8px; background: rgba(5,17,25,.92); color: #e4c28d; font-size: 11px; }
.transport-bar { min-height: 58px; display: flex; align-items: center; gap: 20px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(11,27,37,.88); }
.transport-main { display: flex; align-items: center; gap: 7px; }
.play-button { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px; border: 1px solid rgba(109,226,223,.4); border-radius: 6px; background: rgba(55,151,156,.14); color: var(--cyan); font-size: 9px; font-weight: 800; letter-spacing: .1em; cursor: pointer; }
.play-button:hover { background: rgba(55,151,156,.24); }
.play-icon { font-size: 13px; }
.transport-button { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: #a5bac2; font-size: 9px; letter-spacing: .08em; cursor: pointer; }
.transport-button b { color: #6d8b97; font-size: 8px; }
.speed-control { flex: 1; min-width: 120px; display: grid; grid-template-columns: auto minmax(60px,1fr) 42px; align-items: center; gap: 9px; }
.speed-control label { color: #78929d; font-size: 8px; letter-spacing: .12em; white-space: nowrap; }
.speed-control output { color: var(--cyan); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
input[type="range"] { width: 100%; height: 3px; margin: 8px 0; border-radius: 10px; background: linear-gradient(90deg, #3da7a9, #24404d); accent-color: var(--cyan); cursor: pointer; appearance: none; -webkit-appearance: none; }
input[type="range"]::-webkit-slider-thumb { width: 11px; height: 11px; border: 2px solid #07131c; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 1px rgba(109,226,223,.5), 0 0 8px rgba(109,226,223,.3); appearance: none; -webkit-appearance: none; }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #07131c; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 1px rgba(109,226,223,.5); }
.transport-hint { display: flex; align-items: center; gap: 6px; color: #617b86; font-size: 8px; letter-spacing: .08em; white-space: nowrap; }
kbd { padding: 2px 4px; border: 1px solid rgba(125,159,173,.2); border-radius: 3px; color: #91aab4; font-size: 8px; }
.transport-hint span { color: #38515d; }
.cause-strip { display: grid; grid-template-columns: 1fr 22px 1fr 22px 1fr; align-items: center; min-height: 76px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(110deg, rgba(15,39,49,.92), rgba(9,25,35,.88)); }
.cause-step { display: flex; flex-direction: column; gap: 4px; }
.cause-step span { color: #668c97; font-size: 8px; letter-spacing: .14em; }
.cause-step b { color: #d0e3e6; font-size: 11px; font-weight: 650; }
.cause-step small { color: #7d969f; font-size: 9px; }
.cause-chevron { color: #3c8288; text-align: center; font-size: 17px; }
.control-panel { max-height: calc(100vh - 100px); min-height: 0; overflow: auto; padding: 17px 17px 14px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(180deg, rgba(13,31,42,.98), rgba(8,23,32,.98)); scrollbar-width: thin; scrollbar-color: #254552 transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #244451; border-radius: 5px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 19px; font-weight: 620; letter-spacing: -.025em; }
.preset-count { color: #6f8a95; font-size: 8px; letter-spacing: .13em; }
.preset-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin-bottom: 12px; }
.preset-button { min-height: 39px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.018); color: #829ca7; font-size: 9px; cursor: pointer; transition: .18s ease; }
.preset-button span { display: block; margin-bottom: 3px; color: #526f7b; font-size: 7px; letter-spacing: .12em; }
.preset-button.active, .preset-button:hover { border-color: rgba(109,226,223,.4); background: rgba(54,139,145,.12); color: #c5e5e5; }
.preset-button.active span { color: var(--cyan); }
.regime-banner { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 17px; padding: 8px 10px; border: 1px solid rgba(109,226,223,.18); border-radius: 6px; background: rgba(44,131,135,.09); overflow: hidden; }
.regime-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 5px; background: rgba(109,226,223,.1); color: var(--cyan); font-size: 18px; }
.regime-banner b { display: block; color: #bde3e2; font-size: 8px; letter-spacing: .11em; }
.regime-banner small { display: block; margin-top: 4px; color: #73949e; font-size: 9px; }
.regime-pulse { position: absolute; right: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(120,217,189,.08), 0 0 12px rgba(120,217,189,.4); }
.regime-banner.subcritical { border-color: rgba(228,182,108,.22); background: rgba(228,182,108,.06); }
.regime-banner.subcritical .regime-icon { color: var(--amber); background: rgba(228,182,108,.1); }
.regime-banner.subcritical b { color: #e5c38f; }
.control-group { padding: 0 0 14px; margin-bottom: 13px; border-bottom: 1px solid var(--line); }
.group-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: #8eaab4; font-size: 8px; font-weight: 800; letter-spacing: .15em; }
.group-index { color: #466674; font-size: 9px; }
.slider-control { margin: 0 0 11px; }
.slider-control:last-child { margin-bottom: 0; }
.slider-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.slider-heading label { color: #b2c5cb; font-size: 10px; }
.slider-heading em { color: #77929d; font-style: normal; }
.slider-heading output { color: #d2e6e7; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slider-control input[type="range"] { display: block; margin: 7px 0 4px; }
.range-labels { display: flex; justify-content: space-between; color: #58737e; font-size: 8px; font-variant-numeric: tabular-nums; }
.readout-section { margin: 2px 0 13px; }
.live-mini { display: flex; align-items: center; gap: 5px; color: #6ea79d; font-size: 7px; }
.live-mini i { width: 5px; height: 5px; }
.readout-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.readout-card { min-height: 72px; padding: 9px 9px 7px; border: 1px solid rgba(133,172,188,.12); border-radius: 6px; background: rgba(255,255,255,.018); }
.readout-card > span { display: block; color: #6f8b96; font-size: 7px; letter-spacing: .12em; }
.readout-card b { display: block; margin-top: 7px; color: #d9eded; font-size: 19px; font-weight: 560; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.readout-card b small { color: #87a5af; font-size: 9px; font-weight: 500; letter-spacing: 0; }
.readout-card i { display: block; margin-top: 4px; color: #526d78; font-size: 6px; font-style: normal; letter-spacing: .08em; }
.validation-card { margin: 12px 0; padding: 11px 11px 9px; border: 1px solid rgba(109,226,223,.2); border-radius: 7px; background: linear-gradient(125deg, rgba(34,104,108,.13), rgba(255,255,255,.018)); }
.validation-head { display: flex; justify-content: space-between; color: #82a8af; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.validation-status { color: var(--green); }
.validation-title { margin: 8px 0 9px; color: #d7e8e9; font-size: 11px; }
.validation-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.validation-grid > div { min-width: 0; }
.validation-grid small { display: block; color: #607d88; font-size: 6px; letter-spacing: .08em; line-height: 1.4; }
.validation-grid b { display: block; margin-top: 5px; color: #c5e8e5; font-size: 12px; font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.validation-grid > div:nth-child(3) b { color: var(--green); }
.validation-card p { margin: 8px 0 0; color: #718c97; font-size: 8px; line-height: 1.5; }
.validation-foot { margin-top: 8px; color: #4e707c; font-size: 6px; letter-spacing: .12em; }
.science-panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.014); }
.science-panel summary { min-height: 42px; padding: 0 11px; display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { color: #c2d7dc; font-size: 10px; font-weight: 650; }
.science-panel summary i { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 4px; border-radius: 4px; background: rgba(109,226,223,.1); color: var(--cyan); font-style: normal; }
.summary-meta { margin-left: auto; color: #5f7c87; font-size: 6px; letter-spacing: .1em; }
.summary-chevron { color: #6e8994; transition: transform .2s; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.science-content h3 { margin: 13px 0 6px; color: #a9d1d2; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.science-content p, .science-content li { color: #8ca5ae; font-size: 9px; line-height: 1.6; }
.science-content ul { padding-left: 17px; margin: 7px 0; }
.equation { overflow-x: auto; padding: 8px 9px; border-left: 2px solid rgba(109,226,223,.48); background: rgba(109,226,223,.045); color: #d1e9e7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; white-space: nowrap; }
.science-caveat { padding: 8px; border: 1px solid rgba(228,182,108,.15); border-radius: 5px; color: #bba27e !important; background: rgba(228,182,108,.035); }
.disclaimer { margin-top: 12px; padding: 9px 2px 2px; border-top: 1px solid var(--line); color: #5e7782; font-size: 8px; line-height: 1.5; }
.footerbar { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 24px; border-top: 1px solid rgba(145,184,201,.08); color: #526c77; font-size: 7px; letter-spacing: .13em; }
.footerbar b { color: #2f8790; padding: 0 4px; }
body.embed .topbar, body.embed .footerbar { display: none; }
body.embed .workspace { padding: 8px; grid-template-columns: minmax(0,1fr) 340px; }
body.embed .control-panel { max-height: 100vh; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0,1fr) 420px; padding: 18px; gap: 16px; } .stage-frame { min-height: 620px; } .control-panel { padding: 20px; } }
@media (max-width: 1100px) { .workspace { grid-template-columns: minmax(0,1fr) 340px; } .transport-hint { display: none; } .transport-bar { gap: 14px; } .stage-frame { min-height: 470px; } }
@media (max-width: 820px) { .topbar { padding: 0 15px; } .workspace { display: flex; flex-direction: column; padding: 9px; gap: 9px; } .stage-frame { flex: none; height: min(60vh, 530px); min-height: 390px; } .control-panel { max-height: none; overflow: visible; } .cause-strip { min-height: 70px; padding: 8px 11px; } .cause-step b { font-size: 10px; } .cause-step small { font-size: 8px; } .footerbar { padding: 8px 14px; flex-wrap: wrap; } .annotation-bed { right: 17%; top: 48%; } .annotation-water { right: 5%; top: 29%; } }
@media (max-width: 520px) {
  .topbar { min-height: 58px; padding: 0 11px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-name { font-size: 9px; letter-spacing: .11em; }
  .brand-sub { font-size: 7px; letter-spacing: .12em; }
  .live-indicator { display: none; }
  .topbar-actions { gap: 5px; }
  .icon-button { height: 31px; min-width: 31px; padding: 0 7px; }
  .export-button span { display: none; }
  .workspace { padding: 7px; }
  .stage-frame { height: 435px; min-height: 435px; border-radius: 9px; }
  .stage-topline { top: 10px; left: 10px; right: 10px; }
  .phenomenon-chip, .scale-chip { min-height: 23px; padding: 0 7px; font-size: 7px; gap: 5px; }
  .scale-chip { font-size: 6px; }
  .stage-title-block { top: 61px; left: 13px; }
  .stage-title-block h1 { font-size: 34px; }
  .stage-title-block p { max-width: 180px; font-size: 10px; }
  .eyebrow { font-size: 7px; }
  .annotation-bed { right: 4%; top: 54%; }
  .annotation-water { right: 4%; top: 35%; }
  .stage-annotation { padding: 5px 7px; }
  .stage-annotation b { font-size: 6px; }
  .stage-annotation small { font-size: 7px; }
  .annotation-line { width: 13px; left: -13px; }
  .flow-direction { left: 12px; bottom: 57px; font-size: 7px; gap: 4px; }
  .stage-legend { left: 12px; right: auto; bottom: 17px; gap: 9px; font-size: 6px; }
  .stage-clock { left: 12px; bottom: 37px; font-size: 7px; }
  .transport-bar { min-height: 54px; padding: 7px; gap: 8px; }
  .transport-main { gap: 4px; }
  .play-button { height: 33px; padding: 0 9px; gap: 6px; font-size: 8px; }
  .transport-button { height: 32px; padding: 0 7px; font-size: 8px; }
  .transport-button span { display: none; }
  .speed-control { grid-template-columns: auto minmax(40px,1fr) 35px; gap: 5px; }
  .speed-control label { font-size: 6px; }
  .speed-control output { font-size: 8px; }
  .cause-strip { grid-template-columns: 1fr 12px 1fr 12px 1fr; min-height: 64px; padding: 7px; }
  .cause-step span { font-size: 6px; }
  .cause-step b { font-size: 8px; }
  .cause-step small { font-size: 6px; line-height: 1.3; }
  .cause-chevron { font-size: 12px; }
  .control-panel { padding: 14px 12px; }
  .panel-heading h2 { font-size: 17px; }
  .readout-card { min-height: 68px; }
  .readout-card b { font-size: 17px; }
  .footerbar { justify-content: center; font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
