:root {
  color-scheme: dark;
  --bg: #080d14;
  --panel: #101821;
  --panel-2: #121e29;
  --line: rgba(151, 180, 202, .15);
  --line-strong: rgba(151, 180, 202, .25);
  --text: #e8eef2;
  --muted: #91a0ad;
  --dim: #687987;
  --accent: #ff9a57;
  --accent-2: #f15e38;
  --blue: #77b6d9;
  --green: #78d5ad;
  --radius: 12px;
  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-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; background: radial-gradient(ellipse at 35% -20%, #172633 0, #0b1119 48%, #080d14 100%); }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { max-width: 1800px; margin: 0 auto; padding: 20px 24px 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 2px 0 18px; border-bottom: 1px solid var(--line); }
.brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border: 1px solid rgba(255, 155, 87, .45); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: linear-gradient(145deg, rgba(255, 144, 78, .17), rgba(90, 42, 28, .16)); flex: 0 0 auto; }
.brand-mark span { width: 4px; border-radius: 4px; background: var(--accent); transform: skew(-18deg); }
.brand-mark span:nth-child(1) { height: 11px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 14px; opacity: .75; }
.eyebrow, .panel-kicker, .scene-kicker, .footer, .readout-name, .validation-head, .validation-values small, .unit-tag { font-size: 9px; letter-spacing: .15em; font-weight: 750; }
.eyebrow { color: #8294a2; margin-bottom: 4px; }
h1 { font-size: clamp(17px, 1.65vw, 23px); line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -.035em; }
h1 span { color: #a8b6c0; font-weight: 430; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.live-indicator { display: flex; align-items: center; gap: 7px; color: #a8b9c4; font-size: 9px; letter-spacing: .13em; font-weight: 800; }
.live-indicator i { width: 6px; height: 6px; border-radius: 50%; background: #6ed9aa; box-shadow: 0 0 12px #6ed9aa; }
.field-chip { border: 1px solid var(--line-strong); color: #a9b7c1; border-radius: 6px; padding: 7px 9px; font-size: 9px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(390px, .88fr); gap: 16px; padding-top: 16px; align-items: start; }
.visual-column { min-width: 0; }
.scene-frame { height: min(64vw, 630px); min-height: 470px; max-height: 630px; position: relative; overflow: hidden; border: 1px solid rgba(131, 162, 183, .2); border-radius: 14px; background: radial-gradient(ellipse at 52% 44%, #1b2830, #0b121b 65%, #080e15); box-shadow: 0 20px 70px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.035); isolation: isolate; }
.scene-mount { position: absolute; inset: 0; z-index: 1; }
.webgl-canvas { width: 100%; height: 100%; display: block; outline: none; }
.scene-vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(180deg, rgba(5,10,15,.4), transparent 20%, transparent 76%, rgba(5,10,15,.38)), linear-gradient(90deg, rgba(5,10,15,.22), transparent 20%, transparent 80%, rgba(5,10,15,.2)); }
.scene-heading { position: absolute; top: 20px; left: 22px; z-index: 3; pointer-events: none; }
.scene-kicker { color: #ffb27d; font-size: 9px; }
.scene-subtitle { color: #9aaab5; font-size: 11px; margin-top: 6px; }
.scene-annotations { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.annotation { position: absolute; display: flex; align-items: center; gap: 7px; color: rgba(222, 231, 236, .8); font-size: 8px; font-weight: 800; letter-spacing: .12em; text-shadow: 0 2px 8px #000; white-space: nowrap; }
.annotation-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(255, 140, 75, .9); }
.annotation-gas { left: 55%; top: 55%; }
.annotation-plug { left: 58%; top: 37%; }
.annotation-wall { left: 25%; top: 68%; }
.scene-scale { position: absolute; left: 22px; bottom: 18px; z-index: 3; display: flex; align-items: center; gap: 8px; color: #83929d; font-size: 8px; letter-spacing: .14em; font-weight: 750; pointer-events: none; }
.scale-line { width: 22px; height: 1px; background: #a2b2bd; }
.scene-tools { position: absolute; top: 17px; right: 17px; display: flex; gap: 7px; z-index: 4; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(157, 182, 200, .22); border-radius: 8px; background: rgba(11, 19, 27, .76); color: #c2d0d9; font-size: 10px; font-weight: 800; cursor: pointer; transition: background .18s, border-color .18s, transform .18s; backdrop-filter: blur(8px); }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover, .icon-button.active { border-color: rgba(255, 158, 95, .55); background: rgba(100, 51, 30, .45); color: #ffbd8c; }
.icon-button:active { transform: scale(.96); }
.scene-status { position: absolute; right: 18px; bottom: 18px; z-index: 4; display: flex; align-items: center; gap: 7px; color: #91a3af; font-size: 8px; font-weight: 800; letter-spacing: .1em; background: rgba(8, 15, 22, .68); border: 1px solid rgba(143, 171, 191, .15); border-radius: 20px; padding: 7px 10px; backdrop-filter: blur(8px); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #70d8aa; box-shadow: 0 0 8px #70d8aa; }
.scene-status.error { color: #ffb08a; border-color: rgba(255, 140, 92, .28); }
.scene-status.error .status-dot { background: #ff8d5b; box-shadow: 0 0 8px #ff8d5b; }
.scene-status.success .status-dot { background: #70d8aa; }
.scene-fallback { background-image: linear-gradient(180deg, rgba(5,9,14,.12), rgba(5,9,14,.5)), url('../preview.webp'); background-size: cover; background-position: center 45%; }
.scene-fallback .scene-mount { display: none; }
.cause-chain { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(16, 24, 33, .74); }
.cause-step { display: flex; align-items: center; gap: 10px; min-width: 0; }
.step-index { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255, 158, 95, .28); color: #ffad78; border-radius: 7px; font-size: 9px; font-weight: 800; }
.cause-step strong { display: block; font-size: 8px; letter-spacing: .12em; color: #b9c6ce; }
.cause-step small { display: block; color: #7f909c; font-size: 10px; margin-top: 3px; white-space: nowrap; }
.cause-arrow { color: #536675; font-size: 16px; }
.science-panel { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(16, 24, 33, .78); overflow: hidden; }
.science-toggle { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: transparent; border: 0; cursor: pointer; text-align: left; }
.science-toggle > span:first-child { display: flex; align-items: center; gap: 11px; }
.science-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(119, 182, 217, .12); color: #8dc4e1; font-size: 17px; }
.science-toggle strong { display: block; font-size: 12px; font-weight: 650; }
.science-toggle small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.chevron { color: #92a5b3; font-size: 18px; transition: transform .2s; }
.science-panel.expanded .chevron { transform: rotate(180deg); }
.science-content { padding: 0 16px 16px; animation: reveal .2s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.equation-card { padding: 13px 15px; border-radius: 8px; background: #0a121a; border: 1px solid rgba(126, 165, 190, .15); }
.equation-label { color: #89b7d0; font-size: 8px; letter-spacing: .13em; font-weight: 800; margin-bottom: 10px; }
.equation { color: #e2e9ed; font-family: Georgia, serif; font-size: 16px; line-height: 1.65; }
.equation sub, .equation sup { font-size: 10px; }
.science-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.science-grid > div { border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; }
.science-grid b { display: block; font-family: Georgia, serif; font-size: 12px; color: #e2b18f; }
.science-grid span { display: block; margin-top: 4px; font-size: 9px; color: #8797a2; }
.science-note { color: #9cabb5; font-size: 10px; line-height: 1.6; margin: 12px 0 0; }
.science-note b { color: #d7e0e5; }
.disclaimer { color: #71818d; font-size: 9px; border-top: 1px solid var(--line); padding-top: 10px; margin: 12px 0 0; }
.control-column { min-width: 0; display: grid; gap: 12px; }
.panel { background: linear-gradient(145deg, rgba(18, 29, 39, .96), rgba(13, 21, 30, .96)); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 36px rgba(0,0,0,.12); }
.control-panel { padding: 16px 16px 14px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-kicker { color: #86a1b1; font-size: 8px; }
.panel-header h2 { font-size: 15px; font-weight: 620; letter-spacing: -.02em; margin: 4px 0 0; }
.text-button { background: transparent; border: 1px solid var(--line-strong); color: #9fb0bb; border-radius: 6px; font-size: 8px; letter-spacing: .12em; font-weight: 800; padding: 7px 9px; cursor: pointer; }
.text-button:hover { color: #ffbd8c; border-color: rgba(255, 158, 95, .4); }
.preset-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 15px 0 17px; }
.preset-button { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 45px; padding: 7px 8px; background: rgba(7, 13, 20, .55); border: 1px solid var(--line); border-radius: 8px; color: #aab8c1; text-align: left; font-size: 9px; line-height: 1.3; cursor: pointer; transition: .18s; }
.preset-button:hover { border-color: rgba(255, 160, 101, .35); }
.preset-button.selected { background: rgba(117, 61, 37, .23); border-color: rgba(255, 154, 87, .55); color: #f6c29e; box-shadow: inset 0 0 0 1px rgba(255, 154, 87, .08); }
.preset-symbol { color: #ff9d64; font-size: 17px; width: 20px; text-align: center; }
.control-list { display: grid; gap: 12px; }
.control-item { min-width: 0; }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.control-label label { color: #c4cfd6; font-size: 10px; font-weight: 550; }
.control-label output { color: #ffb17d; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { --range-progress: 50%; display: block; width: 100%; height: 15px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(90deg, #e7834c 0 var(--range-progress), #2b3a46 var(--range-progress) 100%); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 5px; background: #2b3a46; }
input[type="range"]::-moz-range-progress { height: 3px; background: #e7834c; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; border: 2px solid #ffc08f; background: #b75b33; box-shadow: 0 0 0 3px rgba(255, 151, 87, .13); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #ffc08f; background: #b75b33; box-shadow: 0 0 0 3px rgba(255, 151, 87, .13); }
input[type="range"]:focus-visible { outline: 2px solid rgba(125, 188, 222, .7); outline-offset: 4px; border-radius: 4px; }
.range-ends { display: flex; justify-content: space-between; color: #667784; font-size: 8px; margin-top: 1px; }
.transport-row { display: grid; grid-template-columns: 1.2fr 1fr .85fr; gap: 7px; margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.transport-primary, .transport-button { min-height: 35px; border-radius: 7px; cursor: pointer; font-size: 8px; font-weight: 850; letter-spacing: .1em; transition: .18s; }
.transport-primary { display: flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(135deg, #b75c35, #8c3e29); border: 1px solid rgba(255, 169, 112, .32); color: #fff1e8; box-shadow: 0 5px 14px rgba(111, 49, 29, .2); }
.transport-primary:hover { filter: brightness(1.13); }
.transport-primary.paused { background: linear-gradient(135deg, #286a5c, #1e5148); border-color: rgba(120, 213, 173, .32); }
.play-icon { font-size: 11px; }
.transport-button { background: rgba(6, 12, 18, .6); border: 1px solid var(--line-strong); color: #aebdc7; }
.transport-button:hover { border-color: rgba(255, 158, 95, .4); color: #f4c19e; }
.speed-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.speed-row > label { color: #8495a1; font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.speed-control { display: flex; align-items: center; gap: 10px; flex: 1; }
.speed-control output { color: #ffb17d; font-size: 10px; font-weight: 700; min-width: 38px; text-align: right; }
.telemetry-panel { padding: 15px 16px 14px; }
.unit-tag { color: #748795; border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; font-size: 7px; }
.readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.readout-card { min-width: 0; border: 1px solid rgba(142, 169, 187, .14); background: rgba(6, 13, 20, .45); border-radius: 8px; padding: 10px 10px 9px; }
.readout-name { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: #8799a5; font-size: 7px; letter-spacing: .11em; }
.readout-name i { font-style: normal; color: #6f9eb8; font-size: 6px; border: 1px solid rgba(111, 158, 184, .25); padding: 2px 3px; border-radius: 3px; }
.readout-card strong { display: block; color: #e9eef1; font-size: 22px; font-weight: 620; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-top: 7px; white-space: nowrap; }
.readout-card strong small { color: #9cabb5; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.readout-foot { display: block; color: #71828e; font-size: 8px; margin-top: 4px; }
.validation-block { margin-top: 11px; border: 1px solid rgba(120, 213, 173, .17); background: linear-gradient(135deg, rgba(26, 65, 58, .19), rgba(6, 14, 19, .5)); border-radius: 8px; padding: 10px 11px; }
.validation-head { display: flex; align-items: center; justify-content: space-between; color: #8ca99f; font-size: 7px; }
.textbook-tag { border: 1px solid rgba(120, 213, 173, .3); color: #83d5b4; border-radius: 4px; padding: 3px 5px; font-size: 7px; }
.validation-title { font-size: 10px; color: #d5e1df; margin-top: 8px; font-weight: 600; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 9px; }
.validation-values small { display: block; color: #79938b; font-size: 6px; letter-spacing: .11em; }
.validation-values strong { display: block; color: #d7e9e1; font-size: 14px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.validation-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid rgba(120, 213, 173, .12); margin-top: 9px; padding-top: 8px; color: #81978f; font-size: 8px; }
.validation-foot strong { color: #a4e0c7; font-variant-numeric: tabular-nums; }
.validation-pass { margin-left: auto; color: #83d5b4; font-size: 7px; font-weight: 850; letter-spacing: .08em; }
.validation-pass.warning { color: #ffb27d; }
.keyboard-hint { color: #697a86; font-size: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 4px; }
kbd { border: 1px solid rgba(144, 168, 184, .2); border-bottom-width: 2px; border-radius: 4px; padding: 3px 5px; color: #a5b2bb; font: 700 7px ui-monospace, monospace; }
.footer { display: flex; justify-content: space-between; gap: 16px; color: #596a77; font-size: 7px; letter-spacing: .14em; padding: 16px 2px 2px; }
.embed-mode .app-shell { padding-top: 10px; }
.embed-mode .topbar, .embed-mode .footer { display: none; }
.embed-mode .workspace { padding-top: 0; }
button:focus-visible { outline: 2px solid rgba(125, 188, 222, .8); outline-offset: 3px; }
@media (min-width: 1500px) { .workspace { grid-template-columns: minmax(0, 1.7fr) minmax(410px, .78fr); } }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1.2fr) minmax(340px, .9fr); }
  .scene-frame { min-height: 430px; }
  .cause-step small { white-space: normal; }
  .annotation { font-size: 7px; }
}
@media (max-width: 820px) {
  .app-shell { padding: 14px 14px 12px; }
  .workspace { grid-template-columns: 1fr; gap: 12px; }
  .scene-frame { height: min(70vw, 560px); min-height: 390px; }
  .control-column { grid-template-columns: 1fr; }
  .control-panel { order: 0; }
  .telemetry-panel { order: 1; }
  .topbar-right { gap: 8px; }
  .field-chip { display: none; }
}
@media (max-width: 520px) {
  .app-shell { padding: 10px 10px 12px; }
  .topbar { padding-bottom: 12px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 31px; height: 31px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 16px; max-width: 260px; }
  h1 span { display: none; }
  .live-indicator { font-size: 7px; }
  .workspace { padding-top: 10px; }
  .scene-frame { height: 66vh; min-height: 420px; max-height: 610px; border-radius: 10px; }
  .scene-heading { top: 14px; left: 14px; }
  .scene-subtitle { max-width: 220px; font-size: 9px; }
  .scene-tools { top: 10px; right: 10px; gap: 5px; }
  .icon-button { width: 31px; height: 31px; }
  .annotation { font-size: 6px; letter-spacing: .08em; }
  .annotation-gas { left: 48%; top: 55%; }
  .annotation-plug { left: 53%; top: 37%; }
  .annotation-wall { left: 12%; top: 68%; }
  .scene-scale { left: 13px; bottom: 13px; font-size: 6px; }
  .scene-status { right: 10px; bottom: 10px; font-size: 6px; padding: 6px 8px; max-width: 55%; }
  .cause-chain { padding: 10px 9px; gap: 5px; }
  .cause-step { gap: 6px; }
  .step-index { width: 22px; height: 22px; font-size: 8px; }
  .cause-step strong { font-size: 7px; }
  .cause-step small { font-size: 8px; max-width: 82px; }
  .cause-arrow { font-size: 12px; }
  .control-panel, .telemetry-panel { padding: 13px 12px; }
  .preset-button { gap: 5px; font-size: 8px; padding: 6px; }
  .preset-symbol { width: 16px; font-size: 14px; }
  .control-list { gap: 10px; }
  .readout-card { padding: 9px 8px; }
  .readout-card strong { font-size: 20px; }
  .footer { font-size: 6px; flex-wrap: wrap; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
