.app-alert {
  padding: 0;
  border: 0;
  margin: auto;
  color: inherit;
  background: transparent;
  max-width: min(440px, calc(100% - 2rem));
  width: min(440px, calc(100% - 2rem));
  max-height: min(90dvh, calc(100% - 2rem));
  overflow: hidden;
  overscroll-behavior: contain;
  font-family: inherit;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition:
    opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

html:has(.app-alert[open]),
html.is-app-alert-open {
  overflow: hidden !important;
}

.app-alert.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-alert.is-closing {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-alert::backdrop {
  background: rgba(18, 35, 63, 0.48);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  opacity: 0;
  overflow: hidden;
  transition:
    opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    backdrop-filter 0.45s ease,
    -webkit-backdrop-filter 0.45s ease;
}

.app-alert.is-open::backdrop {
  opacity: 1;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app-alert.is-closing::backdrop {
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition:
    opacity 0.28s ease,
    backdrop-filter 0.28s ease,
    -webkit-backdrop-filter 0.28s ease;
}

.app-alert-card {
  position: relative;
  overflow: hidden;
  max-height: inherit;
  padding: 0 0 1.5rem;
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(50, 139, 244, 0.14), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(27, 76, 147, 0.08), transparent 50%),
    #fff;
  border: 1px solid #C9DCF5;
  box-shadow:
    0 28px 64px rgba(27, 76, 147, 0.2),
    0 2px 0 rgba(255, 255, 255, 0.7) inset;
  text-align: center;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.04s,
    transform 0.48s cubic-bezier(0.22, 1, 0.36, 1) 0.04s;
}

.app-alert.is-open .app-alert-card {
  opacity: 1;
  transform: none;
}

.app-alert.is-closing .app-alert-card {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity 0.24s ease,
    transform 0.26s ease;
}

.app-alert-hero {
  position: relative;
  padding: 1.65rem 1.5rem 1.15rem;
  background: linear-gradient(180deg, #E8F1FC 0%, rgba(232, 241, 252, 0) 100%);
}

.app-alert-hero::after {
  content: "";
  position: absolute;
  inset-inline: 1.5rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    to left,
    transparent,
    color-mix(in srgb, #2669C0 45%, transparent) 35%,
    color-mix(in srgb, #2669C0 45%, transparent) 65%,
    transparent
  );
}

.app-alert-icon {
  position: relative;
  z-index: 1;
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transform: scale(0.82);
  opacity: 0;
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.12s,
    opacity 0.4s ease 0.1s;
}

.app-alert.is-open .app-alert-icon {
  transform: scale(1);
  opacity: 1;
}

.app-alert-icon::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, #2669C0 22%, transparent);
  opacity: 0.9;
}

.app-alert-glyph {
  display: none;
  place-items: center;
  width: 100%;
  height: 100%;
}

.app-alert-glyph .icon,
.app-alert-glyph svg {
  width: 30px;
  height: 30px;
}

.app-alert-card[data-alert-type="success"] .is-success,
.app-alert-card[data-alert-type="info"] .is-info,
.app-alert-card[data-alert-type="warning"] .is-warning,
.app-alert-card[data-alert-type="error"] .is-error {
  display: grid;
}

.app-alert-card[data-alert-type="success"] .app-alert-icon,
.app-alert-card[data-alert-type="info"] .app-alert-icon {
  color: #fff;
  background: linear-gradient(145deg, #1B4C93 0%, #2669C0 48%, #328BF4 100%);
  box-shadow:
    0 12px 28px rgba(38, 105, 192, 0.35),
    0 0 0 8px rgba(38, 105, 192, 0.1);
}

.app-alert-card[data-alert-type="warning"] .app-alert-icon {
  color: #8a5a12;
  background: linear-gradient(145deg, #F7F3EA, #E8D9B8);
  box-shadow:
    0 12px 28px rgba(201, 169, 110, 0.28),
    0 0 0 8px rgba(201, 169, 110, 0.12);
}

.app-alert-card[data-alert-type="error"] .app-alert-icon {
  color: #fff;
  background: linear-gradient(145deg, #b42318, #C94F4F 55%, #d97878);
  box-shadow:
    0 12px 28px rgba(201, 79, 79, 0.3),
    0 0 0 8px rgba(201, 79, 79, 0.1);
}

.app-alert-body {
  padding: 1.2rem 1.6rem 0;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.38s ease 0.14s,
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.14s;
}

.app-alert.is-open .app-alert-body {
  opacity: 1;
  transform: none;
}

.app-alert-title {
  margin: 0 0 0.55rem;
  font-size: 1.22rem;
  font-weight: 800;
  color: #12233F;
  letter-spacing: -0.01em;
  line-height: 1.45;
}

.app-alert-message {
  margin: 0 auto 1.35rem;
  max-width: 34ch;
  color: #3D5270;
  line-height: 1.95;
  white-space: pre-line;
  font-size: 0.94rem;
  max-height: min(36vh, 12rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-alert-btn {
  min-width: 148px;
  padding: 0.78rem 1.55rem;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.app-alert-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.app-alert-btn:active {
  transform: translateY(0);
}

.app-alert-card[data-alert-type="success"] .app-alert-btn,
.app-alert-card[data-alert-type="info"] .app-alert-btn {
  background: linear-gradient(90deg, #1B4C93 0%, #2669C0 50%, #328BF4 100%);
  box-shadow: 0 10px 22px rgba(38, 105, 192, 0.28);
}

.app-alert-card[data-alert-type="warning"] .app-alert-btn {
  background: linear-gradient(135deg, #b54708, #f79009);
  box-shadow: 0 10px 22px rgba(181, 71, 8, 0.22);
}

.app-alert-card[data-alert-type="error"] .app-alert-btn {
  background: linear-gradient(135deg, #b42318, #f04438);
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  .app-alert,
  .app-alert-card,
  .app-alert-icon,
  .app-alert-body,
  .app-alert::backdrop {
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 480px) {
  .app-alert-hero {
    padding: 1.4rem 1.15rem 1rem;
  }
  .app-alert-body {
    padding-inline: 1.15rem;
  }
  .app-alert-title {
    font-size: 1.1rem;
  }
  .app-alert-btn {
    width: calc(100% - 0.5rem);
  }
}
