/* 首页快速滚动：触屏只有回到顶部；鼠标设备右下位置胶囊与分区跳转。颜色沿用 theme.css 变量。 */
:root { --fs-line: #cfd9de; --fs-shadow: 0 2px 10px rgb(15 20 25 / .18); }
:root[data-theme="dark"] { --fs-line: #2f3336; --fs-shadow: 0 2px 12px rgb(0 0 0 / .6); }

/* 回到顶部（触屏）与位置胶囊（鼠标）：隐藏时不占 Tab 顺序。 */
.fs-top, .fs-pill { position: fixed; z-index: 30; border: 1px solid var(--fs-line); background: var(--surface); color: var(--fg); opacity: 0; visibility: hidden; translate: 0 8px; transition: opacity .2s, translate .2s, visibility 0s .2s; }
.fs-top.fs-show, .fs-pill.fs-show { opacity: 1; visibility: visible; translate: 0 0; transition: opacity .2s, translate .2s; }
.fs-top { display: none; right: calc(16px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); width: 44px; height: 44px; padding: 0; border-radius: 50%; align-items: center; justify-content: center; box-shadow: var(--fs-shadow); cursor: pointer; }
.fs-pill { right: calc(var(--site-header-right) + 16px); bottom: 24px; height: 44px; padding: 0 4px; border-radius: 22px; display: flex; align-items: center; box-shadow: 0 4px 16px rgb(15 20 25 / .14); font-family: var(--font-body); }
.fs-pill > button { height: 36px; padding: 0; border: 0; border-radius: 18px; background: transparent; color: inherit; display: flex; align-items: center; justify-content: center; font: inherit; cursor: pointer; }
.fs-up { width: 36px; }
.fs-sep { width: 1px; height: 20px; background: var(--line); }
.fs-pill > .fs-toggle { gap: 8px; padding: 0 10px 0 12px; font-size: 14px; font-weight: 500; line-height: 20px; }
.fs-where { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-menu { position: absolute; right: 0; bottom: calc(100% + 8px); width: 248px; padding: 6px; box-sizing: border-box; border: 1px solid var(--fs-line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 28px rgb(15 20 25 / .16); }
.fs-menu[hidden] { display: none; }
.fs-menu-title { padding: 6px 12px 4px; color: var(--muted); font-size: 12px; line-height: 18px; }
.fs-menu-list { display: flex; flex-direction: column; }
.fs-menu-list button { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--fg); font: inherit; font-size: 14px; line-height: 20px; text-align: left; cursor: pointer; }
.fs-menu-list button[aria-current="true"] { background: #1d9bf01f; font-weight: 700; }
.fs-menu-list small { color: var(--muted); font-size: 12px; font-weight: 400; }
.fs-menu-list small[hidden] { display: none; }
/* 深色主题下 --muted 在当前项底色上对比度不足 4.5:1，换成更亮的灰。 */
:root[data-theme="dark"] .fs-menu-list small { color: #8b98a5; }
@media (hover: hover) {
  .fs-pill > button:hover, .fs-menu-list button:hover { background: var(--band); }
}
/* 首页的右侧赞助开关只写在 .page-layout 上（不在 <html> 上），胶囊和回到顶部在这里自行让出赞助栏，偏移与 theme.css 一致。 */
@media (min-width: 901px) {
  .page-layout[data-sponsor-right="true"] ~ :is(.fs-pill, .fs-top) { right: calc(clamp(112px, 12vw, 190px) + 40px); }
}
/* 页底留出按钮高度，滚到底时页脚最后一行不被固定按钮挡住。 */
.page-layout { padding-bottom: 88px; }

/* 触屏只用回到顶部，其余设备用胶囊。 */
@media (pointer: coarse) {
  .fs-top { display: flex; }
  .fs-pill { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fs-top, .fs-pill, .fs-top.fs-show, .fs-pill.fs-show { transition: none; }
}
@media print {
  .fs-top, .fs-pill { display: none !important; }
}
