:root {
  color-scheme: dark;
  --bg: #080d14;
  --panel: #101822;
  --panel-2: #121d28;
  --line: rgba(164, 185, 205, .13);
  --line-strong: rgba(164, 185, 205, .22);
  --text: #edf2f6;
  --muted: #8d9aa8;
  --faint: #627181;
  --accent: #ff8a45;
  --accent-2: #ffc16d;
  --cyan: #70c6d2;
  --green: #9ad2a8;
  --radius: 14px;
  --space: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(ellipse at 52% -15%, rgba(38, 57, 75, .38), transparent 50%), var(--bg); color: var(--text); }
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: min(1600px, 100%); margin: 0 auto; padding: 0 28px 18px; }

.site-header { min-height: 70px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 16px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 29px; height: 29px; border: 1px solid rgba(255, 155, 88, .48); border-radius: 9px; position: relative; display: flex; align-items: end; justify-content: center; gap: 2px; padding: 6px 5px; background: linear-gradient(145deg, rgba(255, 129, 57, .18), rgba(255, 129, 57, .015)); }
.brand-mark span { display: block; width: 4px; border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, #ffc17b, #e65d2c); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .7; }
.brand-mark span:nth-child(2) { height: 14px; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .82; }
.brand-name { font-size: 11px; letter-spacing: .15em; font-weight: 800; }
.brand-name span { color: #8998a8; font-weight: 500; letter-spacing: .11em; }
.brand-subtitle { margin-top: 4px; color: #667586; font-size: 8px; font-weight: 700; letter-spacing: .19em; }
.header-meta { display: flex; align-items: center; gap: 10px; }
.field-chip, .seed-chip { border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; color: #c8d1d9; font-size: 9px; letter-spacing: .11em; font-weight: 800; white-space: nowrap; }
.field-chip span { color: var(--muted); font-weight: 600; margin-left: 5px; }
.seed-chip { color: var(--muted); font-weight: 600; }
.seed-chip strong { color: #e8edf1; margin-left: 5px; font-variant-numeric: tabular-nums; }

.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 25px 0 19px; }
.eyebrow { display: flex; align-items: center; gap: 7px; color: #8a9aa9; font-size: 9px; letter-spacing: .16em; font-weight: 800; }
.eyebrow-dot, .live-pulse, .state-dot { width: 6px; height: 6px; border-radius: 50%; background: #f28b4d; box-shadow: 0 0 12px rgba(242, 139, 77, .55); }
h1 { margin: 8px 0 6px; font-size: clamp(22px, 2.3vw, 31px); line-height: 1.15; letter-spacing: -.045em; font-weight: 740; }
h1 span { color: #9ba8b5; font-weight: 450; }
.intro-copy { max-width: 770px; margin: 0; color: #8d9aa8; font-size: 12px; line-height: 1.6; }
.model-state { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(116, 192, 151, .18); border-radius: 7px; color: #a7cdb4; font-size: 9px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; margin-bottom: 3px; }
.model-state.paused { color: #d9b78b; border-color: rgba(217, 183, 139, .22); }
.model-state.paused .state-dot { background: #d9b78b; box-shadow: none; }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 352px; gap: 14px; align-items: stretch; }
.visual-column { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.viewport-panel, .control-panel, .telemetry-card, .science-details { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(20, 31, 43, .96), rgba(12, 19, 28, .98)); border-radius: var(--radius); overflow: hidden; }
.viewport-panel { min-height: 515px; display: flex; flex-direction: column; position: relative; }
.viewport-topline, .viewport-bottomline { height: 43px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: rgba(9, 15, 22, .74); position: relative; z-index: 2; }
.viewport-topline { border-bottom: 1px solid var(--line); }
.view-label { display: flex; align-items: center; gap: 8px; color: #c4d0db; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.live-pulse { width: 5px; height: 5px; background: #f08b4a; }
.viewport-tools { display: flex; gap: 6px; }
.icon-button { width: 29px; height: 29px; display: grid; place-items: center; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; color: #9caab7; transition: background .18s, color .18s, border-color .18s; }
.icon-button:hover { color: #fff; background: rgba(255,255,255,.07); border-color: var(--line-strong); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.scene-host { flex: 1 1 auto; min-height: 420px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 48% 50%, #172432, #0a1119 70%); }
.scene-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.scene-loading { position: absolute; z-index: 3; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; background: rgba(8,13,20,.9); color: #8595a4; font-size: 9px; font-weight: 800; letter-spacing: .15em; transition: opacity .3s; }
.scene-loading.loaded { opacity: 0; pointer-events: none; }
.loading-ring { width: 27px; height: 27px; border: 2px solid rgba(255, 145, 75, .18); border-top-color: #f08c4c; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scene-error, .context-message { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 80%; padding: 13px 16px; border: 1px solid rgba(245, 132, 81, .28); border-radius: 9px; background: rgba(20, 13, 12, .94); color: #f4c09e; font-size: 11px; line-height: 1.55; text-align: center; }
.context-message { top: 18px; transform: translateX(-50%); max-width: none; color: #f2d5a9; border-color: rgba(242, 213, 169, .25); }
.scene-legend { position: absolute; top: 14px; left: 14px; display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 10px; background: rgba(8, 13, 20, .68); border: 1px solid rgba(255,255,255,.07); border-radius: 6px; color: #aebac5; font-size: 8px; letter-spacing: .1em; font-weight: 800; pointer-events: none; }
.scene-legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-magma { background: #ff6731; box-shadow: 0 0 8px #ff6731; }
.legend-gas { background: #ffc06b; box-shadow: 0 0 8px #ffc06b; }
.legend-line { width: 13px; border-top: 1px dashed #f08b4b; display: inline-block; }
.scene-scale { position: absolute; right: 14px; bottom: 14px; padding: 7px 9px; border-radius: 5px; background: rgba(8, 13, 20, .72); border: 1px solid rgba(255,255,255,.07); color: #c3ced7; font-size: 8px; letter-spacing: .1em; font-weight: 800; text-align: right; pointer-events: none; }
.scene-scale span { display: block; margin-top: 4px; color: #788897; font-size: 7px; font-weight: 600; }
.viewport-bottomline { border-top: 1px solid var(--line); gap: 12px; }
.cause-chain { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 9px; white-space: nowrap; }
.cause-chain span { color: #71808f; font-size: 7px; letter-spacing: .1em; font-weight: 800; }
.cause-chain b { color: #c6d0d8; font-size: 9px; font-weight: 600; }
.cause-chain i { color: #d27c4c; font-style: normal; }
.orbit-hint { color: #6f7e8c; font-size: 8px; letter-spacing: .08em; white-space: nowrap; }
.mouse-icon { color: #9eabb7; font-size: 13px; vertical-align: -1px; margin-right: 4px; }

.telemetry-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.telemetry-card { padding: 12px 13px 11px; min-width: 0; border-radius: 11px; }
.telemetry-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: #8795a3; font-size: 8px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.readout-tag { color: #a17d64; font-size: 7px; letter-spacing: .08em; }
.telemetry-value { margin-top: 9px; display: flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.telemetry-value strong { font-size: clamp(19px, 2vw, 25px); letter-spacing: -.045em; font-weight: 650; }
.telemetry-value small { color: #9ca9b5; font-size: 10px; }
.telemetry-foot { margin-top: 4px; color: #657483; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.waveform { width: 100%; height: 28px; margin-top: 4px; overflow: visible; }
.waveform path { fill: none; stroke: #f08b4b; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(240,139,75,.38)); }
.telemetry-wave-card .telemetry-value { margin-top: 6px; }
.telemetry-wave-card .telemetry-value strong { font-size: 22px; }

.control-panel { padding: 16px 16px 13px; display: flex; flex-direction: column; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 5px 0 0; font-size: 16px; letter-spacing: -.025em; font-weight: 650; }
.panel-index { color: #627181; font-size: 8px; letter-spacing: .12em; font-weight: 800; padding-top: 3px; }
.section-label { color: #7e8d9b; font-size: 8px; letter-spacing: .14em; font-weight: 850; }
.preset-section { padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.preset-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 9px; }
.preset-button { min-height: 54px; display: flex; align-items: center; gap: 7px; text-align: left; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); color: #aab6c1; font-size: 8px; line-height: 1.35; cursor: pointer; transition: .16s ease; }
.preset-button:hover { border-color: rgba(255, 153, 91, .38); background: rgba(255, 153, 91, .055); }
.preset-button.active { border-color: rgba(255, 153, 91, .56); background: linear-gradient(135deg, rgba(255, 135, 70, .15), rgba(255, 135, 70, .035)); color: #f1d1b8; }
.preset-icon { flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px; background: rgba(255,255,255,.05); font-size: 13px; color: #d69a70; }
.resonance-icon { color: #ffc27c; }
.pulse-icon { color: #f07a4b; }
.preset-description { margin: 7px 0 0; color: #6f7f8e; font-size: 9px; line-height: 1.4; min-height: 13px; }
.control-section { padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.range-control { margin-top: 11px; }
.range-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.range-heading label { color: #c3cdd6; font-size: 10px; font-weight: 550; }
.range-heading output { color: #f0b184; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 4px 0 0; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(235, 126, 69, .72), rgba(117, 133, 147, .38)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(235, 126, 69, .72), rgba(117, 133, 147, .38)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; border: 2px solid #ffe0c2; background: #e77c43; box-shadow: 0 0 0 3px rgba(231,124,67,.16); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #ffe0c2; background: #e77c43; box-shadow: 0 0 0 3px rgba(231,124,67,.16); }
.range-limits { display: flex; justify-content: space-between; color: #596978; font-size: 7px; letter-spacing: .03em; margin-top: -1px; }
.last-control-section { border-bottom: 0; padding-bottom: 8px; }
.transport-section { padding-top: 12px; border-top: 1px solid var(--line); margin-top: auto; }
.transport-main { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; margin-top: 9px; }
.transport-button { min-height: 34px; display: flex; justify-content: center; align-items: center; gap: 5px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.025); color: #b7c2cc; font-size: 8px; letter-spacing: .09em; font-weight: 800; cursor: pointer; transition: .16s ease; }
.transport-button:hover { background: rgba(255,255,255,.07); color: #fff; }
.transport-button.primary { background: linear-gradient(135deg, #f08b4b, #b9572e); border-color: rgba(255, 183, 130, .4); color: #190e08; }
.transport-button.primary:hover { filter: brightness(1.1); }
.transport-button span:first-child { font-size: 13px; }
.speed-row, .quality-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.speed-row > span, .quality-row > span { color: #778696; font-size: 8px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.speed-buttons, .quality-buttons { display: flex; gap: 3px; }
.speed-buttons button, .quality-buttons button { min-width: 29px; height: 24px; border: 1px solid transparent; border-radius: 5px; background: rgba(255,255,255,.035); color: #8392a0; font-size: 8px; cursor: pointer; }
.quality-buttons button { min-width: 43px; }
.speed-buttons button.active, .quality-buttons button.active { color: #ffd0a7; border-color: rgba(240, 139, 75, .34); background: rgba(240, 139, 75, .12); }

.science-section { margin-top: 14px; }
.science-details { border-radius: 12px; }
.science-details summary { min-height: 65px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.science-details summary::-webkit-details-marker { display: none; }
.science-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: rgba(112, 198, 210, .08); border: 1px solid rgba(112, 198, 210, .16); color: var(--cyan); font-size: 19px; }
.science-details summary b { display: block; font-size: 12px; font-weight: 700; }
.science-details summary small { display: block; margin-top: 3px; color: #798897; font-size: 9px; }
.summary-status { margin-left: auto; color: #7e8d9b; font-size: 8px; letter-spacing: .13em; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.summary-status i { font-size: 15px; font-style: normal; color: #a8b5c0; }
.science-details[open] .summary-status i { transform: rotate(45deg); }
.science-content { border-top: 1px solid var(--line); padding: 18px 16px 20px; }
.science-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; }
.science-block h3 { margin: 7px 0 7px; font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.science-block p { margin: 0 0 8px; max-width: 650px; color: #9aa7b3; font-size: 10px; line-height: 1.65; }
.equation, .validation-equation { margin: 8px 0; padding: 9px 11px; border-radius: 7px; border: 1px solid rgba(112, 198, 210, .13); background: rgba(112, 198, 210, .035); color: #c4e2e5; font-size: 11px; font-family: Georgia, "Times New Roman", serif; letter-spacing: .02em; }
.equation span { color: #df9666; margin: 0 5px; }
.large-equation { font-size: 15px; color: #f0c59e; }
.variable-note { font-size: 9px !important; }
.validation-equation { font-size: 15px; text-align: center; color: #f2c69f; }
.validation-table { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.validation-table > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.validation-table > div:last-child { border-bottom: 0; }
.validation-table span { color: #82919e; font-size: 8px; letter-spacing: .09em; font-weight: 800; }
.validation-table b { color: #d7e0e7; font-size: 10px; font-variant-numeric: tabular-nums; }
.validation-table b.validation-good { color: #a6d2b0; }
.validation-foot { margin-top: 7px !important; color: #758493 !important; font-size: 8px !important; }
.science-list { margin: 8px 0 0; padding-left: 15px; color: #9aa7b3; font-size: 10px; line-height: 1.8; }
.model-label { margin-top: 12px !important; color: #d09a70 !important; font-size: 8px !important; font-weight: 800; letter-spacing: .1em; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px 2px 0; color: #5e6c79; font-size: 8px; letter-spacing: .08em; }
.site-footer span:last-child { text-align: right; letter-spacing: 0; }

.embed-mode .site-header, .embed-mode .intro-row, .embed-mode .site-footer { display: none; }
.embed-mode .app-shell { padding: 0; }
.embed-mode main { padding: 0; }
.embed-mode .workbench { grid-template-columns: minmax(0, 1fr) 330px; }
.embed-mode .science-section { margin-top: 8px; }

@media (max-width: 1120px) {
  .app-shell { padding: 0 18px 16px; }
  .workbench { grid-template-columns: minmax(0, 1fr) 320px; gap: 10px; }
  .control-panel { padding: 14px 13px 12px; }
  .viewport-panel { min-height: 480px; }
  .scene-host { min-height: 390px; }
  .telemetry-card { padding: 10px; }
  .telemetry-head { font-size: 7px; }
  .readout-tag { font-size: 6px; }
  .cause-chain { gap: 5px; }
  .orbit-hint { display: none; }
}

@media (max-width: 860px) {
  .workbench { grid-template-columns: 1fr; }
  .control-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .panel-heading { grid-column: 1 / -1; }
  .preset-section { grid-column: 1 / -1; }
  .control-section { min-width: 0; }
  .transport-section { grid-column: 1 / -1; }
  .viewport-panel { min-height: 470px; }
  .scene-host { min-height: 380px; }
  .science-grid { gap: 18px; }
}

@media (max-width: 600px) {
  .app-shell { padding: 0 10px 14px; }
  .site-header { min-height: 58px; }
  .brand-name { font-size: 9px; }
  .brand-subtitle { font-size: 7px; }
  .brand-mark { width: 25px; height: 25px; }
  .header-meta { gap: 5px; }
  .field-chip, .seed-chip { padding: 6px 7px; font-size: 7px; }
  .field-chip span { display: none; }
  .seed-chip strong { margin-left: 3px; }
  .intro-row { padding: 17px 0 13px; display: block; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 22px; line-height: 1.22; margin-top: 7px; }
  h1 span { display: block; font-size: 17px; margin-top: 2px; }
  .intro-copy { font-size: 10px; line-height: 1.5; }
  .model-state { display: inline-flex; margin-top: 10px; padding: 6px 8px; font-size: 8px; }
  .workbench { gap: 9px; }
  .visual-column { gap: 8px; }
  .viewport-panel { min-height: 0; }
  .viewport-topline, .viewport-bottomline { height: 36px; padding: 0 9px; }
  .view-label { font-size: 8px; }
  .scene-host { min-height: 310px; height: 40vh; max-height: 420px; }
  .scene-legend { top: 8px; left: 8px; padding: 6px 7px; gap: 7px; font-size: 6px; }
  .scene-scale { right: 8px; bottom: 8px; padding: 6px 7px; font-size: 7px; }
  .scene-scale span { font-size: 6px; }
  .cause-chain { gap: 4px; white-space: normal; }
  .cause-chain span { font-size: 6px; }
  .cause-chain b { font-size: 7px; }
  .cause-chain i { font-size: 8px; }
  .telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .telemetry-card { padding: 9px 10px 8px; border-radius: 9px; }
  .telemetry-head { font-size: 7px; }
  .readout-tag { font-size: 6px; }
  .telemetry-value { margin-top: 7px; }
  .telemetry-value strong { font-size: 21px; }
  .telemetry-foot { font-size: 7px; }
  .waveform { height: 24px; }
  .control-panel { padding: 13px 12px 12px; grid-template-columns: 1fr; }
  .panel-heading, .preset-section, .control-section, .transport-section { grid-column: 1; }
  .panel-heading h2 { font-size: 15px; }
  .preset-buttons { gap: 7px; }
  .preset-button { min-height: 52px; }
  .range-control { margin-top: 12px; }
  .range-heading label, .range-heading output { font-size: 10px; }
  .transport-main { gap: 6px; }
  .science-section { margin-top: 9px; }
  .science-details summary { min-height: 58px; padding: 10px 11px; gap: 9px; }
  .science-symbol { width: 30px; height: 30px; }
  .science-details summary small { font-size: 8px; }
  .summary-status { font-size: 7px; gap: 5px; }
  .science-content { padding: 14px 12px; }
  .science-grid { grid-template-columns: 1fr; gap: 19px; }
  .science-block h3 { font-size: 13px; }
  .science-block p, .science-list { font-size: 9px; }
  .site-footer { display: block; padding-top: 12px; font-size: 7px; line-height: 1.6; }
  .site-footer span { display: block; }
  .site-footer span:last-child { text-align: left; margin-top: 4px; }
  .embed-mode .workbench { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
