/* Surprise overlay. Deliberately separate from the normal PolderHub UI. */
.polder-jumpscare {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.polder-jumpscare.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.polder-jumpscare::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #250000;
  opacity: 0;
}
.polder-jumpscare.is-active::before {
  animation: polderFlash 110ms steps(2, end) 5;
}
.polder-jumpscare img {
  position: relative;
  z-index: 1;
  display: block;
  width: min(98vw, 1180px);
  height: min(97vh, 1180px);
  object-fit: contain;
  transform: scale(.3);
  opacity: 0;
  filter: drop-shadow(0 0 18px #ff2a00) drop-shadow(0 0 52px #7a0000);
  user-select: none;
  -webkit-user-drag: none;
}
.polder-jumpscare.is-active img {
  animation: polderDemonIn 760ms cubic-bezier(.08,.88,.16,1) forwards,
             polderDemonShake 95ms steps(2, end) 7 110ms;
}
body.polder-jumpscare-lock {
  overflow: hidden;
}
@keyframes polderDemonIn {
  0%   { transform: scale(.20); opacity: 0; }
  10%  { transform: scale(.88); opacity: 1; }
  25%  { transform: scale(1.09); opacity: 1; }
  47%  { transform: scale(.97); opacity: 1; }
  100% { transform: scale(1.02); opacity: 1; }
}
@keyframes polderDemonShake {
  0%   { margin-left: -20px; margin-top: 8px; }
  25%  { margin-left: 22px; margin-top: -10px; }
  50%  { margin-left: -16px; margin-top: 11px; }
  75%  { margin-left: 18px; margin-top: -6px; }
  100% { margin-left: 0; margin-top: 0; }
}
@keyframes polderFlash {
  0%, 100% { opacity: 0; }
  50% { opacity: .52; }
}
@media (prefers-reduced-motion: reduce) {
  .polder-jumpscare.is-active img {
    animation: none;
    transform: scale(1);
    opacity: 1;
  }
  .polder-jumpscare.is-active::before { animation: none; opacity: .18; }
}
