#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 12px 14px;
    border-radius: 999px;
    min-width: 200px;
    max-width: min(420px, calc(100vw - 32px));
    pointer-events: auto;
    cursor: default;
    user-select: none;
    position: relative;
    overflow: hidden;

    /* Glass */
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.10),
        0 1px 4px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);

    /* Entrance */
    animation: toast-in 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    will-change: transform, opacity;
}

.toast.toast-hiding {
    animation: toast-out 0.32s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .toast {
        background: rgba(30, 30, 32, 0.78);
        border-color: rgba(255, 255, 255, 0.10);
        box-shadow:
            0 4px 24px rgba(0, 0, 0, 0.45),
            0 1px 4px rgba(0, 0, 0, 0.30),
            inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }
}

/* Also support .dark class on <html> */
.dark .toast {
    background: rgba(30, 30, 32, 0.78);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.45),
        0 1px 4px rgba(0, 0, 0, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.toast-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.toast-icon-wrap svg {
    width: 15px;
    height: 15px;
}

.toast-message {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: #1c1c1e;
    flex: 1;
}

@media (prefers-color-scheme: dark) {
    .toast-message {
        color: #f2f2f7;
    }
}

.dark .toast-message {
    color: #f2f2f7;
}

.toast-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(120, 120, 128, 0.16);
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(120, 120, 128, .28);
}

.toast-close svg {
    width: 9px;
    height: 9px;
    color: #636366;
}

@media (prefers-color-scheme: dark) {
    .toast-close svg {
        color: #aeaeb2;
    }
}

.dark .toast-close svg {
    color: #aeaeb2;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 999px 999px;
    transform-origin: left;
    animation: toast-progress linear forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-18px) scale(0.92);
    }

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

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-12px) scale(0.94);
    }
}

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

    to {
        transform: scaleX(0);
    }
}

@media (max-width: 480px) {
    #toast-container {
        top: 14px;
    }

    .toast {
        padding: 11px 14px 11px 12px;
        gap: 8px;
        min-width: 160px;
    }

    .toast-message {
        font-size: 13px;
    }
}