.toast {
    --toast-rgb: 201, 248, 133;
    position: fixed;
    z-index: 100;
    right: calc(14px + var(--tg-safe-right));
    bottom: calc(30px + var(--tg-safe-bottom));
    left: calc(14px + var(--tg-safe-left));
    width: min(368px, calc(100% - 28px - var(--tg-safe-left) - var(--tg-safe-right)));
    margin-inline: auto;
    min-height: 72px;
    padding: 12px 16px;
    border: 1px solid rgba(var(--toast-rgb), .23);
    border-radius: 21px;
    display: flex;
    align-items: center;
    gap: 12px;
    isolation: isolate;
    overflow: hidden;
    pointer-events: none;
    color: #f5f7f1;
    background:
        radial-gradient(ellipse at 12% -16%, rgba(var(--toast-rgb), .19), transparent 70%),
        linear-gradient(155deg, #262c25f5, #141816fa 70%);
    box-shadow: 0 16px 42px #0009, 0 2px 9px #0006, inset 0 1px #fff1;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    font-family: Onest, Blaze, 'Segoe UI', sans-serif;
}

.toast--error {
    --toast-rgb: 255, 167, 153;
}

.toast-icon {
    position: relative;
    flex: 0 0 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--toast-rgb), .25);
    border-radius: 14px;
    color: rgb(var(--toast-rgb));
    background: linear-gradient(150deg, rgba(var(--toast-rgb), .19), rgba(var(--toast-rgb), .06));
    box-shadow: inset 0 1px rgba(var(--toast-rgb), .15);
}

.toast--cart .toast-icon {
    border-color: #dcffa88c;
    color: #213311;
    background: linear-gradient(145deg, #e4ffb6, #9cdd62);
    box-shadow: 0 4px 18px #a8e76736, inset 0 1px #fff8;
}

.toast-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.3;
}

.toast-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
    overflow-wrap: anywhere;
}

.toast-title {
    font-size: 15px;
    font-weight: 680;
    line-height: 1.3;
    letter-spacing: -.015em;
}

.toast-detail {
    color: #c0cabb;
    font-size: 13px;
    font-weight: 450;
    line-height: 1.35;
}

.toast-progress {
    position: absolute;
    inset: auto 16px 0;
    height: 2px;
    overflow: hidden;
    background: rgba(var(--toast-rgb), .1);
}

.toast-progress::before {
    position: absolute;
    inset: 0;
    content: '';
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(var(--toast-rgb), .3), rgb(var(--toast-rgb)));
    transform-origin: left;
}

@media (max-width: 700px) {
    .toast {
        bottom: calc(104px + var(--tg-safe-bottom));
    }
}

@media (prefers-reduced-motion: no-preference) {
    .toast {
        animation: toast-enter .46s cubic-bezier(.18, .8, .22, 1) both;
    }

    .toast.is-leaving {
        animation: toast-leave .22s cubic-bezier(.5, 0, .7, 1) both;
    }

    .toast--cart .toast-icon::after {
        position: absolute;
        inset: -1px;
        content: '';
        border: 1px solid rgba(var(--toast-rgb), .8);
        border-radius: inherit;
        animation: toast-ring .65s .16s ease-out both;
    }

    .toast:not(.toast--error) .toast-icon path {
        stroke-dasharray: 24;
        animation: toast-check .3s .12s cubic-bezier(.25, .6, .35, 1) both;
    }

    .toast-copy {
        animation: toast-copy-enter .38s .07s ease-out both;
    }

    .toast-progress::before {
        animation: toast-countdown var(--toast-duration) linear both;
    }
}

@keyframes toast-enter {
    0% { opacity: 0; transform: translateY(22px) scale(.94); }
    65% { opacity: 1; transform: translateY(-3px) scale(1.01); }
    100% { opacity: 1; transform: none; }
}

@keyframes toast-leave {
    to { opacity: 0; transform: translateY(10px) scale(.97); }
}

@keyframes toast-ring {
    0% { opacity: .75; transform: scale(.92); }
    100% { opacity: 0; transform: scale(1.45); }
}

@keyframes toast-check {
    from { stroke-dashoffset: 24; }
    to { stroke-dashoffset: 0; }
}

@keyframes toast-copy-enter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: none; }
}

@keyframes toast-countdown {
    to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .toast-progress {
        display: none;
    }

    .toast.is-leaving {
        visibility: hidden;
    }
}
