/* Fresh Green Theme for Games Library - Primary: #4cc439 */
:root {
  /* Primary Green Theme Colors */
  --primary: #4cc439;
  --primary-light: #6dd652;
  --primary-dark: #3aa32d;
  --primary-glow: rgba(76, 196, 57, 0.3);
  --primary-bg: rgba(76, 196, 57, 0.1);
  --primary-border: rgba(76, 196, 57, 0.3);
  
  /* Background & Surface */
  --bg-main: #f8faf8;
  --bg-surface: #ffffff;
  --bg-card: linear-gradient(145deg, #ffffff, #f0f4f0);
  --bg-card-hover: linear-gradient(145deg, #ffffff, #e8f0e8);
  
  /* Text Colors */
  --text-primary: #1a2e1a;
  --text-secondary: #2d4a2d;
  --text-muted: #6b8e6b;
  
  /* Accent Colors */
  --accent-yellow: #facc15;
  --accent-cyan: #22d3ee;
  --accent-pink: #f472b6;
  --accent-orange: #fb923c;
  
  /* Shadows */
  --shadow-sm: 0 4px 16px rgba(76, 196, 57, 0.12);
  --shadow-md: 0 8px 32px rgba(76, 196, 57, 0.18);
  --shadow-lg: 0 16px 48px rgba(76, 196, 57, 0.24);
  --shadow-glow: 0 0 40px rgba(76, 196, 57, 0.25);
  
  /* Border Radius */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  
  /* Fonts */
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

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

body {
  min-height: 100vh;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animated Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(76, 196, 57, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(34, 211, 238, 0.08), transparent),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(250, 204, 21, 0.06), transparent);
  pointer-events: none;
  z-index: -1;
}

/* ===== HEADER ===== */
.site-header {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 16px;
}

.detail-header {
  padding-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: var(--bg-card);
  border: 2px solid var(--primary-border);
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.brand-mark::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  opacity: 0.3;
}

.brand-mark span {
  position: relative;
  z-index: 1;
}

.brand h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.brand p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* Detail Navigation */
.detail-nav {
  margin-top: 12px;
}

.detail-nav a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary-bg);
  border-radius: 999px;
  border: 1px solid var(--primary-border);
  transition: all 0.2s ease;
}

.detail-nav a:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateX(-4px);
}

/* ===== SEARCH ===== */
.search-shell {
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 0 24px 20px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

#searchInput {
  flex: 1 1 340px;
  min-width: 260px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--primary-border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

#searchInput::placeholder {
  color: var(--text-muted);
}

#searchInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-md), 0 0 0 4px var(--primary-glow);
  background: var(--bg-card);
}

#resultCount {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 0 8px;
}

/* ===== GAME GRID ===== */
.game-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
}

/* ===== GAME CARD ===== */
.game-card,
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-xl);
  padding: 0 0 24px 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-card {
  min-height: auto;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent-yellow), var(--accent-cyan));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.game-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

/* Card Icon - Full Width */
.card-icon {
  width: 100%;
  min-height: 150px;
  max-height: 280px;
  background: var(--primary-bg);
  border-bottom: 2px solid var(--primary-border);
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
}

.game-card:hover .card-icon {
  border-color: var(--primary);
}

.card-icon img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

/* Card Header */
.card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 0 20px;
}

/* Game Title */
.game-card h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
}

/* Card Meta (Category & Difficulty) */
.card-meta {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.card-meta span {
  padding: 6px 14px;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.game-card:hover .card-meta span {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Card Description */
.card-copy {
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  padding: 0 20px;
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding: 16px 20px 0 20px;
}

.card-actions a,
.card-actions button {
  flex: 1 1 140px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.card-actions a.play,
.card-actions button.play {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.card-actions a.play:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--primary-glow);
}

.card-actions a.details,
.card-actions button.details {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--primary-border);
}

.card-actions a.details:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--text-primary);
}

/* ===== DETAIL PAGE ===== */
.detail-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.detail-view {
  display: grid;
  gap: 28px;
}

.detail-top {
  display: grid;
  gap: 32px;
  align-items: start;
  grid-template-columns: minmax(0, 380px) 1fr;
}

.detail-top img {
  width: 100%;
  height: auto;
  min-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--primary-bg);
  border: 2px solid var(--primary-border);
}

.detail-copy {
  display: grid;
  gap: 20px;
}

.detail-copy p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 1.05rem;
}

.detail-copy strong {
  color: var(--primary-light);
  font-weight: 700;
}

.detail-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.detail-actions a,
.detail-actions button {
  padding: 16px 28px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.detail-actions a.play {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.detail-actions a.play:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--primary-glow);
}

.detail-actions a.home {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 2px solid var(--primary-border);
}

.detail-actions a.home:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--text-primary);
}

/* ===== EMBED SHELL ===== */
.embed-shell {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--primary-border);
  overflow: hidden;
  min-height: 480px;
}

.embed-shell iframe {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: none;
}

/* ===== AD CONTAINER ===== */
.ad-container {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 20px;
  margin: 8px 0;
}

.header-ad {
  max-width: 1200px;
  margin: 16px auto 0;
  min-height: 90px;
  grid-column: auto;
}

.ad-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px;
  width: 100%;
}

/* ===== FOOTER ===== */
.site-footer {
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 32px 24px;
  text-align: center;
  border-top: 1px solid var(--primary-border);
}

.site-footer p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: var(--text-primary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .site-header {
    padding: 24px 16px 12px;
  }
  
  .brand-mark {
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
  }
  
  .search-shell {
    padding: 0 16px 16px;
  }
  
  .game-grid {
    padding: 20px 16px;
    gap: 20px;
  }
  
  .game-card {
    min-height: auto;
    padding: 0 0 20px 0;
  }
  
  .card-icon {
    width: 100%;
    height: 180px;
  }
  
  .detail-top {
    grid-template-columns: 1fr;
  }
  
  .detail-main {
    padding: 20px 16px;
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ===== ANIMATIONS ===== */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px var(--primary-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--primary-glow);
  }
}

.game-card:hover .card-icon {
  animation: pulse-glow 2s ease-in-out infinite;
}
