/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700&display=swap');

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #ffe0f7 0%, #e8d5ff 40%, #d5eaff 100%);
  overflow-x: hidden;
  position: relative;
}

/* ===== FLOATING SPARKLES BACKGROUND ===== */
.sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sparkles span {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.35;
  animation: floatUp 12s infinite linear;
}

.sparkles span:nth-child(1)  { left:  4%; animation-delay:  0s;   animation-duration: 11s; }
.sparkles span:nth-child(2)  { left:  9%; animation-delay:  2s;   animation-duration: 14s; }
.sparkles span:nth-child(3)  { left: 15%; animation-delay:  5s;   animation-duration: 10s; }
.sparkles span:nth-child(4)  { left: 22%; animation-delay:  1s;   animation-duration: 13s; }
.sparkles span:nth-child(5)  { left: 30%; animation-delay:  7s;   animation-duration: 15s; }
.sparkles span:nth-child(6)  { left: 38%; animation-delay:  3s;   animation-duration: 12s; }
.sparkles span:nth-child(7)  { left: 45%; animation-delay:  9s;   animation-duration: 11s; }
.sparkles span:nth-child(8)  { left: 53%; animation-delay:  0.5s; animation-duration: 14s; }
.sparkles span:nth-child(9)  { left: 60%; animation-delay:  6s;   animation-duration: 10s; }
.sparkles span:nth-child(10) { left: 68%; animation-delay:  4s;   animation-duration: 13s; }
.sparkles span:nth-child(11) { left: 74%; animation-delay:  8s;   animation-duration: 16s; }
.sparkles span:nth-child(12) { left: 80%; animation-delay:  2.5s; animation-duration: 11s; }
.sparkles span:nth-child(13) { left: 87%; animation-delay:  5.5s; animation-duration: 12s; }
.sparkles span:nth-child(14) { left: 92%; animation-delay:  1.5s; animation-duration: 14s; }
.sparkles span:nth-child(15) { left: 97%; animation-delay:  7.5s; animation-duration: 10s; }
.sparkles span:nth-child(16) { left: 18%; animation-delay: 10s;   animation-duration: 13s; }
.sparkles span:nth-child(17) { left: 48%; animation-delay:  3.5s; animation-duration: 15s; }
.sparkles span:nth-child(18) { left: 72%; animation-delay:  6.5s; animation-duration: 11s; }
.sparkles span:nth-child(19) { left: 85%; animation-delay:  0.8s; animation-duration: 14s; }
.sparkles span:nth-child(20) { left: 35%; animation-delay:  4.2s; animation-duration: 12s; }

@keyframes floatUp {
  0%   { transform: translateY(110vh) rotate(0deg);   opacity: 0;    }
  10%  { opacity: 0.35; }
  90%  { opacity: 0.35; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0;    }
}

/* ===== HEADER ===== */
header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.crown {
  font-size: 3.5rem;
  display: block;
  animation: bob 2.5s ease-in-out infinite;
  margin-bottom: 0.25rem;
}

@keyframes bob {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-8px); }
}

header h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  color: #fff;
  text-shadow:
    0 2px 0 #c97fd6,
    0 4px 12px rgba(180, 100, 220, 0.4);
  letter-spacing: 1px;
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: #9b59b6;
  font-weight: 700;
  margin-top: 0.5rem;
}

.hearts-row {
  margin-top: 0.75rem;
  font-size: 1.4rem;
  letter-spacing: 0.3rem;
  animation: heartPulse 2s ease-in-out infinite;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1);    }
  50%       { transform: scale(1.08); }
}

/* ===== MAIN GAME GRID ===== */
main {
  position: relative;
  z-index: 1;
  padding: 1.5rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 2rem;
  justify-items: center;
}

/* ===== GAME CARD ===== */
.game-card {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(180, 100, 220, 0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
  cursor: pointer;
}

.card-glow {
  position: absolute;
  inset: -40px;
  background: radial-gradient(circle, rgba(220, 150, 255, 0.35) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}

.game-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 18px 48px rgba(180, 100, 220, 0.32);
}

.game-card:hover .card-glow {
  opacity: 1;
}

.game-card:active {
  transform: translateY(-2px) scale(0.98);
}

.game-icon {
  position: relative;
  z-index: 1;
  font-size: 4rem;
  display: block;
  margin-bottom: 0.75rem;
  animation: iconWiggle 3s ease-in-out infinite;
}

.game-card:nth-child(2) .game-icon { animation-delay: 0.4s; }
.game-card:nth-child(3) .game-icon { animation-delay: 0.8s; }

@keyframes iconWiggle {
  0%, 100% { transform: rotate(-3deg) scale(1);    }
  50%       { transform: rotate( 3deg) scale(1.08); }
}

.game-card h2 {
  position: relative;
  z-index: 1;
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  color: #7b2d8b;
  margin-bottom: 0.5rem;
}

.game-card p {
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
  color: #6a5a7a;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.play-btn {
  position: relative;
  z-index: 1;
  display: inline-block;
  background: linear-gradient(135deg, #d66de0, #a56ff0);
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 1.05rem;
  padding: 0.55rem 1.6rem;
  border-radius: 50px;
  box-shadow: 0 4px 14px rgba(160, 80, 220, 0.4);
  transition: background 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: 0.5px;
}

.game-card:hover .play-btn {
  background: linear-gradient(135deg, #c95dd4, #8b55e8);
  box-shadow: 0 6px 20px rgba(130, 60, 200, 0.55);
}

.card-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  background: linear-gradient(135deg, #ffe0f7, #e8d5ff);
  color: #9b59b6;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1.5px solid #dbb8f5;
}

/* ===== FOOTER ===== */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #9b59b6;
}

/* ===== BACK BUTTON (used in game pages) ===== */
.back-btn {
  display: inline-block;
  margin: 1rem 1.5rem;
  background: linear-gradient(135deg, #d66de0, #a56ff0);
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  padding: 0.5rem 1.4rem;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(160, 80, 220, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(130, 60, 200, 0.5);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  header {
    padding: 2rem 1rem 1.5rem;
  }
  main {
    padding: 1rem 1rem 3rem;
  }
  .games-grid {
    gap: 1.25rem;
  }
}
