:root {
  color-scheme: dark;
  --bg: #07131b;
  --panel: #0d1c26;
  --panel-raised: #11232e;
  --panel-soft: #0a1821;
  --line: rgba(169, 205, 217, .12);
  --line-strong: rgba(169, 205, 217, .2);
  --text: #e9f3f5;
  --muted: #91a8b1;
  --dim: #617983;
  --accent: #54dfc5;
  --accent-strong: #22bfa9;
  --accent-soft: rgba(84, 223, 197, .11);
  --amber: #f0b86d;
  --danger: #f0a06d;
  --radius: 16px;
  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-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(ellipse at 42% -20%, rgba(27, 76, 84, .18), transparent 50%), var(--bg); }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.embed-mode .app-shell { height: 100%; min-height: 0; overflow: hidden; }
.topbar { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7, 19, 27, .92); }
.brand-lockup, .topbar-right { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(84, 223, 197, .24); border-radius: 12px; background: rgba(84, 223, 197, .07); color: var(--accent); }
.brand-mark svg { width: 32px; height: 32px; }
.brand-name { font-size: 10px; letter-spacing: .18em; font-weight: 800; color: #c6d8dd; }
.brand-subtitle { margin-top: 4px; font-size: 9px; letter-spacing: .12em; color: var(--dim); font-weight: 650; }
.topbar-right { gap: 10px; }
.model-chip, .seed-chip { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 20px; color: #a8c0c8; font-size: 9px; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.seed-chip { color: #728b94; }
.pulse-dot, .state-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(84, 223, 197, .7); }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 368px; gap: 16px; padding: 16px 18px 12px; }
.stage-card, .control-panel { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(16, 34, 45, .98), rgba(9, 23, 32, .98)); box-shadow: 0 18px 50px rgba(0, 0, 0, .14); }
.stage-card { display: flex; flex-direction: column; overflow: hidden; }
.stage-heading { min-height: 88px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 14px; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .17em; }
h1 { margin: 6px 0 0; font-size: clamp(22px, 2vw, 29px); letter-spacing: -.045em; font-weight: 680; }
.stage-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.stage-state { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(84, 223, 197, .18); border-radius: 20px; color: #b5d3d3; background: rgba(84, 223, 197, .06); font-size: 9px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.stage-state .state-dot { width: 5px; height: 5px; }
.canvas-frame { position: relative; flex: 1 1 auto; min-height: 210px; overflow: hidden; border-top: 1px solid rgba(160, 200, 211, .07); border-bottom: 1px solid rgba(160, 200, 211, .07); background: #081923; }
#simCanvas { display: block; width: 100%; height: 100%; }
.canvas-label { position: absolute; top: 14px; display: flex; align-items: center; gap: 8px; color: rgba(170, 197, 204, .65); font-size: 8px; letter-spacing: .11em; font-weight: 750; pointer-events: none; }
.canvas-label-left { left: 18px; flex-direction: column; align-items: flex-start; gap: 3px; }
.label-kicker { color: var(--accent); font-size: 8px; }
.canvas-label-right { right: 18px; gap: 7px; }
.legend-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; margin-left: 7px; }
.legend-bell { background: #d2e5e7; }
.legend-ring { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.canvas-bottom-note { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); color: rgba(124, 169, 178, .64); font-size: 8px; letter-spacing: .15em; font-weight: 800; white-space: nowrap; pointer-events: none; }
.caption-strip { min-height: 72px; flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: rgba(5, 16, 23, .34); }
.caption-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border: 1px solid rgba(84, 223, 197, .25); border-radius: 9px; background: var(--accent-soft); }
.caption-icon span { width: 9px; height: 9px; border: 1.5px solid var(--accent); border-radius: 50%; box-shadow: 0 0 9px rgba(84, 223, 197, .35); }
.caption-copy { min-width: 0; }
.caption-label { margin-bottom: 4px; color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.caption-copy p { margin: 0; color: #bfd0d5; font-size: 11px; line-height: 1.45; }
.transport-bar { min-height: 62px; flex: 0 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); }
.transport-controls { display: flex; align-items: center; gap: 7px; }
.control-button, .icon-button, .screenshot-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(255, 255, 255, .025); color: #bfd0d5; font-size: 10px; font-weight: 700; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.control-button:hover, .icon-button:hover, .screenshot-button:hover { border-color: rgba(84, 223, 197, .42); background: rgba(84, 223, 197, .07); }
.control-button:active, .icon-button:active, .screenshot-button:active, .preset-button:active { transform: translateY(1px); }
.control-button svg, .icon-button svg, .screenshot-button svg { width: 16px; height: 16px; }
.control-button.primary { border-color: rgba(84, 223, 197, .45); background: var(--accent); color: #06211f; }
.control-button.primary:hover { background: #77ecd5; }
.icon-button { width: 34px; padding: 0; }
.time-track-wrap { flex: 1; min-width: 70px; }
.time-track { height: 3px; overflow: hidden; border-radius: 5px; background: rgba(155, 190, 198, .13); }
.time-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.time-track-label { display: flex; justify-content: space-between; margin-top: 6px; color: var(--dim); font-size: 8px; font-weight: 750; letter-spacing: .09em; }
.time-track-label em { color: #627b85; font-style: normal; font-weight: 500; letter-spacing: 0; }
.screenshot-button { flex: 0 0 auto; }
.control-panel { overflow: hidden; }
.panel-scroll { height: 100%; overflow: auto; padding: 18px 16px 16px; scrollbar-width: thin; scrollbar-color: rgba(111, 149, 159, .32) transparent; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-header h2 { margin: 5px 0 0; font-size: 17px; font-weight: 680; letter-spacing: -.025em; }
.quality-toggle { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, .15); }
.quality-button { min-width: 39px; height: 24px; padding: 0 7px; border: 0; border-radius: 6px; background: transparent; color: var(--dim); font-size: 9px; font-weight: 750; cursor: pointer; }
.quality-button.active { background: rgba(84, 223, 197, .14); color: var(--accent); }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .018); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover { border-color: rgba(84, 223, 197, .35); background: rgba(84, 223, 197, .045); }
.preset-mark { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; }
.soft-mark { background: #6ca9c0; box-shadow: 0 0 8px rgba(108, 169, 192, .35); }
.long-mark { background: var(--accent); box-shadow: 0 0 8px rgba(84, 223, 197, .4); }
.preset-button strong { display: block; color: #d7e5e8; font-size: 10px; font-weight: 750; }
.preset-button small { display: block; margin-top: 3px; color: var(--dim); font-size: 8px; }
.controls-section, .readouts-section { margin-top: 20px; }
.section-heading { display: flex; align-items: center; gap: 9px; color: #819aa3; font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.section-line { height: 1px; flex: 1; background: var(--line); }
.slider-control { margin-top: 14px; }
.slider-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slider-topline label { color: #c9d8dc; font-size: 10px; font-weight: 650; }
.slider-topline output { color: var(--accent); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slider-topline output em { color: #65848b; font-size: 7px; font-weight: 550; font-style: normal; }
input[type="range"] { display: block; width: 100%; height: 15px; margin: 6px 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(84, 223, 197, .7), rgba(84, 223, 197, .18)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(84, 223, 197, .7), rgba(84, 223, 197, .18)); }
input[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4.5px; appearance: none; border: 2px solid #d7fff6; border-radius: 50%; background: var(--accent-strong); box-shadow: 0 0 0 3px rgba(84, 223, 197, .12), 0 0 9px rgba(84, 223, 197, .28); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #d7fff6; border-radius: 50%; background: var(--accent-strong); box-shadow: 0 0 0 3px rgba(84, 223, 197, .12); }
.slider-foot { display: flex; justify-content: space-between; color: #5e7680; font-size: 8px; }
.readouts-section { margin-top: 19px; }
.readout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.readout-card { min-width: 0; min-height: 78px; padding: 10px 10px 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .018); }
.readout-name { display: flex; align-items: center; gap: 5px; color: #8099a2; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.info-dot { width: 12px; height: 12px; display: inline-grid; place-items: center; border: 1px solid rgba(129, 159, 168, .3); border-radius: 50%; color: #8da6ae; font-size: 8px; font-weight: 600; letter-spacing: 0; cursor: help; }
.readout-value { margin-top: 6px; color: #e8f7f4; font-size: 21px; font-weight: 680; letter-spacing: -.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout-value small { color: #8ba4ac; font-size: 9px; font-weight: 550; letter-spacing: 0; }
.readout-foot { margin-top: 3px; color: #66818a; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.threshold-card { margin-top: 12px; padding: 11px 12px 10px; border: 1px solid rgba(84, 223, 197, .16); border-radius: 11px; background: linear-gradient(130deg, rgba(84, 223, 197, .065), rgba(84, 223, 197, .018)); }
.threshold-top { display: flex; align-items: center; gap: 8px; }
.threshold-symbol { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; background: rgba(84, 223, 197, .12); color: var(--accent); font-size: 17px; }
.threshold-top strong { display: block; color: #cfe1e3; font-size: 10px; }
.threshold-top small { display: block; margin-top: 2px; color: #718b94; font-size: 8px; }
.threshold-top b { margin-left: auto; color: var(--accent); font-size: 16px; font-variant-numeric: tabular-nums; }
.threshold-track { position: relative; height: 5px; margin: 12px 2px 6px; border-radius: 5px; background: linear-gradient(90deg, rgba(108, 169, 192, .55), rgba(84, 223, 197, .75)); }
.threshold-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #d0fff5; box-shadow: 0 0 8px rgba(84, 223, 197, .8); }
.threshold-track i { position: absolute; top: 50%; left: 40%; width: 9px; height: 9px; transform: translate(-50%, -50%); border: 2px solid #c9fff4; border-radius: 50%; background: #0d6c62; box-shadow: 0 0 0 2px rgba(84, 223, 197, .12); }
.threshold-foot { display: flex; justify-content: space-between; color: #6c858d; font-size: 8px; }
.threshold-card p { margin: 9px 0 0; color: #9db4ba; font-size: 9px; line-height: 1.45; }
.science-panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, .018); }
.science-panel summary { display: flex; align-items: center; gap: 9px; padding: 12px; color: #d2e2e5; font-size: 10px; font-weight: 750; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 7px; background: rgba(84, 223, 197, .1); color: var(--accent); font-size: 13px; }
.summary-chevron { margin-left: auto; color: #78939b; font-size: 15px; transition: transform .18s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 13px; }
.science-content h3 { margin: 9px 0 7px; color: #c6dadd; font-size: 10px; }
.equation { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(169, 205, 217, .07); }
.equation span { color: #7f9aa2; font-size: 8px; }
.equation code { color: #b9e8df; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; text-align: right; }
.check-card { margin: 11px 0; padding: 10px; border: 1px solid rgba(84, 223, 197, .18); border-radius: 9px; background: rgba(84, 223, 197, .045); }
.check-heading { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.check-tick { width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: rgba(84, 223, 197, .15); font-size: 9px; }
.check-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; color: #b6cbd0; font-size: 9px; }
.check-main strong { color: #e5fff8; font-size: 15px; font-variant-numeric: tabular-nums; }
.check-card p, .science-content > p { margin: 6px 0 0; color: #8da5ad; font-size: 9px; line-height: 1.55; }
.model-note { color: #b4d8d2 !important; }
.further-reading { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); }
.further-reading > span { color: #6d8790; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.further-reading p { margin: 6px 0 0; color: #8da5ad; font-size: 8px; line-height: 1.45; }
.number-key { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 12px 2px 2px; color: #536e78; font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.number-key span { font-weight: 550; letter-spacing: 0; }
.app-footer { height: 25px; flex: 0 0 25px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; color: #526a74; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.app-footer em { color: #506b75; font-size: 7px; font-weight: 500; font-style: normal; letter-spacing: 0; }

@media (max-width: 1050px) and (min-width: 701px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; padding: 12px; }
  .panel-scroll { padding: 14px 12px; }
  .stage-heading { padding-left: 17px; padding-right: 17px; }
}
@media (max-width: 700px) {
  .topbar { height: 56px; flex-basis: 56px; padding: 0 12px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-mark svg { width: 27px; height: 27px; }
  .brand-name { font-size: 9px; }
  .brand-subtitle { font-size: 7px; }
  .topbar-right { gap: 5px; }
  .model-chip { height: 24px; padding: 0 7px; font-size: 7px; }
  .seed-chip { display: none; }
  .workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(260px, 43%) minmax(0, 1fr); gap: 9px; padding: 9px 9px 7px; }
  .stage-card { border-radius: 13px; }
  .stage-heading { min-height: 63px; padding: 9px 12px 8px; }
  .eyebrow { font-size: 7px; }
  h1 { margin-top: 4px; font-size: 19px; }
  .stage-subtitle { margin-top: 3px; font-size: 9px; }
  .stage-state { gap: 6px; padding: 6px 8px; font-size: 7px; }
  .canvas-frame { min-height: 100px; }
  .canvas-label { top: 8px; font-size: 6px; }
  .canvas-label-left { left: 10px; }
  .canvas-label-right { right: 10px; gap: 4px; }
  .label-kicker { font-size: 6px; }
  .legend-dot { width: 5px; height: 5px; margin-left: 3px; }
  .canvas-bottom-note { bottom: 7px; font-size: 6px; }
  .caption-strip { min-height: 50px; padding: 7px 10px; gap: 8px; }
  .caption-icon { width: 22px; height: 22px; flex-basis: 22px; border-radius: 7px; }
  .caption-icon span { width: 7px; height: 7px; }
  .caption-label { margin-bottom: 2px; font-size: 6px; }
  .caption-copy p { font-size: 8px; line-height: 1.35; }
  .transport-bar { min-height: 43px; gap: 8px; padding: 6px 8px; }
  .transport-controls { gap: 5px; }
  .control-button, .icon-button, .screenshot-button { height: 29px; gap: 4px; padding: 0 8px; border-radius: 8px; font-size: 8px; }
  .control-button svg, .icon-button svg, .screenshot-button svg { width: 13px; height: 13px; }
  .icon-button { width: 29px; padding: 0; }
  .time-track-label { margin-top: 4px; font-size: 6px; }
  .screenshot-button { padding: 0 7px; }
  .panel-scroll { padding: 12px 12px 16px; }
  .panel-header h2 { font-size: 15px; }
  .preset-row { margin-top: 11px; }
  .controls-section, .readouts-section { margin-top: 15px; }
  .slider-control { margin-top: 11px; }
  .readout-card { min-height: 70px; padding: 8px; }
  .readout-value { font-size: 19px; }
  .threshold-card { margin-top: 10px; }
  .app-footer { display: none; }
}
@media (max-width: 370px) {
  .workspace { grid-template-rows: minmax(250px, 41%) minmax(0, 1fr); padding-left: 7px; padding-right: 7px; }
  .stage-heading { padding-left: 9px; padding-right: 9px; }
  .stage-state { font-size: 6px; }
  .screenshot-button span { display: none; }
  .caption-copy p { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
