.back-to-top-button {
    --scroll-progress: 0deg;
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 3px;
    border: none;
    background:
        conic-gradient(from -90deg,
            #4361ee 0deg,
            #0155b5 var(--scroll-progress),
            rgba(255, 255, 255, 0.16) var(--scroll-progress),
            rgba(255, 255, 255, 0.16) 360deg);
    color: #ffffff;
    box-shadow: 0 18px 38px rgba(1, 85, 181, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease,
        box-shadow 0.25s ease;
    z-index: 120;
    pointer-events: none;
}

.back-to-top-button-inner {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(2, 3, 7, 0.32);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.back-to-top-button svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
    animation: backToTopArrowBounce 1.8s ease-in-out infinite;
    transform-origin: center;
}

.back-to-top-button.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top-button:hover {
    box-shadow: 0 22px 46px rgba(1, 85, 181, 0.36);
}

.back-to-top-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}

@keyframes backToTopArrowBounce {
    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }

    55% {
        transform: translateY(1px);
    }

    75% {
        transform: translateY(-2px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top-button,
    .back-to-top-button svg {
        transition: none;
        animation: none;
    }
}

@media (max-width: 767px) {
    .back-to-top-button {
        left: max(12px, env(safe-area-inset-left));
        bottom: max(12px, env(safe-area-inset-bottom));
        width: 50px;
        height: 50px;
        padding: 2.5px;
    }

    .back-to-top-button svg {
        width: 18px;
        height: 18px;
    }
}
