/* Mobile account readability. Loaded last so both the route page and legacy shell stay legible. */
html.language-switching body::after {
  position: fixed;
  z-index: 2147483647;
  inset: 0;
  content: "";
  background: var(--theme-page, var(--theme-surface, #fff));
  pointer-events: all;
}

@media (max-width: 760px) {
  .account-route-title h1 { font-size: 21px !important; }

  .member-dashboard-profile { padding: 18px 16px; grid-template-columns: 60px minmax(0, 1fr) 42px; gap: 13px; }
  .member-dashboard-avatar { width: 60px; height: 60px; font-size: 22px; }
  .member-dashboard-profile .kicker { font-size: 12px !important; }
  .member-dashboard-profile h2 { margin: 6px 0 8px; font-size: 21px !important; line-height: 1.3; }
  .member-dashboard-profile .buyer-level b { font-size: 14px !important; line-height: 1.45; }
  .member-dashboard-profile .buyer-level em { font-size: 12px !important; }
  .member-settings-button { width: 42px; height: 42px; }
  .member-settings-button .ui-icon { width: 22px; height: 22px; }

  .member-benefit-strip > button,
  .member-benefit-strip > div { min-height: 78px; padding: 13px 7px; }
  .member-benefit-strip span { font-size: 13px !important; line-height: 1.4; }
  .member-benefit-strip strong { margin-top: 7px; font-size: 19px !important; line-height: 1.25; }

  .member-order-shortcuts > header { min-height: 52px; padding: 0 15px; }
  .member-order-shortcuts h3,
  .member-setting-list h3 { font-size: 18px !important; }
  .member-order-shortcuts > header button { font-size: 14px !important; }
  .member-order-shortcuts > header .ui-icon { width: 18px; height: 18px; }
  .member-order-shortcuts > div > button { min-height: 88px; gap: 9px; }
  .member-order-shortcuts > div > button > span { width: 36px; height: 36px; }
  .member-order-shortcuts > div > button .ui-icon { width: 29px; height: 29px; }
  .member-order-shortcuts > div > button > b { font-size: 14px !important; line-height: 1.4; }
  .member-order-shortcuts > div > button em { min-width: 19px; height: 19px; font-size: 10px; }

  .monthly-coupon-claim { min-height: 94px; padding: 14px; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; }
  .coupon-claim-icon { width: 46px; height: 46px; font-size: 19px; }
  .monthly-coupon-claim b { font-size: 16px !important; line-height: 1.45; }
  .monthly-coupon-claim p { margin: 5px 0; font-size: 14px !important; line-height: 1.5; }
  .monthly-coupon-claim small { font-size: 13px !important; line-height: 1.45; }
  .monthly-coupon-claim > button { min-width: 76px; min-height: 42px; padding: 0 13px; font-size: 14px !important; }

  .member-setting-list h3 { min-height: 54px; padding: 15px 16px; }
  .member-setting-list > button { min-height: 64px !important; padding: 11px 16px !important; }
  .member-setting-list > button > span { gap: 13px; }
  .member-setting-list > button > span .ui-icon { width: 23px; height: 23px; }
  .member-setting-list > button > span > b { font-size: 16px !important; line-height: 1.45; }
  .member-setting-list > button > em { min-width: 24px; height: 24px; font-size: 12px; }
  .member-setting-list > button > .ui-icon { width: 20px; height: 20px; }
  .member-language-setting { min-height: 72px; padding: 11px 16px; grid-template-columns: minmax(0, 1fr) minmax(105px, 36%); gap: 10px; }
  .member-language-setting > span { column-gap: 13px; }
  .member-language-setting > span .ui-icon { width: 23px; height: 23px; }
  .member-language-setting > span b { font-size: 16px !important; line-height: 1.35; }
  .member-language-setting > span small { font-size: 12px !important; line-height: 1.4; }
  .member-language-setting select { min-height: 42px; padding: 0 8px; font-size: 14px !important; }

  .mobile-nav a,
  .mobile-nav button,
  .mobile-nav .nav-label { font-size: 13px !important; }
  .mobile-nav .nav-icon-shell .ui-icon { width: 22px; height: 22px; }

  .header-tools {
    flex: none;
    gap: 4px;
  }
  .header-tools .language-select,
  .header-tools .currency-select,
  .header-tools .profile-btn {
    height: 42px;
    min-height: 42px;
    border-radius: 6px;
    font-size: 13px !important;
    font-weight: 650;
    line-height: 1;
  }
  .header-tools .language-select {
    width: 112px;
    max-width: 112px;
    padding: 0 25px 0 10px;
  }
  .header-tools .currency-select {
    width: 80px;
    max-width: 80px;
    padding: 0 24px 0 10px;
  }
  .header-tools .profile-btn.member-ready {
    width: 42px;
    max-width: 42px;
    padding: 4px;
    justify-content: center;
  }
  .header-tools .profile-btn.member-ready .header-avatar {
    width: 30px;
    height: 30px;
  }
  .header-tools .language-select:focus,
  .header-tools .currency-select:focus,
  .header-tools .profile-btn:focus-visible {
    border-color: var(--blue);
    outline: 2px solid color-mix(in srgb, var(--blue) 24%, transparent);
    outline-offset: 1px;
  }
  .coupon-claim-icon .ui-icon { width: 24px; height: 24px; }

  /* Message center: keep the compact inbox layout, but make every reading level phone-legible. */
  .message-inbox-head .kicker { font-size: 11px !important; line-height: 1.4; }
  .message-inbox-head h2 { margin: 7px 0 7px; font-size: 28px !important; line-height: 1.2; }
  .message-inbox-head p { font-size: 15px !important; line-height: 1.55; }
  .message-inbox-actions { gap: 10px; }
  .message-icon-action { width: 46px; height: 46px; }
  .message-icon-action .ui-icon { width: 21px; height: 21px; }
  .message-inbox-link { min-height: 46px; padding: 0 15px; font-size: 15px !important; }

  .message-search { height: 50px; padding: 0 14px; margin-bottom: 12px; gap: 10px; }
  .message-search .ui-icon { width: 20px; height: 20px; }
  .message-search input { font-size: 16px !important; line-height: 1.4; }

  .message-thread-list { gap: 0; }
  .message-thread {
    min-height: 92px;
    padding: 12px 10px;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
  }
  .message-thread-avatar { width: 52px; height: 52px; font-size: 18px; }
  .message-thread-copy b { font-size: 16px !important; line-height: 1.35; }
  .message-thread-copy small { margin-top: 4px; font-size: 13px !important; line-height: 1.4; }
  .message-thread-copy em { margin-top: 5px; font-size: 14px !important; line-height: 1.4; }
  .message-thread-meta { min-width: 72px; gap: 8px; }
  .message-thread time { font-size: 12px !important; line-height: 1.35; }
  .message-thread mark { padding: 4px 6px; font-size: 11px !important; }
  .message-empty { padding: 52px 18px; }
  .message-empty b { font-size: 18px !important; }
  .message-empty p { font-size: 14px !important; line-height: 1.55; }

  .support-head .kicker { font-size: 11px !important; }
  .support-head h2 { font-size: 20px !important; }
  .support-head p { font-size: 12px !important; }
  .support-viewer { font-size: 12px !important; }
  .chat-product-copy b { font-size: 14px !important; }
  .chat-product-copy small { font-size: 12px !important; }
  .request-intervention { font-size: 13px !important; }
  .chat-message b,
  .chat-message time { font-size: 12px !important; }
  .chat-message p { font-size: 15px !important; }
  .chat-composer button { font-size: 15px !important; }
}

/* Shop-opening step 3 uses checkboxes, not text inputs. Keep the category
   selector compact and make all five progress steps fit on a phone. */
@media (max-width: 760px) {
  .seller-route-page .shop-wizard:has(#shopCategoryForm) {
    max-width: 100%;
    overflow: hidden;
  }

  .seller-route-page .shop-wizard:has(#shopCategoryForm) .wizard-progress {
    display: grid;
    width: 100%;
    margin: 20px 0 22px;
    overflow: visible;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .seller-route-page .shop-wizard:has(#shopCategoryForm) .wizard-progress > div {
    min-width: 0;
    justify-content: center;
  }

  .seller-route-page .shop-wizard:has(#shopCategoryForm) .wizard-progress > div:not(:last-child)::after {
    display: block;
    top: 15px;
    right: -7px;
    left: calc(50% + 19px);
  }

  .seller-route-page .shop-wizard:has(#shopCategoryForm) .wizard-progress span {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    padding: 0;
    font-size: 12px;
    line-height: 1;
  }

  .seller-route-page .shop-wizard:has(#shopCategoryForm) .wizard-progress .done span {
    font-size: 0;
  }

  .seller-route-page .shop-wizard:has(#shopCategoryForm) .wizard-progress .done span::before {
    content: "\2713";
    font-size: 15px;
    font-weight: 800;
  }

  .seller-route-page .shop-wizard:has(#shopCategoryForm) .wizard-body {
    padding: 18px 14px;
  }

  .seller-route-page #shopCategoryForm,
  .seller-route-page #shopCategoryForm .category-picker,
  .seller-route-page #shopCategoryForm .category-options {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .seller-route-page #shopCategoryForm .category-picker h3 {
    margin: 0 0 8px;
    font-size: 19px;
    line-height: 1.4;
  }

  .seller-route-page #shopCategoryForm .category-picker p {
    font-size: 14px;
    line-height: 1.65;
  }

  .seller-route-page #shopCategoryForm .category-options {
    display: grid;
    margin-top: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .seller-route-page #shopCategoryForm .category-options label {
    display: grid;
    width: auto;
    min-width: 0;
    min-height: 66px;
    max-height: none;
    padding: 10px;
    overflow: hidden;
    grid-template-columns: 20px 32px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
  }

  .seller-route-page #shopCategoryForm .category-options input[type="checkbox"] {
    display: block;
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 4px;
    box-sizing: border-box;
  }

  .seller-route-page #shopCategoryForm .category-options label > span {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    font-size: 10px;
  }

  .seller-route-page #shopCategoryForm .category-options label > b {
    min-width: 0;
    overflow: visible;
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media (max-width: 370px) {
  .seller-route-page #shopCategoryForm .category-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  body.message-modal-open .mobile-nav a,
  body.message-modal-open .mobile-nav button,
  body.message-modal-open .mobile-nav .nav-label { font-size: 14px !important; }
}

@media (max-width: 399px) {
  .header-tools { gap: 3px; }
  .header-tools .language-select {
    width: 90px;
    max-width: 90px;
    padding-right: 23px;
    padding-left: 8px;
    font-size: 12px !important;
  }
  .header-tools .currency-select {
    width: 72px;
    max-width: 72px;
    padding-right: 22px;
    padding-left: 8px;
    font-size: 12px !important;
  }
  .header-tools .profile-btn.member-ready {
    width: 40px;
    max-width: 40px;
  }

  .member-benefit-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .member-benefit-strip > :nth-child(2) { border-right: 0; }
  .member-benefit-strip > :nth-child(-n + 2) { border-bottom: 1px solid #e7ecf0; }
  .monthly-coupon-claim { grid-template-columns: 44px minmax(0, 1fr); }
  .monthly-coupon-claim > button { width: 100%; grid-column: 1 / -1; }

  .message-thread { min-height: 88px; padding-right: 7px; padding-left: 7px; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 9px; }
  .message-thread-avatar { width: 48px; height: 48px; }
  .message-thread-meta { min-width: 62px; }
  .message-thread time { font-size: 11px !important; }
}

/* Keep every language label readable without pushing the header off-screen. */
.language-select {
  min-width: 0;
  width: 104px;
  max-width: 104px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .header-tools .language-select {
    flex: 0 1 clamp(88px, 26vw, 104px);
    width: clamp(88px, 26vw, 104px);
    max-width: clamp(88px, 26vw, 104px);
    padding-right: 23px;
    padding-left: 9px;
    font-size: 12px !important;
  }
  .header-tools .currency-select {
    flex: 0 1 clamp(70px, 21vw, 80px);
    width: clamp(70px, 21vw, 80px);
    max-width: clamp(70px, 21vw, 80px);
  }
}

/* iPhone-sized screens: give inbox rows enough room for the title, context and
   latest message. The old fixed-height rows clipped the third line behind the
   next row and made the list feel unnecessarily dense. */
@media (max-width: 760px) {
  .message-detail-modal input,
  .message-detail-modal textarea,
  .presale-modal input,
  .presale-modal textarea,
  .message-modal input[type="search"] {
    font-size: 16px !important;
    line-height: 1.4;
  }

  .message-detail-modal,
  .message-detail-modal #modalContent,
  .message-detail-modal .support-shell,
  .presale-modal,
  .presale-modal #modalContent,
  .presale-modal .presale-chat { width: 100%; max-width: 100%; box-sizing: border-box; }

  .message-modal .message-thread-list {
    padding: 3px 0 calc(18px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .message-modal .message-swipe-row,
  .message-modal .message-swipe-content {
    min-height: 110px;
  }

  .message-modal .message-thread {
    min-height: 110px;
    padding: 14px 10px;
    grid-template-columns: 56px minmax(0, 1fr) 70px;
    align-items: start;
    gap: 12px;
  }

  .message-modal .message-thread-avatar {
    width: 56px;
    height: 56px;
    margin-top: 2px;
    border-radius: 9px;
  }

  .message-modal .message-thread-copy b,
  .message-modal .message-thread-copy small,
  .message-modal .message-thread-copy em {
    overflow: hidden;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .message-modal .message-thread-copy b {
    font-size: 17px !important;
    line-height: 1.35;
    -webkit-line-clamp: 2;
  }

  .message-modal .message-thread-copy small {
    margin-top: 5px;
    font-size: 14px !important;
    line-height: 1.45;
    -webkit-line-clamp: 2;
  }

  .message-modal .message-thread-copy em {
    margin-top: 6px;
    font-size: 15px !important;
    line-height: 1.45;
    -webkit-line-clamp: 2;
  }

  .message-modal .message-thread-meta {
    min-width: 70px;
    gap: 9px;
    align-items: flex-end;
  }

  .message-modal .message-thread time {
    font-size: 12px !important;
    line-height: 1.4;
  }

  .message-modal .message-thread mark {
    padding: 4px 6px;
    font-size: 11px !important;
  }
}
