/* ═══════════════════════════════════════════════
   GRAPES V1 — The New Beginning
   Dark purple starry theme
═══════════════════════════════════════════════ */

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

:root {
  --bg:           #0a0a1a;
  --bg2:          #0f0f2a;
  --surface:      rgba(20, 15, 45, 0.85);
  --surface2:     rgba(30, 20, 60, 0.9);
  --purple-glow:  #7c5cbf;
  --purple-light: #a78bda;
  --purple-dim:   #4a3878;
  --accent:       #9d6fff;
  --accent-bright:#c4a0ff;
  --text:         #e8e0ff;
  --muted:        #9b93b8;
  --card-border:  rgba(124, 92, 191, 0.35);
  --card-hover:   rgba(157, 111, 255, 0.2);
  --glass:        rgba(15, 10, 40, 0.7);
  --radius:       12px;
  --nav-h:        60px;
}

/* ── Base ── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Starfield canvas ── */
#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Everything above stars ── */
#app { position: relative; z-index: 1; }

/* ── Nav bar ── */
nav.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  background: rgba(8, 5, 25, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(124, 92, 191, 0.3);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
}

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

.nav-logo .moon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px #a78bda);
}

.nav-logo .brand {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-bright);
  letter-spacing: 0.5px;
  text-shadow: 0 0 16px rgba(157,111,255,0.7);
  line-height: 1.1;
}

.nav-logo .brand sub {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--muted);
  display: block;
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 16px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 7px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-links a:hover {
  background: rgba(124, 92, 191, 0.2);
  color: var(--text);
}

.nav-links a.active {
  background: rgba(157, 111, 255, 0.15);
  color: var(--accent-bright);
}

.nav-search {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  position: relative;
}

.nav-search input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(124, 92, 191, 0.4);
  border-radius: 50px;
  color: var(--text);
  font-size: 0.88rem;
  padding: 8px 16px 8px 38px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.nav-search input:focus {
  border-color: var(--purple-glow);
  box-shadow: 0 0 0 3px rgba(124,92,191,0.2);
}

.nav-search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 80px 24px 48px;
  position: relative;
}

.hero-title {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  background: linear-gradient(135deg, #c4a0ff 0%, #a78bda 40%, #7c5cbf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(157,111,255,0.5));
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(157,111,255,0.4)); }
  50%       { filter: drop-shadow(0 0 45px rgba(157,111,255,0.8)); }
}

.hero-subtitle {
  margin-top: 14px;
  font-size: 1.05rem;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 400;
}

/* ── Search bar (hero) ── */
.hero-search {
  margin: 32px auto 0;
  max-width: 520px;
  position: relative;
}

.hero-search input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(124, 92, 191, 0.5);
  border-radius: 50px;
  color: var(--text);
  font-size: 1rem;
  padding: 14px 24px 14px 48px;
  outline: none;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.hero-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(157,111,255,0.18), 0 4px 24px rgba(157,111,255,0.15);
}

.hero-search .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--purple-light);
  font-size: 1.1rem;
  pointer-events: none;
}

/* ── Category pills ── */
.categories {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 24px 24px 0;
}

.pill {
  background: rgba(124, 92, 191, 0.12);
  border: 1px solid rgba(124, 92, 191, 0.3);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  letter-spacing: 0.3px;
}

.pill:hover, .pill.active {
  background: rgba(157, 111, 255, 0.25);
  border-color: var(--accent);
  color: var(--accent-bright);
}

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 32px 28px 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.section-header h2 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.section-header .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(124,92,191,0.4) 0%, transparent 100%);
}

/* ── Game grid ── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
  padding: 0 24px 48px;
  max-width: 1280px;
  margin: 0 auto;
}

.game-card {
  background: var(--glass);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(6px);
}

.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 32px rgba(157,111,255,0.25), 0 0 0 1px rgba(157,111,255,0.15);
}

.game-card .thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg2);
  transition: filter 0.2s;
}

.game-card:hover .thumb { filter: brightness(1.1); }

.game-card .info {
  padding: 8px 10px 10px;
  background: var(--glass);
}

.game-card .info .name {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.game-card .info .tag {
  text-align: center;
  font-size: 0.65rem;
  color: var(--purple-light);
  margin-top: 3px;
  font-weight: 500;
  opacity: 0.8;
}

/* HOT badge */
.game-card .hot-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #ff6b9d, #ff4757);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.game-card { position: relative; }

/* hidden by filter */
.game-card.hidden { display: none; }

/* ── No results ── */
#no-results {
  text-align: center;
  color: var(--muted);
  padding: 48px;
  display: none;
  width: 100%;
  font-size: 1rem;
}

/* ── Footer ── */
footer {
  border-top: 1px solid rgba(124,92,191,0.2);
  text-align: center;
  padding: 28px 24px;
  color: var(--muted);
  font-size: 0.82rem;
  background: rgba(8,5,25,0.6);
  backdrop-filter: blur(8px);
}

footer a {
  color: var(--purple-light);
  text-decoration: none;
}

footer a:hover { color: var(--accent-bright); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--purple-dim);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--purple-glow); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-title { font-size: clamp(2.5rem, 10vw, 4rem); }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; padding: 0 14px 32px; }
  .section-header { padding: 24px 14px 12px; }
  .categories { padding: 20px 14px 0; }
}

@media (max-width: 480px) {
  nav.topbar { padding: 0 14px; }
  .nav-search { max-width: 100%; }
  .hero { padding: 52px 16px 32px; }
  .hero-search { margin-top: 24px; }
  .games-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 10px 24px; }
}
