html.app-modal-open,
body.app-modal-open {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
}

.app-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-modal-layer[hidden] {
  display: none;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / .58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.app-modal-shell {
  position: relative;
  width: min(840px, 100%);
  max-height: min(820px, calc(100dvh - 48px));
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.app-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.app-modal-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.app-modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

@media (max-width: 600px) {
  .app-modal-layer {
    padding: 0;
  }

  .app-modal-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .app-modal-head {
    padding: 14px 16px;
  }

  .app-modal-body {
    padding: 16px;
  }
}
