.back-to-top {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 18;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: rgba(5, 5, 5, 0.68);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 200ms ease,
    visibility 200ms ease,
    transform 200ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

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

.back-to-top svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back-to-top:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.96);
  outline-offset: 4px;
}

@media (hover: hover) {
  .back-to-top:hover {
    border-color: rgba(255, 255, 255, 0.72);
    background: rgba(28, 28, 28, 0.82);
    transform: translateY(-2px);
  }
}

@media (max-width: 640px) {
  .back-to-top {
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

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