/* =============================================================
   arcade.css — Arcade Hub page (Layer 2 / Task 4)
   15-game grid, neon cards, CRT scanlines, leaderboard sidebar.
   ============================================================= */

/* ── Page shell ──────────────────────────────────────────────── */
.arcade {
  padding: var(--space-2xl) var(--space-lg);
  position: relative;
  min-height: 100vh;
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ── Ambient CRT scanlines ───────────────────────────────────── */
.ambient-bg--crt { background: transparent; }
.ambient-bg--crt::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      oklch(0.95 0.18 145 / 0.04) 0 1px,
      transparent 1px 3px
    ),
    radial-gradient(ellipse at center, oklch(0.4 0.10 145 / 0.05), transparent 70%);
  pointer-events: none;
  mix-blend-mode: screen;
}
.ambient-bg--crt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, oklch(0 0 0 / 0.25) 100%);
  pointer-events: none;
}

/* ── Title + flicker ─────────────────────────────────────────── */
@keyframes arcade-flicker {
  0%, 7%, 9%, 100% { opacity: 1; }
  8%               { opacity: 0.55; }
  8.5%             { opacity: 0.85; }
}
.arcade-title {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  letter-spacing: 0.05em;
  text-align: center;
  margin: 0 0 var(--space-sm);
  text-shadow: 0 0 24px oklch(0.65 0.22 340 / 0.35);
  animation: shimmer-bg 4s linear infinite, arcade-flicker 6s steps(1, end) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .arcade-title { animation: none; }
}
.arcade-subtitle {
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-md);
  margin: 0 0 var(--space-xl);
}

/* ── Filter pills ────────────────────────────────────────────── */
.arcade-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: var(--space-lg);
}
.arcade-filter {
  padding: 8px 16px;
  border-radius: 20px;
  background: oklch(0.18 0.02 280);
  color: white;
  border: 1px solid oklch(1 0 0 / 0.15);
  cursor: pointer;
  font: 600 var(--text-sm) var(--font-sans);
  letter-spacing: 0.02em;
  transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.arcade-filter:hover {
  background: oklch(0.24 0.03 280);
  border-color: oklch(1 0 0 / 0.3);
}
.arcade-filter.active {
  background: oklch(0.28 0.10 290);
  border-color: oklch(0.7 0.2 290);
  box-shadow:
    0 0 0 1px oklch(0.7 0.2 290),
    0 0 16px oklch(0.7 0.2 290 / 0.45);
}
.arcade-filter:focus-visible {
  outline: 2px solid oklch(0.7 0.2 290);
  outline-offset: 3px;
}

/* ── Layout: grid + leaderboard ──────────────────────────────── */
.arcade-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  position: relative;
  z-index: 1;
}
@media (max-width: 800px) {
  .arcade-layout { grid-template-columns: 1fr; }
  .arcade-leaderboard { position: static !important; }
}

/* ── Game grid ───────────────────────────────────────────────── */
.arcade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  align-content: start;
}

/* ── Game cards ──────────────────────────────────────────────── */
.arcade-card {
  --neon-color: oklch(0.7 0.18 290);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: oklch(0.10 0.02 280);
  color: white;
  border: 1px solid oklch(1 0 0 / 0.10);
  border-radius: 12px;
  text-decoration: none;
  position: relative;
  min-height: 130px;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out), border-color 220ms var(--ease-out);
  isolation: isolate;
  overflow: hidden;
}
.arcade-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--neon-color) 0%, transparent 60%);
  opacity: 0.06;
  z-index: -1;
  transition: opacity 220ms var(--ease-out);
}
.arcade-card:hover {
  transform: scale(1.03);
  border-color: var(--neon-color);
  box-shadow:
    0 0 24px var(--neon-color),
    inset 0 0 12px var(--neon-color);
}
.arcade-card:hover::before { opacity: 0.18; }
.arcade-card:focus-visible {
  outline: 2px solid var(--neon-color);
  outline-offset: 3px;
}
.arcade-card--retro  { --neon-color: oklch(0.65 0.22 340); }
.arcade-card--puzzle { --neon-color: oklch(0.70 0.18 280); }
.arcade-card--wild   { --neon-color: oklch(0.70 0.20 80);  }

.arcade-card__title {
  font-size: var(--text-md);
  font-weight: 700;
  color: white;
  letter-spacing: 0.01em;
}
.arcade-card__cat {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--neon-color);
}
.arcade-card__score {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: oklch(0.85 0.02 280);
  margin-top: auto;
}
.arcade-card__cta {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--neon-color);
  opacity: 0.85;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.arcade-card:hover .arcade-card__cta {
  opacity: 1;
  transform: translateX(3px);
}

/* ── Leaderboard ─────────────────────────────────────────────── */
.arcade-leaderboard {
  position: sticky;
  top: 100px;
  align-self: start;
  background: oklch(0.10 0.02 280);
  border: 1px solid oklch(1 0 0 / 0.08);
  border-radius: 12px;
  padding: 18px 20px;
  height: fit-content;
}
.arcade-leaderboard h2 {
  margin: 0 0 12px;
  font-size: var(--text-lg);
  font-weight: 700;
  color: white;
  letter-spacing: 0.02em;
  border-bottom: 1px solid oklch(1 0 0 / 0.12);
  padding-bottom: 8px;
}
.arcade-leaderboard ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.arcade-leaderboard li {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: oklch(0.82 0.02 280);
  padding: 4px 0;
}
.arcade-leaderboard li strong {
  color: oklch(0.85 0.18 80);
  font-weight: 700;
}
.arcade-leaderboard li.empty {
  color: var(--color-muted);
  font-style: italic;
  justify-content: center;
}
#reset-scores {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  color: oklch(0.7 0.20 25);
  border: 1px solid oklch(0.55 0.18 25 / 0.5);
  border-radius: 8px;
  cursor: pointer;
  font: 600 var(--text-sm) var(--font-sans);
  transition: background 180ms var(--ease-out), color 180ms var(--ease-out);
}
#reset-scores:hover {
  background: oklch(0.40 0.18 25 / 0.2);
  color: oklch(0.85 0.18 25);
}
#reset-scores:focus-visible {
  outline: 2px solid oklch(0.7 0.18 25);
  outline-offset: 2px;
}
