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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding: 24px;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== Background glow ===== */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(99, 102, 241, 0.15), transparent),
    radial-gradient(ellipse 45% 45% at 75% 60%, rgba(14, 165, 233, 0.10), transparent),
    radial-gradient(ellipse 40% 35% at 50% 85%, rgba(139, 92, 246, 0.08), transparent);
  transition: background 0.4s ease;
}

/* ===== Theme toggle ===== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.15rem;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.theme-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(1.06);
}

/* ===== Page layout ===== */
.games-page {
  position: relative;
  z-index: 1;
  width: min(800px, 100%);
  margin: 0 auto;
  padding: 60px 0 44px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 24px;
}

.back-link:hover {
  color: var(--accent);
  border-color: rgba(92, 95, 239, 0.25);
  background: var(--panel-hover);
  transform: translateX(-3px);
}

/* ===== Tab bar ===== */
.tab-bar {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-bar::-webkit-scrollbar { height: 0; }

.tab-btn {
  position: relative;
  flex: 1;
  min-width: 100px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.3s ease, transform 0.3s ease;
  z-index: 1;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: #fff;
}

.tab-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  height: calc(100% - 12px);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: left 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
  z-index: 0;
}

/* ===== Hero section ===== */
.game-hero {
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.game-hero.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-cover-wrap {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.hero-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.hero-cover-wrap:hover .hero-cover {
  transform: scale(1.03);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.3) 45%,
    rgba(0, 0, 0, 0) 70%
  );
  pointer-events: none;
}

.hero-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 32px 28px;
  pointer-events: none;
}

.hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.hero-tag {
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.hero-desc {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
  max-width: 560px;
}

.hero-version {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== Downloads section ===== */
.downloads-section {
  animation: fadeSlideUp 0.5s ease both;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-left: 4px;
}

.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.download-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.download-card:hover {
  transform: translateY(-2px) translateX(2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(92, 95, 239, 0.3);
  background: var(--panel-hover);
}

.dl-platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  min-width: 60px;
  justify-content: center;
}

.dl-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dl-body strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.dl-body small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.dl-arrow {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.download-card:hover .dl-arrow {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ===== Animations ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  body { padding: 12px; }

  .games-page { padding: 48px 0 28px; }

  .tab-btn {
    padding: 10px 14px;
    font-size: 0.82rem;
    min-width: 80px;
  }

  .hero-cover-wrap { aspect-ratio: 4 / 3; border-radius: var(--radius-lg); }

  .hero-info { padding: 32px 20px 20px; }
  .hero-title { font-size: 1.5rem; }
  .hero-desc { font-size: 0.85rem; }

  .download-card { padding: 12px 14px; gap: 10px; }
  .dl-arrow { width: 30px; height: 30px; min-width: 30px; font-size: 0.75rem; }
}

@media (max-width: 400px) {
  .hero-title { font-size: 1.25rem; }
  .tab-btn { padding: 8px 12px; font-size: 0.78rem; min-width: 70px; }
}
