html,
body {
  max-width: 100%;
}

body,
.admin-shell {
  min-height: 100dvh;
}

.stage {
  min-height: calc(100dvh - 130px);
}

.modal-box,
.admin-drawer {
  max-height: calc(100dvh - 40px);
}

.admin-sidebar {
  height: 100dvh;
}

:where(img, svg, canvas, video) {
  max-width: 100%;
}

:where(input, textarea, select, button) {
  min-width: 0;
}

:where(h1, h2, h3, h4, p, li, label, button, a, td, th):not(.studio-paper *):not(.protected-preview *) {
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .stage {
    min-height: calc(100dvh - 96px);
  }

  .modal {
    align-items: start;
    overflow-y: auto;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .modal-box {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .admin-sidebar {
    position: relative;
    height: auto;
  }

  .admin-sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-sidebar nav a,
  .admin-sidebar > button,
  button,
  [role="button"] {
    min-height: 44px;
  }

  .credit-info-button {
    box-sizing: border-box;
    flex: 0 0 21px;
    width: 21px;
    height: 21px;
    min-width: 21px;
    min-height: 21px;
    max-width: 21px;
    max-height: 21px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
  }

  .site-footer-links a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding-block: 6px;
  }

  .admin-sidebar nav a {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .admin-main,
  .admin-panel,
  .admin-top,
  .panel-head {
    min-width: 0;
    max-width: 100%;
  }

  .admin-table-wrap,
  .table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .admin-drawer {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    padding: 26px 16px;
  }

  .site-lock-overlay {
    min-height: 100dvh;
  }
}

@media (max-width: 420px) {
  .admin-sidebar nav {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
