/* 旧书斋 · 暖色纸质感 */
:root {
  --paper: #f6efe0;
  --paper-deep: #efe5cf;
  --ink: #3d3226;
  --ink-soft: #7a6a54;
  --seal: #a8442c;      /* 印章红 */
  --ochre: #b98a3d;     /* 赭石 */
  --green: #5c6b4f;     /* 旧墨绿 */
  --line: #d9c9a8;
  --card: #fffdf4;                       /* 弹窗等实底面板（修自引用，保持不透明） */
  --card-hover: #fffcf0;
  --card-grad-a: rgba(255, 252, 242, .78); /* 书/视频卡片：白天半透明底，沙流可透出 */
  --card-grad-b: rgba(251, 244, 227, .58);
  --pill-bg: rgba(255, 253, 245, .6);
  --pill-bg-strong: rgba(255, 253, 245, .94);
  --card-shadow: 0 2px 10px rgba(90, 70, 40, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255,250,235,.6), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(220,200,160,.25), transparent 45%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(160,130,80,.02) 2px 3px);
  color: var(--ink);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  line-height: 1.7;
}

/* ---------- 页头 ---------- */
header.site {
  text-align: center;
  padding: 64px 20px 40px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
header.site::after {
  content: "";
  display: block;
  width: 180px; height: 2px;
  margin: 24px auto 0;
  background: linear-gradient(to right, transparent, var(--seal), transparent);
}
.brand {
  font-size: 34px;
  letter-spacing: 14px;
  font-weight: 700;
}
.brand .seal-dot {
  display: inline-block;
  width: 12px; height: 12px;
  background: var(--seal);
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
}
.tagline {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 15px;
  letter-spacing: 4px;
}

/* ---------- 说明条 ---------- */
.intro {
  max-width: 860px;
  margin: 28px auto 0;
  padding: 0 24px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.intro .pill {
  border: 1px solid var(--line);
  background: var(--pill-bg);
  border-radius: 999px;
  padding: 4px 18px;
  font-size: 13px;
  color: var(--ink-soft);
}
.intro .pill b { color: var(--seal); font-weight: 600; }
/* 长句说明条：允许换行，胶囊内文居中，行距放宽避免挤压 */
.intro .pill.long {
  max-width: 100%;
  padding: 7px 22px;
  line-height: 1.6;
  text-align: center;
}
/* 窄屏下说明区下移，避开右上角"手机版"悬浮切换按钮 */
@media (max-width: 560px) {
  .intro { padding-top: 44px; }
}

/* ---------- 主站迁移提示横幅（仅旧托管站域名下显示，主站 jiushuzhai.com 自动隐藏） ---------- */
.migrate-banner {
  display: none;
  max-width: 820px;
  margin: 22px auto 6px; /* 与上方四句话拉开距离 */
  padding: 12px 20px;
  background: rgba(194, 58, 32, .13); /* 半透明淡红打底 */
  border: 1px solid rgba(194, 58, 32, .38);
  border-radius: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #c23a20;
}
.migrate-banner.show { display: block; }
.migrate-banner a {
  color: #a32e18;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.dark .migrate-banner {
  background: rgba(194, 58, 32, .20);
  border-color: rgba(224, 96, 74, .4);
  color: #e0604a;
}
body.dark .migrate-banner a { color: #e87a63; }

/* ---------- 分类标签（醒目） ---------- */
.tabs {
  display: flex;
  gap: 16px;
  margin: 30px 0 30px;
  flex-wrap: wrap;
  justify-content: center;
}
.tab {
  border: 2px solid var(--seal);
  background: var(--card);
  color: var(--seal);
  border-radius: 8px;
  padding: 14px 34px;
  font-size: 19px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--card-shadow);
}
.tab:hover { background: var(--card-hover); transform: translateY(-2px); }
.tab.active {
  background: var(--seal);
  border-color: var(--seal);
  color: #fff8ec;
  box-shadow: 0 6px 18px rgba(168, 68, 44, .35);
}
.tab .tab-count {
  display: inline-block;
  min-width: 26px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 14px;
  text-align: center;
  background: rgba(168, 68, 44, .12);
  color: inherit;
}
.tab.active .tab-count { background: rgba(255, 248, 236, .25); }

.hidden { display: none !important; }

/* ---------- 书架 ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 40px 24px 60px; }

.shelf-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 26px 0 22px;
}
.shelf-title h2 {
  font-size: 22px;
  letter-spacing: 6px;
  font-weight: 700;
}
.shelf-title .count { color: var(--ink-soft); font-size: 13px; }

.books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 26px;
}

.book-card {
  background: linear-gradient(160deg, var(--card-grad-a), var(--card-grad-b));
  border: 1px solid var(--line);
  border-radius: 4px 10px 10px 4px;
  box-shadow: var(--card-shadow);
  padding: 18px 14px 14px;
  cursor: pointer;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  transform: translateY(-4px) scale(1.03) translate(var(--mx, 0px), var(--my, 0px));
  box-shadow: 0 16px 38px rgba(100, 55, 30, .32), 0 6px 14px rgba(100, 55, 30, .18);
}
/* 夜间：悬停阴影改为太阳光的金色光晕（高亮近白，面积大、强度高） */
body.dark .book-card:hover {
  box-shadow:
    0 18px 50px rgba(236, 196, 110, .62),
    0 8px 24px rgba(240, 204, 122, .45),
    0 2px 10px rgba(248, 226, 160, .55);
}
.book-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--spine, var(--seal));
  border-radius: 4px 0 0 4px;
  opacity: .85;
}
.book-cover {
  flex: none;
  border-bottom: 1px solid var(--line);
}
.book-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 7 / 10;
  object-fit: cover;
  object-position: center;
  border-radius: 0 8px 0 0;
  background: var(--card-grad-b);
}
.book-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
  margin: 12px 2px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.video-card .book-cover img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
}
.play-tag {
  color: var(--green);
  font-weight: 700;
}
.free-tag {
  color: var(--green);
  font-weight: 700;
}

/* ---------- 视频播放弹层 ---------- */
.video-wrap {
  margin-top: 14px;
  background: #2b2318;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.video-wrap video {
  display: block;
  width: 100%;
  max-height: 84vh;
  background: #000;
}
@media (max-width: 560px) {
  .video-wrap video { max-height: none; }
}

/* —— 自定义播放控制条（替换浏览器原生控件，全套统一风格：毛玻璃底 + 印章红） —— */
.cp {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 12px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
  transition: opacity .25s ease;
  z-index: 6;
}
.cp.hide { opacity: 0; pointer-events: none; }

/* 进度条（细线，悬停/拖动时浮出手柄） */
.cp-progress {
  position: relative;
  height: 14px;
  cursor: pointer;
  touch-action: none; /* 触屏拖动进度时不触发页面滚动 */
}
.cp-progress::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 3px;
  background: rgba(245, 238, 218, .28);
  border-radius: 2px;
}
.cp-buffered,
.cp-played {
  position: absolute;
  left: 0;
  top: 6px;
  height: 3px;
  width: 0;
  border-radius: 2px;
}
.cp-buffered { background: rgba(245, 238, 218, .45); }
.cp-played { background: var(--seal, #c23a20); }
.cp-knob {
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translateY(-50%) scale(0);
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  transition: transform .15s;
}
.cp-progress:hover .cp-knob,
.cp-progress.dragging .cp-knob { transform: translateY(-50%) scale(1); }

/* 按钮行 */
.cp-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cp-flex { flex: 1; }
.cp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #f5eeda;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.cp-btn:hover { background: rgba(245, 238, 218, .16); }
.cp-btn:active { color: #fff; }
/* 文字型按钮（倍速/画质）：与原画质胶囊同款毛玻璃风格；flex:none 防止被挤成圆球 */
.cp-btn.cp-txt {
  flex: none;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: #f5eeda;
  border: 1px solid rgba(245, 238, 218, .35);
  background: rgba(20, 14, 8, .55);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cp-btn.cp-txt:hover {
  background: rgba(20, 14, 8, .78);
  border-color: rgba(245, 238, 218, .6);
}
/* 图标状态切换：播放↔暂停、音量↔静音、全屏↔退出全屏 */
#cpPlay .ic-pause, #cpMute .ic-mute, #cpFull .ic-exit { display: none; }
.cp.playing #cpPlay .ic-play { display: none; }
.cp.playing #cpPlay .ic-pause { display: block; }
.cp.muted #cpMute .ic-vol { display: none; }
.cp.muted #cpMute .ic-mute { display: block; }
.cp.full #cpFull .ic-full { display: none; }
.cp.full #cpFull .ic-exit { display: block; }

/* 时间显示：无衬线小字 */
.cp-time {
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 12px;
  color: rgba(245, 238, 218, .85);
  padding: 0 8px;
  white-space: nowrap;
}

/* 音量滑杆：电脑版悬停展开；触屏设备常驻显示可拖动（安卓浏览器可用，iOS 由系统音量接管） */
.cp-vol-box { display: inline-flex; align-items: center; }
.cp-vol {
  width: 0;
  opacity: 0;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(245, 238, 218, .35);
  border-radius: 2px;
  cursor: pointer;
  transition: width .2s, opacity .2s;
}
.cp-vol-box:hover .cp-vol,
.cp-vol:focus {
  width: 64px;
  opacity: 1;
}
.cp-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
}
@media (hover: none) {
  /* 手机：普通播放时滑杆短一点给文字键留空间，全屏后恢复正常长度 */
  .cp-vol { width: 34px; opacity: 1; }
  .cp.full .cp-vol { width: 64px; }
}

/* 弹出菜单（倍速/画质共用）：从控制条向上展开 */
.cp-menu-box,
.quality-box {
  position: relative;
  display: inline-flex;
}
.q-menu,
.cp-menu {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 118px;
  background: rgba(24, 18, 11, .92);
  border: 1px solid rgba(245, 238, 218, .25);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 8;
}
.q-menu.open,
.cp-menu.open { display: block; }
.q-item,
.cp-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  text-align: left;
  color: rgba(245, 238, 218, .82);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.q-item:hover,
.cp-item:hover { background: rgba(245, 238, 218, .12); }
.q-item.active,
.cp-item.active {
  color: var(--seal, #c23a20);
  font-weight: 800;
  background: rgba(245, 238, 218, .08);
}

/* 控制条自动隐藏时光标一并隐藏 */
.video-wrap.hidecursor,
.video-wrap.hidecursor * { cursor: none !important; }

/* 原生全屏：画面铺满、控制条随自定义条一起显示 */
#videoWrap:fullscreen {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#videoWrap:fullscreen video {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain;
  background: #000;
}
@media (max-width: 560px) {
  .cp { padding: 24px 8px 5px; }
  .cp-row { gap: 2px; }
  .cp-btn { padding: 6px; }
  .cp-btn.cp-txt { padding: 3px 9px; font-size: 12px; }
  .cp-time { font-size: 11px; padding: 0 4px; }
}
.video-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}
.vc-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.vc-btn:hover { border-color: var(--seal); color: var(--seal); }
/* 图标默认隐藏（电脑版保持原文字按钮），仅手机版显示 */
.vc-btn svg { display: none; }

/* 手机版专属元素：返回键、双文案按钮、转发分享（电脑版隐藏） */
.back-btn, .share-row { display: none; }
.vc-btn .txt-short { display: none; }

@media (max-width: 560px) {
  .vc-btn .txt-long { display: none; }
  .vc-btn .txt-short { display: inline; }
}

.book-meta {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-soft);
}
.book-year { letter-spacing: 1px; }
.book-price { color: var(--seal); font-weight: 700; font-size: 14px; }

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(50, 38, 22, .45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.overlay.open { display: flex; }
.modal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 520px;
  width: 100%;
  padding: 34px 36px 30px;
  position: relative;
  box-shadow: 0 20px 60px rgba(40, 28, 12, .35);
}
.modal .close {
  position: absolute; right: 14px; top: 10px;
  border: none; background: none;
  font-size: 22px; color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  z-index: 5;
}
/* 视频弹层：两端统一采用图标化播放界面（手机版样式已提升至电脑版） */
.modal.video-modal {
  max-width: 1200px;
  width: 96vw;
  padding: 0 0 26px;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal.video-modal .close { display: none; }
/* 返回键：叠在视频画面左上角，图标左边线与标题竖标左边线（16px）对齐 */
.modal.video-modal .back-btn {
  display: flex;
  align-items: center;
  position: absolute;
  top: 16px;
  left: 8px;
  padding: 8px;
  margin: 0;
  border: none;
  background: none;
  color: #fff;
  filter: drop-shadow(0 1px 5px rgba(0, 0, 0, .65));
  z-index: 5;
}
.modal.video-modal .back-btn svg { width: 30px; height: 30px; }
/* 图标显示、文字隐藏；10s 用无衬线粗体（旧衬线体笔画细） */
.modal.video-modal .vc-btn svg { display: block; }
.modal.video-modal .vc-btn .txt-long { display: none; }
.modal.video-modal .vc-btn .txt-short {
  display: inline;
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--seal);
}
/* 画幅：贴合容器，无底色无缝隙 */
.modal.video-modal .video-wrap {
  order: 1;
  flex: none;
  margin-top: 0;
  background: transparent;
  border-radius: 0;
  line-height: 0;
}
.modal.video-modal .video-wrap video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 84vh;
  background: transparent;
}
/* 快进后退：图标 + 主题色 10s，药丸形实体按键 */
.modal.video-modal .video-controls {
  order: 2;
  margin-top: 16px;
  gap: 16px;
}
.modal.video-modal .video-controls .vc-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 24px;
  font-size: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
/* 按下瞬间：整体变主题色、图标和 10s 文字同时变白（同一过渡同步进行） */
.modal.video-modal .video-controls .vc-btn:active {
  background: var(--seal);
  border-color: var(--seal);
  color: #fff;
}
.modal.video-modal .video-controls .vc-btn:active .txt-short,
.modal.video-modal .video-controls .vc-btn:active svg {
  color: #fff;
}
/* 标题：靠左 + 主题色左竖标（书脊线） */
.modal.video-modal h3 {
  order: 3;
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  border-left: 4px solid var(--seal);
  padding-left: 12px;
  margin: 18px 16px 0;
  line-height: 1.6;
}
/* 点赞 + 分享：整体居中，点赞在左 */
.modal.video-modal .share-row {
  order: 4;
  display: block;
  margin-top: 18px;
  text-align: center;
}
.modal.video-modal .share-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
}
.modal.video-modal .share-row .vc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--ink);
  border-radius: 999px;
}
.modal.video-modal .share-row .vc-btn:active { color: var(--seal); }
.modal.video-modal .share-row .vc-btn.liked,
.modal.video-modal .share-row .vc-btn.liked:active { color: var(--seal); }
/* 播放界面三键：点赞/转发等宽（图标居中，宽度差是下载键无法居中的根因），
   等宽后三键对称，下载键像素级居中，且计数变多位后依然稳定 */
.modal.video-modal .share-group #vLikeBtn,
.modal.video-modal .share-group #vShareBtn { min-width: 90px; justify-content: center; }
/* 点赞数字：字体/字号/字重与快进后退键的 10s 完全一致（曾经漏写选择器导致整段失效） */
.modal.video-modal .share-row .like-count {
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  min-width: 20px;
  text-align: left;
}
.modal.video-modal .share-row .vc-btn.liked .like-count { color: var(--seal); }
.modal.video-modal .pay-note { order: 5; margin-top: 12px; padding: 0 16px; text-align: center; }
@media (max-width: 560px) {
  /* 手机：允许菜单向上溢出视频区，否则最顶上的「原画」会被裁掉 */
  .modal.video-modal .video-wrap { overflow: visible; }
  /* 手机：菜单项进一步紧凑化，确保整列都在视频高度内不溢出 */
  .q-item,
  .cp-item { padding: 4px 11px; font-size: 11px; letter-spacing: 0; }
  .q-menu,
  .cp-menu { max-height: 50vh; overflow-y: auto; }
  /* 播放界面整体从手机屏幕顶边拉开距离 */
  #videoOverlay {
    padding: calc(40px + env(safe-area-inset-top, 0px)) 0 0;
    align-items: flex-start;
  }
  .modal.video-modal {
    width: 100vw;
    max-width: 100vw;
    height: calc(100vh - 40px - env(safe-area-inset-top, 0px));
    max-height: calc(100vh - 40px - env(safe-area-inset-top, 0px));
    padding: 0 0 18px;
    border-radius: 0;
  }
  .modal.video-modal .video-wrap video {
    width: 100vw;
    max-width: 100vw;
  }
  .sf-btn { padding: 11px 26px; font-size: 16px; }
}
/* 转发分享备用面板（手机版，浏览器不支持系统分享时展开） */
.share-fallback {
  display: none;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.share-fallback.open { display: flex; }
.sf-btn {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 1px;
  transition: all .15s;
}
.sf-btn:hover { border-color: var(--seal); color: var(--seal); }

/* 反馈入口：页底右下角圆润小按键，位置略低于两个B站主页按键一行
   （用后代选择器压过后面的 .bili-btn 方角规则） */
.feedback-entry {
  margin-top: 20px;
  text-align: right;
  padding-right: 5%;
}
.feedback-entry .fb-open-btn {
  border-radius: 999px;
  padding: 8px 26px;
  background: rgba(255, 252, 242, .8);    /* 只透一点点，边线保持 */
  color: var(--ink-soft);
}
body.dark .feedback-entry .fb-open-btn {
  background: rgba(42, 24, 16, .8);
}
.fb-modal { max-width: 480px; width: calc(100% - 40px); }
.fb-textarea {
  width: 100%; min-height: 140px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 14px; line-height: 1.7;
  padding: 12px 14px; margin: 14px 0 4px;
}
.fb-textarea:focus { outline: none; border-color: var(--seal); }
.fb-actions { text-align: center; margin-top: 12px; }
#fbSendBtn:disabled { opacity: .55; cursor: default; }
.modal h3 {
  font-size: 18px;
  letter-spacing: 1px;
  margin-bottom: 6px;
  padding-left: 12px;
  border-left: 4px solid var(--seal);
  line-height: 1.5;
}
.m-cover {
  text-align: center;
  margin-bottom: 16px;
}
.m-cover img {
  max-height: 230px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--card-shadow);
}
.modal .m-meta { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }
.modal .m-desc {
  font-size: 14px;
  color: var(--ink);
  background: var(--pill-bg);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pay-price { font-size: 15px; }
.pay-price b { color: var(--seal); font-size: 22px; }
.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 26px;
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary { background: var(--seal); color: #fff8ec; }
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pay-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- 打赏 ---------- */
.donate {
  margin-top: 70px;
  border-top: 1px solid var(--line);
  padding-top: 44px;
  text-align: center;
}
.donate h2 { font-size: 22px; letter-spacing: 6px; }
.donate-actions { margin-top: 20px; }
.donate-btn {
  display: inline-block;
  text-decoration: none;
}
/* B站主页入口：比打赏按钮小一号，同为纸面圆角风格，两个并排等大 */
.bili-links {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 16px;
}
.bili-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 18px 7px 8px;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 2px;
  transition: all .15s;
}
/* B站头像：圆形小图，与按钮文字同高，风格与封面纸面一致 */
.bili-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(90, 60, 35, .18);
  transition: box-shadow .15s ease, transform .15s ease;
}
.bili-btn:hover { border-color: var(--seal); color: var(--seal); }
/* 悬停时头像浮起带阴影，与卡片悬停风格一致 */
.bili-btn:hover .bili-avatar {
  box-shadow:
    0 4px 12px rgba(100, 55, 30, .30),
    0 2px 5px rgba(100, 55, 30, .20);
  transform: translateY(-1px);
}
body.dark .bili-btn:hover .bili-avatar {
  box-shadow:
    0 4px 14px rgba(236, 196, 110, .45),
    0 2px 6px rgba(240, 204, 122, .30);
}
.donate-actions .pay-note { margin-top: 12px; }
.qr-wrap {
  display: inline-flex;
  gap: 40px;
  justify-content: center;
}
.qr-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 24px;
  width: 190px;
  box-shadow: var(--card-shadow);
}
.qr-placeholder {
  width: 140px; height: 140px;
  margin: 0 auto;
  background:
    repeating-linear-gradient(45deg, var(--paper-deep) 0 6px, var(--card) 6px 12px);
  border: 1px dashed var(--line);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.6;
}
.qr-box .qr-label { margin-top: 12px; font-size: 13px; letter-spacing: 2px; }

/* ---------- 页脚 ---------- */
footer.site {
  text-align: center;
  padding: 30px 20px 44px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 2px;
}
footer.site .foot-line { margin-top: 8px; }

/* 手机版视图（手动切换） */
/* 顶部悬浮按钮组：主题切换 + 手机/电脑切换 */
.top-actions {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 40; /* 低于弹层(z-50)，打开弹窗时被遮罩盖住 */
  display: flex;
  gap: 8px;
}
.view-toggle {
  border: 1px solid var(--line);
  background: var(--pill-bg-strong);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
}
.view-toggle:hover { color: var(--seal); border-color: var(--seal); }
body.mobile-view main,
body.mobile-view .intro { max-width: 480px; }
body.mobile-view .books { grid-template-columns: repeat(2, 1fr); gap: 14px; }
body.mobile-view .book-cover img { aspect-ratio: 7 / 10; }
body.mobile-view .video-card .book-cover img { aspect-ratio: 16 / 9; }

@media (max-width: 560px) {
  .tab { padding: 11px 22px; font-size: 16px; letter-spacing: 2px; }
  .books { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
  .book-title { font-size: 12px; min-height: 36px; }
  /* 手机版：反馈键与上方两个 B 站主页按键拉开距离（电脑版不变） */
  .feedback-entry { margin-top: 44px; }
}
/* 电脑上点「手机版」预览时同样拉开距离 */
body.mobile-view .feedback-entry { margin-top: 44px; }

/* ---------- 背景细沙流（canvas 粒子） ---------- */
.bg-sand {
  position: fixed;
  inset: 0;
  z-index: -1;          /* 压在纸纹底色之上、所有内容之下 */
  pointer-events: none; /* 纯装饰，不拦截任何点击 */
  display: block;
}

/* ---------- 主题切换按钮（太阳 / 月亮图标，主题色） ---------- */
.theme-toggle {
  padding: 7px 10px;
  display: flex;
  align-items: center;
  line-height: 0;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  color: var(--seal);
}

/* ---------- 夜间主题：暗夜书房，与旧书暖色协调 ---------- */
body.dark {
  --paper: #140a06;        /* 夜间底色：更黑的暗红黑（低饱和） */
  --paper-deep: #0e0603;
  --ink: #e3d2b5;          /* 暖羊皮纸文字（降饱和） */
  --ink-soft: #a68a6c;
  --seal: #c23a20;         /* 灯下印章红：压暗去橙，用于按键/标签 */
  --ochre: #c9a067;
  --green: #8f9c88;
  --line: #40261a;
  --card: #2a1810;
  --card-hover: #332013;
  --card-grad-a: #2c1a0f;
  --card-grad-b: #211208;
  --pill-bg: rgba(44, 26, 16, .72);
  --pill-bg-strong: rgba(38, 22, 13, .94);
  --card-shadow: 0 2px 10px rgba(0, 0, 0, .5);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(95, 42, 24, .10), transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(62, 29, 16, .12), transparent 45%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .07) 2px 3px);
}
/* 夜间下的局部微调（变量覆盖不到的部位） */
body.dark .overlay { background: rgba(8, 6, 3, .62); }

/* 内置浏览器轻提示（微信/B站/微博/QQ/支付宝内打开时出现，可关） */
.app-hint {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 9990;
  max-width: min(92vw, 470px);
  background: rgba(245, 238, 218, .95);
  color: #3a2f26;
  border: 1px solid rgba(194, 58, 32, .32);
  border-radius: 14px;
  padding: 10px 36px 10px 16px;
  font-size: 12.5px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.app-hint b { color: #c23a20; font-weight: 600; }
body.dark .app-hint {
  background: rgba(34, 24, 18, .95);
  color: #e3d2b5;
  border-color: rgba(226, 140, 96, .32);
}
body.dark .app-hint b { color: #e2704c; }
.app-hint-close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .5;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.app-hint-close:hover { opacity: .9; }
