/* v3.10.39 — reference-position lobby layout.
   Only positioning, density, responsive rails, and missing browse controls are changed.
   Existing black/gold visual identity and functional modules remain intact. */

#view-games {
  --lobby-rail-width: 208px;
  --lobby-gap: 18px;
}

#gameLobby.game-lobby {
  display: grid;
  grid-template-columns: var(--lobby-rail-width) minmax(0, 1fr);
  gap: var(--lobby-gap);
  align-items: start;
  max-width: 100%;
}

#gameLobby > .lobby-announcement {
  grid-column: 1 / -1;
  margin: 0;
}

#gameLobby > .lobby-category-nav {
  grid-column: 1;
  grid-row: 2 / span 20;
  position: sticky;
  top: 88px;
  z-index: 12;
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(221, 185, 79, .18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 22, 24, .98), rgba(10, 10, 11, .98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, .24);
}

.lobby-filter-tools {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(221, 185, 79, .13);
}

.lobby-search-field {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(221, 185, 79, .18);
  border-radius: 11px;
  background: rgba(255, 255, 255, .035);
  color: #ead99f;
}

.lobby-search-field:focus-within {
  border-color: rgba(243, 207, 97, .58);
  box-shadow: 0 0 0 3px rgba(221, 185, 79, .08);
}

.lobby-search-field svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.lobby-search-field input,
.lobby-provider-filter {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #fff5d8;
  background: transparent;
  font: inherit;
  font-size: 12px;
}

.lobby-search-field input::placeholder { color: rgba(255, 245, 216, .48); }

.lobby-provider-filter {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(221, 185, 79, .18);
  border-radius: 11px;
  background: #151517;
}

.lobby-provider-filter option { background: #151517; color: #fff5d8; }

.lobby-filter-count {
  padding-inline: 4px;
  color: rgba(255, 245, 216, .5);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#gameLobby .lobby-category-button {
  width: 100%;
  min-width: 0;
  min-height: 39px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  justify-content: start;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  text-align: left;
  white-space: nowrap;
}

#gameLobby .lobby-category-button > span:first-child {
  display: grid;
  place-items: center;
  width: 24px;
  color: #f1cf64;
}

#gameLobby .lobby-category-button.active,
#gameLobby .lobby-category-button.filter-selected {
  color: #16130a;
  background: linear-gradient(180deg, #f2d463, #d6a72c);
  border-color: rgba(255, 229, 134, .68);
  box-shadow: 0 9px 24px rgba(202, 151, 28, .18);
}

#gameLobby .lobby-category-button.active > span:first-child,
#gameLobby .lobby-category-button.filter-selected > span:first-child { color: #16130a; }

#gameLobby > .game-showcase-section,
#gameLobby > .game-provider-section {
  grid-column: 2;
  min-width: 0;
  margin-top: 0;
}

#gameLobby .game-showcase-section,
#gameLobby .game-provider-section {
  scroll-margin-top: 94px;
}

#gameLobby .game-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

#gameLobby .game-section-heading h2 {
  margin: 1px 0 0;
  font-size: clamp(18px, 2vw, 24px);
}

#gameLobby .game-section-kicker {
  font-size: 9px;
  letter-spacing: .16em;
}

#featuredGamesGrid.featured-games-grid {
  display: grid !important;
  grid-template-columns: none !important;
  grid-auto-flow: column;
  grid-auto-columns: minmax(100%, 1fr);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(221, 185, 79, .38) transparent;
}

#featuredGamesGrid .featured-game-card {
  min-height: 330px !important;
  scroll-snap-align: start;
}

#featuredGamesGrid .featured-game-content {
  min-height: 330px !important;
  max-width: min(52%, 560px);
  padding: clamp(22px, 3vw, 40px) !important;
}

#gameLobby .compact-games-grid,
#gameLobby #categoriesSection .compact-games-grid {
  display: grid !important;
  grid-template-columns: none !important;
  grid-auto-flow: column;
  grid-auto-columns: minmax(142px, 1fr);
  gap: 10px !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(221, 185, 79, .34) transparent;
}

#gameLobby .compact-game-card {
  min-width: 0;
  scroll-snap-align: start;
}

#gameLobby .compact-game-media {
  aspect-ratio: 1 / 1 !important;
}

#gameLobby .compact-game-copy {
  padding: 8px 6px 4px;
}

#gameLobby .compact-game-copy strong {
  font-size: 12px;
  line-height: 1.2;
}

#gameLobby .compact-game-copy span {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.25;
}

#gameLobby .game-category-sections {
  display: grid;
  gap: 16px;
}

#gameLobby .game-category-block {
  min-width: 0;
}

#gameLobby .game-category-block h3 {
  margin: 0 0 8px;
  color: #f1d06a !important;
  font-size: 14px;
}

#gameLobby .game-provider-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(136px, max-content);
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 9px;
  scroll-snap-type: x proximity;
}

#gameLobby .provider-chip {
  appearance: none;
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 9px 14px;
  border: 1px solid rgba(221, 185, 79, .18);
  border-radius: 12px;
  color: #fff1bf;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.018));
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  scroll-snap-align: start;
}

#gameLobby .provider-chip:hover {
  border-color: rgba(243, 207, 97, .52);
  background: rgba(221, 185, 79, .1);
}

.lobby-filter-hidden,
.lobby-filter-empty { display: none !important; }

@media (min-width: 861px) and (max-width: 1180px) {
  #view-games { --lobby-rail-width: 174px; --lobby-gap: 14px; }
  #gameLobby > .lobby-category-nav { padding: 9px; }
  #gameLobby .lobby-category-button { font-size: 11px; padding-inline: 8px; }
  #gameLobby .compact-games-grid,
  #gameLobby #categoriesSection .compact-games-grid { grid-auto-columns: minmax(132px, 1fr); }
  #featuredGamesGrid .featured-game-content { max-width: 62%; }
}

@media (max-width: 860px) {
  #gameLobby.game-lobby {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  #gameLobby > .lobby-announcement { order: 0; }

  #gameLobby > .lobby-category-nav {
    order: 1;
    position: relative;
    top: auto;
    z-index: 12;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    border-radius: 14px;
    backdrop-filter: blur(16px);
    scrollbar-width: none;
  }

  #gameLobby > .lobby-category-nav::-webkit-scrollbar { display: none; }

  .lobby-filter-tools {
    flex: 0 0 min(78vw, 330px);
    grid-template-columns: minmax(136px, 1fr) minmax(112px, .8fr);
    gap: 6px;
    padding: 0 7px 0 0;
    margin: 0;
    border: 0;
    border-right: 1px solid rgba(221, 185, 79, .13);
  }

  .lobby-search-field,
  .lobby-provider-filter { min-height: 34px; }
  .lobby-filter-count { grid-column: 1 / -1; padding-left: 2px; font-size: 8.5px; }

  #gameLobby .lobby-category-button {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    display: inline-flex;
    grid-template-columns: none;
    gap: 5px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 10px;
  }

  #gameLobby .lobby-category-button > span:first-child { width: auto; }

  #gameLobby > .game-showcase-section,
  #gameLobby > .game-provider-section { order: 3; width: 100%; }
  #gameLobby > #featuredSection { order: 2; }

  #gameLobby .game-showcase-section,
  #gameLobby .game-provider-section { scroll-margin-top: 72px; }

  #featuredGamesGrid .featured-game-card { min-height: 235px !important; }
  #featuredGamesGrid .featured-game-content {
    min-height: 235px !important;
    max-width: 72%;
    padding: 18px !important;
  }
  #featuredGamesGrid .featured-game-content h3 { font-size: clamp(21px, 7vw, 30px) !important; }
  #featuredGamesGrid .featured-game-content p { display: none; }
  #featuredGamesGrid .game-card-badges { display: none; }
  #featuredGamesGrid .button { min-height: 34px; padding: 7px 12px; font-size: 11px; }

  #gameLobby .compact-games-grid,
  #gameLobby #categoriesSection .compact-games-grid {
    grid-auto-columns: minmax(126px, 42vw) !important;
    gap: 8px !important;
    padding-bottom: 7px;
  }

  #gameLobby .game-section-heading { margin-bottom: 7px; }
  #gameLobby .game-section-heading h2 { font-size: 17px; }
  #gameLobby .game-category-sections { gap: 12px; }
  #gameLobby .game-provider-list { grid-auto-columns: minmax(126px, 42vw); }
}

@media (max-width: 480px) {
  #gameLobby > .lobby-category-nav { margin-inline: -2px; width: calc(100% + 4px); }
  .lobby-filter-tools { flex-basis: 286px; grid-template-columns: 154px 118px; }
  .lobby-search-field input,
  .lobby-provider-filter { font-size: 10px; }
  #featuredGamesGrid .featured-game-card { min-height: 210px !important; }
  #featuredGamesGrid .featured-game-content { min-height: 210px !important; max-width: 80%; padding: 15px !important; }
  #gameLobby .compact-games-grid,
  #gameLobby #categoriesSection .compact-games-grid { grid-auto-columns: minmax(116px, 40vw) !important; }
}

/* v3.10.40 — single navigation panel fix.
   The existing application sidebar remains the only side panel.
   Game search, provider filter, and lobby categories are presented as
   a compact horizontal toolbar above the game content. */

#view-games {
  --lobby-rail-width: auto;
  --lobby-gap: 14px;
}

#gameLobby.game-lobby {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: var(--lobby-gap) !important;
  max-width: 100%;
}

#gameLobby > .lobby-announcement {
  order: 0;
  width: 100%;
  margin: 0;
}

#gameLobby > .lobby-category-nav {
  order: 1;
  position: sticky;
  top: 78px;
  z-index: 24;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(221, 185, 79, .18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(22, 22, 24, .98), rgba(10, 10, 11, .98));
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22);
  backdrop-filter: blur(16px);
}

#gameLobby .lobby-filter-tools {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0 0 9px;
  margin: 0 0 1px;
  border: 0;
  border-bottom: 1px solid rgba(221, 185, 79, .13);
}

#gameLobby .lobby-filter-count {
  align-self: center;
  white-space: nowrap;
}

#gameLobby .lobby-category-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 36px;
  display: inline-flex;
  grid-template-columns: none;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  text-align: center;
  font-size: 11px;
  white-space: nowrap;
}

#gameLobby .lobby-category-button > span:first-child {
  display: inline-grid;
  width: auto;
}

#gameLobby > .game-showcase-section,
#gameLobby > .game-provider-section {
  order: initial;
  width: 100%;
  min-width: 0;
  margin-top: 0;
}

@media (max-width: 860px) {
  #gameLobby.game-lobby {
    gap: 12px !important;
  }

  #gameLobby > .lobby-category-nav {
    position: relative;
    top: auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    border-radius: 14px;
    scrollbar-width: none;
  }

  #gameLobby > .lobby-category-nav::-webkit-scrollbar {
    display: none;
  }

  #gameLobby .lobby-filter-tools {
    flex: 0 0 min(86vw, 410px);
    grid-template-columns: minmax(150px, 1fr) minmax(120px, .78fr);
    gap: 6px;
    width: auto;
    padding: 0 8px 0 0;
    margin: 0;
    border: 0;
    border-right: 1px solid rgba(221, 185, 79, .13);
  }

  #gameLobby .lobby-filter-count {
    grid-column: 1 / -1;
    padding-left: 2px;
    font-size: 8.5px;
  }

  #gameLobby .lobby-category-button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10px;
  }

  #gameLobby > .game-showcase-section,
  #gameLobby > .game-provider-section {
    order: 3;
  }

  #gameLobby > #featuredSection {
    order: 2;
  }
}

@media (max-width: 480px) {
  #gameLobby .lobby-filter-tools {
    flex-basis: 292px;
    grid-template-columns: 158px 120px;
  }
}

/* v3.10.41 — mobile game search visibility fix.
   Keep the search and provider controls on their own full-width row so the
   horizontal category controls cannot squeeze or push the search field away. */
@media (max-width: 860px) {
  #gameLobby > .lobby-category-nav {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch;
    overflow-x: visible;
  }

  #gameLobby .lobby-filter-tools {
    flex: 1 0 100% !important;
    width: 100% !important;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 38%) !important;
    padding: 0 0 8px !important;
    margin: 0 0 1px !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(221, 185, 79, .13) !important;
  }

  #gameLobby .lobby-search-field,
  #gameLobby .lobby-provider-filter {
    width: 100%;
    min-width: 0;
  }

  #gameLobby .lobby-search-field input {
    display: block;
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  #gameLobby .lobby-filter-tools {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #gameLobby .lobby-filter-count {
    grid-column: 1;
  }

  #gameLobby .lobby-search-field,
  #gameLobby .lobby-provider-filter {
    min-height: 38px;
  }
}


/* v3.10.42 — desktop toolbar order fix.
   Keep the game search/provider/category toolbar directly below the announcement
   and above the featured banner on desktop. The previous flex order left
   default-order game sections ahead of the toolbar. */
@media (min-width: 861px) {
  #gameLobby > .lobby-announcement {
    order: 0 !important;
  }

  #gameLobby > .lobby-category-nav {
    order: 1 !important;
  }

  #gameLobby > .game-showcase-section,
  #gameLobby > .game-provider-section {
    order: 2 !important;
  }
}

/* v3.10.43 — all-screen toolbar order fix.
   Force the search/provider/category toolbar directly below the announcement
   and above the featured/game content on desktop, tablet, and mobile. */
#gameLobby > .lobby-announcement {
  order: 0 !important;
}

#gameLobby > .lobby-category-nav {
  order: 1 !important;
}

#gameLobby > .game-showcase-section,
#gameLobby > .game-provider-section {
  order: 2 !important;
}

/* v3.10.44 — game runtime replaces the lobby.
   The lobby layout uses high-specificity display rules, so the generic .hidden
   utility could not hide it after a game was launched. Keep the lobby fully
   removed while the runtime is active on desktop, tablet, and mobile. */
#gameLobby.hidden,
.portal.game-active #gameLobby {
  display: none !important;
}

#gameRuntime.hidden {
  display: none !important;
}

.portal.game-active #gameRuntime {
  display: flex !important;
}

/* v3.10.45 — mobile game scrolling fix.
   Keep the runtime as a two-row grid (toolbar + iframe) and allow vertical
   touch scrolling inside the launched game on phones and tablets. */
.portal.game-active #gameRuntime {
  display: grid !important;
}

@media (max-width: 860px) {
  html,
  body {
    min-height: 100% !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: auto !important;
    touch-action: pan-y !important;
  }

  .portal.game-active,
  .portal.game-active .main,
  .portal.game-active .content,
  .portal.game-active #view-games,
  .portal.game-active #gameRuntime {
    height: auto !important;
    min-height: 100dvh !important;
    overflow: visible !important;
  }

  .portal.game-active #gameRuntime {
    grid-template-rows: auto minmax(calc(100dvh - 52px), auto) !important;
    align-content: start !important;
  }

  .portal.game-active .game-frame {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: calc(100dvh - 52px) !important;
    max-height: none !important;
    overflow: auto !important;
    overscroll-behavior-y: auto !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
  }
}
