/* ============================================
   Animations — Keyframes & Micro-interactions
   ============================================ */


/* ---- Counter bounce ---- */
@keyframes counterBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.2); }
  50% { transform: scale(0.95); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.counter-bounce {
  animation: counterBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Fact card slide up ---- */
@keyframes factCardSlideUp {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.fact-card-enter {
  animation: factCardSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ---- Microstate Radar Ping (Glows 1 time at the start) ---- */
@keyframes microstateRadarPing {
  0% {
    r: 1.6;
    filter: drop-shadow(0 0 0px rgba(184, 58, 46, 0));
  }
  35% {
    r: 3.4;
    filter: drop-shadow(0 0 10px rgba(226, 109, 92, 0.95)) drop-shadow(0 0 20px rgba(184, 58, 46, 0.70));
  }
  100% {
    r: 2.2;
    filter: drop-shadow(0 0 3px rgba(184, 58, 46, 0.30));
  }
}

/* ---- Island / Small Territory Radar Pulse (Glows 1 time at the start) ---- */
@keyframes islandRadarPulse {
  0% {
    stroke-width: 1.0px;
    filter: drop-shadow(0 0 0px rgba(184, 58, 46, 0));
  }
  35% {
    stroke-width: 2.0px;
    stroke: #FFE5E0;
    filter: drop-shadow(0 0 10px rgba(226, 109, 92, 0.95)) drop-shadow(0 0 20px rgba(184, 58, 46, 0.70));
  }
  100% {
    stroke-width: 1.2px;
    stroke: var(--reverse-highlight-light);
    filter: drop-shadow(0 0 4px rgba(184, 58, 46, 0.35));
  }
}

/* ---- Soft Mode-Aware Country Discovery Reveal ---- */
@keyframes countryRevealCasual {
  0% {
    fill: #E8C15A;
    stroke: #FFF0B8;
    stroke-width: 1.5px;
    filter: drop-shadow(0 0 8px rgba(197, 155, 39, 0.55));
  }
  100% {
    fill: var(--casual-highlight);
    stroke: var(--casual-highlight-light);
    stroke-width: 0.95px;
    filter: drop-shadow(0 0 2px rgba(197, 155, 39, 0.20));
  }
}

@keyframes countryRevealSpeed {
  0% {
    fill: #5BB898;
    stroke: #B5F0DB;
    stroke-width: 1.5px;
    filter: drop-shadow(0 0 8px rgba(45, 127, 103, 0.55));
  }
  100% {
    fill: var(--speed-highlight);
    stroke: var(--speed-highlight-light);
    stroke-width: 0.95px;
    filter: drop-shadow(0 0 2px rgba(45, 127, 103, 0.20));
  }
}

@keyframes countryRevealReverse {
  0% {
    fill: #C94A3A;
    stroke: #E26D5C;
    stroke-width: 1.2px;
    filter: drop-shadow(0 0 4px rgba(184, 58, 46, 0.35));
  }
  100% {
    fill: var(--reverse-highlight);
    stroke: var(--reverse-highlight-light);
    stroke-width: 0.95px;
    filter: drop-shadow(0 0 1px rgba(184, 58, 46, 0.15));
  }
}

/* ---- Microstate Beacon Radar Ping ---- */
@keyframes beaconPing {
  0% {
    r: 2px;
    opacity: 1;
    stroke-width: 2px;
  }
  50% {
    r: 12px;
    opacity: 0.8;
    stroke-width: 1.5px;
  }
  100% {
    r: 22px;
    opacity: 0;
    stroke-width: 0.5px;
  }
}

/* ---- Discovery Ripple & Streak Pop ---- */
@keyframes streakPop {
  0% { transform: scale(0.85); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Glow pulse for active highlight ---- */
@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 4px var(--active-glow-subtle)); }
  50% { filter: drop-shadow(0 0 10px var(--active-glow)); }
}

/* ---- Fade in ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* ---- Fade in up ---- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.4s ease forwards;
}

/* ---- Scale in ---- */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in {
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ---- App reveal (after intro) ---- */
@keyframes appReveal {
  from {
    opacity: 0;
    filter: blur(8px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

.app-reveal {
  animation: appReveal 0.8s ease forwards;
}

/* ---- Correct guess flash ---- */
@keyframes correctFlash {
  0% { background: transparent; }
  15% { background: var(--active-glow-subtle); }
  100% { background: transparent; }
}

.input-correct {
  animation: correctFlash 0.6s ease;
}

/* ---- Timer tick ---- */
@keyframes timerTick {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ---- Shimmer for loading states ---- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 0%,
    var(--glass-bg-hover) 50%,
    var(--glass-bg) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ---- Mode switch transition ---- */
@keyframes modeSwitch {
  0% { opacity: 0.6; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

.mode-transition {
  animation: modeSwitch 0.3s ease;
}

/* ---- Floating animation for continent labels ---- */
@keyframes floatSubtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* ---- Victory Overlay & Themes ---- */
.victory-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(14, 13, 11, 0.40) 0%, rgba(9, 8, 7, 0.72) 50%, rgba(5, 5, 8, 0.94) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.victory-card {
  max-width: 520px;
  width: 100%;
  background: var(--ink-950, #0E0D0B);
  border: 1px solid var(--hairline, rgba(237, 230, 216, 0.12));
  border-radius: var(--radius-lg, 12px);
  padding: 36px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85);
  animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
}

/* Theme: Casual Golden Illumination */
.victory-card.casual-theme {
  border-color: rgba(197, 155, 39, 0.4);
  box-shadow: 0 0 60px rgba(197, 155, 39, 0.15), 0 24px 80px rgba(0, 0, 0, 0.9);
}
.victory-card.casual-theme .victory-badge {
  background: rgba(197, 155, 39, 0.15);
  color: var(--brass-400, #DFB755);
  border: 1px solid rgba(197, 155, 39, 0.4);
}

/* Theme: Speed Hyperdrive */
.victory-card.speed-theme {
  border-color: rgba(91, 184, 152, 0.4);
  box-shadow: 0 0 60px rgba(91, 184, 152, 0.15), 0 24px 80px rgba(0, 0, 0, 0.9);
}
.victory-card.speed-theme .victory-badge {
  background: rgba(91, 184, 152, 0.15);
  color: #7AD4B5;
  border: 1px solid rgba(91, 184, 152, 0.4);
}

/* Theme: Reverse Tactical Mastermind */
.victory-card.reverse-theme {
  border-color: rgba(184, 58, 46, 0.4);
  box-shadow: 0 0 60px rgba(184, 58, 46, 0.15), 0 24px 80px rgba(0, 0, 0, 0.9);
}
.victory-card.reverse-theme .victory-badge {
  background: rgba(184, 58, 46, 0.15);
  color: #E87063;
  border: 1px solid rgba(184, 58, 46, 0.4);
}

.victory-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 4px 14px;
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.victory-icon {
  font-size: 3.2rem;
  margin-bottom: 2px;
  display: block;
  animation: floatSubtle 3s ease-in-out infinite;
}

.victory-card h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--paper, #EDE6D8);
  letter-spacing: -0.01em;
  margin: 0;
}

.victory-quirky-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--paper-muted, #A79E8E);
  line-height: 1.55;
  background: rgba(237, 230, 216, 0.03);
  border: 1px solid var(--hairline, rgba(237, 230, 216, 0.1));
  padding: 16px 20px;
  border-radius: var(--radius-sm, 6px);
  text-align: left;
}

.victory-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.victory-next-btn {
  padding: 10px 20px;
  background: var(--brass-500, #C59B27);
  color: var(--ink-950, #0E0D0B) !important;
  border: 1px solid var(--brass-400, #DFB755);
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 0 16px rgba(197, 155, 39, 0.35);
}

.speed-theme .victory-next-btn {
  background: #B83A2E;
  border-color: #D04538;
  color: #FFF !important;
  box-shadow: 0 0 16px rgba(184, 58, 46, 0.35);
}

.reverse-theme .victory-next-btn {
  background: var(--brass-500, #C59B27);
  border-color: var(--brass-400, #DFB755);
  color: var(--ink-950, #0E0D0B) !important;
}

.victory-next-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.victory-close-btn {
  padding: 10px 18px;
  background: rgba(237, 230, 216, 0.06);
  color: var(--paper, #EDE6D8);
  border: 1px solid var(--hairline, rgba(237, 230, 216, 0.15));
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.victory-close-btn:hover {
  background: rgba(237, 230, 216, 0.12);
  color: var(--paper-bright, #FFFFFF);
  transform: translateY(-1px);
}

/* SVG Wave Animations */
@keyframes goldenAuroraWave {
  0% { fill: #ffd700; filter: drop-shadow(0 0 12px #ffd700); }
  50% { fill: #00f5d4; filter: drop-shadow(0 0 20px #00f5d4); }
  100% { fill: #00b4d8; filter: drop-shadow(0 0 8px #00b4d8); }
}

.aurora-wave-active {
  animation: goldenAuroraWave 1.8s ease-in-out infinite alternate;
}

@keyframes electricPulse {
  0%, 100% { filter: drop-shadow(0 0 4px #00f5d4); }
  50% { filter: drop-shadow(0 0 25px #00f5d4) drop-shadow(0 0 10px #ffffff); }
}

.electric-pulse-active {
  animation: electricPulse 0.8s ease-in-out infinite;
}

