@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

:root {
  --bg: #08060f;
  --bg-surface: #0c0a14;
  --bg-card: #13111d;
  --bg-hover: #1c1828;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-glow: rgba(124, 58, 237, 0.2);
  --pink: #ec4899;
  --text: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #55556a;
  --border: #1e1a2e;
  --glass: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --topbar-h: 60px;
  --transition: 0.25s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #05020e;
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(124,58,237,0.25) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at -10% 40%, rgba(37,99,235,0.18) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 110% 70%, rgba(139,92,246,0.15) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 80% 0%, rgba(6,182,212,0.1) 0%, transparent 45%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(59,130,246,0.12) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════
   TOPBAR
   ═══════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 200;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon-wrap {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.logo-icon-img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

.logo-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #fff;
  letter-spacing: 0;
  line-height: 1.4;
}

.topbar-spacer { display: none; }

/* ═══════════════════════════════════
   SEARCH WITH DROPDOWN
   ═══════════════════════════════════ */
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 560px;
  justify-self: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  padding: 10px 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box.focused {
  border-color: rgba(124,58,237,0.4);
  box-shadow: 0 0 24px rgba(124,58,237,0.12), 0 0 0 1px rgba(124,58,237,0.1);
  background: rgba(255,255,255,0.08);
  border-radius: 16px 16px 0 0;
}

.search-icon { color: var(--text-muted); flex-shrink: 0; transition: color 0.2s; }
.search-box.focused .search-icon { color: var(--accent); }

.search-box input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 14px;
  width: 100%; font-family: inherit;
}

.search-box input::placeholder { color: var(--text-muted); }

.search-clear {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 0 2px;
  line-height: 1; transition: color 0.2s;
}
.search-clear:hover { color: #fff; }

/* ─── DROPDOWN ─── */
.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: rgba(12,10,20,0.97);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(124,58,237,0.15);
  border-top: none;
  border-radius: 0 0 16px 16px;
  padding: 10px 6px 14px;
  max-height: 340px;
  overflow-y: auto;
  z-index: 300;
  scrollbar-width: thin;
  scrollbar-color: #222 transparent;
}

.search-dropdown.open { display: block; }

.dropdown-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 8px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.cat-chip:hover {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.25);
  color: #fff;
  transform: translateY(-1px);
}

.cat-chip.active {
  background: rgba(124,58,237,0.2);
  border-color: var(--accent);
  color: #fff;
}


/* ═══════════════════════════════════
   CONTENT
   ═══════════════════════════════════ */
.content {
  position: relative;
  z-index: 1;
  margin-top: var(--topbar-h);
  padding: 20px;
  min-height: calc(100vh - var(--topbar-h));
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

.feed { width: 100%; }

/* ═══════════════════════════════════
   GAMES GRID
   ═══════════════════════════════════ */
.games-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.game-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  aspect-ratio: 16/9;
  background: var(--bg-card);
}

.game-card img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform 0.4s ease;
}

.game-card:hover img { transform: scale(1.08); }

.game-card-overlay {
  position: absolute; inset: 0; z-index: 4;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 50%);
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.game-card:hover .game-card-overlay { opacity: 1; }

.game-card-name {
  font-size: 13px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transform: translateY(6px);
  transition: transform 0.3s ease;
}

.game-card:hover .game-card-name { transform: translateY(0); }

.game-card-stats {
  display: flex; gap: 10px; margin-top: 4px;
  transform: translateY(6px);
  transition: transform 0.3s ease 0.03s;
}

.game-card:hover .game-card-stats { transform: translateY(0); }

.game-card-stat {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: rgba(255,255,255,0.6);
}

.game-card-stat svg { width: 12px; height: 12px; }
.game-card-stat.likes svg { color: var(--pink); }

/* ─── VIDEO PREVIEW ─── */
.game-card-video {
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none; opacity: 0;
  transition: opacity 0.3s ease;
  background: #000; border-radius: 12px; overflow: hidden;
}

.game-card-video.active { opacity: 1; pointer-events: auto; }

.game-card-video iframe {
  width: 100% !important; height: 100% !important;
}

.game-card-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

/* ═══════════════════════════════════
   PAGINATION
   ═══════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 32px 0 16px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  font-family: inherit;
  padding: 0 6px;
}

.page-btn:hover {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.3);
  color: #fff;
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px rgba(124,58,237,0.3);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-btn:disabled:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.page-btn svg {
  width: 18px; height: 18px;
}

.page-dots {
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 4px;
  user-select: none;
}

/* ═══════════════════════════════════
   STATES
   ═══════════════════════════════════ */
.loading-state,
.empty-state {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════════════════════════
   FOOTER
   ═══════════════════════════════════ */
/* ═══════════════════════════════════
   FOOTER - GAMING
   ═══════════════════════════════════ */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 60px;
  overflow: hidden;
}

.footer-glow {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #7c3aed, #3b82f6, #06b6d4, #7c3aed, transparent);
  background-size: 200% 100%;
  animation: footer-line-glow 4s linear infinite;
}

@keyframes footer-line-glow {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.footer-bg {
  background: linear-gradient(180deg, rgba(10,6,20,0.95) 0%, rgba(5,2,14,1) 100%);
  padding: 48px 20px 0;
  position: relative;
}

.footer-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(124,58,237,0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 50% at 80% 100%, rgba(59,130,246,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.footer-inner { max-width: 1200px; margin: 0 auto; position: relative; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px; margin-bottom: 40px;
}

.footer-brand .footer-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; margin-bottom: 14px;
}

.footer-brand .footer-logo-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}

.footer-brand .footer-logo-icon img {
  width: 100%; height: 100%; object-fit: contain;
}

.footer-brand .footer-logo-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #fff;
  line-height: 1.4;
}

.footer-brand p {
  font-size: 13px; color: var(--text-muted); line-height: 1.7; max-width: 300px; margin-top: 4px;
}

.footer-col h4 {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 16px;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-col a {
  display: block; text-decoration: none; color: var(--text-muted);
  font-size: 13px; padding: 5px 0; transition: 0.2s;
}
.footer-col a:hover { color: #fff; padding-left: 4px; }

.footer-bottom {
  border-top: 1px solid rgba(124,58,237,0.1);
  padding: 20px 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}

.footer-copy { font-size: 12px; color: var(--text-muted); }

.footer-legal { display: flex; gap: 20px; }
.footer-legal a { font-size: 12px; color: var(--text-muted); text-decoration: none; transition: 0.2s; }
.footer-legal a:hover { color: #a78bfa; }

/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */
@media (max-width: 768px) {
  .topbar {
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 0 12px;
  }

  .search-wrapper { max-width: none; justify-self: stretch; }

  .games-masonry {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}

@media (max-width: 500px) {
  .logo-name { display: none; }

  .logo-icon-wrap { width: 32px; height: 32px; border-radius: 8px; padding: 4px; }

  .search-box { padding: 8px 14px; border-radius: 24px; }
  .search-box.focused { border-radius: 14px 14px 0 0; }

  .games-masonry {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .game-card { border-radius: 8px; }
  .game-card-overlay { padding: 10px; opacity: 1; }
  .game-card-name { font-size: 11px; transform: none; }
  .game-card-stats { transform: none; }

  .content { padding: 12px 8px; }

  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-legal { flex-wrap: wrap; justify-content: center; }

  .page-btn { min-width: 36px; height: 36px; font-size: 13px; border-radius: 8px; }

  .search-dropdown { border-radius: 0 0 14px 14px; }
  .cat-chip { font-size: 12px; padding: 6px 12px; }
}
