.back-to-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 900;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: #27ae60;
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 53, 90, 0.22);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #219653;
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 3px solid rgba(39, 174, 96, 0.35);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .back-to-top {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
  }
}
