/* ===== 页面切换动画 ===== */
.page-enter {
  animation: slideIn 0.3s ease-out;
}

.page-exit {
  animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-30px);
  }
}

/* ===== 淡入淡出 ===== */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.fade-out {
  animation: fadeOut 0.3s ease-in forwards;
}

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

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

/* ===== 气泡浮动动画 ===== */
.bubble-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(233, 69, 96, 0.3), transparent 70%);
  animation: bubbleFloat 4s ease-in infinite;
  opacity: 0;
}

.bubble:nth-child(1) { width: 20px; height: 20px; left: 10%; animation-delay: 0s; animation-duration: 5s; }
.bubble:nth-child(2) { width: 30px; height: 30px; left: 20%; animation-delay: 0.5s; animation-duration: 6s; }
.bubble:nth-child(3) { width: 15px; height: 15px; left: 30%; animation-delay: 1s; animation-duration: 4s; }
.bubble:nth-child(4) { width: 25px; height: 25px; left: 40%; animation-delay: 1.5s; animation-duration: 5.5s; }
.bubble:nth-child(5) { width: 35px; height: 35px; left: 50%; animation-delay: 2s; animation-duration: 7s; }
.bubble:nth-child(6) { width: 18px; height: 18px; left: 60%; animation-delay: 0.3s; animation-duration: 4.5s; }
.bubble:nth-child(7) { width: 28px; height: 28px; left: 70%; animation-delay: 1.2s; animation-duration: 6.5s; }
.bubble:nth-child(8) { width: 22px; height: 22px; left: 80%; animation-delay: 0.8s; animation-duration: 5s; }
.bubble:nth-child(9) { width: 32px; height: 32px; left: 90%; animation-delay: 1.8s; animation-duration: 6s; }
.bubble:nth-child(10) { width: 16px; height: 16px; left: 5%; animation-delay: 2.5s; animation-duration: 4s; }

@keyframes bubbleFloat {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100px) scale(1);
    opacity: 0;
  }
}

/* ===== 文字逐个显示动画 ===== */
.text-reveal {
  overflow: hidden;
  white-space: nowrap;
  animation: textReveal 1.5s steps(30) forwards;
}

@keyframes textReveal {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* ===== 脉冲动画 ===== */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(233, 69, 96, 0);
  }
}

/* ===== 闪烁动画 ===== */
.blink {
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== 弹跳动画 ===== */
.bounce {
  animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-10px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-5px); }
}

/* ===== 摇晃动画 ===== */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== 缩放动画 ===== */
.scale-in {
  animation: scaleIn 0.3s ease-out;
}

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

/* ===== 旋转动画 ===== */
.spin {
  animation: spin 1s linear infinite;
}

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

/* ===== 加载动画 ===== */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingDots {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== 心跳动画 ===== */
.heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  10% { transform: scale(1.1); }
  20% { transform: scale(1); }
  30% { transform: scale(1.1); }
  40% { transform: scale(1); }
}

/* ===== 渐入上滑 ===== */
.slide-up {
  animation: slideUp 0.4s ease-out;
}

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

/* ===== 渐入下滑 ===== */
.slide-down {
  animation: slideDown 0.4s ease-out;
}

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

/* ===== 渐变背景动画 ===== */
.gradient-bg {
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary), var(--bg-primary));
  background-size: 200% 200%;
  animation: gradientMove 10s ease infinite;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== 光晕效果 ===== */
.glow {
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
  }
  to {
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.8);
  }
}

/* ===== 延迟类 ===== */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ===== 过场动画专用样式 ===== */
.transition-page {
  position: relative;
  overflow: hidden;
}

.transition-page .task-reveal {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: var(--space-xxl);
}

.transition-page .task-reveal h2 {
  font-size: var(--font-size-xxl);
  margin-bottom: var(--space-lg);
  color: var(--accent);
}

.transition-page .task-reveal p {
  font-size: var(--font-size-xl);
  line-height: 1.8;
}

.transition-page .countdown {
  position: absolute;
  bottom: var(--space-xxl);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
}
