.back-to-top {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + max(env(safe-area-inset-bottom, 0px), var(--back-to-top-footer-offset, 0px)));
  z-index: 920;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 8px;
  border: 1px solid #f6f2ea66;
  border-radius: 50%;
  background: var(--accent, #8e302a);
  color: #fffefa;
  font-family: inherit;
  box-shadow: 0 4px 18px #392e2a30;
  cursor: pointer;
  animation: back-to-top-appear .2s ease-out;
  transition: transform .2s ease, box-shadow .2s ease;
}
.back-to-top[hidden] { display: none; }
.back-to-top svg { flex-shrink: 0; }
.back-to-top:hover { transform: translateY(-3px); box-shadow: 0 7px 22px #392e2a40; }
.back-to-top:active { transform: none; }
.back-to-top:focus-visible { outline: 2px solid var(--accent, #8e302a); outline-offset: 4px; }
@keyframes back-to-top-appear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 600px) {
  .back-to-top {
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + max(env(safe-area-inset-bottom, 0px), var(--back-to-top-footer-offset, 0px)));
    width: 52px;
    height: 52px;
    padding: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top { animation: none; transition: none; }
  .back-to-top:hover { transform: none; }
}
