/* mascot.css — the full-screen Addy moment (assets/js/mascot.js).
   Covers the whole viewport so a celebration is the only thing on screen,
   the way Duolingo does it. Colour comes from the app's accent theme, and
   the tone attribute tints the backdrop: a party is warm, a setback is calm. */

.mascot-stage {
  position: fixed;
  inset: 0;
  z-index: 11000;               /* above the rewards pop and the skip modal */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--card-bg, #fff);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.mascot-stage.is-open { display: flex; opacity: 1; }

/* A soft wash behind Addy, tinted by the tone of the moment. */
.mascot-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, var(--mascot-wash, rgba(124, 92, 191, 0.16)) 0%, transparent 62%);
  pointer-events: none;
}

.mascot-stage[data-tone="party"]  { --mascot-wash: rgba(255, 196, 61, 0.28); }
.mascot-stage[data-tone="win"]    { --mascot-wash: rgba(26, 158, 92, 0.18); }
.mascot-stage[data-tone="gentle"] { --mascot-wash: rgba(124, 92, 191, 0.14); }

.mascot-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  text-align: center;
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  transition: transform 0.34s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.24s ease;
}

.mascot-stage.is-open .mascot-card { transform: none; opacity: 1; }

/* ── Addy ── */
.mascot-art {
  width: min(58vw, 260px);
  height: auto;
  display: block;
  margin: 0 auto 0.6rem;
  filter: drop-shadow(0 14px 26px rgba(30, 16, 46, 0.18));
}

.mascot-stage.is-open .mascot-art { animation: mascotHop 0.62s cubic-bezier(0.2, 0.8, 0.3, 1); }
.mascot-stage.is-open[data-tone="party"] .mascot-art { animation: mascotPop 0.72s cubic-bezier(0.2, 0.9, 0.3, 1); }
.mascot-stage.is-open[data-tone="gentle"] .mascot-art { animation: mascotFadeUp 0.5s ease; }

@keyframes mascotHop {
  0%   { transform: translateY(26px) scale(0.9); opacity: 0; }
  55%  { transform: translateY(-8px) scale(1.03); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

@keyframes mascotPop {
  0%   { transform: scale(0.6) rotate(-6deg); opacity: 0; }
  45%  { transform: scale(1.08) rotate(3deg); opacity: 1; }
  70%  { transform: scale(0.97) rotate(-1deg); }
  100% { transform: none; }
}

@keyframes mascotFadeUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Copy ── */
/* `display` here would otherwise beat the browser's [hidden] rule, leaving an
   empty pill on moments that carry no points. */
.mascot-points[hidden] { display: none; }

.mascot-points {
  display: inline-block;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  background: var(--brand-grad);
  border-radius: 999px;
  padding: 0.22rem 0.85rem;
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.mascot-title {
  font-size: clamp(1.4rem, 6vw, 1.9rem);
  font-weight: 800;
  color: var(--plum);
  margin: 0 0 0.45rem;
  line-height: 1.15;
}

.mascot-body {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 auto 1.6rem;
  max-width: 22rem;
}

.mascot-cta {
  min-width: 190px;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  font-weight: 700;
}

/* ── Confetti (party tone only; JS skips it under reduced motion) ── */
.mascot-burst {
  position: absolute;
  inset: -10% 0 auto;
  height: 60%;
  overflow: hidden;
  pointer-events: none;
}

.mascot-burst i {
  position: absolute;
  top: -8%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: mascotConfetti 1.5s ease-in forwards;
}

@keyframes mascotConfetti {
  0%   { opacity: 0; transform: translateY(-10px) rotate(0deg); }
  12%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(320px) rotate(420deg); }
}

/* ── Motion-sensitive users get the moment without the movement ── */
@media (prefers-reduced-motion: reduce) {
  .mascot-stage,
  .mascot-card { transition: none; }
  .mascot-stage.is-open .mascot-art,
  .mascot-stage.is-open[data-tone="party"] .mascot-art,
  .mascot-stage.is-open[data-tone="gentle"] .mascot-art { animation: none; }
  .mascot-card { transform: none; }
}

/* Small screens: Addy gets more room, the button reaches the thumb. */
@media (max-width: 480px) {
  .mascot-art { width: min(70vw, 240px); }
  .mascot-cta { width: 100%; }
  .mascot-card { padding-bottom: env(safe-area-inset-bottom); }
}
