:root {
  --games-bg: #090909;
  --games-surface: rgba(255, 255, 255, 0.04);
  --games-card: rgba(255, 255, 255, 0.06);
  --games-accent: #ffffff;
  --games-accent-2: #a3a3a3;
  --games-text: #d4d4d4;
  --games-muted: #888888;
  --games-border: rgba(255, 255, 255, 0.12);
  --games-glow: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  color: var(--games-text);
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(255, 255, 255, 0.06), transparent 55%),
    linear-gradient(180deg, #101010 0%, var(--games-bg) 42%, #050505 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 18%, transparent 78%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(9, 9, 9, 0.78);
  border-bottom: 1px solid var(--games-border);
}

.topbar__home {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--games-border);
  background: var(--games-surface);
  color: var(--games-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.topbar__home:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--games-accent);
  flex-shrink: 0;
}

.search {
  flex: 1;
  max-width: 560px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--games-border);
  background: var(--games-surface);
  color: var(--games-text);
  font-size: 14px;
}

.search::placeholder {
  color: var(--games-muted);
}

.search:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.count {
  color: var(--games-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--games-border);
  flex-shrink: 0;
}

.categories {
  display: flex;
  gap: 8px;
  padding: 12px 18px 6px;
  flex-wrap: wrap;
  position: sticky;
  top: 64px;
  z-index: 15;
  background: linear-gradient(180deg, rgba(9, 9, 9, 0.92), transparent);
}

.cat {
  padding: 8px 14px;
  background: var(--games-surface);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--games-muted);
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.cat:hover {
  color: var(--games-text);
  border-color: var(--games-border);
  transform: translateY(-1px);
}

.cat.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  padding: 12px 18px 40px;
  grid-auto-flow: dense;
}

.game-card {
  background: var(--games-card);
  border: 1px solid var(--games-border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  color: var(--games-text);
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

.game-card img {
  width: 100%;
  height: 124px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.35);
}

.game-card h3 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  padding: 10px 10px 4px;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.play-btn {
  margin: 8px 10px 10px;
  padding: 9px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.play-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.big {
  grid-column: span 2;
  grid-row: span 2;
}

.big img {
  height: 72%;
  min-height: 200px;
}

.big h3 {
  font-size: 16px;
  padding: 12px 12px 6px;
}

.big .play-btn {
  margin: 10px 12px 12px;
  padding: 11px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
  }

  .search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 10px 12px 32px;
  }

  .big {
    grid-column: span 1;
    grid-row: span 1;
  }

  .big img {
    height: 124px;
    min-height: 0;
  }
}
