/* Shared article/feed back-to-top control. Article TOC/music positioning overrides remain page-owned. */
.ai-back-to-top {
  position: fixed;
  /* 文章宽 720px 居中时，右半边空隙中心 = (100vw - 720px)/2 + 720px + (100vw - 720px)/4 = 75vw + 180px */
  left: calc(75vw + 180px);
  top: 68%;
  transform: translate(-50%, calc(-50% + 8px));
  z-index: 50;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(126, 192, 224, 0.44);
  border-radius: 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='rgba(80,160,220,0.5)'/%3E%3Cstop offset='1' stop-color='rgba(100,180,240,0.35)'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='6' y='6' width='32' height='32' rx='2' fill='none' stroke='url(%23g)' stroke-width='0.8'/%3E%3Cpath d='M6 8 Q6 6 8 6' fill='none' stroke='url(%23g)' stroke-width='0.8'/%3E%3Crect x='18' y='18' width='8' height='8' fill='rgba(124,206,246,0.08)' stroke='rgba(100,180,220,0.5)' stroke-width='0.6'/%3E%3Crect x='10' y='4' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='17' y='4' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='24' y='4' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='31' y='4' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='10' y='38' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='17' y='38' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='24' y='38' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='31' y='38' width='3' height='2' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='4' y='10' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='4' y='17' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='4' y='24' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='4' y='31' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='38' y='10' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='38' y='17' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='38' y='24' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Crect x='38' y='31' width='2' height='3' fill='rgba(100,180,220,0.5)'/%3E%3Cline x1='12' y1='6' x2='12' y2='18' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3Cline x1='19' y1='6' x2='19' y2='18' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3Cline x1='26' y1='6' x2='26' y2='18' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3Cline x1='33' y1='6' x2='33' y2='18' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3Cline x1='6' y1='12' x2='18' y2='12' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3Cline x1='6' y1='19' x2='18' y2='19' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3Cline x1='26' y1='12' x2='38' y2='12' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3Cline x1='26' y1='19' x2='38' y2='19' stroke='rgba(100,180,220,0.35)' stroke-width='0.5'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(12, 22, 36, 0.95), rgba(8, 16, 28, 0.98));
  background-size:
    100% 100%,
    100% 100%;
  background-position:
    0 0,
    0 0;
  color: rgba(190, 236, 255, 0.95);
  font-size: 1.35em;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    border-color 0.2s,
    box-shadow 0.2s;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(124, 206, 246, 0.18);
}
.ai-back-to-top.visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.ai-back-to-top:hover {
  border-color: rgba(162, 222, 248, 0.72);
  box-shadow: 0 0 24px rgba(124, 206, 246, 0.36);
}
@media (max-width: 840px) {
  /* 视口较窄时右侧空隙太小，改回贴右 */
  .ai-back-to-top {
    left: auto;
    right: 1rem;
    transform: translateY(calc(-50% + 8px));
  }
  .ai-back-to-top.visible {
    transform: translateY(-50%);
  }
}

.ai-back-to-top {
  visibility: hidden;
  pointer-events: none;
}
.ai-back-to-top.visible {
  visibility: visible;
  pointer-events: auto;
}
.ai-back-to-top[data-back-to-top-layout='feed'] {
  left: calc(75vw + 212.5px);
}
@media (max-width: 1040px) {
  .ai-back-to-top[data-back-to-top-layout='feed'] {
    left: auto;
    right: 1rem;
    transform: translateY(calc(-50% + 8px));
  }
  .ai-back-to-top[data-back-to-top-layout='feed'].visible {
    transform: translateY(-50%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-back-to-top {
    transition: none;
  }
}
