:root {
  color-scheme: dark;
  --bg: #10171a;
  --panel: #151f23;
  --panel-2: #1a272c;
  --line: rgba(201, 220, 219, 0.11);
  --line-strong: rgba(201, 220, 219, 0.2);
  --text: #e8ece8;
  --muted: #8c9a98;
  --subtle: #61716f;
  --accent: #d6a56d;
  --accent-soft: rgba(214, 165, 109, 0.14);
  --cyan: #82c1c0;
  --green: #8bc0a1;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; 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; }
.masthead {
  height: 66px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
  background: #10171a; border-bottom: 1px solid var(--line); position: relative; z-index: 5;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 29px; height: 29px; border: 1px solid rgba(214,165,109,.45); border-radius: 8px; position: relative; display: flex; align-items: center; justify-content: center; gap: 2px; transform: rotate(-7deg); }
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--accent); }
.brand-mark span:nth-child(1) { height: 9px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; opacity: .75; }
.brand-eyebrow { color: #9ba9a5; font-size: 9px; font-weight: 750; letter-spacing: .18em; }
.brand-eyebrow span { color: var(--accent); padding: 0 3px; }
.brand-title { margin-top: 3px; font-size: 14px; font-weight: 650; letter-spacing: .015em; }
.brand-title span { color: #5b6c6b; padding: 0 3px; }
.header-meta { display: flex; align-items: center; gap: 18px; }
.header-chip { border: 1px solid var(--line-strong); border-radius: 20px; padding: 7px 11px; color: #aab6b2; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.live-dot, .tag-dot { width: 6px; height: 6px; display: inline-block; background: var(--green); border-radius: 50%; margin-right: 6px; box-shadow: 0 0 9px rgba(139,192,161,.55); }
.header-seed { color: #687875; font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.workspace { height: calc(100vh - 66px); height: calc(100dvh - 66px); display: grid; grid-template-columns: minmax(0, 1fr) 370px; min-height: 0; }
.viewer { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #8b8273; isolation: isolate; }
.canvas-host { position: absolute; inset: 0; z-index: 0; }
#simulation-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.viewer-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(14,22,24,.34) 0%, transparent 24%, transparent 58%, rgba(11,17,18,.56) 100%), linear-gradient(90deg, rgba(16,22,22,.18), transparent 35%, transparent 80%, rgba(15,20,20,.1)); }
.scene-topline { position: absolute; z-index: 2; top: 22px; left: 24px; right: 24px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scene-kicker { display: flex; align-items: center; gap: 9px; color: rgba(244,239,228,.84); font-size: 9px; font-weight: 750; letter-spacing: .16em; text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.kicker-index { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(16,25,27,.56); border: 1px solid rgba(255,255,255,.24); color: #f0c38c; font-size: 11px; }
.scene-model-tag { color: rgba(245,239,226,.83); border: 1px solid rgba(255,255,255,.28); border-radius: 20px; padding: 7px 10px; background: rgba(22,29,28,.24); font-size: 8px; letter-spacing: .13em; font-weight: 750; backdrop-filter: blur(8px); }
.scene-title-block { position: absolute; z-index: 2; left: 27px; top: 88px; pointer-events: none; text-shadow: 0 2px 16px rgba(0,0,0,.28); }
.scene-overline { color: rgba(245,238,223,.78); font-size: 8px; font-weight: 750; letter-spacing: .18em; }
.scene-title-block h1 { margin: 7px 0 2px; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(36px, 4.4vw, 58px); line-height: .98; letter-spacing: -.045em; color: #f5ebd9; }
.scene-title-block h1 em { color: #e4bd8c; font-weight: 400; }
.scene-title-block p { margin: 10px 0 0; color: rgba(248,241,227,.83); font-size: 12px; letter-spacing: .015em; }
.scene-scale { position: absolute; z-index: 2; right: 26px; bottom: 133px; display: flex; align-items: center; gap: 8px; color: rgba(242,235,221,.76); font-size: 8px; letter-spacing: .11em; font-weight: 750; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.scene-scale b { color: #f1c38d; font-size: 7px; }
.scale-line { width: 27px; height: 1px; background: #e3b987; box-shadow: 0 0 7px rgba(227,185,135,.65); }
.scene-hud { position: absolute; z-index: 2; left: 22px; right: 22px; bottom: 44px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid rgba(255,255,255,.19); border-radius: 10px; background: rgba(15,23,24,.68); backdrop-filter: blur(14px); box-shadow: 0 8px 24px rgba(0,0,0,.12); pointer-events: none; }
.hud-cell { min-width: 0; padding: 11px 13px 10px; border-right: 1px solid rgba(255,255,255,.12); }
.hud-cell:last-child { border-right: 0; }
.hud-label { display: block; color: #9eaaa5; font-size: 7px; font-weight: 750; letter-spacing: .13em; white-space: nowrap; }
.hud-cell strong { display: block; margin-top: 6px; font-size: clamp(15px, 1.5vw, 20px); line-height: 1; font-weight: 600; letter-spacing: -.035em; color: #f1e9d9; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-unit { display: block; margin-top: 6px; color: #71817c; font-size: 7px; font-weight: 650; letter-spacing: .12em; }
.viewer-bottomline { position: absolute; z-index: 2; left: 24px; right: 24px; bottom: 15px; display: flex; justify-content: space-between; align-items: center; color: rgba(242,237,223,.73); font-size: 8px; letter-spacing: .09em; pointer-events: none; }
.legend { display: flex; align-items: center; gap: 7px; }
.legend-swatch { width: 7px; height: 7px; display: inline-block; border-radius: 2px; margin-left: 5px; }
.legend-swatch.iron { background: #a75f3d; }
.legend-swatch.manganese { background: #332a25; border: 1px solid rgba(255,255,255,.3); }
.legend-swatch.biofilm { background: #d1a15d; }
.viewer-instruction { color: rgba(239,233,219,.66); font-size: 7px; font-weight: 700; letter-spacing: .12em; }
.viewer-instruction span { padding: 0 5px; opacity: .6; }
.mouse-glyph { font-size: 13px; color: #e7c08e; vertical-align: -1px; }
.annotation { position: absolute; z-index: 3; display: flex; align-items: center; gap: 7px; transform: translate(-50%,-50%); padding: 6px 8px; border-radius: 5px; border: 1px solid rgba(255,255,255,.28); background: rgba(18,25,26,.64); backdrop-filter: blur(6px); color: #f5ebd8; font-size: 8px; letter-spacing: .04em; white-space: nowrap; pointer-events: none; transition: opacity .18s ease; text-shadow: 0 1px 5px rgba(0,0,0,.3); }
.annotation-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; background: #d8a76f; box-shadow: 0 0 8px rgba(216,167,111,.8); }
.annotation.cyan .annotation-dot { background: #8ac8c4; box-shadow: 0 0 8px rgba(138,200,196,.8); }
.annotation.muted .annotation-dot { background: #d0c1a9; }
.context-overlay { position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; background: rgba(9,14,16,.68); backdrop-filter: blur(8px); }
.context-overlay[hidden] { display: none; }
.context-card { width: min(300px, calc(100% - 40px)); padding: 22px; border: 1px solid var(--line-strong); border-radius: 14px; background: #182327; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.context-icon { display: block; font-size: 28px; color: var(--accent); margin-bottom: 8px; }
.context-card strong { font-size: 14px; }
.context-card p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.control-panel { min-width: 0; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); overflow: hidden; }
.panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #39494a transparent; padding: 22px 20px 12px; }
.panel-intro { padding-bottom: 18px; }
.section-eyebrow { color: #9b8a73; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.section-eyebrow span { color: #596a66; padding: 0 4px; }
.panel-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.panel-title-row h2 { margin: 0; font-size: 17px; font-weight: 630; letter-spacing: -.03em; }
.run-state { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; color: #9bc4a7; font-size: 7px; font-weight: 800; letter-spacing: .11em; }
.run-state i { width: 5px; height: 5px; border-radius: 50%; background: #82c79b; box-shadow: 0 0 8px rgba(130,199,155,.55); }
.run-state.paused { color: #d4a66f; }
.run-state.paused i { background: #d4a66f; box-shadow: none; }
.panel-intro > p { margin: 9px 0 14px; max-width: 310px; color: #9aa8a3; font-size: 10px; line-height: 1.55; }
.mechanism-chain { display: flex; align-items: center; gap: 6px; padding: 10px 9px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 8px; }
.mechanism-chain > div:not(.chain-arrow) { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.mechanism-chain span { color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.mechanism-chain b { color: #c6d0cb; font-size: 7px; letter-spacing: .1em; }
.mechanism-chain small { color: #778681; font-size: 8px; line-height: 1.3; }
.chain-arrow { color: #5e716d; font-size: 12px; }
.panel-section { padding: 15px 0 16px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-heading > span:first-child { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.section-heading h3 { margin: 0; color: #dce3dd; font-size: 10px; font-weight: 680; letter-spacing: .015em; white-space: nowrap; }
.section-rule { height: 1px; flex: 1; background: linear-gradient(90deg, rgba(214,165,109,.25), transparent); }
.preset-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.preset-button { min-width: 0; display: flex; align-items: flex-start; gap: 6px; padding: 9px 7px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.018); text-align: left; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.preset-button:hover { border-color: rgba(214,165,109,.42); background: rgba(214,165,109,.06); }
.preset-button:active { transform: translateY(1px); }
.preset-button.active { border-color: rgba(214,165,109,.52); background: rgba(214,165,109,.10); }
.preset-icon { color: var(--accent); font-size: 14px; line-height: 1.1; }
.preset-button b { display: block; color: #dbe2dc; font-size: 8px; line-height: 1.25; white-space: nowrap; }
.preset-button small { display: block; margin-top: 4px; color: #788782; font-size: 7px; white-space: nowrap; }
.parameter-list { display: grid; gap: 13px; }
.parameter { display: block; min-width: 0; }
.parameter-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.parameter-name { color: #b8c4be; font-size: 9px; font-weight: 550; }
.parameter output { color: #e1b783; font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 3px; margin: 3px 0; border-radius: 3px; background: linear-gradient(90deg, #bd9568, #647e78); cursor: pointer; display: block; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border: 2px solid #e5c194; border-radius: 50%; background: #253438; box-shadow: 0 0 0 3px rgba(214,165,109,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #e5c194; border-radius: 50%; background: #253438; box-shadow: 0 0 0 3px rgba(214,165,109,.12); }
.range-ends { display: flex; justify-content: space-between; margin-top: 5px; color: #63736f; font-size: 7px; font-variant-numeric: tabular-nums; }
.transport-row { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 6px; }
.transport-row button, .utility-button, .quality-button { border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.025); cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.transport-row button:hover, .utility-button:hover, .quality-button:hover { border-color: rgba(130,193,192,.42); background: rgba(130,193,192,.07); }
.transport-primary { min-height: 34px; display: flex; justify-content: center; align-items: center; gap: 7px; background: #bd9365 !important; border-color: #bd9365 !important; color: #1a2423; font-size: 9px; font-weight: 800; }
.transport-primary:hover { background: #d1a575 !important; }
.transport-secondary { min-height: 34px; color: #c0ccc5; font-size: 8px; font-weight: 650; }
.transport-secondary span { color: var(--accent); font-size: 13px; vertical-align: -1px; margin-right: 3px; }
.control-icon { font-size: 12px; line-height: 1; }
.speed-control { margin-top: 15px; }
.utility-row { display: flex; gap: 6px; margin-top: 13px; }
.quality-control { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0,0,0,.1); }
.quality-button { border: 0; border-radius: 5px; padding: 5px 8px; color: #87948e; font-size: 8px; }
.quality-button.active { background: #31433f; color: #d9e4dc; }
.utility-button { flex: 1; padding: 5px 7px; color: #aab8b0; font-size: 8px; }
.utility-button span { color: var(--accent); font-size: 12px; margin-right: 3px; vertical-align: -1px; }
.quality-note { display: flex; justify-content: space-between; margin-top: 8px; color: #62726e; font-size: 7px; font-weight: 700; letter-spacing: .12em; }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.data-card { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.022); }
.data-card span { display: block; color: #85948d; font-size: 7px; font-weight: 750; letter-spacing: .11em; }
.data-card strong { display: block; margin-top: 6px; color: #e2c49e; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.data-card small { display: block; margin-top: 4px; color: #677873; font-size: 7px; }
.validation-card { padding: 11px; border: 1px solid rgba(139,192,161,.2); border-radius: 8px; background: rgba(139,192,161,.035); }
.validation-head { display: flex; align-items: center; gap: 8px; }
.validation-check { width: 18px; height: 18px; display: inline-flex; justify-content: center; align-items: center; flex-shrink: 0; border-radius: 50%; background: rgba(139,192,161,.15); color: #a4d0b1; font-size: 11px; }
.validation-head b { display: block; color: #d5e2d8; font-size: 9px; }
.validation-head small { display: block; margin-top: 3px; color: #789084; font-size: 7px; letter-spacing: .08em; }
.validation-label { margin-left: auto; color: #91c3a1; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.validation-values { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin-top: 12px; padding: 9px 0; border-top: 1px solid rgba(139,192,161,.13); border-bottom: 1px solid rgba(139,192,161,.13); }
.validation-values small { display: block; color: #71857a; font-size: 6px; font-weight: 750; letter-spacing: .1em; }
.validation-values strong { display: block; margin-top: 5px; color: #d9e5d9; font-size: 10px; font-variant-numeric: tabular-nums; }
.validation-foot { display: flex; justify-content: space-between; margin-top: 8px; color: #789084; font-size: 7px; }
.validation-foot b { color: #b4c9b8; font-weight: 650; }
.validation-card > p { margin: 9px 0 0; color: #85958c; font-size: 8px; line-height: 1.5; }
.science-section { padding-bottom: 10px; }
.science-toggle { width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.025); text-align: left; cursor: pointer; }
.science-toggle:hover { border-color: rgba(214,165,109,.4); background: rgba(214,165,109,.045); }
.science-toggle-icon { width: 25px; height: 25px; display: inline-flex; justify-content: center; align-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-family: Georgia,serif; font-size: 17px; }
.science-toggle b { display: block; color: #dce4de; font-size: 9px; }
.science-toggle small { display: block; margin-top: 3px; color: #7d8d87; font-size: 7px; }
.science-chevron { margin-left: auto; color: #91a19a; font-size: 16px; transition: transform .18s ease; }
.science-toggle[aria-expanded="true"] .science-chevron { transform: rotate(180deg); }
.science-details { padding: 8px 2px 2px; }
.science-details[hidden] { display: none; }
.equation-block { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.equation-block > span { display: block; color: #b18e68; font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.equation-block code { display: block; margin-top: 7px; color: #e0e8e0; font-family: Georgia,serif; font-size: 12px; line-height: 1.5; white-space: normal; }
.equation-block p, .science-defs p { margin: 6px 0 0; color: #8b9a93; font-size: 8px; line-height: 1.55; }
.science-defs { padding: 10px 8px 3px; }
.science-defs > b { color: #c6d2c9; font-size: 8px; }
.science-defs ul { margin: 6px 0 0; padding-left: 15px; color: #8b9a93; font-size: 8px; line-height: 1.55; }
.science-defs li { margin: 3px 0; }
.model-disclaimer { margin: 11px 7px 2px; padding: 8px; border-left: 2px solid #a9855d; background: rgba(214,165,109,.055); color: #b6a38a; font-size: 8px; line-height: 1.45; }
.panel-footer { display: flex; justify-content: space-between; padding: 12px 0 8px; border-top: 1px solid var(--line); color: #596a65; font-size: 7px; font-weight: 750; letter-spacing: .12em; }
.embed-mode .masthead { display: none; }
.embed-mode .workspace { height: 100vh; height: 100dvh; }

@media (max-width: 1040px) {
  .workspace { grid-template-columns: minmax(0,1fr) 340px; }
  .panel-scroll { padding-left: 16px; padding-right: 16px; }
  .scene-hud { left: 15px; right: 15px; }
  .hud-cell { padding-left: 9px; padding-right: 9px; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .masthead { height: 58px; padding: 0 14px; }
  .brand-title { font-size: 12px; }
  .brand-eyebrow { font-size: 8px; }
  .header-chip { padding: 6px 8px; font-size: 7px; }
  .header-seed { display: none; }
  .workspace { height: auto; min-height: calc(100dvh - 58px); display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(410px, 54svh) auto; }
  .viewer { min-height: 410px; }
  .control-panel { overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { height: auto; max-height: none; overflow: visible; padding: 19px 16px 12px; }
  .scene-topline { top: 14px; left: 14px; right: 14px; }
  .scene-title-block { top: 66px; left: 17px; }
  .scene-title-block h1 { font-size: clamp(34px, 10vw, 46px); }
  .scene-title-block p { font-size: 10px; }
  .scene-overline { font-size: 7px; }
  .scene-model-tag { font-size: 7px; padding: 6px 8px; }
  .scene-hud { left: 10px; right: 10px; bottom: 40px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hud-cell { padding: 8px 9px; border-bottom: 1px solid rgba(255,255,255,.1); }
  .hud-cell:nth-child(2) { border-right: 0; }
  .hud-cell:nth-child(3), .hud-cell:nth-child(4) { border-bottom: 0; }
  .hud-cell strong { font-size: 15px; }
  .hud-label { font-size: 6px; }
  .hud-unit { margin-top: 4px; font-size: 6px; }
  .scene-scale { right: 13px; bottom: 150px; font-size: 7px; }
  .viewer-bottomline { left: 13px; right: 13px; bottom: 12px; }
  .legend { gap: 4px; font-size: 6px; }
  .legend-swatch { margin-left: 2px; }
  .viewer-instruction { font-size: 6px; }
  .annotation { font-size: 7px; padding: 5px 6px; }
  .embed-mode .workspace { grid-template-rows: minmax(360px, 52svh) auto; }
}
@media (max-width: 390px) {
  .brand-mark { width: 25px; height: 25px; }
  .brand-lockup { gap: 8px; }
  .header-chip { letter-spacing: .07em; }
  .scene-kicker { font-size: 7px; }
  .scene-hud { bottom: 39px; }
  .hud-cell { padding: 7px; }
  .hud-cell strong { font-size: 14px; }
  .viewer-instruction { letter-spacing: .06em; }
  .preset-button { padding: 8px 5px; gap: 4px; }
  .preset-button b { font-size: 7px; }
  .preset-button small { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
