/* Full-page back buttons use the same chevron and keep their localized names. */
#main :is(
  #orderInquiryBack, #secondaryBack, #pointsBack, #walletBack, #historyBack,
  #historyTrendBack, #guideBack, #exchangeBack, #productBack, #referralBack,
  #chatBack, #wheelHelpBack, #winnerBack
):not(:has(svg)) {
  position: relative;
  inline-size: 44px;
  min-inline-size: 44px;
  min-block-size: 44px;
  font-size: 0 !important;
}
#main :is(
  #orderInquiryBack, #secondaryBack, #pointsBack, #walletBack, #historyBack,
  #historyTrendBack, #guideBack, #exchangeBack, #productBack, #referralBack,
  #chatBack, #wheelHelpBack, #winnerBack
):not(:has(svg))::after {
  position: absolute;
  inset: 50% auto auto 50%;
  inline-size: 9px;
  block-size: 9px;
  border: 0 solid currentColor;
  border-width: 0 0 2px 2px;
  transform: translate(-35%, -50%) rotate(45deg);
  content: "";
  pointer-events: none;
}

#main .order-inquiry {
  display: flex;
  flex-direction: column;
  inline-size: 100%;
  min-block-size: var(--empty-page-size);
  box-sizing: border-box;
  padding-block: max(12px, var(--device-safe-top, 0px)) 8px;
}
#main .order-inquiry-results {
  display: flex;
  flex: 1;
  flex-direction: column;
}
#main .order-inquiry-results:has(> .order-inquiry-card) {
  padding-block-end: 20px;
}
#main .order-inquiry-header {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  column-gap: 4px;
  text-align: center;
}
#main .order-inquiry-header h1 {
  overflow-wrap: anywhere;
}
#main #orderInquiryBack:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 8px;
}

/* The main wrapper already reserves a 20px bottom content inset. */
#main {
  --empty-page-size: calc(
    var(--pwa-window-height, 100dvh) -
    var(--ios-nav-height, calc(74px + var(--device-safe-bottom, 0px))) - 20px
  );
}
#main > :is(
  #storefront-catalog:has(#catalogEmpty:not([hidden])),
  .history-screen:has(:is(#historyNoMatches, #historyServerEmpty):not([hidden])),
  .winner-screen:has(#winnerEmpty:not([hidden])),
  .exchange-page:has(#exchangeEmpty:not([hidden])),
  .account-subpage:has(> .secondary-content > .secondary-empty:only-child)
):not([hidden]) {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-block-size: var(--empty-page-size);
}
#main :is(
  .orders-content:has(> #orderFilterEmpty:not([hidden])),
  .history-page:has(:is(#historyNoMatches, #historyServerEmpty):not([hidden])),
  .history-results:has(> :is(#historyNoMatches, #historyServerEmpty):not([hidden])),
  .winner-content:has(> #winnerEmpty:not([hidden])),
  .exchange-page > .secondary-content:has(#exchangeEmpty:not([hidden])),
  .account-subpage > .secondary-content:has(> .secondary-empty:only-child)
) {
  display: flex;
  flex: 1;
  flex-direction: column;
}
#main :is(
  #winnerEmpty, #exchangeEmpty
):not([hidden]),
#main .account-subpage > .secondary-content > .secondary-empty:only-child {
  margin-block: auto;
}
#main .orders-screen:not(.wheel-records-screen):has(#orderFilterEmpty:not([hidden])) {
  min-block-size: var(--empty-page-size);
}
#main .orders-screen #orderFilterEmpty:not([hidden]) {
  align-self: stretch;
  justify-content: center;
  margin-block: auto;
  padding-block: 16px;
}
#main #storefront-catalog #catalogEmpty:not([hidden]) {
  margin-block: auto;
}
#main #storefront-catalog #catalogEmpty > h2 {
  position: static;
  inline-size: auto;
  block-size: auto;
  margin: 8px 0 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
}
#main .history-screen .history-page .history-results > :is(#historyNoMatches, #historyServerEmpty):not([hidden]) {
  margin-block: auto;
}
#main .order-inquiry-results[aria-busy="true"] > p:not([role="alert"]),
#main .order-inquiry-results > .order-inquiry-empty {
  margin-block: auto;
  padding: 16px 8px;
  color: #526859;
  font-size: 14px;
  text-align: center;
  text-wrap: balance;
}

#main #exchangeEmpty:not([hidden]) {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 8px;
  color: #526859;
  text-align: center;
}
