.back-to-top {
  position: fixed;
  z-index: 30;
  right: max(20px, calc((100vw - var(--max)) / 2));
  bottom: 24px;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid #fff4;
  border-radius: 50%;
  background: #111;
  color: #fff;
  box-shadow: 0 8px 24px #0004;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover { background: var(--gold); }
.back-to-top:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

@media (max-width: 700px) {
  .back-to-top { right: 16px; bottom: 16px; width: 48px; height: 48px; }
}

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