:root {
  color-scheme: dark;
  --bg: #07121b;
  --panel: #0b1924;
  --panel-2: #10222e;
  --line: rgba(158, 193, 207, .13);
  --line-strong: rgba(158, 193, 207, .22);
  --text: #e6f0f3;
  --muted: #8ca3ad;
  --faint: #607681;
  --teal: #69d9cf;
  --teal-bright: #9af1df;
  --amber: #e2b47a;
  --blue: #6bb5d0;
  --danger: #e5a17d;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: radial-gradient(ellipse at 50% -30%, #17303d 0%, #091722 45%, #06111a 100%); min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: min(100%, 1800px); margin: 0 auto; padding: 0 20px 20px; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(105,217,207,.45); color: var(--teal-bright); border-radius: 9px; display: grid; place-items: center; font-family: Georgia, serif; font-size: 21px; background: linear-gradient(145deg, rgba(105,217,207,.16), rgba(105,217,207,.025)); box-shadow: inset 0 0 16px rgba(105,217,207,.06); }
.eyebrow { font-size: 9px; line-height: 1.2; letter-spacing: .18em; color: #77929e; font-weight: 750; }
.brand-title { margin-top: 3px; font-size: 14px; letter-spacing: .12em; font-weight: 850; }
.brand-title span { color: var(--teal); }
.top-meta { display: flex; align-items: center; gap: 10px; color: #91a8b2; font-size: 9px; letter-spacing: .12em; font-weight: 750; }
.live-dot, .chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 12px rgba(105,217,207,.8); }
.meta-divider { height: 13px; width: 1px; background: var(--line-strong); margin: 0 4px; }
.model-tag { color: #d0a977; border: 1px solid rgba(210,165,110,.25); background: rgba(210,165,110,.07); border-radius: 5px; padding: 5px 7px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 358px; gap: 16px; padding-top: 16px; align-items: stretch; }
.scene-column { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.scene-frame { position: relative; overflow: hidden; min-height: 440px; height: clamp(440px, calc(100vh - 310px), 690px); border-radius: 13px; border: 1px solid rgba(128,175,191,.18); background: radial-gradient(ellipse at 50% 55%, #17313d, #0a1924 72%); box-shadow: var(--shadow); isolation: isolate; }
.scene-root { position: absolute; inset: 0; z-index: 1; }
.scene-root 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(4,13,20,.25), transparent 18%, transparent 72%, rgba(4,13,20,.45)), linear-gradient(90deg, rgba(4,13,20,.17), transparent 18%, transparent 82%, rgba(4,13,20,.18)); }
.scene-topline { position: absolute; z-index: 3; left: 18px; right: 18px; top: 16px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scene-chip { display: flex; align-items: center; gap: 8px; border: 1px solid rgba(152,194,205,.2); border-radius: 6px; padding: 7px 9px; background: rgba(5,17,25,.62); backdrop-filter: blur(12px); color: #b8cbd1; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.scene-scale { color: rgba(185,207,212,.72); font-size: 8px; letter-spacing: .12em; background: rgba(5,17,25,.45); padding: 7px 9px; border-radius: 5px; }
.scene-scale b { color: var(--amber); font-weight: 800; margin-left: 4px; }
.scene-annotation { position: absolute; z-index: 3; display: flex; gap: 7px; align-items: center; pointer-events: none; text-shadow: 0 2px 8px #07121b; }
.annotation-left { top: 26%; left: 5%; }
.annotation-right { bottom: 27%; right: 5%; flex-direction: row-reverse; text-align: right; }
.annotation-line { width: 25px; height: 1px; background: rgba(130,222,211,.8); box-shadow: 0 0 8px rgba(105,217,207,.45); }
.scene-annotation b { display: block; color: #b9e8e0; font-size: 8px; letter-spacing: .15em; }
.scene-annotation small { display: block; margin-top: 3px; color: rgba(211,225,227,.76); font-size: 9px; }
.scene-bottom-hud { position: absolute; z-index: 3; bottom: 14px; left: 17px; right: 17px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.flow-legend, .camera-hint { display: flex; align-items: center; gap: 7px; color: rgba(192,214,219,.7); font-size: 8px; letter-spacing: .12em; font-weight: 750; }
.legend-arrow { color: var(--teal); font-size: 17px; line-height: 1; }
.mouse-icon { font-size: 12px; color: var(--teal); }
.scene-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.scene-caption { font-size: 11px; color: #9fb3bb; line-height: 1.45; max-width: 78%; }
.scene-footer-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn { height: 30px; min-width: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 7px; color: #a8c0c7; background: rgba(14,32,43,.75); cursor: pointer; font-size: 14px; transition: .18s ease; }
.icon-btn:hover { border-color: rgba(105,217,207,.5); color: var(--teal-bright); background: rgba(105,217,207,.08); }
#quality-toggle { font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.metrics-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.metric-card { min-height: 75px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px 9px; background: linear-gradient(135deg, rgba(17,39,51,.88), rgba(9,24,34,.9)); }
.metric-label { color: #7f9aa5; font-size: 8px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.metric-label span { color: #b3c9ce; margin-left: 3px; }
.metric-value { margin-top: 6px; font-size: 21px; line-height: 1; letter-spacing: -.04em; color: #e2f2f1; font-variant-numeric: tabular-nums; font-weight: 650; }
.metric-value small { font-size: 10px; color: #8ca8b0; letter-spacing: 0; margin-left: 2px; font-weight: 600; }
.metric-foot { margin-top: 5px; color: #66818c; font-size: 7px; letter-spacing: .1em; font-weight: 750; }
.control-panel { min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(160deg, rgba(13,31,43,.98), rgba(8,22,32,.98)); padding: 17px 16px 14px; display: flex; flex-direction: column; max-height: calc(100vh - 84px); overflow: hidden; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-head h1 { margin: 5px 0 0; font-size: 18px; letter-spacing: -.03em; font-weight: 650; }
.state-pill { display: flex; align-items: center; gap: 6px; border: 1px solid rgba(105,217,207,.24); border-radius: 20px; padding: 6px 8px; color: var(--teal); background: rgba(105,217,207,.06); font-size: 8px; letter-spacing: .1em; font-weight: 850; }
.state-pill span { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.state-pill.paused { color: var(--amber); border-color: rgba(226,180,122,.25); background: rgba(226,180,122,.06); }
.state-pill.paused span { background: var(--amber); }
.transport-state { padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.transport-state-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 8px; letter-spacing: .12em; color: #78939d; font-weight: 800; }
.transport-state-top b { color: #c1dedb; font-size: 9px; letter-spacing: .03em; }
.response-track { margin-top: 9px; height: 4px; background: #1a303b; border-radius: 8px; overflow: hidden; }
.response-fill { height: 100%; width: 20%; background: linear-gradient(90deg, #5c9ba5, #79d7c8); border-radius: 8px; box-shadow: 0 0 10px rgba(105,217,207,.35); transition: width .35s ease; }
.response-scale { display: flex; justify-content: space-between; margin-top: 5px; color: #617b85; font-size: 7px; letter-spacing: .12em; }
.preset-block { padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.section-label { color: #7b98a2; font-size: 8px; letter-spacing: .15em; font-weight: 850; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 9px; }
.preset-btn { min-width: 0; min-height: 59px; display: flex; align-items: flex-start; gap: 6px; text-align: left; padding: 8px 7px; border-radius: 8px; border: 1px solid var(--line); background: rgba(8,22,31,.55); cursor: pointer; transition: .18s ease; }
.preset-btn:hover { border-color: rgba(105,217,207,.36); background: rgba(105,217,207,.04); }
.preset-btn.active { border-color: rgba(105,217,207,.55); background: linear-gradient(135deg, rgba(105,217,207,.11), rgba(105,217,207,.035)); box-shadow: inset 0 0 0 1px rgba(105,217,207,.05); }
.preset-icon { font-size: 13px; color: var(--teal); line-height: 1.1; }
.preset-btn b { display: block; font-size: 8px; line-height: 1.3; color: #d5e3e5; white-space: nowrap; }
.preset-btn small { display: block; margin-top: 4px; color: #78909a; font-size: 7px; line-height: 1.2; white-space: nowrap; }
.controls-scroll { min-height: 0; overflow-y: auto; padding: 13px 3px 10px 0; scrollbar-width: thin; scrollbar-color: #294653 transparent; }
.controls-title { margin-bottom: 12px; }
.control-row { padding: 0 1px 13px; margin-bottom: 11px; border-bottom: 1px solid rgba(158,193,207,.075); }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.control-label label { color: #c4d4d9; font-size: 10px; font-weight: 600; }
.control-label output { color: var(--teal-bright); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 4px; margin: 0; border-radius: 10px; appearance: none; -webkit-appearance: none; background: linear-gradient(90deg, #4d9e9a, #284451); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #d7f6ec; border: 3px solid #4caeaa; box-shadow: 0 0 0 3px rgba(105,217,207,.12), 0 1px 6px #000; }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: #d7f6ec; border: 3px solid #4caeaa; box-shadow: 0 0 0 3px rgba(105,217,207,.12), 0 1px 6px #000; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(105,217,207,.2); }
.range-ends { display: flex; justify-content: space-between; margin-top: 7px; color: #5e7883; font-size: 7px; letter-spacing: .04em; }
.speed-control { margin-bottom: 0; border-bottom: 0; padding-bottom: 4px; }
.playback-bar { display: grid; grid-template-columns: minmax(0,1fr) 78px 36px; gap: 7px; padding: 11px 0 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.play-btn, .step-btn, .reset-btn, .primary-btn { border: 0; border-radius: 7px; cursor: pointer; transition: .18s ease; }
.play-btn { height: 36px; display: flex; justify-content: center; align-items: center; gap: 8px; background: linear-gradient(110deg, #4aada4, #4e9b9b); color: #061a20; font-size: 10px; font-weight: 850; letter-spacing: .06em; box-shadow: 0 5px 16px rgba(47,153,145,.16); }
.play-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.play-glyph { font-size: 13px; }
.step-btn { background: rgba(100,148,161,.12); border: 1px solid rgba(125,171,184,.22); color: #b7d0d5; font-size: 8px; letter-spacing: .1em; font-weight: 850; }
.reset-btn { border: 1px solid var(--line-strong); background: rgba(100,148,161,.08); color: #aac2c8; font-size: 19px; }
.step-btn:hover, .reset-btn:hover { border-color: rgba(105,217,207,.5); color: var(--teal-bright); }
.validation-card { margin-top: 12px; border: 1px solid rgba(105,217,207,.17); border-radius: 8px; background: linear-gradient(135deg, rgba(30,71,75,.19), rgba(8,25,34,.6)); padding: 10px 11px 9px; }
.validation-head { display: flex; justify-content: space-between; align-items: center; color: #7d9e9e; font-size: 7px; letter-spacing: .14em; font-weight: 850; }
.verified-mark { color: var(--teal); font-size: 12px; }
.validation-title { margin-top: 5px; color: #cde0df; font-size: 10px; font-weight: 700; }
.validation-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 9px; }
.validation-grid small { display: block; color: #66858b; font-size: 7px; letter-spacing: .1em; }
.validation-grid b { display: block; margin-top: 4px; color: #d9e9e7; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.validation-note { margin-top: 8px; color: #66818a; font-size: 7px; line-height: 1.4; }
.science-section { margin-top: 16px; border: 1px solid var(--line); border-radius: 11px; background: rgba(10,25,35,.8); overflow: hidden; }
.science-section details > summary { display: flex; align-items: center; gap: 12px; padding: 13px 16px; list-style: none; cursor: pointer; }
.science-section summary::-webkit-details-marker { display: none; }
.science-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(105,217,207,.09); color: var(--teal); font-family: Georgia, serif; font-size: 18px; }
.science-section summary b { display: block; font-size: 11px; }
.science-section summary small { display: block; margin-top: 3px; color: #78919b; font-size: 9px; }
.summary-chevron { margin-left: auto; color: #82a0a9; font-size: 17px; transition: transform .2s ease; }
.science-section details[open] .summary-chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 20px 18px 18px; }
.science-intro { max-width: 850px; }
.science-intro h2 { margin: 7px 0 6px; font-size: 19px; letter-spacing: -.03em; }
.science-intro p { margin: 0; max-width: 850px; color: #9bb0b8; font-size: 11px; line-height: 1.65; }
.equation-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; margin-top: 17px; }
.equation-card { padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(16,38,49,.55); }
.equation-card > span { color: #76a7a7; font-size: 7px; letter-spacing: .12em; font-weight: 850; }
.equation-card h3 { margin: 7px 0 10px; font-size: 11px; }
.equation { min-height: 35px; display: flex; align-items: center; color: #c6e9df; font-family: Georgia, serif; font-size: 12px; line-height: 1.4; }
.equation-card p { margin: 8px 0 0; color: #8299a2; font-size: 9px; line-height: 1.55; }
.science-footnotes { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.science-footnotes b { color: #b9d2d2; font-size: 9px; }
.science-footnotes p { margin: 5px 0 0; color: #7d949d; font-size: 9px; line-height: 1.6; }
.footer-note { padding: 14px 2px 0; color: #536b76; text-align: center; font-size: 8px; letter-spacing: .06em; }
.loading-overlay { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; background: #091923; color: #9ab6bc; font-size: 8px; letter-spacing: .18em; font-weight: 850; transition: opacity .4s ease; }
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loader-ring { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(105,217,207,.16); border-top-color: var(--teal); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.context-overlay { position: absolute; z-index: 10; inset: 0; display: grid; place-items: center; background: rgba(4,12,18,.82); backdrop-filter: blur(9px); }
.context-overlay[hidden] { display: none; }
.context-card { width: min(300px, calc(100% - 36px)); padding: 22px; border: 1px solid rgba(226,180,122,.3); border-radius: 12px; background: #10232e; text-align: center; box-shadow: var(--shadow); }
.context-icon { font-size: 25px; color: var(--amber); }
.context-card b { display: block; margin-top: 9px; font-size: 14px; }
.context-card p { color: #93aab1; font-size: 10px; line-height: 1.5; }
.primary-btn { padding: 10px 14px; background: #5cb8aa; color: #07171c; font-size: 10px; font-weight: 800; }
.embed-mode .app-shell { padding: 0; }
.embed-mode .topbar, .embed-mode .science-section, .embed-mode .footer-note { display: none; }
.embed-mode .workspace { padding: 0; grid-template-columns: minmax(0,1fr) 330px; gap: 8px; }
.embed-mode .scene-frame { border-radius: 0; height: 100vh; min-height: 360px; }
.embed-mode .control-panel { border-radius: 0; max-height: 100vh; }
:focus-visible { outline: 2px solid rgba(105,217,207,.85); outline-offset: 3px; }

@media (max-width: 1080px) {
  .app-shell { padding: 0 14px 18px; }
  .workspace { grid-template-columns: minmax(0,1fr) 330px; gap: 11px; }
  .control-panel { padding: 14px 12px 12px; }
  .scene-frame { height: clamp(410px, calc(100vh - 330px), 620px); }
  .preset-btn { padding: 7px 5px; }
  .preset-btn b { font-size: 7px; }
  .preset-btn small { font-size: 6px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 10px 14px; }
  .topbar { height: 58px; }
  .top-meta { font-size: 7px; gap: 6px; }
  .model-tag { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
  .scene-column { gap: 7px; }
  .scene-frame { height: 49vh; min-height: 310px; max-height: 470px; border-radius: 10px; }
  .scene-topline { left: 10px; right: 10px; top: 10px; }
  .scene-chip { font-size: 7px; padding: 6px 7px; }
  .scene-scale { font-size: 6px; padding: 6px 7px; }
  .annotation-left { top: 25%; left: 3%; }
  .annotation-right { bottom: 23%; right: 3%; }
  .scene-annotation b { font-size: 7px; }
  .scene-annotation small { font-size: 7px; }
  .annotation-line { width: 14px; }
  .scene-bottom-hud { left: 10px; right: 10px; bottom: 9px; }
  .flow-legend, .camera-hint { font-size: 6px; gap: 4px; }
  .scene-caption { font-size: 9px; max-width: 76%; }
  .scene-footer-actions { gap: 4px; }
  .icon-btn { height: 28px; min-width: 31px; }
  .metrics-strip { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
  .metric-card { min-height: 68px; padding: 9px 10px; }
  .metric-label { font-size: 7px; }
  .metric-value { font-size: 19px; }
  .control-panel { max-height: none; overflow: visible; border-radius: 10px; padding: 14px 13px; }
  .panel-head h1 { font-size: 17px; }
  .controls-scroll { overflow: visible; max-height: none; }
  .preset-btn { min-height: 56px; }
  .preset-btn b { font-size: 8px; }
  .preset-btn small { font-size: 7px; }
  .control-row { padding-bottom: 12px; margin-bottom: 10px; }
  .control-label label { font-size: 10px; }
  .science-section { margin-top: 10px; }
  .science-content { padding: 16px 13px; }
  .equation-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .science-footnotes { grid-template-columns: 1fr; gap: 10px; }
  .embed-mode .workspace { display: flex; flex-direction: column; }
  .embed-mode .scene-frame { height: 50vh; min-height: 280px; }
  .embed-mode .control-panel { max-height: none; }
}
@media (max-width: 390px) {
  .brand-title { font-size: 12px; }
  .eyebrow { font-size: 8px; }
  .top-meta { letter-spacing: .08em; }
  .scene-frame { min-height: 290px; }
  .preset-grid { gap: 4px; }
  .preset-btn { padding: 7px 4px; gap: 4px; }
  .preset-icon { font-size: 11px; }
  .preset-btn b { font-size: 7px; }
  .preset-btn small { font-size: 6px; }
  .validation-grid { gap: 4px; }
  .validation-grid b { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.symbol-key { margin-top: 13px; padding: 10px 12px; border-radius: 7px; background: rgba(105,217,207,.045); border: 1px solid rgba(105,217,207,.12); }
.symbol-key b { color: #82bcb6; font-size: 7px; letter-spacing: .14em; }
.symbol-key p { margin: 5px 0 0; color: #8ea7ae; font-size: 9px; line-height: 1.55; }
