/* Básico e limpo, sem frameworks */
:root {
  --bg: #0c0d10;
  --panel: #14161b;
  --text: #e7e9ee;
  --muted: #a9aebb;
  --accent: #6ea8fe;
  --border: #242833;
  --glow1: #2a6cf7;
  --glow2: #8a5cf6;
  --glow3: #ff6ec7;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(180deg, var(--bg), #0f1116 30%);
  color: var(--text);
}

.site-header {
  padding: 44px 16px 16px;
  text-align: center;
  background:
    radial-gradient(1200px 300px at 50% -40px, rgba(80,120,255,0.12), transparent),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 60%);
}
.site-header h1 {
  margin: 0 0 6px;
  font-size: 32px;
  background: linear-gradient(90deg, var(--text), #cfe0ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.site-header .subtitle { margin: 0; color: var(--muted); }
.back-link { text-align: center; margin-top: 6px; }
.back-link a { color: var(--accent); text-decoration: none; }
.back-link a:hover { text-decoration: underline; }

.container { max-width: 1000px; margin: 0 auto; padding: 16px; }

.status { color: var(--muted); margin: 16px 0; }

/* Controles (busca e resumo) */
.controls { display: grid; gap: 12px; margin: 6px 0 14px; }
.summary { color: var(--muted); }
.search-bar { display: flex; justify-content: center; }
.search-bar input[type="search"] {
  width: min(720px, 100%);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f1218;
  color: var(--text);
  outline: none;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  transition: border-color .12s ease, box-shadow .12s ease, background .2s ease;
}
.search-bar input[type="search"]::placeholder { color: #868e9c; }
.search-bar input[type="search"]:focus {
  border-color: #2b3350;
  box-shadow: 0 0 0 3px rgba(110,168,254,0.15);
  background: #101521;
}

.list-grid {
  list-style: none;
  padding: 0; margin: 16px 0;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Agrupamento por categorias */
.groups { display: grid; gap: 22px; }
.group { padding-top: 2px; }
.group-title {
  margin: 8px 2px 6px;
  font-size: 18px; font-weight: 700;
  color: #e9ecf5;
}
.group-title small { color: var(--muted); font-weight: 500; margin-left: 6px; }

.list-item {
  position: relative;
  background: linear-gradient(var(--panel), var(--panel)) padding-box,
              linear-gradient(135deg, var(--glow1), var(--glow2), var(--glow3)) border-box;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px;
  min-height: 96px;
  transition: transform .08s ease-out, box-shadow .12s ease-out, opacity .15s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,0.25), 0 6px 20px rgba(0,0,0,0.15);
}
.list-item a {
  display: block; color: var(--text); text-decoration: none;
  font-weight: 700; letter-spacing: .2px;
  font-size: 15px;
}
.list-item small { display: block; color: var(--muted); margin-top: 6px; font-size: 12px; }
.list-item:hover { transform: translateY(-1.5px); box-shadow: 0 10px 28px rgba(0,0,0,0.22); }

.list-item .emoji { margin-right: 8px; filter: saturate(1.1); }

/* Skeleton placeholders to stabilize layout before data loads */
.skeleton-group { opacity: 0.7; }
.skeleton-bar {
  display: inline-block;
  width: 180px;
  height: 18px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(80,90,120,0.4), rgba(120,140,170,0.6), rgba(80,90,120,0.4));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  min-height: 96px;
  background: linear-gradient(90deg, rgba(40,44,60,0.4), rgba(60,70,90,0.6), rgba(40,44,60,0.4));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  box-shadow: none;
}
.skeleton-card::after {
  content: '';
  position: absolute;
  left: 18px;
  top: 22px;
  width: 60%;
  height: 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
}
.skeleton-card::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 46px;
  width: 40%;
  height: 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
}

.groups.loaded .skeleton-group { display: none; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.table-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); }
.data-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.data-table thead th { position: sticky; top: 0; background: #171a20; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table tbody tr:hover { background: #151821; }

.site-footer { text-align: center; padding: 24px 16px 40px; color: var(--muted); }
.site-footer code { color: var(--muted); }

/* Game cards (list view) */
#game-grid {
  /* Narrower columns to better fit cover width */
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.list-item.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: unset; /* override generic min-height */
  padding: 12px 10px 14px;
  transition: transform .08s ease-out, box-shadow .12s ease-out;
}
.list-item.game-card:hover {
  transform: translateY(-2px);
}
.list-item.game-card:focus,
.list-item.game-card:focus-within {
  outline: 2px solid rgba(110,168,254,.5);
  outline-offset: 2px;
}

.cover-wrap {
  width: 166px;
  height: 224px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: #101521;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.game-card-cover {
  width: 166px;
  height: 224px;
  object-fit: cover;
  display: block;
}

.game-card-cover.placeholder {
  background: #141924;
  border: 1px dashed var(--border);
}

.badge-pos {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, var(--glow1), var(--glow2));
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.game-card-title {
  font-weight: 700;
  margin-top: 10px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em; /* keep similar heights across cards */
}

.game-card-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

@media (max-width: 480px) {
  #game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .cover-wrap, .game-card-cover, .game-card-cover.placeholder { width: 150px; height: 202px; }
}

@media (prefers-reduced-motion: reduce) {
  .list-item.game-card { transition: none; }
}
