.site-scroll-to-top {
    position: fixed;
    left: max(18px, env(safe-area-inset-left, 0px));
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(226, 232, 240, 0.96);
    border-radius: 16px;
    color: #111827;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 14px, 0) scale(0.92);
    transition:
        opacity 180ms ease,
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
        color 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
    -webkit-tap-highlight-color: transparent;
}

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

.site-scroll-to-top:hover {
    border-color: rgba(249, 115, 22, 0.38);
    color: #f97316;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.19);
    transform: translate3d(0, -2px, 0) scale(1);
}

.site-scroll-to-top:active {
    transform: translate3d(0, 0, 0) scale(0.95);
}

.site-scroll-to-top:focus-visible {
    outline: 3px solid rgba(249, 115, 22, 0.24);
    outline-offset: 3px;
}

.site-scroll-to-top svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

html[data-theme="dark"] .site-scroll-to-top {
    border-color: rgba(71, 85, 105, 0.78);
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] .site-scroll-to-top:hover {
    border-color: rgba(251, 146, 60, 0.62);
    color: #fb923c;
    background: #111827;
}

@media (max-width: 767px) {
    .site-scroll-to-top {
        left: max(12px, env(safe-area-inset-left, 0px));
        bottom: calc(
            var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px))
            + var(--mobile-nav-height, 60px)
            + var(--mobile-nav-bottom, 16px)
            + 14px
        );
        width: 44px;
        height: 44px;
        border-radius: 15px;
    }

    .site-scroll-to-top svg {
        width: 20px;
        height: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-scroll-to-top {
        transition-duration: 1ms;
    }
}
