/* Silicon Odyssey · the single-window descent.
   The 3D view is the subject and it fills the window. Everything else is a quiet layer over
   it: the stage rail along the top, two small hints top left, where-you-are bottom left,
   the text cards down the right, and the detail panel on the left when a label is opened.
   One accent, cleanroom amber. */

@font-face{font-family:'Archivo';font-style:normal;font-display:swap;font-weight:100 900;src:url(/fonts/archivo-latin-var.woff2) format('woff2')}
@font-face{font-family:'Spectral';font-style:normal;font-display:swap;font-weight:400;src:url(/fonts/spectral-latin-400-normal.woff2) format('woff2')}
@font-face{font-family:'Spectral';font-style:normal;font-display:swap;font-weight:600;src:url(/fonts/spectral-latin-600-normal.woff2) format('woff2')}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-display:swap;font-weight:400;src:url(/fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2')}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-display:swap;font-weight:500;src:url(/fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2')}

:root{
  --ink:#0D1120; --panel:rgba(18,23,40,.84); --panel-solid:#141A2C; --panel-strong:rgba(18,23,40,.96); --line:#2C3754;
  --text:#EDF0F7; --dim:#A9B3C9; --faint:#8692AC; --acc:#E8A33D; --acc-ink:#1A1206;
  --chip:rgba(13,17,32,.72); --top1:rgba(13,17,32,.92); --top2:rgba(13,17,32,.55); --top3:rgba(13,17,32,0);
  --acc-soft:rgba(232,163,61,.28); --acc-faint:rgba(232,163,61,.08);
  --fd:"Archivo",system-ui,sans-serif; --fb:"Spectral",Georgia,serif;
  --fm:"JetBrains Mono",ui-monospace,monospace;
  --top:56px;
  /* the sky over the header: a sunrise on the dark background, deep indigo into rose and the first amber */
  --skyH:max(120px,22vh);
  --sky:linear-gradient(180deg,rgba(9,12,30,.95) 0%,rgba(24,24,62,.84) 24%,rgba(88,44,98,.48) 48%,rgba(210,100,78,.22) 70%,rgba(232,163,61,.09) 85%,rgba(232,163,61,0) 100%);
}
/* the light background: a pale lab blue, re-derived for contrast rather than inverted. The amber
   darkens so it still reads as text on white (#9A5A00 is about 5:1). */
:root[data-theme="light"]{
  --ink:#CDDEF4; --panel:rgba(250,252,255,.93); --panel-solid:#F7FAFE; --panel-strong:rgba(250,252,255,.97); --line:#BFCDE2;
  --text:#0E1A30; --dim:#33445F; --faint:#56667F; --acc:#9A5A00; --acc-ink:#FFFFFF;
  --chip:rgba(255,255,255,.86); --top1:rgba(205,222,244,.95); --top2:rgba(205,222,244,.6); --top3:rgba(205,222,244,0);
  --acc-soft:rgba(154,90,0,.18); --acc-faint:rgba(154,90,0,.08);
  color-scheme:light;
  /* a sunset on the light background: periwinkle into lavender, rose and peach */
  --sky:linear-gradient(180deg,rgba(146,166,226,.78) 0%,rgba(178,172,230,.6) 26%,rgba(240,176,192,.4) 52%,rgba(255,204,158,.22) 74%,rgba(255,204,158,0) 100%);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--ink);color:var(--text);font-family:var(--fb);font-size:17px;line-height:1.6;overflow-x:hidden}
[hidden]{display:none!important}
button{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--acc);outline-offset:2px}

.skip{position:absolute;left:-9999px;top:8px;z-index:30;background:var(--acc);color:var(--acc-ink);padding:8px 12px}
.skip:focus{left:8px}

#scene{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0;cursor:grab;touch-action:pan-y}
#scene:active{cursor:grabbing}
#noGl{position:fixed;inset:auto 0 0 0;z-index:40;margin:0;padding:14px 18px;background:var(--panel-solid);color:var(--dim);text-align:center}

/* ---- top bar: brand, the stage rail, reading level ---- */
.top{
  position:fixed;inset:0 0 auto 0;z-index:20;height:var(--top);
  display:flex;align-items:center;gap:18px;padding:0 clamp(12px,2.4vw,28px);
  background:none;
}
/* The sky band behind the header, about a fifth of the screen tall. The colour gives the far edge of
   the view an atmosphere, and a blur that fades out downward puts that edge out of focus, like a
   shallow depth of field. It sits over the 3D view and the story cards, under the panels and labels. */
body::before,body::after{content:"";position:fixed;inset:0 0 auto 0;height:var(--skyH);z-index:12;pointer-events:none}
body::before{backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
  -webkit-mask-image:linear-gradient(180deg,#000 0%,#000 22%,transparent 58%);mask-image:linear-gradient(180deg,#000 0%,#000 22%,transparent 58%)}
body::after{background:var(--sky)}
@media (prefers-reduced-transparency:reduce){body::before{display:none}}
.brand{font-family:var(--fd);font-weight:650;font-size:16px;letter-spacing:-.01em;margin:0;white-space:nowrap}
#rail{display:flex;gap:2px;flex:1;min-width:0;justify-content:center}
#rail button{
  background:none;border:0;cursor:pointer;padding:10px 7px;display:flex;align-items:center;gap:7px;
  color:var(--faint);font-family:var(--fm);font-size:11.5px;min-height:40px;
}
#rail .dot{width:8px;height:8px;border-radius:50%;background:currentColor;opacity:.55;flex:none;transition:transform .25s,opacity .25s}
#rail .nm{display:none;white-space:nowrap}
#rail button[aria-current="true"]{color:var(--acc)}
#rail button[aria-current="true"] .dot{opacity:1;transform:scale(1.5)}
#rail button[aria-current="true"] .nm,#rail button:hover .nm,#rail button:focus-visible .nm{display:inline}
/* the branch sits apart from the descent, with a square marker: a side road, not a stop */
#rail .branch{margin-left:12px;padding-left:14px;border-left:1px solid var(--line)}
#rail .branch .dot{border-radius:2px}
#rail .branch.second{margin-left:0;padding-left:7px;border-left:0}
.tools{display:flex;gap:10px;align-items:center}
#lang button{padding:7px 9px}

.seg{display:inline-flex;border:1px solid var(--line);border-radius:6px;overflow:hidden;background:var(--chip)}
.seg button{background:none;border:0;padding:7px 11px;cursor:pointer;color:var(--dim);font-family:var(--fm);font-size:12px;min-height:34px}
.seg button+button{border-left:1px solid var(--line)}
.seg button[aria-pressed="true"]{background:var(--acc);color:var(--acc-ink)}
.tog{background:var(--chip);border:1px solid var(--line);border-radius:6px;padding:7px 11px;cursor:pointer;
  color:var(--dim);font-family:var(--fm);font-size:12px;min-height:34px}
.tog[aria-pressed="true"]{border-color:var(--acc);color:var(--acc)}
.tog.go{border-color:var(--acc);color:var(--acc);font-family:var(--fd);font-size:14px;font-weight:600}
.tog.go:hover{background:var(--acc);color:var(--acc-ink)}
.tog.back{font-family:var(--fd);font-size:14px}
.tog:hover,.seg button:hover{color:var(--text)}
.link{background:none;border:0;padding:0;color:var(--acc);cursor:pointer;font-family:var(--fm);font-size:inherit;text-decoration:underline;text-underline-offset:3px}

/* ---- the dock, left: where you are, then tabs for this view, its materials and its lab ---- */
#hud{
  position:fixed;left:clamp(12px,2.4vw,28px);top:calc(var(--top) + 52px);z-index:15;
  max-height:calc(100vh - var(--top) - 52px - clamp(12px,3vh,28px));
  width:min(410px,32vw);display:flex;flex-direction:column;
  background:var(--panel);backdrop-filter:blur(12px);
  border:1px solid var(--line);border-radius:10px;padding:14px 16px 0;
  transition:opacity .25s,visibility .25s;
}
#hud .scale{display:flex;align-items:flex-end;gap:10px;font-family:var(--fm);font-size:13px;color:var(--acc);margin:0;line-height:1}
#hud .bar i{display:block;height:7px;width:60px;border:2px solid var(--acc);border-top:0}
#hud .scale b{color:var(--dim);font-weight:400;margin-left:auto}
#hud .cmp{margin:7px 0 0;font-size:14px;line-height:1.4;color:var(--dim)}
#hud .note{color:var(--faint);font-size:13px}
#hud h1{font-family:var(--fd);font-weight:650;font-size:clamp(22px,2.1vw,30px);letter-spacing:-.02em;line-height:1.05;margin:6px 0 0}
/* the detail panel takes the dock's place while it is open */
body.popping #hud{opacity:0;visibility:hidden}
.tabs{display:flex;gap:2px;margin:12px -16px 0;padding:0 12px;border-bottom:1px solid var(--line)}
.tabs button{background:none;border:0;border-bottom:2px solid transparent;margin-bottom:-1px;padding:9px 10px;min-height:40px;cursor:pointer;
  font-family:var(--fd);font-weight:600;font-size:14px;color:var(--faint);display:inline-flex;align-items:center;gap:6px}
.tabs button:hover{color:var(--text)}
.tabs button[aria-selected="true"]{color:var(--text);border-bottom-color:var(--acc)}
.tabs b{font-family:var(--fm);font-weight:500;font-size:11px;color:var(--acc-ink);background:var(--acc);border-radius:9px;padding:1px 6px}
.tabs b:empty{display:none}
.panes{flex:1;min-height:0;overflow:auto;margin:0 -16px;padding:12px 16px 14px}
.panes>section{display:flex;flex-direction:column;gap:12px}
.panes>section[hidden]{display:none}
.panes>section>*{flex-shrink:0}
#ctl{display:flex;flex-direction:column;gap:10px}
#ctl:empty{display:none}
#ctl .seg{flex-wrap:wrap}
#ctl>.tog{align-self:flex-start}
.cnote{margin:0;color:var(--dim);font-size:15px;line-height:1.5}
.stitle{margin:0;font-family:var(--fd);font-weight:600;font-size:17px}
.row{display:flex;gap:8px;flex-wrap:wrap}
.cnote.small{font-size:13.5px;color:var(--faint)}
.rng{display:flex;flex-direction:column;gap:6px;font-family:var(--fm);font-size:12px;color:var(--dim)}
.rng input{width:100%;accent-color:var(--acc)}
.steps{display:flex;gap:4px;list-style:none;margin:0;padding:0;flex-wrap:wrap}
.steps button{width:30px;padding:0;height:30px;border-radius:50%;border:1px solid var(--line);background:var(--chip);
  color:var(--faint);font-family:var(--fm);font-size:12px;cursor:pointer}
.steps button[aria-current="true"]{background:var(--acc);border-color:var(--acc);color:var(--acc-ink)}
#hud .how{margin:0;font-family:var(--fm);font-size:11px;color:var(--faint);line-height:1.5}

/* materials */
.mcls{margin:4px 4px 2px;font-family:var(--fd);font-size:12.5px;font-weight:600;color:var(--faint)}
.mrow{display:grid;grid-template-columns:14px 1fr auto;align-items:center;gap:9px;width:100%;background:none;border:1px solid transparent;
  border-radius:6px;padding:6px 6px;cursor:pointer;color:var(--text);text-align:left;min-height:34px}
.mrow:hover{border-color:var(--line)}
.mrow[aria-pressed="true"]{border-color:var(--acc);background:var(--acc-faint)}
.mrow .sw{width:14px;height:14px;border-radius:3px;border:1px solid rgba(255,255,255,.25)}
.mrow.nd .sw{border-style:dashed;opacity:.6}
.mrow.nd .mn{color:var(--dim)}
.mrow .mn{font-family:var(--fd);font-size:14px;line-height:1.25}
.mrow .mf{font-family:var(--fm);font-size:11.5px;color:var(--faint)}
#matsList{display:flex;flex-direction:column;gap:2px}
#matsInfo{margin:4px 4px 0;font-size:14px;line-height:1.45;color:var(--dim)}

/* the lab */
#labKicker{margin:0;font-family:var(--fm);font-size:11.5px;color:var(--faint)}
#labTitle{margin:-6px 0 0;font-family:var(--fd);font-weight:650;font-size:20px;letter-spacing:-.015em;line-height:1.15}
#labCanvas{display:block;width:100%;aspect-ratio:16/11;border-radius:8px;background:var(--ink);border:1px solid var(--line)}
#labCtl{display:flex;flex-direction:column;gap:10px}
#labCtl .rng span{display:flex;justify-content:space-between;gap:10px}
#labCtl .rng b{font-weight:500;color:var(--dim)}
#labCtl .rng output{color:var(--acc)}
#labCtl .seg{flex-wrap:wrap}
#labCtl>.tog{align-self:flex-start}
#labRead{display:grid;grid-template-columns:1fr 1fr;gap:8px 14px;margin:0}
#labRead div{border-left:2px solid var(--line);padding-left:9px}
#labRead dt{font-family:var(--fm);font-size:11px;color:var(--faint)}
#labRead dd{margin:2px 0 0;font-family:var(--fd);font-size:16px;color:var(--text)}
#labMath{background:var(--chip);border:1px solid var(--line);border-radius:8px;padding:4px 12px;overflow-x:auto;color:var(--text)}
#labMath math{font-size:1.12rem;margin:8px 0}
#labBody{margin:0;color:var(--dim);font-size:15px;line-height:1.55}
#labRefs{font-size:12.5px;line-height:1.45;color:var(--faint)}
#labRefs ol{margin:4px 0 0;padding-left:18px}
#labRefs li{margin:2px 0}
#labRefs[hidden]{display:none}
.lnav{display:flex;align-items:center;justify-content:space-between;gap:8px}

/* ---- labels that follow the 3D anchors ---- */
#markers{position:fixed;inset:0;z-index:14;pointer-events:none;transition:opacity .2s}
#markers.off .mk{pointer-events:none}
.mk{
  position:absolute;left:0;top:0;pointer-events:auto;
  display:flex;align-items:center;gap:8px;background:none;border:0;padding:6px;cursor:pointer;
  margin:-14px 0 0 -14px;min-height:28px;
}
.mk .ring{width:16px;height:16px;border-radius:50%;border:2px solid var(--acc);background:var(--acc-soft);flex:none;
  box-shadow:0 0 0 4px rgba(232,163,61,.12)}
.mk .lbl{font-family:var(--fm);font-size:12px;color:var(--text);background:var(--chip);
  padding:3px 8px;border-radius:4px;border:1px solid var(--line);white-space:nowrap}
.mk .sz{margin-left:8px;color:var(--acc)}
.mk:hover .lbl,.mk:focus-visible .lbl{border-color:var(--acc);color:var(--acc)}
/* a label that had to move away from a panel faces back towards its spot */
.mk.flip{flex-direction:row-reverse}
#leaders{position:fixed;inset:0;width:100%;height:100%;z-index:13;pointer-events:none;overflow:visible;transition:opacity .2s}
#leaders line{stroke:var(--acc);stroke-width:1.3;stroke-dasharray:3 3;opacity:.85}
#leaders circle{fill:var(--acc)}
@media (prefers-reduced-motion:no-preference){
  .mk .ring{animation:pulse 2.2s ease-in-out infinite}
  @keyframes pulse{0%,100%{box-shadow:0 0 0 3px rgba(232,163,61,.16)}50%{box-shadow:0 0 0 9px rgba(232,163,61,0)}}
}

/* ---- the detail panel ---- */
#pop{
  position:fixed;z-index:25;left:clamp(12px,2.4vw,28px);top:calc(var(--top) + 52px);
  width:min(410px,32vw);max-height:calc(100vh - var(--top) - 70px);overflow:auto;
  background:var(--panel-strong);backdrop-filter:blur(14px);
  border:1px solid var(--line);border-top:3px solid var(--acc);border-radius:10px;padding:0 0 16px;
}
#pop figure{margin:0}
#pop img{display:block;width:100%;height:auto;max-height:280px;object-fit:cover;border-radius:7px 7px 0 0;background:var(--ink)}
#pop figcaption{font-family:var(--fm);font-size:10.5px;line-height:1.5;color:var(--faint);padding:8px 18px 0}
#pop figcaption a{color:var(--dim)}
#pop h2{font-family:var(--fd);font-weight:650;font-size:22px;letter-spacing:-.015em;margin:14px 18px 6px}
#pop p{margin:0 18px;color:var(--dim);font-size:16px}
#pop #popSize{font-family:var(--fd);font-size:14.5px;color:var(--acc);margin-bottom:8px;line-height:1.45}
#pop #popSize:empty{display:none}
@media (prefers-reduced-motion:no-preference){
  #pop:not([hidden]){animation:popIn .28s cubic-bezier(.2,.8,.2,1)}
  @keyframes popIn{from{opacity:0;transform:translateX(-16px)}to{opacity:1;transform:none}}
}
#pop #popNote{font-family:var(--fm);font-size:10.5px;color:var(--faint);margin-top:10px}
#pop #popNote:empty{display:none}
#popClose,.dlgx{position:absolute;top:8px;right:8px;width:34px;height:34px;border-radius:50%;
  border:0;background:var(--chip);color:var(--text);font-size:20px;line-height:1;cursor:pointer;z-index:2}

/* ---- the story down the right ---- */
#story{position:relative;z-index:10;pointer-events:none}
.stage-sec{min-height:150vh;padding:calc(var(--top) + 14vh) clamp(12px,2.4vw,28px) 0;display:flex;justify-content:flex-end}
.stage-sec:last-child{min-height:110vh}
.card{
  pointer-events:auto;width:min(380px,100%);align-self:flex-start;
  background:var(--panel);backdrop-filter:blur(10px);
  border:1px solid var(--line);border-left:3px solid var(--acc);border-radius:10px;padding:18px 20px;
}
.card .kicker{font-family:var(--fm);font-size:11px;color:var(--faint);margin:0}
.card h2{font-family:var(--fd);font-weight:650;font-size:clamp(24px,2.4vw,30px);letter-spacing:-.02em;line-height:1.08;margin:4px 0 10px}
.card .body{margin:0;color:var(--dim)}
.facts{margin-top:14px;padding-top:12px;border-top:1px solid var(--line)}
.facts .fh{margin:0 0 6px;font-family:var(--fd);font-weight:600;font-size:14px;color:var(--acc)}
.facts ul{margin:0;padding:0 0 0 18px;color:var(--dim);font-size:15px;line-height:1.5}
.facts li{margin:0 0 6px}
.facts li::marker{color:var(--acc)}
.end{position:relative;z-index:10;padding:40px clamp(12px,2.4vw,28px) 60px;color:var(--faint);font-size:15px;max-width:60ch;margin-left:auto}
.branch-card{margin:0 0 28px auto}
.branch-card h2{font-family:var(--fd);font-weight:650;font-size:26px;letter-spacing:-.02em;margin:0 0 8px;color:var(--text)}
.branch-card .body{margin:0 0 14px}

/* ---- the branch: the page holds still and the wheel steps through assembly instead ---- */
html.branch{overflow:hidden}
html.branch #story,html.branch .end{visibility:hidden}

/* ---- hints, top left: is there more, and can I move it ---- */
#hints{position:fixed;top:calc(var(--top) + 2px);left:clamp(12px,2.4vw,28px);z-index:18;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.hint{display:inline-flex;align-items:center;gap:8px;min-height:38px;margin:0;padding:5px 13px 5px 10px;
  border:1px solid var(--line);border-radius:19px;background:var(--chip);backdrop-filter:blur(8px);
  color:var(--dim);font-family:var(--fd);font-size:13.5px;font-weight:500;line-height:1}
button.hint{cursor:pointer}
button.hint:hover{color:var(--text);border-color:var(--acc)}
.hint svg{flex:none;fill:none;stroke:var(--acc);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;overflow:visible}
.hint .mouse{width:15px;height:23px}
.hint .chev{width:11px;height:18px;margin-left:-3px;transition:transform .35s}
#hintScroll[data-dir="up"] .chev{transform:rotate(180deg)}
.hint .orbit{width:31px;height:24px}
.hint .orbit .back{opacity:.4;stroke-dasharray:2 2.6}
.hint .orbit .cube{stroke:var(--text);opacity:.8;stroke-width:1.3}
#hintTurn{transition:opacity .4s}
#hintTurn.done{opacity:.55}
@media (prefers-reduced-motion:no-preference){
  .hint .wheel{animation:wheel 1.7s ease-in-out infinite}
  #hintScroll[data-dir="up"] .wheel{animation-direction:reverse}
  @keyframes wheel{0%{transform:translateY(0);opacity:1}70%{transform:translateY(5px);opacity:0}100%{transform:translateY(0);opacity:0}}
  .hint .chev .c1{animation:chev 1.7s ease-in-out infinite}
  .hint .chev .c2{animation:chev 1.7s ease-in-out .22s infinite}
  @keyframes chev{0%,100%{opacity:.25}40%{opacity:1}}
  .hint .orbit .front{stroke-dasharray:20 5;animation:orb 2.6s linear infinite}
  @keyframes orb{to{stroke-dashoffset:-25}}
  #hintTurn:not(.done) .cube{animation:sway 2.6s ease-in-out infinite;transform-origin:18px 13px}
  @keyframes sway{0%,100%{transform:translateX(-1px)}50%{transform:translateX(1px)}}
}

dialog.dlg{max-width:min(720px,calc(100vw - 24px));max-height:84vh;overflow:auto;background:var(--panel-solid);
  color:var(--text);border:1px solid var(--line);border-radius:12px;padding:24px 26px}
dialog.dlg::backdrop{background:rgba(5,7,14,.7)}
.dlg h2{font-family:var(--fd);margin:0 0 8px;padding-right:40px}
.dlg h3{font-family:var(--fd);font-size:17px;margin:20px 0 6px}
.dlg p,.dlg li{color:var(--dim);font-size:14.5px;line-height:1.55}
.dlg p{margin:0 0 8px}
.dlg a{color:var(--acc)}
.dlg .more{display:flex;flex-wrap:wrap;gap:8px 18px;list-style:none;padding:0;margin:0}
/* the About dialog's tabs: about, photograph credits, legal */
.dtabs{display:flex;flex-wrap:wrap;gap:4px;border-bottom:1px solid var(--line);margin:4px 0 6px}
.dtabs button{font:inherit;font-size:14px;color:var(--dim);background:none;border:0;border-bottom:2px solid transparent;
  padding:10px 12px 8px;min-height:44px;cursor:pointer;margin-bottom:-1px}
.dtabs button[aria-selected="true"]{color:var(--text);border-bottom-color:var(--acc)}
.dtabs button:focus-visible{outline:2px solid var(--acc);outline-offset:-2px;border-radius:6px}
.dlg [role="tabpanel"]:focus-visible{outline:2px solid var(--acc);outline-offset:4px;border-radius:6px}
.dlg [role="tabpanel"] > h3:first-child{margin-top:12px}
.tog.icon{display:inline-flex;align-items:center;justify-content:center;width:36px;padding:0}
.tog.icon svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.tog.icon svg .dot{fill:currentColor;stroke:none}

/* ---- narrow screens: the story goes full width, the HUD shrinks ---- */
@media (max-width:820px){
  .brand{display:none}
  #rail .nm{display:none!important}
  /* eleven stops do not fit a phone: the rail becomes a strip that scrolls sideways */
  #rail{justify-content:flex-start;overflow-x:auto;scrollbar-width:none;-webkit-mask-image:linear-gradient(90deg,#000 85%,transparent);mask-image:linear-gradient(90deg,#000 85%,transparent)}
  #rail::-webkit-scrollbar{display:none}
  #rail button{padding:10px 6px;flex:none}
  #hud .how{display:none}
  .stage-sec{justify-content:stretch}
  .card{width:100%}
  .hint{font-size:12.5px;min-height:34px;padding:4px 11px 4px 9px}
  #hud .cmp{font-size:13.5px}
  /* the story card already names the stage, and the scene needs the room */
  #hud h1{display:none}
  .card{padding:14px 16px}
  .card .body{font-size:16px}
}

@media (max-width:520px){
  #hintTurn .ht{display:none}
  #hintTurn{padding-right:10px}
}

@media (max-width:640px){
  .tools{gap:6px}
  #level button{padding:7px 8px}
}

/* ---- the 404 and the redirect page ---- */
.nf{max-width:60ch;margin:18vh auto 0;padding:0 20px;color:var(--dim)}
.nf h1{font-family:var(--fd);font-weight:650;font-size:clamp(30px,5vw,48px);letter-spacing:-.02em;color:var(--text);margin:0 0 12px}
.nf a{color:var(--acc)}
.nf a.tog{display:inline-block;text-decoration:none;margin-top:8px}

/* ---- logic level meter, transistor stage ---- */
.logic .lh{margin:0 0 6px;font-family:var(--fd);font-size:13px;font-weight:600;color:var(--dim)}
.lbar{position:relative;display:flex;height:24px;border-radius:6px;overflow:visible;font-family:var(--fm);font-size:12px}
.lbar span{display:flex;align-items:center;justify-content:center}
.lbar .z0{width:30%;background:rgba(134,146,172,.28);border-radius:6px 0 0 6px;color:var(--text)}
.lbar .zx{width:40%;background:repeating-linear-gradient(135deg,rgba(255,132,150,.16) 0 6px,rgba(255,132,150,.05) 6px 12px);color:#FF8496}
.lbar .z1{width:30%;background:rgba(232,163,61,.30);border-radius:0 6px 6px 0;color:var(--acc)}
.lbar .lm{position:absolute;top:-5px;bottom:-5px;left:100%;width:4px;margin-left:-2px;border-radius:2px;background:var(--text);box-shadow:0 0 0 2px var(--ink)}
.logic[data-state="1"] .lm{background:var(--acc)}
.logic[data-state="2"] .lm{background:#FF8496}
@media (prefers-reduced-motion:no-preference){.lbar .lm{transition:left .25s}}
.lt{position:relative;height:16px;margin-top:4px;font-family:var(--fm);font-size:10.5px;color:var(--faint)}
.lt span{position:absolute;top:0;transform:translateX(-50%);white-space:nowrap}
.lt span:first-child{left:0;transform:none}
.lt .a{left:30%}
.lt .b{left:70%}
.lt span:last-child{right:0;left:auto;transform:none}
.logic .ln{margin-top:6px}

@media (max-width:820px){
  /* on a phone the dock is a sheet along the bottom */
  #hud{left:8px;right:8px;top:auto;bottom:8px;width:auto;max-height:46vh;padding:10px 12px 0}
  #pop{left:8px;right:8px;width:auto;top:auto;bottom:8px;max-height:62vh}
  .tabs{margin:8px -12px 0}
  .panes{margin:0 -12px;padding:10px 12px 12px}
  #labRead{grid-template-columns:1fr}
}

/* ---- a recording (?capture): solid panels, so only what really moves changes between frames ---- */
html.capture #hud,html.capture .card,html.capture #hints>*,html.capture #zoom button{background:var(--panel-solid);backdrop-filter:none}

/* ---- zoom for the 3D view: along the bottom, just right of the dock, clear of the story cards ---- */
#zoom{position:fixed;left:calc(clamp(12px,2.4vw,28px) + min(410px,32vw) + 14px);bottom:clamp(12px,3vh,28px);z-index:16;display:flex;flex-direction:row;gap:6px}
#zoom button{width:42px;height:42px;border-radius:50%;border:1px solid var(--line);background:var(--panel);backdrop-filter:blur(8px);
  color:var(--text);cursor:pointer;display:grid;place-items:center;padding:0}
#zoom button:hover{border-color:var(--acc);color:var(--acc)}
#zoom svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#btnTheme svg .sun{display:none}
:root[data-theme="light"] #btnTheme svg .sun{display:inline}
:root[data-theme="light"] #btnTheme svg .moon{display:none}

/* ---- the dock on a phone folds down to its first lines ---- */
#dockFold{display:none}
@media (max-width:820px){
  #zoom{top:calc(var(--top) + 48px);bottom:auto;left:auto;right:8px}
  #zoom button{width:38px;height:38px}
  #dockFold{display:grid;place-items:center;position:absolute;top:4px;right:8px;width:40px;height:32px;border:0;background:none;color:var(--dim);cursor:pointer}
  #dockFold svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;transition:transform .2s}
  #hud.mini .tabs,#hud.mini .panes,#hud.mini .cmp{display:none}
  #hud.mini{padding-bottom:10px}
  #hud.mini #dockFold svg{transform:rotate(180deg)}
}
