.scroll-top-button {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(255, 153, 0, 0.98), rgba(255, 191, 71, 0.94));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 18px, 0) scale(0.92);
  transition:
    opacity .24s ease,
    transform .24s ease,
    box-shadow .24s ease,
    border-color .24s ease;
}

.scroll-top-button::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 20px;
  border: 1px solid rgba(255, 153, 0, 0.28);
  opacity: 0;
  transform: scale(0.82);
  transition: opacity .24s ease, transform .24s ease;
}

.scroll-top-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  animation: scrollTopFloat 2.8s ease-in-out infinite;
}

.scroll-top-button.is-visible::before {
  opacity: 1;
  transform: scale(1);
  animation: scrollTopRing 2.8s ease-in-out infinite;
}

.scroll-top-button:hover {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.32);
  transform: translate3d(0, -3px, 0) scale(1.03);
}

.scroll-top-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.78);
  outline-offset: 4px;
}

.scroll-top-button__arrow {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-1px);
}

.scroll-top-button__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes scrollTopFloat {
  0%, 100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -5px;
  }
}

@keyframes scrollTopRing {
  0%, 100% {
    opacity: .34;
    transform: scale(.92);
  }

  50% {
    opacity: .08;
    transform: scale(1.12);
  }
}

@media (max-width: 640px) {
  .scroll-top-button {
    left: max(14px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .scroll-top-button::before {
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-top-button,
  .scroll-top-button.is-visible,
  .scroll-top-button.is-visible::before {
    animation: none;
  }
}
