/* The button, cable and destination share a single 600 × 190 drawing space. */
#scene.has-circuit .stage-prop {
  display: none;
}
#scene.has-circuit .performer {
  width: 43%;
  height: 55%;
  left: 30%;
  bottom: 37%;
}
#scene.has-circuit .ground-shadow {
  bottom: 38%;
  width: 30%;
  left: 35%;
}
#scene.has-circuit .bubble {
  top: 4%;
  right: 3%;
  max-width: 46%;
  font-size: 18px;
}
.cable-board {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 3%;
  height: 38%;
  z-index: 12;
  isolation: isolate;
}
.cable-board::before {
  content: "";
  position: absolute;
  inset: 0 -1% -5%;
  border-radius: 28px;
  background: #fff7e4e8;
  border: 2px solid #fffdf3;
  box-shadow: 0 8px 20px #50324a30;
  z-index: -1;
}
.cable-wires {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}
.cable-track,
.cable-core,
.cable-signal {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cable-track {
  stroke: #543746;
  stroke-width: 16;
}
.cable-core {
  stroke: #df9e55;
  stroke-width: 9;
}
.cable-signal {
  stroke: #fff28c;
  stroke-width: 10;
  opacity: 0;
  filter: drop-shadow(0 0 5px #fff169);
}
.is-running .cable-signal {
  opacity: 1;
}
.cable-plug {
  fill: #7654a3;
  stroke: #4b3159;
  stroke-width: 4;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.circuit-button {
  position: absolute;
  left: 4%;
  top: 18%;
  width: 21%;
  height: 59%;
  border: 0;
  background: none;
  isolation: isolate;
  padding: 0;
}
.button-foot {
  position: absolute;
  inset: 29% 0 7%;
  background: #92563e;
  border: 3px solid #5d3e37;
  border-radius: 50% 50% 25% 25%;
  box-shadow: 0 7px 0 #f1c78b;
}
.button-top {
  position: absolute;
  inset: 0 0 28%;
  background: radial-gradient(ellipse at 35% 22%, #ffc89a, #eb845d 65%);
  border: 3px solid #884b3e;
  border-radius: 50%;
  box-shadow:
    inset 0 -8px 0 #c65d45,
    0 10px 0 #b35d43;
  transition: transform 0.15s;
  display: grid;
  place-items: center;
}
.button-top svg {
  width: 50%;
  height: 80%;
}
.button-word {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12%;
  font-size: clamp(12px, 1.1vw, 19px);
  font-weight: 1000;
  letter-spacing: 0.12em;
  color: #604131;
}
.circuit-button:enabled:hover .button-top {
  transform: translateY(-3px);
}
.circuit-button:enabled:active .button-top,
.is-running .button-top {
  transform: translateY(9px);
  box-shadow:
    inset 0 -3px 0 #c65d45,
    0 2px 0 #b35d43;
}
.circuit-button:disabled {
  opacity: 1;
  cursor: default;
}
.circuit-button:focus-visible,
.circuit-card:focus-visible {
  outline: 4px solid #6d469a;
  outline-offset: 5px;
}
.circuit-cards {
  position: absolute;
  left: 38%;
  right: 0;
  top: 5%;
  height: 53%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4%;
}
.circuit-card {
  min-width: 0;
  position: relative;
  border: 3px solid #bdab91;
  border-radius: 16px;
  background: #fffdf4;
  box-shadow: 0 5px 0 #d7c2a2;
  padding: 3px 7px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #624653;
}
.circuit-card svg {
  height: 70%;
  width: 100%;
  overflow: visible;
}
.circuit-card > span:last-child {
  font-weight: 1000;
  font-size: clamp(10px, 0.95vw, 16px);
  line-height: 1;
}
.circuit-card:disabled {
  opacity: 1;
  cursor: default;
}
.circuit-card.intended {
  border-color: #a38bc1;
}
.circuit-card.connected {
  border-color: #67418f;
  box-shadow:
    0 5px 0 #68468f,
    0 0 0 3px #dac3ef;
}
.card-socket {
  position: absolute;
  left: calc(50% - 9px);
  bottom: -10px;
  width: 18px;
  height: 14px;
  border-radius: 5px;
  background: #533b59;
  border: 3px solid #bc9fcb;
}
.is-arrived .circuit-card.connected {
  background: #fff0ad;
  box-shadow:
    0 5px 0 #a88439,
    0 0 0 5px #f8d563;
}
.quiet .cable-plug {
  transition: none;
}
.quiet.is-running .cable-signal {
  stroke-dasharray: none;
  stroke-dashoffset: 0;
}
#hint .script-link {
  display: block;
  margin-top: 6px;
  color: #68468f;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 760px) {
  .cable-board {
    height: 39%;
  }
  .circuit-card {
    border-width: 2px;
    border-radius: 10px;
    padding: 2px 3px 4px;
  }
  .circuit-card > span:last-child {
    font-size: 10px;
  }
  .button-word {
    font-size: 11px;
  }
  #scene.has-circuit .bubble {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cable-plug,
  .button-top {
    transition: none;
  }
}
body.still .cable-plug,
body.still .button-top {
  transition: none;
}

.is-arrived .button-top {
  transform: translateY(0);
  box-shadow:
    inset 0 -8px 0 #c65d45,
    0 10px 0 #b35d43;
}
/* Keep the actor's feet clear of the console and label the physical cap. */
#scene.has-circuit .performer {
  bottom: 42%;
  height: 53%;
}
#scene.has-circuit .ground-shadow {
  bottom: 42%;
}
.circuit-button .button-top svg {
  display: none;
}
.circuit-button .button-word {
  top: 22%;
  bottom: auto;
  z-index: 2;
  color: #fff9e5;
  font-size: clamp(12px, 1.25vw, 21px);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 1px #914b36;
  pointer-events: none;
}
@media (max-width: 760px) {
  .circuit-button .button-word {
    font-size: 12px;
    top: 24%;
  }
}
.circuit-button .button-word {
  transition: transform 0.15s;
}
.circuit-button:enabled:active .button-word,
.is-running .button-word {
  transform: translateY(9px);
}
.is-arrived .button-word {
  transform: translateY(0);
}
.quiet .button-word,
body.still .button-word {
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  .circuit-button .button-word {
    transition: none;
  }
}
/* A single light-bead is the causal signal; the cord stays dark behind it. */
.cable-board::before {
  background: linear-gradient(145deg, #fff5df, #ecd2a6);
  border: 3px solid #fff9eb;
  box-shadow:
    inset 0 0 0 3px #c69d6d,
    0 9px 0 #8d644b55,
    0 12px 26px #50324a30;
}
.cable-track {
  stroke: #3b273f;
  stroke-width: 18;
}
.cable-core {
  stroke: #72556f;
  stroke-width: 9;
}
.cable-bead {
  opacity: 0;
  pointer-events: none;
}
.is-running .cable-bead {
  opacity: 1;
}
.bead-glow {
  fill: #ffed68;
  opacity: 0.24;
}
.bead-body {
  fill: #ffe648;
  stroke: #fffef0;
  stroke-width: 4;
  filter: drop-shadow(0 2px 3px #382339);
}
.bead-glint {
  fill: white;
}
.is-at-socket .circuit-card.connected .card-socket {
  background: #ffe648;
  border-color: #fffef0;
  box-shadow:
    0 0 0 4px #61446b,
    0 0 16px #fff56c;
}
.circuit-card {
  background: linear-gradient(135deg, #fffef6, #f4e2bf);
  border-color: #bca17c;
  box-shadow:
    0 5px 0 #b9986e,
    inset 0 2px 0 white;
}
.circuit-card.connected {
  border-color: #775482;
  box-shadow:
    0 5px 0 #775482,
    0 0 0 2px #dac3df;
}
.circuit-card.intended {
  border-color: #a58bb6;
}
.circuit-card svg {
  height: 75%;
}
.button-top {
  box-shadow:
    inset 0 4px 0 #ffe1bd,
    inset 0 -9px 0 #c25e47,
    0 12px 0 #a6503e;
}
.is-running .button-top {
  transform: translateY(12px);
  box-shadow:
    inset 0 3px 0 #ef9e73,
    inset 0 -3px 0 #ba5b45,
    0 1px 0 #a6503e;
}
.is-running .button-word {
  transform: translateY(12px);
}
.is-at-socket .button-top,
.is-arrived .button-top {
  transform: translateY(0);
  box-shadow:
    inset 0 4px 0 #ffe1bd,
    inset 0 -9px 0 #c25e47,
    0 12px 0 #a6503e;
}
.is-at-socket .button-word,
.is-arrived .button-word {
  transform: translateY(0);
}
.gesture-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.choice-gesture {
  width: 42px;
  height: 42px;
  flex: none;
}
.quiet .cable-bead {
  opacity: 0;
}
.cable-comet-tail {
  fill: none;
  stroke: #ffc447;
  stroke-width: 12;
  stroke-linecap: round;
  opacity: 0;
  filter: drop-shadow(0 1px 2px #fff9b3);
}
.is-running .cable-comet-tail {
  opacity: 0.85;
}
.cable-plug {
  transition: none;
}
.cable-flight {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  width: clamp(54px, 7vw, 100px);
  aspect-ratio: 1;
  background: #ffe296;
  border: 3px solid #fff9dc;
  border-radius: 24px;
  box-shadow:
    0 0 0 3px #a77c4b,
    0 8px 22px #744d3e44;
  display: grid;
  place-items: center;
}
.cable-flight svg {
  width: 80%;
  height: 80%;
}
.is-running .circuit-card:not(.connected) {
  opacity: 0.48;
}
.is-at-socket .circuit-card.connected {
  background: #ffcf76;
  transform: translateY(-3px) scale(1.08);
  box-shadow:
    0 5px 0 #b17c3b,
    0 0 0 4px #fff0b7;
}
.circuit-card {
  transition:
    transform 0.18s,
    background 0.18s,
    opacity 0.18s;
  transform-origin: 50% 100%;
}
.circuit-card > span:last-child {
  font-size: clamp(14px, 1.4vw, 24px);
}
.circuit-button::after {
  content: "";
  position: absolute;
  inset: -5% -5% 15%;
  border: 4px solid #ffc369;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.is-running .circuit-button::after {
  animation: press-ring 0.55s ease-out 1;
}
@keyframes press-ring {
  0% {
    transform: scale(0.85);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}
.quiet .cable-comet-tail {
  opacity: 0;
}
.quiet .circuit-card {
  transition: none;
}
.quiet.is-at-socket .circuit-card.connected {
  transform: none;
}
@media (max-width: 760px) {
  .circuit-card > span:last-child {
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .circuit-card {
    transition: none;
  }
  .is-running .circuit-button::after {
    animation: none;
  }
  .is-at-socket .circuit-card.connected {
    transform: none;
  }
}
body.still .circuit-card {
  transition: none;
}
body.still .is-running .circuit-button::after {
  animation: none;
}
body.still .is-at-socket .circuit-card.connected {
  transform: none;
}
/* Grid items must not grow to the SVG's intrinsic height. */
.circuit-cards {
  grid-template-rows: minmax(0, 1fr);
}
.circuit-card {
  height: 100%;
  min-height: 0;
  overflow: visible;
}
.circuit-card svg {
  flex: 1 1 0;
  min-height: 0;
  height: 0;
  width: 100%;
}
.circuit-card > span:last-child {
  flex: 0 0 auto;
  line-height: 1.15;
}
