html.app-modal-open {
  overflow: hidden;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.app-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: var(--bg-deep-a78);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);
  cursor: pointer;
}

.app-modal-surface {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: var(--r-2xl);
  background: var(--panel);
  box-shadow: var(--shadow-xl);
  transform: translateY(12px) scale(0.985);
  opacity: 0;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

.app-modal.is-open .app-modal-surface {
  transform: none;
  opacity: 1;
}

.app-modal-surface::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-a00), var(--accent), var(--accent-a00));
  opacity: 0.9;
  pointer-events: none;
}

.app-modal-surface:focus {
  outline: none;
}

.app-modal-surface :is(button, a, input, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.app-modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
}

.app-modal-title {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.app-modal-title h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: var(--fs-3xl);
}

.app-modal-close {
  margin-left: auto;
  border-radius: 50%;
}

.app-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 22px;

}

@media (max-width: 768px) {
  .app-modal {
    top: var(--mobile-header-h, 0px);
    padding: 0;
  }

  .app-modal-surface {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }
}
