/*
 * Quizshow-Show-Effekte (Spec 2026-11-06 Quizshow, M2): Leuchtschild, Tusch-Lichtlauf, Konfettikanonen.
 * Bausteine: js/quizStage/themeAnim/quizshow/{signs,tusch,cannons}.js. Regeln (Q2): animiert werden nur transform und opacity,
 * Leuchten entsteht über vorgefertigte Ebenen (Verläufe, Schatten), deren Deckkraft sich ändert. Blinker höchstens 3/s.
 * Maße in Container-Einheiten der Effekt-Ebene (cqh/cqw), damit alles mit der Leinwand skaliert.
 * Reduziert (Klasse .is-reduced oder Systemeinstellung): keine Animation, das Schild leuchtet dann statisch.
 */

.pq-qs-fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  container-type: size;
}

/* ---------------------------------------------------------------- Leuchtschild */

.pq-qs-sign {
  --pq-qs-len: 7;
  --pq-qs-w: min(46cqw, 82cqh);
  position: absolute;
  left: 50%;
  top: 3.2cqh;
  width: var(--pq-qs-w);
  aspect-ratio: 4.4 / 1;
  transform: translateX(-50%);
  transform-origin: 50% -3cqh;
}

.pq-qs-sign__hanger {
  position: absolute;
  top: -4cqh;
  width: 0.55cqh;
  height: 4.4cqh;
  border-radius: 0.3cqh;
  background: linear-gradient(90deg, #5d5a66, #d9d6e3 45%, #6e6a78);
  box-shadow: 0 0 0 0.12cqh #1d1726;
}
.pq-qs-sign__hanger--l { left: 16%; }
.pq-qs-sign__hanger--r { right: 16%; }
.pq-qs-sign__hanger::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.5cqh;
  width: 1.4cqh;
  height: 1cqh;
  margin-left: -0.7cqh;
  border-radius: 0.3cqh 0.3cqh 0.1cqh 0.1cqh;
  background: linear-gradient(180deg, #ffe7a0, #b8841f);
  box-shadow: 0 0 0 0.12cqh #3b2208;
}

.pq-qs-sign__glow {
  position: absolute;
  inset: -60% -18% -150% -18%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 46% 26% at 50% 27%, rgb(255 220 120 / 0.85) 0%, rgb(255 150 50 / 0.45) 45%, transparent 75%),
    radial-gradient(ellipse 50% 50% at 50% 42%, rgb(255 120 40 / 0.22) 0%, rgb(255 60 60 / 0.1) 55%, transparent 75%);
  opacity: 0;
}

.pq-qs-sign__box {
  position: absolute;
  inset: 0;
  border-radius: 1.8cqh;
  background: linear-gradient(180deg, #fff0b8 0%, #f0c04c 18%, #b07a1c 52%, #e7b54a 82%, #fff0b8 100%);
  box-shadow:
    inset 0 0 0 0.24cqh #5a3a0c,
    0 1.4cqh 2.6cqh rgb(0 0 0 / 0.6),
    0 0 0 0.3cqh rgb(20 8 30 / 0.7);
}

.pq-qs-sign__band {
  position: absolute;
  inset: 0.75cqh;
  border-radius: 1.3cqh;
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.04) 0 0.5cqh, transparent 0.5cqh 1.6cqh),
    linear-gradient(180deg, #e52a45 0%, #b5132d 45%, #7d0a1f 100%);
  box-shadow: inset 0 0.35cqh 0.6cqh rgb(255 255 255 / 0.28), inset 0 -0.45cqh 0.8cqh rgb(0 0 0 / 0.5);
}

.pq-qs-sign__track {
  position: absolute;
  inset: 1.55cqh 1.7cqh;
}

.pq-qs-sign__bulb {
  position: absolute;
  width: 1.85cqh;
  height: 1.85cqh;
  margin: -0.925cqh 0 0 -0.925cqh;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgb(255 236 190 / 0.6) 0 14%, #8c5d1f 34%, #4a2b0a 72%, #2a1705 100%);
  box-shadow: 0 0 0 0.2cqh #4a0814, 0 0.2cqh 0.25cqh rgb(0 0 0 / 0.55);
}
.pq-qs-sign__bulb::after {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #ffffff 0 14%, #fff4c4 30%, #ffd04a 58%, #ff9a1a 100%);
  box-shadow: 0 0 0.9cqh 0.3cqh rgb(255 205 70 / 0.85), 0 0 2.2cqh 0.5cqh rgb(255 120 30 / 0.45);
  opacity: 0;
}

.pq-qs-sign__glass {
  position: absolute;
  inset: 3.9cqh 4cqh;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 0.8cqh;
  background:
    radial-gradient(ellipse 80% 90% at 50% 45%, #2f0f18 0%, #170609 70%, #0c0305 100%);
  box-shadow: inset 0 0 1.4cqh #000, inset 0 0 0 0.25cqh #3d0b16, 0 0 0 0.25cqh #f3c75a;
}

.pq-qs-sign__text,
.pq-qs-sign__lit {
  grid-area: 1 / 1;
  font-family: Inter, "Arial Black", system-ui, sans-serif;
  font-weight: 900;
  font-size: min(7.6cqh, calc((var(--pq-qs-w) - 10cqh) / (var(--pq-qs-len) * 0.82)));
  line-height: 1;
  letter-spacing: 0.1em;
  padding-left: 0.1em;
  white-space: nowrap;
  text-transform: uppercase;
}
.pq-qs-sign__text {
  color: #4b1820;
  text-shadow: 0 0.06em 0 rgb(0 0 0 / 0.7), 0 -0.03em 0 rgb(255 200 200 / 0.12);
}
.pq-qs-sign__lit {
  color: #fff8d8;
  text-shadow:
    0 0 0.05em #fff,
    0 0 0.16em #ffe07a,
    0 0 0.38em #ffa21f,
    0 0 0.8em #ff4a1f;
  opacity: 0;
}
.pq-qs-sign[data-kind="oooh"] .pq-qs-sign__lit {
  color: #fff0f8;
  text-shadow:
    0 0 0.05em #fff,
    0 0 0.16em #ff9ccf,
    0 0 0.38em #ff3d8b,
    0 0 0.8em #c3165e;
}

.pq-qs-sign__wash {
  grid-area: 1 / 1;
  align-self: stretch;
  justify-self: stretch;
  background: radial-gradient(ellipse 60% 70% at 50% 50%, rgb(255 170 60 / 0.32), rgb(255 90 40 / 0.1) 60%, transparent 85%);
  opacity: 0;
}
.pq-qs-sign[data-kind="oooh"] .pq-qs-sign__wash {
  background: radial-gradient(ellipse 60% 70% at 50% 50%, rgb(255 80 150 / 0.3), rgb(200 30 100 / 0.1) 60%, transparent 85%);
}

.pq-qs-sign__reflex {
  grid-area: 1 / 1;
  align-self: stretch;
  justify-self: stretch;
  background:
    linear-gradient(112deg, transparent 0 14%, rgb(255 255 255 / 0.16) 18%, rgb(255 255 255 / 0.05) 27%, transparent 31% 62%, rgb(255 255 255 / 0.08) 66%, transparent 71%),
    linear-gradient(180deg, rgb(255 255 255 / 0.1), transparent 40%);
}

.pq-qs-sign__screw {
  position: absolute;
  width: 1.1cqh;
  height: 1.1cqh;
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 44%, #5a3a0c 44% 56%, transparent 56%),
    radial-gradient(circle at 35% 30%, #fff6cc, #c9952e 70%);
  box-shadow: 0 0 0 0.1cqh #4a2e08;
}
.pq-qs-sign__screw--tl { left: 0.2cqh; top: 0.2cqh; }
.pq-qs-sign__screw--tr { right: 0.2cqh; top: 0.2cqh; }
.pq-qs-sign__screw--bl { left: 0.2cqh; bottom: 0.2cqh; }
.pq-qs-sign__screw--br { right: 0.2cqh; bottom: 0.2cqh; }

/* an: dreimal blinken (Abstand 420 ms), dann glühen; Birnen laufen im Wechsel (1 Wechsel/s) */
.pq-qs-sign.is-on .pq-qs-sign__lit,
.pq-qs-sign.is-on .pq-qs-sign__wash { opacity: 1; animation: pq-qs-blink3 1000ms linear both; }
.pq-qs-sign.is-on .pq-qs-sign__glow {
  opacity: 1;
  animation: pq-qs-blink3 1000ms linear both, pq-qs-breathe 1800ms ease-in-out 1000ms infinite alternate;
}
.pq-qs-sign.is-on .pq-qs-sign__bulb::after {
  opacity: 1;
  animation: pq-qs-blink3 1000ms linear both, pq-qs-chase 1000ms linear 1000ms infinite;
}
.pq-qs-sign.is-on .pq-qs-sign__bulb.is-odd::after {
  animation: pq-qs-blink3 1000ms linear both, pq-qs-chase 1000ms linear 1500ms infinite;
}
.pq-qs-sign.is-on { animation: pq-qs-sign-pop 760ms cubic-bezier(0.3, 0.7, 0.4, 1) both; }
.pq-qs-sign.is-on[data-kind="oooh"] { animation: pq-qs-sign-sag 1100ms cubic-bezier(0.3, 0.7, 0.4, 1) both; }

.pq-qs-sign.is-out .pq-qs-sign__lit,
.pq-qs-sign.is-out .pq-qs-sign__wash,
.pq-qs-sign.is-out .pq-qs-sign__glow,
.pq-qs-sign.is-out .pq-qs-sign__bulb::after,
.pq-qs-sign.is-out .pq-qs-sign__bulb.is-odd::after {
  animation: pq-qs-out 450ms ease-in both;
}

@keyframes pq-qs-blink3 {
  0% { opacity: 0; }
  4% { opacity: 1; }
  24% { opacity: 1; }
  30% { opacity: 0.06; }
  42% { opacity: 0.06; }
  46% { opacity: 1; }
  66% { opacity: 1; }
  72% { opacity: 0.06; }
  84% { opacity: 0.06; }
  88% { opacity: 1; }
  100% { opacity: 1; }
}
@keyframes pq-qs-breathe {
  0% { opacity: 1; }
  100% { opacity: 0.74; }
}
@keyframes pq-qs-chase {
  0% { opacity: 1; }
  40% { opacity: 1; }
  50% { opacity: 0.14; }
  90% { opacity: 0.14; }
  100% { opacity: 1; }
}
@keyframes pq-qs-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes pq-qs-sign-pop {
  0% { transform: translateX(-50%) scale(1) rotate(0deg); }
  16% { transform: translateX(-50%) scale(1.07) rotate(-1.4deg); }
  38% { transform: translateX(-50%) scale(0.985) rotate(1deg); }
  62% { transform: translateX(-50%) scale(1.015) rotate(-0.45deg); }
  100% { transform: translateX(-50%) scale(1) rotate(0deg); }
}
@keyframes pq-qs-sign-sag {
  0% { transform: translateX(-50%) translateY(0) rotate(0deg); }
  22% { transform: translateX(-50%) translateY(1.2cqh) rotate(3.2deg); }
  48% { transform: translateX(-50%) translateY(0.4cqh) rotate(-1.6deg); }
  74% { transform: translateX(-50%) translateY(0.2cqh) rotate(0.7deg); }
  100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
}

/* ---------------------------------------------------------------- Tusch-Lichtlauf */

.pq-qs-tusch__rail {
  position: absolute;
  inset: 2.3cqh;
}
.pq-qs-tusch__rail::before {
  content: "";
  position: absolute;
  inset: -1.35cqh;
  border-radius: 2cqh;
  border: 2.7cqh solid #241509;
  box-shadow:
    0 0 0 0.22cqh #e6b244,
    inset 0 0 0 0.22cqh #e6b244,
    0 0 2cqh rgb(0 0 0 / 0.55);
}

.pq-qs-tusch__glow {
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 5cqh 1.6cqh rgb(255 205 80 / 0.55),
    inset 0 0 16cqh 2cqh rgb(255 120 40 / 0.22);
  opacity: 0;
}

.pq-qs-tusch__bulb {
  --pq-qs-lit: radial-gradient(circle at 40% 34%, #ffffff 0 16%, #fff3c0 32%, #ffcf45 60%, #ff9418 100%);
  --pq-qs-halo: 0 0 1cqh 0.35cqh rgb(255 210 80 / 0.9), 0 0 2.6cqh 0.6cqh rgb(255 140 40 / 0.45);
  position: absolute;
  width: 2.1cqh;
  height: 2.1cqh;
  margin: -1.05cqh 0 0 -1.05cqh;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, rgb(255 238 200 / 0.55) 0 13%, #8a5a1c 34%, #3d2408 76%);
  box-shadow: 0 0 0 0.2cqh #120a03, 0 0 0 0.42cqh #b8862b, 0 0 0 0.56cqh #1a0f04;
}
.pq-qs-tusch__bulb.is-red {
  --pq-qs-lit: radial-gradient(circle at 40% 34%, #ffffff 0 14%, #ffd0c8 30%, #ff5a4a 60%, #d4142c 100%);
  --pq-qs-halo: 0 0 1cqh 0.35cqh rgb(255 90 70 / 0.9), 0 0 2.6cqh 0.6cqh rgb(230 30 50 / 0.45);
  background: radial-gradient(circle at 36% 30%, rgb(255 220 220 / 0.5) 0 13%, #7c1a22 34%, #36070c 76%);
}
.pq-qs-tusch__bulb::before,
.pq-qs-tusch__bulb::after {
  content: "";
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  background: var(--pq-qs-lit);
  box-shadow: var(--pq-qs-halo);
  opacity: 0;
}

.pq-qs-tusch.is-run .pq-qs-tusch__bulb::before {
  animation: pq-qs-blip 460ms linear calc(var(--i) * var(--pq-qs-step)) both;
}
.pq-qs-tusch.is-run .pq-qs-tusch__bulb::after {
  animation: pq-qs-allflash var(--pq-qs-flash-ms) ease-out var(--pq-qs-flash-at) both;
}
.pq-qs-tusch.is-run .pq-qs-tusch__glow {
  animation: pq-qs-glowflash var(--pq-qs-flash-ms) ease-out var(--pq-qs-flash-at) both;
}

@keyframes pq-qs-blip {
  0% { opacity: 0; transform: scale(0.7); }
  7% { opacity: 1; transform: scale(1.3); }
  26% { opacity: 0.55; transform: scale(1.08); }
  45% { opacity: 0.22; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes pq-qs-allflash {
  0% { opacity: 0; transform: scale(0.8); }
  12% { opacity: 1; transform: scale(1.4); }
  50% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes pq-qs-glowflash {
  0% { opacity: 0; }
  14% { opacity: 1; }
  50% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* ---------------------------------------------------------------- Konfettikanonen */

.pq-qs-cannon {
  position: absolute;
  bottom: 1.2cqh;
  width: 30cqh;
  height: 25cqh;
}
.pq-qs-cannon--left { left: 2.4cqh; }
.pq-qs-cannon--right { right: 2.4cqh; transform: scaleX(-1); }

.pq-qs-cannon svg { display: block; width: 100%; height: 100%; overflow: visible; }

.pq-qs-cannon__base {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 60%;
  transform-origin: 30% 100%;
}

.pq-qs-cannon__aim {
  position: absolute;
  left: 47%;
  top: 55%;
  width: 0;
  height: 0;
  transform: rotate(-52deg);
}

.pq-qs-cannon__barrel {
  position: absolute;
  left: -8.1cqh;
  top: -4.9cqh;
  width: 24cqh;
  height: 9.8cqh;
}

.pq-qs-cannon__muzzle {
  position: absolute;
  left: 96%;
  top: 50%;
  width: 0;
  height: 0;
}

.pq-qs-cannon__flash {
  position: absolute;
  left: 97%;
  top: 50%;
  width: 13cqh;
  height: 13cqh;
  margin: -6.5cqh 0 0 -3.8cqh;
  opacity: 0;
}

.pq-qs-cannon__puff {
  position: absolute;
  left: 98%;
  top: 50%;
  width: 5.8cqh;
  height: 5.8cqh;
  margin: -2.9cqh 0 0 -2cqh;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, rgb(255 255 255 / 0.95), rgb(236 230 255 / 0.7) 45%, rgb(200 190 230 / 0) 70%);
  opacity: 0;
}
.pq-qs-cannon__puff--a { --px: 3.4cqh; --py: -1.4cqh; --ps: 1.9; }
.pq-qs-cannon__puff--b { --px: 5.6cqh; --py: 1cqh; --ps: 1.5; }
.pq-qs-cannon__puff--c { --px: 1.6cqh; --py: 2.2cqh; --ps: 1.7; }

.pq-qs-cannon.is-firing .pq-qs-cannon__barrel { animation: pq-qs-recoil 720ms both; }
.pq-qs-cannon.is-firing .pq-qs-cannon__base { animation: pq-qs-rock 620ms ease-out both; }
.pq-qs-cannon.is-firing .pq-qs-cannon__flash { animation: pq-qs-muzzle 300ms ease-out both; }
.pq-qs-cannon.is-firing .pq-qs-cannon__puff { animation: pq-qs-puff 880ms ease-out 40ms both; }
.pq-qs-cannon.is-firing .pq-qs-cannon__puff--b { animation-delay: 90ms; }
.pq-qs-cannon.is-firing .pq-qs-cannon__puff--c { animation-delay: 140ms; }

@keyframes pq-qs-recoil {
  0% { transform: translateX(0); animation-timing-function: cubic-bezier(0.1, 0.9, 0.3, 1); }
  9% { transform: translateX(-20%) scaleY(1.06); animation-timing-function: ease-in-out; }
  32% { transform: translateX(-17%) scaleY(1); animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1.4); }
  100% { transform: translateX(0); }
}
@keyframes pq-qs-rock {
  0% { transform: translateX(0) rotate(0deg); }
  12% { transform: translateX(-4%) rotate(-3.5deg); }
  40% { transform: translateX(-2%) rotate(1.2deg); }
  70% { transform: translateX(-0.5%) rotate(-0.4deg); }
  100% { transform: translateX(0) rotate(0deg); }
}
@keyframes pq-qs-muzzle {
  0% { opacity: 0; transform: scale(0.3) rotate(0deg); }
  18% { opacity: 1; transform: scale(1.15) rotate(12deg); }
  100% { opacity: 0; transform: scale(1.5) rotate(20deg); }
}
@keyframes pq-qs-puff {
  0% { opacity: 0; transform: translate(0, 0) scale(0.3); }
  22% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(var(--ps)); }
}

.pq-qs-cannon__bit {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  animation: pq-qs-bit var(--dur, 2000ms) var(--d, 0ms) both;
}
.pq-qs-cannon__bit > i {
  position: absolute;
  width: 2cqh;
  height: 1.1cqh;
  margin: -0.55cqh 0 0 -1cqh;
  border-radius: 0.12cqh;
  box-shadow: inset 0 -0.15cqh 0 rgb(0 0 0 / 0.18);
  animation: pq-qs-flip var(--flip, 400ms) linear infinite;
}
.pq-qs-cannon__bit.is-dot > i { width: 1.3cqh; height: 1.3cqh; margin: -0.65cqh 0 0 -0.65cqh; border-radius: 50%; }
.pq-qs-cannon__bit.is-curl > i { width: 0.75cqh; height: 3.4cqh; margin: -1.7cqh 0 0 -0.37cqh; border-radius: 0.3cqh; }

@keyframes pq-qs-bit {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(0.6); animation-timing-function: cubic-bezier(0.12, 0.75, 0.35, 1); }
  40% { opacity: 1; transform: translate(var(--x1), var(--y1)) rotate(var(--r1)) scale(1); animation-timing-function: cubic-bezier(0.45, 0, 0.75, 0.7); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x2), var(--y2)) rotate(var(--r2)) scale(1); }
}
@keyframes pq-qs-flip {
  0% { transform: rotate3d(1, 0.4, 0.2, 0deg); }
  100% { transform: rotate3d(1, 0.4, 0.2, 360deg); }
}

/* ---------------------------------------------------------------- reduziert */

.pq-qs-fx.is-reduced,
.pq-qs-fx.is-reduced *,
.pq-qs-fx.is-reduced *::before,
.pq-qs-fx.is-reduced *::after {
  animation: none !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .pq-qs-fx,
  .pq-qs-fx *,
  .pq-qs-fx *::before,
  .pq-qs-fx *::after {
    animation: none !important;
    transition: none !important;
  }
}
