/* ===== 移动端底部导航（2026-11-16） =====
   仅 ≤768px 显示；桌面端完全不受影响。body 的底部内边距由 JS 加类触发，
   避免无 JS 时页面被多留一条空白。 */
.lt-bn { display: none; }
.lt-top { display: none; }

@media (max-width: 768px), (max-height: 520px) and (pointer: coarse) {
  .lt-bn {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 900; /* 低于导航栏(1000)/Wiki 抽屉(999·1001)/弹窗(9999)，避免盖住抽屉与模态框 */
    background: rgba(23, 28, 57, .92);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
    border-top: 1px solid rgba(255, 255, 255, .10);
    box-shadow: 0 -8px 26px rgba(0, 0, 0, .32);
    padding: 5px 6px;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    -webkit-tap-highlight-color: transparent;
    /* 2026-11-17：滚动时自动收起、静止后滑回；上滑/到顶/到底立即出现 */
    will-change: transform, opacity;
    transition: transform .34s cubic-bezier(.22, 1, .36, 1), opacity .22s ease;
  }
  .lt-bn.is-hidden {
    transform: translateY(calc(100% + 8px));
    opacity: 0;
    pointer-events: none;
  }
  .lt-bn a {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; padding: 6px 2px;
    color: rgba(255, 255, 255, .66);
    text-decoration: none;
    font-size: 11px; line-height: 1.15; font-weight: 600;
    border-radius: 10px;
    transition: color .18s ease, background .18s ease, transform .12s ease;
  }
  .lt-bn a svg { width: 23px; height: 23px; display: block; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
  .lt-bn a.is-active { color: #9fe094; background: rgba(143, 212, 134, .13); }
  .lt-bn a.is-active svg { transform: translateY(-1px); }
  .lt-bn a:active { background: rgba(255, 255, 255, .08); transform: scale(.94); }
  .lt-bn a:focus-visible { outline: 2px solid #8fd486; outline-offset: -2px; }

  body.lt-bn-on { padding-bottom: 64px; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  /* Wiki 目录抽屉从顶部铺到底部，给底栏留出空间，否则最后几项会压在底栏下面 */
  body.lt-bn-on .wiki-sidebar { padding-bottom: 78px; padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  /* Wiki「返回顶部」原本 bottom:16px，正好落在底栏里，抬到底栏上方 */
  body.lt-bn-on #wikiBackToTop { bottom: 78px !important; bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important; }

  /* 输入框聚焦（手机软键盘弹出）时收起底栏，避免挡住正在填的字段 */
  body.lt-bn-input .lt-bn { transform: translateY(110%); }

  /* 回到顶部（Wiki 页有自带的，不重复注入） */
  .lt-top {
    display: none;
    position: fixed; right: 14px; bottom: 78px;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    z-index: 890;
    width: 42px; height: 42px; padding: 0;
    border: 0; border-radius: 50%;
    background: #5DA552; color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
    align-items: center; justify-content: center;
    cursor: pointer;
  }
  .lt-top svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .lt-top.is-on { display: flex; }
  .lt-top:active { background: #4a8a41; }
  .lt-top:focus-visible { outline: 2px solid #8fd486; outline-offset: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .lt-bn, .lt-bn a, .lt-bn a svg { transition: none !important; }
  .lt-bn.is-hidden { transform: none; opacity: 0; }
}
