/* Games page: flat dark layout, wide card grid, source dropdown inside the search bar. */

html.games-mode body {
  background: #09090b;
}
html.games-mode .hdr {
  background: #0b0b0e;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
html.games-mode #view {
  padding: 1.5rem 3rem 3rem;
}
html.games-mode .hdr-search-slot #search {
  background: #0f0f13;
  border-color: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding-right: 20rem;
}

/* ---- source dropdown (sits where the old Cloud switch was) ---- */
.search-count.has-dd {
  pointer-events: none;
}
.src-dd {
  position: relative;
  pointer-events: auto;
}
.src-dd-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 8.5rem;
  max-width: 13rem;
  height: 34px;
  padding: 0 0.7rem 0 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #d4d4d8;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.src-dd-btn:hover,
.src-dd.open .src-dd-btn {
  background: rgba(125, 255, 138, 0.1);
  border-color: rgba(125, 255, 138, 0.5);
  color: #7dff8a;
}
.src-dd-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.src-dd-btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}
.src-dd.open .src-dd-btn svg {
  transform: rotate(180deg);
}
.src-dd-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
  width: 15rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #121216;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.src-dd-menu[hidden] {
  display: none;
}
.src-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #d4d4d8;
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.src-dd-item:hover,
.src-dd-item:focus-visible {
  background: rgba(125, 255, 138, 0.1);
  color: #7dff8a;
  outline: none;
}
.src-dd-item[aria-selected="true"] {
  color: #fff;
  background: rgba(125, 255, 138, 0.1);
}
.src-dd-count {
  color: #71717a;
  font-size: 12px;
}

/* ---- section tabs: Games / Cloud Games ---- */
.gp-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}
.gp-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #a1a1aa;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.gp-tab:hover {
  color: #7dff8a;
  background: rgba(125, 255, 138, 0.1);
}
.gp-tab[aria-selected="true"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}
.gp-tab small {
  color: #71717a;
  font-size: 12px;
}

/* ---- card grid ---- */
.gp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.8rem;
}
.gp-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #101014;
  color: #d4d4d8;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.gp-card:hover {
  transform: translateY(-2px);
  border-color: rgba(125, 255, 138, 0.6);
  background: #14141a;
}
.gp-card:hover .gp-name {
  color: #7dff8a;
}
.gp-art {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: radial-gradient(circle at 70% 30%, rgba(125, 255, 138, 0.16), transparent 60%), #0b0b0e;
}
.gp-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gp-letter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7dff8a;
  font-size: 2.2rem;
  opacity: 0.7;
}
.gp-name {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.6rem;
  padding: 0.6rem 0.8rem;
  background: #0d0d10;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
/* The page is a column so the switcher sits at the very bottom even on short pages. */
.games-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 8.5rem);
}
.gp-pager {
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin-top: auto;
  padding-top: 2rem;
}
.gp-pager[hidden] {
  display: none;
}
.gp-pg-btn,
.gp-pg-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: #d4d4d8;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.gp-pg-btn {
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.gp-pg-btn:first-child {
  border-radius: 10px 0 0 10px;
}
.gp-pg-btn:last-child {
  border-radius: 0 10px 10px 0;
}
.gp-pg-btn:hover:not(:disabled) {
  color: #7dff8a;
  background: rgba(125, 255, 138, 0.1);
  border-color: rgba(125, 255, 138, 0.5);
}
.gp-pg-btn:disabled {
  color: #52525b;
  cursor: default;
}
.gp-pg-info {
  margin: 0 -1px;
  color: #a1a1aa;
  letter-spacing: 0.04em;
}
.gp-empty {
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 3rem 1.5rem;
  text-align: center;
  color: #a1a1aa;
  font-size: 14px;
}
.gp-empty strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #e4e4e7;
  font-size: 15px;
  font-weight: 600;
}
.gp-empty[hidden] {
  display: none;
}

@media (max-width: 900px) {
  html.games-mode #view {
    padding: 1rem 1rem 2rem;
  }
  .gp-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
  }
  .gp-pg-btn,
  .gp-pg-info {
    height: 40px;
    padding: 0 0.8rem;
    font-size: 12px;
  }
  .gp-name {
    min-height: 3rem;
    font-size: 13px;
  }
}
@media (max-width: 640px) {
  html.games-mode .hdr-search-slot #search {
    padding-right: 8rem;
  }
  html.games-mode #search-count-text,
  html.games-mode .search-count-divider {
    display: none;
  }
  .src-dd-btn {
    min-width: 5.5rem;
    max-width: 6.5rem;
  }
}
