.back-to-top {
  --scroll-progress: 0%;
  --scroll-progress-offset: 100;
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #f2fff4;
  background: transparent;
  filter: drop-shadow(0 9px 17px rgba(0, 0, 0, .42));
  isolation: isolate;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(.92);
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease, filter .22s ease;
}

.back-to-top::before {
  position: absolute;
  inset: 5px;
  z-index: 0;
  border: 1px solid rgba(220, 255, 225, .25);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 16%, rgba(233, 255, 238, .31), transparent 43%), linear-gradient(145deg, rgba(70, 132, 83, .65), rgba(5, 23, 12, .79) 72%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 -9px 14px rgba(0, 0, 0, .22), 0 0 20px rgba(40, 255, 95, .1);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  content: '';
}

.back-to-top-ring {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.back-to-top-ring-track {
  stroke: rgba(193, 255, 203, .33);
  stroke-width: 2.8;
}

.back-to-top-ring-value {
  stroke: url(#back-to-top-ring-gradient);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: var(--scroll-progress-offset);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  filter: drop-shadow(0 0 3px rgba(96, 255, 112, .6));
}

.back-to-top-icon {
  position: relative;
  z-index: 2;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

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

.back-to-top:hover {
  filter: drop-shadow(0 11px 19px rgba(0, 0, 0, .46)) drop-shadow(0 0 10px rgba(40, 255, 95, .2));
  transform: translateY(-3px) scale(1);
}

.back-to-top:focus-visible {
  outline: 2px solid #28ff5f;
  outline-offset: 4px;
}

@media (max-width: 600px) {
  .back-to-top {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
  }
}

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