/* Square marketplace listing covers with a compact, aligned information block. */
body:has(.market-home) .market-home .store-content .grid,
body:has(.buyer-main) .buyer-main .grid {
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  grid-auto-rows: auto !important;
  align-items: stretch !important;
}

@media (min-width: 1181px) and (max-width: 1600px) {
  body:has(.market-home) .market-home .store-content .grid,
  body:has(.buyer-main) .buyer-main .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  body:has(.market-home) .market-home .store-content .grid,
  body:has(.buyer-main) .buyer-main .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card,
body:has(.buyer-main) .buyer-main .grid > .market-product-card {
  display: grid !important;
  grid-template-rows: auto 118px !important;
  container-type: inline-size;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  align-self: stretch !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card > .thumb.product-thumb,
body:has(.buyer-main) .buyer-main .grid > .market-product-card > .thumb.product-thumb {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  flex: none !important;
  overflow: hidden !important;
  border-radius: 0 !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card > .thumb.product-thumb img,
body:has(.buyer-main) .buyer-main .grid > .market-product-card > .thumb.product-thumb img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card > .thumb.product-thumb:is(.asset-steam,.asset-telegram,.asset-genshin,.asset-mail) img,
body:has(.buyer-main) .buyer-main .grid > .market-product-card > .thumb.product-thumb:is(.asset-steam,.asset-telegram,.asset-genshin,.asset-mail) img {
  object-fit: contain !important;
  padding: clamp(20px, 7%, 46px) !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card > .cardbody,
body:has(.buyer-main) .buyer-main .grid > .market-product-card > .cardbody {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-rows: 38px 22px 36px !important;
  align-content: stretch !important;
  align-items: center !important;
  gap: 3px !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 8px 12px !important;
  overflow: hidden !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card .cardbody h3,
body:has(.buyer-main) .buyer-main .grid > .market-product-card .cardbody h3 {
  display: -webkit-box !important;
  box-sizing: border-box !important;
  height: 38px !important;
  min-height: 0 !important;
  max-height: 38px !important;
  margin: 0 !important;
  overflow: hidden !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow-wrap: anywhere !important;
  line-height: 19px !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card .market-product-description,
body:has(.buyer-main) .buyer-main .grid > .market-product-card .market-product-description {
  display: none !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card .market-product-rating,
body:has(.buyer-main) .buyer-main .grid > .market-product-card .market-product-rating {
  box-sizing: border-box !important;
  display: flex !important;
  width: 100% !important;
  height: 22px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  align-items: center !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

body:has(.market-home) .market-home .store-content .grid > .market-product-card .market-price-row,
body:has(.buyer-main) .buyer-main .grid > .market-product-card .market-price-row {
  box-sizing: border-box !important;
  display: flex !important;
  width: 100% !important;
  height: auto !important;
  min-height: 38px !important;
  max-height: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  align-self: end !important;
  align-items: center !important;
  overflow: hidden !important;
}

body:has(.market-home) .market-home .market-product-card .market-favorite-toggle,
body:has(.buyer-main) .buyer-main .market-product-card .market-favorite-toggle {
  z-index: 3 !important;
}

@media (max-width: 760px) {
  body:has(.market-home) .market-home .store-content .grid,
  body:has(.buyer-main) .buyer-main .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  body:has(.market-home) .market-home .store-content .grid {
    box-sizing: border-box !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }
  body:has(.market-home) .market-home .store-content .grid > .market-product-card,
  body:has(.buyer-main) .buyer-main .grid > .market-product-card {
    grid-template-rows: auto 114px !important;
  }
  body:has(.market-home) .market-home .store-content .grid > .market-product-card > .thumb.product-thumb,
  body:has(.buyer-main) .buyer-main .grid > .market-product-card > .thumb.product-thumb {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
  }
}

@media (max-width: 420px) {
  body:has(.market-home) .market-home .store-content .grid > .market-product-card,
  body:has(.buyer-main) .buyer-main .grid > .market-product-card {
    grid-template-rows: auto 114px !important;
  }
  body:has(.market-home) .market-home .store-content .grid > .market-product-card > .cardbody,
  body:has(.buyer-main) .buyer-main .grid > .market-product-card > .cardbody {
    padding-right: 10px !important;
    padding-left: 10px !important;
  }
}

/* Keep the square art full-width; shrink its display size by fitting more cards per row. */
body:has(.market-home) #app .market-home .store-content .grid,
body:has(.buyer-main) #app .buyer-main .grid {
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
}
body:has(.market-home) #app .market-home .store-content .grid > .market-product-card > .thumb.product-thumb,
body:has(.buyer-main) #app .buyer-main .grid > .market-product-card > .thumb.product-thumb {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
body:has(.market-home) #app .market-home .store-content .grid > .market-product-card,
body:has(.buyer-main) #app .buyer-main .grid > .market-product-card {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
@media (min-width: 1181px) and (max-width: 1600px) {
  body:has(.market-home) #app .market-home .store-content .grid,
  body:has(.buyer-main) #app .buyer-main .grid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  body:has(.market-home) #app .market-home .store-content .grid,
  body:has(.buyer-main) #app .buyer-main .grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media (max-width: 1250px) and (min-width: 901px) {
  body:has(.market-home) #app .market-home .store-content .grid,
  body:has(.buyer-main) #app .buyer-main .grid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
}
@media (max-width: 900px) and (min-width: 761px) {
  body:has(.market-home) #app .market-home .store-content .grid,
  body:has(.buyer-main) #app .buyer-main .grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media (max-width: 760px) {
  body:has(.market-home) #app .market-home .store-content .grid,
  body:has(.buyer-main) #app .buyer-main .grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
/* GGsel-style product cover: artwork starts directly at the card edge with no frame. */
body[data-theme="dark"]:has(.market-home) #app .market-home .store-content .grid > article.market-product-card,
body[data-theme="dark"]:has(.buyer-main) #app .buyer-main .grid > article.market-product-card {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: hidden !important;
}
body[data-theme="dark"]:has(.market-home) #app .market-home .store-content .grid > article.market-product-card > button.thumb.product-thumb,
body[data-theme="dark"]:has(.buyer-main) #app .buyer-main .grid > article.market-product-card > button.thumb.product-thumb {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: transparent !important;
}
body[data-theme="dark"]:has(.market-home) #app .market-home .store-content .grid > article.market-product-card > button.thumb.product-thumb::before,
body[data-theme="dark"]:has(.market-home) #app .market-home .store-content .grid > article.market-product-card > button.thumb.product-thumb::after,
body[data-theme="dark"]:has(.buyer-main) #app .buyer-main .grid > article.market-product-card > button.thumb.product-thumb::before,
body[data-theme="dark"]:has(.buyer-main) #app .buyer-main .grid > article.market-product-card > button.thumb.product-thumb::after {
  content: none !important;
  border: 0 !important;
  box-shadow: none !important;
}
body[data-theme="dark"]:has(.market-home) #app .market-home .store-content .grid > article.market-product-card > button.thumb.product-thumb img,
body[data-theme="dark"]:has(.buyer-main) #app .buyer-main .grid > article.market-product-card > button.thumb.product-thumb img {
  display: block !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
/* Keep the text panel surface; the card shell itself must not form a frame around the cover. */
body[data-theme="dark"]:has(.market-home) #app .market-home .store-content .grid > article.market-product-card,
body[data-theme="dark"]:has(.buyer-main) #app .buyer-main .grid > article.market-product-card {
  background: transparent !important;
  border-radius: 0 !important;
}
body[data-theme="dark"]:has(.market-home) #app .market-home .store-content .grid > article.market-product-card > .cardbody,
body[data-theme="dark"]:has(.buyer-main) #app .buyer-main .grid > article.market-product-card > .cardbody {
  background: #17191c !important;
  border: 0 !important;
  border-radius: 0 0 8px 8px !important;
}

/* The ribbon crosses the upper-left quarter of the square cover, without adding a row. */
#app .market-product-card>.thumb.product-thumb>.market-discount-overlay {
  position: absolute !important;
  z-index: 2 !important;
  top: 19% !important;
  left: 19% !important;
  right: auto !important;
  bottom: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: 80% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: linear-gradient(90deg, #b92734, #db3d49, #b92734) !important;
  color: #fff !important;
  box-shadow: inset 0 1px #ffb9be50, inset 0 -1px #7d172450 !important;
  transform: translate(-50%, -50%) rotate(-45deg) !important;
  transform-origin: center !important;
  pointer-events: none !important;
  transition: none !important;
}
#app .market-product-card>.thumb.product-thumb>.market-discount-overlay strong {
  display: block;
  font-size: 10px !important;
  font-weight: 800;
  line-height: 1 !important;
  letter-spacing: .01em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Current and crossed-out prices share one baseline; regular offers need no spacer. */
#app .market-product-card .market-price-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center !important;
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-top: 0 !important;
}
#app .market-product-card .market-price-stack {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: baseline !important;
  justify-content: flex-end !important;
  gap: clamp(3px, 2cqw, 5px) !important;
  height: auto !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}
#app .market-product-card .market-price-stack::before {
  content: none !important;
  display: none !important;
}
#app .market-product-card .market-price-stack .market-old-price {
  order: 0 !important;
  height: auto !important;
  line-height: 18px !important;
  font-size: clamp(8px, 4.8cqw, 11px) !important;
  flex: none !important;
  margin: 0 !important;
}
#app .market-product-card .market-price-stack .price {
  order: 1 !important;
  height: auto !important;
  line-height: 24px !important;
  font-size: clamp(12px, 8.5cqw, 20px) !important;
  flex: none !important;
  margin: 0 0 0 auto !important;
  gap: clamp(2px, 1.8cqw, 4px) !important;
}
#app .market-product-card .market-price-prefix {
  font-size: clamp(7px, 4.5cqw, 10px) !important;
}
#app .market-product-card .market-cart-button {
  display: grid !important;
  place-items: center;
  box-sizing: border-box;
  width: 36px !important;
  min-width: 0 !important;
  max-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  align-self: center;
  justify-self: end;
  flex: 0 0 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  transition: background-color .15s ease !important;
}
#app .market-product-card .market-cart-button:hover {
  transform: none !important;
  filter: none !important;
  background: #ffb85f !important;
  box-shadow: none !important;
}
#app .market-product-card .market-cart-button:focus-visible {
  outline-offset: -3px !important;
}
body:has(.buyer-favorites-page) #app .market-product-card .market-cart-button {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  flex-basis: 42px !important;
  border: 1px solid #ffbf68 !important;
  border-radius: 11px !important;
  background: linear-gradient(145deg,#ffb64b,#f39a2e) !important;
  color: #211609 !important;
  box-shadow: 0 4px 12px #ff9f2c25 !important;
}
body:has(.buyer-favorites-page) #app .market-product-card .market-cart-button svg {
  width: 21px !important;
  height: 21px !important;
  fill: none !important;
  stroke: #211609 !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}
@media (max-width: 760px) {
  #app .market-product-card>.cardbody {
    grid-template-rows: 38px 20px 34px !important;
  }
  #app .market-product-card .market-product-rating {
    height: 20px !important;
  }
  #app .market-product-card .market-price-row {
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
  }
  #app .market-product-card .market-cart-button {
    width: clamp(28px, 19cqw, 34px) !important;
    height: clamp(28px, 19cqw, 34px) !important;
    min-height: clamp(28px, 19cqw, 34px) !important;
    flex-basis: clamp(28px, 19cqw, 34px) !important;
  }
}
@media (max-width: 520px) {
  #app .market-product-card>.thumb.product-thumb>.market-discount-overlay {
    height: 18px !important;
  }
  #app .market-product-card>.thumb.product-thumb>.market-discount-overlay strong {
    font-size: 9px !important;
    letter-spacing: 0;
  }
}
