/* animations.css — task complete, XP float, level-up overlay, habit toggle pulse, streak flash, particle burst */
/* Populated in Phases 2–7 */

/* XP float */
@keyframes xp-float {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px); }
}

.xp-float {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--xp-color);
  pointer-events: none;
  animation: xp-float 0.8s ease-out forwards;
  transform: translateX(-50%);
  z-index: 3000;
}

/* Task complete — lime border flash */
@keyframes card-flash {
  0%   { border-color: var(--border-subtle); box-shadow: none; }
  40%  { border-color: var(--accent-primary); box-shadow: 0 0 20px var(--accent-glow); }
  100% { border-color: var(--accent-primary); box-shadow: 0 0 20px var(--accent-glow); }
}
.task-card--completing { animation: card-flash 200ms ease-out forwards; }

/* Strikethrough draws left-to-right on done */
.task-card--done .task-title {
  position: relative;
  display: inline;
}

/* Level-up overlay */
.levelup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 13, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.levelup-overlay--visible { opacity: 1; }

.levelup-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  width: 100%;
  max-width: 360px;
}

.levelup-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.25em;
  color: var(--accent-primary);
  text-transform: uppercase;
}

@keyframes levelup-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  80%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.levelup-number {
  font-family: 'Syne', sans-serif;
  font-size: 112px;
  font-weight: 800;
  color: var(--accent-primary);
  text-shadow: 0 0 60px var(--accent-glow), 0 0 120px rgba(163,255,18,0.2);
  line-height: 1;
  opacity: 0;
}
.levelup-number--pop {
  animation: levelup-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.levelup-bar-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.levelup-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.levelup-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-primary);
  border-radius: 3px;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.levelup-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.levelup-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: var(--text-muted);
}

.levelup-btn {
  margin-top: 12px;
  padding: 14px 40px;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-inner);
  cursor: pointer;
  border: none;
  min-height: 52px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.levelup-btn--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Timer running pulse */
@keyframes timer-pulse {
  0%, 100% { box-shadow: 0 0 16px var(--accent-glow); }
  50%       { box-shadow: 0 0 36px rgba(163,255,18,0.45); }
}

/* Timer running dot blink */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Habit card complete pulse */
@keyframes habit-pulse {
  0%   { border-color: var(--border-subtle); box-shadow: none; }
  40%  { border-color: var(--accent-primary); box-shadow: 0 0 18px var(--accent-glow); }
  100% { border-color: var(--accent-primary); box-shadow: 0 0 18px var(--accent-glow); }
}
.habit-card--pulse { animation: habit-pulse 500ms ease-out forwards; }

/* Habit streak counter bounce */
@keyframes streak-bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); color: var(--accent-primary); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.habit-streak--bounce { animation: streak-bounce 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

/* Flame icon flicker on streak milestone (7/30/100d) */
@keyframes fire-flicker {
  0%   { transform: scale(1) rotate(0deg); }
  20%  { transform: scale(1.6) rotate(-12deg); opacity: 0.8; }
  40%  { transform: scale(0.9) rotate(8deg); opacity: 1; }
  60%  { transform: scale(1.5) rotate(-8deg); opacity: 0.7; }
  80%  { transform: scale(0.95) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
.streak-flame { display: inline-block; }
.streak-flame--flicker { animation: fire-flicker 0.4s ease-in-out 3; }

/* Onboarding modal */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 13, 0.92);
  z-index: 4500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.onboarding-overlay--visible { opacity: 1; }

/* ================================================================
   BONUS DAY keyframes
   ================================================================ */

@keyframes bonusScanlines {
  0%   { background-position: 0 0; }
  100% { background-position: 0 6px; }
}

@keyframes bonusEyebrowReveal {
  0%   { max-width: 0; opacity: 1; }
  100% { max-width: 260px; opacity: 1; }
}

@keyframes bonusTypeCaret {
  0%, 100% { border-right-color: var(--accent-primary); }
  50%      { border-right-color: transparent; }
}

@keyframes bonusDrop {
  0%   { opacity: 0; transform: translateY(-22px); }
  60%  { opacity: 1; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes bonusChromaticFlash {
  0% {
    opacity: 0;
    transform: scale(0.9);
    text-shadow:
      -8px 0 0 rgba(255, 0, 64, 0.85),
       8px 0 0 rgba(0, 255, 255, 0.85),
       0 0 32px rgba(163, 255, 18, 0.0);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
    text-shadow:
      -4px 0 0 rgba(255, 0, 64, 0.55),
       4px 0 0 rgba(0, 255, 255, 0.55),
       0 0 40px rgba(163, 255, 18, 0.55);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    text-shadow:
      0 0 0 rgba(255, 0, 64, 0),
      0 0 0 rgba(0, 255, 255, 0),
      0 0 28px rgba(163, 255, 18, 0.55);
  }
}

@keyframes bonusGlowPulse {
  0%, 100% {
    text-shadow: 0 0 20px rgba(163, 255, 18, 0.4);
  }
  50% {
    text-shadow:
      0 0 40px rgba(163, 255, 18, 0.75),
      0 0 80px rgba(255, 107, 53, 0.25);
  }
}

@keyframes bonusEdgeFlash {
  0%   { box-shadow: inset 0 0 0 rgba(255, 107, 53, 0); }
  30%  { box-shadow: inset 0 0 80px rgba(255, 107, 53, 0.45); }
  100% { box-shadow: inset 0 0 0 rgba(255, 107, 53, 0); }
}

/* ---- Achievements ---- */
.ach-modal-badge--pulse {
  animation: achModalPulse 1400ms ease-out 1;
}
@keyframes achModalPulse {
  0%   { box-shadow: 0 0 0 0 var(--rarity-rare-glow); transform: scale(1); }
  50%  { box-shadow: 0 0 0 18px rgba(255, 107, 53, 0); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); transform: scale(1); }
}

.ach-legendary-badge--pulse {
  animation: achLegendaryPulse 2400ms ease-in-out infinite;
}
@keyframes achLegendaryPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 var(--rarity-legendary-glow), 0 0 32px 4px var(--rarity-legendary-glow);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(181, 123, 255, 0), 0 0 56px 10px var(--rarity-legendary-glow);
    transform: scale(1.04);
  }
}

@keyframes achLegendaryBg {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ach-modal-badge--pulse,
  .ach-legendary-badge--pulse,
  .ach-legendary-overlay::before { animation: none; }
}

/* Level-up rewards panel */
.levelup-rewards {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.levelup-reward-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}
.levelup-reward-label {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* Welcome Back overlay */
.welcome-back-card {
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.welcome-back-bonus {
  font-size: 11px;
  color: #F59E0B;
  letter-spacing: 0.06em;
  margin: 8px 0 4px;
  text-align: center;
}
