/* Screen wipe transition, shake, flash, confetti and toast. */

/* ---------- Wipe transition ---------- */
.wipe { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; }
.wipe.in, .wipe.out { pointer-events: all; }
.wipe .panel {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -30%;
  width: 160%;
  transform: translateX(140%) skewX(14deg);
}
.wipe .panel:nth-child(1) { background: var(--pink); }
.wipe .panel:nth-child(2) { background: var(--yellow); }
.wipe .panel:nth-child(3) {
  background:
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.08) 0 10deg, transparent 10deg 20deg),
    var(--purple);
}
.wipe.in .panel { animation: wipeIn 0.5s var(--snap) forwards; }
.wipe.in .panel:nth-child(2) { animation-delay: 0.07s; }
.wipe.in .panel:nth-child(3) { animation-delay: 0.14s; }
.wipe.out .panel { transform: translateX(0) skewX(14deg); animation: wipeOut 0.55s var(--snap) forwards; }
.wipe.out .panel:nth-child(1) { animation-delay: 0.14s; }
.wipe.out .panel:nth-child(2) { animation-delay: 0.07s; }
@keyframes wipeIn {
  from { transform: translateX(140%) skewX(14deg); }
  to { transform: translateX(0) skewX(14deg); }
}
@keyframes wipeOut {
  from { transform: translateX(0) skewX(14deg); }
  to { transform: translateX(-140%) skewX(14deg); }
}
.wipe-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 16px;
  text-align: center;
  font-family: var(--display);
  font-size: clamp(40px, 12vw, 96px);
  line-height: 1.05;
  color: var(--yellow);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink), 0 12px 0 var(--pink);
  opacity: 0;
}
.wipe.in .wipe-label.has { animation: labelSlam 0.6s var(--bounce) 0.4s both; }
.wipe.out .wipe-label.has { animation: labelOut 0.3s ease-in both; }
@keyframes labelSlam {
  0% { opacity: 0; transform: scale(3) rotate(-15deg); }
  60% { opacity: 1; transform: scale(0.9) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-3deg); }
}
@keyframes labelOut {
  from { opacity: 1; transform: scale(1) rotate(-3deg); }
  to { opacity: 0; transform: scale(0.3) rotate(20deg); }
}

/* ---------- Effects ---------- */
.shake { animation: shake 0.5s ease-in-out !important; }
@keyframes shake {
  0%, 100% { translate: 0 0; }
  15% { translate: -10px 0; }
  30% { translate: 9px 0; }
  45% { translate: -7px 0; }
  60% { translate: 5px 0; }
  75% { translate: -3px 0; }
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
}
body.flash::after { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 45; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100% - 32px);
  width: max-content;
  background: var(--ink);
  color: #fff;
  border: 3px solid var(--yellow);
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 16px;
  text-align: center;
  transform: translate(-50%, 150%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s var(--bounce), opacity 0.3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

