/* Overlay+ celebration effects - the look and motion of every particle
   countdown-effects.js spawns. Its own file so the control panel can load it
   too and preview a celebration exactly as the overlay will draw it. */

.op-fx-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.op-fx-p {
  position: absolute;
  left: var(--x, 0);
  top: var(--y, 0);
  width: var(--size, 10px);
  height: var(--size, 10px);
  margin: calc(var(--size, 10px) / -2) 0 0 calc(var(--size, 10px) / -2);
  background: var(--color, #fff);
  opacity: 0;
  animation-name: op-fx-fall;
  animation-duration: var(--dur, 2000ms);
  animation-delay: var(--delay, 0ms);
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}
.op-fx-p.op-fx-glow { box-shadow: 0 0 calc(var(--size, 10px) * 0.8) var(--color, #fff); }

@keyframes op-fx-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(0.4); }
  8% { opacity: 1; }
  80% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, 120px)) rotate(var(--rot, 180deg)) scale(1);
  }
}

/* --------------------------------- pictures -------------------------------- */
/* Your own picture or emote. It pops in from small to its full size, then
   falls rocking gently - upright enough to recognise all the way down. */
.op-fx-pic {
  background: none;
  animation-name: op-fx-pic;
}
.op-fx-pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
@keyframes op-fx-pic {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(0.15); }
  9% {
    opacity: 1;
    transform: translate(calc(var(--dx, 0px) * 0.05), calc(var(--dy, 120px) * 0.03))
      rotate(calc(var(--rot, 20deg) * 0.1)) scale(1.12);
  }
  15% {
    transform: translate(calc(var(--dx, 0px) * 0.09), calc(var(--dy, 120px) * 0.07))
      rotate(calc(var(--rot, 20deg) * 0.15)) scale(1);
  }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 120px)) rotate(var(--rot, 20deg)) scale(1); }
}

.op-fx-rect { border-radius: 2px; }
.op-fx-dot { border-radius: 50%; }
.op-fx-star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%,
    21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.op-fx-flower {
  border-radius: 50%;
  box-shadow:
    calc(var(--size, 10px) * 0.55) 0 0 0 var(--color, #fff),
    calc(var(--size, 10px) * -0.55) 0 0 0 var(--color, #fff),
    0 calc(var(--size, 10px) * 0.55) 0 0 var(--color, #fff),
    0 calc(var(--size, 10px) * -0.55) 0 0 var(--color, #fff);
}

/* --------------------------------- balloons -------------------------------- */
/* A balloon, not a blob: taller than wide, a shine, a knot and a string, and
   it sways as it rises rather than tumbling. */
.op-fx-balloon {
  height: calc(var(--size, 20px) * 1.22);
  margin-top: calc(var(--size, 20px) * -0.61);
  border-radius: 50% 50% 48% 48% / 56% 56% 44% 44%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.9) 0 7%, rgba(255, 255, 255, 0) 22%),
    radial-gradient(circle at 60% 70%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.25) 100%),
    var(--color, #ff5a5f);
  animation-name: op-fx-balloon;
  animation-timing-function: linear;
}
.op-fx-balloon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 0;
  height: 0;
  transform: translate(-50%, -1px);
  border-left: calc(var(--size, 20px) * 0.1) solid transparent;
  border-right: calc(var(--size, 20px) * 0.1) solid transparent;
  border-bottom: calc(var(--size, 20px) * 0.14) solid var(--color, #ff5a5f);
}
.op-fx-balloon::after {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + var(--size, 20px) * 0.12);
  width: max(1px, calc(var(--size, 20px) * 0.05));
  height: calc(var(--size, 20px) * 1.5);
  background: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.15));
  transform-origin: top center;
  animation: op-fx-string 1.4s ease-in-out infinite alternate;
}
@keyframes op-fx-string {
  from { transform: translateX(-50%) rotate(-9deg); }
  to { transform: translateX(-50%) rotate(9deg); }
}
@keyframes op-fx-balloon {
  0% { opacity: 0; transform: translate(0, 0) rotate(-5deg); }
  8% { opacity: 1; }
  33% { transform: translate(calc(var(--dx, 0px) * 0.33 + var(--sway, 14px)), calc(var(--dy, -200px) * 0.33)) rotate(6deg); }
  66% { transform: translate(calc(var(--dx, 0px) * 0.66 - var(--sway, 14px)), calc(var(--dy, -200px) * 0.66)) rotate(-5deg); }
  88% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -200px)) rotate(3deg); }
}

/* ---------------------------------- bubbles -------------------------------- */
/* Clear, with a bright window reflection, a smaller one opposite, a lit rim
   and a faint tint - which is what makes a circle read as a bubble. */
.op-fx-bubble {
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 27%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0.45) 10%, rgba(255, 255, 255, 0) 20%),
    radial-gradient(circle at 70% 76%, rgba(255, 255, 255, 0.5) 0 4%, rgba(255, 255, 255, 0) 11%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0 58%, rgba(255, 255, 255, 0.16) 74%,
      rgba(255, 255, 255, 0.5) 92%, rgba(255, 255, 255, 0.7) 100%);
  box-shadow:
    inset calc(var(--size, 14px) * -0.12) calc(var(--size, 14px) * -0.16) calc(var(--size, 14px) * 0.3) var(--color, #9fdcff),
    inset calc(var(--size, 14px) * 0.1) calc(var(--size, 14px) * 0.08) calc(var(--size, 14px) * 0.25) rgba(255, 170, 230, 0.35);
  animation-name: op-fx-bubble;
  animation-timing-function: linear;
}
@keyframes op-fx-bubble {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  10% { opacity: 0.95; }
  30% { transform: translate(calc(var(--dx, 0px) * 0.3 + var(--sway, 14px)), calc(var(--dy, -200px) * 0.3)) scale(0.9); }
  60% { transform: translate(calc(var(--dx, 0px) * 0.6 - var(--sway, 14px)), calc(var(--dy, -200px) * 0.6)) scale(1); }
  92% { opacity: 0.95; transform: translate(var(--dx, 0px), var(--dy, -200px)) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -200px)) scale(1.4); }
}

/* -------------------------------- jellyfish -------------------------------- */
/* A bell and its tentacles, drifting up. Three animations, one per concern:
   the particle carries the drift, the bell pulses on its own timing, and the
   tentacles waver on theirs - which is what stops all of them moving as one
   stiff shape. The element is far taller than the bell so the tentacles have
   somewhere to hang. */
.op-fx-jelly {
  background: none;
  height: calc(var(--size, 30px) * 1.75);
  margin-top: calc(var(--size, 30px) * -0.5);
  animation-name: op-fx-jelly-drift;
  animation-timing-function: linear;
}

/* The bell: wider than it is tall, with a lit dome and a bright rim. */
.op-fx-jelly::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 33%;
  border-radius: 50% 50% 40% 40% / 80% 80% 20% 20%;
  background:
    radial-gradient(ellipse 60% 70% at 33% 24%, rgba(255, 255, 255, 0.9) 0 8%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(ellipse 120% 60% at 50% 96%, rgba(255, 255, 255, 0.55) 0 12%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 90% 100% at 50% 38%,
      color-mix(in srgb, var(--color, #9fdcff) 55%, transparent) 0 52%,
      color-mix(in srgb, var(--color, #9fdcff) 22%, transparent) 76%,
      color-mix(in srgb, var(--color, #9fdcff) 80%, transparent) 100%);
  box-shadow: 0 0 calc(var(--size, 30px) * 0.26) color-mix(in srgb, var(--color, #9fdcff) 42%, transparent);
  transform-origin: 50% 12%;
  animation: op-fx-jelly-pulse 1.9s ease-in-out infinite;
}

/* The tentacles: fine strands from under the bell, tapering away to nothing.
   Repeating stripes make one element read as a dozen of them; the mask is
   what stops them ending in a hard line. */
.op-fx-jelly::after {
  content: '';
  position: absolute;
  left: 12%;
  top: 28%;
  width: 78%;
  height: 72%;
  background:
    repeating-linear-gradient(to right,
      color-mix(in srgb, var(--color, #9fdcff) 85%, transparent) 0 3.5%,
      rgba(255, 255, 255, 0) 3.5% 11%),
    radial-gradient(ellipse 22% 100% at 50% 0,
      color-mix(in srgb, var(--color, #9fdcff) 65%, transparent) 0 40%,
      rgba(255, 255, 255, 0) 72%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0 18%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(to bottom, #000 0 18%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0) 100%);
  transform-origin: 50% 0;
  animation: op-fx-jelly-tentacle 2.3s ease-in-out infinite alternate;
}

@keyframes op-fx-jelly-pulse {
  0%, 100% { transform: scale(1, 1); }
  35% { transform: scale(0.84, 1.18); }
  60% { transform: scale(1.09, 0.88); }
}
@keyframes op-fx-jelly-tentacle {
  from { transform: skewX(-13deg) scale(0.94, 0.9); }
  to { transform: skewX(13deg) scale(1.06, 1.1); }
}
@keyframes op-fx-jelly-drift {
  0% { opacity: 0; transform: translate(0, 0) rotate(-4deg) scale(0.7); }
  10% { opacity: 0.95; }
  33% {
    transform: translate(calc(var(--dx, 0px) * 0.33 + var(--sway, 14px)), calc(var(--dy, -200px) * 0.33))
      rotate(5deg) scale(1);
  }
  66% {
    transform: translate(calc(var(--dx, 0px) * 0.66 - var(--sway, 14px)), calc(var(--dy, -200px) * 0.66))
      rotate(-5deg) scale(1);
  }
  90% { opacity: 0.95; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -200px)) rotate(3deg) scale(1.05); }
}

/* ---------------------------------- rockets -------------------------------- */
/* Positioned and turned by the Web Animations path in countdown-effects.js;
   the flame and trail sit behind the nozzle and turn with it. */
.op-fx-rocket {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--len, 60px);
  height: calc(var(--len, 60px) * 0.44);
  margin: calc(var(--len, 60px) * -0.22) 0 0 calc(var(--len, 60px) * -0.5);
  opacity: 0;
  will-change: transform, opacity;
}
.op-fx-rocket-art { position: absolute; inset: 0; }
.op-fx-rocket-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.op-fx-rocket-flame {
  position: absolute;
  right: 84%;
  top: 25%;
  width: 60%;
  height: 50%;
  transform-origin: 100% 50%;
  background: linear-gradient(to left, #fff7cf 0%, #ffd23f 22%, #ff8a2b 52%,
    rgba(255, 70, 30, 0.6) 78%, rgba(255, 70, 30, 0) 100%);
  clip-path: polygon(100% 18%, 100% 82%, 0% 50%);
  filter: drop-shadow(0 0 6px rgba(255, 150, 60, 0.9));
  animation: op-fx-flame 110ms ease-in-out infinite alternate;
}
.op-fx-rocket-trail {
  position: absolute;
  right: 118%;
  top: 38%;
  width: 190%;
  height: 24%;
  border-radius: 999px;
  background: linear-gradient(to left, rgba(255, 190, 90, 0.6), rgba(255, 110, 50, 0.25) 45%, rgba(255, 90, 40, 0) 100%);
  filter: blur(2px);
  transform-origin: 100% 50%;
  animation: op-fx-trail 160ms ease-in-out infinite alternate;
}
@keyframes op-fx-flame {
  from { transform: scaleX(0.72) scaleY(0.9); opacity: 0.85; }
  to { transform: scaleX(1.12) scaleY(1.05); opacity: 1; }
}
@keyframes op-fx-trail {
  from { opacity: 0.55; transform: scaleX(0.85); }
  to { opacity: 0.95; transform: scaleX(1.05); }
}

/* --------------------------------- lightning ------------------------------- */
.op-fx-lightning {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  overflow: visible;
  filter: drop-shadow(0 0 6px #cfe6ff) drop-shadow(0 0 16px #6fa8ff);
  animation: op-fx-strike 900ms ease-out both;
}
@keyframes op-fx-strike {
  0% { opacity: 0; }
  3% { opacity: 1; }
  9% { opacity: 0.15; }
  14% { opacity: 1; }
  24% { opacity: 0.85; }
  60% { opacity: 0.3; }
  100% { opacity: 0; }
}
.op-fx-lflash {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(220, 235, 255, 0.55),
    rgba(180, 210, 255, 0.18) 45%, rgba(180, 210, 255, 0) 75%);
  animation: op-fx-lflash 520ms ease-out both;
}
@keyframes op-fx-lflash {
  0% { opacity: 0; }
  5% { opacity: 1; }
  12% { opacity: 0.2; }
  18% { opacity: 0.8; }
  100% { opacity: 0; }
}
