/* Games Page Specific Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #222;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Games Header */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  animation: float 20s ease-in-out infinite;
  opacity: 0.3;
}

@keyframes float {
  0%, 100% { transform: translateX(0) translateY(0) rotate(0deg); }
  25% { transform: translateX(-20px) translateY(-20px) rotate(90deg); }
  50% { transform: translateX(20px) translateY(-10px) rotate(180deg); }
  75% { transform: translateX(-10px) translateY(20px) rotate(270deg); }
}

header h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  margin-bottom: 1.5rem;
  text-shadow: 0 4px 8px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
  animation: slideInUp 0.8s ease-out;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color: #fff;
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  font-size: 0.95rem;
  z-index: 10;
}

.back-button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  background: linear-gradient(135deg, #8e2de2, #4a00e0);
  color: #fff !important;
}

/* Main Content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1rem;
  position: relative;
  z-index: 1;
}

.category-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

/* Enhanced Category Cards */
.category-card, .stack-card {
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }
.category-card:nth-child(5) { animation-delay: 0.5s; }
.category-card:nth-child(6) { animation-delay: 0.6s; }

.category-card::before, .stack-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
  transition: left 0.6s;
}

.category-card:hover::before, .stack-card:hover::before {
  left: 100%;
}

.category-card:hover, .stack-card:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow: 0 25px 50px rgba(102, 126, 234, 0.25);
  background: linear-gradient(145deg, #fff, #f8f9ff);
}

.category-card h3, .stack-card h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: #333;
  font-weight: 700;
  transition: color 0.3s ease;
}

.category-card:hover h3, .stack-card:hover h3 {
  color: #667eea;
}

.category-card p, .stack-card p {
  font-size: 1.1rem;
  color: #666;
  line-height: 1.7;
  margin-bottom: 2rem;
  opacity: 0.85;
}

/* Enhanced Play Button, Code Button*/
.play-button, .code-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 0.875rem 1.75rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-size: 0.95rem;
}

.play-button::before, .code-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.play-button:hover::before, .code-button:hover::before {
  left: 100%;
}

.play-button:hover, .code-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.play-button::after {
  content: '🎮';
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

.play-button:hover::after, .code-button:hover::after {
  transform: scale(1.2) rotate(10deg);
}

/* Game Icon Animation */
.category-card h3::before {
  content: '🎮';
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 1.2em;
  transition: transform 0.3s ease;
}

.category-card:hover h3::before {
  transform: scale(1.2) rotate(15deg);
}

/* Special styling for specific games */
.category-card:nth-child(1) h3::before {
  content: '🧠'; /* Memory game */
}

.category-card:nth-child(2) h3::before {
  content: '🐍'; /* Snake game */
}
.category-card:nth-child(4) h3::before {
  content: '🎯'; /* Word Guess game */
}

/* Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Responsive Design */
@media (max-width: 768px) {
  header {
    padding: 3rem 1rem;
    min-height: 40vh;
  }

  main {
    padding: 2rem 1rem;
  }

  .category-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .category-card {
    padding: 2rem 1.5rem;
  }

  .category-card h3 {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 2rem 1rem;
  }

  .category-card {
    padding: 1.5rem 1rem;
  }

  .category-card h3 {
    font-size: 1.4rem;
  }

  .play-button {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
}

/* Loading animation */
.page-loaded .category-card {
  animation-play-state: running;
}

/* Hover effect for the entire page */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(102, 126, 234, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}