/* ═══ WebView 全分辨率适配基石 ═══
   首屏 CSS 防线，在 JS 注入之前生效，确保：
   1. 任何分辨率下 WebView 不超出屏幕
   2. body 锁定视口（position:fixed），内容区内部滚动
   3. 顶部/底部固定元素死锁于屏幕边缘
   4. 图片/媒体不撑破容器
   5. 禁用自定义滚动条

   ★ 注意：此文件同时被 local 模式和 remote 模式（线上）使用
   ══════════════════════════════════════ */

/* ── 视口锁定：html/body 永不滚动 ── */
html {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  --vh: 1vh;
  --nav-h: 0px;
  --top-h: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  height: 100%;
  max-height: 100%;
  width: 100%;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow-x: hidden;
  overscroll-behavior: none;
  position: fixed;
  top: 0;
  left: 0;
}

/* ── 全局盒模型 ── */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ── #root 填满视口，作为唯一滚动容器 ── */
#root {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  position: relative;
}

/* ── 媒体元素不撑破容器 ── */
img, video, iframe, canvas, svg, embed, object {
  max-width: 100%;
  height: auto;
}

/* ── 隐藏滚动条 ── */
::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.reader-three-column-scroll {
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: rgba(120, 113, 108, 0.75) transparent;
}

.reader-three-column-scroll::-webkit-scrollbar {
  width: 10px !important;
  height: 10px !important;
  display: block !important;
}

.reader-three-column-scroll::-webkit-scrollbar-track {
  background: rgba(214, 211, 209, 0.45) !important;
  border-radius: 999px;
}

.reader-three-column-scroll::-webkit-scrollbar-thumb {
  background: rgba(120, 113, 108, 0.75) !important;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box !important;
}

.reader-three-column-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(87, 83, 78, 0.9) !important;
  background-clip: content-box !important;
}

/* ── 100vh 修正为动态 --vh ── */
.min-h-screen { min-height: calc(var(--vh, 1vh) * 100); }
.h-screen { height: calc(var(--vh, 1vh) * 100); }

/* ── 底部 fixed 元素锚定安全区 ── */
[class*="fixed"][class*="bottom-0"] {
  bottom: env(safe-area-inset-bottom, 0px);
  will-change: auto;
  transform: none;
}
