:root{
  color-scheme:dark;
  --bg:#0d1416;
  --panel:#151f21;
  --panel-2:#192527;
  --line:#2b393b;
  --line-soft:#223033;
  --text:#edf3f1;
  --muted:#9aabaa;
  --dim:#718181;
  --accent:#65d4c3;
  --accent-dark:#1b655d;
  --danger:#e2b48c;
  --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{font-size:14px;line-height:1.45}
button,input{font:inherit}
button{color:inherit}
.app{max-width:1600px;margin:0 auto;padding:0 24px 18px}
.topbar{height:66px;display:flex;align-items:center;gap:12px;border-bottom:1px solid var(--line-soft);margin-bottom:18px}
.brand-mark{width:28px;height:28px;border:1px solid #42625e;border-radius:8px;display:flex;align-items:flex-end;justify-content:center;gap:3px;padding:6px}
.brand-mark span{display:block;width:3px;border-radius:3px;background:var(--accent)}
.brand-mark span:nth-child(1){height:7px}.brand-mark span:nth-child(2){height:13px}.brand-mark span:nth-child(3){height:10px}
.brand-copy{display:flex;flex-direction:column;line-height:1.15;gap:3px}.brand-copy strong{font-size:10px;letter-spacing:.16em}.brand-copy span{font-size:11px;color:var(--muted)}
.topbar-spacer{flex:1}
.classification,.topbar-seed,.tiny-tag{font-size:9px;letter-spacing:.12em;color:var(--accent);border:1px solid #34524e;border-radius:999px;padding:5px 9px}
.topbar-seed{color:var(--muted);border-color:var(--line)}
.workspace{display:grid;grid-template-columns:minmax(0,1.48fr) minmax(360px,.82fr);gap:18px;align-items:start}
.stage-card,.control-card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);min-width:0;overflow:hidden}
.stage-card{padding:20px;display:flex;flex-direction:column;gap:16px}
.stage-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.eyebrow{font-size:9px;letter-spacing:.16em;color:var(--accent);font-weight:700;margin:0 0 6px}
h1,h2,h3,h4,p{margin-top:0}
h1{font-size:clamp(22px,2.4vw,31px);line-height:1.12;letter-spacing:-.035em;margin:0 0 6px;font-weight:650}
.stage-subtitle{color:var(--muted);font-size:12px;margin:0}
.state-chip{display:flex;align-items:center;gap:8px;white-space:nowrap;border:1px solid #3c514e;background:#182725;color:#d9efeb;padding:7px 10px;border-radius:999px;font-size:11px}
.state-dot{width:7px;height:7px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 4px #65d4c31b}
.canvas-shell{width:100%;height:clamp(300px,48vw,510px);min-height:260px;border:1px solid #263638;border-radius:12px;overflow:hidden;background:#10191b;position:relative}
#scene{display:block;width:100%;height:100%;touch-action:pan-y}
.stage-footer{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(150px,.7fr);gap:20px;align-items:end}
.caption-block p{font-size:12px;line-height:1.5;color:#c5d1cf;margin:0;max-width:560px}
.progress-label{display:flex;justify-content:space-between;gap:8px;font-size:10px;color:var(--muted);margin-bottom:7px}
.progress-label em,.readout em{font-style:normal;color:var(--dim);font-size:9px;text-transform:uppercase;letter-spacing:.1em}
.progress-label strong{color:var(--text);font-variant-numeric:tabular-nums}
.progress-track{height:5px;background:#2a393a;border-radius:99px;overflow:hidden}
.progress-track span{display:block;width:100%;height:100%;background:var(--accent);border-radius:99px;transition:width .12s linear}
.control-card{padding:18px;display:flex;flex-direction:column;gap:14px}
.panel-title-row{display:flex;justify-content:space-between;align-items:center}
.panel-title-row h2{font-size:17px;margin:0;letter-spacing:-.02em}
.tiny-tag{font-size:8px;padding:4px 7px}
.preset-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.preset{background:#111a1c;border:1px solid var(--line);border-radius:10px;padding:8px 5px;display:flex;flex-direction:column;align-items:center;gap:5px;cursor:pointer;min-width:0;transition:border-color .15s,background .15s}
.preset:hover,.preset.active{border-color:#5b9c91;background:#1a2a2b}
.preset strong{font-size:10px;display:block;line-height:1.2}.preset small{font-size:8px;color:var(--muted);display:block;margin-top:3px;white-space:nowrap}
.preset-mark{width:22px;height:17px;border:1px solid #78918d;border-radius:4px;display:block;position:relative;overflow:hidden}
.mark-crack:after{content:"";position:absolute;left:9px;top:0;width:1px;height:100%;background:var(--accent);transform:rotate(30deg);box-shadow:4px 5px 0 var(--accent),-4px 9px 0 var(--accent)}
.mark-smooth{background:linear-gradient(145deg,#447a73,#172b2b)}
.mark-flake:after{content:"";position:absolute;right:0;top:0;border-left:8px solid transparent;border-bottom:8px solid var(--accent);width:0;height:0}
.mark-break:after{content:"";position:absolute;inset:3px;border-top:1px solid var(--accent);transform:rotate(-25deg);box-shadow:0 4px 0 #b0d9d3}
.control-list{display:flex;flex-direction:column;gap:10px}
.control-row{border-bottom:1px solid var(--line-soft);padding-bottom:8px}
.control-label{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:5px}
.control-label label{font-size:11px;font-weight:550;color:#dce6e3}
.control-kind{font-size:8px;letter-spacing:.08em;text-transform:uppercase;color:var(--dim)}
.range-line{display:flex;align-items:center;gap:12px}
input[type=range]{appearance:none;-webkit-appearance:none;flex:1;min-width:0;height:4px;background:#354647;border-radius:99px;outline:none;cursor:pointer;accent-color:var(--accent)}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:13px;height:13px;border-radius:50%;background:var(--accent);border:2px solid #d8f4ef;box-shadow:0 0 0 3px #65d4c31c}
input[type=range]::-moz-range-thumb{width:10px;height:10px;border-radius:50%;background:var(--accent);border:2px solid #d8f4ef;box-shadow:0 0 0 3px #65d4c31c}
.range-line output{width:92px;text-align:right;font-size:10px;color:#e5eeeb;font-variant-numeric:tabular-nums;white-space:nowrap}
.readout-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.readout{background:#10191b;border:1px solid #263638;border-radius:9px;padding:9px 10px;min-width:0}
.readout span{display:flex;justify-content:space-between;align-items:center;gap:4px;color:var(--muted);font-size:9px}
.readout strong{display:block;font-size:19px;font-weight:620;letter-spacing:-.03em;margin-top:3px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.readout strong small{font-size:10px;font-weight:500;color:var(--muted);letter-spacing:0}
.transport-row{display:grid;grid-template-columns:1.35fr .8fr .7fr .8fr;gap:6px}
.action-button{border:1px solid #39494a;background:#1b282a;color:#d9e4e1;border-radius:8px;padding:9px 5px;font-size:10px;cursor:pointer;white-space:nowrap}
.action-button:hover{border-color:#6d9c94;background:#203234}
.action-button.primary{background:var(--accent);color:#0c1a19;border-color:var(--accent);font-weight:700}
.action-button.primary:hover{background:#83e0d2}
.play-icon{font-size:9px;margin-right:4px}
.quality-row{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:10px;margin-top:-5px}
.quality-row em{font-style:normal;color:var(--text);margin-left:5px}
.text-button{background:none;border:0;color:var(--accent);font-size:10px;padding:3px;cursor:pointer}
.experiment-card{border:1px solid #34504c;background:#142220;border-radius:11px;padding:12px}
.experiment-head{display:flex;justify-content:space-between;align-items:center}
.experiment-head h3{font-size:13px;margin:0;letter-spacing:-.01em}
.experiment-icon{font-size:17px;color:var(--accent)}
.experiment-card>p{font-size:10px;color:var(--muted);line-height:1.45;margin:8px 0}
.experiment-button{width:100%;background:#1d3935;border:1px solid #47766e;border-radius:7px;color:#dff8f3;padding:8px;font-size:10px;cursor:pointer}
.experiment-button:hover{background:#244a44}
.experiment-result{font-size:10px;color:#b7c9c5;line-height:1.5;margin-top:8px;min-height:30px;font-variant-numeric:tabular-nums}
.checks-section{border-top:1px solid var(--line-soft);padding-top:11px}
.checks-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:7px}
.checks-heading h3{font-size:11px;margin:0}.checks-heading span{font-size:8px;color:var(--accent);letter-spacing:.14em}
.check-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:5px 0;border-bottom:1px solid #202d2f;font-size:9px}
.check-row:last-child{border:0}.check-name{color:#c8d4d1}.check-result{color:var(--accent);font-variant-numeric:tabular-nums;white-space:nowrap}.check-result small{color:var(--dim);font-size:8px;margin-left:4px}
.science-panel{border-top:1px solid var(--line-soft);padding-top:11px}
.science-panel summary{list-style:none;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:12px;font-weight:650}
.science-panel summary::-webkit-details-marker{display:none}.science-panel summary:after{content:"＋";color:var(--accent);font-size:15px;margin-left:10px}.science-panel[open] summary:after{content:"−"}
.summary-note{font-size:9px;font-weight:400;color:var(--muted);margin-left:auto;margin-right:8px}
.science-content{padding:12px 2px 0;color:#b9c7c4;font-size:10px;line-height:1.55}
.science-content h4{font-size:10px;color:#e5efec;margin:12px 0 5px}.science-content p{margin-bottom:7px}.science-lead{color:#d1ddda}.equation{background:#10191b;border-left:2px solid var(--accent-dark);padding:6px 8px;color:#e0eeea;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:10px}.science-content ul{padding-left:17px;margin:5px 0}.science-content li{margin:4px 0}.science-note{color:#8fa5a0;border-top:1px solid var(--line-soft);padding-top:8px;margin-top:10px}
.page-footer{display:flex;justify-content:space-between;gap:12px;padding:13px 3px 0;color:#6e7d7e;font-size:8px;letter-spacing:.1em;text-transform:uppercase}

body.embed-mode{height:100vh;height:100dvh;overflow:hidden}
body.embed-mode .app{height:100vh;height:100dvh;max-width:none;padding:0;display:flex;flex-direction:column;overflow:hidden}
body.embed-mode .topbar,body.embed-mode .page-footer{display:none}
body.embed-mode .workspace{flex:1;min-height:0;overflow:hidden;grid-template-columns:minmax(0,1.48fr) minmax(330px,.82fr);gap:10px;padding:10px}
body.embed-mode .stage-card,body.embed-mode .control-card{min-height:0;height:100%;}
body.embed-mode .stage-card{padding:14px;gap:12px}
body.embed-mode .canvas-shell{height:auto;min-height:0;flex:1}
body.embed-mode .control-card{overflow-y:auto;overscroll-behavior:contain;padding:14px;gap:10px}
body.embed-mode .science-panel{padding-bottom:8px}

@media(max-width:900px){
  .app{padding:0 14px 14px}.workspace{grid-template-columns:minmax(0,1.1fr) minmax(330px,.9fr);gap:12px}.stage-card{padding:16px}.control-card{padding:14px}.canvas-shell{height:390px}.preset-grid{gap:4px}.preset{padding:7px 2px}
}
@media(max-width:720px){
  .app{padding:0 10px 14px}.topbar{height:54px;margin-bottom:10px}.workspace{grid-template-columns:1fr;gap:10px}.stage-card{padding:13px;gap:12px}.canvas-shell{height:clamp(250px,76vw,340px);min-height:250px}.stage-heading{align-items:center}.stage-subtitle{font-size:11px}.state-chip{font-size:9px;padding:6px 8px}.stage-footer{grid-template-columns:1fr;gap:10px}.progress-block{max-width:260px;width:100%}.control-card{padding:14px}.page-footer{font-size:7px}.classification{display:none}
  body.embed-mode .workspace{display:grid;grid-template-columns:1fr;grid-template-rows:minmax(0,48%) minmax(0,52%);gap:8px;padding:8px}
  body.embed-mode .stage-card{padding:10px;gap:8px}
  body.embed-mode .stage-heading{gap:6px}
  body.embed-mode .stage-heading h1{font-size:19px}
  body.embed-mode .stage-subtitle{display:none}
  body.embed-mode .canvas-shell{height:auto;min-height:0;flex:1}
  body.embed-mode .stage-footer{grid-template-columns:1fr;gap:5px}
  body.embed-mode .caption-block p{font-size:9px;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  body.embed-mode .progress-block{max-width:none}
  body.embed-mode .progress-label{margin-bottom:4px;font-size:8px}
  body.embed-mode .control-card{padding:10px;gap:8px}
  body.embed-mode .panel-title-row h2{font-size:14px}
  body.embed-mode .preset{padding:5px 2px}
  body.embed-mode .preset-mark{display:none}
  body.embed-mode .control-list{gap:7px}
  body.embed-mode .control-row{padding-bottom:5px}
  body.embed-mode .control-label{margin-bottom:3px}
  body.embed-mode .range-line output{width:84px;font-size:9px}
  body.embed-mode .readout{padding:6px 8px}
  body.embed-mode .readout strong{font-size:16px}
  body.embed-mode .transport-row{gap:4px}
  body.embed-mode .action-button{padding:7px 3px;font-size:9px}
  body.embed-mode .experiment-card{padding:9px}
  body.embed-mode .experiment-card>p{margin:5px 0}
  body.embed-mode .checks-section{padding-top:7px}
  body.embed-mode .science-panel{padding-top:7px}
}
@media(max-width:390px){
  .app{padding-left:8px;padding-right:8px}.stage-card{padding:10px}.canvas-shell{height:260px}.control-card{padding:11px}.range-line{gap:7px}.range-line output{width:84px;font-size:9px}.readout strong{font-size:17px}.transport-row{grid-template-columns:1.2fr .75fr .6fr .75fr}.action-button{font-size:9px}
}
