/* 03-final — THE ROOM: his room as the section under the hero, scene layers, live overlays, hotspots, plug. */

/* ====================================================================== layout
   .den is his room, right under the hero: the Room's whole first screen, now a
   section of the page. Stack (default: portrait, phones): its title and note,
   then the room, the plug right under it, the object dock, the burn ticker.
   Side (landscape >= 760px, aspect >= 5/4): title, plug and ticker in a column
   on the left wall, the square scene at full height on the right; the section
   is one screen under the top bar, where a link or room.bringUp() puts it. The
   stage spans the whole width there, so the camera can fly over the wall.
   --S is the scene size in both layouts. */
.den {
  --S: min(100vw, 52svh);
  --gut: 16px;
  --col: 640px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "stage" "plug" "dock" "foot";
  background: var(--wall);
  isolation: isolate;
  /* html's scroll padding is the bar + 12 px: a link puts the section right under the bar */
  scroll-margin-top: -12px;
}
.den > .den__head { grid-area: head; }
.den > .stage { grid-area: stage; }
.den > .plug { grid-area: plug; }
.den > .dock { grid-area: dock; }
.den > .burn { grid-area: foot; }
.den > :is(.den__head, .plug, .burn) {
  position: relative;
  z-index: 10;
  min-width: 0;
  max-width: var(--col);
  margin-inline: max(var(--gut), calc((100% - var(--col)) / 2));
  transition: opacity 0.4s;
}
.wall {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.035) 1px, transparent 1.6px) 0 0 / 7px 7px,
    linear-gradient(180deg, #19181e 0%, #121116 60%, #0d0d11 100%);
}
.wall__glow {
  position: absolute;
  right: calc(var(--S) * 0.42);
  top: -20%;
  width: 120vh;
  height: 120vh;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 137, 73, 0.16) 0%, rgba(252, 92, 4, 0.06) 35%, transparent 65%);
  transition: background 1.2s;
}
.wall__cables {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #050507;
  stroke-width: 9;
  stroke-linecap: round;
  opacity: 0.85;
}
.stage {
  position: relative;
  height: var(--S);
  overflow: hidden;
}
.camera {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}
.scene {
  position: absolute;
  top: 0;
  left: calc(50% - var(--S) / 2);
  width: var(--S);
  height: var(--S);
  overflow: hidden;
  container: scene / inline-size;
  background: #0d0c10;
}
.scene::after {
  /* soft edges where the art meets the wall */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px #000;
}

@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 600px) {
  /* the left column stays in flow: if a small screen needs more height than
     the viewport, the section grows instead of clipping; the room stays on top */
  .den {
    --den-h: calc(100svh - var(--topbar-h));
    --S: min(var(--den-h), calc(100vw - clamp(440px, 38vw, 580px)));
    --gut: clamp(18px, 2.6vw, 52px);
    --col: 600px;
    min-height: var(--den-h);
    grid-template-columns: minmax(0, calc(100% - var(--S)));
    grid-template-rows: minmax(10px, 1fr) auto auto auto minmax(10px, 1fr);
    grid-template-areas: "." "head" "plug" "foot" ".";
    row-gap: clamp(8px, 1.6vh, 20px);
  }
  .stage {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: var(--den-h);
  }
  .scene {
    left: auto;
    right: 0;
    top: max(0px, calc((var(--den-h) - var(--S)) / 2));
  }
  .scene::after {
    box-shadow: none;
    background:
      linear-gradient(90deg, var(--wall) 0%, rgba(21, 20, 26, 0.75) 2.5%, transparent 9%),
      linear-gradient(180deg, rgba(13, 13, 17, 0.6) 0%, transparent 5%, transparent 95%, rgba(13, 13, 17, 0.6) 100%);
  }
}

/* ====================================================================== rooms
   Each room = planes (bg plate, fg cutout, front bits) + art overlays authored
   in image pixels (1254 x 1254) scaled by --k, + hotspot layers. */
.room {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
}
.room.is-active { opacity: 1; visibility: visible; }
.plane, .hotspots {
  position: absolute;
  inset: 0;
  transform: scale(1.03);
}
.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.art {
  position: absolute;
  left: 0;
  top: 0;
  width: 1254px;
  height: 1254px;
  transform-origin: 0 0;
  transform: scale(var(--k, 0.5));
  pointer-events: none;
}
html:not(.js) .art, html:not(.js) .hotspots { display: none; }
.art [style*="--x"] {
  position: absolute;
  left: calc(var(--x) * 1px);
  top: calc(var(--y) * 1px);
}

/* light pools */
.light {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.light--before {
  background:
    radial-gradient(circle at 51% 15%, transparent 0 16%, rgba(8, 6, 12, 0.16) 38%, rgba(5, 4, 9, 0.46) 72%, rgba(3, 3, 6, 0.66) 100%);
}
.light--before::after {
  /* extra darkness that grows when the bulb dips */
  content: "";
  position: absolute;
  inset: 0;
  background: #030306;
  opacity: var(--dim, 0);
}
.light--after {
  background:
    radial-gradient(circle at 30% 12%, rgba(255, 196, 110, 0.12), transparent 45%),
    radial-gradient(circle at 50% 60%, transparent 40%, rgba(10, 6, 2, 0.35) 100%);
}

/* ---------------------------------------------------------------- bulb */
.bulb-patch { position: absolute; left: 588px; top: 0; width: 106px; height: 254px; }
.bulb {
  position: absolute;
  left: 600px;
  top: 0;
  width: 80px;
  height: 232px;
  transform-origin: 40px 0;
  animation: sway 3.8s ease-in-out infinite alternate;
}
@keyframes sway {
  from { transform: rotate(-1.3deg); }
  to { transform: rotate(1.3deg); }
}
.bulb__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bulb__cord { fill: #1d1c20; stroke: #000; stroke-width: 3; }
.bulb__socket { fill: #2c2b30; stroke: #000; stroke-width: 3.5; }
.bulb__collar { fill: #3d3c43; stroke: #000; stroke-width: 3.5; }
.bulb__glass { fill: #ffe27a; stroke: #111; stroke-width: 4.5; transition: fill 0.15s; }
.bulb__shine { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; opacity: 0.75; }
.bulb__wire { fill: none; stroke: #8a6316; stroke-width: 2.5; }
.bulb__coil { fill: none; stroke: #fff8d6; stroke-width: 3.5; stroke-linecap: round; }
.bulb__glow {
  position: absolute;
  left: 40px;
  top: 188px;
  width: 620px;
  height: 620px;
  margin: -310px 0 0 -310px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 160, 0.62) 0%, rgba(255, 200, 100, 0.32) 12%, rgba(253, 130, 62, 0.12) 34%, transparent 62%);
  opacity: var(--bulb, 1);
}
.is-bulb-off .bulb__glass { fill: #6f6a5f; }
.is-bulb-off .bulb__coil { stroke: #3a352c; }
.is-bulb-off .bulb__glow { opacity: 0; }

/* ---------------------------------------------------------------- rig */
.fan {
  position: absolute;
  left: calc((var(--cx) - var(--ry)) * 1px);
  top: calc((var(--cy) - var(--ry)) * 1px);
  width: calc(var(--ry) * 2px);
  height: calc(var(--ry) * 2px);
  transform: scaleX(calc(var(--rx) / var(--ry)));
  opacity: var(--fan-op, 1);
}
.fan i {
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(30, 30, 36, 0.2) 0 18%, transparent 19%),
    repeating-conic-gradient(from 8deg, rgba(8, 8, 12, 0.9) 0deg 13deg, rgba(64, 64, 72, 0.5) 13deg 32deg, rgba(30, 30, 36, 0.62) 32deg 51.43deg);
  filter: blur(1.4px);
}
.fan b {
  position: absolute;
  left: 34%;
  top: 34%;
  width: 32%;
  height: 32%;
  border-radius: 50%;
  border: 4px solid #000;
  background: radial-gradient(circle at 38% 34%, #6a6a74 0%, #34343b 55%, #222227 100%);
}
.led {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: #ffd08a;
  box-shadow: 0 0 6px 2px rgba(252, 117, 43, 0.95), 0 0 16px 6px rgba(252, 92, 4, 0.45);
  animation: ledBlink var(--d, 2s) steps(1) var(--o, 0s) infinite;
}
.led--g { background: #c8ffd8; box-shadow: 0 0 6px 2px rgba(39, 240, 107, 0.95), 0 0 16px 6px rgba(39, 240, 107, 0.4); }
.led--r { background: #ffc0c0; box-shadow: 0 0 6px 2px rgba(255, 59, 59, 0.95), 0 0 14px 5px rgba(255, 59, 59, 0.45); }
@keyframes ledBlink {
  0%, 62% { opacity: 1; }
  63%, 100% { opacity: 0.15; }
}
.strip {
  position: absolute;
  width: 13px;
  height: calc(var(--h) * 1px);
  border-radius: 7px;
  background: rgba(253, 123, 52, 0.38);
  box-shadow: 0 0 22px 8px rgba(252, 92, 4, 0.32);
  animation: stripPulse 3.2s ease-in-out infinite alternate;
}
@keyframes stripPulse {
  from { opacity: 0.45; }
  to { opacity: 1; }
}
.shimmer { position: absolute; left: 0; top: 0; }
.shimmer i {
  position: absolute;
  background-image: url("../shared/img/layers/rtc-mining-room-bg.webp");
  background-size: 1254px 1254px;
}
.heat {
  position: absolute;
  left: 24px;
  top: 150px;
  width: 330px;
  height: 160px;
  overflow: visible;
}
.heat path {
  fill: none;
  stroke: rgba(255, 196, 130, 0.42);
  stroke-width: 5;
  stroke-linecap: round;
  transform-box: fill-box;
  animation: heatRise 3.4s linear infinite;
  opacity: 0;
}
.heat path:nth-child(2) { animation-delay: -0.9s; }
.heat path:nth-child(3) { animation-delay: -1.8s; }
.heat path:nth-child(4) { animation-delay: -2.6s; }
@keyframes heatRise {
  0% { transform: translateY(26px) scaleY(0.8); opacity: 0; }
  30% { opacity: 0.9; }
  100% { transform: translateY(-46px) scaleY(1.1); opacity: 0; }
}

/* ---------------------------------------------------------------- meter */
.meter {
  position: absolute;
  left: 0;
  top: 0;
  width: 170px;
  height: 80px;
  transform-origin: 0 0;
  border-radius: 5px;
  background: radial-gradient(ellipse at 50% 40%, #2a0606 0%, #160303 70%);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9);
}
.sevenseg { position: absolute; inset: 6px 8px; width: calc(100% - 16px); height: calc(100% - 12px); overflow: visible; }
.sevenseg .seg { fill: #3d0b0b; }
.sevenseg .seg.on { fill: #ff4b4b; filter: drop-shadow(0 0 3px rgba(255, 60, 60, 0.95)); }
.sevenseg .euro { fill: none; stroke: #ff4b4b; stroke-width: 3.4; stroke-linecap: round; filter: drop-shadow(0 0 3px rgba(255, 60, 60, 0.95)); }
.sevenseg .msg { fill: #ff4b4b; font: 400 22px/1 var(--ff-pixel); filter: drop-shadow(0 0 3px rgba(255, 60, 60, 0.9)); }

/* ---------------------------------------------------------------- monitors */
.screen {
  position: absolute;
  left: 0;
  top: 0;
  width: 430px;
  height: 262px;
  transform-origin: 0 0;
}
.screen__in {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 12px;
  padding: 16px 14px 12px 16px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 30% 20%, #142553 0%, #0a1430 70%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.7);
  color: #fff;
}
.screen p { margin: 0; }
.screen__left, .screen__right { position: relative; display: flex; flex-direction: column; min-width: 0; }
.screen__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 400 27px/1 var(--ff-display);
  letter-spacing: 0.03em;
}
.screen__coin {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #000;
  background: radial-gradient(circle at 40% 35%, #fd8b4c, #fc5c04 60%, #cd4a02);
  color: #3b1d00;
  font: 400 30px/1 var(--ff-display);
}
.screen__label { margin-top: 22px !important; font: 400 21px/1 var(--ff-display); letter-spacing: 0.03em; color: #eef2ff; }
.screen__value { font: 400 44px/1 var(--ff-num); letter-spacing: 0.02em; color: #fc762d; text-shadow: 0 0 10px rgba(252, 92, 4, 0.55); white-space: nowrap; }
.screen p.screen__value { overflow-wrap: normal; }
.screen__right {
  padding: 10px 10px 8px;
  border: 3px solid #ff3b3b;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(120, 10, 30, 0.35), rgba(60, 0, 15, 0.55));
  box-shadow: 0 0 14px rgba(255, 59, 59, 0.45), inset 0 0 14px rgba(255, 59, 59, 0.25);
}
.screen__right {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto 1fr auto;
  column-gap: 4px;
}
.screen__right .screen__label { grid-column: 1 / -1; margin-top: 0 !important; font-size: 18px; }
.screen__value--red { grid-column: 1; grid-row: 2; margin-top: 2px; font-size: 38px; color: #ff3b3b; text-shadow: 0 0 10px rgba(255, 59, 59, 0.7); }
.screen__warn { grid-column: 2; grid-row: 2; align-self: center; width: 34px; height: 34px; fill: none; stroke: #ff3b3b; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(255, 59, 59, 0.8)); animation: verdict 1.6s steps(1) infinite; }
.screen__chart { width: 100%; height: auto; margin-top: auto; }
.screen__chart--red { grid-column: 1 / -1; grid-row: 3; align-self: center; margin: 2px 0 0; }
.screen__right .screen__verdict { grid-column: 1 / -1; grid-row: 4; }
.screen p { overflow-wrap: anywhere; }
.screen__verdict {
  margin-top: 4px !important;
  font: 400 22px/1 var(--ff-display);
  letter-spacing: 0.03em;
  color: #ff3b3b;
  text-shadow: 0 0 10px rgba(255, 59, 59, 0.85);
  animation: verdict 1.6s steps(1) infinite;
}
@keyframes verdict {
  0%, 70% { opacity: 1; }
  71%, 100% { opacity: 0.25; }
}
.screen__off {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #020308;
  color: #4a5274;
  font: 400 26px/1 var(--ff-pixel);
  opacity: 0;
  visibility: hidden;
}
/* the dead screen types one order before the candle (unplug.js) */
.screen__term {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 0 28px;
  background: #020308;
  color: #c9ffd9;
  font: 400 25px/1.05 var(--ff-pixel);
  text-shadow: 0 0 8px rgba(139, 255, 58, 0.7);
  opacity: 0;
  visibility: hidden;
}
.screen .screen__term p { margin: 0; overflow-wrap: anywhere; }
.screen__term-l1 { color: #fff; font-size: 52px; letter-spacing: 0.04em; }
.screen__prompt { color: var(--copium); }
.screen__caret {
  display: inline-block;
  width: 0.45em;
  height: 0.8em;
  margin-left: 6px;
  background: var(--copium);
  vertical-align: -0.05em;
  animation: caret 0.9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.screen__term.is-done .screen__term-l1 { color: var(--green); text-shadow: 0 0 14px rgba(39, 240, 107, 0.9); }
.screen__term.is-done .screen__caret { display: none; }
.screen__candle {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
}
.screen__candle::before {
  content: "";
  position: absolute;
  left: calc(50% - 110px);
  top: calc(50% - 110px);
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(39, 240, 107, 0.55) 0%, rgba(39, 240, 107, 0.18) 40%, transparent 70%);
}
.screen__candle svg { position: relative; width: 66px; height: 214px; overflow: visible; filter: drop-shadow(0 0 16px rgba(39, 240, 107, 0.95)); }
.screen__candle rect { fill: #27f06b; stroke: #000; stroke-width: 4; }
.screen__candle .wick { stroke: #27f06b; stroke-width: 5; }
.screen__time {
  position: absolute;
  right: 16px;
  top: 12px;
  font: 400 30px/1 var(--ff-pixel);
  color: #27f06b;
  text-shadow: 0 0 10px rgba(39, 240, 107, 0.8);
}
.screen--after { width: 400px; height: 236px; }
.screen--after .screen__in {
  display: block;
  padding: 0;
  background:
    linear-gradient(rgba(60, 110, 200, 0.12) 1px, transparent 1px) 0 0 / 100% 39px,
    linear-gradient(90deg, rgba(60, 110, 200, 0.12) 1px, transparent 1px) 0 0 / 50px 100%,
    radial-gradient(ellipse at 70% 10%, #13285a 0%, #0a1430 75%);
}
.screen2__title {
  position: absolute;
  left: 18px;
  top: 14px;
  padding: 4px 10px 2px;
  border: 2px solid #fc5c04;
  border-radius: 6px;
  color: #fd8949;
  font: 400 20px/1 var(--ff-display);
  letter-spacing: 0.04em;
}
.screen2__chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen2__candle {
  position: absolute;
  right: 20px;
  bottom: 16px;
  color: #27f06b;
  font: 400 22px/1 var(--ff-display);
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px rgba(39, 240, 107, 0.7);
}
.screen2__candle b { font: 400 26px/1 var(--ff-pixel); }

/* ---------------------------------------------------------------- window, moon */
.moon-glow {
  width: calc(var(--r) * 2px);
  height: calc(var(--r) * 2px);
  margin: calc(var(--r) * -1px) 0 0 calc(var(--r) * -1px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 96, 0.55) 0%, rgba(253, 130, 62, 0.24) 34%, transparent 68%);
  animation: breathe 6.5s ease-in-out infinite alternate;
}
@keyframes breathe {
  from { transform: scale(0.9); opacity: 0.65; }
  to { transform: scale(1.08); opacity: 1; }
}
.twinkles i {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.8);
  animation: twinkle var(--d) ease-in-out infinite alternate;
}
@keyframes twinkle {
  from { opacity: 0.2; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1.15); }
}
.lit i {
  width: calc(var(--w) * 1px);
  height: calc(var(--h) * 1px);
  border: 2px solid #000;
  background: #fd8949;
  box-shadow: 0 0 10px rgba(253, 137, 73, 0.8);
  animation: litFlick var(--d) steps(1) infinite;
}
@keyframes litFlick {
  0%, 88% { opacity: 1; }
  89%, 93% { opacity: 0.08; }
  94%, 100% { opacity: 1; }
}

/* ---------------------------------------------------------------- UV scribbles */
.scribble {
  width: calc(var(--w) * 1px);
  margin: 0;
  color: #d6ff5c;
  font: 400 calc(var(--fs) * 1px)/1.05 var(--ff-hand);
  text-shadow: 0 0 6px rgba(170, 255, 60, 0.9), 0 0 16px rgba(120, 255, 40, 0.55);
  transform: rotate(var(--r));
  opacity: 0;
  transition: opacity 0.5s;
}
.is-flash .scribble { opacity: 0.96; }

/* ---------------------------------------------------------------- after room */
.lamp-glow {
  width: 520px;
  height: 520px;
  margin: -200px 0 0 -260px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 210, 120, 0.34) 0%, rgba(253, 130, 62, 0.12) 40%, transparent 70%);
  animation: breathe 7s ease-in-out infinite alternate;
}
.citylights i {
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--c, #ffc46b);
  box-shadow: 0 0 10px 3px var(--c, rgba(253, 143, 82, 0.8));
  animation: twinkle var(--d) ease-in-out infinite alternate;
}
.rigglow {
  width: 150px;
  height: 150px;
  margin: -75px 0 0 -75px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 136, 72, 0.6) 0%, rgba(252, 92, 4, 0.2) 40%, transparent 70%);
  animation: breathe 2.6s ease-in-out var(--o, 0s) infinite alternate;
}
.zzz span {
  position: absolute;
  left: 0;
  top: 0;
  color: #fff6dd;
  font: 400 44px/1 var(--ff-hand);
  text-shadow: 3px 3px 0 #000;
  opacity: 0;
  animation: zzz 4.2s ease-out infinite;
}
.zzz span:nth-child(2) { animation-delay: 1.4s; font-size: 36px; }
.zzz span:nth-child(3) { animation-delay: 2.8s; font-size: 28px; }
@keyframes zzz {
  0% { transform: translate(0, 0) rotate(-10deg); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(46px, -120px) rotate(14deg); opacity: 0; }
}
.smoke i {
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 220, 230, 0.5) 0%, rgba(200, 200, 210, 0.2) 45%, transparent 70%);
  opacity: 0;
  animation: smoke 5s ease-out infinite;
}
.smoke i:nth-child(2) { animation-delay: 1.7s; }
.smoke i:nth-child(3) { animation-delay: 3.4s; }
@keyframes smoke {
  0% { transform: translate(0, 170px) scale(0.4); opacity: 0; }
  20% { opacity: 0.85; }
  100% { transform: translate(-26px, -60px) scale(2.2); opacity: 0; }
}
.ember {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3c4 0%, #fc5c04 35%, rgba(252, 92, 4, 0.4) 55%, transparent 72%);
  animation: ember 1.8s ease-in-out infinite alternate;
}
@keyframes ember {
  from { transform: scale(0.75); opacity: 0.7; }
  to { transform: scale(1.2); opacity: 1; }
}

/* ---------------------------------------------------------------- front plane */
.plane--front { transform: scale(1.05); }
.dust { position: absolute; inset: 0; width: 100%; height: 100%; }
.front-cable {
  position: absolute;
  left: -3%;
  top: -4%;
  width: 14%;
  height: 46%;
  fill: none;
  stroke: #050506;
  stroke-width: 16;
  stroke-linecap: round;
  filter: blur(2.5px);
  opacity: 0.9;
}

/* ====================================================================== hotspots */
.hotspots { z-index: 20; pointer-events: none; }
.hs {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  text-align: left;
  pointer-events: auto;
  transform: translate(-22px, -50%);
  -webkit-tap-highlight-color: transparent;
}
.hs--left { flex-direction: row-reverse; transform: translate(calc(-100% + 22px), -50%); text-align: right; }
.hs--down { flex-direction: column; gap: 2px; transform: translate(-50%, -22px); text-align: center; }
.hs--up { flex-direction: column-reverse; gap: 2px; transform: translate(-50%, calc(-100% + 22px)); text-align: center; }
.hs__ring {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
}
.hs__ring::before, .hs__ring::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
}
.hs__ring::before {
  border: 3px solid #fff;
  box-shadow: 0 0 0 2.5px #000, inset 0 0 0 2px #000, 0 0 16px rgba(255, 200, 120, 0.55);
}
.hs__ring::after {
  border: 3px solid rgba(255, 196, 110, 0.9);
  animation: hsPulse 2.6s ease-out infinite;
}
@keyframes hsPulse {
  0% { transform: scale(1); opacity: 0.95; }
  70%, 100% { transform: scale(1.75); opacity: 0; }
}
.hs__num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2.5px solid #000;
  border-radius: 50%;
  background: var(--btc);
  color: #000;
  font: 400 15px/1 var(--ff-display);
  transition: transform 0.2s var(--ease-pop), background-color 0.2s;
}
.hs__label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 10em;
  padding: 4px 8px 3px;
  border: 2px solid #000;
  border-radius: 8px;
  background: rgba(8, 8, 12, 0.86);
  color: #fff;
  font: 400 15px/1.05 var(--ff-display);
  letter-spacing: 0.045em;
  box-shadow: 2px 2px 0 rgba(252, 92, 4, 0.9);
  /* at rest only the numbered rings show: a label appears on hover, on focus,
     when the pointer comes near, and during the first-visit hint */
  opacity: 0;
  transform: scale(0.8);
  transform-origin: var(--lo, 0 50%);
  transition: opacity 0.22s, transform 0.25s var(--ease-pop), background-color 0.2s, color 0.2s;
}
.hs--left .hs__label { --lo: 100% 50%; }
.hs--down .hs__label { --lo: 50% 0; }
.hs--up .hs__label { --lo: 50% 100%; }
.hs__label .ico { width: 17px; height: 17px; stroke-width: 2.6; }
.hs:is(:hover, :focus-visible, .is-near, .is-picked) .hs__label,
.den.is-labels .hs__label,
.hs--hot .hs__label { opacity: 1; transform: none; }
.hs:is(:hover, :focus-visible, .is-picked) .hs__num { transform: scale(1.25); background: #fff; }
.hs:is(:hover, :focus-visible, .is-picked) .hs__label { background: var(--btc); color: #000; }
/* the one label that never hides: the signature gesture */
.hs--hot .hs__label {
  background: var(--btc);
  color: #000;
  font-size: 17px;
  box-shadow: 3px 3px 0 #000;
  animation: hotNudge 2.4s ease-in-out infinite;
}
.hs--hot .hs__num { background: #fff3c4; }
@keyframes hotNudge {
  0%, 70%, 100% { translate: 0 0; }
  80% { translate: 5px 0; }
  90% { translate: 1px 0; }
}
.hs:focus-visible { outline: none; }
.hs:focus-visible .hs__ring::before { box-shadow: 0 0 0 2.5px #000, 0 0 0 6px var(--amber); }
@container scene (max-width: 620px) {
  /* the rings only, the rig's too: its always-on "Unplug me" lay over ring 1; the UNPLUG THE ASIC socket is right
     under the stage and the dock names the rig */
  .hs:not(.is-picked) .hs__label { display: none; }
  .hs:not(.hs--hot) { transform: translate(-50%, -50%); }
  /* a tapped ring flashes its name above itself before the camera flies in */
  .hs.is-picked .hs__label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    display: inline-flex;
    translate: -50% 0;
  }
  .hs.is-picked.is-below .hs__label { bottom: auto; top: calc(100% + 2px); }
  .hs.is-picked.is-start .hs__label { left: 0; translate: 0 0; }
  .hs.is-picked.is-end .hs__label { left: auto; right: 0; translate: 0 0; }
  .hs--hot .hs__label { font-size: 14px; padding: 3px 7px 2px; }
}
.is-zoomed .hotspots, .is-busy .hotspots, .is-flash .hotspots { opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.is-zoomed .hs, .is-busy .hs, .is-flash .hs { pointer-events: none; }
.hotspots .hs { transition: opacity 0.3s; }

/* ====================================================================== stage UI */
.darkness {
  position: absolute;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
}
.darkness.is-on { opacity: 1; }
/* the lights-on intro (room.js): the room waits in the dark, a dark room and not a blank block: about a tenth of
   the art shows through and the dead bulb still glows; the wall around it stays as it is */
.den.is-intro .scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 14;
  pointer-events: none;
  background: radial-gradient(circle at 50.8% 15%, rgba(255, 214, 140, 0.16), rgba(4, 4, 7, 0.9) 28%);
}
.speedlines {
  position: absolute;
  inset: 0;
  z-index: 41;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  overflow: visible;
}
.speedlines path { fill: rgba(255, 246, 220, 0.55); }
.flash {
  position: absolute;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--fx, 60%) var(--fy, 45%), #f1fff4 0%, #6dffa0 18%, #27f06b 38%, rgba(10, 60, 30, 0.96) 80%);
}
.room-hint {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: 8px;
  margin: 0;
  padding: 5px 12px 4px;
  border: 3px solid #000;
  border-radius: 999px;
  background: #fff7e6;
  color: #111;
  font: 400 15px/1.1 var(--ff-display);
  letter-spacing: 0.04em;
  text-align: center;
  box-shadow: 4px 4px 0 #000;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 24px);
  animation: hintBob 2.4s ease-in-out infinite;
}
@keyframes hintBob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}
.room-hint__touch { display: none; }
@media (hover: none) {
  .room-hint__mouse { display: none; }
  .room-hint__touch { display: inline; }
}
.room-hint.is-gone { opacity: 0; transition: opacity 0.4s; }
.den.is-after .room-hint { display: none; }
.is-zoomed .room-hint, .is-busy .room-hint { opacity: 0; transition: opacity 0.3s; }
.lights-on {
  position: absolute;
  z-index: 60;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  background: #fff3c4;
  color: #000;
}
/* the unplug sequence can be cut short (click, Space, Esc or this button) */
.seq-skip {
  position: absolute;
  z-index: 60;
  right: 12px;
  bottom: 12px;
  gap: 4px;
  padding-inline: 14px 10px;
  background: rgba(16, 16, 20, 0.86);
}
.seq-skip .ico { width: 18px; height: 18px; }
@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 600px) {
  .room-hint { left: calc(100% - var(--S) / 2); bottom: 14px; padding: 7px 14px 6px; font-size: 19px; }
  .lights-on { left: calc(100% - var(--S) / 2); }
  .seq-skip { right: 18px; bottom: 18px; }
}

/* ====================================================================== dock */
.dock {
  position: relative;
  z-index: 6;
  margin-top: 14px;
  padding: 10px 0;
  background: linear-gradient(180deg, #121116, #0d0c10);
  border-block: 3px solid #000;
}
.dock__list {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 2px 16px 6px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: #3a3940 transparent;
}
.dock__list li { flex: none; scroll-snap-align: start; }
.dock__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 12px 6px 6px;
  border: 2px solid #000;
  border-radius: 12px;
  background: #24232a;
  color: var(--paper);
  font: 600 14px/1.15 var(--ff-body);
  box-shadow: 3px 3px 0 #000;
  white-space: nowrap;
}
/* the same number as the ring on the art, so "7" always means the pizza box */
.dock__n {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border: 2px solid #000;
  border-radius: 999px;
  background: var(--btc);
  color: #000;
  font: 400 14px/1 var(--ff-display);
}
.dock__item .ico { width: 24px; height: 24px; color: var(--btc); }
.dock__item .ico--head { width: auto; height: 30px; margin: -4px 0; }
.dock__item--hot { background: var(--btc); color: #000; }
.dock__item--hot .ico { color: #000; }
.dock__item--hot .dock__n { background: #fff3c4; }
.dock li[data-for="after"], .den.is-after .dock li[data-for="before"] { display: none; }
.den.is-after .dock li[data-for="after"] { display: block; }
@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 600px) {
  .dock { display: none; }
}
/* tall side layouts: the dock is the room's legend on the left wall, under the plug, in two columns, so the
   numbered rings have their names without a hover (a shorter screen keeps the column to the head and the plug) */
@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 860px) {
  .den {
    grid-template-rows: minmax(10px, 1fr) auto auto auto auto minmax(10px, 1fr);
    grid-template-areas: "." "head" "plug" "dock" "foot" ".";
  }
  .den > .dock {
    display: block;
    z-index: 10;
    max-width: var(--col);
    margin: 0 max(var(--gut), calc((100% - var(--col)) / 2));
    padding: 0;
    border: 0;
    background: none;
    transition: opacity 0.4s;
  }
  .dock__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0; overflow: visible; }
  .dock__item { width: 100%; white-space: normal; text-align: left; }
  .is-zoomed .dock { opacity: 0; pointer-events: none; }
}

/* ====================================================================== head
   The section's title and its note (the numbers on the art are the story's), then,
   once the ASIC is unplugged, the after room's headline. The five-second test is
   the hero's: this column only tells what the room is. */
.den__head {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: clamp(28px, 7vw, 44px) 0 16px;
  container-type: inline-size;
}
.den__note { margin: 0; color: var(--amber); font: 700 14px/1.45 var(--ff-body); }
@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 600px) {
  .den__head { gap: clamp(8px, 1.4vh, 14px); padding: 0; }
}
.is-zoomed :is(.den__head, .plug, .burn) { opacity: 0; pointer-events: none; }
.is-busy :is(.den__head, .burn) { opacity: 0.25; }

.after-line { display: none; }
.after-line__big {
  margin: 0 0 6px;
  font: 400 clamp(26px, 7.4cqi, 46px)/1 var(--ff-display);
  letter-spacing: 0.02em;
  color: #c9ffd9;
  text-shadow: 0 0 2px #fff, 0 0 12px rgba(39, 240, 107, 0.9), 0 0 28px rgba(39, 240, 107, 0.55), 3px 3px 0 #000;
}
.after-line__sub { margin: 0; font: 600 clamp(15px, 3cqi, 17px)/1.35 var(--ff-body); color: var(--paper); }
/* the two lines stay in the PDF's English; other languages read them under */
.after-line__tr { margin: 0 0 8px; color: #b9f3cb; font: 500 clamp(14px, 2.8cqi, 16px)/1.35 var(--ff-body); }
.den.is-after .after-line { display: block; }
.den.is-after .burn { color: #9fe9b6; }
.den.is-after .burn::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.burn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 16px 0 34px;
  color: #ffb1b1;
  font: 400 clamp(18px, 0.5vw + 14px, 21px)/1.15 var(--ff-pixel);
  letter-spacing: 0.02em;
}
.burn::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 0.3em;
  border-radius: 2px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}
@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 600px) {
  .burn { padding: 0; }
}
/* short landscape screens: the plain extras give way to the title and the plug */
@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 600px) and (max-height: 800px) {
  .burn { display: none; }
  .plug { padding: 8px 12px; }
  .plug__hint { display: none; }
}

/* the lights-on intro (room.js): the rings and the hint wait in the dark too */
.den.is-intro :is(.room-hint, .hs) { opacity: 0; }

/* ====================================================================== the plug */
.plug {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 3px solid #000;
  border-radius: 18px;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 204, 0, 0.09) 0 12px, transparent 12px 24px),
    #18171d;
  box-shadow: 4px 4px 0 #000;
  container: plug / inline-size;
}
.den > .plug { margin-top: 12px; }
@media (min-aspect-ratio: 5/4) and (min-width: 760px) and (min-height: 600px) {
  .den > .plug { margin-top: 0; }
}
.plug__text { flex: 1 1 210px; min-width: 0; }
/* narrow sockets stack: the title and hint on top, a full-width rig below
   (a longer pull for the thumb) */
@container plug (max-width: 470px) {
  .plug__text { flex-basis: 100%; }
  .plug__hint { margin-top: 4px; }
  .plug__rig { flex-basis: 100%; min-width: 0; }
}
.plug__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--btc);
  font: 400 clamp(24px, 1.2vw + 16px, 32px)/1 var(--ff-display);
  letter-spacing: 0.04em;
  text-shadow: 2px 2px 0 #000;
}
.plug__title .ico { width: 26px; height: 26px; stroke-width: 2.6; }
.plug__hint { margin: 6px 0 0; color: var(--muted); font: 500 14px/1.35 var(--ff-body); }
.plug__t-off, .plug__back { display: none; }
.den.is-after .plug__t-on { display: none; }
.den.is-after .plug__t-off { display: inline; }
.den.is-after .plug__back { display: inline-flex; margin-top: 10px; }
.den.is-after .plug__hint { display: none; }
.den.is-after .plug__title { color: var(--green); }
.plug__rig {
  position: relative;
  flex: 1 1 240px;
  min-width: 240px;
  height: 96px;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(90deg, #0f0e12 0 24px, transparent 24px),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 1.5px) 0 0 / 6px 6px,
    #1f1e24;
  border: 2px solid #000;
}
.plug__wall { position: absolute; left: 4px; top: -2px; z-index: 2; width: 40px; height: 100px; }
.plug__wallline { stroke: #000; stroke-width: 3; }
.plug__plate { fill: #ebe5d6; stroke: #000; stroke-width: 3; }
.plug__slot { fill: #34302a; stroke: #000; stroke-width: 2; }
.plug__screw { fill: #b9b2a2; stroke: #000; stroke-width: 1.5; }
.plug__handle {
  position: absolute;
  left: 26px;
  top: 8px;
  z-index: 1;
  width: 200px;
  height: 80px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  cursor: grab;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.plug__handle:active { cursor: grabbing; }
.plug__handle svg { width: 200px; height: 80px; overflow: visible; }
.plug__cable { fill: none; stroke: #0a0a0c; stroke-width: 11; stroke-linecap: round; }
.plug__cable-hi { fill: none; stroke: #3c3b42; stroke-width: 2.5; stroke-linecap: round; }
.plug__prong { fill: #d8d4cb; stroke: #000; stroke-width: 2.5; }
.plug__body { fill: var(--btc); stroke: #000; stroke-width: 3.5; }
.plug__grip { fill: none; stroke: #a43b02; stroke-width: 4; stroke-linecap: round; }
.plug__tag { fill: #f4ecd8; stroke: #000; stroke-width: 2.5; }
.plug__handle:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
@keyframes plugWiggle {
  0%, 100% { rotate: 0deg; }
  25% { rotate: -4deg; }
  75% { rotate: 4deg; }
}
.plug.is-hot { box-shadow: 4px 4px 0 #000, 0 0 0 4px var(--btc); }
.plug__sparks { position: absolute; left: 30px; top: 48px; z-index: 3; pointer-events: none; }
/* drag affordance: chevrons pointing the way out, and a little nudge now and then */
.plug__arrows {
  position: absolute;
  right: 14px;
  top: calc(50% - 9px);
  display: flex;
  gap: 2px;
  pointer-events: none;
}
.plug__arrows i {
  width: 14px;
  height: 14px;
  border-top: 4px solid var(--btc);
  border-right: 4px solid var(--btc);
  border-radius: 2px;
  transform: rotate(45deg);
  opacity: 0.15;
  animation: chevron 1.5s ease-in-out infinite;
}
.plug__arrows i:nth-child(2) { animation-delay: 0.2s; }
.plug__arrows i:nth-child(3) { animation-delay: 0.4s; }
@keyframes chevron {
  0%, 100% { opacity: 0.15; }
  40% { opacity: 1; }
}
.den.is-after .plug__arrows { display: none; }
.den:not(.is-after) .plug__handle { animation: plugNudge 6.5s ease-in-out 3s infinite; }
@keyframes plugNudge {
  0%, 88%, 100% { translate: 0 0; rotate: 0deg; }
  91% { translate: 9px 0; rotate: 3deg; }
  94% { translate: 2px 0; rotate: -2deg; }
  97% { translate: 6px 0; rotate: 1deg; }
}
.den .plug.is-hot .plug__handle { animation: plugWiggle 0.5s ease-in-out 3; }
.den:not(.is-after) .plug__handle:active { animation: none; }
.plug__sparks i {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: #fff3a0;
  box-shadow: 0 0 6px #ffcc00;
  transform-origin: 0 50%;
}
