:root {
  color-scheme: dark;
  --bg: #0a1118;
  --panel: #111c25;
  --panel-raised: #14232d;
  --line: rgba(166, 194, 202, 0.15);
  --line-strong: rgba(166, 194, 202, 0.24);
  --text: #e5eef0;
  --muted: #91a5ad;
  --soft: #b8c8cd;
  --accent: #4fe0c2;
  --accent-dim: rgba(79, 224, 194, 0.12);
  --warning: #b7c5c9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: radial-gradient(ellipse at 20% 0%, rgba(49, 90, 96, 0.16), transparent 42%), var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
.page-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 28px 36px; }
.brand-header { height: 64px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(79,224,194,.55); border-radius: 9px; color: var(--accent); font-size: 16px; font-weight: 800; box-shadow: 0 0 18px rgba(79,224,194,.08); }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: 1.55px; line-height: 1.4; }
.brand-title { color: #dce7e9; font-size: 12px; font-weight: 650; letter-spacing: .2px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #8ea2aa; font-size: 9px; font-weight: 750; letter-spacing: 1.2px; }
.live-dot, .stamp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(79,224,194,.7); }
.app-main { padding-top: 25px; }
.intro-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.accent-text { color: var(--accent); }
h1 { margin: 6px 0 4px; font-size: clamp(25px, 3vw, 36px); line-height: 1.12; letter-spacing: -.9px; font-weight: 720; }
.subtitle { margin: 0; color: #a6b7bd; font-size: 13px; line-height: 1.5; }
.model-stamp { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; color: #9eb1b7; font-size: 8px; font-weight: 750; letter-spacing: 1.1px; white-space: nowrap; }
.toolbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; margin-bottom: 10px; background: rgba(17,28,37,.82); border: 1px solid var(--line); border-radius: 9px; }
.transport-controls, .toolbar-right { display: flex; align-items: center; gap: 7px; }
.control-button, .quality-button { min-height: 31px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 6px; background: #14222c; color: #c6d4d8; font-size: 10px; font-weight: 650; cursor: pointer; transition: border-color .18s, background .18s, color .18s; }
.control-button:hover, .quality-button:hover { border-color: rgba(79,224,194,.55); color: #f0fffb; }
.control-button.primary { border-color: rgba(79,224,194,.36); background: rgba(79,224,194,.09); color: #c9fff2; }
.button-icon { color: var(--accent); font-size: 13px; line-height: 1; }
.simulation-state { display: inline-flex; align-items: center; gap: 7px; margin-right: 7px; color: #9db0b6; font-size: 8px; font-weight: 750; letter-spacing: 1.2px; }
.simulation-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(79,224,194,.65); }
.simulation-state i.paused { background: #82939a; box-shadow: none; }
.quality-button { min-height: 29px; padding: 0 9px; color: #90a5ac; font-size: 8px; letter-spacing: 1px; }
.quality-button b { color: var(--accent); font-size: 9px; }
.quality-button.low-quality b { color: var(--warning); }
.stage { position: relative; width: 100%; height: clamp(330px, 36vw, 450px); overflow: hidden; border: 1px solid rgba(139,177,185,.18); border-radius: 11px; background: #0b151d; box-shadow: inset 0 0 42px rgba(0,0,0,.25), 0 12px 35px rgba(0,0,0,.12); }
#scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.stage-topline, .stage-bottomline, .stage-scale { position: absolute; pointer-events: none; color: #b6c8cc; font-size: 8px; font-weight: 750; letter-spacing: 1.35px; }
.stage-topline { top: 14px; left: 17px; display: flex; gap: 8px; align-items: center; }
.stage-topline span:first-child { color: var(--accent); }
.stage-separator { color: #5c737b; }
.stage-bottomline { bottom: 12px; left: 17px; display: flex; align-items: center; gap: 7px; }
.key-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 2px; box-shadow: 0 0 8px rgba(79,224,194,.5); }
.stage-muted { color: #82979e; font-weight: 500; letter-spacing: .25px; }
.stage-scale { right: 16px; bottom: 12px; color: #789098; font-size: 7px; }
.readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; margin: 10px 0; }
.readout-card { min-width: 0; padding: 12px 14px 10px; background: linear-gradient(145deg, rgba(19,32,42,.95), rgba(14,24,32,.95)); border: 1px solid var(--line); border-radius: 8px; }
.readout-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #9eb0b6; font-size: 8px; font-weight: 750; letter-spacing: 1.1px; white-space: nowrap; }
.readout-label span { color: #668079; font-size: 7px; letter-spacing: .8px; }
.readout-value { margin-top: 7px; color: #eaf4f4; font-size: clamp(21px, 2.1vw, 27px); font-weight: 690; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.readout-value small { color: #8ca2a9; font-size: 11px; font-weight: 550; letter-spacing: 0; }
.readout-foot { margin-top: 3px; color: #82969d; font-size: 9px; line-height: 1.35; }
.workbench { display: grid; grid-template-columns: minmax(0,1.28fr) minmax(310px,.72fr); gap: 10px; align-items: stretch; margin-top: 10px; }
.panel { min-width: 0; padding: 15px; background: linear-gradient(150deg, rgba(18,30,40,.97), rgba(15,25,33,.97)); border: 1px solid var(--line); border-radius: 9px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.panel-heading h2 { margin: 3px 0 0; color: #e2ecee; font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
.panel-tag { color: #78928e; font-size: 7px; font-weight: 800; letter-spacing: 1px; white-space: nowrap; padding-top: 4px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 15px; }
.preset-button { min-height: 27px; padding: 0 9px; border: 1px solid rgba(156,185,192,.16); border-radius: 5px; background: #0e1a22; color: #9eafb4; font-size: 9px; font-weight: 600; cursor: pointer; transition: .16s ease; }
.preset-button:hover { border-color: rgba(79,224,194,.45); color: #d9f8f1; }
.preset-button.active { color: #cafff3; border-color: rgba(79,224,194,.55); background: rgba(79,224,194,.10); }
.slider-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); column-gap: 18px; row-gap: 15px; }
.slider-control { min-width: 0; display: flex; flex-direction: column; gap: 6px; cursor: default; }
.slider-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #b8c8cc; font-size: 10px; }
.slider-heading b { color: #e5f2f0; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; height: 5px; margin: 2px 0 0; border-radius: 8px; outline: none; appearance: none; -webkit-appearance: none; background: linear-gradient(to right, var(--accent) 0 var(--fill), #33444c var(--fill) 100%); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { width: 13px; height: 13px; border: 2px solid #b8fff0; border-radius: 50%; background: #1d8f80; appearance: none; -webkit-appearance: none; box-shadow: 0 0 0 3px rgba(79,224,194,.10); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #b8fff0; border-radius: 50%; background: #1d8f80; box-shadow: 0 0 0 3px rgba(79,224,194,.10); }
.slider-range { display: flex; justify-content: space-between; color: #6f858d; font-size: 8px; font-variant-numeric: tabular-nums; }
.side-stack { display: grid; grid-template-rows: 1fr auto; gap: 10px; }
.compact-heading { align-items: center; margin-bottom: 10px; }
.compact-heading h2 { font-size: 14px; }
.pass-mark { padding: 4px 6px; border: 1px solid rgba(79,224,194,.25); border-radius: 4px; color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .9px; white-space: nowrap; }
.pass-mark.warn { color: var(--warning); border-color: rgba(229,183,124,.32); }
.check-list { display: grid; gap: 0; }
.check-row { min-height: 25px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid rgba(158,184,191,.09); color: #9fb1b6; font-size: 9px; }
.check-row:last-child { border-bottom: 0; }
.check-row b { color: var(--accent); font-size: 9px; font-variant-numeric: tabular-nums; font-weight: 700; }
.check-row b.check-warn { color: var(--warning); }
.panel-note { margin: 9px 0 0; color: #70858d; font-size: 8px; line-height: 1.45; }
.experiment-copy { margin: -2px 0 10px; color: #9dafb5; font-size: 9px; line-height: 1.55; }
.experiment-button { width: 100%; min-height: 32px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border: 1px solid rgba(79,224,194,.40); border-radius: 5px; background: rgba(79,224,194,.08); color: #cafff3; font-size: 9px; font-weight: 700; cursor: pointer; }
.experiment-button:hover { background: rgba(79,224,194,.15); }
.experiment-button:disabled { opacity: .55; cursor: wait; }
.experiment-button span { font-size: 14px; color: var(--accent); }
.experiment-result { display: grid; gap: 3px; min-height: 34px; margin-top: 8px; color: #8fa5ac; font-size: 8px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.experiment-result strong { color: #dffbf4; font-size: 10px; }
.caption-panel { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; padding: 13px 15px; border: 1px solid rgba(79,224,194,.17); border-radius: 8px; background: linear-gradient(90deg, rgba(79,224,194,.055), rgba(17,29,38,.70)); }
.caption-icon { flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid rgba(79,224,194,.5); border-radius: 50%; color: var(--accent); font-size: 11px; font-family: Georgia, serif; font-style: italic; }
.caption-panel p { margin: 4px 0 0; color: #b5c6ca; font-size: 10px; line-height: 1.55; }
.science-panel { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(15,25,33,.86); }
.science-panel summary { min-height: 54px; display: flex; justify-content: space-between; align-items: center; padding: 9px 15px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary span:first-child { display: grid; gap: 2px; }
.science-panel summary strong { color: #dce8ea; font-size: 13px; font-weight: 650; }
.summary-mark { color: var(--accent); font-size: 20px; font-weight: 300; transition: transform .2s; }
.science-panel[open] .summary-mark { transform: rotate(45deg); }
.science-content { padding: 2px 15px 16px; border-top: 1px solid var(--line); }
.science-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 26px; padding-top: 14px; }
.science-columns h3 { margin: 0 0 7px; color: #d6e4e6; font-size: 11px; }
.science-columns p { margin: 0 0 7px; color: #91a6ad; font-size: 9px; line-height: 1.65; }
.equation { margin: 8px 0; padding: 10px; overflow-wrap: anywhere; border: 1px solid rgba(79,224,194,.17); border-radius: 5px; background: rgba(79,224,194,.045); color: #c8f6eb; font-family: Georgia, serif; font-size: 13px; line-height: 1.55; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; padding: 18px 2px 0; color: #647981; font-size: 7px; font-weight: 750; letter-spacing: 1.1px; }
.load-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; color: var(--warning); text-align: center; font-size: 13px; }

body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
.embed-mode .page-shell { width: 100%; height: 100%; max-width: none; padding: 8px 12px; }
.embed-mode .brand-header, .embed-mode .intro-row, .embed-mode .science-panel, .embed-mode .page-footer { display: none; }
.embed-mode .app-main { height: 100%; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.embed-mode .toolbar { flex: 0 0 42px; min-height: 42px; margin: 0; }
.embed-mode .stage { flex: 1 1 auto; min-height: 230px; height: auto; }
.embed-mode .readout-grid { flex: 0 0 auto; margin: 0; gap: 6px; }
.embed-mode .readout-card { padding: 7px 9px; }
.embed-mode .readout-label { font-size: 7px; }
.embed-mode .readout-label span { display: none; }
.embed-mode .readout-value { margin-top: 3px; font-size: 19px; }
.embed-mode .readout-foot { display: none; }
.embed-mode .workbench { flex: 0 0 auto; grid-template-columns: minmax(0,1.2fr) minmax(235px,.8fr); gap: 7px; margin: 0; }
.embed-mode .panel { padding: 9px; }
.embed-mode .panel-heading { margin-bottom: 6px; }
.embed-mode .panel-heading h2 { font-size: 12px; }
.embed-mode .preset-row { gap: 4px; margin-bottom: 8px; }
.embed-mode .preset-button { min-height: 23px; padding: 0 6px; font-size: 8px; }
.embed-mode .slider-grid { row-gap: 8px; column-gap: 10px; }
.embed-mode .slider-heading { font-size: 9px; }
.embed-mode .slider-heading b { font-size: 9px; }
.embed-mode .slider-range { font-size: 7px; }
.embed-mode .side-stack { gap: 7px; }
.embed-mode .check-row { min-height: 20px; font-size: 8px; }
.embed-mode .panel-note { display: none; }
.embed-mode .experiment-copy { font-size: 8px; margin-bottom: 6px; }
.embed-mode .experiment-button { min-height: 27px; font-size: 8px; }
.embed-mode .experiment-result { min-height: 24px; margin-top: 5px; font-size: 7px; }
.embed-mode .caption-panel { flex: 0 0 auto; margin: 0; padding: 8px 10px; }
.embed-mode .caption-panel p { font-size: 8px; line-height: 1.35; }
.embed-mode .caption-icon { width: 16px; height: 16px; flex-basis: 16px; font-size: 9px; }

@media (max-width: 760px) {
  .page-shell { padding: 0 14px 26px; }
  .brand-header { height: 56px; }
  .header-right { font-size: 7px; }
  .app-main { padding-top: 18px; }
  .intro-row { align-items: flex-start; flex-direction: column; margin-bottom: 14px; gap: 8px; }
  .model-stamp { padding: 6px 8px; }
  .toolbar { padding: 6px; }
  .control-button { min-height: 30px; padding: 0 8px; font-size: 9px; }
  .toolbar-right { gap: 4px; }
  .simulation-state { font-size: 7px; margin-right: 2px; }
  .quality-button { padding: 0 6px; font-size: 7px; }
  .stage { height: 320px; }
  .stage-scale { display: none; }
  .readout-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .readout-card { padding: 10px 11px 9px; }
  .readout-value { font-size: 24px; }
  .workbench { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: auto; }
  .panel { padding: 13px; }
  .science-columns { grid-template-columns: 1fr; gap: 12px; }
  .page-footer { flex-direction: column; gap: 5px; }
  .embed-mode .page-shell { padding: 6px; }
  .embed-mode .workbench { grid-template-columns: 1fr; min-height: 0; }
  .embed-mode .controls-panel { padding: 7px; }
  .embed-mode .side-stack { display: none; }
  .embed-mode .stage { min-height: 250px; }
  .embed-mode .readout-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .embed-mode .readout-card { padding: 6px 5px; }
  .embed-mode .readout-value { font-size: clamp(14px,4vw,18px); }
  .embed-mode .readout-value small { font-size: 8px; }
  .embed-mode .readout-label { white-space: normal; font-size: 6px; line-height: 1.2; }
  .embed-mode .controls-panel .panel-heading { display: none; }
  .embed-mode .preset-row { margin-bottom: 6px; }
  .embed-mode .slider-grid { grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: 7px; }
  .embed-mode .slider-control { gap: 4px; }
  .embed-mode .slider-range { display: none; }
  .embed-mode .caption-panel { display: none; }
}
@media (max-width: 420px) {
  .page-shell { padding-left: 10px; padding-right: 10px; }
  h1 { font-size: 26px; }
  .subtitle { font-size: 11px; }
  .stage { height: 300px; }
  .readout-label { white-space: normal; font-size: 7px; }
  .readout-label span { display: none; }
  .readout-value { font-size: 22px; }
  .side-stack { grid-template-columns: 1fr; }
  .slider-grid { column-gap: 12px; }
  .slider-heading { font-size: 9px; }
  .slider-heading b { font-size: 9px; }
  .embed-mode .toolbar { flex-basis: 38px; min-height: 38px; }
  .embed-mode .stage { min-height: 240px; }
  .embed-mode .readout-label { font-size: 5.8px; }
  .embed-mode .readout-value { font-size: 14px; }
  .embed-mode .preset-button { font-size: 7px; }
  .embed-mode .slider-heading { font-size: 8px; }
  .embed-mode .slider-heading b { font-size: 8px; }
}
