@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in { animation: fadeIn var(--t-base) ease both; }
.animate-fade-in-up { animation: fadeInUp var(--t-base) ease both; }
.animate-fade-in-down { animation: fadeInDown var(--t-base) ease both; }
.animate-scale-in { animation: scaleIn var(--t-base) ease both; }

.transition-scroll {
  position: relative;
  overflow: visible;
  animation: scrollUnrollContent var(--t-scroll) cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes scrollUnrollContent {
  0% {
    clip-path: inset(0 50% 0 50%);
    opacity: 0.4;
  }
  20% { opacity: 1; }
  100% {
    clip-path: inset(0 -8px 0 -8px);
    opacity: 1;
  }
}

.transition-scroll::before,
.transition-scroll::after {
  content: '';
  position: absolute;
  top: -10px;
  bottom: -10px;
  width: 6px;
  background:
    radial-gradient(circle at 50% 8%, #fde68a 0%, transparent 18%),
    radial-gradient(circle at 50% 92%, #fde68a 0%, transparent 18%),
    linear-gradient(180deg, #8b6a3a 0%, #d4af37 50%, #8b6a3a 100%);
  border-radius: 3px;
  box-shadow:
    0 0 8px rgba(212, 175, 55, 0.6),
    inset 0 0 2px rgba(255, 230, 150, 0.7);
  z-index: 4;
  pointer-events: none;
}

.transition-scroll::before {
  left: 50%;
  margin-left: -3px;
  animation: scrollRodLeft var(--t-scroll) cubic-bezier(0.22, 1, 0.36, 1) both;
}

.transition-scroll::after {
  right: 50%;
  margin-right: -3px;
  animation: scrollRodRight var(--t-scroll) cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes scrollRodLeft {
  0%   { left: 50%; opacity: 0; }
  15%  { opacity: 1; }
  100% { left: 0; opacity: 1; }
}

@keyframes scrollRodRight {
  0%   { right: 50%; opacity: 0; }
  15%  { opacity: 1; }
  100% { right: 0; opacity: 1; }
}

@keyframes inkBrush {
  0% {
    clip-path: polygon(0 100%, 0 100%, 0 100%, 0 100%);
    opacity: 0;
  }
  20% { opacity: 1; }
  100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    opacity: 1;
  }
}

.transition-ink {
  animation: inkBrush var(--t-slow) ease-out both;
}

@keyframes talismanDrop {
  0% {
    transform: translateY(-200%) rotate(-15deg);
    opacity: 0;
  }
  60% {
    transform: translateY(8%) rotate(3deg);
    opacity: 1;
  }
  80% {
    transform: translateY(-2%) rotate(-1deg);
  }
  100% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
}

.animate-talisman-drop {
  animation: talismanDrop 1.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes breath {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.9; }
}

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-breath { animation: breath 2.4s ease-in-out infinite; }

@keyframes glow {
  0%, 100% { box-shadow: 0 0 16px rgba(212, 175, 55, 0.4); }
  50% { box-shadow: 0 0 32px rgba(212, 175, 55, 0.8); }
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

@keyframes progressFill {
  from { width: 0; }
}

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

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
