/* ========================================
   STEP WARS - Base Styles
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0a0a0f;
  color: #e0d6c8;
  font-family: 'Crimson Text', serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#root {
  width: 100%;
  height: 100%;
}

/* Loading Screen */
#loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1520 0%, #0a0a0f 70%);
  transition: opacity 0.6s ease;
}
#loading.hide {
  opacity: 0;
  pointer-events: none;
}
#loading h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: 2.4rem;
  color: #D4AF37;
  text-shadow: 0 0 30px rgba(212,175,55,0.4);
  margin-bottom: 24px;
  letter-spacing: 3px;
}
#loading .bar-track {
  width: 240px;
  height: 4px;
  background: rgba(212,175,55,0.15);
  border-radius: 2px;
  overflow: hidden;
}
#loading .bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #D4AF37, #f5d76e);
  border-radius: 2px;
  animation: loadBar 2s ease-in-out forwards;
}
@keyframes loadBar {
  0% { width: 0%; }
  40% { width: 60%; }
  80% { width: 85%; }
  100% { width: 100%; }
}
#loading .sub {
  font-family: 'Cinzel', serif;
  color: rgba(212,175,55,0.5);
  font-size: 0.8rem;
  margin-top: 16px;
  letter-spacing: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,0.4); }

/* ========================================
   VFX Animations & Keyframes
   ======================================== */

  @import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Cinzel:wght@400;500;600;700;800;900&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&family=MedievalSharp&display=swap');

  @keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
  }
  @keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    10% { opacity: 0.8; }
    80% { opacity: 0.3; }
    100% { transform: translateY(-100vh) scale(0.2); opacity: 0; }
  }
  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  @keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
  }
  @keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px var(--glow-color, rgba(212,175,55,0.3)), 0 0 40px var(--glow-color, rgba(212,175,55,0.1)); }
    50% { box-shadow: 0 0 30px var(--glow-color, rgba(212,175,55,0.5)), 0 0 60px var(--glow-color, rgba(212,175,55,0.2)); }
  }
  @keyframes breathe {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
  }
  @keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
  }
  @keyframes orbFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(5deg); }
    50% { transform: translateY(-5px) rotate(0deg); }
    75% { transform: translateY(-20px) rotate(-5deg); }
  }
  @keyframes ringPulse {
    0% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.05); opacity: 0.3; }
    100% { transform: scale(0.8); opacity: 0.6; }
  }
  @keyframes emojiFloat {
    0% { transform: translateY(0) translateX(0) rotate(0deg) scale(0.3); opacity: 0; }
    10% { opacity: 0.5; transform: translateY(-10vh) translateX(calc(var(--drift) * 0.2)) rotate(calc(var(--spin) * 0.2)) scale(1); }
    50% { opacity: 0.35; }
    100% { transform: translateY(-110vh) translateX(var(--drift)) rotate(var(--spin)) scale(0.4); opacity: 0; }
  }

  .race-card {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }
  .race-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 0%, var(--card-glow, transparent) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.35s;
  }
  .race-card:hover::before, .race-card.selected::before { opacity: 1; }
  .race-card:hover { transform: translateY(-4px) scale(1.03); }
  .race-card.selected { transform: scale(1.05); }

  .cta-btn {
    position: relative; overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .cta-btn::before {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
  }
  .cta-btn:hover::before { left: 100%; }
  .cta-btn:hover { transform: translateY(-2px); filter: brightness(1.15); }
  .cta-btn:active { transform: translateY(0) scale(0.98); }

  .modal-overlay { animation: fadeIn 0.3s ease-out; }
  .modal-content { animation: scaleIn 0.35s cubic-bezier(0.4, 0, 0.2, 1); }

  .unit-row {
    transition: all 0.2s ease;
  }
  .unit-row:hover {
    background: rgba(255,255,255,0.06) !important;
    transform: translateX(4px);
  }

  .benefit-row {
    animation: slideInLeft 0.5s ease-out both;
  }

  @keyframes emojiSway {
    0%, 100% { transform: scale(1.1) rotate(0deg) translateY(0); }
    25% { transform: scale(1.1) rotate(-6deg) translateY(-3px); }
    50% { transform: scale(1.1) rotate(0deg) translateY(-1px); }
    75% { transform: scale(1.1) rotate(6deg) translateY(-3px); }
  }

  @keyframes expandDown {
    from { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
    to { max-height: 2000px; opacity: 1; }
  }

  @keyframes queuePulse {
    0%, 100% { box-shadow: 0 0 4px var(--pulse-color, rgba(255,215,0,0.3)); }
    50% { box-shadow: 0 0 14px var(--pulse-color, rgba(255,215,0,0.6)); }
  }

  @keyframes barGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
  }

  .card-hover {
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  }
  .card-hover:hover {
    border-color: var(--hover-color, rgba(255,255,255,0.15)) !important;
    box-shadow: 0 0 12px var(--hover-glow, rgba(255,255,255,0.08));
    transform: translateY(-1px);
  }
`;
