/* ===== 关键帧动画库 ===== */

/* 宠物浮动 */
@keyframes petFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-3deg); }
  75% { transform: translateY(-6px) rotate(3deg); }
}

/* 宠物吃东西 */
@keyframes petEat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(-5deg); }
}

/* 宠物洗澡 */
@keyframes petBath {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
  100% { transform: rotate(0deg); }
}

/* 宠物玩耍 */
@keyframes petPlay {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px) scale(1.1); }
}

/* 宠物治疗 */
@keyframes petHeal {
  0%, 100% { filter: drop-shadow(2px 4px 8px rgba(0,0,0,0.15)); }
  50% { filter: drop-shadow(0 0 20px rgba(76, 175, 80, 0.8)) brightness(1.2); }
}

/* 摇摆 */
@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-10deg); }
  30% { transform: rotate(8deg); }
  45% { transform: rotate(-6deg); }
  60% { transform: rotate(4deg); }
  75% { transform: rotate(-2deg); }
}

/* 弹跳 */
@keyframes bounce {
  0%, 100% { transform: translateY(0) scaleY(1); }
  40% { transform: translateY(-20px) scaleY(1.05); }
  60% { transform: translateY(-12px) scaleY(0.95); }
}

/* 按钮点击涟漪 */
@keyframes ripple {
  to { transform: scale(3); opacity: 0; }
}

/* 进度条光泽 */
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 弹出动画 */
@keyframes bubblePop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* 模态框入场 */
@keyframes modalIn {
  0% { transform: scale(0.8) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Toast 通知 */
@keyframes toastIn {
  0% { transform: translateX(100px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100px); opacity: 0; }
}

/* 金币飞行 */
@keyframes coinFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.3); opacity: 0; }
}

/* 旋转加载 */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 心跳 */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.2); }
  28% { transform: scale(1); }
  42% { transform: scale(1.15); }
  70% { transform: scale(1); }
}

/* 孵化动画 */
@keyframes hatch {
  0% { transform: rotate(0deg) scale(1); }
  10% { transform: rotate(-5deg) scale(1.02); }
  20% { transform: rotate(5deg) scale(1.04); }
  30% { transform: rotate(-8deg) scale(1.06); }
  40% { transform: rotate(8deg) scale(1.08); }
  50% { transform: rotate(-10deg) scale(1.1); }
  60% { transform: rotate(10deg) scale(1.2); }
  70% { transform: rotate(-5deg) scale(1.3); }
  80% { transform: scale(1.4) rotate(0deg); }
  90% { transform: scale(0.8); }
  100% { transform: scale(1) rotate(0deg); }
}

/* 闪烁 */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 淡入上移 */
@keyframes fadeInUp {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* 页面切换 */
@keyframes pageIn {
  0% { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* 积分数字跳动 */
@keyframes pointsJump {
  0% { transform: scale(1); color: inherit; }
  50% { transform: scale(1.5); color: #FFD600; }
  100% { transform: scale(1); color: inherit; }
}

/* 星星爆炸 */
@keyframes starBurst {
  0% { transform: scale(0) rotate(0deg); opacity: 1; }
  100% { transform: scale(2) rotate(180deg); opacity: 0; }
}

/* 等级提升 */
@keyframes levelUp {
  0% { transform: scale(1); }
  30% { transform: scale(1.3) rotate(-5deg); }
  60% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1); }
}

/* 实用动画类 */
.animate-bounce { animation: bounce 1s infinite; }
.animate-wobble { animation: wobble 2s infinite; }
.animate-heartbeat { animation: heartbeat 1.5s infinite; }
.animate-blink { animation: blink 1s infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease; }
.animate-pageIn { animation: pageIn 0.4s ease; }
.animate-levelUp { animation: levelUp 0.6s ease; }

/* 孵化蛋 */
.egg-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.egg-emoji {
  font-size: 120px;
  cursor: pointer;
  transition: all 0.3s;
  filter: drop-shadow(0 8px 20px rgba(255, 107, 157, 0.4));
  animation: petFloat 3s ease-in-out infinite;
}
.egg-emoji.hatching { animation: hatch 2s ease-in-out; }
.egg-emoji:hover { transform: scale(1.1); }
.egg-progress-ring {
  width: 160px;
  height: 160px;
  position: relative;
  margin-bottom: 16px;
}
.egg-progress-ring svg {
  transform: rotate(-90deg);
}
.egg-progress-ring .ring-bg {
  fill: none;
  stroke: #F0E6FF;
  stroke-width: 8;
}
.egg-progress-ring .ring-fill {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 弹出道具选择 */
.item-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.item-option {
  background: #F8F0FF;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.item-option:hover, .item-option.selected {
  border-color: var(--primary);
  background: #FFF0F8;
  transform: scale(1.03);
}
.item-option .item-emoji { font-size: 32px; }
.item-option .item-label { font-size: 11px; font-weight: 700; color: var(--text-mid); text-align: center; }
.item-option .item-count-badge {
  background: var(--primary);
  color: white;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
}

/* 星星粒子 */
.star-particle {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  font-size: 20px;
  animation: starBurst 0.8s ease forwards;
}

/* 等级提升横幅 */
.level-up-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #FF6B9D, #7C4DFF);
  color: white;
  padding: 24px 40px;
  border-radius: 24px;
  text-align: center;
  z-index: 9997;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.level-up-title { font-size: 32px; font-weight: 900; margin-bottom: 8px; }
.level-up-sub { font-size: 16px; opacity: 0.9; }
