:root {
  color-scheme: dark;
  --bg: #07111b;
  --panel: #0d1a26;
  --panel-2: #10202d;
  --line: rgba(152, 184, 204, .14);
  --line-strong: rgba(152, 184, 204, .24);
  --text: #e5eef4;
  --muted: #8ea2b2;
  --dim: #627989;
  --cyan: #63d7f5;
  --ice: #a6edff;
  --amber: #e9b978;
  --green: #77d9bd;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; 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 { min-width: 320px; }
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; display: flex; flex-direction: column; background: radial-gradient(ellipse at 22% -10%, rgba(37, 86, 111, .16), transparent 40%), var(--bg); }
.topbar { min-height: 68px; padding: 12px 22px; display: grid; grid-template-columns: 220px minmax(0, 1fr) 220px; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: rgba(6, 15, 24, .82); }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 29px; height: 29px; position: relative; display: flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid rgba(99, 215, 245, .35); border-radius: 8px; background: linear-gradient(145deg, rgba(99, 215, 245, .13), rgba(99, 215, 245, .015)); }
.brand-mark span { width: 3px; border-radius: 3px; background: var(--cyan); display: block; transform: skewY(-25deg); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 11px; opacity: .72; }
.brand-name { font-size: 11px; font-weight: 800; letter-spacing: .17em; color: #e9f3f8; }
.brand-name span { color: var(--cyan); padding: 0 2px; }
.brand-sub { margin-top: 3px; color: var(--dim); font-size: 8px; letter-spacing: .19em; font-weight: 700; }
.title-lockup { min-width: 0; text-align: center; }
.eyebrow { font-size: 8px; letter-spacing: .2em; color: #7f9bad; font-weight: 700; }
.eyebrow span { color: var(--cyan); padding: 0 5px; }
h1 { margin: 4px 0 0; font-size: clamp(17px, 1.65vw, 22px); letter-spacing: -.035em; font-weight: 650; }
h1 span { color: var(--cyan); font-weight: 400; }
.top-meta { display: flex; justify-content: flex-end; gap: 7px; align-items: center; }
.seed-chip, .webgl-chip { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 9px; letter-spacing: .08em; white-space: nowrap; }
.seed-chip strong { margin-left: 5px; color: #d9e7ee; font-variant-numeric: tabular-nums; }
.webgl-chip { color: #a9c5d4; }
.webgl-chip i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 5px; box-shadow: 0 0 9px rgba(119, 217, 189, .65); }
.cause-strip { min-height: 47px; display: flex; align-items: center; justify-content: center; gap: clamp(10px, 2vw, 30px); padding: 7px 18px; border-bottom: 1px solid var(--line); background: rgba(10, 23, 34, .75); }
.cause-step { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.cause-step > span:not(.step-index) { color: #7390a2; font-size: 8px; letter-spacing: .13em; font-weight: 800; }
.cause-step strong { color: #c6d7e0; font-size: 10px; font-weight: 550; }
.step-index { color: var(--cyan); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; opacity: .85; }
.cause-arrow { color: #3c7187; font-size: 14px; }
.strip-note { margin-left: auto; color: #5f8193; font-size: 8px; letter-spacing: .14em; white-space: nowrap; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 12px; padding: 12px; }
.visual-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.viewport-wrap { min-height: 360px; flex: 1; display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: #07111b; box-shadow: 0 14px 36px rgba(0, 0, 0, .22); }
.viewport { flex: 1; min-height: 300px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 48% 40%, #102a3b 0%, #091723 57%, #07111b 100%); }
.simulation-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.scene-topline { position: absolute; z-index: 3; top: 13px; left: 15px; right: 15px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scene-kicker, .scene-scale { font-size: 8px; letter-spacing: .16em; color: #8ba7b8; font-weight: 800; text-shadow: 0 1px 8px #07111b; }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(119, 217, 189, .7); }
.scene-scale strong { color: var(--ice); margin-left: 5px; }
.scene-legend { position: absolute; z-index: 3; top: 39px; left: 15px; display: flex; gap: 13px; pointer-events: none; color: #91a7b5; font-size: 9px; text-shadow: 0 1px 7px #07111b; }
.scene-legend span { display: flex; align-items: center; gap: 5px; }
.scene-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.legend-soil { background: #9a805e; }
.legend-water { background: #3aa7cb; }
.legend-ice { background: #a6edff; box-shadow: 0 0 7px rgba(166, 237, 255, .65); }
.annotation-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.scene-annotation { position: absolute; left: 0; top: 0; padding: 5px 7px; border: 1px solid rgba(116, 204, 231, .36); border-radius: 4px; background: rgba(5, 17, 27, .76); color: #bcecff; font-size: 8px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; transform-origin: top left; transition: opacity .15s ease; text-shadow: none; }
.annotation-front { border-color: rgba(233, 185, 120, .35); color: #f0c994; }
.viewport-toolbar { min-height: 43px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line); background: #0a1722; }
.run-state { display: flex; align-items: center; gap: 8px; min-width: 0; color: #9db0bd; font-size: 8px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #718594; }
.status-dot.is-running { background: var(--green); box-shadow: 0 0 8px rgba(119, 217, 189, .7); }
.toolbar-divider { height: 13px; width: 1px; background: var(--line-strong); margin: 0 3px; }
.time-label { color: #637d8d; }
.run-state strong { color: #e0edf3; font-size: 10px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.toolbar-actions { display: flex; align-items: center; gap: 5px; }
.tool-button { min-height: 27px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(18, 39, 53, .8); color: #a8c1ce; font-size: 9px; cursor: pointer; transition: border-color .18s, background .18s, color .18s; white-space: nowrap; }
.tool-button:hover { border-color: rgba(99, 215, 245, .45); background: #142b3b; color: #e4f5fc; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.readout-card { min-width: 0; padding: 10px 11px 9px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, rgba(16, 34, 47, .92), rgba(10, 23, 34, .96)); }
.readout-heading { display: flex; justify-content: space-between; align-items: center; gap: 5px; color: #91a8b6; font-size: 8px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; }
.readout-tag { color: #567789; font-size: 7px; letter-spacing: .07em; }
.readout-value { margin: 8px 0 7px; color: #e7f4f8; font-size: clamp(16px, 1.65vw, 22px); font-weight: 650; letter-spacing: -.035em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-track { height: 3px; overflow: hidden; border-radius: 4px; background: rgba(113, 145, 163, .16); }
.meter-fill { height: 100%; border-radius: 4px; transition: width .22s ease; }
.meter-fill.cyan { background: linear-gradient(90deg, #267d9e, #65d8f4); box-shadow: 0 0 7px rgba(99, 215, 245, .45); }
.meter-fill.ice { background: linear-gradient(90deg, #4b9cb9, #b7f2ff); box-shadow: 0 0 7px rgba(166, 237, 255, .5); }
.readout-foot { margin-top: 7px; color: #6f8796; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.control-panel { min-height: 0; overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(165deg, rgba(15, 31, 44, .98), rgba(9, 20, 30, .99)); scrollbar-color: #294556 transparent; scrollbar-width: thin; }
.panel-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.panel-eyebrow { color: #7091a4; font-size: 8px; letter-spacing: .17em; font-weight: 800; }
.panel-header h2 { margin: 4px 0 0; font-size: 17px; font-weight: 650; letter-spacing: -.025em; }
.panel-icon { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid rgba(99, 215, 245, .2); border-radius: 8px; color: var(--cyan); font-size: 19px; background: rgba(99, 215, 245, .07); }
.section-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; color: #8ea7b6; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.section-label span { color: #526f80; font-size: 7px; letter-spacing: .1em; white-space: nowrap; }
.preset-section { padding: 13px 0 12px; border-bottom: 1px solid var(--line); }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.preset-button { min-width: 0; min-height: 64px; padding: 7px 5px 6px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; border: 1px solid var(--line); border-radius: 7px; background: rgba(8, 20, 30, .75); text-align: left; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.preset-button:hover { border-color: rgba(99, 215, 245, .42); transform: translateY(-1px); }
.preset-button.active { border-color: rgba(99, 215, 245, .55); background: linear-gradient(145deg, rgba(25, 65, 83, .55), rgba(13, 32, 45, .9)); box-shadow: inset 0 0 0 1px rgba(99, 215, 245, .08); }
.preset-symbol { color: var(--cyan); font-size: 15px; line-height: 1; }
.preset-button strong { font-size: 9px; font-weight: 700; color: #d7e5eb; white-space: nowrap; }
.preset-button small { font-size: 7px; color: #718c9d; white-space: nowrap; }
.active-scenario { margin-top: 8px; color: #5f7b8c; font-size: 7px; letter-spacing: .13em; }
.active-scenario strong { margin-left: 5px; color: #9fc8d8; font-size: 8px; letter-spacing: .05em; }
.parameter-section { padding: 13px 0 10px; border-bottom: 1px solid var(--line); }
.parameter-row { margin: 0 0 12px; }
.parameter-row:last-child { margin-bottom: 2px; }
.parameter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.parameter-head label { color: #c3d1d9; font-size: 10px; font-weight: 550; }
.parameter-head output { color: var(--cyan); font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; display: block; width: 100%; height: 4px; margin: 0; border-radius: 5px; background: linear-gradient(90deg, #266e88, #4ebbd7 58%, #263d4c); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border: 2px solid #c6f4ff; border-radius: 50%; background: #2b8eaa; box-shadow: 0 0 0 3px rgba(99, 215, 245, .13), 0 1px 5px #000; }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #c6f4ff; border-radius: 50%; background: #2b8eaa; box-shadow: 0 0 0 3px rgba(99, 215, 245, .13), 0 1px 5px #000; }
.range-ends { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; color: #5f7888; font-size: 7px; }
.playback-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.playback-buttons { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 6px; margin-bottom: 11px; }
.primary-button, .secondary-button { min-height: 31px; border-radius: 6px; cursor: pointer; font-size: 9px; font-weight: 700; transition: background .18s, border-color .18s; }
.primary-button { border: 1px solid rgba(82, 196, 225, .45); background: linear-gradient(135deg, #1c7895, #14556e); color: #edfbff; box-shadow: 0 4px 12px rgba(17, 113, 143, .15); }
.primary-button:hover { background: linear-gradient(135deg, #238eac, #17647d); }
.secondary-button { border: 1px solid var(--line-strong); background: rgba(17, 37, 51, .9); color: #b0c3ce; }
.secondary-button:hover { border-color: rgba(99, 215, 245, .4); background: #173244; }
.speed-head { margin-bottom: 6px; }
.mini-status { padding: 11px 0 12px; border-bottom: 1px solid var(--line); }
.mini-status-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.mini-status-head strong { color: #c9eaf4; font-size: 12px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.mini-status-label { margin: 5px 0 8px; color: #5e7c8d; font-size: 7px; letter-spacing: .1em; }
.mini-status-label span { color: #7893a1; }
.mini-status-foot { display: flex; justify-content: space-between; margin-top: 5px; color: #607b8a; font-size: 7px; }
.muted-status { color: #c49d6c !important; }
.science-panel { margin-top: 11px; border: 1px solid rgba(99, 215, 245, .17); border-radius: 8px; background: rgba(7, 19, 29, .72); }
.science-panel summary { min-height: 36px; padding: 0 10px; display: flex; justify-content: space-between; align-items: center; list-style: none; cursor: pointer; color: #c3d9e3; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.science-panel summary::-webkit-details-marker { display: none; }
.summary-right { color: #668597; font-size: 7px; letter-spacing: .1em; }
.summary-right i { margin-left: 5px; color: var(--cyan); font-style: normal; font-size: 12px; }
.science-panel[open] .summary-right i { display: inline-block; transform: rotate(180deg); }
.science-content { padding: 0 10px 10px; }
.science-intro { padding: 9px 0 10px; border-top: 1px solid var(--line); color: #9fb3bf; font-size: 9px; line-height: 1.55; }
.equation-block { padding: 8px 0; border-top: 1px solid rgba(152, 184, 204, .09); }
.equation-label { display: flex; justify-content: space-between; color: #7f9cad; font-size: 7px; font-weight: 800; letter-spacing: .11em; }
.equation-label span { color: #5d8193; font-size: 6px; }
.equation { margin: 7px 0 4px; color: #c6f0fb; font: 14px Georgia, "Times New Roman", serif; letter-spacing: .01em; }
.equation sub { font-size: 9px; }
.equation-block p { margin: 0; color: #6e8796; font-size: 8px; line-height: 1.4; }
.validation-card { margin-top: 8px; padding: 9px; border: 1px solid rgba(119, 217, 189, .18); border-radius: 7px; background: rgba(18, 57, 55, .18); }
.validation-head { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-bottom: 7px; }
.validation-head strong { color: #b7d8d7; font-size: 7px; letter-spacing: .12em; }
.validation-head span { padding: 3px 5px; border-radius: 3px; background: rgba(119, 217, 189, .1); color: #83d7bd; font-size: 6px; font-weight: 800; letter-spacing: .07em; }
.validation-head span.warning { background: rgba(233, 185, 120, .12); color: #e9b978; }
.validation-line { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; color: #78939e; font-size: 8px; }
.validation-line strong { color: #d5e8eb; font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; }
.validation-note { margin-top: 7px; color: #66808e; font-size: 7px; line-height: 1.45; }
.assumption-list { display: grid; gap: 7px; margin-top: 10px; }
.assumption-list div { display: grid; grid-template-columns: 70px 1fr; gap: 7px; }
.assumption-list strong { color: #7694a5; font-size: 7px; letter-spacing: .1em; }
.assumption-list span { color: #748b98; font-size: 7px; line-height: 1.45; }
.panel-footnote { padding-top: 10px; color: #546e7e; font-size: 7px; line-height: 1.4; }
.footer-bar { min-height: 29px; padding: 5px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); color: #5c7585; font-size: 7px; font-weight: 800; letter-spacing: .13em; }
.footer-bar span { color: var(--cyan); padding: 0 3px; }
.footer-bar strong { color: #8fa8b6; }
.keyboard-hints { display: flex; align-items: center; gap: 6px; color: #607b8a; font-weight: 500; letter-spacing: .02em; }
kbd { padding: 2px 4px; border: 1px solid rgba(152, 184, 204, .2); border-radius: 3px; color: #9cb5c2; font: 7px ui-monospace, SFMono-Regular, Consolas, monospace; }
.context-overlay, .fatal-overlay { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; background: rgba(3, 10, 16, .82); backdrop-filter: blur(8px); }
.context-overlay[hidden], .fatal-overlay[hidden] { display: none; }
.context-card { max-width: 260px; padding: 22px; text-align: center; border: 1px solid var(--line-strong); border-radius: 12px; background: #102330; }
.context-icon { color: var(--cyan); font-size: 25px; }
.context-card strong { display: block; margin-top: 8px; font-size: 13px; }
.context-card p { color: var(--muted); font-size: 10px; line-height: 1.5; }
.fatal-overlay { padding: 22px; color: #f1c38c; text-align: center; font-size: 12px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; padding: 9px 13px; border: 1px solid rgba(99, 215, 245, .35); border-radius: 7px; background: #102a3a; color: #d6f5fc; font-size: 10px; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.embed-mode .topbar, .embed-mode .cause-strip, .embed-mode .footer-bar { display: none; }
.embed-mode .workspace { padding: 0; gap: 0; grid-template-columns: minmax(0, 1fr) 330px; }
.embed-mode .viewport-wrap { border-radius: 0; border: 0; }
.embed-mode .control-panel { border-radius: 0; }
@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 390px; padding: 15px; gap: 14px; }
  .control-panel { padding: 16px; }
  .viewport-wrap { min-height: 440px; }
}
@media (max-width: 1080px) {
  .topbar { grid-template-columns: 160px minmax(0, 1fr) 170px; padding-inline: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; gap: 9px; padding: 9px; }
  .control-panel { padding: 11px; }
  .strip-note { display: none; }
}
@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; min-height: 62px; }
  .brand-lockup { display: none; }
  .title-lockup { text-align: left; }
  .top-meta { grid-column: 2; grid-row: 1; }
  .cause-strip { justify-content: flex-start; overflow-x: auto; gap: 12px; }
  .cause-step strong { font-size: 9px; }
  .workspace, .embed-mode .workspace { display: flex; flex-direction: column; padding: 8px; gap: 9px; }
  .viewport-wrap { flex: none; height: min(58vh, 520px); min-height: 360px; }
  .viewport { min-height: 0; }
  .control-panel { overflow: visible; }
  .readout-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-bar { flex-wrap: wrap; justify-content: center; }
  .footer-bar > div:first-child, .footer-bar > div:last-child { display: none; }
}
@media (max-width: 520px) {
  .topbar { padding: 9px 12px; min-height: 58px; }
  .eyebrow { font-size: 7px; }
  h1 { font-size: 17px; }
  .seed-chip { display: none; }
  .webgl-chip { padding: 6px 7px; font-size: 8px; }
  .cause-strip { min-height: 42px; padding: 6px 12px; }
  .cause-step { gap: 5px; }
  .cause-step > span:not(.step-index) { font-size: 7px; }
  .cause-step strong { font-size: 8px; }
  .step-index { font-size: 8px; }
  .cause-arrow { font-size: 11px; }
  .workspace { padding: 7px; }
  .viewport-wrap { height: 49vh; min-height: 340px; }
  .scene-legend { top: 36px; gap: 8px; font-size: 8px; }
  .scene-topline { top: 11px; left: 11px; right: 11px; }
  .scene-kicker, .scene-scale { font-size: 7px; }
  .viewport-toolbar { align-items: flex-start; flex-direction: column; padding: 8px 10px; gap: 7px; }
  .toolbar-actions { width: 100%; }
  .tool-button { flex: 1; }
  .tool-button span { font-size: 8px; }
  .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .readout-card { padding: 9px; }
  .readout-heading { font-size: 7px; }
  .readout-tag { font-size: 6px; }
  .readout-value { font-size: 19px; margin: 6px 0; }
  .readout-foot { font-size: 7px; }
  .control-panel { padding: 12px; }
  .panel-header h2 { font-size: 16px; }
  .parameter-head label { font-size: 10px; }
  .parameter-head output { font-size: 9px; }
  .preset-button { min-height: 62px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 6px; }
  .keyboard-hints { font-size: 6px; }
  .embed-mode .workspace { padding: 0; }
  .embed-mode .viewport-wrap { height: 100vh; min-height: 0; }
  .embed-mode .control-panel { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
/* ms-fix-045: keep the 3D viewport at viewport height instead of stretching to the control column */
@media (min-width: 901px){.workspace{align-items:start}.viewport-wrap{position:sticky;top:12px;height:calc(100vh - 24px);height:calc(100dvh - 24px);max-height:860px;flex:none}.embed-mode .viewport-wrap{top:0;height:100vh;height:100dvh;max-height:none}}
.viewport > .simulation-canvas{position:absolute;inset:0;width:100%!important;height:100%!important;display:block}
