/* 🌌 Background */
body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0d1117;
  color: white;
  text-align: center;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Floating particles background */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6366f1, transparent);
  top: -200px;
  left: -200px;
  animation: float 25s ease-in-out infinite;
}

body::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #ec4899, transparent);
  bottom: -150px;
  right: -150px;
  animation: float 30s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { 
    transform: translate(0, 0) scale(1);
  }
  33% { 
    transform: translate(100px, -80px) scale(1.1);
  }
  66% { 
    transform: translate(-80px, 100px) scale(0.9);
  }
}

body > * {
  position: relative;
  z-index: 1;
}

/* 🔥 Navbar */
.navbar {
  padding: 40px 20px 35px;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar h2 {
  margin: 0;
  font-size: 3.2rem;
  font-weight: 900;
  background: linear-gradient(120deg, #ff6b6b, #ffd93d 25%, #6bcf7f 50%, #4d96ff 75%, #c471ed);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
  animation: rainbow 8s linear infinite, bounce 2s ease-in-out infinite;
  display: inline-block;
  text-shadow: 0 0 30px rgba(255, 107, 107, 0.3);
}

@keyframes rainbow {
  to { background-position: 200% center; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.navbar p {
  margin: 12px 0 0;
  opacity: 0.7;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 1px;
  animation: fadeSlide 1s ease-out;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 0.7;
    transform: translateY(0);
  }
}

/* 🔍 Search Section */
.search-box {
  margin: 60px auto;
  max-width: 700px;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

/* 🔍 Input */
input {
  padding: 16px 24px;
  width: 320px;
  border-radius: 12px;
  border: 2px solid rgba(99, 102, 241, 0.3);
  outline: none;
  background: rgba(22, 27, 34, 0.8);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

input:focus {
  border-color: #ec4899;
  box-shadow: 
    0 0 0 4px rgba(236, 72, 153, 0.1), 
    0 8px 30px rgba(236, 72, 153, 0.4);
  transform: translateY(-3px) scale(1.02);
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateY(-3px) scale(1.02) rotate(0deg); }
  25% { transform: translateY(-3px) scale(1.02) rotate(-1deg); }
  75% { transform: translateY(-3px) scale(1.02) rotate(1deg); }
}

/* 🔘 Select */
select {
  padding: 16px 20px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.1);
  outline: none;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

select:hover {
  border-color: #8b5cf6;
  transform: translateY(-2px);
}

select option {
  background: #1a1f3a;
  color: white;
}

/* 🔘 Button */
button {
  padding: 15px 35px;
  border: 2px solid #6366f1;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 5px 20px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.3);
  }
  50% {
    box-shadow: 0 5px 30px rgba(99, 102, 241, 0.5);
  }
}

button::after {
  content: '🚀';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

button:hover::after {
  right: 15px;
  animation: rocket 0.6s ease-in-out;
}

@keyframes rocket {
  0%, 100% { transform: translateY(-50%) rotate(0deg); }
  50% { transform: translateY(-50%) rotate(-15deg) translateX(5px); }
}

button:hover {
  transform: translateY(-4px) rotate(-1deg);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6);
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  border-color: #ec4899;
}

button:active {
  transform: translateY(-2px) scale(0.98);
  animation: none;
}

/* 🎮 Grid */
#results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 35px;
  padding: 50px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

/* 🧊 Game Card */
.game-card {
  background: rgba(22, 27, 34, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 0;
  cursor: pointer;
  border: 2px solid rgba(99, 102, 241, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  opacity: 0;
  animation: fadeInFloat 0.8s ease forwards;
}

.game-card:nth-child(1) { animation-delay: 0.1s; }
.game-card:nth-child(2) { animation-delay: 0.2s; }
.game-card:nth-child(3) { animation-delay: 0.3s; }
.game-card:nth-child(4) { animation-delay: 0.4s; }
.game-card:nth-child(5) { animation-delay: 0.5s; }
.game-card:nth-child(6) { animation-delay: 0.6s; }
.game-card:nth-child(n+7) { animation-delay: 0.7s; }

@keyframes fadeInFloat {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 340deg,
    rgba(99, 102, 241, 0.8) 340deg 360deg
  );
  animation: rotate 4s linear infinite;
  opacity: 0;
  transition: opacity 0.5s;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

.game-card:hover::before {
  opacity: 1;
}

.game-card::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: rgba(22, 27, 34, 0.95);
  border-radius: 14px;
  z-index: 0;
}

/* 🔥 Clean Hover */
.game-card:hover {
  transform: translateY(-12px) rotate(2deg);
  border-color: rgba(236, 72, 153, 0.6);
  box-shadow: 
    0 20px 60px rgba(236, 72, 153, 0.4),
    0 0 40px rgba(99, 102, 241, 0.3);
}

/* 🖼 Image */
.game-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 0;
  transition: all 0.4s ease;
  display: block;
  position: relative;
  z-index: 1;
  filter: brightness(0.9);
}

/* 🎯 Image effects */
.game-card:hover img {
  transform: scale(1.15) rotate(-2deg);
  filter: brightness(1.1) saturate(1.2);
}

.game-card h3 {
  position: relative;
  z-index: 2;
  margin: 16px 20px 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  text-align: left;
  transition: all 0.3s ease;
}

.game-card:hover h3 {
  color: #ffd93d;
  transform: translateX(5px);
}

/* ⭐ Text */
.game-card p {
  position: relative;
  z-index: 2;
  margin: 8px 20px;
  text-align: left;
  opacity: 0.75;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.game-card:hover p {
  opacity: 1;
  transform: translateX(3px);
}

.game-card p:last-child {
  margin-bottom: 20px;
}

/* ⏳ Loader */
.loader {
  width: 60px;
  height: 60px;
  margin: 60px auto;
  position: relative;
  animation: loaderBounce 1.5s ease-in-out infinite;
}

.loader::before,
.loader::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.loader::before {
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: #6366f1;
  border-right-color: #ec4899;
  border-bottom-color: #ffd93d;
  animation: spin 1s linear infinite;
}

.loader::after {
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
  border: 4px solid transparent;
  border-top-color: #ffd93d;
  border-left-color: #6bcf7f;
  animation: spin 0.7s linear infinite reverse;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes loaderBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* 📄 Description */
#description {
  max-width: 800px;
  margin: 20px auto;
  line-height: 1.7;
  text-align: left;
}

/* 🔹 Section Titles */
h3 {
  margin-top: 25px;
  color: #3b82f6;
}

/* 🎮 Game Details */
#image {
  border-radius: 15px;
  margin-top: 10px;
}

#title {
  margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar h2 {
    font-size: 2rem;
  }
  
  .search-box {
    flex-direction: column;
    margin: 40px auto;
  }
  
  input {
    width: 100%;
    max-width: 400px;
  }
  
  #results {
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 20px;
  }
  
  button {
    width: 100%;
    max-width: 400px;
  }
}