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

:root {
  --bg: #0a0a0f;
  --bg-1: #0e0e16;
  --bg-2: #14141f;
  --bg-3: #1a1a2a;
  --bg-card: #16162a;
  --bg-card-hover: #1e1e3a;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(0,212,255,0.25);
  --accent: #00d4ff;
  --accent-2: #7c5cfa;
  --accent-glow: rgba(0,212,255,0.15);
  --text: #e8e8e8;
  --text-2: #8a8aa0;
  --text-3: #505068;
  --success: #00e676;
  --warning: #ffc107;
  --danger: #ff5252;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 8px 32px rgba(0,0,0,0.6);
  --header-h: 64px;
}

/* ── Reset & Base ──────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Particles Canvas ──────────────────────────────────── */
#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* ── Header ────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1.5rem;
  z-index: 1000;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, box-shadow 0.3s;
}
.header.scrolled {
  background: rgba(10,10,15,0.96);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.header-left { display: flex; align-items: center; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo img { border-radius: 6px; }
.logo-dot { color: var(--accent); }

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: 2rem;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-btn.active { color: var(--accent); background: rgba(0,212,255,0.08); }
.nav-btn svg { opacity: 0.7; }
.nav-btn.active svg { opacity: 1; }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ── Search ────────────────────────────────────────────── */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: all 0.3s var(--ease);
  max-width: 320px;
}
.search-box:focus-within {
  border-color: rgba(0,212,255,0.4);
  background: rgba(0,212,255,0.04);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
  max-width: 400px;
}
.search-icon { color: var(--text-3); flex-shrink: 0; }
#searchInput {
  background: none;
  border: none;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.88rem;
  outline: none;
  width: 100%;
  font-family: inherit;
}
#searchInput::placeholder { color: var(--text-3); }
.search-kbd {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-3);
  border: 1px solid var(--border);
  font-family: inherit;
  flex-shrink: 0;
}

/* ── Icon Buttons ──────────────────────────────────────── */
.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.3);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ── Main Content ──────────────────────────────────────── */
.main {
  position: relative;
  z-index: 1;
  padding-top: var(--header-h);
  min-height: 100vh;
}
.section { display: none; padding-bottom: 4rem; }
.section.active { display: block; }
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  padding: 2rem 2rem 1rem;
  letter-spacing: -0.02em;
}

/* ── Hero Banner ───────────────────────────────────────── */
.hero {
  position: relative;
  height: 75vh;
  min-height: 500px;
  max-height: 700px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  transition: transform 8s ease-out;
  will-change: transform;
}
.hero:hover .hero-bg { transform: scale(1.03); }
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, var(--bg) 0%, rgba(10,10,15,0.7) 40%, rgba(10,10,15,0.2) 70%, transparent 100%),
    linear-gradient(to right, rgba(10,10,15,0.8) 0%, transparent 50%);
}
.hero-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 200px;
  background: linear-gradient(to top, var(--bg), transparent);
  z-index: 2;
}
.hero-content {
  position: relative;
  z-index: 3;
  padding: 3rem;
  max-width: 600px;
}
.hero-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(0,212,255,0.15);
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}
.hero-desc {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 12px; }
.btn-play, .btn-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-play {
  background: var(--text);
  color: var(--bg);
}
.btn-play:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,255,255,0.2); }
.btn-info {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-info:hover { background: rgba(255,255,255,0.15); }

/* ── Row (Netflix Style) ───────────────────────────────── */
.row {
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
  animation: rowFadeIn 0.6s var(--ease) forwards;
}
@keyframes rowFadeIn {
  to { opacity: 1; transform: none; }
}
.row:nth-child(2) { animation-delay: 0.1s; }
.row:nth-child(3) { animation-delay: 0.2s; }
.row:nth-child(4) { animation-delay: 0.3s; }
.row:nth-child(5) { animation-delay: 0.4s; }

.row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  margin-bottom: 0.75rem;
}
.row-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.row-more {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.row:hover .row-more { opacity: 1; }
.row-more:hover { text-decoration: underline; }
.row-more::after {
  content: '→';
  transition: transform 0.2s;
}
.row-more:hover::after { transform: translateX(3px); }

.row-slider {
  display: flex;
  gap: 14px;
  padding: 0 2rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}
.row-slider::-webkit-scrollbar { display: none; }

/* ── Game Card ─────────────────────────────────────────── */
.game-card {
  position: relative;
  flex: 0 0 220px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.35s var(--ease), box-shadow 0.35s;
  scroll-snap-align: start;
  background: var(--bg-card);
  content-visibility: auto;
  contain-intrinsic-size: 220px 250px;
  contain: layout style;
}
.game-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: var(--shadow), 0 0 0 1px rgba(0,212,255,0.15);
  z-index: 10;
}
.game-card-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  display: block;
  background: var(--bg-3);
  transition: transform 0.4s var(--ease);
}
.game-card:hover .game-card-img { transform: scale(1.06); }

.game-card-body {
  padding: 0.7rem 0.85rem 0.8rem;
}
.game-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-3);
}
.game-card-badge {
  position: absolute;
  top: 8px; right: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 2;
}
.badge-html5 { background: rgba(0,212,255,0.15); color: var(--accent); border: 1px solid rgba(0,212,255,0.25); }
.badge-flash { background: rgba(255,152,0,0.15); color: #ffb74d; border: 1px solid rgba(255,152,0,0.25); }
.badge-local { background: rgba(0,230,118,0.15); color: var(--success); border: 1px solid rgba(0,230,118,0.25); }
.proxy-badge {
  position: absolute; top: 32px; right: 8px; z-index: 2;
  padding: 2px 6px; border-radius: 3px; font-size: 0.6rem; font-weight: 700;
  background: rgba(167,139,250,0.15); color: #a78bfa; border: 1px solid rgba(167,139,250,0.25);
  letter-spacing: 0.06em; text-transform: uppercase;
}

.game-card-fav {
  position: absolute;
  top: 8px; left: 8px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  color: var(--text-2);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s;
  z-index: 2;
}
.game-card:hover .game-card-fav { opacity: 1; transform: scale(1); }
.game-card-fav:hover { color: var(--danger); background: rgba(255,82,82,0.2); }
.game-card-fav.active { color: var(--danger); opacity: 1; transform: scale(1); }

.game-card-report {
  position: absolute;
  top: 44px; left: 8px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s;
  z-index: 2;
}
.game-card:hover .game-card-report { opacity: 1; transform: scale(1); }
.game-card-report:hover { color: var(--danger); background: rgba(255,82,82,0.2); }

.report-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.report-opt:hover { border-color: rgba(255,82,82,0.3); background: rgba(255,82,82,0.05); }
.report-opt input[type="checkbox"] { accent-color: var(--danger); }
.report-opt span { color: var(--text-2); }

.game-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.game-card:hover .game-card-overlay { opacity: 1; }
.play-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  border-radius: 50%;
  color: var(--bg);
  transform: scale(0.7);
  transition: transform 0.3s var(--ease);
}
.game-card:hover .play-icon { transform: scale(1); }

/* ── Skeleton Loading ──────────────────────────────────── */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton-grid {
  display: flex; gap: 16px; overflow: hidden;
  padding: 4px 0;
}
.skeleton-card {
  flex: 0 0 220px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.skeleton-card-img {
  width: 100%; aspect-ratio: 16/10;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%);
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-card-body {
  padding: 0.7rem 0.85rem 0.8rem;
}
.skeleton-card-title {
  height: 14px; width: 70%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%);
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-card-meta {
  height: 10px; width: 40%; margin-top: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%);
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* ── Fade-in Animation ─────────────────────────────────── */
@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.game-card.fade-in {
  animation: card-fade-in 0.35s var(--ease) both;
}

/* ── Browse Grid ───────────────────────────────────────── */
.browse-header { padding: 2rem 2rem 0; }
.browse-filters {
  display: flex;
  gap: 8px;
  padding: 1rem 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.browse-filters::-webkit-scrollbar { display: none; }
.filter-btn {
  padding: 7px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
}
.filter-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.filter-btn.active {
  background: rgba(0,212,255,0.12);
  border-color: rgba(0,212,255,0.3);
  color: var(--accent);
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 1rem 2rem;
}

/* ── Player ────────────────────────────────────────────── */
.player {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #000;
  display: none;
  flex-direction: column;
}
.player.active { display: flex; }
.player-header {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  background: rgba(10,10,15,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.player-back {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  transition: all 0.2s;
}
.player-back:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.player-title {
  flex: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-actions { display: flex; gap: 4px; }
.player-action {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.player-action:hover { color: var(--text); background: rgba(255,255,255,0.08); }

.player-frame {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-3);
  font-size: 0.9rem;
  background: var(--bg);
}
.player-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Game Loading Overlay (black/white screen detector) ── */
.game-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg);
  transition: opacity 0.4s;
}
.game-loading-overlay.active { display: flex; }
.game-loading-overlay.hiding { opacity: 0; }
.game-loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.game-loading-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  animation: loadingPulse 2s ease-in-out infinite;
}
@keyframes loadingPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
.game-loading-bar {
  width: 200px;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.game-loading-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 3s ease;
}

/* ── Card Stagger Row Entrance ─────────────────────────── */
@keyframes cardRowIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: none; }
}
.game-card.stagger-in {
  animation: cardRowIn 0.4s var(--ease) both;
}

/* ── Dialogs ───────────────────────────────────────────── */
dialog {
  background: none;
  border: none;
  padding: 0;
  margin: auto;
  max-width: 520px;
  width: fit-content;
  height: fit-content;
  inset: 0;
  position: fixed;
}
dialog::backdrop {
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
}
dialog[open] { display: flex; }
.dialog {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  animation: dialogIn 0.3s var(--ease);
}
@keyframes dialogIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.dialog-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}
.dialog-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  border: none;
  color: var(--text-2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.dialog-close:hover { background: rgba(255,82,82,0.15); color: var(--danger); }
.dialog-body { padding: 1.5rem; }

/* ── Upload Zone ───────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text-3);
}
.upload-zone:hover {
  border-color: rgba(0,212,255,0.4);
  background: rgba(0,212,255,0.03);
  color: var(--accent);
}
.upload-zone p { margin: 1rem 0 0.25rem; font-size: 0.95rem; font-weight: 500; }
.upload-zone span { font-size: 0.82rem; }

/* ── Settings ──────────────────────────────────────────── */
.settings-body { display: flex; flex-direction: column; gap: 1.25rem; }
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.setting-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.setting-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.setting-select:focus { border-color: rgba(0,212,255,0.4); }
.setting-select option { background: var(--bg-2); color: var(--text); }
.setting-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.setting-input:focus { border-color: rgba(0,212,255,0.4); }
.setting-hint { font-size: 0.75rem; color: var(--text-3); margin-top: -2px; }

/* Toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: rgba(0,212,255,0.3); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--accent); }

/* Theme Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-2);
  font-size: 0.75rem;
  font-family: inherit;
}
.theme-option:hover { border-color: rgba(255,255,255,0.15); }
.theme-option.active { border-color: var(--accent); color: var(--accent); background: rgba(0,212,255,0.06); }
.theme-preview {
  width: 100%;
  aspect-ratio: 2/1;
  border-radius: 6px;
}
.setting-footer {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.setting-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-2);
  transition: color 0.2s;
}
.setting-link:hover { color: var(--accent); text-decoration: none; }

/* ── Welcome Dialog ────────────────────────────────────── */
.welcome-dialog { overflow: visible; }
.welcome-content {
  text-align: center;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}
.welcome-glow {
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0,212,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-logo {
  width: 64px;
  border-radius: 12px;
  margin-bottom: 1rem;
  position: relative;
}
.welcome-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
  position: relative;
}
.welcome-text {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  position: relative;
}
.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
  position: relative;
}
.welcome-feat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-2);
  text-align: left;
}
.welcome-feat svg { color: var(--accent); flex-shrink: 0; }

.welcome-btn {
  position: relative;
  padding: 12px 32px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.4;
  overflow: hidden;
  transition: all 0.3s;
  font-family: inherit;
}
.welcome-btn.enabled {
  cursor: pointer;
  opacity: 1;
}
.welcome-btn.enabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,212,255,0.3);
}
.welcome-btn-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background: rgba(255,255,255,0.4);
  width: 0;
  transition: width 8s linear;
}
.welcome-btn.counting .welcome-btn-progress { width: 100%; }

/* ── Skeleton Loading ──────────────────────────────────── */
.skeleton-row, .skeleton-grid {
  display: flex;
  gap: 14px;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.skeleton-card {
  flex: 0 0 220px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.skeleton-img {
  width: 100%;
  aspect-ratio: 16/10;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-text {
  height: 12px;
  margin: 10px 12px 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-text.short { width: 60%; margin-bottom: 12px; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Notifications ─────────────────────────────────────── */
#notifications {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notification {
  padding: 12px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  animation: notifIn 0.3s var(--ease);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}
.notification.out { animation: notifOut 0.3s var(--ease) forwards; }
@keyframes notifIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: none; }
}
@keyframes notifOut {
  to { opacity: 0; transform: translateX(40px); }
}

/* ── Empty State ───────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-3);
}
.empty-state svg { margin-bottom: 1rem; opacity: 0.3; }

/* ── Animations ────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Themes ────────────────────────────────────────────── */
[data-theme="space"] {
  --bg: #0a0a18;
  --bg-1: #0e0e20;
  --bg-2: #14142a;
  --bg-3: #1a1a35;
  --bg-card: #161630;
  --accent: #a78bfa;
  --accent-2: #818cf8;
  --accent-glow: rgba(167,139,250,0.15);
  --border-hover: rgba(167,139,250,0.25);
}
[data-theme="neon"] {
  --bg: #050f0a;
  --bg-1: #081510;
  --bg-2: #0c1f16;
  --bg-3: #102a1e;
  --bg-card: #0e251a;
  --accent: #22d3ee;
  --accent-2: #86efac;
  --accent-glow: rgba(34,211,238,0.15);
  --border-hover: rgba(34,211,238,0.25);
}
[data-theme="retro"] {
  --bg: #0f0800;
  --bg-1: #150c02;
  --bg-2: #1c1004;
  --bg-3: #251606;
  --bg-card: #1e1208;
  --accent: #f97316;
  --accent-2: #fbbf24;
  --accent-glow: rgba(249,115,22,0.15);
  --border-hover: rgba(249,115,22,0.25);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .header { padding: 0 1rem; gap: 0.75rem; }
  .header-nav { display: none; }
  .search-box { max-width: 200px; }
  .search-kbd { display: none; }
  .hero { height: 60vh; min-height: 400px; }
  .hero-content { padding: 2rem 1.5rem; }
  .hero-title { font-size: 1.8rem; }
  .row-slider { padding: 0 1rem; }
  .browse-grid { padding: 1rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .section-title { padding: 1.5rem 1rem 0.75rem; font-size: 1.2rem; }
  .browse-header { padding: 1.5rem 1rem 0; }
  .game-card { flex: 0 0 160px; }
}
@media (max-width: 480px) {
  .header-nav { display: none; }
  .hero { height: 50vh; }
  .hero-actions { flex-direction: column; }
  .btn-play, .btn-info { width: 100%; justify-content: center; }
}

/* ── Visually Hidden ───────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}
