/* ============================================================
   NEONBET · Games view (dedicated lobby)  (redesign-v2 · FIX-4)
   ------------------------------------------------------------
   Mobile-first dedicated games page: header + count, category
   poster cards, search + sort + filters, 2-col game grid.
   Driven by the LIVE data layer — rails/filters use the admin
   CATEGORIES and GAMES; providers derived from GAMES. Game launch
   reuses openGameIframe. No backend/API/category changes.
   Injected as #nb-games (sibling of #nb-home, view-switched by nav).
   ============================================================ */

#nb-games { position: relative; z-index: 1; display: none; }
#nb-games.is-active { display: block; }
#nb-games .container { width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-5); }
@media (min-width: 768px) { #nb-games .container { padding: 0 var(--space-8); } }

/* Hero */
#nb-games .lobby-hero { padding: var(--space-6) 0 var(--space-2); }
#nb-games .lobby-hero h1 { margin: 0; font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 400; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-primary); }
#nb-games .lobby-hero p { color: var(--text-secondary); margin: var(--space-2) 0 0; font-size: var(--text-base); }

/* Category poster strip */
#nb-games .cat-strip { display: flex; gap: var(--space-3); overflow-x: auto; padding: var(--space-5) 0 var(--space-2); scroll-snap-type: x mandatory; scrollbar-width: none; }
#nb-games .cat-strip::-webkit-scrollbar { display: none; }
#nb-games .cat-card {
  flex: 0 0 auto; scroll-snap-align: start; position: relative;
  width: 240px; height: 120px; border-radius: var(--radius-xl); overflow: hidden;
  border: 1px solid var(--border-subtle); cursor: pointer; isolation: isolate;
  display: flex; align-items: flex-end; padding: var(--space-4);
  transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
#nb-games .cat-card::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.9; }
#nb-games .cat-card.g0::before { background: linear-gradient(135deg, rgba(255,46,147,0.55), rgba(139,92,255,0.35)); }
#nb-games .cat-card.g1::before { background: linear-gradient(135deg, rgba(0,229,255,0.45), rgba(139,92,255,0.40)); }
#nb-games .cat-card.g2::before { background: linear-gradient(135deg, rgba(139,92,255,0.50), rgba(0,229,255,0.30)); }
#nb-games .cat-card.g3::before { background: linear-gradient(135deg, rgba(232,194,106,0.50), rgba(255,46,147,0.30)); }
#nb-games .cat-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgba(7,7,12,0.65), transparent 70%); }
#nb-games .cat-card:hover { transform: translateY(-3px); border-color: var(--neon-cyan); }
#nb-games .cat-card .cat-card-name { font-family: var(--font-display); font-size: var(--text-lg); color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.6); letter-spacing: 0.02em; text-transform: uppercase; }
#nb-games .cat-card .cat-card-sub { position: absolute; top: var(--space-3); left: var(--space-4); font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.85); }

/* Toolbar */
#nb-games .lobby-toolbar { position: sticky; top: calc(var(--nav-height-mobile) + env(safe-area-inset-top)); z-index: 10; background: var(--bg-base); padding: var(--space-3) 0; margin-top: var(--space-2); }
@media (min-width: 1200px) { #nb-games .lobby-toolbar { top: calc(var(--nav-height) + env(safe-area-inset-top)); } }
#nb-games .lobby-toolbar-inner { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
#nb-games .lobby-search { position: relative; flex: 1 1 100%; }
@media (min-width: 560px) { #nb-games .lobby-search { flex: 1 1 240px; } }
#nb-games .lobby-search input { height: 44px; width: 100%; padding: 0 var(--space-4) 0 44px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-primary); font-family: var(--font-sans); font-size: var(--text-base); }
#nb-games .lobby-search input:focus { outline: none; border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(0,229,255,0.14); }
#nb-games .lobby-search svg { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
#nb-games .sort-select { height: 44px; padding: 0 var(--space-3); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-primary); font-family: var(--font-sans); font-size: var(--text-sm); }
#nb-games .filter-toggle { height: 44px; padding: 0 var(--space-4); display: inline-flex; align-items: center; gap: 8px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-primary); font-family: var(--font-display); font-size: var(--text-xs); letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; }
#nb-games .filter-toggle:hover { border-color: var(--neon-cyan); }
#nb-games .filter-toggle svg { width: 16px; height: 16px; }
#nb-games .filter-toggle .fcount { background: var(--neon-magenta); color: #fff; border-radius: var(--radius-pill); font-family: var(--font-mono); font-size: 0.6rem; padding: 1px 6px; }

/* Count */
#nb-games .lobby-count { font-size: var(--text-sm); color: var(--text-secondary); margin: var(--space-2) 0 var(--space-4); }
#nb-games .lobby-count strong { color: var(--text-primary); font-family: var(--font-mono); }

/* Grid */
#nb-games .games-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, 1fr); padding-bottom: var(--space-20); }
@media (min-width: 600px)  { #nb-games .games-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-4); } }
@media (min-width: 900px)  { #nb-games .games-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { #nb-games .games-grid { grid-template-columns: repeat(5, 1fr); } }
#nb-games .games-empty { grid-column: 1 / -1; padding: var(--space-12) var(--space-5); text-align: center; color: var(--text-muted); }

/* Filter drawer */
.gv-filter-scrim { position: fixed; inset: 0; background: var(--bg-overlay); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; z-index: calc(var(--z-drawer)); transition: opacity 200ms var(--ease-out); }
.gv-filter-scrim.is-open { opacity: 1; pointer-events: auto; }
.gv-filter { position: fixed; top: 0; left: 0; bottom: 0; width: min(340px, 86vw); z-index: calc(var(--z-drawer) + 1); background: var(--bg-base); border-right: 1px solid var(--border-subtle); box-shadow: 16px 0 60px rgba(0,0,0,0.55); transform: translateX(-100%); transition: transform 260ms var(--ease-out); display: flex; flex-direction: column; }
.gv-filter.is-open { transform: translateX(0); }
.gv-filter[hidden] { display: none; }
.gv-filter-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.gv-filter-head h3 { margin: 0; font-family: var(--font-display); font-size: var(--text-lg); font-weight: 400; }
.gv-filter-close { width: 36px; height: 36px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; background: var(--bg-surface); border: 1px solid var(--border-subtle); color: var(--text-secondary); cursor: pointer; }
.gv-filter-body { flex: 1; overflow-y: auto; padding: var(--space-5); }
.gv-filter-section { margin-bottom: var(--space-6); }
.gv-filter-section h4 { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 var(--space-3); }
.gv-opt { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-primary); font-family: var(--font-sans); font-size: var(--text-sm); text-align: left; cursor: pointer; min-height: 38px; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.gv-opt:hover { background: rgba(255,255,255,0.04); }
.gv-opt.is-active { background: rgba(0,229,255,0.12); color: var(--neon-cyan); font-weight: 600; }
.gv-opt input { accent-color: var(--neon-cyan); width: 16px; height: 16px; }
.gv-opt .gv-c { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.gv-filter-foot { padding: var(--space-4) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-subtle); display: flex; gap: var(--space-3); }
.gv-filter-foot .btn { flex: 1; }
@media (min-width: 1024px) { .gv-filter, .gv-filter-scrim { /* sidebar handled inline; keep drawer for simplicity on all sizes */ } }
