.ac-toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  top: auto;
  left: auto;
  z-index: 10050;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 12px;
  max-width: min(400px, calc(100vw - 32px));
  pointer-events: none;
  font-family: "Outfit", "Segoe UI", system-ui, sans-serif;
}

body.ac-page .ac-toast-root {
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  bottom: auto;
  flex-direction: column;
}

.ac-toast {
  --ac-c: #00e676;
  --ac-c-glow: rgba(0, 230, 118, 0.42);
  --ac-fg: #ffffff;
  --ac-bg: rgba(18, 18, 24, 0.82);
  --ac-toast-ms: 4000ms;

  position: relative;
  pointer-events: auto;
  margin: 0;
  width: min(380px, calc(100vw - 32px));
  padding: 14px 14px 14px 16px;
  border-radius: 14px;
  display: grid;
  grid-template-columns: 40px 1fr 28px;
  align-items: start;
  gap: 0 12px;
  color: var(--ac-fg);
  background: var(--ac-bg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 48px -12px var(--ac-c-glow);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  overflow: hidden;

  opacity: 0;
  transform: translateX(12px) translateY(-6px) scale(0.98);
  transition:
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s ease;
}

.ac-toast:hover {
  transform: translateX(0) translateY(-2px) scale(1);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 56px -8px var(--ac-c-glow);
}

.ac-toast.is-in {
  opacity: 1;
  transform: translateX(0) translateY(0) scale(1);
}

.ac-toast.is-out {
  opacity: 0;
  transform: translateX(8px) translateY(-4px) scale(0.97);
  transition:
    opacity 0.26s ease,
    transform 0.26s ease;
  pointer-events: none;
}

.ac-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--ac-c);
  border-radius: 14px 0 0 14px;
  box-shadow: 0 0 18px var(--ac-c-glow);
}

.ac-toast__icon-box {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--ac-c);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  margin-top: 1px;
}

.ac-toast__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-top: 2px;
}

.ac-toast__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ac-fg);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.ac-toast__msg {
  font-size: 13px;
  font-weight: 450;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
  word-break: break-word;
}

.ac-toast__close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.14s, color 0.14s;
  flex-shrink: 0;
  margin-top: 6px;
}

.ac-toast__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
}

.ac-toast__progress {
  grid-column: 1 / -1;
  height: 2px;
  margin-top: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ac-c), rgba(255, 255, 255, 0.35));
  opacity: 0.65;
  transform-origin: left center;
  animation: acToastProgress var(--ac-toast-ms) linear forwards;
}

.ac-toast.is-paused .ac-toast__progress {
  animation-play-state: paused;
}

.ac-toast--loading .ac-toast__progress {
  display: none;
}

@keyframes acToastProgress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.ac-toast--success {
  --ac-c: #00e676;
  --ac-c-glow: rgba(0, 230, 118, 0.45);
}

.ac-toast--error {
  --ac-c: #ff4d4d;
  --ac-c-glow: rgba(255, 77, 77, 0.5);
}

.ac-toast--warning {
  --ac-c: #ffd600;
  --ac-c-glow: rgba(255, 214, 0, 0.42);
}

.ac-toast--warning .ac-toast__icon-box {
  color: #ffd600;
}

.ac-toast--info {
  --ac-c: #00b0ff;
  --ac-c-glow: rgba(0, 176, 255, 0.48);
}

.ac-toast--loading {
  --ac-c: rgba(255, 255, 255, 0.85);
  --ac-c-glow: rgba(255, 255, 255, 0.22);
}

.ac-toast--loading .ac-toast__icon-box {
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="light"] .ac-toast {
  --ac-fg: #0f172a;
  --ac-bg: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.95) inset,
    0 12px 36px rgba(15, 23, 42, 0.12),
    0 0 40px -12px var(--ac-c-glow);
}

html[data-theme="light"] .ac-toast:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.98) inset,
    0 16px 42px rgba(15, 23, 42, 0.14),
    0 0 48px -10px var(--ac-c-glow);
}

html[data-theme="light"] .ac-toast__msg {
  color: rgba(15, 23, 42, 0.62);
}

html[data-theme="light"] .ac-toast__close {
  color: rgba(15, 23, 42, 0.38);
}

html[data-theme="light"] .ac-toast__close:hover {
  background: rgba(15, 23, 42, 0.07);
  color: rgba(15, 23, 42, 0.88);
}

html[data-theme="light"] .ac-toast--loading .ac-toast__icon-box {
  color: #475569;
}

@media (max-width: 600px) {
  .ac-toast-root {
    bottom: max(16px, env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    max-width: none;
    align-items: stretch;
  }

  body.ac-page .ac-toast-root {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    flex-direction: column-reverse;
  }

  .ac-toast {
    width: 100%;
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ac-toast {
    transition-duration: 0.01s;
  }

  .ac-toast:hover {
    transform: none;
  }

  .ac-toast__progress {
    animation-duration: 0.01ms;
  }
}
