.back-to-top {
  position: fixed;
  z-index: 15;
  inset-inline-end: max(12px, env(safe-area-inset-right));
  inset-block-end: max(12px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--accent, #0e7490);
  border-radius: 50%;
  color: var(--accent-deep, #0b4f63);
  background: var(--surface, #fff);
  cursor: pointer;
  touch-action: manipulation;
}
.back-to-top[hidden] { display: none; }
.back-to-top:hover { color: var(--surface, #fff); background: var(--accent-deep, #0b4f63); }
.back-to-top:focus-visible { outline: 3px solid var(--accent, #0e7490); outline-offset: 3px; }
/* Leave the last content and footer clear of the floating control. */
@media screen { .main { padding-bottom: max(80px, env(safe-area-inset-bottom)); } }
/* On narrow screens the control occupies a small dedicated side gutter. */
@media screen and (max-width: 650px) {
  .main { padding-inline-end: max(68px, calc(56px + env(safe-area-inset-right))); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .back-to-top { display: none !important; } }
