:root {
  color-scheme: dark;
  --bg: #0b1117;
  --panel: #101922;
  --panel-raised: #141f29;
  --panel-soft: #0e171f;
  --line: rgba(168, 190, 204, 0.13);
  --line-strong: rgba(168, 190, 204, 0.22);
  --text: #edf4f6;
  --muted: #8b9aa6;
  --subtle: #60717e;
  --accent: #69e2d0;
  --accent-soft: rgba(105, 226, 208, 0.12);
  --accent-line: rgba(105, 226, 208, 0.45);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; overflow: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: 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 { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: 72px minmax(0, 1fr); background: radial-gradient(ellipse at 30% -25%, rgba(54, 100, 106, .14), transparent 45%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(11, 17, 23, .92); z-index: 2; }
.brand-lockup { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(105,226,208,.35); border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--accent-soft); transform: rotate(-7deg); flex: 0 0 auto; }
.brand-mark span { width: 3px; border-radius: 4px; background: var(--accent); display: block; transform: rotate(7deg); }
.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; }
.eyebrow, .section-kicker { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .15em; line-height: 1.3; }
.eyebrow { margin-bottom: 4px; }
.eyebrow-dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); vertical-align: 2px; margin: 0 6px; }
h1 { margin: 0; font-size: 18px; line-height: 1.1; font-weight: 650; letter-spacing: -.035em; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.status-pill { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--accent-line); border-radius: 999px; color: #b8d8d4; font-size: 10px; font-weight: 650; letter-spacing: .02em; background: var(--accent-soft); white-space: nowrap; }
.status-dot, .live-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(105,226,208,.65); }
.iteration-readout { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.iteration-readout span { color: var(--subtle); font-size: 8px; letter-spacing: .14em; font-weight: 700; }
.iteration-readout strong { font-size: 14px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 356px; min-height: 0; overflow: hidden; }
.stage-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: 62px minmax(0, 1fr) auto; padding: 0 22px 16px 24px; border-right: 1px solid var(--line); }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-width: 0; }
.stage-intro { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.stage-subtitle { font-size: 11px; color: #a2b0b9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-tools { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.quality-switch { display: flex; align-items: center; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; background: #0c141b; }
.quality-button { border: 0; background: transparent; color: var(--muted); font-size: 9px; font-weight: 700; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.quality-button.active { background: #23343b; color: var(--accent); }
.icon-button { height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 9px; background: #101922; color: #b5c3ca; font-size: 9px; font-weight: 750; letter-spacing: .04em; cursor: pointer; transition: border-color .18s ease, color .18s ease, transform .18s ease; }
.icon-button:hover { border-color: var(--accent-line); color: var(--accent); transform: translateY(-1px); }
.icon-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.canvas-frame { min-height: 0; position: relative; overflow: hidden; border: 1px solid rgba(145, 173, 187, .16); border-radius: 16px; background: linear-gradient(135deg, rgba(19,34,43,.95), rgba(9,16,22,.98)); box-shadow: 0 18px 55px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.025); }
#simulationCanvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.canvas-corner { position: absolute; z-index: 1; pointer-events: none; color: rgba(141, 165, 177, .56); font-size: 8px; letter-spacing: .14em; font-weight: 700; }
.canvas-corner.top-left { top: 13px; left: 15px; display: flex; align-items: center; gap: 7px; }
.corner-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .8; }
.canvas-corner.bottom-right { bottom: 12px; right: 14px; }
.caption-bar { display: flex; align-items: flex-start; gap: 12px; padding: 13px 3px 0; min-height: 67px; }
.caption-icon { display: flex; align-items: center; justify-content: center; flex: 0 0 27px; width: 27px; height: 27px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 17px; }
.caption-bar .section-kicker { display: block; margin: 0 0 4px; }
.caption-bar p { margin: 0; color: #c3d0d5; font-size: 11px; line-height: 1.45; }
.control-column { min-height: 0; background: linear-gradient(180deg, rgba(17,26,35,.92), rgba(13,21,29,.96)); }
.control-scroll { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 17px 15px; scrollbar-width: thin; scrollbar-color: #31424b transparent; }
.panel-section { padding-bottom: 16px; margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.live-indicator { display: flex; align-items: center; gap: 6px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.live-indicator i { width: 5px; height: 5px; }
.section-note { color: var(--subtle); font-size: 8px; font-weight: 700; letter-spacing: .1em; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; padding: 10px 10px 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8,15,21,.44); }
.metric-card.metric-primary { border-color: rgba(105,226,208,.28); background: linear-gradient(135deg, rgba(105,226,208,.09), rgba(8,15,21,.55)); }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: #a6b5be; font-size: 9px; font-weight: 600; white-space: nowrap; }
.metric-label span { color: var(--accent); font-family: Georgia, serif; font-size: 11px; }
.metric-value { margin-top: 7px; font-size: 20px; line-height: 1; font-weight: 650; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-primary .metric-value { color: var(--accent); }
.metric-unit { margin-top: 5px; color: var(--subtle); font-size: 8px; }
.check-card { margin-top: 8px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8,15,21,.36); }
.check-heading { display: flex; align-items: center; justify-content: space-between; color: #a7b7bf; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.check-tag { color: var(--accent); padding: 3px 5px; border: 1px solid rgba(105,226,208,.22); border-radius: 4px; font-size: 7px; }
.check-equation { margin: 8px 0 9px; color: #d2dfdf; font-family: Georgia, "Times New Roman", serif; font-size: 11px; letter-spacing: .005em; }
.check-comparison { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 8px; }
.check-comparison strong { color: var(--text); font-size: 10px; font-variant-numeric: tabular-nums; margin-left: 3px; }
.check-difference { margin-left: auto; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.check-footnote { margin-top: 7px; color: var(--subtle); font-size: 7px; }
.controls-section { padding-bottom: 13px; }
.control-row { margin-bottom: 12px; }
.control-row:last-child { margin-bottom: 0; }
.control-label-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.control-label-line label { color: #c4d0d5; font-size: 10px; font-weight: 600; }
.control-label-line em { color: var(--accent); font-family: Georgia, serif; font-size: 11px; font-style: italic; }
.control-label-line output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; display: block; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(105,226,208,.65), rgba(105,226,208,.18)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(105,226,208,.65), rgba(105,226,208,.18)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border: 2px solid #0e1b20; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(105,226,208,.16); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #0e1b20; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(105,226,208,.16); }
.range-ends { display: flex; justify-content: space-between; margin-top: 1px; color: #627480; font-size: 7px; font-variant-numeric: tabular-nums; }
.compact-control { margin-top: 1px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset-button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 8px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: rgba(8,15,21,.4); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.preset-button:hover, .preset-button.selected { border-color: var(--accent-line); background: var(--accent-soft); }
.preset-symbol { display: flex; align-items: center; justify-content: center; flex: 0 0 25px; width: 25px; height: 25px; border-radius: 7px; color: var(--accent); background: rgba(105,226,208,.1); font-family: Georgia, serif; font-size: 17px; }
.preset-button strong, .preset-button small { display: block; }
.preset-button strong { color: #d7e3e5; font-size: 9px; font-weight: 700; }
.preset-button small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.transport-section { padding-bottom: 12px; margin-bottom: 11px; }
.transport-row { display: grid; grid-template-columns: 1.2fr .9fr .9fr; gap: 7px; }
.transport-button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: #111c25; color: #c1cdd2; font-size: 9px; font-weight: 650; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.transport-button:hover { border-color: var(--accent-line); color: var(--accent); transform: translateY(-1px); }
.primary-transport { border-color: rgba(105,226,208,.42); background: rgba(105,226,208,.12); color: var(--accent); }
.primary-transport:hover { background: rgba(105,226,208,.18); }
.play-icon { font-size: 11px; line-height: 1; }
.transport-footnote { display: flex; align-items: center; gap: 5px; margin-top: 9px; color: var(--subtle); font-size: 7px; }
.keyboard-hint { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 15px; padding: 0 3px; border: 1px solid var(--line-strong); border-radius: 4px; color: #91a1aa; font-size: 7px; font-weight: 700; }
.science-panel { border: 1px solid var(--line); border-radius: 10px; background: rgba(8,15,21,.34); overflow: hidden; }
.science-panel summary { display: flex; align-items: center; gap: 8px; padding: 11px 11px; color: #d3dfe2; font-size: 10px; font-weight: 650; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-summary-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); font-family: Georgia, serif; font-size: 13px; }
.chevron { margin-left: auto; color: var(--muted); font-size: 14px; transition: transform .18s ease; }
.science-panel[open] .chevron { transform: rotate(180deg); }
.science-content { padding: 0 11px 12px; color: #9eafb8; font-size: 9px; line-height: 1.5; }
.science-content h3 { margin: 12px 0 5px; color: #d6e1e3; font-size: 9px; font-weight: 750; }
.science-content p { margin: 5px 0; }
.equation-block { margin: 7px 0; padding: 8px; border-left: 2px solid var(--accent-line); background: rgba(105,226,208,.055); color: #d4e5e2; font-family: Georgia, "Times New Roman", serif; font-size: 11px; line-height: 1.55; }
.science-disclaimer { margin-top: 12px !important; padding-top: 9px; border-top: 1px solid var(--line); color: #81939e; font-size: 8px; }
.panel-bottom-note { margin-top: 10px; color: #5f707c; font-size: 7px; line-height: 1.45; text-align: center; }
@media (max-width: 900px) and (min-width: 641px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 322px; }
  .stage-column { padding-left: 17px; padding-right: 16px; }
  .topbar { padding: 0 17px; }
  .control-scroll { padding-left: 13px; padding-right: 13px; }
  .metric-value { font-size: 18px; }
}
@media (max-width: 640px) {
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { grid-template-rows: 58px minmax(0, 1fr); height: 100%; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-lockup { gap: 9px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 8px; }
  .eyebrow { font-size: 7px; letter-spacing: .11em; }
  h1 { font-size: 15px; }
  .topbar-right { gap: 8px; }
  .status-pill { padding: 6px 8px; gap: 6px; font-size: 8px; }
  .iteration-readout span { font-size: 6px; }
  .iteration-readout strong { font-size: 11px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(300px, 46dvh) minmax(0, 1fr); }
  .stage-column { grid-template-rows: 38px minmax(0,1fr) 44px; padding: 0 10px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-toolbar { gap: 7px; }
  .stage-intro { gap: 2px; }
  .stage-subtitle { max-width: 220px; font-size: 8px; }
  .stage-toolbar .section-kicker { font-size: 7px; }
  .stage-tools { gap: 5px; }
  .quality-switch { padding: 2px; border-radius: 7px; }
  .quality-button { padding: 4px 6px; font-size: 8px; }
  .icon-button { height: 26px; padding: 0 6px; gap: 4px; font-size: 8px; }
  .icon-button svg { width: 12px; height: 12px; }
  .canvas-frame { border-radius: 11px; }
  .canvas-corner { font-size: 6px; }
  .canvas-corner.top-left { top: 8px; left: 9px; }
  .canvas-corner.bottom-right { display: none; }
  .caption-bar { min-height: 0; padding: 8px 1px 0; gap: 8px; }
  .caption-icon { flex-basis: 22px; width: 22px; height: 22px; font-size: 14px; border-radius: 6px; }
  .caption-bar .section-kicker { font-size: 7px; margin-bottom: 2px; }
  .caption-bar p { font-size: 8px; line-height: 1.3; }
  .control-scroll { padding: 11px 12px 18px; }
  .panel-section { padding-bottom: 11px; margin-bottom: 11px; }
  .section-heading { margin-bottom: 8px; }
  .section-heading .section-kicker { font-size: 8px; }
  .metric-card { padding: 8px 9px 7px; }
  .metric-label { font-size: 8px; }
  .metric-value { margin-top: 5px; font-size: 17px; }
  .metric-unit { margin-top: 4px; font-size: 7px; }
  .check-card { padding: 8px 9px; margin-top: 7px; }
  .check-equation { margin: 6px 0; font-size: 10px; }
  .check-comparison { gap: 7px; font-size: 7px; }
  .check-comparison strong { font-size: 9px; }
  .check-footnote { font-size: 6px; margin-top: 5px; }
  .control-row { margin-bottom: 9px; }
  .control-label-line { margin-bottom: 4px; }
  .control-label-line label { font-size: 9px; }
  .control-label-line output { font-size: 9px; }
  .range-ends { font-size: 6px; }
  .preset-button { padding: 7px 6px; gap: 6px; }
  .preset-symbol { width: 22px; height: 22px; flex-basis: 22px; font-size: 15px; }
  .preset-button strong { font-size: 8px; }
  .preset-button small { font-size: 6px; }
  .transport-button { min-height: 31px; font-size: 8px; }
  .transport-footnote { font-size: 6px; }
  .science-panel summary { padding: 9px; font-size: 9px; }
  .science-content { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
