:root{
  --bg:#070b11;
  --panel:rgba(255,255,255,.045);
  --panel-2:rgba(255,255,255,.075);
  --line:rgba(205,222,235,.14);
  --line-2:rgba(205,222,235,.30);
  --text:#eef3f6;
  --text-2:#abb9c4;
  --text-3:#71818e;
  --text-4:#454e56;
  --accent:#55d0e8;
  --true:#ffb067;
  --sans:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --serif:'Instrument Serif',Georgia,'Times New Roman',serif;
  --mono:'IBM Plex Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
*{margin:0;padding:0;box-sizing:border-box}
[hidden]{display:none !important}
body.boot *{transition:none !important; animation:none !important}
html,body{height:100%}
body{
  background:var(--bg); color:var(--text); font-family:var(--sans);
  -webkit-font-smoothing:antialiased;
  background-image:radial-gradient(130% 95% at 50% -8%, #0e1a24 0%, #0a131b 52%, #05090d 100%);
  background-attachment:fixed;
}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px; border-radius:6px}
button{font-family:inherit; color:inherit; background:none; border:none}

.page{display:flex; flex-direction:column; min-height:100vh}

/* ---------- top bar ---------- */
.bar{
  display:flex; justify-content:space-between; align-items:center; gap:12px;
  padding:max(14px, env(safe-area-inset-top)) 20px 0; flex:none;
}
.home,.icon{
  display:inline-flex; align-items:center; gap:7px; height:38px;
  color:var(--text); text-decoration:none; font:500 14px/1 var(--sans);
  background:var(--panel); border:1px solid var(--line); border-radius:999px;
  cursor:pointer; transition:background .15s, border-color .15s;
}
.home{padding:0 14px 0 10px}
.home span{font-family:var(--serif); font-size:18px; letter-spacing:.01em}
.icon{width:38px; justify-content:center; padding:0; flex:none}
.home:hover,.icon:hover{background:var(--panel-2); border-color:var(--line-2)}

/* ---------- layout ---------- */
main{
  flex:1; display:grid; grid-template-columns:minmax(0,1fr) 322px;
  gap:24px; padding:10px 20px max(22px, env(safe-area-inset-bottom));
  align-items:start; align-content:start;
  width:100%; max-width:1128px; margin:0 auto;
}
.stage{display:flex; flex-direction:column; gap:12px; min-width:0}
.titleblock{max-width:680px; padding:6px 2px 2px}
.kicker{font-size:11.5px; font-weight:600; letter-spacing:.15em; text-transform:uppercase; color:var(--text-3)}
h1{
  font-family:var(--serif); font-weight:400; font-size:clamp(32px, 4.2vw, 54px);
  line-height:.98; letter-spacing:-.01em; margin:4px 0 8px;
}
.sub{font-size:14.5px; line-height:1.55; color:var(--text-2); max-width:66ch}
.sub b{font-weight:600; color:var(--text)}
.lbl{
  font-size:11px; font-weight:600; letter-spacing:.12em; text-transform:uppercase;
  color:var(--text-3); display:flex; justify-content:space-between; align-items:baseline; gap:8px;
}
.lbl .hint{font:600 11px/1 var(--mono); letter-spacing:.02em; text-transform:none; color:var(--accent)}
.srlive{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}

/* ---------- the scene ---------- */
.slate{
  position:relative; width:100%; overflow:hidden; border-radius:14px;
  background:#050810; border:1px solid rgba(205,222,235,.12);
  box-shadow:0 22px 46px -30px #000, 0 1px 0 rgba(224,236,200,.06) inset;
  isolation:isolate; touch-action:none;
}
#scene{display:block; width:100%; aspect-ratio:1.5; height:auto}

.handle{
  position:absolute; width:34px; height:34px; margin:-17px 0 0 -17px;
  border-radius:50%; background:rgba(85,208,232,.16); border:1.5px solid var(--accent);
  color:var(--accent); font:700 13px/1 var(--mono); display:flex;
  align-items:center; justify-content:center; cursor:grab; touch-action:none;
  box-shadow:0 0 0 6px rgba(85,208,232,.08);
  transition:background .12s, box-shadow .12s;
}
.handle:hover{background:rgba(85,208,232,.26)}
.handle:active,.handle.drag{cursor:grabbing; background:rgba(85,208,232,.34); box-shadow:0 0 0 9px rgba(85,208,232,.12)}
.handle.h2{background:rgba(255,176,103,.16); border-color:var(--true); color:var(--true); box-shadow:0 0 0 6px rgba(255,176,103,.08)}
.handle.h2:hover{background:rgba(255,176,103,.26)}
.handle.h2:active,.handle.h2.drag{background:rgba(255,176,103,.34); box-shadow:0 0 0 9px rgba(255,176,103,.12)}

.cap2{display:flex; gap:7px 18px; flex-wrap:wrap; padding:1px 2px}
.legend{display:inline-flex; align-items:center; gap:6px; font:500 11px/1.3 var(--sans); color:var(--text-3)}
.sw{width:13px; height:13px; border-radius:50%; display:inline-block; flex:none}
.sw.s-true{background:none; border:1.5px solid var(--text-3)}
.sw.s-cand{background:none; border:1.5px solid var(--accent); box-shadow:0 0 6px var(--accent)}

/* ---------- panel ---------- */
.panel{
  display:flex; flex-direction:column; gap:14px; position:sticky; top:12px;
  background:var(--panel); border:1px solid var(--line); border-radius:16px;
  padding:14px 15px 13px;
}
.grp{display:flex; flex-direction:column; gap:8px}
.note{font-size:11.5px; line-height:1.5; color:var(--text-3)}
.note b{color:var(--text-2); font-weight:600}

input[type=range]{-webkit-appearance:none; appearance:none; width:100%; height:26px; background:transparent; cursor:pointer; display:block}
input[type=range]::-webkit-slider-runnable-track{height:5px; border-radius:99px; background:rgba(255,255,255,.13)}
input[type=range]::-moz-range-track{height:5px; border-radius:99px; background:rgba(255,255,255,.13)}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none; width:19px; height:19px; margin-top:-7px;
  border-radius:50%; background:var(--accent); border:none;
  box-shadow:0 1px 5px rgba(0,0,0,.5), 0 0 0 1px rgba(0,0,0,.25);
}
input[type=range]::-moz-range-thumb{width:19px; height:19px; border-radius:50%; background:var(--accent); border:none; box-shadow:0 1px 5px rgba(0,0,0,.5)}

.checkrow{display:flex; align-items:flex-start; gap:9px; font-size:13px; line-height:1.4; color:var(--text-2); cursor:pointer}
.checkrow input{width:18px; height:18px; margin-top:1px; accent-color:var(--accent); flex:none; cursor:pointer}
.dim2{color:var(--text-3); font-size:11.5px}

.readout{border-radius:11px; padding:10px 12px; border:1px solid var(--line); background:var(--panel-2); font-size:12.5px; line-height:1.5; color:var(--text-2)}
.readout .big{display:block; font:400 24px/1.15 var(--serif); color:var(--text); margin-bottom:4px; letter-spacing:.01em}
.readout .big b{color:var(--accent); font-weight:400}
.readout .dim{color:var(--text-3); font-size:12px}

.foot{font-size:11.5px; line-height:1.6; color:#b9c6d1; border-top:1px solid var(--line); padding-top:12px}
.link{color:var(--accent); cursor:pointer; font:inherit; font-weight:600; text-align:left; text-decoration:underline; text-underline-offset:2px}
.link:hover{color:#8be3f5}

/* ---------- about ---------- */
dialog{border:none; padding:0; background:transparent; max-width:min(706px, 92vw); max-height:86vh; margin:auto}
dialog::backdrop{background:rgba(5,8,13,.68); backdrop-filter:blur(3px)}
.about{
  position:relative; background:#0b121a; border:1px solid rgba(205,222,235,.2);
  border-radius:18px; padding:26px 28px 24px; overflow-y:auto; max-height:86vh;
  box-shadow:0 30px 60px -28px #000;
}
.about h2{font-family:var(--serif); font-weight:400; font-size:31px; line-height:1.05; margin:4px 0 14px; color:var(--text)}
.about h3{font-family:var(--serif); font-weight:400; font-size:22px; line-height:1.1; margin:22px 0 10px; color:var(--text)}
.about p{font-size:14.5px; line-height:1.68; color:var(--text-2); margin-bottom:12px}
.about p b{color:var(--text); font-weight:600}
.about em,.about i{font-style:italic}
.about .fine{font-size:12.5px; color:var(--text-3); border-top:1px solid var(--line); padding-top:12px; margin-top:16px; margin-bottom:0}
.x{
  position:absolute; top:14px; right:14px; width:32px; height:32px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; color:var(--text-3);
  background:var(--panel-2); border:1px solid var(--line); border-radius:999px;
}
.x:hover{color:var(--text); border-color:var(--line-2)}

/* ---------- narrow ---------- */
@media (max-width:920px){
  main{grid-template-columns:minmax(0,1fr); gap:16px; padding:8px 14px max(20px, env(safe-area-inset-bottom))}
  .panel{position:static}
  h1{font-size:clamp(28px, 8.2vw, 40px)}
  .sub{font-size:14px}
  #scene{aspect-ratio:1.2}
  .about{padding:22px 20px 20px; border-radius:15px}
  .about h2{font-size:26px}
  .about h3{font-size:20px}
}
@media (max-width:420px){
  .readout .big{font-size:20px}
  .handle{width:30px; height:30px; margin:-15px 0 0 -15px; font-size:12px}
}
