:root {
  color-scheme: dark;
  --bg: #080d17;
  --panel: #0d1421;
  --panel-raised: #111b2b;
  --panel-soft: #101927;
  --line: rgba(148, 171, 197, 0.14);
  --line-strong: rgba(148, 171, 197, 0.24);
  --text: #edf3f8;
  --muted: #8b9aab;
  --subtle: #5e6e80;
  --cyan: #62d4e8;
  --cyan-soft: rgba(98, 212, 232, 0.13);
  --orange: #ff9857;
  --green: #83d9bd;
  --danger: #ff735e;
  --radius: 12px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow: hidden; }
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 { min-height: 100vh; height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 38% 28%, rgba(24, 46, 68, 0.28), transparent 52%), var(--bg); }
.topbar { height: 64px; flex: 0 0 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; border-bottom: 1px solid var(--line); background: rgba(7, 12, 21, 0.88); z-index: 5; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 29px; height: 29px; position: relative; border: 1px solid rgba(98, 212, 232, 0.45); border-radius: 9px; transform: rotate(45deg); display: flex; align-items: center; justify-content: center; gap: 2px; background: linear-gradient(135deg, rgba(98, 212, 232, 0.16), rgba(255, 152, 87, 0.1)); }
.brand-mark span { display: block; width: 3px; border-radius: 5px; background: var(--cyan); transform: rotate(-45deg); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .75; }
.brand-name { font-size: 11px; font-weight: 800; letter-spacing: .16em; line-height: 1.3; }
.brand-name span { color: var(--muted); font-weight: 500; letter-spacing: .1em; }
.brand-subtitle { color: var(--subtle); font-size: 8px; letter-spacing: .19em; margin-top: 3px; }
.topbar-meta { display: flex; align-items: center; gap: 11px; color: #8494a7; font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.live-dot, .status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 11px rgba(131, 217, 189, .7); }
.meta-divider { height: 15px; width: 1px; background: var(--line-strong); }

.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; flex: 1; min-height: 0; }
.visual-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 22px 24px 16px; gap: 14px; }
.scene-header { display: flex; align-items: flex-end; justify-content: space-between; min-height: 67px; gap: 16px; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: 8px; font-weight: 800; letter-spacing: .19em; line-height: 1.2; }
h1, h2, h3, p { margin-top: 0; }
.scene-header h1 { margin: 0; font-size: clamp(22px, 2vw, 29px); line-height: 1.08; letter-spacing: -.04em; font-weight: 650; }
.scene-subtitle { margin: 6px 0 0; color: #8d9caf; font-size: 12px; letter-spacing: .015em; }
.scene-badges { display: flex; align-items: center; gap: 7px; padding-bottom: 3px; }
.pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 6px 9px; font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.pill-cyan { color: var(--cyan); background: var(--cyan-soft); border: 1px solid rgba(98, 212, 232, .22); }
.pill-muted { color: #9aa7b5; background: rgba(130, 148, 167, .09); border: 1px solid var(--line); }

.scene-wrap { position: relative; flex: 1; min-height: 280px; overflow: hidden; border: 1px solid rgba(126, 156, 185, .2); border-radius: 15px; background: radial-gradient(ellipse at 51% 49%, #142337 0%, #0a1422 48%, #080d17 100%); box-shadow: var(--shadow), inset 0 0 60px rgba(0, 0, 0, .3); isolation: isolate; }
#scene-canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.scene-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(5, 10, 18, .28), transparent 22%, transparent 75%, rgba(5, 10, 18, .22)), linear-gradient(0deg, rgba(5, 10, 18, .52), transparent 24%, transparent 82%, rgba(5, 10, 18, .18)); z-index: 1; }
.scene-label { position: absolute; z-index: 2; display: flex; align-items: center; gap: 7px; color: rgba(216, 231, 241, .82); font-size: 8px; letter-spacing: .13em; font-weight: 800; text-shadow: 0 2px 8px #03070d; pointer-events: none; }
.label-line { width: 22px; height: 1px; background: var(--cyan); box-shadow: 0 0 7px rgba(98, 212, 232, .55); }
.label-gas { top: 56%; left: 8%; }
.label-slug { top: 38%; right: 7%; flex-direction: row-reverse; text-align: right; }
.label-slug .label-line { background: var(--orange); box-shadow: 0 0 7px rgba(255, 152, 87, .55); }
.label-wave { bottom: 20%; right: 9%; flex-direction: row-reverse; text-align: right; }
.label-wave .label-line { background: #78a8e9; }
.scene-scale { position: absolute; left: 18px; bottom: 17px; z-index: 2; display: flex; align-items: center; gap: 8px; color: #718397; font-size: 7px; letter-spacing: .13em; pointer-events: none; }
.scale-line { width: 28px; height: 1px; background: #70899f; }
.scene-status { position: absolute; top: 15px; left: 17px; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid rgba(148, 171, 197, .17); border-radius: 7px; background: rgba(5, 10, 18, .6); color: #8da0b4; font-size: 7px; font-weight: 800; letter-spacing: .13em; backdrop-filter: blur(8px); }
.scene-status.ready .status-dot { background: var(--green); }
.scene-status.error .status-dot { background: var(--danger); box-shadow: 0 0 9px rgba(255, 115, 94, .6); }
.context-banner { position: absolute; inset: auto 16px 56px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid rgba(255, 115, 94, .3); border-radius: 9px; background: rgba(31, 15, 19, .94); color: #f1c1b9; font-size: 11px; }
.context-banner[hidden] { display: none; }
.mini-button { padding: 7px 9px; border: 1px solid rgba(255, 152, 87, .35); border-radius: 6px; background: rgba(255, 152, 87, .1); color: #ffc092; font-size: 8px; font-weight: 800; letter-spacing: .1em; cursor: pointer; }
.scene-tools { position: absolute; right: 15px; top: 14px; z-index: 3; display: flex; gap: 6px; }
.icon-button { width: 32px; height: 32px; border: 1px solid rgba(148, 171, 197, .22); border-radius: 8px; background: rgba(6, 12, 21, .58); color: #d6e1eb; font-size: 17px; cursor: pointer; backdrop-filter: blur(8px); transition: background .18s, border-color .18s, transform .18s; }
.icon-button:hover { background: rgba(98, 212, 232, .13); border-color: rgba(98, 212, 232, .45); transform: translateY(-1px); }
.scene-legend { position: absolute; right: 16px; bottom: 16px; z-index: 2; display: flex; align-items: center; gap: 13px; color: #8a9aab; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.scene-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-magma { background: #ff7134; box-shadow: 0 0 8px #ff7134; }
.legend-gas { background: #ffbd70; box-shadow: 0 0 8px #ffbd70; }
.legend-seismic { background: #7aa9e7; box-shadow: 0 0 8px #7aa9e7; }
.stage-footer { display: flex; align-items: center; justify-content: space-between; min-height: 26px; gap: 12px; }
.cause-chain { display: flex; align-items: center; gap: 10px; color: #8797a9; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.chain-step { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chain-number { color: var(--cyan); font-size: 8px; }
.chain-arrow { color: #4f667d; }
.motion-note { color: #637488; font-size: 8px; letter-spacing: .06em; }

.control-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 18px 16px; background: linear-gradient(180deg, rgba(14, 22, 35, .98), rgba(10, 16, 27, .98)); border-left: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: #334355 transparent; }
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: #334355; border-radius: 99px; }
.panel-section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h2, .validation-head h2 { margin: 0; font-size: 15px; font-weight: 620; letter-spacing: -.025em; }
.tiny-tag { color: #8193a7; font-size: 7px; font-weight: 800; letter-spacing: .12em; border: 1px solid var(--line); border-radius: 5px; padding: 5px 6px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-card { min-width: 0; padding: 11px 11px 9px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(135deg, rgba(23, 35, 52, .76), rgba(14, 22, 34, .8)); }
.metric-featured { background: linear-gradient(135deg, rgba(25, 54, 70, .58), rgba(14, 26, 40, .85)); border-color: rgba(98, 212, 232, .2); }
.metric-label { display: flex; justify-content: space-between; gap: 4px; color: #8d9daf; font-size: 7px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.metric-unit { color: #667b90; font-weight: 600; }
.metric-value { margin: 8px 0 5px; color: #f2f7fb; font-size: 23px; font-weight: 560; letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1; }
.metric-featured .metric-value { color: #9de8f1; }
.metric-foot { color: #65788c; font-size: 6px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.text-button { border: 0; background: transparent; color: var(--cyan); font-size: 7px; font-weight: 800; letter-spacing: .12em; cursor: pointer; padding: 5px 0; }
.text-button:hover { color: #b5f4fb; }
.control-list { display: flex; flex-direction: column; gap: 13px; }
.control-row label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: #c4d0dc; font-size: 10px; }
.control-row output { color: #8fe0ec; font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { display: block; width: 100%; height: 14px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, rgba(98, 212, 232, .75), rgba(98, 212, 232, .22)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, rgba(98, 212, 232, .75), rgba(98, 212, 232, .22)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #07111c; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 2px rgba(98, 212, 232, .24), 0 0 9px rgba(98, 212, 232, .38); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #07111c; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 2px rgba(98, 212, 232, .24); }
.range-hint { display: flex; justify-content: space-between; color: #53657a; font-size: 7px; margin-top: 2px; }
.preset-section { padding-bottom: 16px; }
.preset-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.preset-button { display: flex; align-items: center; gap: 10px; padding: 8px 9px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: rgba(19, 29, 44, .62); cursor: pointer; transition: border-color .18s, background .18s; }
.preset-button:hover { border-color: rgba(98, 212, 232, .32); }
.preset-button.active { border-color: rgba(98, 212, 232, .5); background: rgba(35, 72, 87, .28); }
.preset-icon { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border-radius: 7px; font-size: 19px; background: rgba(255,255,255,.04); }
.preset-quiet { color: #a4b7c8; }
.preset-harmonic { color: var(--cyan); }
.preset-eruptive { color: var(--orange); }
.preset-button strong { display: block; color: #dbe5ed; font-size: 9px; font-weight: 700; }
.preset-button small { display: block; color: #718297; font-size: 8px; margin-top: 2px; }
.preset-description { margin: 8px 0 0; color: #78899c; font-size: 8px; line-height: 1.45; }
.transport-section { padding-bottom: 17px; }
.sim-clock { color: #92a4b6; font-size: 8px; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.transport-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 7px; }
.play-button, .transport-button { height: 35px; border-radius: 7px; font-size: 8px; font-weight: 800; letter-spacing: .1em; cursor: pointer; transition: transform .16s, border-color .16s, background .16s; }
.play-button { display: flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid rgba(98, 212, 232, .4); background: linear-gradient(135deg, rgba(36, 108, 123, .6), rgba(18, 62, 78, .7)); color: #d8f8fb; }
.play-button span:first-child { font-size: 14px; line-height: 1; }
.transport-button { border: 1px solid var(--line-strong); background: rgba(23, 34, 49, .7); color: #b6c3d0; }
.transport-button span { margin-left: 4px; color: var(--cyan); font-size: 13px; }
.play-button:hover, .transport-button:hover { transform: translateY(-1px); border-color: rgba(98, 212, 232, .55); }
.speed-row, .quality-row { display: flex; justify-content: space-between; align-items: center; margin-top: 13px; color: #75869a; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.speed-row output { color: #9ce4ed; font-size: 9px; font-variant-numeric: tabular-nums; }
.speed-slider { margin-top: 6px !important; }
.segmented { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: rgba(4, 9, 16, .35); }
.segmented button { border: 0; border-radius: 4px; padding: 5px 8px; background: transparent; color: #728397; font-size: 7px; font-weight: 800; letter-spacing: .1em; cursor: pointer; }
.segmented button.selected { background: rgba(98, 212, 232, .16); color: #9de9f1; }

.science-panel { margin: 0 0 17px; border: 1px solid var(--line); border-radius: 9px; background: rgba(16, 26, 40, .55); overflow: hidden; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary .eyebrow { margin: 0 0 4px; font-size: 7px; }
.science-panel summary strong { display: block; font-size: 12px; font-weight: 650; }
.summary-mark { color: var(--cyan); font-size: 17px; transition: transform .2s; }
.science-panel[open] .summary-mark { transform: rotate(45deg); }
.science-content { padding: 0 12px 12px; }
.science-block { padding: 10px 0; border-top: 1px solid var(--line); }
.science-block h3 { margin: 0 0 6px; color: #dce6ee; font-size: 9px; font-weight: 700; }
.science-block p, .science-block li { color: #8798aa; font-size: 8px; line-height: 1.55; }
.science-block p { margin: 0 0 7px; }
.science-block ul { padding-left: 15px; margin: 5px 0 0; }
.science-block li { margin: 3px 0; }
.equation { padding: 8px 9px; border-left: 2px solid rgba(98, 212, 232, .55); border-radius: 0 5px 5px 0; background: rgba(98, 212, 232, .06); color: #b5eaf0; font-family: Georgia, "Times New Roman", serif; font-size: 12px; letter-spacing: .015em; overflow-wrap: anywhere; }
.equation-note { margin: 6px 0 0 !important; color: #667c91 !important; font-family: Georgia, "Times New Roman", serif; font-size: 8px !important; }
.science-limitations { padding-bottom: 4px; }
.science-statement { margin: 10px 0 0; color: #667b8e; font-size: 7px; line-height: 1.5; }
.validation-panel { padding: 13px 12px 11px; border: 1px solid rgba(131, 217, 189, .18); border-radius: 9px; background: linear-gradient(135deg, rgba(25, 55, 53, .2), rgba(13, 26, 34, .52)); }
.validation-head { display: flex; align-items: center; gap: 9px; }
.validation-check { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: rgba(131, 217, 189, .13); color: var(--green); font-size: 14px; }
.validation-head .eyebrow { margin: 0 0 4px; color: var(--green); font-size: 7px; }
.validation-head h2 { font-size: 11px; }
.validation-description { margin: 9px 0 10px; color: #8293a4; font-size: 8px; line-height: 1.45; }
.validation-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.validation-values div { padding: 7px 8px; border: 1px solid rgba(131, 217, 189, .12); border-radius: 6px; background: rgba(4, 12, 17, .25); }
.validation-values span, .validation-difference span { display: block; color: #6e8e88; font-size: 6px; font-weight: 800; letter-spacing: .1em; }
.validation-values strong { display: block; margin-top: 5px; color: #c6eadd; font-size: 12px; font-variant-numeric: tabular-nums; }
.validation-difference { display: flex; align-items: center; justify-content: space-between; padding-top: 9px; margin-top: 8px; border-top: 1px solid rgba(131, 217, 189, .12); }
.validation-difference strong { color: var(--green); font-size: 11px; font-variant-numeric: tabular-nums; }
.panel-footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; color: #53667b; font-size: 6px; font-weight: 800; letter-spacing: .12em; }

@media (max-width: 1100px) {
  .main-layout { grid-template-columns: minmax(0, 1fr) 350px; }
  .visual-stage { padding-left: 18px; padding-right: 18px; }
  .control-panel { padding-left: 15px; padding-right: 15px; }
  .scene-label { font-size: 7px; }
  .cause-chain { gap: 7px; font-size: 7px; }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; }
  .topbar { height: 56px; flex-basis: 56px; padding: 0 15px; }
  .topbar-meta { font-size: 7px; gap: 7px; }
  .topbar-meta span:nth-last-child(1) { display: none; }
  .meta-divider { display: none; }
  .main-layout { display: flex; flex-direction: column; min-height: 0; }
  .visual-stage { padding: 16px 14px 12px; gap: 11px; }
  .scene-header { min-height: 58px; }
  .scene-header h1 { font-size: 22px; }
  .scene-subtitle { font-size: 10px; }
  .scene-wrap { flex: none; height: min(62vw, 430px); min-height: 290px; }
  .stage-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
  .control-panel { overflow: visible; border-left: 0; border-top: 1px solid var(--line); padding: 17px 14px 24px; }
  .metric-value { font-size: 21px; }
  .control-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .preset-grid { grid-template-columns: 1fr 1fr 1fr; }
  .preset-button { padding: 7px; gap: 6px; }
  .preset-icon { width: 25px; height: 25px; flex-basis: 25px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 7px; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 9px; }
  .brand-name span { font-size: 8px; }
  .brand-subtitle { font-size: 7px; }
  .brand-mark { width: 25px; height: 25px; }
  .topbar-meta { font-size: 6px; letter-spacing: .08em; }
  .scene-header { align-items: flex-start; }
  .scene-header h1 { font-size: 20px; }
  .scene-badges { flex-direction: column; align-items: flex-end; gap: 4px; }
  .pill { font-size: 6px; padding: 5px 7px; }
  .scene-wrap { height: 355px; min-height: 355px; }
  .label-gas { left: 5%; top: 57%; }
  .label-slug { right: 4%; top: 37%; }
  .label-wave { right: 5%; bottom: 20%; }
  .scene-label { font-size: 6px; gap: 4px; letter-spacing: .08em; }
  .label-line { width: 13px; }
  .scene-legend { left: 14px; right: auto; bottom: 38px; gap: 9px; font-size: 6px; }
  .scene-scale { left: 14px; bottom: 15px; font-size: 6px; }
  .scene-status { top: 12px; left: 12px; font-size: 6px; }
  .scene-tools { right: 10px; top: 10px; }
  .icon-button { width: 29px; height: 29px; }
  .cause-chain { flex-wrap: wrap; gap: 6px; font-size: 6px; }
  .chain-step { gap: 4px; }
  .motion-note { font-size: 7px; }
  .control-list { grid-template-columns: 1fr; gap: 14px; }
  .control-row label { font-size: 10px; }
  .preset-grid { grid-template-columns: 1fr; }
  .preset-button { padding: 8px 9px; }
  .preset-button strong { font-size: 9px; }
  .preset-button small { font-size: 8px; }
  .transport-row { grid-template-columns: 1.25fr 1fr 1fr; }
  .validation-values strong { font-size: 11px; }
  .panel-footer { font-size: 5px; }
}

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

.embed-mode .topbar { display: none; }
.embed-mode .visual-stage { padding-top: 12px; }
.embed-mode .scene-header { min-height: 55px; }
