.toast-container {
  position: fixed;
  z-index: 2147483000;
  top: 20px;
  right: 20px;
  display: flex;
  width: min(390px, calc(100vw - 40px));
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.site-toast {
  --toast-accent: #328dff;
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  gap: 11px;
  overflow: hidden;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--toast-accent) 48%, #34255e);
  border-radius: 15px;
  color: #f8f5ff;
  background: linear-gradient(145deg, rgba(40, 18, 75, 0.98), rgba(13, 17, 35, 0.98));
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.48), 0 0 22px color-mix(in srgb, var(--toast-accent) 22%, transparent);
  pointer-events: auto;
  animation: toast-enter 240ms ease-out both;
}

.toast-success { --toast-accent: #3af3e0; }
.toast-info { --toast-accent: #328dff; }
.toast-warning { --toast-accent: #ffb52e; }
.toast-error { --toast-accent: #ff4f70; }

.toast-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--toast-accent) 50%, transparent);
  border-radius: 11px;
  color: var(--toast-accent);
  background: color-mix(in srgb, var(--toast-accent) 14%, transparent);
}

.toast-copy {
  min-width: 0;
}

.toast-title {
  display: block;
  margin-top: 1px;
  font-size: 0.95rem;
  line-height: 1.3;
}

.toast-message {
  margin: 4px 0 0;
  color: #c5c9db;
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.toast-close,
.toast-action {
  min-height: 34px;
  border: 1px solid #363352;
  border-radius: 9px;
  color: #d9d9e8;
  background: rgba(13, 17, 35, 0.72);
  cursor: pointer;
}

.toast-close {
  width: 34px;
  padding: 0;
}

.toast-close:hover,
.toast-close:focus-visible,
.toast-action:hover,
.toast-action:focus-visible {
  border-color: var(--toast-accent);
  outline: none;
}

.toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.toast-action {
  padding: 6px 12px;
}

.toast-action-primary {
  border-color: color-mix(in srgb, var(--toast-accent) 70%, #6735c4);
  color: #fff;
  background: linear-gradient(135deg, #6c25d7, #431391);
}

.toast-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--toast-accent);
  transform-origin: left;
}

.toast-leaving {
  animation: toast-leave 220ms ease-in both;
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateX(28px) scale(0.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-leave {
  to { opacity: 0; transform: translateX(28px) scale(0.98); }
}

@media (max-width: 768px) {
  .toast-container {
    top: auto;
    right: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: min(100% - 20px, 520px);
    transform: translateX(50%);
  }

  .site-toast {
    grid-template-columns: 38px minmax(0, 1fr) 42px;
    padding: 13px;
    border-radius: 14px;
  }

  .toast-close {
    width: 42px;
    min-height: 42px;
  }

  .toast-action {
    min-height: 42px;
    flex: 1 1 110px;
  }

  @keyframes toast-enter {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes toast-leave {
    to { opacity: 0; transform: translateY(24px) scale(0.98); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-toast,
  .toast-leaving {
    animation-duration: 1ms !important;
  }
}
