/**
 * Celebration Animation Styles
 * Confetti burst + overlay message when a module is mastered.
 */

/* ── Overlay ─────────────────────────────────────────────────────────────── */

.cel-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  animation: cel-fade-in 0.3s ease forwards;
  pointer-events: auto;
}

.cel-overlay.cel-dismiss {
  animation: cel-fade-out 0.4s ease forwards;
  pointer-events: none;
}

@keyframes cel-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cel-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── Message card ────────────────────────────────────────────────────────── */

.cel-card {
  position: relative;
  z-index: 2;
  background: var(--panel, #121a24);
  border-radius: var(--radius-lg, 1rem);
  box-shadow: var(--shadow, 0 28px 60px rgba(6, 12, 20, 0.45));
  padding: 2.5rem 2rem 2rem;
  max-width: 380px;
  width: 90vw;
  text-align: center;
  transform: scale(0.85) translateY(20px);
  animation: cel-card-in 0.4s 0.1s ease forwards;
}

@keyframes cel-card-in {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.cel-card .cel-emoji {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.cel-card .cel-heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--heading, inherit);
}

.cel-card .cel-subtitle {
  font-size: 1rem;
  margin: 0 0 0.25rem;
  color: var(--muted, #94a3b8);
}

.cel-card .cel-encourage {
  font-size: 0.9rem;
  margin: 0.5rem 0 1.25rem;
  color: var(--muted, #94a3b8);
  font-style: italic;
}

.cel-card .cel-btn {
  display: inline-block;
  padding: 0.6rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius, 0.5rem);
  background: var(--primary, #ff8a5b);
  color: var(--primary-on, #0f172a);
  cursor: pointer;
  transition: background 0.15s ease;
}

.cel-card .cel-btn:hover {
  background: var(--primary-hover, #ff9e78);
}

.cel-card .cel-btn:active {
  background: var(--primary-active, #e8764d);
}

/* ── Confetti particles ──────────────────────────────────────────────────── */

.cel-confetti-container {
  position: fixed;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
  overflow: hidden;
}

.cel-confetti {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 10px;
  opacity: 0;
  animation: cel-fall 3s ease-in forwards;
}

.cel-confetti.cel-circle {
  border-radius: 50%;
}

@keyframes cel-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(110vh) rotate(720deg);
  }
}

/* Stagger delays and horizontal positions are set inline via JS.
   We define a few size variants in CSS: */

.cel-confetti.cel-sm  { width: 6px;  height: 6px; }
.cel-confetti.cel-md  { width: 10px; height: 10px; }
.cel-confetti.cel-lg  { width: 14px; height: 14px; }

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .cel-confetti-container {
    display: none !important;
  }

  .cel-overlay {
    animation: none;
    opacity: 1;
  }

  .cel-overlay.cel-dismiss {
    animation: none;
    opacity: 0;
  }

  .cel-card {
    animation: none;
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
