/* ============================================================
   Scenes: solution flow (terminal -> 247toegang -> door)
   + finale door-unlock demo
   ============================================================ */

/* ---------- Solution flow ---------- */
#aansluiting { border-top: 1px solid var(--line); }

.flow-diagram {
  --cycle: 3.6s;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 0;
  padding: 60px 52px 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in oklab, var(--surface-solid) 50%, transparent);
  overflow: hidden;
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  text-align: center;
  min-width: 154px;
  z-index: 2;
}

.flow-card {
  width: 116px;
  height: 116px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  color: var(--accent);
  position: relative;
}

.flow-card svg { width: 52px; height: 52px; }

.flow-hub {
  background: color-mix(in oklab, var(--accent) 12%, var(--surface-solid));
  border-color: var(--accent-dim);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.flow-label {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
}

.flow-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: -7px;
  max-width: 150px;
  text-wrap: balance;
}

/* connectors */
.flow-link {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 70px;
  padding: 0 8px;
  z-index: 1;
}

.flow-line {
  position: relative;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-dim), var(--line) 45%, var(--line) 55%, var(--accent-dim));
  opacity: 0.85;
}

.flow-line::before,
.flow-line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--accent-dim);
}

.flow-line::before { left: -3px; }
.flow-line::after { right: -3px; }

.flow-pulse {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent), 0 0 32px var(--accent-glow);
  opacity: 0;
}

.flow-tag {
  position: absolute;
  top: calc(50% + 18px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  color: var(--muted);
  white-space: nowrap;
}

/* synced loop while in view */
.flow-diagram.live .flow-link.l1 .flow-pulse { animation: flowPulse var(--cycle) cubic-bezier(0.5, 0, 0.4, 1) infinite; }
.flow-diagram.live .flow-link.l2 .flow-pulse { animation: flowPulse var(--cycle) cubic-bezier(0.5, 0, 0.4, 1) infinite; animation-delay: calc(var(--cycle) * 0.46); }
.flow-diagram.live .flow-hub { animation: hubPulse var(--cycle) ease-in-out infinite; }
.flow-diagram.live .flow-node:last-child .flow-card { animation: doorRecv var(--cycle) ease-in-out infinite; }

@keyframes flowPulse {
  0% { opacity: 0; left: 0; }
  6% { opacity: 1; }
  40% { opacity: 1; left: calc(100% - 10px); }
  46%, 100% { opacity: 0; left: calc(100% - 10px); }
}

@keyframes hubPulse {
  0%, 34% { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2); }
  44% { box-shadow: 0 0 0 1px var(--accent), 0 0 32px var(--accent-glow), 0 12px 30px rgba(0, 0, 0, 0.2); }
  60%, 100% { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2); }
}

@keyframes doorRecv {
  0%, 82% { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16); }
  90% { box-shadow: 0 0 30px var(--accent-glow), 0 10px 26px rgba(0, 0, 0, 0.16); }
  100% { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16); }
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 30px;
}

.flow-step {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.flow-step b {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  display: grid;
  place-items: center;
}

.flow-step p { font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.flow-step p strong { color: var(--ink); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .flow-diagram.live .flow-pulse,
  .flow-diagram.live .flow-hub,
  .flow-diagram.live .flow-node:last-child .flow-card { animation: none; }
}

@media (max-width: 880px) {
  .flow-diagram { grid-template-columns: 1fr; justify-items: center; gap: 6px; padding: 44px 24px; }
  .flow-link { width: 2px; min-width: 0; height: 56px; padding: 0; justify-content: center; }
  .flow-line { width: 2px; height: 100%; background: linear-gradient(180deg, var(--accent-dim), var(--line) 45%, var(--line) 55%, var(--accent-dim)); }
  .flow-line::before { left: 50%; top: -3px; margin: 0 0 0 -3.5px; }
  .flow-line::after { left: 50%; right: auto; top: auto; bottom: -3px; margin: 0 0 0 -3.5px; }
  .flow-pulse { left: 50%; margin-left: -5px; }
  .flow-tag { top: 50%; left: calc(50% + 14px); transform: translateY(-50%); }
  .flow-diagram.live .flow-link.l1 .flow-pulse,
  .flow-diagram.live .flow-link.l2 .flow-pulse { animation-name: flowPulseV; }
  .flow-steps { grid-template-columns: 1fr; }
}

@keyframes flowPulseV {
  0% { opacity: 0; top: 0; }
  6% { opacity: 1; }
  40% { opacity: 1; top: calc(100% - 10px); }
  46%, 100% { opacity: 0; top: calc(100% - 10px); }
}

/* ---------- Finale: door scene ---------- */
#finale {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 130px 32px 110px;
  overflow: hidden;
}

#finale .section-head { max-width: 640px; margin: 0 auto 56px; text-align: center; }

.scene-wrap {
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
}

.scene {
  position: relative;
  width: min(880px, 100%);
  height: 540px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    radial-gradient(80% 70% at 50% -6%, oklch(0.42 0.03 220 / 0.55), transparent 60%),
    radial-gradient(60% 50% at 38% 108%, var(--accent-glow), transparent 70%),
    linear-gradient(180deg, #12161d, #0a0d12 74%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: box-shadow 1.4s ease, border-color 1.4s ease;
}

/* soft top spotlight + inner vignette */
.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(255, 255, 255, 0.07), transparent 55%);
  pointer-events: none;
  z-index: 5;
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px 10px rgba(0, 0, 0, 0.55);
  border-radius: inherit;
  pointer-events: none;
  z-index: 6;
}

html[data-theme="light"] .scene {
  background:
    radial-gradient(80% 70% at 50% -6%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(60% 50% at 38% 108%, var(--accent-glow), transparent 70%),
    linear-gradient(180deg, #e8ecec, #d6dcdc 74%);
}

html[data-theme="light"] .scene::after { box-shadow: inset 0 0 120px 10px rgba(40, 55, 55, 0.12); }

#finale.f-open .scene { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 40px 110px var(--accent-glow); border-color: var(--accent-dim); }

/* very subtle wall grid, fades out — keeps it calm and clean */
.scene-grid {
  position: absolute;
  inset: 0 0 96px 0;
  background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 92px 92px;
  opacity: 0.5;
  mask-image: radial-gradient(110% 80% at 50% 0%, #000 18%, transparent 76%);
  -webkit-mask-image: radial-gradient(110% 80% at 50% 0%, #000 18%, transparent 76%);
}

.scene-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 96px;
  background: linear-gradient(180deg, #0b0f15 0%, #0f141a 60%, #0b1015 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

/* crisp specular line where wall meets floor */
.scene-floor::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16) 28%, rgba(255, 255, 255, 0.16) 72%, transparent);
}

/* soft reflection band on the floor under the door */
.scene-floor::after {
  content: "";
  position: absolute;
  left: 25%;
  width: 300px;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 72%);
  filter: blur(3px);
  transition: background 1.5s ease 0.75s;
}

/* the door's warm interior pools onto the floor once it opens */
#finale.f-open .scene-floor::after { background: linear-gradient(180deg, var(--accent-glow), transparent 72%); }

html[data-theme="light"] .scene-floor {
  background: linear-gradient(180deg, #c8cfcf, #bcc4c4 92%);
  border-top-color: rgba(0, 0, 0, 0.08);
}

/* ---- Door: modern glass entrance ---- */
.doorframe {
  position: absolute;
  left: 27%;
  bottom: 96px;
  width: 252px;
  height: 398px;
  border-radius: 6px 6px 0 0;
  perspective: 1700px;
  background: #14181c;
  box-shadow:
    inset 0 0 0 8px #2c333b,
    inset 0 0 0 9px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 44px 90px rgba(0, 0, 0, 0.55);
}

html[data-theme="light"] .doorframe {
  background: #aeb6bb;
  box-shadow:
    inset 0 0 0 8px #8a939a,
    inset 0 0 0 9px rgba(255, 255, 255, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 44px 90px rgba(40, 55, 55, 0.25);
}

.doorway {
  position: absolute;
  inset: 8px;
  background: linear-gradient(180deg, #0a1018, #05080d);
  overflow: hidden;
}

.doorway-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(85% 62% at 50% 24%, var(--accent-glow), transparent 64%),
    linear-gradient(180deg, transparent 36%, var(--accent-glow) 130%);
  opacity: 0;
  transition: opacity 1.6s ease 0.55s;
}

#finale.f-open .doorway-glow { opacity: 0.95; }

/* interior floor strip seen once the door opens */
.doorway::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 26%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.06));
  opacity: 0;
  transition: opacity 1.6s ease 0.7s;
}

#finale.f-open .doorway::after { opacity: 1; }

/* the glass door leaf */
.door {
  position: absolute;
  inset: 8px;
  transform-origin: left center;
  transform: rotateY(0deg);
  transition: transform 1.8s cubic-bezier(0.62, 0, 0.18, 1) 0.18s, box-shadow 1.8s ease 0.18s;
  z-index: 2;
  border-radius: 2px;
  background:
    linear-gradient(116deg, rgba(150, 180, 198, 0.2) 0%, rgba(110, 140, 160, 0.08) 42%, rgba(150, 180, 198, 0.16) 100%);
  box-shadow:
    inset 0 0 0 3px #353d45,
    inset 0 0 0 4px rgba(255, 255, 255, 0.07),
    inset 0 0 40px rgba(120, 160, 180, 0.08);
}

/* light streak reflection on the glass */
.door::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(116deg, transparent 24%, rgba(255, 255, 255, 0.1) 34%, transparent 44%, transparent 70%, rgba(255, 255, 255, 0.05) 80%, transparent 88%);
  pointer-events: none;
  border-radius: 2px;
}

/* horizontal metal rails (top & bottom) */
.door-rail {
  position: absolute;
  left: 6px; right: 6px;
  height: 20px;
  background: linear-gradient(180deg, #3c444c, #262c33);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.4);
  z-index: 2;
}
.door-rail.top { top: 10px; }
.door-rail.bottom { bottom: 10px; }

/* long vertical pull handle on the latch side */
.door-pull {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 132px;
  margin-top: -66px;
  border-radius: 4px;
  background: linear-gradient(90deg, #aab3bb, #5c646d);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.55);
  z-index: 3;
}

#finale.f-open .door {
  transform: rotateY(-76deg);
  box-shadow:
    -48px 8px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 0 3px #353d45,
    inset 0 0 0 4px rgba(255, 255, 255, 0.07);
}

/* ---- Electric strike on the latch-side jamb ---- */
.door-strike {
  position: absolute;
  right: -2px;
  top: 50%;
  width: 15px;
  height: 84px;
  margin-top: -42px;
  border-radius: 3px;
  background: linear-gradient(90deg, #4c545d 0%, #2b3139 60%, #353c44 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 3px 8px rgba(0, 0, 0, 0.5);
  z-index: 5;
  transition: box-shadow 0.45s ease, background 0.45s ease;
}

/* mounting screws */
.door-strike::before,
.door-strike::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 3.5px;
  height: 3.5px;
  margin-left: -1.75px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d2d8de, #565e67);
}
.door-strike::before { top: 9px; }
.door-strike::after { bottom: 9px; }

/* keeper pocket where the latch seats */
.strike-keeper {
  position: absolute;
  left: 3px;
  top: 50%;
  width: 8px;
  height: 30px;
  margin-top: -15px;
  border-radius: 2px;
  background: #090d11;
  box-shadow: inset 1.5px 0 4px rgba(0, 0, 0, 0.85);
  transition: box-shadow 0.45s ease, background 0.45s ease;
}

#finale.f-unlock .door-strike,
#finale.f-open .door-strike {
  background: linear-gradient(90deg, var(--accent) 0%, #1f5e44 70%, var(--accent-dim) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 18px var(--accent-glow), 0 0 44px var(--accent-glow);
}

#finale.f-unlock .strike-keeper,
#finale.f-open .strike-keeper {
  background: #0c1f17;
  box-shadow: inset 0 0 8px var(--accent);
}

#finale.f-unlock .door-strike { animation: strikeClick 0.42s cubic-bezier(0.3, 0, 0.2, 1); }

@keyframes strikeClick {
  0% { transform: translateX(0); }
  35% { transform: translateX(2.5px); }
  100% { transform: translateX(0); }
}

/* warm light wedge spilling onto the floor when the door opens */
.door-light {
  position: absolute;
  left: calc(27% - 30px);
  bottom: 0;
  width: 360px;
  height: 138px;
  background: radial-gradient(75% 100% at 42% 0%, var(--accent-glow), transparent 72%);
  filter: blur(7px);
  opacity: 0;
  transform: scaleY(0.4);
  transform-origin: top center;
  transition: opacity 1.5s ease 0.75s, transform 1.5s ease 0.75s;
  pointer-events: none;
}

#finale.f-open .door-light { opacity: 0.95; transform: scaleY(1); }

/* ---- Flat front-on terminal on the wall ---- */
.wall-terminal {
  position: absolute;
  left: calc(27% + 252px + 80px);
  bottom: calc(96px + 127px);
  z-index: 4;
  filter: drop-shadow(0 24px 34px rgba(0, 0, 0, 0.6));
}

/* slim mounting backplate so the terminal reads as wall-mounted, not floating */
.wall-terminal::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80px;
  height: 160px;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 12px 26px rgba(0, 0, 0, 0.42);
  z-index: -1;
}
html[data-theme="light"] .wall-terminal::after {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.32));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 12px 26px rgba(40, 55, 55, 0.16);
}

/* subtle mounting glow behind the terminal */
.wall-terminal::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 150px;
  height: 150px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  z-index: -1;
}

#finale.f-ok .wall-terminal::before,
#finale.f-signal .wall-terminal::before,
#finale.f-unlock .wall-terminal::before,
#finale.f-open .wall-terminal::before { opacity: 0.85; }

.ft-term {
  position: relative;
  width: 66px;
  height: 144px;
  border-radius: 13px;
  background: linear-gradient(158deg, #20252c, #090c10 66%);
  box-shadow:
    inset 0 0 0 1.2px rgba(255, 255, 255, 0.1),
    inset 0 2px 3px rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

/* glass sheen across the front */
.ft-term::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(118deg, transparent 44%, rgba(255, 255, 255, 0.05) 50%, transparent 58%);
  pointer-events: none;
}

/* camera bar — accurate to the model: IR · lens · mic · lens · IR */
.ft-lens, .ft-ir, .ft-mic { position: absolute; transform: translateX(-50%); border-radius: 50%; }
.ft-lens {
  top: 9px;
  width: 7px;
  height: 7px;
  background: radial-gradient(circle at 34% 30%, #4a5660, #05080c 64%);
  box-shadow: 0 0 0 1.3px #1b2127, 0 0 0 3px rgba(26, 52, 70, 0.4);
}
.ft-lens.a { left: 37%; }
.ft-lens.b { left: 63%; }
.ft-ir {
  top: 11px;
  width: 4px;
  height: 4px;
  background: #2c1014;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.ft-ir.a { left: 18%; }
.ft-ir.b { left: 82%; }
.ft-mic { top: 6px; left: 50%; width: 2.4px; height: 2.4px; background: #05080c; }

#finale.f-scan .ft-ir { background: #ff5168; box-shadow: 0 0 6px rgba(255, 80, 105, 0.9); }

.ft-screen {
  position: absolute;
  top: 16px;
  left: 6px;
  right: 6px;
  bottom: 29px;
  border-radius: 6px;
  background: linear-gradient(196deg, #0b2030, #060d15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: background 0.6s ease;
}

.ft-face { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity 0.45s ease; }
.ft-face svg { width: 36px; height: 42px; fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0.6; }

.ft-scanline {
  position: absolute;
  left: 11px;
  right: 11px;
  top: 8px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  opacity: 0;
}

#finale.f-scan .ft-scanline { animation: ftScan 1.6s ease-in-out infinite; }

@keyframes ftScan {
  0% { top: 8px; opacity: 0; }
  16% { opacity: 1; }
  84% { opacity: 1; }
  100% { top: 76%; opacity: 0; }
}

.ft-check {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ft-check svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.ft-hint {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 5.5px;
  letter-spacing: 0.02em;
  color: rgba(180, 210, 225, 0.6);
  transition: opacity 0.4s ease;
}

.ft-logo {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: 42px;
  height: auto;
  opacity: 0.92;
}

.ft-scanner {
  position: absolute;
  bottom: 6px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 3px;
  background: #0a0f15;
  box-shadow: inset 0 0 0 1px rgba(120, 135, 148, 0.45);
}
.ft-scanner::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #1c2832, #05080c);
}

/* approved / unlock states */
#finale.f-ok .ft-face,
#finale.f-signal .ft-face,
#finale.f-unlock .ft-face,
#finale.f-open .ft-face { opacity: 0; }

#finale.f-ok .ft-check,
#finale.f-signal .ft-check,
#finale.f-unlock .ft-check,
#finale.f-open .ft-check { opacity: 1; transform: scale(1); }

#finale.f-ok .ft-screen,
#finale.f-signal .ft-screen,
#finale.f-unlock .ft-screen,
#finale.f-open .ft-screen { background: linear-gradient(196deg, #0b2c20, #06160f); }

#finale.f-ok .ft-hint,
#finale.f-signal .ft-hint,
#finale.f-unlock .ft-hint,
#finale.f-open .ft-hint { opacity: 0; }

/* face-scan pulse rings emitted while scanning */
.scan-ring {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}

#finale.f-scan .scan-ring { animation: scanRing 1.6s cubic-bezier(0.2, 0.6, 0.4, 1) infinite; }
#finale.f-scan .scan-ring.r2 { animation-delay: 0.55s; }
#finale.f-scan .scan-ring.r3 { animation-delay: 1.1s; }

@keyframes scanRing {
  0% { opacity: 0; transform: scale(0.45); }
  18% { opacity: 0.65; }
  100% { opacity: 0; transform: scale(2.4); }
}

/* ---- Signal wire: terminal -> strike ---- */
.wall-wire {
  position: absolute;
  left: calc(27% + 252px - 4px);
  bottom: calc(96px + 195px);
  width: 88px;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(180deg, #2a313a, #161b21);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.5), 0 2px 7px rgba(0, 0, 0, 0.4);
  opacity: 0.92;
  z-index: 3;
  transition: opacity 0.5s ease, box-shadow 0.5s ease;
}
html[data-theme="light"] .wall-wire {
  background: linear-gradient(180deg, #c4cbcf, #9aa3a9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 2px 7px rgba(40, 55, 55, 0.18);
}
/* recessed channel the signal pulse rides in */
.wall-wire::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.4);
}
/* junction cover where the trunking meets the terminal */
.wall-wire::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 12px;
  height: 16px;
  margin-top: -8px;
  border-radius: 3px;
  background: linear-gradient(180deg, #313841, #1b2026);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.45);
}
html[data-theme="light"] .wall-wire::after {
  background: linear-gradient(180deg, #cdd4d8, #a4adb3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 6px rgba(40, 55, 55, 0.18);
}

#finale.f-signal .wall-wire,
#finale.f-unlock .wall-wire,
#finale.f-open .wall-wire { opacity: 1; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.5), 0 0 16px var(--accent-glow); }

.wall-wire .wire-dot {
  position: absolute;
  top: 50%;
  right: 2px;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent), 0 0 30px var(--accent-glow);
  opacity: 0;
  z-index: 2;
}

#finale.f-signal .wire-dot { animation: wireTravel 0.55s cubic-bezier(0.5, 0, 0.4, 1) forwards; }

@keyframes wireTravel {
  0% { opacity: 0; right: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { opacity: 0; right: calc(100% - 9px); transform: none; }
}

/* ---- Status row ---- */
.finale-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#finale-status-text {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
  min-height: 20px;
  transition: opacity 0.18s ease;
}

.f-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.f-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  padding: 0 clamp(24px, 5vw, 52px);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  transition: color 0.45s ease;
}

/* connector running back to the previous node */
.f-step::before {
  content: "";
  position: absolute;
  right: 50%;
  top: 16px;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
  transition: background 0.5s ease;
}
.f-step:first-child::before { display: none; }

/* the node */
.f-step i {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  display: grid;
  place-items: center;
  transition: border-color 0.45s ease, background 0.45s ease, box-shadow 0.45s ease;
}
.f-step i::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.45;
  transition: background 0.45s ease, transform 0.45s ease, opacity 0.45s ease;
}

.f-step.active { color: var(--ink); }
.f-step.active::before { background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.f-step.active i { border-color: var(--accent); background: var(--accent-glow); box-shadow: 0 0 0 4px var(--accent-glow); }
.f-step.active i::after { background: var(--accent); opacity: 1; transform: scale(1.18); }

#finale-replay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#finale-replay.visible { opacity: 1; pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  #finale.f-scan .scan-ring,
  #finale.f-scan .ft-scanline,
  #finale.f-signal .wire-dot,
  #finale.f-unlock .door-strike { animation: none; }
  .door, .door-light, .doorway-glow { transition: none; }
}

@media (max-width: 760px) {
  .scene { height: 430px; }
  .scene-floor { height: 72px; }
  .doorframe { left: 9%; bottom: 72px; width: 196px; height: 312px; }
  .wall-terminal { left: calc(9% + 196px + 40px); bottom: calc(72px + 70px); transform: scale(0.82); transform-origin: bottom center; }
  .wall-wire { left: calc(9% + 196px - 4px); bottom: calc(72px + 142px); width: 44px; }
  .door-light { left: calc(9% - 20px); width: 260px; }
}
