/* app.vue supplies the configured width and loads this stylesheet with
   the same unfolded-screen media query. */
html body.mobile-layout-page {
  background-color: #e8edf3;
}

html body.mobile-layout-page.theme-dark-page {
  background-color: #080d17;
}

html.mobile-layout-page body.mobile-layout-page #__nuxt {
  width: var(--fold-layout-width);
  min-width: 0;
  max-width: var(--fold-layout-width);
  margin-inline: auto;
}

html body.mobile-layout-page #__nuxt .app-shell.mobile-layout {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-inline: auto;
}

/* Size tracks from the available list width, including for loading placeholders.
   The percentage floor keeps wide columns from packing a fifth card. */
html body.mobile-layout-page .app-shell.mobile-layout.view-home :is(.mobile-comic-rail, .mobile-ranking-rail, .mobile-skeleton-card-row),
html body.mobile-layout-page .app-shell.mobile-layout:is(.view-hall, .view-search) .hall-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(145px, 21%)), 1fr)) !important;
}

/* Fixed and teleported surfaces still use the viewport as their containing
   block, so align them to the same column as the app shell. */
html body.mobile-layout-page :is(
  .app-shell.mobile-layout > .topbar,
  .app-shell.mobile-layout .mobile-account-logo-topbar,
  .app-shell.mobile-layout .mobile-bottom-nav,
  .app-shell.mobile-layout.view-register-success .register-success-main,
  .public-mobile-fixed-topbar,
  .public-mobile-fixed-bottom-actions,
  .mobile-account-page-panel,
  .mobile-comic-version-page-panel,
  .app-shell.ssr-reader-shell.mobile-layout > .mobile-detail-page-panel:not(.mobile-reader-fullscreen),
  .mobile-detail-page-panel:not(.mobile-reader-fullscreen)
) {
  box-sizing: border-box;
  inset-inline: 0;
  width: var(--fold-layout-width);
  min-width: 0;
  max-width: var(--fold-layout-width);
  margin-inline: auto;
}

/* Let artwork and the page strip fill the centered column. */
html body.mobile-layout-page :is(.app-shell.ssr-reader-shell.mobile-layout > .mobile-detail-page-panel, .mobile-detail-page-panel)
  :is(.mobile-reader-anchor-zone, .work-reader, .mobile-serialized-flip-reader) {
  width: 100%;
  max-width: var(--fold-layout-width);
  margin-inline: auto;
}

html body.mobile-layout-page :is(.app-shell.ssr-reader-shell.mobile-layout > .mobile-detail-page-panel, .mobile-detail-page-panel):not(.mobile-reader-fullscreen)
  :is(.page-list, .page-image img) {
  width: 100%;
}

html body.mobile-layout-page .mobile-detail-page-panel .mobile-chapter-comments-drawer,
html body.mobile-layout-page .detail-share-sheet {
  max-width: var(--fold-layout-width);
  margin-inline: auto;
}

html body.mobile-layout-page .mobile-reader-fullscreen .mobile-reader-fullscreen-exit {
  right: max(calc(var(--fold-layout-side) + 8px), env(safe-area-inset-right));
}

/* The floating control has an inline viewport offset on reader pages. */
html body.mobile-layout-page .public-back-top-button {
  right: max(calc(var(--fold-layout-side) + 0.75rem), env(safe-area-inset-right)) !important;
}
