.scroll-to-top-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;

  width: 52px;
  height: 52px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;

  color: var(--text-strong, #ffffff);
  background:
    linear-gradient(135deg, rgba(71, 120, 255, 0.92), rgba(143, 108, 255, 0.92)),
    var(--surface, #111827);

  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);

  cursor: pointer;

  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.92);
  pointer-events: none;

  transition:
    opacity 0.22s ease,
    visibility 0.22s ease,
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease;
}

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

.scroll-to-top-btn i {
  font-size: 1.05rem;
  line-height: 1;
}

.scroll-to-top-btn:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.42),
    0 0 0 5px rgba(71, 120, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.scroll-to-top-btn:active {
  transform: translateY(-1px) scale(0.97);
}

.scroll-to-top-btn:focus-visible {
  outline: 3px solid rgba(143, 108, 255, 0.55);
  outline-offset: 4px;
}

html[data-theme="light"] .scroll-to-top-btn {
  color: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  background:
    linear-gradient(135deg, rgba(57, 101, 255, 0.95), rgba(124, 91, 255, 0.95)),
    #ffffff;

  box-shadow:
    0 18px 38px rgba(31, 41, 55, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

html[data-theme="light"] .scroll-to-top-btn:hover {
  border-color: rgba(57, 101, 255, 0.28);
  box-shadow:
    0 22px 48px rgba(31, 41, 55, 0.28),
    0 0 0 5px rgba(57, 101, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

@media (max-width: 720px) {
  .scroll-to-top-btn {
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }
}

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

  .scroll-to-top-btn:hover,
  .scroll-to-top-btn:active,
  .scroll-to-top-btn.show {
    transform: none;
  }
}