/* Account screens: load after mobile.css and marketplace.css.
   All layout overrides stop below desktop; money and account state stay in their existing code. */
@media (max-width: 1099px) {
  /* Let content shrink inside cards instead of widening the viewport. */
  :is(.wiz, .bal-shell, .set-shell, .auth2-shell, .sp, #my-lots-root) {
    min-width: 0;
  }
  :is(.wiz, .bal-shell, .set-shell, .auth2-shell, #my-lots-root) [hidden] {
    display: none !important;
  }
  :is(.wiz, .bal-shell, .set-shell, .auth2-shell) :is(input, textarea, select) {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    scroll-margin-block: 110px 110px;
  }
  :is(.wiz .field, .set-input, .bal-shell .form__row input, .bal-shell select) {
    min-height: 48px;
    font-size: 16px;
  }
  :is(.wiz-btn, .drop-pick, .drop-paste, .bal-shell .form__submit,
      .set-actions .btn, .set-actions .form__submit, .auth2-submit,
      .p-deposit__btn, .p-fit__btn, .p-fit__save, .mc-btn, .mc-tool) {
    min-height: 44px;
    touch-action: manipulation;
  }
  :is(.wiz__body, .wiz-split, .set-grid, .set-card, .auth2-card, .bal-panel,
      .sp-main, .sp-side, .mc-grid, .mc-item) > * {
    min-width: 0;
  }

  /* Listing creation: enough room for fields and touch controls at tablet widths. */
  .wiz-shell .wiz { padding: 26px; }
  .wiz-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wiz__title { line-height: 1.2; }
  .wiz__head { flex-wrap: wrap; }
  .wiz__head a { display: inline-flex; align-items: center; min-height: 44px; }
  .wiz__body { min-height: 260px; }
  .wiz-game-search__clear { width: 44px; height: 44px; right: 2px; }
  .wiz-quick__txt { min-width: 0; overflow-wrap: anywhere; }
  .wiz .field-row :is(label, .field-row__hint, .field-row__err) { line-height: 1.5; }
  .wiz .field-row__hint { font-size: 13px; }
  .wiz .switch input { flex: 0 0 44px; }
  .wiz .drop-pick { display: inline-flex; align-items: center; justify-content: center; border: 0; font-family: inherit; }
  .wiz .drop-paste { justify-content: center; }
  .wiz :is(.drop-pick, .drop-paste, .drop-tile__rm):focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
  .wiz .drop-view__nav { width: 44px; height: 44px; }
  .wiz .drop-tile__rm { width: 44px; height: 44px; top: 2px; right: 2px; font-size: 22px; }
  .wiz .drop-tile__badge { top: auto; bottom: 6px; }
  .wiz .review-block__row { display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 8px 14px; padding: 8px 0; }
  .wiz .review-block__row b { text-align: right; overflow-wrap: anywhere; }

  /* Wallet: payment methods keep readable titles even with five providers. */
  .bal-shell .pm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bal-shell :is(.pm-tile__name, .pm-tile__sub, .bal-msg, .bal-out small, .op__sub) { overflow-wrap: anywhere; }
  .bal-shell .bal-panel__sub { line-height: 1.55; }
  .bal-shell .bal-quick { gap: 8px; }
  .bal-shell .bal-quick button { min-height: 44px; height: auto; padding: 10px 14px; }
  .bal-shell .bal-link { display: inline-flex; align-items: center; min-height: 44px; line-height: 1.4; text-align: left; }
  .bal-shell :is(.bal-hero__hold, .bal-avail, .bal-holds__head) { flex-wrap: wrap; }
  .bal-shell :is(.bal-total, .bal-msg, .bal-dest-note) { font-size: 14px; line-height: 1.5; }
  .bal-shell :is(.op__amt, .bal-total b, .bal-holds b, .bal-avail b) { font-variant-numeric: tabular-nums; }
  .bal-shell .ops-filter .rv-chip { min-height: 44px; }
  .bal-shell .bal-tabs .sp-tab { min-height: 48px; }

  /* Settings navigation also works in portrait and landscape on tablets. */
  .set-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .set-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
  .set-nav {
    position: sticky; top: calc(var(--nav-offset, 76px) + 8px); z-index: 5;
    flex-direction: row; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; padding: 6px; background: var(--bg-1);
  }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav__item { width: auto; flex: 0 0 auto; min-height: 46px; padding: 10px 13px; white-space: nowrap; }
  .set-nav__item[aria-selected="true"]::before { display: none; }
  .set-head__sub, .set-status, .set-card__hint, .set-field__hint { overflow-wrap: anywhere; }
  .set-card__hint, .set-field__hint, .set-row__hint { font-size: 13px; line-height: 1.55; }
  .set-card .ref-row { flex-wrap: wrap; gap: 10px; }
  .set-card .ref-row__body { min-width: 0; overflow-wrap: anywhere; }
  .set-card :is(.token-reveal__value, .set-codes) { max-width: 100%; overflow-x: auto; }
  .set-card .set-qr { max-width: 100%; }
  .set-card .set-qr :is(img, canvas) { max-width: 100%; height: auto; }
  .set-link { display: inline-flex; align-items: center; min-height: 44px; }

  /* Account access: keep the full input width for usernames and email. */
  .auth2-inputwrap:not(:has(.auth2-peek)) .set-input { padding-right: 14px; }
  .auth2-inputwrap:has(.auth2-peek) .set-input { min-height: 54px; }
  .auth2-peek { min-height: 44px; right: 5px; }
  .auth2-tab, .auth2-social { min-height: 48px; }
  .auth2-link, .auth2-check:not(.auth2-check--terms) { min-height: 44px; display: inline-flex; align-items: center; }
  .auth2-sub, .auth2-msg, .auth2-hint { overflow-wrap: anywhere; line-height: 1.5; }
  .auth2-check input { width: 20px; height: 20px; }

  /* Profile controls and personal lot actions need visible touch areas. */
  .sp .p-head { grid-template-columns: auto minmax(0, 1fr); }
  .sp .p-actions { grid-column: 1 / -1; }
  .sp .p-actions > * { min-height: 46px; }
  .sp .p-name { overflow-wrap: anywhere; }
  .sp .p-meta { gap: 8px 14px; }
  .sp .p-followers, .sp .p-name-btn, .sp .p-banner__act { min-height: 44px; }
  .sp .p-banner__act--drop { min-width: 44px; }
  .sp .p-avatar__corner { width: 44px; height: 44px; }
  .sp .sp-tab { min-height: 48px; }
  .sp .sp-stat { min-width: 0; }
  .sp .sp-stat__val { overflow-wrap: anywhere; }
  .sp .p-deposit__form { flex-wrap: wrap; width: 100%; }
  .sp .p-deposit__input { flex: 1 1 140px; max-width: 100%; min-height: 46px; font-size: 16px; }
  .p-fit { bottom: calc(var(--mnav-space, 60px) + 12px); max-height: calc(100dvh - var(--mnav-space, 60px) - 88px); overflow-y: auto; }
  #my-lots-root .mc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
  #my-lots-root .mc-btn { height: auto; padding: 12px 10px; white-space: normal; line-height: 1.3; }
  #my-lots-root .mc-tools { gap: 4px; }
  #my-lots-root .mc-tool { height: 44px; }
  #my-lots-root .ml-panel :is(button, select) { min-height: 44px; }
  #my-lots-root .ml-panel :is(div, span, textarea, select) { min-width: 0; max-width: 100%; }
  #my-lots-root .ml-stock__preview { flex: 1; overflow-wrap: anywhere; }
  #my-lots-root .ml-stock__remove { flex: none; min-width: 44px; }

  /* Seller statistics and promo fields must shrink with their grid tracks. */
  #dash-root .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dash-root :is(.dash-tile, .dash-panel, .dash-promo-form > *, .promo-row > *) { min-width: 0; }
  #dash-root .dash-tile__val { white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.25 !important; }
  #dash-root .dash-promo-form { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto !important; }
  #dash-root .dash-promo-form input { min-width: 0; max-width: 100%; min-height: 46px; }
  #dash-root :is(.promo-row__code, .promo-row > div, .top-lot__rev) { overflow-wrap: anywhere; }
  #dash-root .dash-ready__item { flex-wrap: wrap; }
  #dash-root .dash-ready__item > span:nth-child(2) { flex: 1 1 160px; min-width: 0; }
  #dash-root .dash-ready__item a { display: inline-flex; align-items: center; min-height: 44px; }
  .ref-tile { min-width: 0; }
  .ref-tile__val { overflow-wrap: anywhere; line-height: 1.25; }
  .ref-row__sum { max-width: 100%; overflow-wrap: anywhere; }
  .notif-tab, .rw-fchip, .tp-tab, .tp-btn { min-height: 44px; }
  .notif-page__tools, .notif-row__head { flex-wrap: wrap; }
  .notif-row__title { overflow-wrap: anywhere; }
  #tp-toasts { bottom: calc(var(--mnav-space) + var(--tp-me-height, 0px) + 20px); }
  html.is-staff #tp-toasts { bottom: calc(var(--mnav-space) + var(--tp-me-height, 0px) + 78px); }

  /* Achievement dialogs sit above navigation and remain scrollable in landscape. */
  .ach-pop { z-index: 1000; padding: 16px; }
  .ach-pop__card { width: min(360px, 100%); max-height: calc(var(--mobile-vh, 100dvh) - 32px); overflow-y: auto; overscroll-behavior: contain; }
  .ach-pop__btn { min-height: 44px; }
  .p-followers-dialog__close { flex-basis: 44px; width: 44px; height: 44px; }
  .lv-modal__x { width: 44px; height: 44px; }
}

@media (min-width: 761px) and (max-width: 1099px) {
  .wiz-shell--wide .wiz-split { grid-template-columns: minmax(0, 1fr); }
  .wiz-shell--wide .wiz-split__info { position: static; }
  .bal-shell .pm-grid--wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .auth2-shell { grid-template-columns: minmax(0, 1fr); width: min(640px, calc(100% - 48px)); }
}

@media (max-width: 760px) {
  /* Keep wizard actions in the normal flow so the keyboard and bottom bar cannot cover them. */
  .wiz-shell { margin-top: 72px; margin-bottom: 28px; }
  .wiz-shell__hero { width: 96px; height: 96px; top: -72px; right: 14px; }
  .wiz-shell .wiz { padding: 18px 16px; }
  .wiz__head { gap: 4px 12px; margin-bottom: 6px; }
  .wiz__step-lbl { font-size: 12px; }
  .wiz__title { font-size: 23px; margin-bottom: 18px; }
  .wiz__body { min-height: 0; gap: 18px; }
  .wiz__progress { margin-bottom: 20px; gap: 5px; }
  .wiz__cta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
  .wiz__cta .wiz-btn { min-height: 48px; padding: 12px 14px; border-radius: 14px; line-height: 1.3; }
  .wiz-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .wiz-grid--games { gap: 28px 10px; }
  .wiz-tile { padding: 16px 10px; }
  .wiz-tile__info { gap: 7px; padding: 0 10px 12px; }
  .wiz-tile--art .wiz-tile__name { font-size: 13px; line-height: 1.25; }
  .wiz-tile__mini { width: 26px; height: 26px; border-radius: 8px; }
  .wiz .wiz-way { padding: 14px; gap: 10px; }
  .wiz .wiz-way__body b { font-size: 15px; }
  .wiz .field { padding: 12px; }
  .wiz .drop-zone { padding: 14px; border-color: var(--line-hi); }
  .wiz .drop-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .wiz .drop-head b { margin: 0; font-size: 14px; }
  .wiz .drop-pick, .wiz .drop-head .drop-paste { width: 100%; }
  .wiz .drop-hint { font-size: 13px; line-height: 1.55; }
  .wiz .drop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wiz .drop-view__cap { align-items: stretch; }
  .wiz .drop-view__cap .drop-paste { width: 100%; }
  .wiz .review-block { padding: 14px; }

  .bal-shell { margin-top: 20px; }
  .bal-shell .bal-hero.ax { padding: 94px 18px 22px; }
  .bal-shell .bal-hero__val { font-size: clamp(28px, 8vw, 44px); letter-spacing: -.04em; line-height: 1.2; overflow-wrap: anywhere; }
  .bal-shell .bal-hero__inner { min-width: 0; }
  .bal-shell .bal-panel { padding: 18px 14px; }
  .bal-shell .pm-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .bal-shell .pm-tile { grid-template-columns: 112px minmax(0, 1fr); gap: 3px 10px; padding: 14px 12px; min-height: 76px; }
  .bal-shell .pm-tile__ico { gap: 4px; min-width: 0; }
  .bal-shell .pm-brand { min-width: 0; padding-inline: 4px; font-size: 10px; letter-spacing: 0; }
  .bal-shell .pm-brand--mc { padding-right: 14px; }
  .bal-shell .bal-tabs .sp-tab { padding: 10px 8px; gap: 5px; font-size: 13px; }
  .bal-shell .bal-actions .form__submit { width: 100%; min-height: 50px; }
  .bal-shell .bal-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bal-shell .bal-quick button { padding: 10px 6px; }
  .bal-shell .bal-avail { gap: 0 12px; padding: 12px; }
  .bal-shell .bal-out { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .bal-shell .bal-out > * { justify-self: start; }
  .bal-shell .bal-st { white-space: normal; line-height: 1.5; }
  .bal-shell .op { grid-template-columns: 32px minmax(0, 1fr); gap: 6px 10px; padding: 14px 12px; }
  .bal-shell .op__ico { grid-column: 1; grid-row: 1 / span 3; }
  .bal-shell .op__amt { grid-column: 2; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
  .bal-shell .op__date { grid-column: 2; margin-top: 0; min-width: 0; text-align: left; }

  .set-shell { margin-top: 22px; margin-bottom: 36px; }
  .set-head { align-items: flex-start; margin-bottom: 18px; }
  .set-head > div { min-width: 0; }
  .set-head__title { font-size: 28px; }
  .set-grid { grid-template-columns: minmax(0, 1fr); }
  .set-card { padding: 20px 16px; }
  .set-sec__head { margin-bottom: 14px; }
  .set-avatar { gap: 12px; }
  .set-avatar__side { min-width: 0; }
  .set-avatar__side .btn { min-height: 44px; white-space: normal; text-align: center; }
  .set-actions { gap: 10px; }
  .set-actions > :is(button, a) { max-width: 100%; white-space: normal; text-align: center; justify-content: center; }
  .set-actions .set-status { flex-basis: 100%; }
  .set-code { padding: 12px; }
  .set-row { gap: 10px; padding-block: 16px; }
  .auth2-shell { width: calc(100% - 32px); margin-block: 24px 36px; gap: 26px; }
  .auth2-card--form { padding: 22px 16px; }
  .auth2-tabs { display: flex; width: 100%; box-sizing: border-box; }
  .auth2-tab { flex: 1; padding-inline: 8px; }
  .auth2-row { flex-wrap: wrap; gap: 4px 12px; }
  .auth2-socials { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth2-social { padding-inline: 10px; }
  .auth2-submit { min-height: 50px; }

  .sp .p-head { margin-inline: 8px; gap: 14px; }
  .sp .p-name { font-size: 28px; line-height: 1.2; }
  .sp .p-actions { gap: 8px; }
  .sp .p-actions > * { flex: 1 1 140px; padding: 12px !important; }
  .sp .sp-stats { gap: 10px; margin-top: 22px; }
  .sp .sp-stat { padding: 15px; }
  .sp .sp-stat__val { font-size: 23px; line-height: 1.2; }
  .sp .sp-layout { margin-top: 22px; gap: 20px; }
  .sp .sp-side { grid-template-columns: minmax(0, 1fr); }
  .sp .p-bio { padding: 18px 18px 18px 44px; font-size: 15px; overflow-wrap: anywhere; }
  .sp .p-bio::before { left: 14px; }
  .sp .p-deposit__btn { white-space: normal; }
  .p-fit__row input[type="range"] { min-height: 36px; }
  #my-lots-root .mc-grid { grid-template-columns: minmax(0, 1fr); }
  #my-lots-root > div:first-child > .btn { width: 100%; min-height: 48px; justify-content: center; }
  #my-lots-root .mc-item { gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
  #my-lots-root .mc-meta { font-size: 13px; line-height: 1.5; }

  #dash-root .dash-panel { padding: 18px 14px !important; }
  #dash-root .dash-promo-form { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #dash-root .promo-row { grid-template-columns: minmax(0, 1fr) auto !important; }
  #dash-root .promo-row > :first-child { grid-column: 1 / -1; }
  #dash-root .top-lot { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  #dash-root .top-lot__title { grid-column: 1 / -1; }
  #dash-root .dash-alert { flex-wrap: wrap; }
  #dash-root .dash-alert > span:nth-child(2) { flex: 1; min-width: 0; }

  /* Compact public cards also appear in favorites and seller profiles. */
  :is(#fav-root, .sp-main) .lcard__foot { flex-direction: column; align-items: stretch; gap: 9px; }
  :is(#fav-root, .sp-main) .lcard__price { max-width: 100%; white-space: normal; overflow-wrap: anywhere; align-items: flex-start; }
  :is(#fav-root, .sp-main) .lcard__price .lot-price__before { justify-content: flex-start; }
  :is(#fav-root, .sp-main) .lcard__price :is(.lot-price__current, .lot-price__before s) { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .rw-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); }
  .rw-stat { min-width: 0; }
  .rw-stat :is(b, span) { overflow-wrap: anywhere; }
  .dp-step { grid-template-columns: 40px minmax(0, 1fr); padding: 16px; gap: 12px; }
  .dp-step h3 { overflow-wrap: anywhere; }
}

@media (max-width: 480px) {
  #dash-root .dash-grid, .ref-tiles { grid-template-columns: minmax(0, 1fr); }
  .tp-me { flex-wrap: wrap; }
  .tp-me__txt { flex-basis: 150px; overflow-wrap: anywhere; }
  .tp-me > .tp-btn { flex: 1 1 100%; white-space: normal; }
}
