:root {
  --bg: #0a0713;
  --bg-2: #120a22;
  --panel: rgba(22, 14, 40, 0.72);
  --panel-solid: #160e28;
  --ink: #f4ecff;
  --muted: #a89bcf;
  --neon-pink: #ff2e88;
  --neon-cyan: #22e0ff;
  --neon-purple: #a855f7;
  --neon-yellow: #ffd23f;
  --line: rgba(168, 155, 207, 0.18);
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Rajdhani", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(168, 85, 247, 0.25), transparent 60%),
    radial-gradient(1000px 500px at 90% 0%, rgba(34, 224, 255, 0.18), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---- Ambient FX ---- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(168, 85, 247, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 224, 255, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, transparent, #000 20%, #000 65%, transparent);
  animation: gridDrift 24s linear infinite;
}
@keyframes gridDrift { to { background-position: 0 440px, 440px 0; } }

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.16) 2px 4px);
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(10, 7, 19, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark { filter: drop-shadow(0 0 8px rgba(255, 46, 136, 0.6)); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; gap: 4px; line-height: 1; font-family: "Press Start 2P", monospace; }
.brand-top { font-size: 13px; color: var(--neon-cyan); text-shadow: 0 0 10px rgba(34, 224, 255, 0.6); }
.brand-bottom { font-size: 13px; color: var(--neon-pink); text-shadow: 0 0 10px rgba(255, 46, 136, 0.6); }

.header-tools { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within { border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(34, 224, 255, 0.15); }
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  width: clamp(120px, 30vw, 240px);
}
.search input::placeholder { color: var(--muted); }

/* ---- Layout ---- */
.wrap { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 60px; }

/* ---- Hero ---- */
.hero { text-align: center; padding: clamp(40px, 8vw, 90px) 0 28px; }
.hero-kicker { font-family: "Press Start 2P", monospace; font-size: 11px; letter-spacing: 2px; color: var(--neon-yellow); text-shadow: 0 0 10px rgba(255, 210, 63, 0.5); margin: 0 0 22px; }
.hero-title {
  position: relative;
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(28px, 8vw, 76px);
  line-height: 1.1;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink), var(--neon-purple), var(--neon-cyan));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hueShift 8s linear infinite;
  filter: drop-shadow(0 0 18px rgba(255, 46, 136, 0.35));
}
.hero-title::before {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  color: transparent;
  -webkit-text-stroke: 1px rgba(34, 224, 255, 0.25);
  z-index: -1;
}
@keyframes hueShift { to { background-position: 300% 0; } }
.hero-sub { max-width: 560px; margin: 20px auto 0; color: var(--muted); font-size: clamp(15px, 2.4vw, 19px); }
.hero-stats { margin-top: 20px; color: var(--muted); font-size: 15px; display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.hero-stats strong { color: var(--neon-cyan); }
.hero-stats .dot { color: var(--neon-purple); }

/* ---- Filters ---- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 8px 0 34px; }
.chip {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.15s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.chip:hover { transform: translateY(-2px); color: var(--ink); }
.chip[aria-pressed="true"] {
  color: #0a0713;
  border-color: transparent;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: 0 6px 22px rgba(255, 46, 136, 0.35);
}

/* ---- Grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(16px, 2.4vw, 26px);
}

.tile {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateY(0);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s, border-color 0.25s;
  opacity: 0;
  animation: tileIn 0.5s ease forwards;
}
@keyframes tileIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.tile:hover, .tile:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(34, 224, 255, 0.6);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55), 0 0 26px rgba(34, 224, 255, 0.28);
  outline: none;
}

.tile-art { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0d0820; }
.tile-art img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.tile:hover .tile-art img { transform: scale(1.06); }
.tile-art::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(10, 7, 19, 0.85) 100%);
}

.tile-badge {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 2;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  padding: 6px 9px;
  border-radius: 8px;
  color: #0a0713;
  background: var(--neon-yellow);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}
.tile-badge.soon { background: var(--neon-purple); color: #fff; }
.tile-platforms {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--neon-cyan);
  background: rgba(10, 7, 19, 0.8);
  border: 1px solid rgba(34, 224, 255, 0.45);
}

.tile-play {
  position: absolute;
  top: 50%; left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%) scale(0.8);
  width: 62px; height: 62px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 46, 136, 0.92);
  box-shadow: 0 0 24px rgba(255, 46, 136, 0.6);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}
.tile:hover .tile-play, .tile:focus-visible .tile-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.tile-play svg { fill: #fff; margin-left: 3px; }

.tile-body { position: relative; z-index: 2; padding: 16px 16px 18px; margin-top: -34px; }
.tile-title { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: 0.3px; }
.tile-desc { margin: 6px 0 0; color: var(--muted); font-size: 15px; min-height: 2.6em; }
.tile-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 600; color: var(--neon-cyan); border: 1px solid rgba(34, 224, 255, 0.3); padding: 3px 9px; border-radius: 999px; }

.tile.is-soon { pointer-events: none; }
.tile.is-soon .tile-art img { filter: grayscale(0.5) brightness(0.7); }

.empty { text-align: center; color: var(--muted); font-size: 18px; padding: 40px 0; }

/* ---- Footer ---- */
.site-footer { position: relative; z-index: 1; text-align: center; padding: 30px 20px 50px; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer p { margin: 4px 0; }
.footer-hint { font-size: 14px; opacity: 0.8; }
code { background: rgba(168, 85, 247, 0.18); padding: 2px 6px; border-radius: 6px; color: var(--neon-cyan); font-size: 0.92em; }

/* ---- Account button ---- */
.account { display: flex; align-items: center; }
.btn-signin {
  cursor: pointer;
  font: inherit; font-weight: 700; font-size: 15px;
  color: #0a0713;
  border: 0; border-radius: 999px; padding: 9px 18px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  box-shadow: 0 6px 20px rgba(255, 46, 136, 0.3);
  transition: filter 0.15s, transform 0.15s;
}
.btn-signin:hover { filter: brightness(1.08); transform: translateY(-1px); }
.account-user { display: flex; align-items: center; gap: 10px; }
.account-name { font-weight: 700; color: var(--neon-cyan); font-size: 15px; }
.account-name::before { content: "@"; opacity: 0.6; }
.btn-signout {
  cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  transition: color 0.2s, border-color 0.2s;
}
.btn-signout:hover { color: var(--ink); border-color: var(--neon-pink); }

/* ---- Auth modal ---- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 2, 12, 0.72); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 40px rgba(168, 85, 247, 0.2);
  animation: modalIn 0.22s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--ink); }
.modal-title { margin: 0 0 16px; font-size: 22px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; background: rgba(168,85,247,0.1); padding: 4px; border-radius: 12px; }
.tab { flex: 1; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); background: transparent; border: 0; padding: 9px; border-radius: 9px; transition: color 0.2s, background 0.2s; }
.tab[aria-pressed="true"] { color: #0a0713; background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink)); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #0d0820; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { outline: 0; border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(34,224,255,0.15); }
.auth-error { min-height: 1.2em; margin: 2px 0 10px; color: #ff6a9c; font-size: 14px; font-weight: 600; }
.btn-primary {
  width: 100%; cursor: pointer; font: inherit; font-weight: 700; font-size: 16px; color: #0a0713;
  border: 0; border-radius: 12px; padding: 13px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-green, #37ff8b));
  box-shadow: 0 8px 24px rgba(34,224,255,0.3);
  transition: filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.auth-hint { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 560px) {
  .search input { width: 90px; }
  .btn-signin { padding: 8px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .tile { opacity: 1; }
}

/* ---- Login page ---- */
.gate-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 22px; padding: 24px 16px; }
.gate-brand { pointer-events: none; }
.gate-card { animation: none; }

/* ---- Admin: invites ---- */
a.btn-signout { text-decoration: none; display: inline-block; }
.admin-wrap { max-width: 760px; padding-top: 32px; }
.admin-back { color: var(--neon-cyan); text-decoration: none; font-weight: 600; }
.admin-sub { color: var(--muted); margin: -6px 0 20px; }
.admin-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.admin-form .field { margin: 0; }
.admin-form .btn-primary { width: auto; padding: 12px 18px; }
.admin-new { margin: 6px 0 22px; color: var(--muted); font-size: 14px; }
.admin-copy { display: flex; gap: 8px; margin-top: 6px; }
.admin-copy input { flex: 1; font: inherit; color: var(--ink); background: #0d0820; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: 13px; font-weight: 600; }
.admin-table td .btn-signout { margin-right: 6px; }
.admin-section { margin: 34px 0; }
.admin-section h2 { font-family: "Press Start 2P", monospace; font-size: 14px; color: var(--neon-cyan); margin: 0 0 14px; }
.admin-cost { display: flex; gap: 14px; flex-wrap: wrap; }
.admin-stat { flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #0d0820; }
.admin-stat span { display: block; color: var(--muted); font-size: 13px; }
.admin-stat strong { display: block; font-size: 26px; margin-top: 4px; }
.admin-filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.admin-filters .field { margin: 0; }
.admin-filters select { font: inherit; color: var(--ink); background: #0d0820; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.admin-tag { font-size: 12px; color: var(--neon-cyan); margin-left: 6px; }
.admin-ua { color: var(--muted); font-size: 13px; }
.admin-bad { color: #ff6b8a; }
@media (max-width: 560px) { .admin-form { grid-template-columns: 1fr; } }
