/* ── 浮动导航栏（nav-stack.js） ────────────────────────────────── */
.bk-float-nav { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 24px; right: 24px; z-index: 990; background: var(--card-bg, #fff); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border: 1px solid var(--border, #E5E2DD); border-radius: var(--float-radius, 31px); transform: translateY(calc(-100% - 8px - env(safe-area-inset-top, 0px))); transition: transform .3s var(--ease-out, cubic-bezier(.4,0,.2,1)); pointer-events: none; padding: 8px 12px; }
[data-theme="dark"] .bk-float-nav { background: var(--card-bg, #201F1D); border-color: var(--border, #34322E); }
.bk-float-nav.show { transform: translateY(0); pointer-events: auto; box-shadow: var(--shadow-card, 0 2px 8px rgba(60,40,10,.06)); }
.bk-float-nav-inner { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 44px; padding: 0; position: relative; }
.bk-float-nav-link { position: absolute; left: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--text, #1A1918); text-decoration: none; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .1s; }
.bk-float-nav-link:active { background: var(--nav-hover); transform: translateY(-50%) scale(0.9); }
.bk-float-nav-link.bk-float-disabled { opacity: 0.25; pointer-events: none; }
.bk-float-nav-settings { display: none; }
.bk-float-title { flex: 1; min-width: 0; text-align: center; font-size: var(--text-sm, 0.875rem); font-weight: 600; color: var(--text, #1A1918); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.4; padding: 0 4px 0 52px; }
.bk-float-play-btn { color: var(--brand, #3D8A5A); border: none; background: transparent; cursor: pointer; padding: 0; }
.bk-float-play-btn .bk-pause-icon { display: none; }
.bk-float-play-btn.bk-playing .bk-play-icon { display: none; }
.bk-float-play-btn.bk-playing .bk-pause-icon { display: block; }
.bk-float-bottom { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 24px; right: 24px; z-index: 990; background: var(--card-bg, #fff); border: 1px solid var(--border, #E5E2DD); border-radius: var(--float-radius, 31px); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; transform: translateY(100%); transition: transform .3s var(--ease-out, cubic-bezier(.4,0,.2,1)); pointer-events: none; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
[data-theme="dark"] .bk-float-bottom { background: var(--card-bg, #201F1D); border-color: var(--border, #34322E); }
.bk-float-bottom.show { transform: translateY(0); pointer-events: auto; box-shadow: var(--shadow-card, 0 2px 8px rgba(60,40,10,.06)); }
.bk-float-bottom-inner { display: flex; align-items: center; justify-content: center; gap: 32px; padding: 0; }
.bk-float-bottom-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted, #888); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .1s; }
.bk-float-bottom-btn:active { background: var(--nav-hover); transform: scale(0.88); }
.bk-float-bottom-btn svg { display: block; }
.bk-float-bottom-tts-btn { color: var(--brand, #3D8A5A); }
.bk-float-bottom-tts-btn .bk-pause-icon { display: none; }
.bk-float-bottom-tts-btn.bk-playing .bk-play-icon { display: none; }
.bk-float-bottom-tts-btn.bk-playing .bk-pause-icon { display: block; }
.bk-float-tts-bar { position: absolute; bottom: 100%; left: 0; right: 0; z-index: 1; display: none; pointer-events: none; }
.bk-float-tts-bar.show { display: block; pointer-events: auto; }
/* PDF 模式下隐藏 TTS 朗读栏（PDF 无文字朗读需求，避免遮挡页面）
   注意：TTS 控制栏实际有两层——.bk-float-tts-bar（包装层，部分布局下不存在）
   和 .bottom-control-bar（实际控制栏，含播放/进度/速度）。
   在 split mode 等布局下 .bottom-control-bar 直接挂在 .reading-view 下而非
   .bk-float-tts-bar 内，所以需同时隐藏两者。 */
body:has(.bk-pdf-mode) .bk-float-tts-bar,
body.bk-pdf-reading .bk-float-tts-bar,
body:has(.bk-pdf-mode) .bottom-control-bar,
body.bk-pdf-reading .bottom-control-bar { display: none !important; }
/* PDF 阅读模式下隐藏主应用浮动栏（由 PDF 阅读器自带顶栏/功能按钮接管） */
body:has(.bk-pdf-mode) .bk-float-nav,
body.bk-pdf-reading .bk-float-nav,
body:has(.bk-pdf-mode) .bk-float-bottom,
body.bk-pdf-reading .bk-float-bottom { display: none !important; }
.bk-float-tts-bar .bottom-control-bar { flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; border-radius: 16px; border: 1px solid var(--border, #E5E2DD); box-shadow: var(--shadow-card, 0 2px 8px rgba(60,40,10,.06)); background: var(--card-bg, #fff); -webkit-backdrop-filter: none; backdrop-filter: none; padding: 10px 14px; }
.bk-float-tts-bar .tts-title { flex-basis: 100%; font-size: var(--text-sm, 0.875rem); font-weight: 600; color: var(--brand, #3D8A5A); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4; }
[data-theme="dark"] .bk-float-tts-bar .bottom-control-bar { background: var(--card-bg, #201F1D); border-color: var(--border, #34322E); }

/* ── 常驻底部 4-Tab 导航栏（bottom-tab-bar.js） ──────────────── */
.bk-bottom-tab-bar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #E5E2DD);
  border-radius: 31px;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transform: translateX(-50%) translateY(140%);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s var(--ease-out, cubic-bezier(.4,0,.2,1)), opacity .2s ease;
}
.bk-bottom-tab-bar.is-visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
[data-theme="dark"] .bk-bottom-tab-bar { background: var(--card-bg, #201F1D); border-color: var(--border, #34322E); }

/* ── PWA 安装横幅（Ardot 22:4，Soft Nordic） ──────────────────── */
.bk-pwa-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
  display: none; align-items: center; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--card-bg, #FFFFFF);
  border-top: 1px solid var(--border, #E5E2DD);
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.bk-pwa-banner-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand, #3D8A5A); color: #FFFFFF;
}
.bk-pwa-banner-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bk-pwa-banner-title { font-size: 14px; font-weight: 600; color: var(--heading, #1A1918); }
.bk-pwa-banner-sub { font-size: 12px; color: var(--text-muted, #9A958C); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-pwa-banner-install {
  flex: 0 0 auto; height: 32px; min-width: 64px; padding: 0 14px;
  border: none; border-radius: 16px;
  background: var(--brand, #3D8A5A); color: #FFFFFF;
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.bk-pwa-banner-install:active { opacity: .88; }
.bk-pwa-banner-close {
  flex: 0 0 auto; width: 24px; height: 24px; border: none; background: none;
  color: var(--text-muted, #9A958C); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
/* 横幅可见时，常驻 Tab 浮岛上移避让 */
body.bk-pwa-banner-visible .bk-bottom-tab-bar {
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + 76px);
}
[data-theme="dark"] .bk-pwa-banner { background: var(--card-bg, #201F1D); }
.bk-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 54px;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 24px;
  color: var(--text-muted, #9A958C);
  font: inherit;
  line-height: 1.1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s ease, background .15s ease;
}
.bk-tab-icon { display: flex; align-items: center; justify-content: center; }
.bk-tab-icon svg { width: 22px; height: 22px; display: block; }
.bk-tab-label { font-size: 11px; font-weight: 600; }
.bk-tab.is-active { color: var(--brand, #3D8A5A); }
.bk-tab:active { background: var(--nav-hover, #ECEAE5); }
/* 5-Tab 极窄屏（≤320px）退化为横向滚动，不破坏白色胶囊 */
@media (max-width: 360px) {
  .bk-bottom-tab-bar { max-width: calc(100vw - 16px); overflow-x: auto; overflow-y: hidden; }
  .bk-tab { min-width: 52px; flex: 0 0 auto; }
}

