.back-to-top {
    position: fixed;
    right: max(24px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 900;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid #696971;
    border-radius: 8px;
    background: #232325;
    color: #d7dadd;
    box-shadow: 0 4px 16px rgb(0 0 0 / 25%);
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.back-to-top[hidden] { display: none; }
.back-to-top svg { color: inherit; pointer-events: none; }
.back-to-top:hover { background: #353537; border-color: #9b9ba3; }
.back-to-top:focus-visible { outline: 2px solid #b6c3cd; outline-offset: 3px; }

@media (max-width: 760px) {
    .back-to-top {
        width: 44px;
        height: 44px;
        right: calc(14px + env(safe-area-inset-right, 0px));
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}

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