/* The Zap Lab. Its layout (the fixed overlay, the two-sided grid, the room layers
   and the creature slot) is shared with the other rooms in potions.css, and the
   pantry, plate and dish styles come from kitchen.css; this file is only what is
   the lab's own. */

#zaplab { --zap-cool: #4a3f86; --zap-glow: #bff6ff; }

/* ---------------------------------------------------------------- the room */

.zap-panel { fill: rgba(255, 255, 255, 0.035); stroke: rgba(191, 246, 255, 0.12); stroke-width: 2; }
.zap-cable { fill: none; stroke: #1c1640; stroke-width: 10; stroke-linecap: round; }
.zap-light { fill: #8ff3ff; animation: zap-blink 2.4s ease-in-out infinite; }
@keyframes zap-blink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.zap-pad-rim { fill: none; stroke: rgba(233, 226, 255, 0.55); stroke-width: 3; stroke-dasharray: 4 8; }

/* The creature is a little smaller here, so it fits beside the Zapper. */
#zaplab .creature-slot { width: 30%; }

/* --------------------------------------------------------------- the benches */

/* Each bench is painted like its hopper, warm for food and teal for drink, with a
   3 px rim over 3:1 against its fill and a tab on its inner edge pointing at the
   machine, so the pairing is literal rather than a faint rim (UX-REVIEW.md, Z1). */
.zap-shelf { grid-template-columns: repeat(3, 1fr); }
.bench-zap-foods {
  --bench-edge: #c98a5a;
  background: linear-gradient(180deg, #4a3428, #2c1f1a);
  box-shadow: 0 12px 30px rgba(7, 4, 15, 0.55), inset 0 0 0 3px var(--bench-edge);
}
.bench-zap-drinks {
  --bench-edge: #5fd8ee;
  background: linear-gradient(180deg, #17485a, #0e2a36);
  box-shadow: 0 12px 30px rgba(7, 4, 15, 0.55), inset 0 0 0 3px var(--bench-edge);
}
.bench-zap-foods, .bench-zap-drinks { position: relative; overflow: visible; }
.bench-zap-foods::after, .bench-zap-drinks::after {
  content: ''; position: absolute; top: 50%; width: 22px; height: 22px;
  background: var(--bench-edge); transform: translateY(-50%) rotate(45deg); border-radius: 4px;
}
.bench-zap-foods::after  { right: -9px; }
.bench-zap-drinks::after { left: -9px; }
.zap-item { position: relative; }
.zap-item[aria-pressed="true"] { border-color: #ffffff; box-shadow: 0 0 0 2px #ffffff, 0 0 16px rgba(191, 246, 255, 0.7); }
.bench-zap-foods .zap-item { border-color: rgba(201, 138, 90, 0.6); background: linear-gradient(180deg, #6a4a38, #3d2a22); }
.bench-zap-drinks .zap-item { border-color: rgba(95, 216, 238, 0.6); background: linear-gradient(180deg, #1f5f76, #123845); }
@media (max-aspect-ratio: 5/6) { .bench-zap-foods::after, .bench-zap-drinks::after { display: none; } }
/* a food's flavour, small in the corner, so strawberry and blueberry pancakes differ */
.zap-badge { position: absolute; right: 2px; bottom: 2px; width: 38% !important; height: 38% !important; }

/* ---------------------------------------------------------------- the Zapper */

/* Anchored by its base on the floor. */
.zapper {
  position: absolute; aspect-ratio: 300 / 340; transform: translate(-50%, -100%);
  pointer-events: auto;
}
.zapper > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible;
  filter: drop-shadow(0 10px 12px rgba(7, 4, 15, 0.55)); }
.zapper.bump > svg { animation: bowl-bump 0.35s cubic-bezier(.3, 1.5, .5, 1); }
.zapper.over > svg { filter: drop-shadow(0 0 18px rgba(191, 246, 255, 0.9)); }

.zap-foot  { fill: #241c4a; }
.zap-cab   { stroke: rgba(255, 255, 255, 0.18); stroke-width: 3; }
.zap-hopper { stroke-width: 4; }
.zap-hopper-food  { fill: #4a3428; stroke: #c98a5a; }
.zap-hopper-drink { fill: #17485a; stroke: #5fd8ee; }
.zap-lamp  { fill: #ffd27a; animation: zap-blink 1.6s ease-in-out infinite; }
.zap-dome  { stroke: rgba(230, 245, 255, 0.7); stroke-width: 4; }
.zap-dome-shine { fill: none; stroke: rgba(255, 255, 255, 0.5); stroke-width: 6; stroke-linecap: round; }
.zap-band  { fill: #9d93d8; }
.zap-coil  { fill: #8b80c9; }
.zap-ball  { fill: #d9d2ff; transition: fill 0.2s ease; }
.zap-bolts polyline { fill: none; stroke: #e8fdff; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 6px #8ff3ff); }

/* What is in the dome, floating: the food on the left, the drink on the right. */
.in-dome {
  position: absolute; width: 27%; top: 25%; pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(7, 4, 15, 0.4));
  animation: dome-float 2.4s ease-in-out infinite;
}
.in-dome[hidden] { display: none; }
.dome-food  { left: 21%; }
.dome-drink { left: 52%; animation-delay: -1.2s; }
@keyframes dome-float { 50% { translate: 0 -8%; } }

/* The big button on the cabinet's front. It lights and pulses once both are in. */
.zap-button {
  /* 30% of the machine: about 87 px on the iPad, the biggest target in the room */
  position: absolute; left: 50%; top: 77%; width: 30%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; padding: 0;
  background: radial-gradient(circle at 38% 32%, #ffb3c1, #e0355a 55%, #8e1433);
  border: 4px solid #2a2150;
  /* Not ready: dark, sunk flat into the cabinet. Ready: full colour, raised on its
     shadow with a white ring, and pulsing. The ring and the height survive reduced
     motion and red-green colour blindness, where the hue alone did not. */
  box-shadow: 0 1px 0 #1b1440;
  filter: saturate(0.3) brightness(0.55);
  transition: filter 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}
.zap-button.ready {
  filter: none; transform: translate(-50%, -54%);
  box-shadow: 0 0 0 4px #ffffff, 0 5px 0 #1b1440, 0 8px 14px rgba(7, 4, 15, 0.5);
  animation: zap-ready 1.1s ease-in-out infinite;
}
.zap-button:active { transform: translate(-50%, -46%); box-shadow: 0 0 0 4px #ffffff, 0 1px 0 #1b1440; }
.zap-button.nudge { animation: zap-nudge 0.4s ease; }
@keyframes zap-ready { 50% { box-shadow: 0 0 0 4px #ffffff, 0 5px 0 #1b1440, 0 0 26px 8px rgba(255, 90, 130, 0.8); } }
@keyframes zap-nudge { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }

/* Zapping: the machine shakes, the coil glows, and the two in the dome spin into one. */
.zapper.zapping > svg { animation: zap-shake 0.12s linear infinite; }
.zapper.zapping .zap-ball { fill: #bff6ff; }
.zapper.zapping .in-dome { animation: zap-spin 2.1s ease-in forwards; }
@keyframes zap-shake { 25% { transform: translate(-1.5%, 0.5%) rotate(-0.6deg); } 75% { transform: translate(1.5%, -0.5%) rotate(0.6deg); } }
@keyframes zap-spin {
  to { left: 36.5%; top: 26%; rotate: 720deg; scale: 0.2; opacity: 0; }
}

/* -------------------------------------------------------------- the invention */

.result-box-zap {
  background: radial-gradient(ellipse at 50% 45%, #4a3f86, #231b4a 72%);
  box-shadow: inset 0 0 0 3px rgba(191, 246, 255, 0.45), 0 10px 24px rgba(7, 4, 15, 0.45);
}
.result-reset-zap { color: #bff6ff; border-color: rgba(191, 246, 255, 0.55); }
.dish.invention { filter: drop-shadow(0 10px 10px rgba(7, 4, 15, 0.55)); }
.inv-pic { position: absolute; inset: 0; filter: drop-shadow(0 0 14px var(--glow, #bff6ff)) drop-shadow(0 0 4px var(--glow, #bff6ff)); }
.inv-pic img { position: absolute; pointer-events: none; }
.inv-food  { inset: 0; width: 100%; height: 100%; }
.inv-drink { width: 52%; height: 52%; right: -14%; bottom: -8%; rotate: 16deg; }
.inv-bits { position: absolute; inset: 0; }
.inv-bits img { width: 22%; height: 22%; transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  filter: drop-shadow(0 1px 1.5px rgba(7, 4, 15, 0.45)); }

#z-creature.chomp { animation: chomp 0.7s cubic-bezier(.3, 1.4, .5, 1); }

@media (prefers-reduced-motion: reduce) {
  .zap-light, .zap-lamp, .in-dome, .zap-button.ready, .zapper.zapping > svg { animation: none; }
}
