/**
 * 回到顶部悬浮按钮（挂在 body 下，避免被 #page-wrapper 的 transform 影响）
 */
body > .back-to-top {
  position: fixed;
}

.back-to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 1.5rem);
  bottom: clamp(1.25rem, 4vw, 2rem);
  z-index: 9990;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: #0369a1;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 20px rgba(3, 105, 161, 0.35);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #0284c7;
  box-shadow: 0 8px 24px rgba(3, 105, 161, 0.45);
}

.back-to-top:focus {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.back-to-top .fa {
  font-size: 1.125rem;
  line-height: 44px;
}

.back-to-top-icon {
  display: block;
  width: 12px;
  height: 12px;
  margin: 0 auto;
  border: 2px solid #fff;
  border-right: 0;
  border-bottom: 0;
  transform: rotate(45deg) translate(2px, 2px);
}

@media (max-width: 768px) {
  .back-to-top {
    width: 40px;
    height: 40px;
    right: 1rem;
    bottom: 1.25rem;
  }

  .back-to-top .fa {
    line-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 0.15s ease, visibility 0.15s ease;
  }
}
