:root {
  color-scheme: dark;
  --bg: #07111c;
  --panel: rgba(12, 25, 39, .94);
  --panel-2: rgba(15, 31, 47, .92);
  --line: rgba(151, 187, 209, .13);
  --line-strong: rgba(151, 187, 209, .22);
  --text: #e6f0f6;
  --muted: #8ea5b6;
  --soft: #60798d;
  --cyan: #63d6ee;
  --cyan-2: #2ba9c9;
  --gold: #d8b47a;
  --amber: #e9a86a;
  --green: #7bd4b2;
  --danger: #e58b86;
  --radius: 14px;
  --space: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { background: radial-gradient(ellipse at 54% 44%, #12263a 0%, #091522 45%, #050c14 100%); }
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 { width: 100%; height: 100%; min-height: 560px; display: flex; flex-direction: column; padding: 0 18px 10px; }
.topbar { height: 76px; min-height: 76px; display: grid; grid-template-columns: 240px minmax(0,1fr) 170px; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid rgba(99,214,238,.38); border-radius: 11px; background: linear-gradient(145deg, rgba(99,214,238,.16), rgba(30,75,95,.12)); color: #dff9ff; font-size: 12px; font-weight: 800; letter-spacing: -.08em; box-shadow: inset 0 0 18px rgba(99,214,238,.08); }
.brand-mark span { color: var(--cyan); margin: 0 1px; }
.brand-copy { min-width: 0; }
.eyebrow, .section-label { color: #7694a8; font-size: 9px; font-weight: 800; letter-spacing: .16em; line-height: 1.4; }
.brand-title { color: #d7e4ec; font-size: 11px; font-weight: 650; margin-top: 3px; white-space: nowrap; }
.topbar-center { min-width: 0; }
.topbar-center h1 { margin: 3px 0 0; font-size: clamp(16px, 1.45vw, 21px); line-height: 1.2; font-weight: 690; letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-center h1 span { color: #91a8b8; font-size: .78em; font-weight: 450; letter-spacing: -.01em; }
.topbar-status { justify-self: end; display: flex; align-items: center; gap: 8px; color: #9ab3c2; font-size: 9px; font-weight: 750; letter-spacing: .13em; white-space: nowrap; }
.status-dot, .live-pulse { width: 7px; height: 7px; border-radius: 50%; background: #63d6b4; box-shadow: 0 0 0 4px rgba(99,214,180,.10), 0 0 13px rgba(99,214,180,.65); }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(230px, 264px) minmax(390px, 1fr) minmax(235px, 274px); gap: 12px; padding: 12px 0 10px; }
.panel { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(120,160,184,.3) transparent; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(165deg, rgba(15,31,47,.97), rgba(8,20,32,.96)); box-shadow: 0 16px 44px rgba(0,0,0,.16), inset 0 1px rgba(255,255,255,.025); padding: 15px 14px 13px; }
.panel::-webkit-scrollbar { width: 5px; }
.panel::-webkit-scrollbar-thumb { background: rgba(120,160,184,.28); border-radius: 10px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; font-weight: 650; letter-spacing: -.025em; }
.panel-index { color: #527286; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.preset-block { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.preset-grid { display: grid; gap: 6px; margin-top: 9px; }
.preset-btn { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid transparent; border-radius: 9px; background: rgba(255,255,255,.025); text-align: left; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.preset-btn:hover { background: rgba(99,214,238,.07); border-color: rgba(99,214,238,.16); }
.preset-btn.active { background: rgba(99,214,238,.09); border-color: rgba(99,214,238,.28); }
.preset-btn:active { transform: translateY(1px); }
.preset-btn b { display: block; font-size: 10px; font-weight: 700; color: #dce9ef; }
.preset-btn small { display: block; color: #7890a1; font-size: 9px; margin-top: 2px; }
.preset-swatch { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; border: 1px solid rgba(255,255,255,.15); }
.swatch-classic { background: repeating-linear-gradient(180deg,#b4d8d7 0 2px,#314d5b 2px 5px,#e1b77b 5px 7px,#243f4e 7px 10px); }
.swatch-dense { background: repeating-linear-gradient(180deg,#f0c58d 0 2px,#314b59 2px 4px,#b8d7d4 4px 6px,#263c49 6px 8px); }
.swatch-sparse { background: repeating-linear-gradient(180deg,#d9c69e 0 3px,#314b59 3px 10px,#314b59 10px 16px); }
.control-group { padding: 13px 0 4px; border-bottom: 1px solid var(--line); }
.control-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 5px 8px; margin: 10px 0 12px; }
.control-name { color: #c3d2dc; font-size: 10px; font-weight: 600; }
.control-name em { color: #698396; font-size: 9px; font-style: normal; font-weight: 500; }
.control-row output { color: #9fe3ef; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; -webkit-appearance: none; grid-column: 1 / -1; width: 100%; height: 3px; border-radius: 10px; background: linear-gradient(90deg, rgba(85,190,215,.85), rgba(75,113,136,.45)); cursor: pointer; margin: 2px 0 0; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #d5f6fb; border: 2px solid #319bb7; box-shadow: 0 0 0 3px rgba(99,214,238,.11); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #d5f6fb; border: 2px solid #319bb7; box-shadow: 0 0 0 3px rgba(99,214,238,.11); }
.control-footnote { display: flex; gap: 7px; align-items: flex-start; color: #71899b; font-size: 9px; line-height: 1.45; padding-top: 12px; }
.mini-info { width: 14px; height: 14px; flex: 0 0 14px; display: grid; place-items: center; border: 1px solid rgba(99,214,238,.4); border-radius: 50%; color: var(--cyan); font-size: 9px; font-weight: 800; }
.viewport-card { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(112,159,184,.2); border-radius: var(--radius); background: radial-gradient(ellipse at 50% 45%, rgba(25,55,75,.72), rgba(7,17,28,.94) 73%); box-shadow: 0 20px 55px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.035); }
.viewport-topline, .viewport-bottomline { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; }
.viewport-topline { min-height: 39px; border-bottom: 1px solid rgba(151,187,209,.09); }
.view-tag { display: flex; align-items: center; gap: 8px; color: #9cb6c6; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.live-pulse { width: 6px; height: 6px; }
.view-actions { display: flex; gap: 5px; }
.icon-btn { width: 27px; height: 25px; display: grid; place-items: center; border: 1px solid rgba(145,184,204,.17); border-radius: 7px; background: rgba(15,33,48,.7); color: #a8c1cf; font-size: 14px; cursor: pointer; transition: .2s; }
.icon-btn:hover { color: #e8fbff; border-color: rgba(99,214,238,.45); background: rgba(99,214,238,.1); }
#qualityToggle { font-size: 9px; font-weight: 800; letter-spacing: .05em; }
.scene-host { position: relative; flex: 1; min-height: 260px; overflow: hidden; isolation: isolate; }
.scene-host canvas { display: block; width: 100%; height: 100%; outline: none; }
.scene-loading { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; background: radial-gradient(ellipse,rgba(10,27,42,.9),rgba(6,14,23,.97)); color: #93b0c1; font-size: 10px; letter-spacing: .08em; transition: opacity .45s; }
.scene-loading.hidden { opacity: 0; pointer-events: none; }
.loading-orbit { width: 32px; height: 32px; border: 1px solid rgba(99,214,238,.2); border-top-color: var(--cyan); border-radius: 50%; animation: spin 1.2s linear infinite; box-shadow: 0 0 20px rgba(99,214,238,.12); }
@keyframes spin { to { transform: rotate(360deg); } }
.scene-label { position: absolute; z-index: 2; display: flex; align-items: center; gap: 6px; color: rgba(182,211,224,.75); font-size: 8px; font-weight: 800; letter-spacing: .14em; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.9); white-space: nowrap; }
.scene-label i { width: 15px; height: 1px; background: rgba(99,214,238,.75); box-shadow: 0 0 8px rgba(99,214,238,.7); }
.label-source { top: 11%; right: 10%; }
.label-front { top: 52%; right: 7%; }
.label-bands { top: 70%; left: 7%; }
.label-bands i { background: rgba(222,183,128,.8); }
.scene-caption { position: absolute; left: 13px; bottom: 13px; z-index: 2; max-width: 58%; color: rgba(153,183,199,.72); font-size: 9px; line-height: 1.4; pointer-events: none; }
.context-loss { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 20px; text-align: center; background: rgba(4,11,18,.88); color: #f0b5a8; font-size: 12px; }
.viewport-bottomline { min-height: 48px; border-top: 1px solid rgba(151,187,209,.09); background: rgba(7,17,28,.45); }
.timeline-readout { display: flex; align-items: baseline; gap: 10px; }
.timeline-label { color: #708a9e; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.timeline-readout strong { color: #d6edf4; font-size: 12px; font-variant-numeric: tabular-nums; }
.transport-legend { display: flex; align-items: center; gap: 11px; color: #8ba4b5; font-size: 8px; }
.transport-legend span { display: flex; align-items: center; gap: 5px; }
.transport-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-a { background: #4ecde7; box-shadow: 0 0 6px #4ecde7; }
.legend-b { background: #d7ad70; }
.legend-p { background: #f3dfb7; box-shadow: 0 0 6px #e7c88f; }
.transport-controls { min-height: 53px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 13px; border-top: 1px solid rgba(151,187,209,.09); background: rgba(6,15,24,.72); }
.playback-buttons { display: flex; gap: 6px; }
.primary-btn, .secondary-btn { min-height: 30px; padding: 0 10px; border-radius: 7px; cursor: pointer; font-size: 9px; font-weight: 750; transition: .2s; }
.primary-btn { display: flex; align-items: center; gap: 7px; border: 1px solid rgba(83,196,218,.38); background: linear-gradient(135deg,rgba(49,147,174,.34),rgba(29,93,120,.22)); color: #d7f6fa; }
.primary-btn:hover { border-color: rgba(99,214,238,.75); background: rgba(55,154,181,.4); }
.play-icon { font-size: 11px; }
.secondary-btn { border: 1px solid rgba(145,184,204,.15); background: rgba(255,255,255,.035); color: #9db3c1; }
.secondary-btn:hover { border-color: rgba(145,184,204,.38); color: #e0edf2; }
.speed-control { display: grid; grid-template-columns: auto minmax(55px,90px) auto; align-items: center; gap: 8px; color: #6f899b; font-size: 8px; font-weight: 800; letter-spacing: .11em; }
.speed-control output { color: #a7dbe5; font-size: 9px; letter-spacing: 0; min-width: 26px; }
.speed-control input[type="range"] { width: 85px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; min-height: 93px; padding: 10px 10px 9px; border: 1px solid rgba(145,184,204,.11); border-radius: 10px; background: linear-gradient(145deg,rgba(27,48,64,.65),rgba(11,26,40,.68)); }
.metric-primary { grid-column: 1 / -1; min-height: 108px; border-color: rgba(99,214,238,.2); background: linear-gradient(145deg,rgba(25,72,87,.36),rgba(11,29,43,.74)); }
.metric-top { display: flex; justify-content: space-between; gap: 5px; color: #7893a6; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.metric-unit { color: #5f7a8c; font-size: 8px; font-weight: 650; letter-spacing: 0; text-align: right; }
.metric-value { margin-top: 7px; color: #e1f3f6; font-size: 25px; line-height: 1; font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-primary .metric-value { color: #9ee8f2; font-size: 31px; }
.metric-note { margin-top: 5px; color: #70899b; font-size: 8px; }
.metric-bar, .chemistry-track { height: 3px; margin-top: 9px; overflow: hidden; border-radius: 5px; background: rgba(132,169,190,.12); }
.metric-bar i, .chemistry-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#3fa9c4,#8ce4e9); box-shadow: 0 0 9px rgba(99,214,238,.45); transition: width .3s; }
.chemistry-card, .validation-card { margin-top: 9px; padding: 11px 10px; border: 1px solid rgba(145,184,204,.11); border-radius: 10px; background: rgba(10,24,37,.6); }
.chemistry-head, .validation-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.state-pill { padding: 4px 6px; border: 1px solid rgba(99,214,238,.18); border-radius: 5px; background: rgba(99,214,238,.07); color: #8fd8e3; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.state-pill.active { color: #d9c18e; border-color: rgba(216,180,122,.3); background: rgba(216,180,122,.08); }
.chemistry-line { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; color: #829aab; font-size: 9px; }
.chemistry-line strong { color: #d1e0e8; font-size: 9px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chemistry-track { margin-top: 10px; }
.chemistry-track i { background: linear-gradient(90deg,#a07a4d,#e7c58d); box-shadow: 0 0 8px rgba(231,197,141,.35); }
.check-mark { color: #6d94a7; font-size: 11px; font-weight: 800; }
.check-mark.passed { color: #7bd4b2; }
.validation-title { margin-top: 8px; color: #c7d7e0; font-size: 10px; font-weight: 650; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; margin-top: 10px; }
.validation-values div { min-width: 0; }
.validation-values small { display: block; color: #6e899b; font-size: 7px; font-weight: 800; letter-spacing: .09em; }
.validation-values strong { display: block; margin-top: 4px; color: #d9e8ee; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.validation-foot { margin-top: 8px; color: #6e899b; font-size: 8px; line-height: 1.4; }
.science-panel { margin-top: 9px; border: 1px solid rgba(145,184,204,.12); border-radius: 10px; background: rgba(10,24,37,.55); }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 10px; list-style: none; cursor: pointer; color: #d4e3e9; font-size: 10px; font-weight: 700; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 5px; background: rgba(99,214,238,.1); color: var(--cyan); font-size: 12px; }
.chevron { color: #7794a7; transition: transform .2s; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 10px 12px; color: #8da4b3; font-size: 9px; line-height: 1.5; }
.science-content p { margin: 6px 0 10px; }
.science-content ul { margin: 5px 0 10px; padding-left: 16px; }
.science-content li { margin: 4px 0; }
.science-subhead { margin-top: 9px; color: #9cb5c4; font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.equation { margin-top: 7px; padding: 8px 7px; border: 1px solid rgba(99,214,238,.12); border-radius: 6px; background: rgba(99,214,238,.045); color: #c4eaf0; font-family: Georgia, "Times New Roman", serif; font-size: 12px; text-align: center; }
.disclaimer { padding-top: 8px; border-top: 1px solid var(--line); color: #7f9aaa; font-style: italic; }
.footerbar { min-height: 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #50697b; font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.footerbar b { color: #7da6b9; font-weight: 800; }
.embed-mode .app-shell { padding: 0; }
.embed-mode .topbar, .embed-mode .footerbar { display: none; }
.embed-mode .workspace { padding: 0; gap: 0; }
.embed-mode .viewport-card { border: 0; border-radius: 0; }
.embed-mode .scene-host { min-height: 0; }
@media (max-width: 1100px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .workspace { grid-template-columns: minmax(210px,235px) minmax(340px,1fr) minmax(215px,235px); gap: 8px; }
  .panel { padding: 12px 10px; }
  .topbar { grid-template-columns: 205px minmax(0,1fr) 135px; gap: 10px; }
  .topbar-center h1 { font-size: 16px; }
  .transport-legend { gap: 7px; }
}
@media (max-width: 860px) {
  html, body { overflow: auto; min-height: 100%; }
  .app-shell { min-height: 100%; height: auto; padding: 0 10px 10px; }
  .topbar { height: auto; min-height: 65px; grid-template-columns: 1fr auto; gap: 8px; }
  .brand-lockup { grid-column: 1; }
  .topbar-center { grid-column: 1 / -1; grid-row: 2; padding: 0 0 9px; }
  .topbar-center h1 { white-space: normal; font-size: 17px; }
  .topbar-status { grid-column: 2; grid-row: 1; }
  .workspace { display: flex; flex-direction: column; min-height: 0; padding: 9px 0; gap: 9px; }
  .viewport-card { order: 0; min-height: 480px; height: min(64vh, 560px); }
  .controls-panel { order: 1; overflow: visible; }
  .data-panel { order: 2; overflow: visible; }
  .panel-heading { margin-bottom: 10px; }
  .preset-grid { grid-template-columns: repeat(3,1fr); }
  .preset-btn { align-items: flex-start; padding: 7px 6px; gap: 6px; }
  .preset-swatch { width: 18px; height: 22px; flex-basis: 18px; }
  .preset-btn b { font-size: 9px; }
  .preset-btn small { font-size: 8px; }
  .control-group { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .control-group > .section-label { grid-column: 1 / -1; }
  .control-row { margin: 9px 0 10px; }
  .control-footnote { padding-bottom: 2px; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .metric-primary { grid-column: span 2; }
  .footerbar { flex-wrap: wrap; justify-content: center; padding: 4px 0; text-align: center; }
}
@media (max-width: 480px) {
  .app-shell { padding: 0 7px 8px; }
  .topbar { min-height: 58px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
  .brand-title { font-size: 10px; }
  .topbar-status { font-size: 8px; }
  .topbar-center h1 { font-size: 16px; line-height: 1.25; }
  .topbar-center h1 span { display: block; margin-top: 2px; font-size: .76em; }
  .viewport-card { min-height: 420px; height: 53vh; }
  .viewport-topline, .viewport-bottomline { padding-left: 9px; padding-right: 9px; }
  .view-tag { font-size: 8px; }
  .scene-label { font-size: 7px; }
  .label-source { right: 4%; top: 9%; }
  .label-front { right: 2%; top: 52%; }
  .label-bands { left: 3%; top: 72%; }
  .scene-caption { max-width: 65%; left: 9px; bottom: 8px; font-size: 8px; }
  .transport-controls { align-items: flex-start; flex-direction: column; gap: 8px; padding: 8px 9px; }
  .playback-buttons { width: 100%; }
  .primary-btn, .secondary-btn { flex: 1; justify-content: center; }
  .speed-control { width: 100%; grid-template-columns: auto 1fr auto; }
  .speed-control input[type="range"] { width: 100%; }
  .transport-legend { gap: 7px; font-size: 7px; }
  .timeline-label { font-size: 7px; }
  .timeline-readout strong { font-size: 11px; }
  .control-group { column-gap: 10px; }
  .preset-grid { gap: 4px; }
  .preset-btn { flex-direction: column; gap: 4px; }
  .preset-swatch { width: 100%; height: 9px; flex-basis: 9px; }
  .metric-card { padding: 9px 8px; }
  .metric-value { font-size: 22px; }
  .metric-primary .metric-value { font-size: 28px; }
  .footerbar { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
