/* ─────────────────────────────────────────────────────────────
   Maki — Toast notifications
   ─────────────────────────────────────────────────────────────
   Visual contract:
     • Bottom-right stack on desktop, full-width top on phones.
     • Glass card, cyan accent line, soft drop shadow.
     • Enter:  slide + fade in 220ms.
     • Exit:   slide + fade out 240ms.
     • Auto-dismiss pulse along the bottom shows remaining time.
   Performance:
     • Compositor-only transforms / opacity for enter/exit.
     • `will-change: transform,opacity` only while a toast is in
       flight (added by JS via the .mk-is-in class).
     • No layout reads after first paint of each toast.
   ───────────────────────────────────────────────────────────── */

.mk-toast-host {
  position: fixed;
  right: 20px;
  bottom: 24px;
  display: flex;
  flex-direction: column-reverse; /* newest on top of the stack */
  gap: 10px;
  z-index: 9999;
  pointer-events: none; /* let clicks pass through the gaps */
  max-width: calc(100vw - 32px);
}

/* Off-screen live region for screen-reader announcements only. */
.mk-toast-sr {
  position: fixed;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── card ───────────────────────────────────────────────── */
.mk-toast {
  position: relative;
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 13px 14px 14px 14px;
  border-radius: 14px;
  background:
    linear-gradient(180deg,
      rgba(15, 26, 46, 0.92) 0%,
      rgba(8, 16, 30, 0.92) 100%);
  border: 1px solid rgba(186, 224, 255, 0.14);
  box-shadow:
    0 18px 50px -18px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  color: var(--text-secondary, #c8d6e8);
  font-family: var(--font-sans,
    'Inter', system-ui, -apple-system, Segoe UI, sans-serif);
  font-size: 13.5px;
  line-height: 1.45;
  overflow: hidden;
  transform: translate3d(20px, 6px, 0);
  opacity: 0;
  transition:
    transform 0.26s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity   0.26s ease;
  will-change: transform, opacity;
}
.mk-toast.mk-is-in {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}
.mk-toast.mk-is-out {
  transform: translate3d(20px, 6px, 0);
  opacity: 0;
}

/* ── icon ──────────────────────────────────────────────── */
.mk-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  flex: 0 0 auto;
  margin-top: 1px;
}
.mk-toast-icon svg { width: 16px; height: 16px; }

.mk-toast-success .mk-toast-icon {
  background: linear-gradient(135deg, #22d3ee, #67e8f9);
  color: #061121;
  box-shadow: 0 6px 14px -6px rgba(34, 211, 238, 0.5);
}
.mk-toast-error .mk-toast-icon {
  background: linear-gradient(135deg, #fb7185, #fda4af);
  color: #2a0814;
  box-shadow: 0 6px 14px -6px rgba(251, 113, 133, 0.5);
}
.mk-toast-info .mk-toast-icon {
  background: linear-gradient(135deg, #93c5fd, #c4e0ff);
  color: #061121;
  box-shadow: 0 6px 14px -6px rgba(147, 197, 253, 0.45);
}

/* ── body ──────────────────────────────────────────────── */
.mk-toast-body { min-width: 0; }
.mk-toast-title {
  color: var(--text-primary, #f4fbff);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.1px;
  margin-bottom: 2px;
}
.mk-toast-msg {
  font-size: 13px;
  color: var(--text-secondary, #c8d6e8);
}

/* ── close button ──────────────────────────────────────── */
.mk-toast-close {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #7a8aa3);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.mk-toast-close:hover {
  color: var(--text-primary, #f4fbff);
  background: rgba(255, 255, 255, 0.05);
}
.mk-toast-close svg { width: 14px; height: 14px; }

/* ── countdown rail ────────────────────────────────────── */
.mk-toast-pulse {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--ice-3, #67e8f9), transparent);
  transform-origin: left center;
  animation: mk-toast-pulse var(--mk-toast-dur, 4200ms) linear forwards;
  opacity: 0.85;
}
.mk-toast-error .mk-toast-pulse {
  background: linear-gradient(90deg, transparent, #fb7185, transparent);
}

@keyframes mk-toast-pulse {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── mobile: stack at the top, full-width ──────────────── */
@media (max-width: 600px) {
  .mk-toast-host {
    right: 12px;
    left: 12px;
    bottom: auto;
    top: 12px;
    max-width: none;
    flex-direction: column; /* newest at top still */
  }
  .mk-toast {
    min-width: 0;
    max-width: none;
    width: 100%;
    padding: 12px 12px 13px;
  }
}

/* ── reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mk-toast {
    transition: opacity 0.18s ease;
    transform: none;
  }
  .mk-toast.mk-is-in,
  .mk-toast.mk-is-out { transform: none; }
  .mk-toast-pulse { animation: none; opacity: 0; }
}
