/* ============================================
   天天三国 - 动画系统
   Keyframes · 工具类 · 过渡效果
   ============================================ */

/* ============================================
   关键帧定义
   ============================================ */

/* 淡入 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 淡出 */
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* 从底部滑入 */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 向下滑出 */
@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(30px);
  }
}

/* 从右侧滑入 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 从左侧滑入 */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 脉冲发光 (SSR卡牌) */
@keyframes glow {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(255, 152, 0, 0.4),
      0 0 20px rgba(156, 39, 176, 0.3),
      inset 0 0 8px rgba(255, 152, 0, 0.1);
  }
  50% {
    box-shadow:
      0 0 16px rgba(255, 152, 0, 0.7),
      0 0 40px rgba(156, 39, 176, 0.5),
      inset 0 0 16px rgba(255, 152, 0, 0.2);
  }
}

/* 流光扫过 */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* 震动 (受击) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-6px) rotate(-1deg); }
  20% { transform: translateX(5px) rotate(1deg); }
  30% { transform: translateX(-4px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(1px); }
}

/* 飘浮上升 (伤害数字) */
@keyframes float {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  20% {
    transform: translateY(-20px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(0.8);
  }
}

/* 旋转 (加载) */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 缩放脉冲 */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* 弹入 */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 从顶部滑入 (Toast) */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 向顶部滑出 (Toast) */
@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-100%) scale(0.95);
  }
}

/* 呼吸灯 */
@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 金光闪烁 */
@keyframes goldFlicker {
  0%, 100% {
    text-shadow: 0 0 4px rgba(218, 165, 32, 0.5);
  }
  50% {
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 0 0 20px rgba(218, 165, 32, 0.4);
  }
}

/* 边框流光 */
@keyframes borderGlow {
  0% {
    border-color: var(--color-gold-dark);
    box-shadow: 0 0 5px rgba(218, 165, 32, 0.2);
  }
  50% {
    border-color: var(--color-gold-light);
    box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  }
  100% {
    border-color: var(--color-gold-dark);
    box-shadow: 0 0 5px rgba(218, 165, 32, 0.2);
  }
}

/* 缩放弹跳 */
@keyframes scaleBounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.1); }
  80% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ============================================
   动画工具类
   ============================================ */
.animate-fadeIn {
  animation: fadeIn 0.3s ease-out both;
}

.animate-fadeOut {
  animation: fadeOut 0.3s ease-out both;
}

.animate-slideUp {
  animation: slideUp 0.4s ease-out both;
}

.animate-slideIn {
  animation: slideIn 0.4s ease-out both;
}

.animate-slideInLeft {
  animation: slideInLeft 0.4s ease-out both;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

.animate-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 215, 0, 0.15) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2.5s ease-in-out infinite;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

.animate-float {
  animation: float 1.2s ease-out both;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

.animate-bounceIn {
  animation: bounceIn 0.5s ease-out both;
}

.animate-breathe {
  animation: breathe 2s ease-in-out infinite;
}

.animate-goldFlicker {
  animation: goldFlicker 2s ease-in-out infinite;
}

.animate-borderGlow {
  animation: borderGlow 2s ease-in-out infinite;
}

/* ============================================
   延迟工具类 (交错动画)
   ============================================ */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.3s; }
.delay-7 { animation-delay: 0.35s; }
.delay-8 { animation-delay: 0.4s; }

/* ============================================
   减少动画 (无障碍)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
