/* CSS Variables */
:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #475569;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* Light Mode */
body.light-mode {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-card: #E5E7EB;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --border: #D1D5DB;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Navigation */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
}

.nav-title {
  color: var(--primary);
  font-size: 1.5rem;
}

.logo-text span {
  font-weight: 700;
}

.logo-text span:nth-child(6n+1) { color: #ef4444; }
.logo-text span:nth-child(6n+2) { color: #f59e0b; }
.logo-text span:nth-child(6n+3) { color: #10b981; }
.logo-text span:nth-child(6n+4) { color: #3b82f6; }
.logo-text span:nth-child(6n+5) { color: #a855f7; }
.logo-text span:nth-child(6n+6) { color: #ec4899; }

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--primary);
  background: var(--bg-card);
}

/* Language Switch */
.lang-switch {
  display: flex;
  gap: 0.25rem;
  margin-left: 1rem;
}

.lang-btn {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.lang-btn:hover {
  color: var(--primary);
  background: var(--bg-card);
}

.lang-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.view.hidden {
  display: none;
}

.container {
  width: 100%;
}

/* Games Header */
.games-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
}

.games-header h2 {
  color: var(--primary);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.games-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Hero Image */
.hero-image {
  max-width: 825px;
  margin: 1.5rem auto 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

body.light-mode .hero-image {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.hero-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Games List */
.games-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* Game Card */
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.game-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.game-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.game-card:hover .game-image img {
  transform: scale(1.05);
}

.game-image img.fit-contain {
  object-fit: contain;
  background: var(--bg-secondary);
}

.game-card:hover .game-image img.fit-contain {
  transform: scale(2.5);
  position: relative;
  z-index: 10;
  pointer-events: none;
}

.game-card:hover .game-image:has(img.fit-contain) {
  overflow: visible;
  position: relative;
  z-index: 10;
}

.game-card:has(img.fit-contain):hover {
  overflow: visible;
  z-index: 10;
}

.game-emoji-banner {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  transition: transform 0.3s ease;
}

.game-card:hover .game-emoji-banner {
  transform: scale(1.05);
}

.game-detail-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8rem;
  padding: 3rem;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  border-radius: 1rem;
  border: 1px solid var(--border);
}

.game-content {
  padding: 1.5rem;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.game-category {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.game-players {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.game-title {
  color: var(--text-primary);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.game-summary {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.game-meta {
  display: flex;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.game-duration,
.game-difficulty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Game Detail */
.btn-back {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.btn-back:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
}

.game-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
}

.game-detail-image {
  text-align: center;
  margin-bottom: 2rem;
}

.game-detail-image img {
  max-width: 100%;
  height: auto;
  max-height: 400px;
  border-radius: 1rem;
  object-fit: cover;
}

.game-detail-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.game-detail-title {
  color: var(--primary);
  font-size: 2rem;
  margin-bottom: 1rem;
}

.game-detail-meta {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.game-meta-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  font-size: 0.85rem;
}

.game-detail-content {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.game-detail-content h3 {
  color: var(--primary);
  margin-bottom: 1rem;
}

.game-detail-content h4 {
  color: var(--text-primary);
  margin: 1.25rem 0 0.75rem;
}

.game-detail-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.game-detail-content ul {
  margin-left: 2rem;
  margin-top: 0.5rem;
}

.game-detail-content li {
  margin-bottom: 0.5rem;
}

.game-detail-actions {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-play {
  display: inline-block;
  background: var(--primary);
  color: #ffffff;
  padding: 1rem 2.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-play:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.btn-disabled {
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
  border: 1px solid var(--border);
}

.btn-disabled:hover {
  background: var(--bg-secondary);
  transform: none;
  box-shadow: none;
}

/* Old games link */
.old-games-link {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  text-align: center;
}

.old-games-link p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.old-games-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.old-games-link a:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 2px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 1rem;
  }

  .nav-menu {
    gap: 0.5rem;
  }

  .main-content {
    padding: 1rem;
  }

  .games-list {
    grid-template-columns: 1fr;
  }

  .game-detail-meta {
    flex-direction: column;
    align-items: center;
  }
}
