html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
}

.main,
#content,
.grid > *,
.card,
.hero {
  min-width: 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 860px) {
  .side {
    width: min(320px, 88vw);
    height: 100vh;
    height: 100dvh;
    padding-top: calc(18px + env(safe-area-inset-top));
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: calc(56px + env(safe-area-inset-top));
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  }

  .only-m,
  .top-acts .icon-btn,
  .top-acts .user-btn,
  .side-h .icon-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .crumb {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-acts {
    min-width: 0;
    gap: 2px;
  }

  #content {
    padding: 16px 14px calc(32px + env(safe-area-inset-bottom));
  }

  .nav-link,
  .btn,
  .tabs button,
  .page-acts > button,
  .page-acts > a {
    min-height: 44px;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select {
    min-height: 44px;
  }

  .overlay {
    align-items: end;
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .modal {
    width: min(100%, 560px);
    max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    border-radius: 20px 20px 12px 12px;
  }

  .modal.wide {
    width: min(100%, 760px);
  }

  .modal-b {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .gal-toolbar {
    align-items: stretch;
  }

  .gal-toolbar > * {
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  .lg-art,
  .lg-side,
  .lg-card,
  .lg-copy,
  .lg-stage {
    min-width: 0;
  }

  .lg-copy h1 {
    overflow-wrap: anywhere;
  }

  .lg-art img {
    max-width: 100%;
    height: auto;
  }

  .lg-card form,
  .lg-card form > *,
  .lg-field,
  .lg-field > div {
    min-width: 0;
    max-width: 100%;
  }

  .topbar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .crumb {
    font-size: 14px;
  }

  #content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .hero {
    padding: 16px;
  }

  .page-acts {
    gap: 6px;
  }

  .page-acts > button,
  .page-acts > a {
    max-width: 100%;
    white-space: normal;
  }

  .tabs {
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 860px) and (max-height: 500px) {
  .overlay {
    align-items: center;
  }
}
