.scroll-to-top {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    width: 3rem;
    height: 3rem;
    padding: 0;
    place-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-surface);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(.75rem);
    transition: opacity .2s ease, transform .2s ease, color .2s ease;
}

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

.scroll-to-top:hover,
.scroll-to-top:focus-visible {
    background: var(--color-surface);
    color: var(--color-primary-hover);
}

.scroll-to-top .icon {
    width: 100%;
    height: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .scroll-to-top {
        transition: none;
    }
}
