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

html, body {
  width: 100%;
  min-height: 100vh;
  background: #0e0e10;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Top Nav ─── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(14, 14, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #1e1e22;
}

.nav-brand {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  white-space: nowrap;
  cursor: pointer;
}
.nav-brand span { color: #4c9eff; }

.nav-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.nav-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: #1a1a1e;
  border: 1px solid #2a2a30;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.nav-search input:focus { border-color: #4c9eff; }
.nav-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #666;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #999;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover { color: #fff; background: #1e1e24; }

.nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-login {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #4c9eff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-login:hover { background: #3b8dee; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.user-menu:hover { background: #1e1e24; }
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.user-name { font-size: 13px; font-weight: 500; color: #ccc; }
.user-menu-wrap { position: relative; }
.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #1e1e24;
  border: 1px solid #333;
  border-radius: 8px;
  min-width: 140px;
  padding: 4px 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.user-menu-wrap.open .user-dropdown { display: block; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  color: #ccc;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.dropdown-item:hover { background: #2a2a32; color: #fff; }

/* ─── Hero ─── */
.hero {
  padding: 48px 24px 36px;
  text-align: center;
  background: linear-gradient(180deg, #12121a 0%, #0e0e10 100%);
}
.hero h1 {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.hero p {
  font-size: 16px;
  color: #888;
  max-width: 480px;
  margin: 0 auto;
}

/* ─── Toolbar ─── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 24px;
  margin-bottom: 24px;
}
.sort-tabs {
  display: flex;
  gap: 4px;
  background: #1a1a1e;
  border-radius: 8px;
  padding: 3px;
}
.sort-tab {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.sort-tab:hover { color: #ccc; }
.sort-tab.active { color: #fff; background: #2a2a32; }

.result-count {
  font-size: 13px;
  color: #666;
}

/* ─── Game Grid ─── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 0 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.game-card {
  background: #16161a;
  border: 1px solid #1e1e24;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  cursor: pointer;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: #2a2a36;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.card-cover {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1e1e28 0%, #14141a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.game-card:hover .card-cover img {
  transform: scale(1.03);
}
.card-cover .placeholder-icon {
  color: #2a2a36;
}
.card-cover .placeholder-icon svg {
  width: 52px;
  height: 52px;
}

.card-body {
  padding: 14px 16px 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.card-creator {
  font-size: 12px;
  color: #666;
}
.card-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #555;
}
.card-stats span {
  display: flex;
  align-items: center;
  gap: 3px;
}
.card-stats svg {
  width: 12px;
  height: 12px;
}

/* ─── Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 24px 48px;
}
.page-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  background: #1a1a1e;
  border: 1px solid #2a2a30;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.page-btn:hover { color: #fff; background: #2a2a32; }
.page-btn.active { color: #fff; background: #4c9eff; border-color: #4c9eff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: #555;
  font-size: 15px;
  grid-column: 1 / -1;
}

/* ─── Loading skeleton ─── */
.skeleton-card {
  background: #16161a;
  border: 1px solid #1e1e24;
  border-radius: 10px;
  overflow: hidden;
}
.skeleton-cover {
  width: 100%;
  aspect-ratio: 16/10;
  background: linear-gradient(90deg, #1a1a1e 25%, #222228 50%, #1a1a1e 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-body { padding: 12px 14px; }
.skeleton-line {
  height: 12px;
  background: #1e1e24;
  border-radius: 4px;
  margin-bottom: 8px;
}
.skeleton-line.short { width: 60%; }

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

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .top-nav { padding: 10px 16px; }
  .hero { padding: 32px 16px 24px; }
  .hero h1 { font-size: 24px; }
  .game-grid { padding: 0 16px 32px; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .toolbar { padding: 0 16px; }
  .nav-search { display: none; }
}
