:root {
  --bg: #8ba3b8;
  --header-bg: #3d4f5f;
  --card-bg: #f0f4f8;
  --card-hover: #ffffff;
  --text: #1a1a1a;
  --muted: #555;
  --accent: #e07a5f;
  --accent-hover: #c96a52;
  --radius: 10px;
  --shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.4;
}

/* Header */
.site-header {
  background: linear-gradient(180deg, #2c3a47 0%, var(--header-bg) 100%);
  color: #fff;
  padding: 1.5rem 1rem 1.25rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
}

.site-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
  font-size: 1.05rem;
  opacity: 0.9;
  margin-top: 0.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

#searchInput {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  width: min(280px, 70vw);
  background: rgba(255,255,255,0.95);
  color: #222;
}

#searchInput:focus {
  outline: 2px solid var(--accent);
}

/* Main */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

#sortSelect {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
}

/* Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

@media (min-width: 600px) {
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (min-width: 900px) {
  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

.game-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 2px solid transparent;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
  background: var(--card-hover);
  border-color: var(--accent);
}

.game-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.cover-wrap {
  position: relative;
  object-fit: contain;
  background: #d0d8e0;
  overflow: hidden;
}

.cover-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.25s ease;
}

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

.card-body {
  padding: 0.65rem 0.7rem 0.8rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.card-title {
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.25;
  color: #1a2a3a;
}

.card-meta {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.card-platforms {
  font-size: 0.7rem;
  color: #4a6a7a;
  margin-top: auto;
  padding-top: 0.25rem;
}

.empty-state {
  text-align: center;
  color: #fff;
  font-size: 1.1rem;
  padding: 3rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #a8c0d0, #7a9bb0);
  color: #fff;
  font-weight: 800;
  font-size: 1.5rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  background: rgba(0,0,0,0.15);
}

footer .disclaimer {
  margin-top: 0.35rem;
  opacity: 0.8;
  font-size: 0.8rem;
}

.load-status {
  text-align: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
