.site-alert-stack {
  position: absolute;
  top: 86px;
  left: 50%;
  z-index: 1400;
  width: min(720px, calc(100% - 32px));
  display: grid;
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.site-alert {
  --site-alert-accent: var(--ct-primary);
  --site-alert-accent-rgb: var(--ct-rgb-primary);

  position: relative;
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 10px 12px 10px 10px;
  border: 1px solid rgb(var(--site-alert-accent-rgb) / 0.24);
  border-radius: 16px;
  color: var(--ct-ink);
  background: rgb(var(--ct-rgb-surface) / 0.92);
  box-shadow:
    0 18px 50px rgb(var(--ct-rgb-ink) / 0.14),
    inset 0 1px 0 rgb(255 255 255 / 0.65);
  backdrop-filter: blur(18px) saturate(1.15);
  pointer-events: auto;
  animation: site-alert-enter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.site-alert::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--site-alert-accent);
}

.site-alert--success {
  --site-alert-accent: #22c55e;
  --site-alert-accent-rgb: 34 197 94;
}

.site-alert--error,
.site-alert--danger {
  --site-alert-accent: #ef4444;
  --site-alert-accent-rgb: 239 68 68;
}

.site-alert--warning {
  --site-alert-accent: #f59e0b;
  --site-alert-accent-rgb: 245 158 11;
}

.site-alert--info {
  --site-alert-accent: #3b82f6;
  --site-alert-accent-rgb: 59 130 246;
}

.site-alert__icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--site-alert-accent);
  background: rgb(var(--site-alert-accent-rgb) / 0.11);
  font-size: 1rem;
}

.site-alert__text {
  min-width: 0;
  color: var(--ct-ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.85;
}

.site-alert__close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--ct-muted);
  background: transparent;
  cursor: pointer;
  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    transform 0.18s ease;
}

.site-alert__close:hover {
  color: var(--ct-ink);
  background: var(--ct-surface-soft);
  transform: rotate(4deg);
}

.site-alert__progress {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  transform-origin: right center;
  background: var(--site-alert-accent);
  opacity: 0.72;
  animation: site-alert-progress 5.5s linear forwards;
}

.site-alert.is-leaving {
  animation: site-alert-leave 0.24s ease forwards;
}

html[data-theme="dark"] .site-alert {
  border-color: rgb(var(--site-alert-accent-rgb) / 0.28);
  background: rgb(14 22 32 / 0.9);
  box-shadow:
    0 20px 54px rgb(0 0 0 / 0.34),
    inset 0 1px 0 rgb(255 255 255 / 0.05);
}

html[data-theme="dark"] .site-alert__text {
  color: #f8fafc;
}

html[data-theme="dark"] .site-alert__close {
  color: rgb(248 250 252 / 0.62);
}

html[data-theme="dark"] .site-alert__close:hover {
  color: #fff;
  background: rgb(255 255 255 / 0.07);
}

@keyframes site-alert-enter {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.98);
    filter: blur(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes site-alert-leave {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
    filter: blur(3px);
  }
}

@keyframes site-alert-progress {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (max-width: 767px) {
  .site-alert-stack {
    top: 78px;
    width: min(100% - 20px, 560px);
    gap: 8px;
  }

  .site-alert {
    min-height: 54px;
    grid-template-columns: 36px minmax(0, 1fr) 30px;
    gap: 8px;
    padding: 9px 10px 9px 8px;
    border-radius: 14px;
  }

  .site-alert__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.9rem;
  }

  .site-alert__text {
    font-size: 0.82rem;
    line-height: 1.75;
  }

  .site-alert__close {
    width: 28px;
    height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-alert,
  .site-alert__progress,
  .site-alert.is-leaving {
    animation: none;
  }
}
