.chapter-nav {
  display: flex;
  align-items: center;
  gap: clamp(2px, 1vw, 10px);
  padding: 4px;
  border: 1px solid #545d5040;
  border-radius: 28px;
  background: #f2eee4ed;
  box-shadow: 0 5px 16px #22281b15;
  transform: translateY(var(--chapter-drift, 0px));
}
.chapter-nav a {
  color: #3e4a40;
  padding: 6px clamp(7px, 1vw, 14px);
  border-radius: 20px;
  text-decoration: none;
  font-size: clamp(.7rem, 1.3vw, .9rem);
  white-space: nowrap;
  transition: background .22s, color .22s;
}
.chapter-nav a[aria-current="location"] { background: #38473e; color: #fffdf5; }
.chapter-nav a:focus-visible { outline: 2px solid #506e60; }
.section[id] { scroll-margin-top: 54px; }
.hero {
  background-position: center, center, calc(50% + var(--scene-x, 0px)) calc(54% + var(--scene-y, 0px));
}
.portrait-scene {
  transform: translate3d(calc(var(--scene-x, 0px) * -.55), calc(var(--scene-y, 0px) * -.55), 0);
  transition: transform .55s cubic-bezier(.17,.66,.35,1);
}
.portrait-pool i.is-interactive {
  left: var(--ripple-x);
  top: var(--ripple-y);
  animation: pond-ripple 2.8s ease-out 1;
}
.portrait-scene .hero-portrait { pointer-events: none; }
.inspection-beam {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(circle 137px at var(--inspect-x, 50%) var(--inspect-y, 50%),
      var(--laser-glow, #a5dce140) 3%, transparent 99%),
    radial-gradient(circle 116px at var(--inspect-x, 50%) var(--inspect-y, 50%),
      #ecfcf619 0 75%, #ecfcf60c 83%, transparent 100%);
  opacity: 0;
  transition: opacity .65s ease;
}
.lab-stage.is-inspecting .inspection-beam { opacity: .78; }
.lab-stage.is-charging .inspection-beam { opacity: .76; }
.lab-stage .meter b {
  color: #c5d3ce;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 calc(4px + 12px * var(--spin-energy, 0)) var(--laser-glow);
}
.lab-stage.is-charging .meter b { color: var(--laser-gleam); }
.lab-stage .spinner-halo::after {
  border-color: var(--laser-accent);
  box-shadow: 0 0 28px var(--laser-glow), inset 0 0 20px var(--laser-glow);
}
.lab-stage .spinner-halo::before {
  animation: energy-orbit 18s linear infinite;
  animation-play-state: paused;
}
.lab-stage.is-spinning .spinner-halo::before { animation-play-state: running; }
@keyframes energy-orbit { to { transform: rotate(360deg); } }
.lab .lab-shell {
  position: relative;
  background: #0e1110;
  border-color: #ccd3cc24;
}
.lab .lab-shell .lab-stage {
  background: radial-gradient(ellipse at 48% 48%, #171b19, #0d100f 52%, #070908 86%);
}
.lab .lab-shell .lab-panel {
  position: relative;
  background: linear-gradient(110deg, #151917e0, #141816 70%);
  border: 0;
}
.lab .lab-shell .lab-panel::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0 auto 0 -42px;
  width: 55px;
  pointer-events: none;
  background: linear-gradient(90deg, #15191700, #151917ef 78%, #15191700);
}
.lab .triple-shell .lab-panel::before { inset: 0 -42px 0 auto; transform: scaleX(-1); }
.lab-stage .spinner-halo { border-width: .5px; border-color: #acc5bc42; }
.lab-stage .spinner-halo::before, .lab-stage .spinner-halo::after { border-width: .5px; }
.stage-wavefield {
  position: absolute;
  z-index: -1;
  width: min(84%, 470px);
  aspect-ratio: 1;
  pointer-events: none;
  transform: rotate(-12deg) scaleY(.86);
}
.triple-stage .stage-wavefield { transform: rotate(19deg) scaleY(.92); }
.stage-wavefield::before,
.stage-wavefield::after {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: .5px solid #becfc844;
  mask-image: conic-gradient(from 16deg, #000 2% 18%, transparent 30% 43%, #000 50% 67%, transparent 79% 96%, #000);
}
.stage-wavefield::after {
  inset: 12%;
  border-style: dotted;
  opacity: .66;
  transform: rotate(49deg);
}
.stage-wavefield i {
  position: absolute;
  inset: 5%;
  border: .5px solid var(--laser-accent);
  border-radius: 50%;
  opacity: 0;
  animation: fine-orbit-ripple 8.4s linear infinite;
}
.stage-wavefield i:nth-child(2) { animation-delay: -2.8s; }
.stage-wavefield i:nth-child(3) { animation-delay: -5.6s; }
@keyframes fine-orbit-ripple {
  0% { opacity: 0; transform: scale(.51); }
  26% { opacity: calc(.12 + .30 * var(--spin-energy, 0)); }
  100% { opacity: 0; transform: scale(1.12); }
}
.lab-stage .meter::after {
  content: "";
  position: absolute;
  inset: auto 0 -6px;
  height: 1px;
  background: repeating-linear-gradient(90deg, #b8c9c548 0 1px, transparent 1px 5px),
    linear-gradient(90deg, var(--laser-accent) calc(var(--spin-energy, 0) * 100%), transparent 0);
}
@media (max-width: 850px) {
  .lab .lab-shell .lab-panel::before {
    inset: -28px 0 auto;
    width: auto;
    height: 38px;
    transform: none;
    background: linear-gradient(180deg, #15191700, #151917ef 76%, #15191700);
  }
}
.inspection-speck {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: 3px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--laser-gleam);
  box-shadow: 0 0 6px var(--laser-accent);
  pointer-events: none;
  animation: inspection-dust .58s ease-out both;
}
@keyframes inspection-dust {
  from { opacity: .49; transform: scale(.9); }
  to { opacity: 0; transform: translate(var(--dx), -13px) scale(.3); }
}
.archive-controls input { min-height: 30px; }
.contact-tools button, .archive-controls button { min-height: 44px; }
@media (max-width: 480px) {
  .nav { gap: 7px; }
  .brand { font-size: .78rem; white-space: nowrap; }
  .chapter-nav a { padding: 7px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .chapter-nav, .portrait-scene { transform: none; }
  .chapter-nav a { transition: none; }
  .lab-stage .spinner-halo::before { animation: none; }
  .stage-wavefield i { animation: none; }
}
