/* ─── Fonts & Reset ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;600;700;800;900&display=swap');

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

:root {
  --bg:          #080812;
  --bg-card:     #0f0f1e;
  --bg-card-alt: #12121f;
  --border:      #1c1c30;
  --text:        #ddddf0;
  --muted:       #5a5a7a;
  --pink:        #ff3d9a;
  --purple:      #7b2fff;
  --cyan:        #00d9ff;
  --green:       #39ff14;
  --yellow:      #ffd600;
  --orange:      #ff7300;
  --radius:      14px;
  --radius-lg:   20px;
}

/* ─── Base ───────────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Background texture & glows ─────────────────────────────────────────────── */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.bg-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
}

.bg-glow--1 {
  width: 600px; height: 600px;
  background: var(--purple);
  top: -200px; left: -200px;
  animation: float-a 18s ease-in-out infinite alternate;
}

.bg-glow--2 {
  width: 500px; height: 500px;
  background: var(--pink);
  bottom: -150px; right: -100px;
  animation: float-b 14s ease-in-out infinite alternate;
}

.bg-glow--3 {
  width: 400px; height: 400px;
  background: var(--cyan);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: float-c 20s ease-in-out infinite alternate;
}

@keyframes float-a { to { transform: translate(80px, 60px); } }
@keyframes float-b { to { transform: translate(-60px, -40px); } }
@keyframes float-c { to { transform: translate(-40%, -60%); } }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  text-align: center;
  padding: 72px 24px 48px;
  position: relative;
  z-index: 1;
}

.site-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
  margin-bottom: 20px;
}

.title-line-1,
.title-line-2 {
  font-family: 'Press Start 2P', monospace;
  display: block;
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--cyan), var(--green), var(--yellow));
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 6s ease infinite;
}

.title-line-1 {
  font-size: clamp(1.6rem, 6vw, 4rem);
  letter-spacing: -1px;
}

.title-line-2 {
  font-size: clamp(1.1rem, 4vw, 2.6rem);
  letter-spacing: 6px;
  opacity: 0.9;
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.site-subtitle {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ─── Games Grid ─────────────────────────────────────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
  padding-bottom: 80px;
}

/* ─── Game Card ──────────────────────────────────────────────────────────────── */
.game-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 22px;
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(.25,.8,.25,1),
              box-shadow 0.22s cubic-bezier(.25,.8,.25,1),
              border-color 0.22s ease;
  cursor: pointer;
}

/* Gradient tint from card color */
.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 10% 10%, var(--card-color, var(--purple)) 0%, transparent 65%);
  opacity: 0.06;
  transition: opacity 0.22s ease;
  pointer-events: none;
}

/* Glowing top border */
.game-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-color, var(--purple)), transparent);
  opacity: 0.5;
  transition: opacity 0.22s ease;
}

.game-card:hover {
  transform: translateY(-9px) rotate(-0.5deg);
  box-shadow:
    0 24px 48px rgba(0,0,0,0.45),
    0 0 0 1px var(--card-color, var(--purple)),
    0 0 40px color-mix(in srgb, var(--card-color, var(--purple)) 35%, transparent);
  border-color: var(--card-color, var(--purple));
}

.game-card:hover::before { opacity: 0.13; }
.game-card:hover::after  { opacity: 1; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card-emoji {
  font-size: 2.8rem;
  line-height: 1;
  display: block;
  transition: transform 0.22s ease;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--card-color, var(--purple)) 60%, transparent));
}

.game-card:hover .card-emoji {
  transform: scale(1.15) rotate(5deg);
}

.card-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--text);
  padding-top: 4px;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.tag {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.card-footer {
  margin-top: 8px;
}

.play-btn {
  display: inline-block;
  padding: 9px 20px;
  background: linear-gradient(135deg,
    var(--card-color, var(--purple)),
    color-mix(in srgb, var(--card-color, var(--purple)) 60%, var(--pink))
  );
  border-radius: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.58rem;
  color: #fff;
  letter-spacing: 1px;
  transition: filter 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--card-color, var(--purple)) 40%, transparent);
}

.game-card:hover .play-btn {
  filter: brightness(1.25);
  transform: scale(1.04);
}

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-emoji { font-size: 4rem; }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  position: relative;
  z-index: 1;
}

.site-footer .container {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.admin-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: color 0.15s;
}

.admin-link:hover { color: var(--text); }

.footer-sep { color: var(--border); }

.footer-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ─── Shared Buttons ─────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  padding: 11px 24px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border: none;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.18s ease, transform 0.18s ease;
  box-shadow: 0 4px 20px rgba(123,47,255,0.35);
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

.btn-full { width: 100%; text-align: center; }

.btn-ghost {
  display: inline-block;
  padding: 9px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ─── Flash messages ─────────────────────────────────────────────────────────── */
.flash {
  padding: 12px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.flash--success {
  background: rgba(57,255,20,0.1);
  border: 1px solid rgba(57,255,20,0.3);
  color: var(--green);
}

.flash--error {
  background: rgba(255,61,154,0.1);
  border: 1px solid rgba(255,61,154,0.3);
  color: var(--pink);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header { padding: 48px 16px 32px; }
  .games-grid  { grid-template-columns: 1fr; gap: 16px; }
  .game-card   { padding: 22px 18px 18px; }
}
