/* ── Card Animations ─────────────────────────────────────────── */

@keyframes cardFlip {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(180deg);
  }
}

@keyframes cardSlideIn {
  from {
    transform: translateY(-20px) rotate(-2deg);
    opacity: 0;
  }
  to {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
}

@keyframes cardBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes cardPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(232, 160, 74, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(232, 160, 74, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(232, 160, 74, 0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Card type-specific animations */
.rush-card.played-skill {
  animation: cardSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rush-card.played-project {
  animation: cardBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rush-card.played-event {
  animation: cardPulse 0.8s ease-out;
}

/* Status effect indicators */
.status-protected {
  position: relative;
}

.status-protected::before {
  content: '';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background-image: url('/assets/icons/status/protected.svg');
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
}

.status-boosted {
  position: relative;
}

.status-boosted::before {
  content: '';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background-image: url('/assets/icons/status/boosted.svg');
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 10;
  animation: cardPulse 1s infinite;
}

.status-debuffed {
  position: relative;
}

.status-debuffed::before {
  content: '';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background-image: url('/assets/icons/status/debuffed.svg');
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
}

/* Turn timeline animation */
.timeline-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.timeline-quarter {
  flex: 1;
  text-align: center;
  position: relative;
  padding: 8px 0;
}

.timeline-quarter.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: slideUp 0.3s ease-out;
}

.timeline-quarter.completed {
  color: var(--stat-reward);
}

.timeline-quarter.current {
  font-weight: 700;
  color: var(--accent);
}

/* Achievement badges */
.achievement-popup {
  position: fixed;
  top: 100px;
  right: 20px;
  background: var(--surface-1);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 10px 40px var(--shadow-tint);
  z-index: 1000;
  transform: translateX(100%);
  animation: slideInAchievement 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideInAchievement {
  to {
    transform: translateX(0);
  }
}

.achievement-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.achievement-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent);
}

.achievement-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Rush Q dramatic reveal */
.rush-q-reveal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  animation: fadeIn 0.3s ease-out;
}

.rush-q-reveal-content {
  text-align: center;
  animation: cardBounce 0.6s ease-out;
}

.rush-q-reveal-content h2 {
  font-size: 3rem;
  font-weight: 900;
  color: var(--neg);
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Colorblind mode patterns */
@media (prefers-contrast: high) {
  :root {
    --border: #666;
    --surface-1: #000;
    --surface-2: #111;
  }
}

/* Achievement popup */
.achievement-popup {
  position: fixed;
  top: 100px;
  right: 20px;
  background: var(--surface-1);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  max-width: 300px;
  box-shadow: 0 10px 40px var(--shadow-tint);
  z-index: 1000;
  transform: translateX(100%);
  animation: slideInAchievement 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.achievement-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  text-align: center;
}

.achievement-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  text-align: center;
}

.achievement-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

@keyframes slideInAchievement {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

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