/**
 * 阅读页回顶按钮（共享组件，配合 back-to-top.js）。
 *
 * 颜色全部走当前页面的 CSS 变量，桌面与精读模块各自的配色都能沿用；
 * 移动端 / 平板的按钮让开底部标签栏，不用时不可见也不可点。
 */

.back-to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: var(--forest-deep, #17204f);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: var(--shadow, 0 12px 30px rgba(23, 32, 79, 0.24));
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 0s linear 160ms;
  -webkit-tap-highlight-color: transparent;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}

.back-to-top:hover {
  background: var(--forest, #4056d6);
}

.back-to-top:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.back-to-top svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 1024px) {
  .back-to-top {
    bottom: calc(
      var(--site-nav-height, 62px) + 14px + env(safe-area-inset-bottom, 0px)
    );
  }
}

@media print {
  .back-to-top {
    display: none !important;
  }
}
