:root {
  --red: #e3350d;
  --red-dark: #c62828;
  --blue: #3b4cca;
  --blue-dark: #2a2a72;
  --yellow: #ffcb05;
  --yellow-dark: #f5a623;
  --cream: #fff9e6;
  --white: #ffffff;
  --ink: #1a1a2e;
  --muted: #5c5c7a;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 12px 40px rgba(26, 26, 46, 0.15);
  --radius: 18px;
  --font: "Nunito", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 203, 5, 0.35), transparent 25%),
    radial-gradient(circle at 90% 10%, rgba(59, 76, 202, 0.25), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(227, 53, 13, 0.12), transparent 40%),
    linear-gradient(160deg, #eef3ff 0%, var(--cream) 45%, #ffe8e0 100%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 3px solid var(--yellow);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.pokeball {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--red) 48%, #222 48%, #222 52%, var(--white) 52%);
  border: 3px solid var(--ink);
  position: relative;
  flex-shrink: 0;
}

.pokeball::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--ink);
}

.nav-link {
  font-weight: 700;
  color: var(--blue);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  transition: background 0.2s;
}

.nav-link:hover { background: rgba(59, 76, 202, 0.1); }

/* Hero */
.hero {
  padding: 3rem 0 2rem;
  text-align: center;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--blue), var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  margin: 0 auto 1.5rem;
  max-width: 620px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--card);
  border: 2px solid var(--yellow);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

/* Search & filters */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.search-wrap {
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 3px solid var(--blue);
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  background: var(--white);
  box-shadow: var(--shadow);
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(227, 53, 13, 0.15);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  border: 2px solid var(--blue);
  background: var(--white);
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--blue);
  color: var(--white);
}

.filter-btn.active-pokemon {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

/* Game grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  padding-bottom: 3rem;
}

.game-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid transparent;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--yellow);
  box-shadow: 0 20px 50px rgba(59, 76, 202, 0.2);
}

.card-thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #1a1a2e, #3b4cca);
  overflow: hidden;
  position: relative;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.card-badge {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
}

.card-body {
  padding: 1rem 1.1rem 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.card-body h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.25;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: var(--white);
  box-shadow: 0 6px 0 #8b1a1a;
  flex: 1;
}

.btn-primary:hover {
  box-shadow: 0 4px 0 #8b1a1a;
  transform: translateY(2px);
}

.btn-secondary {
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--blue);
}

.btn-secondary:hover { background: rgba(59, 76, 202, 0.08); }

/* Detail page */
.detail-hero {
  padding: 2rem 0 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 800;
  color: var(--blue);
  margin-bottom: 1.25rem;
}

.back-link:hover { color: var(--red); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.detail-gallery {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 3px solid var(--yellow);
}

.main-shot {
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  aspect-ratio: 4/3;
}

.main-shot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.thumb-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.thumb-row button {
  flex: 1;
  border: 3px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: #111;
  aspect-ratio: 4/3;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s;
}

.thumb-row button.active,
.thumb-row button:hover {
  opacity: 1;
  border-color: var(--red);
}

.thumb-row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.detail-info h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  line-height: 1.1;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.meta-tag {
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.detail-info .description {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.features-box {
  background: var(--card);
  border-left: 5px solid var(--red);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.features-box h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--blue);
}

.features-box ul {
  margin: 0;
  padding-left: 1.2rem;
}

.features-box li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
  color: var(--ink);
}

.download-cta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.download-cta .btn-primary {
  font-size: 1.1rem;
  padding: 1rem 1.5rem;
}

.download-note {
  font-size: 0.82rem;
  color: var(--muted);
}

.package-line {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  grid-column: 1 / -1;
}

.loading {
  text-align: center;
  padding: 4rem;
  font-weight: 700;
  color: var(--blue);
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; }
  .detail-grid { grid-template-columns: 1fr; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .card-actions { flex-direction: column; }
}

@media (max-width: 480px) {
  .hero { padding-top: 2rem; }
  .games-grid { grid-template-columns: 1fr; }
}
