.catalog-categories {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .8rem 0 .65rem;
}

/* Reserve space for offscreen cards; the first row always renders normally. */
@supports (content-visibility: auto) {
  .catalog-showcase .game-card:nth-child(n+4) {
    content-visibility: auto;
    contain-intrinsic-block-size: auto 860px;
  }
}

.catalog-categories button {
  min-height: 40px;
  padding: .4rem .85rem;
  border: 1px solid #745267;
  border-radius: 999px;
  background: #211723;
  color: #f0dfec;
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.catalog-categories button[aria-pressed="true"] {
  border-color: #a8f5df;
  background: #234346;
  color: #d1ffed;
}

.catalog-categories button:focus-visible,
.catalog-showcase .game-cover:focus-visible {
  outline: 2px solid #a8f5df;
  outline-offset: 2px;
}

.catalog-showcase .game-cover { position: relative; }

.catalog-category-tag, .catalog-watch {
  position: absolute;
  z-index: 2;
  color: #fff;
  background: #211322eb;
  border: 1px solid #d8a5ca;
  border-radius: 999px;
  font-weight: 750;
  line-height: 1.2;
}

.catalog-category-tag {
  top: .55rem;
  left: .55rem;
  max-width: 54%;
  padding: .35rem .55rem;
  font-size: .72rem;
}

.catalog-watch {
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  padding: .65rem .85rem;
  white-space: nowrap;
  font-size: .88rem;
}

.catalog-showcase a[data-game-demo]:hover .catalog-watch,
.catalog-showcase a[data-game-demo]:focus-visible .catalog-watch {
  background: #ffd47c;
  color: #291911;
}

.q-theme .catalog-showcase .store-card .game-cover .sale-marks {
  inset: .55rem .55rem auto auto;
  align-items: flex-end;
  flex-direction: column;
}

.q-theme .catalog-showcase .store-card .game-plans { grid-template-columns: minmax(0, 1fr); }

.q-theme .catalog-showcase .store-card .game-plans .plan-download {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: .15rem .55rem;
  min-height: 66px;
}

.catalog-showcase .plan-download > :is(.plan-title, .plan-price, small) { grid-column: 1; }

.catalog-buy-action {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  padding: .45rem .6rem;
  border-radius: .5rem;
  background: #31192e;
  color: #fff2f4;
  white-space: nowrap;
  font-size: .8rem;
  font-weight: 800;
}

.q-theme .catalog-showcase .store-card .game-plans .plan-online { min-height: 62px; }

.catalog-demo-dialog {
  box-sizing: border-box;
  width: min(43rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  padding: clamp(.75rem, 2.5vw, 1.25rem);
  border: 1px solid #9a6083;
  border-radius: 1rem;
  background: #1d1421;
  color: #f8eef6;
  overflow: auto;
}

.catalog-demo-dialog::backdrop { background: #0a0611de; }
.catalog-demo-header { display: flex; justify-content: space-between; gap: .6rem; align-items: center; margin-bottom: .65rem; }
.catalog-demo-header h2 { margin: 0; font-size: clamp(1rem, 3vw, 1.4rem); }

.catalog-demo-dialog video {
  display: block;
  width: 100%;
  max-height: 66vh;
  margin: 0 auto .6rem;
  object-fit: contain;
  border-radius: .5rem;
  background: #08070a;
}

.catalog-demo-dialog video[hidden] { display: none; }
.catalog-demo-dialog > a { color: #a8f5df; font-weight: 700; }

.game-owner-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin: .85rem 0;
  padding: .85rem 1rem;
  border: 1px solid #745267;
  border-radius: 14px;
  background: #211723;
  color: #f0dfec;
}

.game-owner-invite h3,
.game-owner-invite p {
  margin: 0;
}

.game-owner-invite p {
  margin-top: .2rem;
}

.game-owner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.game-owner-invite .button {
  min-height: 44px;
}

.compact-catalog .section-heading { align-items: end; margin-bottom: .8rem; gap: .8rem; }
.compact-catalog .section-heading h1 { margin: 0; font-size: clamp(1.45rem, 4vw, 2.5rem); }
.compact-catalog .section-heading p { margin: .35rem 0 0; }
.compact-catalog .game-card[hidden] { display: none !important; }
.compact-catalog .game-card:nth-child(n+4) { contain-intrinsic-block-size: auto 320px; }
.q-theme .compact-catalog .store-card .game-info { padding: .65rem; gap: .45rem; }
.q-theme .compact-catalog .store-card h3 { font-size: clamp(.9rem, 2.5vw, 1.08rem); overflow-wrap: anywhere; }
.q-theme .compact-catalog .store-card .game-plans { gap: .35rem; }
.q-theme .compact-catalog .store-card .game-plans .plan-choice {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: .35rem .5rem;
  gap: .12rem .4rem;
}
.q-theme .compact-catalog .store-card .plan-title { font-size: .75rem; }
.q-theme .compact-catalog .store-card .plan-price { font-size: .97rem; white-space: nowrap; }
.compact-catalog .plan-choice > small, .compact-catalog .catalog-buy-action,
.compact-catalog small.plan-unavailable, .compact-catalog .cart-open-button,
.compact-catalog .catalog-category-tag { display: none; }
.compact-catalog .cart-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.compact-catalog .cart-add-button { min-height: 36px; padding: .24rem .5rem; font-size: .75rem; }
.compact-catalog .catalog-watch { inset: auto .4rem .4rem auto; translate: none; padding: .28rem .45rem; font-size: .72rem; }
.catalog-more { text-align: center; margin: 1.1rem 0 .2rem; }
.catalog-help { display: flex; flex-wrap: wrap; gap: .6rem 1rem; padding: .75rem 0; }
.catalog-help a { color: #f1dcf0; text-underline-offset: .18em; }
@media (max-width: 620px) {
  .compact-catalog .section-heading { display: grid; grid-template-columns: minmax(0,1fr); align-items: start; }
  .compact-catalog .q-search, .compact-catalog .q-search input { width: 100%; min-width: 0; }
  .q-theme .compact-catalog .game-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: .55rem; }
  .compact-catalog .catalog-categories, .compact-catalog .game-filters { gap: .3rem; }
  .compact-catalog .catalog-categories button { min-height: 36px; padding: .3rem .55rem; font-size: .74rem; }
}


.q-theme .catalog-navigation {
  gap: .45rem;
  margin-bottom: .35rem;
}

.q-theme .catalog-navigation .catalog-account-shop {
  background: #ffd18c;
  color: #382012;
  border-color: #ffe4b7;
}

.q-theme .catalog-navigation .catalog-account-shop:hover,
.q-theme .catalog-navigation .catalog-account-shop:focus-visible {
  color: #382012;
}

@media (min-width: 501px) {
  .q-theme .catalog-navigation { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 500px) {
  .q-theme .catalog-navigation .catalog-account-shop { grid-column: 1 / -1; }
}

.catalog-utility, .catalog-partners {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 .55rem;
}

.catalog-utility {
  justify-content: space-between;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto .6rem;
}

.q-theme .catalog-partners { column-gap: .45rem; }

.q-theme .catalog-utility .fx-toggle {
  position: static;
  margin: 0 0 .25rem auto;
}

.catalog-partners a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .25rem;
  color: #ffd6eb;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .22em;
}

.catalog-partners a:focus-visible {
  outline: 2px solid #a8f5df;
  outline-offset: -2px;
}

/* The legacy mobile header hides its last link. Catalog links must all stay visible. */
.q-theme .catalog-navigation a:last-child { display: grid; }
.q-theme .catalog-partners a:last-child { display: inline-flex; }

/* Search patterns adapted from Lucian UX/UI Prompt #429 and #092, MIT License (c) 2026 Seokwoooo. https://lucianlabs.dev/en/uxui-prompt/ */
.catalog-search { position: relative; width: min(100%, 20rem); max-width: none; min-width: 0; }
.catalog-search label { display: block; margin-bottom: .3rem; color: #f1cce4; font-size: .85rem; font-weight: 700; }
.q-theme .catalog-search input {
  width: 100%;
  min-height: 46px;
  padding-inline: .85rem;
  border-radius: 12px;
  background: #190f1c;
  border-color: #976680;
  font-size: 1rem;
}
.catalog-search input:focus-visible, .catalog-empty button:focus-visible {
  outline: 2px solid #a8f5df;
  outline-offset: 2px;
}
.catalog-search-results {
  position: absolute;
  z-index: 10;
  inset: calc(100% + .4rem) 0 auto;
  max-height: min(55vh, 20rem);
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: .3rem;
  border: 1px solid #986d8e;
  border-radius: 12px;
  background: #211524;
  box-shadow: 0 12px 26px #0b050ccc;
}
.catalog-search-results li {
  min-height: 44px;
  display: grid;
  align-content: center;
  padding: .45rem .65rem;
  border-radius: 8px;
  overflow-wrap: anywhere;
  color: #fff3fa;
  font-weight: 650;
  cursor: pointer;
}
.catalog-search-results li:hover,
.catalog-search-results li[aria-selected="true"] { background: #3b2540; color: #c6fae9; }
.catalog-empty {
  margin-top: .85rem;
  padding: clamp(.9rem, 3vw, 1.45rem);
  border: 1px solid #77546e;
  border-radius: 14px;
  background: #231625;
}
.catalog-empty p { margin: 0 0 .65rem; font-weight: 700; }
#search-recovery { display: flex; flex-wrap: wrap; gap: .55rem; }
.catalog-empty .button { min-height: 44px; white-space: normal; }
.catalog-empty[hidden], .catalog-search-results[hidden] { display: none; }
@media (max-width: 620px) {
  .compact-catalog .catalog-search { width: 100%; }
}
