:root {
  --neb-back-top-accent: #8bd400;
  --neb-back-top-size: 52px;
}

.neb-back-to-top {
  position: fixed;
  right: clamp(20px, 2.2vw, 32px);
  bottom: clamp(88px, 9vw, 104px);
  z-index: 9998;
  display: grid;
  width: var(--neb-back-top-size);
  height: var(--neb-back-top-size);
  padding: 0;
  place-items: center;
  overflow: hidden;
  color: var(--neb-back-top-accent);
  background:
    linear-gradient(145deg, rgba(24, 28, 25, 0.96), rgba(5, 7, 7, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 30px rgba(0, 0, 0, 0.34),
    0 0 0 rgba(139, 212, 0, 0);
  opacity: 0;
  transform: translateY(14px) scale(0.94);
  pointer-events: none;
  cursor: pointer;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    color 220ms ease;
}

.neb-back-to-top::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(139, 212, 0, 0.16);
  border-radius: inherit;
  transition: border-color 220ms ease;
}

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

.neb-back-to-top__ring {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: conic-gradient(
    from 210deg,
    transparent 0 62%,
    rgba(139, 212, 0, 0.72) 72%,
    transparent 84% 100%
  );
  opacity: 0.42;
  -webkit-mask: radial-gradient(circle, transparent 68%, #000 70%);
  mask: radial-gradient(circle, transparent 68%, #000 70%);
}

.neb-back-to-top__icon {
  position: relative;
  z-index: 1;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.neb-back-to-top:hover {
  color: #baff2a;
  border-color: rgba(139, 212, 0, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 18px 34px rgba(0, 0, 0, 0.42),
    0 0 28px rgba(139, 212, 0, 0.22);
  transform: translateY(-3px) scale(1.02);
}

.neb-back-to-top:hover::before {
  border-color: rgba(139, 212, 0, 0.34);
}

.neb-back-to-top:focus-visible {
  outline: 2px solid var(--neb-back-top-accent);
  outline-offset: 4px;
}

@media (max-width: 767px) {
  :root {
    --neb-back-top-size: 46px;
  }

  .neb-back-to-top {
    right: max(18px, env(safe-area-inset-right));
    bottom: max(84px, calc(env(safe-area-inset-bottom) + 84px));
  }

  .neb-back-to-top__icon {
    width: 19px;
    height: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .neb-back-to-top {
    transition: opacity 120ms linear;
  }
}

