#toast-container {
    position: fixed;
    top: 0;
    right: 0;
    max-height: 100vh;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;

    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 1000;

    color: #eee;

    .toast {
        --color: hsl(0, 0%, 0%);

        border-radius: 0.2em;
        box-shadow: 0.25rem 0.25rem 0.5rem #0008;
        animation:
            slideInRight 0.3s ease-in-out forwards,
            fadeOut 0.5s ease-in-out forwards 100s;
        transform: translateX(calc(100% + 1rem));
        cursor: pointer;
        margin-bottom: 1em;
        padding: 0.5em;
        position: relative;
        background-color: var(--color);

        > .progress {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            border-radius: 0.2em;
            background-color: hsl(from var(--color) h s max(0, calc(l - 10)));

            height: 0.2em;
            width: 100%;

            animation: toastProgress 0s ease-out forwards;
        }

        > .message {
            overflow-wrap: break-word;
            overflow-y: auto;
            overflow-x: hidden;
            max-width: 20vw;
            max-height: calc((100vh - 2rem + 1em) / 5 - 2em);
            white-space: pre-wrap;
            tab-size: 2;

            &::first-line {
                line-height: 2rem;
                font-weight: bold;
            }

            > .icon {
                display: inline;
                float: left;
                width: 2rem;
                height: 2rem;
                padding-right: 0.5rem;
                shape-outside: circle(100% at 0 0);
                filter: invert(99%) sepia(2%) saturate(3022%) hue-rotate(177deg) brightness(119%) contrast(87%); /* #eee */
            }
        }

        > .time {
            position: absolute;
            top: 0.25em;
            right: 0.25em;
            font-size: 0.5em;
        }

        &.closing {
            animation: slideOutRight 0.3s ease-in-out forwards;
        }

        &.success {
            --color: hsl(105, 100%, 22%);
        }

        &.warning {
            --color: hsl(39, 100%, 40%);
        }

        &.info {
            --color: hsl(237, 95%, 40%);
        }

        &.error {
            --color: hsl(0, 100%, 38%);
        }
    }
}

@keyframes slideInRight {
    0% {
        transform: translateX(calc(100% + 1rem));
    }

    75% {
        transform: translateX(-10%);
    }

    100% {
        transform: translateX(0%);
    }
}

@keyframes slideOutRight {
    0% {
        transform: translateX(0%);
    }

    25% {
        transform: translateX(-10%);
    }

    75% {
        opacity: 1;
    }

    100% {
        transform: translateX(calc(100% + 1rem));
        opacity: 0;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes toastProgress {
    0% {
        width: 100%;
    }

    100% {
        width: 0%;
    }
}
