
/* Restri marketplace repair v1 — final responsive contracts */

/* Mobile/iOS: prevent Safari focus zoom without disabling user zoom. */
@media (max-width: 768px) {
  input:not(.auth-code-cell),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Desktop auth gets more breathing room; mobile geometry remains unchanged. */
@media (min-width: 769px) {
  [data-auth-modal-root] .auth-shell,
  [data-auth-password-modal-root] .auth-shell {
    width: min(560px, calc(100vw - 48px)) !important;
    max-width: 560px !important;
  }
  [data-auth-modal-root] .auth-shell--email-step {
    width: min(500px, calc(100vw - 48px)) !important;
    max-width: 500px !important;
  }
  [data-auth-modal-root] .auth-card,
  [data-auth-password-modal-root] .auth-card {
    padding-left: 38px !important;
    padding-right: 38px !important;
  }
}

/* Password reveal controls only exist visually when there is something to reveal. */
.auth-password-toggle[hidden],
[data-password-toggle][hidden] {
  display: none !important;
}

/* Mobile notification access lives in the header without exposing desktop actions. */
.mobile-header-notifications {
  display: none;
}
@media (max-width: 768px) {
  .topbar-row {
    position: relative;
  }
  .mobile-header-notifications {
    display: inline-grid;
    place-items: center;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: #667085;
    text-decoration: none;
    z-index: 8;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-header-notifications .material-symbols-outlined {
    font-size: 23px;
    line-height: 1;
  }
  .mobile-header-notifications__badge {
    position: absolute;
    top: 4px;
    right: 3px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #7c3aed;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
  }
}

/* Bottom navigation: slightly lower while respecting iOS safe-area. */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    bottom: max(2px, env(safe-area-inset-bottom)) !important;
  }
}

/* Account menu touch feedback is one full-width tappable row. */
@media (max-width: 768px) {
  body[data-page-key="/account/menu"] .mobile-account-menu__item {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    border-radius: 14px !important;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }
  body[data-page-key="/account/menu"] .mobile-account-menu__item:active,
  body[data-page-key="/account/menu"] .mobile-account-menu__item:focus-visible {
    background: rgba(124,58,237,.075) !important;
  }
}

/* Seller profile game chips: one-line, content-width, touch-scroll, no visible bar. */
@media (max-width: 768px) {
  .seller-profile-toolbar__row--games,
  [data-game-filters] {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 8px !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    padding-bottom: 2px;
  }
  .seller-profile-toolbar__row--games::-webkit-scrollbar,
  [data-game-filters]::-webkit-scrollbar {
    display: none;
  }
  .seller-profile-toolbar__row--games .ui-chip,
  [data-game-filters] .ui-chip {
    flex: 0 0 auto !important;
    width: max-content !important;
    max-width: none !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
  }
}

/* Popular games: protect the intended compact mobile dimensions from later rules. */
@media (max-width: 768px) {
  .quick-game-card,
  .home-quick-games .quick-game-card,
  .popular-games .quick-game-card {
    min-height: 92px !important;
    height: auto !important;
  }
}

/* Profile photo modal: backdrop behind, crisp interactive dialog above it. */
.profile-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1900 !important;
  isolation: isolate;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.profile-modal-overlay,
.profile-modal__overlay {
  position: absolute !important;
  inset: 0 !important;
  z-index: 0 !important;
  background: rgba(15,23,42,.48) !important;
  backdrop-filter: blur(5px) !important;
  -webkit-backdrop-filter: blur(5px) !important;
}
.profile-modal-card,
.profile-modal__card {
  position: relative !important;
  z-index: 2 !important;
  filter: none !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: auto !important;
}

/* Withdrawal action is always present. Zero balance may disable it, never hide it. */
.wallet-hero__actions [data-open-modal="withdraw"] {
  display: inline-flex !important;
  visibility: visible !important;
}

/* Listing stock and mobile seller. */
.listing-stock-status {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.35;
  color: #667085;
}
.listing-stock-status strong {
  color: #344054;
  font-weight: 700;
}
.listing-seller--mobile-after-price {
  display: none;
}
@media (max-width: 720px) {
  .listing-seller--desktop.listing-seller--in-buy-card {
    display: none !important;
  }
  .listing-seller--mobile-after-price {
    display: block !important;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(15,23,42,.07);
  }
}

/* Payment chooser: clean bottom sheet on phones and never hidden under bottom nav. */
@media (max-width: 720px) {
  [data-listing-payment-modal] {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 12px 10px calc(84px + env(safe-area-inset-bottom)) !important;
  }
  [data-listing-payment-modal] .listing-payment-modal__shell {
    width: 100% !important;
    max-width: 520px !important;
    max-height: calc(100dvh - 112px - env(safe-area-inset-bottom));
    overflow: auto;
    border-radius: 26px;
  }
  [data-listing-payment-modal] .listing-payment-modal__card {
    border-radius: 26px !important;
    padding: 28px 18px 20px !important;
  }
  [data-listing-payment-modal] .payment-method-card {
    min-height: 68px !important;
    padding: 14px 16px !important;
    border-radius: 18px !important;
  }
}

/* Lightbox: larger media, true backdrop click area. */
.ld-lightbox {
  cursor: zoom-out;
}
.ld-lightbox-card {
  cursor: default;
}
.ld-lightbox-img {
  max-width: min(92vw, 1280px) !important;
  max-height: min(84dvh, 920px) !important;
  object-fit: contain !important;
}
@media (max-width: 720px) {
  .ld-lightbox-card {
    width: min(96vw, 760px) !important;
    max-width: 96vw !important;
  }
  .ld-lightbox-img {
    max-width: 94vw !important;
    max-height: 76dvh !important;
  }
}

/* Purchases/sales tabs and real mobile list presentation. */
@media (max-width: 768px) {
  .sales-page {
    min-width: 0 !important;
    overflow-x: clip;
  }
  .sales-tabs {
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  .sales-tabs__btn {
    min-height: 38px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    white-space: nowrap;
  }
  .sales-view-switch {
    margin-left: auto !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
  }
  .sales-page .sales-view-switch__btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    border-radius: 12px !important;
  }
  .sales-page .sales-view-switch__icon {
    width: 21px !important;
    height: 21px !important;
  }
  .sales-table-wrap {
    border: 0 !important;
    background: transparent !important;
    overflow: visible !important;
  }
  .sales-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .sales-table thead {
    display: none !important;
  }
  .sales-table tbody {
    display: grid !important;
    gap: 12px !important;
  }
  .sales-table tbody tr {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 8px 12px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 16px !important;
    box-sizing: border-box;
    border: 1px solid #e6eaf0 !important;
    border-radius: 20px !important;
    background: #fff !important;
  }
  .sales-table tbody td {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  .sales-table tbody td:nth-child(1) { grid-column: 1; grid-row: 1; color:#64748b; font-size:12px; }
  .sales-table tbody td:nth-child(2) { grid-column: 2; grid-row: 1; justify-self:end; }
  .sales-table tbody td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; font-weight:800; font-size:17px; }
  .sales-table tbody td:nth-child(4),
  .sales-table tbody td:nth-child(5),
  .sales-table tbody td:nth-child(6) { grid-column: 1 / -1; color:#64748b; font-size:13px; }
  .sales-table tbody td:nth-child(7) { grid-column: 1; font-size:20px; font-weight:800; align-self:end; }
  .sales-table tbody td:nth-child(8) { grid-column: 2; justify-self:end; align-self:end; }
}

/* Order summary metadata is plain information, not pill soup. */
.order-summary__params {
  gap: 0 !important;
}
.order-param-chip,
.order-param-chip--category {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  gap: 4px !important;
}
.order-param-chip:not(:last-child)::after {
  content: "·";
  margin: 0 8px;
  color: #98a2b3;
  font-weight: 400;
}
.order-param-chip__label,
.order-param-chip__value {
  font-size: 12px !important;
}
.order-param-chip__value {
  font-weight: 600 !important;
}

/* Mobile order composition: action -> chat -> product -> safety. */
@media (max-width: 768px) {
  .order-page {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    min-width: 0;
    overflow-x: clip;
  }
  .order-workspace,
  .order-workspace > .order-side {
    display: contents !important;
  }
  .order-page__seller-back { order: 0; }
  .order-side > .primary-action,
  .order-side > .order-action-card { order: 10; }
  .order-main { order: 20; min-width:0; }
  .order-summary--hero { order: 30; }
  .order-side > .trust-card { order: 40; }
  .order-side > :not(.primary-action):not(.order-action-card):not(.trust-card) { order: 35; }
  .order-summary {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 14px !important;
  }
  .order-summary__main {
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .order-summary__side,
  .price-block {
    align-items: flex-start !important;
    justify-items: start !important;
    text-align: left !important;
  }
  .order-summary__params {
    align-items: baseline !important;
    row-gap: 6px !important;
  }
  .order-param-chip {
    flex-wrap: nowrap !important;
  }
  .chat-shell {
    height: min(66dvh, 610px) !important;
    min-height: 480px !important;
    max-height: 610px !important;
    border-radius: 22px !important;
  }
  .chat-shell .chatbox,
  .chat-shell #chatbox {
    padding-top: 10px !important;
    padding-bottom: 8px !important;
  }
  .chat-shell .chat-form__input,
  .chat-form__input,
  #msg {
    font-size: 16px !important;
  }
}

/* PROFILE_MODAL_FINAL_STACK_V1 */
.profile-modal:not([hidden]) {
  display: grid !important;
  place-items: center !important;
  padding: 20px !important;
  pointer-events: auto !important;
}
.profile-modal-overlay,
.profile-modal__overlay {
  position: absolute !important;
  inset: 0 !important;
}
.profile-modal-card,
.profile-modal__card {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: min(560px, calc(100vw - 32px)) !important;
  max-height: calc(100dvh - 32px) !important;
  overflow: auto !important;
}

/* SEARCH_ICON_FINAL_CONTRACT_V1 */
.header-search-submit,
.header-search-submit:hover,
.header-search-submit:active,
.header-search-submit:focus,
.header-search-submit:focus-visible {
  font-size: 0 !important;
  text-indent: 0 !important;
}
.header-search-submit::before,
.header-search-submit::after {
  content: none !important;
}
.header-search-submit-icon {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Mobile notification access: the topbar itself is visible only on
   data-show-mobile-header=1 pages, so reserve real search space for the bell. */
@media (max-width: 768px) {
  body[data-show-mobile-header="1"][data-authenticated="1"] .header-search-zone {
    padding-right: 48px;
  }

  body[data-show-mobile-header="1"][data-authenticated="1"] .mobile-header-notifications {
    display: inline-grid !important;
  }
}
