#back-to-top {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(var(--back-top-bottom, 20px), env(safe-area-inset-bottom));
  z-index: 900;
  display: inline-flex;
  width: 48px;
  height: 48px;
  box-sizing: border-box;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(13, 198, 202, .7);
  border-radius: 12px;
  background: #091f4e;
  color: #fff;
  box-shadow: 0 12px 28px rgba(9, 31, 78, .18);
  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .2s ease, transform .2s ease, background-color .2s ease;
}

#back-to-top[hidden] {
  display: none !important;
}

#back-to-top:hover,
#back-to-top:focus-visible {
  background: #0dc6ca;
  color: #091f4e;
}

#back-to-top:focus-visible {
  outline: 3px solid rgba(13, 198, 202, .45);
  outline-offset: 3px;
}

#back-to-top svg { width: 20px; height: 20px; }

@media (max-width: 480px) {
  #back-to-top {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(var(--back-top-bottom, 16px), env(safe-area-inset-bottom));
  }
}

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