/* =============================================
   PlayBliss — Arcade Stylesheet
   ============================================= */

/* ---- Variables ---- */
:root {
  --bg-base:        #06061a;
  --bg-surface:     #09092a;
  --bg-card:        #0e0e35;
  --bg-card-hover:  #151550;
  --bg-glass:       rgba(14,14,53,0.75);

  --primary:        #7b35e8;
  --primary-light:  #a855ff;
  --primary-dark:   #5a1fc8;
  --primary-glow:   rgba(123,53,232,0.5);

  --cyan:           #00d4ff;
  --cyan-glow:      rgba(0,212,255,0.4);
  --green:          #00e87b;
  --green-glow:     rgba(0,232,123,0.4);
  --orange:         #ff7b35;
  --pink:           #ff35a0;
  --yellow:         #ffe135;

  --text:           #e8e8ff;
  --text-muted:     #8888bb;
  --text-dim:       #5555aa;
  --border:         rgba(123,53,232,0.35);
  --border-light:   rgba(255,255,255,0.07);
  --border-neon:    rgba(0,212,255,0.4);

  --shadow-card:    0 4px 24px rgba(0,0,0,0.6);
  --shadow-glow:    0 0 30px rgba(123,53,232,0.4);

  /* Box-shadow glow helpers */
  --glow-purple:    0 0 8px rgba(123,53,232,0.9), 0 0 24px rgba(123,53,232,0.4);
  --glow-cyan:      0 0 8px rgba(0,212,255,0.9), 0 0 24px rgba(0,212,255,0.4);
  --glow-green:     0 0 8px rgba(0,232,123,0.9), 0 0 24px rgba(0,232,123,0.4);
  --glow-orange:    0 0 8px rgba(255,123,53,0.9), 0 0 24px rgba(255,123,53,0.4);
  --glow-pink:      0 0 8px rgba(255,53,160,0.9), 0 0 24px rgba(255,53,160,0.4);

  /* Text shadow glow helpers */
  --text-glow-cyan:   0 0 8px rgba(0,212,255,0.9), 0 0 20px rgba(0,212,255,0.4);
  --text-glow-purple: 0 0 8px rgba(168,85,255,0.9), 0 0 20px rgba(123,53,232,0.4);
  --text-glow-green:  0 0 8px rgba(0,232,123,0.9), 0 0 20px rgba(0,232,123,0.4);
  --text-glow-white:  0 0 8px rgba(255,255,255,0.6), 0 0 20px rgba(200,200,255,0.3);

  --radius:         8px;
  --radius-lg:      10px;
  --radius-xl:      14px;
  --radius-pill:    999px;

  --nav-h:          64px;
  --music-h:        80px;
  --transition:     0.2s ease;

  --pixel-font:     'Press Start 2P', monospace;
  --display-font:   'Orbitron', monospace;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  /* Subtle dot grid — the classic 80s arcade floor */
  background-image: radial-gradient(circle, rgba(123,53,232,0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img, svg { display: block; }
input, select { font-family: inherit; }
::selection { background: var(--primary); color: #fff; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; box-shadow: var(--glow-purple); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ---- Keyframes ---- */
@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.5; }
  50%       { transform: rotate(45deg) translateY(6px); opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes neonPulse {
  0%, 100% { box-shadow: var(--glow-cyan); }
  50%       { box-shadow: 0 0 4px rgba(0,212,255,0.4); }
}
@keyframes scanlines {
  0%   { background-position: 0 0; }
  100% { background-position: 0 8px; }
}
@keyframes heroGlow {
  0%, 100% { text-shadow: var(--text-glow-purple); }
  50%       { text-shadow: 0 0 20px rgba(168,85,255,0.5), 0 0 40px rgba(0,212,255,0.2); }
}
@keyframes cardEdge {
  0%, 100% { border-color: rgba(0,212,255,0.6); box-shadow: var(--shadow-card), var(--glow-cyan); }
  50%       { border-color: rgba(168,85,255,0.6); box-shadow: var(--shadow-card), var(--glow-purple); }
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 1000;
  background: rgba(6,6,26,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,212,255,0.25);
  /* Neon top line */
  box-shadow: 0 1px 0 rgba(0,212,255,0.15), 0 -2px 0 inset rgba(0,212,255,0.1);
  transition: background var(--transition);
}
.navbar.scrolled {
  background: rgba(6,6,26,0.98);
  border-bottom-color: rgba(0,212,255,0.4);
}
/* Neon top accent line */
.navbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--primary), var(--cyan), transparent);
  opacity: 0.8;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-icon { font-size: 22px; line-height: 1; }
.logo-text {
  font-family: var(--pixel-font);
  font-size: 12px;
  color: var(--cyan);
  text-shadow: var(--text-glow-cyan);
  letter-spacing: 1px;
  line-height: 1.4;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding-left: 16px;
}
.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.nav-link:hover {
  color: var(--cyan);
  border-color: rgba(0,212,255,0.2);
  text-shadow: 0 0 6px rgba(0,212,255,0.5);
}
.nav-link.active {
  color: var(--cyan);
  background: rgba(0,212,255,0.08);
  border-color: rgba(0,212,255,0.3);
  text-shadow: var(--text-glow-cyan);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-music-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--cyan);
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.3);
  transition: all var(--transition);
}
.btn-music-toggle:hover {
  background: rgba(0,212,255,0.18);
  box-shadow: var(--glow-cyan);
}

.btn-coming-soon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  border: 1px solid var(--border);
  transition: all var(--transition);
  position: relative;
}
.btn-coming-soon:hover {
  border-color: var(--primary);
  color: var(--text);
  box-shadow: var(--glow-purple);
}
.badge-soon {
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--display-font);
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--cyan);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ============================================
   MAIN CONTENT / VIEWS
   ============================================ */
.main-content { padding-top: var(--nav-h); }
.view { display: none; }
.view.active { display: block; }

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Grid overlay for retro feel */
  background-image:
    linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* CRT scanlines overlay */
.hero-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.07),
    rgba(0,0,0,0.07) 1px,
    transparent 1px,
    transparent 4px
  );
  pointer-events: none;
  z-index: 3;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 20%, rgba(6,6,26,0.7) 70%, var(--bg-base) 90%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 24px;
  max-width: 800px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius);
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.4);
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--cyan);
  text-shadow: var(--text-glow-cyan);
  margin-bottom: 28px;
  letter-spacing: 0.5px;
  box-shadow: var(--glow-cyan);
  animation: neonPulse 3s ease-in-out infinite;
}

.hero-title {
  font-family: var(--pixel-font);
  font-size: clamp(20px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 2px;
  margin-bottom: 24px;
  color: var(--text);
  text-shadow: var(--text-glow-white);
  animation: heroGlow 4s ease-in-out infinite;
}

.gradient-text {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--primary-light) 50%, var(--green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(0,212,255,0.4));
}

.hero-subtitle {
  font-size: clamp(13px, 1.8vw, 16px);
  color: var(--text-muted);
  margin-bottom: 40px;
  line-height: 1.9;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 52px;
}

.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
  color: #fff;
  font-family: var(--pixel-font);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1px;
  box-shadow: var(--glow-purple), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all var(--transition);
  border: 1px solid rgba(168,85,255,0.5);
}
.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(168,85,255,0.9), 0 0 35px rgba(123,53,232,0.5), 0 8px 24px rgba(0,0,0,0.4);
}

.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--radius);
  background: rgba(0,212,255,0.06);
  color: var(--cyan);
  font-family: var(--pixel-font);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1px;
  border: 1px solid rgba(0,212,255,0.35);
  transition: all var(--transition);
}
.btn-hero-secondary:hover {
  transform: translateY(-2px);
  background: rgba(0,212,255,0.12);
  border-color: rgba(0,212,255,0.7);
  box-shadow: var(--glow-cyan);
  text-shadow: var(--text-glow-cyan);
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-num {
  font-family: var(--pixel-font);
  font-size: 20px;
  color: var(--cyan);
  text-shadow: var(--text-glow-cyan);
}
.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stat-divider {
  width: 1px; height: 40px;
  background: linear-gradient(180deg, transparent, var(--cyan), transparent);
  opacity: 0.4;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.scroll-arrow {
  width: 24px; height: 24px;
  border-right: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
  transform: rotate(45deg);
  animation: scrollBounce 1.5s infinite;
  margin: auto;
  box-shadow: 2px 2px 4px rgba(0,212,255,0.4);
}

/* ============================================
   SECTIONS
   ============================================ */
.section-container {
  padding: 60px 48px;
}
.section-dark {
  background: var(--bg-surface);
  /* Grid lines for dark sections */
  background-image:
    linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.section-title {
  font-family: var(--pixel-font);
  font-size: clamp(11px, 1.4vw, 14px);
  font-weight: 400;
  color: var(--text);
  text-shadow: var(--text-glow-white);
  letter-spacing: 1px;
}
.section-icon { margin-right: 8px; }

.btn-see-all {
  font-size: 12px;
  font-family: var(--pixel-font);
  color: var(--cyan);
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(0,212,255,0.3);
  transition: all var(--transition);
  letter-spacing: 0.5px;
}
.btn-see-all:hover {
  background: rgba(0,212,255,0.1);
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
  text-shadow: var(--text-glow-cyan);
}

/* ============================================
   GAME CARD
   ============================================ */
.game-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid rgba(123,53,232,0.2);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  position: relative;
}
/* Neon corner accent */
.game-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
}
.game-card:hover::before { opacity: 1; }
.game-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0,212,255,0.5);
  box-shadow: var(--shadow-card), var(--glow-cyan);
  animation: cardEdge 3s ease-in-out infinite;
}
.game-card:hover .card-play-btn { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.game-card:hover .card-thumb-img { transform: scale(1.08); }

.card-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--bg-surface);
}
.card-thumb-img {
  width: 100%; height: 100%;
  transition: transform 0.35s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(0,212,255,0.85);
  display: flex; align-items: center; justify-content: center;
  color: #000;
  opacity: 0;
  transition: all var(--transition);
  box-shadow: var(--glow-cyan);
}
.card-cat-badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(8px);
  font-family: var(--display-font);
}

.card-info {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-name {
  font-family: var(--pixel-font);
  font-size: 9px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.6;
  letter-spacing: 0.5px;
}
.card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.card-stars {
  display: flex;
  gap: 2px;
  color: var(--yellow);
  font-size: 11px;
  text-shadow: 0 0 6px rgba(255,225,53,0.5);
}
.card-plays {
  font-size: 10px;
  color: var(--text-dim);
}

/* Scroll row */
.games-scroll-row {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
.games-scroll-row .game-card {
  width: 220px;
  min-width: 220px;
}
.games-scroll-row::-webkit-scrollbar { height: 4px; }

/* Grid (browse page) */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.games-grid .game-card { width: 100%; min-width: unset; }

/* ============================================
   CATEGORIES GRID
   ============================================ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.category-card {
  padding: 24px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid rgba(123,53,232,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.category-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.category-card:hover::before { opacity: 1; }
.category-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0,212,255,0.5);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-card), var(--glow-cyan);
}
.cat-icon { font-size: 34px; line-height: 1; }
.cat-name {
  font-family: var(--pixel-font);
  font-size: 8px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.5px;
}
.cat-count {
  font-size: 11px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0,212,255,0.4);
}

/* ============================================
   CTA BANNER
   ============================================ */
.cta-banner {
  padding: 40px 48px;
  background: linear-gradient(135deg, rgba(0,212,255,0.06) 0%, rgba(123,53,232,0.08) 100%);
  border-top: 1px solid rgba(0,212,255,0.2);
  border-bottom: 1px solid rgba(123,53,232,0.2);
  position: relative;
  overflow: hidden;
}
.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.04),
    rgba(0,0,0,0.04) 1px,
    transparent 1px,
    transparent 4px
  );
  pointer-events: none;
}
.cta-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.cta-text h3 {
  font-family: var(--pixel-font);
  font-size: 14px;
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--cyan);
  text-shadow: var(--text-glow-cyan);
}
.cta-text p {
  font-size: 14px;
  color: var(--text-muted);
}
.btn-cta {
  padding: 13px 32px;
  border-radius: var(--radius);
  background: rgba(0,212,255,0.1);
  color: var(--cyan);
  font-family: var(--pixel-font);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1px;
  border: 1px solid rgba(0,212,255,0.5);
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: var(--glow-cyan);
}
.btn-cta:hover {
  transform: translateY(-2px);
  background: rgba(0,212,255,0.2);
  box-shadow: 0 0 15px rgba(0,212,255,0.7), 0 0 35px rgba(0,212,255,0.3);
  text-shadow: var(--text-glow-cyan);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  padding: 40px 48px;
  background: var(--bg-surface);
  border-top: 1px solid rgba(0,212,255,0.15);
}
.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.footer-logo { display: flex; align-items: center; gap: 10px; }
.footer-tagline {
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a { color: var(--text-muted); transition: color var(--transition); }
.footer-links a:hover { color: var(--cyan); text-shadow: var(--text-glow-cyan); }
.footer-copy {
  font-size: 11px;
  color: var(--text-dim);
}

/* ============================================
   BROWSE VIEW
   ============================================ */
.browse-hero {
  padding: 48px 48px 36px;
  background: var(--bg-surface);
  background-image:
    linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  border-bottom: 1px solid rgba(0,212,255,0.15);
}
.browse-title {
  font-family: var(--pixel-font);
  font-size: clamp(16px, 2.5vw, 26px);
  font-weight: 400;
  margin-bottom: 10px;
  color: var(--text);
  text-shadow: var(--text-glow-white);
}
.browse-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.browse-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.search-wrap {
  position: relative;
  max-width: 440px;
}
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border-radius: var(--radius);
  border: 1px solid rgba(0,212,255,0.2);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}
.search-input:focus {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}
.search-input::placeholder { color: var(--text-muted); }

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 7px 16px;
  border-radius: var(--radius);
  font-family: var(--display-font);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  transition: all var(--transition);
  letter-spacing: 0.3px;
}
.filter-chip:hover {
  color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
}
.filter-chip.active {
  background: rgba(0,212,255,0.08);
  color: var(--cyan);
  border-color: rgba(0,212,255,0.5);
  box-shadow: var(--glow-cyan);
  text-shadow: 0 0 6px rgba(0,212,255,0.5);
}

.browse-body { padding: 32px 48px 60px; }

.no-results {
  text-align: center;
  padding: 60px 20px;
}
.no-results.hidden { display: none; }
.no-results-emoji {
  font-size: 48px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 12px rgba(0,212,255,0.4));
}
.no-results p { color: var(--text-muted); font-size: 16px; }

/* ============================================
   GAME VIEW
   ============================================ */
.game-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(6,6,26,0.95);
  border-bottom: 1px solid rgba(0,212,255,0.2);
  backdrop-filter: blur(10px);
}
.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-back:hover {
  color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
  box-shadow: var(--glow-cyan);
}

.game-title-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.game-view-title {
  font-family: var(--pixel-font);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: var(--text-glow-white);
  letter-spacing: 0.5px;
}
.game-view-cat {
  padding: 3px 10px;
  border-radius: var(--radius);
  font-family: var(--display-font);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.game-toolbar-actions { display: flex; gap: 8px; }
.toolbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}
.toolbar-btn:hover {
  color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
  box-shadow: var(--glow-cyan);
}

.game-frame-wrap {
  width: 100%;
  height: calc(100vh - var(--nav-h) - 64px);
  background: #000;
  position: relative;
}
.game-frame {
  width: 100%; height: 100%;
  border: none;
  display: block;
}

/* ============================================
   MUSIC BAR
   ============================================ */
.music-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--music-h);
  z-index: 900;
  background: rgba(9,9,42,0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(0,212,255,0.25);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4), 0 0 0 0 transparent;
  transform: translateY(0);
  transition: transform var(--transition);
}
.music-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--primary), var(--cyan), transparent);
  opacity: 0.6;
}
.music-bar.hidden {
  transform: translateY(100%);
}
.music-bar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  padding: 0 24px;
}

.music-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 240px;
  flex-shrink: 0;
  min-width: 0;
}
.music-art {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.7);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--glow-purple);
}
.music-art img { width: 100%; height: 100%; object-fit: cover; }
.music-meta { min-width: 0; }
.music-track-name {
  font-family: var(--pixel-font);
  font-size: 8px;
  font-weight: 400;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0,212,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}
.music-track-artist {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.music-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mctl-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.mctl-btn:hover {
  color: var(--cyan);
  background: rgba(0,212,255,0.1);
  text-shadow: var(--text-glow-cyan);
}
.mctl-play {
  width: 44px; height: 44px;
  background: rgba(0,212,255,0.12);
  color: var(--cyan);
  border: 1px solid rgba(0,212,255,0.4);
  box-shadow: var(--glow-cyan);
}
.mctl-play:hover {
  background: rgba(0,212,255,0.25);
  transform: scale(1.06);
  box-shadow: 0 0 15px rgba(0,212,255,0.8), 0 0 35px rgba(0,212,255,0.4);
}
.mctl-loop.active,
.mctl-btn.active {
  color: var(--cyan);
  text-shadow: var(--text-glow-cyan);
}

.music-progress-area {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}
.music-time {
  font-size: 11px;
  color: var(--text-muted);
  font-feature-settings: "tnum";
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.music-progress-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  position: relative;
  cursor: pointer;
}
.music-progress-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  box-shadow: 0 0 6px rgba(0,212,255,0.5);
  transition: width 0.25s linear;
  pointer-events: none;
}
.music-progress-thumb {
  position: absolute;
  top: 50%; left: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
  transform: translate(-50%, -50%);
  transition: left 0.25s linear;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}
.music-progress-track:hover .music-progress-thumb { opacity: 1; }

.music-right {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 220px;
  flex-shrink: 0;
  justify-content: flex-end;
}
.music-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.vol-slider {
  -webkit-appearance: none;
  width: 80px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
  cursor: pointer;
}
.music-genre-select {
  background: var(--bg-card);
  border: 1px solid rgba(0,212,255,0.2);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
}
.music-genre-select:focus { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.music-genre-select option { background: var(--bg-card); }

.music-close-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.music-close-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}

/* Floating music button */
.music-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 890;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  background: rgba(0,212,255,0.1);
  color: var(--cyan);
  font-family: var(--pixel-font);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.5px;
  border: 1px solid rgba(0,212,255,0.4);
  box-shadow: var(--glow-cyan);
  transition: all var(--transition);
  animation: neonPulse 3s ease-in-out infinite;
}
.music-fab:hover {
  transform: translateY(-2px);
  background: rgba(0,212,255,0.2);
  box-shadow: 0 0 15px rgba(0,212,255,0.8), 0 0 35px rgba(0,212,255,0.4);
  text-shadow: var(--text-glow-cyan);
}
.music-fab.hidden { display: none; }
.music-fab-label { white-space: nowrap; }

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid rgba(0,212,255,0.3);
  font-family: var(--display-font);
  font-size: 12px;
  color: var(--text);
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-card), var(--glow-cyan);
}
.toast.success { border-color: var(--green); box-shadow: var(--shadow-card), var(--glow-green); }
.toast.info    { border-color: var(--cyan);  box-shadow: var(--shadow-card), var(--glow-cyan); }

/* ============================================
   CATEGORY COLOR THEMES
   ============================================ */
[data-cat="arcade"]   { --cat-color: #ff7b35; }
[data-cat="puzzle"]   { --cat-color: #b07aff; }
[data-cat="sports"]   { --cat-color: #00e87b; }
[data-cat="strategy"] { --cat-color: #00d4ff; }
[data-cat="card"]     { --cat-color: #ff7bc8; }
[data-cat="casual"]   { --cat-color: #ffe135; }
[data-cat="action"]   { --cat-color: #ff5555; }
[data-cat="classic"]  { --cat-color: #a8ff35; }

.card-cat-badge {
  color: var(--cat-color, var(--primary-light));
  background: rgba(0,0,0,0.3);
  border: 1px solid currentColor;
  opacity: 0.85;
}

/* Category background thumbs */
.thumb-arcade   { background: linear-gradient(135deg, #1a0800, #3d1500, #ff7b35 180%); }
.thumb-puzzle   { background: linear-gradient(135deg, #0d0a1e, #2a1060, #7b35e8 180%); }
.thumb-sports   { background: linear-gradient(135deg, #001a0a, #003d1a, #00e87b 180%); }
.thumb-strategy { background: linear-gradient(135deg, #001a1a, #003d3d, #00d4ff 180%); }
.thumb-card     { background: linear-gradient(135deg, #1a001a, #3d003d, #ff35a0 180%); }
.thumb-casual   { background: linear-gradient(135deg, #1a1500, #3d3500, #ffe135 180%); }
.thumb-action   { background: linear-gradient(135deg, #1a0000, #3d0000, #ff3535 180%); }
.thumb-classic  { background: linear-gradient(135deg, #0a1a00, #1a3d00, #a0ff35 180%); }

.game-thumb-inner {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.2));
}

/* ============================================
   UTILITY
   ============================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .section-container { padding: 48px 32px; }
  .browse-hero { padding: 40px 32px 28px; }
  .browse-body { padding: 28px 32px 48px; }
  .cta-banner { padding: 32px; }
  .site-footer { padding: 32px; }
}

@media (max-width: 768px) {
  :root { --nav-h: 56px; }

  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: rgba(9,9,42,0.98);
    border-bottom: 1px solid rgba(0,212,255,0.2);
    padding: 16px;
    gap: 4px;
    z-index: 999;
    backdrop-filter: blur(20px);
  }
  .nav-hamburger { display: flex; }
  .btn-coming-soon .badge-soon { display: none; }
  .btn-coming-soon span:not(.badge-soon) { display: none; }
  .btn-coming-soon { padding: 8px; }
  .btn-coming-soon svg { display: block; }

  .section-container { padding: 40px 20px; }
  .browse-hero { padding: 28px 20px 20px; }
  .browse-body { padding: 20px 20px 40px; }
  .cta-banner { padding: 24px 20px; }
  .site-footer { padding: 24px 20px; }

  .hero-title { font-size: 18px; }
  .hero-stats { gap: 14px; }
  .stat-num { font-size: 16px; }

  .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .categories-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

  .music-bar-inner { padding: 0 16px; gap: 10px; }
  .music-info { width: 140px; }
  .music-right { display: none; }
  .music-track-artist { display: none; }

  .game-toolbar { padding: 10px 16px; }
  .game-frame-wrap { height: calc(100vh - var(--nav-h) - 56px); }
}

@media (max-width: 480px) {
  .hero-title { font-size: 14px; }
  .hero-buttons { flex-direction: column; align-items: center; }
  .btn-hero-primary, .btn-hero-secondary { width: 100%; max-width: 280px; justify-content: center; }
  .cta-inner { flex-direction: column; align-items: flex-start; }
  .browse-title { font-size: 14px; }
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .music-bar { height: 68px; }
  :root { --music-h: 68px; }
  .music-controls { gap: 4px; }
  .mctl-btn { width: 30px; height: 30px; }
  .mctl-play { width: 38px; height: 38px; }
}
