/* 诗词坊 · 移动端 PWA 样式 —— 宣纸 / 墨色 / 朱砂 */

:root {
  --paper: #f5f1e6;
  --surface: #fffdf6;
  --ink: #2b2723;
  --ink-2: #6f6656;
  --ink-3: #a29881;
  --accent: #a63a2b;
  --accent-soft: #f3e0d8;
  --gold: #b08d3e;
  --line: #e7dfcc;
  --radius: 14px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "FangSong", serif;
  --tab-h: 58px;
  --top-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(176, 141, 62, .05), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(166, 58, 43, .04), transparent 45%);
  overflow-x: clip; /* 异常富文本不得撑出横向滚动 */
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--top-h);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(245, 241, 230, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.seal {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff; font-size: 20px; font-weight: 700;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(166, 58, 43, .35);
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: 2px; }
.icon-btn {
  border: none; background: none; color: var(--ink);
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%;
}
.icon-btn:active { background: var(--accent-soft); }

/* ---------- 主区域 ---------- */
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tab-h) + var(--safe-b) + 24px);
  min-height: calc(100vh - var(--top-h) - var(--tab-h));
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex;
  max-width: 640px; margin: 0 auto;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 253, 246, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--ink-3);
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent); }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(43, 39, 35, .04);
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 2px 12px;
}
.section-head h2 {
  margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.section-head h2::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px;
  background: var(--accent);
}
.section-head .more { font-size: 13px; color: var(--ink-3); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; cursor: grab; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.chips.dragging { cursor: grabbing; user-select: none; }
.chips:hover { scrollbar-color: rgba(90, 74, 48, .3) transparent; }
.chips::-webkit-scrollbar { height: 5px; }
.chips::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.chips:hover::-webkit-scrollbar-thumb { background: rgba(90, 74, 48, .25); }
.chips.wrap { flex-wrap: wrap; overflow: visible; cursor: default; }
.chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip b { font-weight: 400; font-size: 11px; color: var(--ink-3); }
.chip.active b { color: rgba(255, 255, 255, .75); }
.chips.wrap { flex-wrap: wrap; overflow: visible; }

/* 诗文卡片 */
.poem-item { display: block; padding: 14px 16px; margin-bottom: 10px; }
.poem-item .t { font-size: 16.5px; font-weight: 700; }
.poem-item .m { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.poem-item .m .sep { margin: 0 6px; color: var(--line); }
.poem-item .x {
  font-size: 13.5px; color: var(--ink-2); margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- 首页 ---------- */
.today-card {
  display: block; /* <a> 行内元素必须显式块化, 否则碎片化渲染错乱 */
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #fffdf6 0%, #f9f3e4 70%, #f4ead2 100%);
  border: 1px solid #e9ddc0;
  border-radius: var(--radius);
  padding: 22px 16px 16px;
  box-shadow: 0 2px 10px rgba(176, 141, 62, .10);
}
/* 右上角丝带角标: 用真实 DOM 元素(.ribbon), 此环境的伪元素角标渲染不可靠 */
.today-card .ribbon {
  position: absolute; top: 0; right: 0;
  font-size: 11px; letter-spacing: 3px; line-height: 1;
  color: #fff; background: var(--accent);
  padding: 8px 10px 8px 13px;
  border-radius: 0 var(--radius) 0 12px;
  opacity: .92;
}
.today-card .label { font-size: 12px; color: var(--gold); letter-spacing: 3px; padding-right: 76px; }
.today-card h1 { margin: 6px 0 4px; font-size: 24px; letter-spacing: 2px; }
.today-card .meta { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }
.today-card .verse {
  font-size: 15.5px; line-height: 2; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.today-card .verse p { margin: 0; }

.search-ico { width: 16px; height: 16px; color: var(--ink-3); flex: 0 0 auto; }

.home-search {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 11px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-3); font-size: 14px; cursor: pointer;
}

.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px; cursor: grab; scrollbar-width: thin; scrollbar-color: transparent transparent; -webkit-mask-image: linear-gradient(90deg, #000 90%, rgba(0, 0, 0, .35)); mask-image: linear-gradient(90deg, #000 90%, rgba(0, 0, 0, .35)); }
.hscroll.dragging { cursor: grabbing; user-select: none; }
.hscroll:hover { scrollbar-color: rgba(90, 74, 48, .3) transparent; }
.hscroll::-webkit-scrollbar { height: 5px; }
.hscroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.hscroll:hover::-webkit-scrollbar-thumb { background: rgba(90, 74, 48, .25); }

.quote-card {
  flex: 0 0 260px;
  display: flex; flex-direction: column; justify-content: space-between;
  height: 150px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.quote-card .q {
  font-size: 14.5px; line-height: 1.8; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.quote-card .s { margin-top: 8px; font-size: 12px; color: var(--ink-3); }

.book-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.book-card { padding: 14px; display: block; }
.book-card .n { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.book-card .p { margin-top: 4px; font-size: 12px; color: var(--ink-3); }

.author-chip {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 64px; font-size: 12.5px; color: var(--ink-2);
}
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px; color: #fff;
  background: linear-gradient(135deg, #b8863e, #a63a2b);
  box-shadow: 0 2px 6px rgba(43, 39, 35, .15);
}
.avatar.small { width: 38px; height: 38px; font-size: 16px; }

/* ---------- 详情页 ---------- */
.poem-page .poem-title { text-align: center; font-size: 22px; letter-spacing: 2px; margin: 18px 0 6px; }
.poem-page .poem-meta { text-align: center; font-size: 13.5px; color: var(--ink-3); margin-bottom: 18px; }
.poem-page .poem-meta a { color: var(--accent); }
.poem-content {
  font-size: 17px; line-height: 2.2; color: var(--ink);
  text-align: center; letter-spacing: .5px;
  overflow-wrap: break-word;
}
.poem-content p { margin: 0 0 14px; }
.chapter-content { overflow-wrap: break-word; }
.subcard .body { overflow-wrap: break-word; }
.subcard .body span { white-space: normal !important; } /* 原站引用条目常带 nowrap 内联样式 */

/* 语音朗读按钮 */
.tts-row { display: flex; justify-content: flex-end; margin: -6px 0 10px; }
.tts-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--accent-soft); background: var(--surface);
  color: var(--accent); font-size: 13px; font-family: inherit;
  cursor: pointer;
}
.tts-btn:active { background: var(--accent-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0 0; }

.subcard { margin-top: 14px; padding: 16px; }
.subcard h3 {
  margin: 0 0 10px; font-size: 15px; color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.subcard h3::before { content: ""; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; }
.subcard .body { font-size: 14.5px; line-height: 1.9; color: var(--ink-2); }
.subcard .body p { margin: 0 0 8px; }
.author-card { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; }
.author-card .avatar { flex: 0 0 auto; margin-top: 2px; }
.author-card .info { min-width: 0; }
.author-card .name { font-size: 16px; font-weight: 700; }
.author-card .dyn { font-size: 12px; color: var(--ink-3); }
.author-card .intro {
  margin-top: 6px; font-size: 13.5px; color: var(--ink-2); line-height: 1.8;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.author-card .intro.expanded { display: block; }
.link-btn {
  margin-top: 6px; border: none; background: none; padding: 0;
  color: var(--accent); font-size: 13px; cursor: pointer;
}

/* ---------- 列表筛选 ---------- */
.filter-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.count-note { font-size: 12.5px; color: var(--ink-3); margin: 4px 2px 10px; }

/* ---------- 搜索页 ---------- */
.search-box {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.search-box input {
  flex: 1; border: none; outline: none; background: none;
  font-family: inherit; font-size: 15.5px; color: var(--ink);
}
.search-box .clear { border: none; background: none; color: var(--ink-3); cursor: pointer; font-size: 14px; white-space: nowrap; flex: 0 0 auto; padding: 0 0 0 6px; }
.search-section { margin-top: 14px; }
.search-section h2 { font-size: 14px; color: var(--ink-3); font-weight: 400; margin: 0 0 8px; letter-spacing: 1px; }

/* ---------- 古籍 ---------- */
.part-row { margin-bottom: 8px; }
.chapter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.chapter-grid a {
  padding: 10px 6px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.intro-text { font-size: 14.5px; line-height: 1.9; color: var(--ink-2); }
.intro-text.clamp {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.chapter-content { font-size: 16.5px; line-height: 2.1; }
.locked {
  margin-top: 16px; padding: 22px 16px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--ink-3); font-size: 14px;
}

/* ---------- 作者 ---------- */
.author-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 10px; }
.author-row .info { flex: 1; min-width: 0; }
.author-row .name { font-size: 16px; font-weight: 700; }
.author-row .m { font-size: 12.5px; color: var(--ink-3); }

/* ---------- 状态 ---------- */
.empty { text-align: center; color: var(--ink-3); padding: 40px 0; font-size: 14px; }
.error-box { text-align: center; color: var(--accent); padding: 40px 0; }
.skeleton {
  background: linear-gradient(90deg, #eee7d6 25%, #f5f0e2 50%, #eee7d6 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
  border-radius: 10px; height: 14px; margin: 10px 0;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
  margin: 18px auto; width: 26px; height: 26px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sentinel { height: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px);
  transform: translateX(-50%);
  background: rgba(43, 39, 35, .92); color: #fff;
  padding: 10px 20px; border-radius: 999px; font-size: 13.5px;
  z-index: 100; animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; } }

/* 桌面宽屏时模拟手机居中 */
@media (min-width: 720px) {
  body { background: #ece5d3; }
  .topbar, .tabbar { border-radius: 0; }
}

/* ============================================================
   视觉升级 v16 —— 质感、动效、骨架屏、广告位
   ============================================================ */

/* ---------- 印章与顶栏质感 ---------- */
.seal {
  background: linear-gradient(145deg, #b8452f, var(--accent) 55%, #8f2f22);
  box-shadow: 0 2px 8px rgba(166, 58, 43, .38), inset 0 1px 1px rgba(255, 255, 255, .25);
  font-family: var(--serif);
}
.icon-btn { transition: background .15s; }
.icon-btn:active { transform: scale(.92); }

/* ---------- 卡片质感与按压反馈 ---------- */
.card {
  box-shadow: 0 1px 2px rgba(43, 39, 35, .04), 0 4px 14px rgba(43, 39, 35, .05);
}
.card, .chip, .tts-btn { transition: transform .12s ease, box-shadow .15s ease; }
.card:active { transform: scale(.985); }
.chip:active { transform: scale(.94); }

/* ---------- 页面切入动效(路由渲染的新节点自动应用) ---------- */
#app > * { animation: fadeUp .32s ease both; }
#app > *:nth-child(2) { animation-delay: .04s; }
#app > *:nth-child(3) { animation-delay: .08s; }
#app > *:nth-child(4) { animation-delay: .12s; }
#app > *:nth-child(n+5) { animation-delay: .15s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #app > * { animation: none; }
}

/* ---------- 今日一诗: 水墨装饰 ---------- */
.today-card::before {
  content: "詩";
  position: absolute; right: -6px; bottom: -30px;
  font-size: 110px; line-height: 1;
  color: rgba(166, 58, 43, .055);
  pointer-events: none;
  font-family: var(--serif);
}
.today-card h1 { text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }

/* ---------- 名句卡引号装饰 ---------- */
.quote-card { position: relative; }
.quote-card .q::before {
  content: "\201C";
  position: absolute; left: 10px; top: 2px;
  font-size: 30px; line-height: 1;
  color: rgba(176, 141, 62, .4);
  font-family: Georgia, serif;
}

/* ---------- 骨架屏 ---------- */
.skel { animation: shimmer 1.2s infinite; background: linear-gradient(90deg, #ece5d2 25%, #f4efe1 50%, #ece5d2 75%); background-size: 200% 100%; border-radius: 10px; }
.skel-card { height: 96px; margin-bottom: 12px; border: 1px solid rgba(231, 223, 204, .6); }
.skel-title { height: 26px; width: 42%; margin: 4px 2px 16px; }
.skel-chips { display: flex; gap: 8px; margin-bottom: 18px; }
.skel-chip { height: 30px; flex: 0 0 auto; }
.skel-chip.w1 { width: 64px; } .skel-chip.w2 { width: 88px; } .skel-chip.w3 { width: 74px; }

/* ---------- 返回顶部 ---------- */
.back-top {
  position: fixed; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 20px);
  z-index: 60;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: rgba(255, 253, 246, .95);
  box-shadow: 0 4px 14px rgba(43, 39, 35, .16);
  color: var(--ink-2); cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .2s;
  transform: translateY(8px);
}
.back-top.show { opacity: 1; pointer-events: auto; transform: none; }
.back-top:active { transform: scale(.92); }

/* ---------- 广告位 ---------- */
.ad-slot {
  position: relative;
  margin: 14px 0;
  min-height: 90px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  border: 1px dashed rgba(176, 141, 62, .45);
  border-radius: var(--radius);
  background: rgba(249, 243, 228, .5);
  overflow: hidden;
}
.ad-slot .ad-tag {
  position: absolute; left: 8px; top: 6px;
  font-size: 10px; color: rgba(162, 152, 129, .9);
  border: 1px solid rgba(162, 152, 129, .4);
  border-radius: 3px; padding: 0 4px; line-height: 1.5;
}
.ad-slot .ad-note { font-size: 12px; color: var(--ink-3); letter-spacing: 1px; }
.ad-slot .ad-size { font-size: 10.5px; color: rgba(162, 152, 129, .75); }
.ad-slot:empty { border-style: solid; border-color: transparent; background: none; min-height: 0; margin: 0; }
.poem-page .ad-slot, .list-ad { margin: 14px 2px; }

/* ============================================================
   v17 —— 墨夜暗色模式 + 阅读字号缩放
   切换方式: html[data-theme="dark"]; 字号: 根元素 --read-scale
   ============================================================ */

:root { --read-scale: 1; }

/* 阅读面字号跟随缩放 */
.poem-content { font-size: calc(17px * var(--read-scale)); }
.chapter-content { font-size: calc(16px * var(--read-scale)); }
.subcard .body { font-size: calc(14px * var(--read-scale)); line-height: 1.9; }

/* 阅读页字号调节控件 */
.read-ctl { display: flex; gap: 6px; }
.read-btn {
  min-width: 34px; padding: 7px 10px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
  font-family: var(--serif); font-size: 12.5px; font-weight: 700;
  cursor: pointer;
}
.read-btn:active { transform: scale(.94); color: var(--accent); border-color: var(--accent-soft); }

/* ---------- 墨夜暗色 ---------- */
html[data-theme="dark"] {
  --paper: #1d1a16;
  --surface: #27221b;
  --ink: #e9e2d0;
  --ink-2: #b4aa93;
  --ink-3: #857c66;
  --accent: #d0685a;
  --accent-soft: #402a24;
  --gold: #c4a260;
  --line: #37312a;
}
html[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 15% 20%, rgba(196, 162, 96, .05), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(208, 104, 90, .04), transparent 45%);
}
html[data-theme="dark"] .topbar {
  background: rgba(29, 26, 22, .92);
  border-bottom-color: #2e2921;
}
html[data-theme="dark"] .tabbar {
  background: rgba(35, 31, 25, .96);
  border-top-color: #2e2921;
}
html[data-theme="dark"] .seal {
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5), inset 0 1px 1px rgba(255, 255, 255, .18);
}
html[data-theme="dark"] .today-card {
  background: linear-gradient(150deg, #2b261f 0%, #241f19 70%, #201c16 100%);
  border-color: #3a332a;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .today-card::before { color: rgba(208, 104, 90, .08); }
html[data-theme="dark"] .today-card h1 { text-shadow: none; }
html[data-theme="dark"] .today-card .label { color: var(--gold); }
html[data-theme="dark"] .card { box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25); }
html[data-theme="dark"] .quote-card .q::before { color: rgba(196, 162, 96, .5); }
html[data-theme="dark"] .skel { background: linear-gradient(90deg, #26221b 25%, #2e2922 50%, #26221b 75%); background-size: 200% 100%; }
html[data-theme="dark"] .skel-card { border-color: #332d25; }
html[data-theme="dark"] .back-top {
  background: rgba(39, 34, 27, .95);
  border-color: #3a332a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
html[data-theme="dark"] .ad-slot {
  border-color: rgba(196, 162, 96, .35);
  background: rgba(42, 37, 28, .45);
}
html[data-theme="dark"] .ad-slot .ad-tag { color: rgba(133, 124, 102, 1); border-color: rgba(133, 124, 102, .5); }
html[data-theme="dark"] .home-search { background: var(--surface); }
html[data-theme="dark"] .icon-btn:active { background: var(--accent-soft); }
html[data-theme="dark"] .tts-btn { background: var(--surface); }
html[data-theme="dark"] .read-btn { background: var(--surface); }
html[data-theme="dark"] .toast { background: rgba(58, 52, 42, .95); }
html[data-theme="dark"] .author-card .dyn { color: var(--gold); }

/* 桌面宽屏的暗色底 */
@media (min-width: 720px) {
  html[data-theme="dark"] body { background: #17140f; }
}

/* ============================================================
   v18 —— 用户视角 UI 精修
   ============================================================ */

/* ---------- 全局细节 ---------- */
::selection { background: rgba(166, 58, 43, .22); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- 今日一诗: 日期 + 题下笔触 ---------- */
.today-top { display: flex; justify-content: space-between; align-items: center; padding-right: 76px; }
.today-top .label { padding-right: 0; }
.today-date { font-size: 11.5px; color: var(--ink-3); letter-spacing: 1px; flex: 0 0 auto; }
.today-card h1 { font-size: 26px; display: inline-block; position: relative; margin-bottom: 10px; }
.today-card h1::after {
  content: ""; position: absolute; left: 1px; right: -3px; bottom: -3px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(166, 58, 43, .12));
}
.today-card .verse { margin-top: 8px; }

/* ---------- 主题标签墙: 收起/展开 ---------- */
.more-tags { cursor: pointer; }
.more-tags b { font-weight: 400; }

/* ---------- 古籍封面(书脊) ---------- */
.book-card {
  position: relative; padding: 14px 14px 14px 20px;
  background: linear-gradient(160deg, var(--surface) 0%, var(--paper) 130%);
}
.book-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--accent) 100%);
  opacity: .85;
}
.book-card::after {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px;
  background: rgba(255, 253, 246, .5);
}
html[data-theme="dark"] .book-card::after { background: rgba(0, 0, 0, .35); }
.book-card .n { font-size: 15.5px; font-weight: 700; letter-spacing: 1.5px; }
.book-card .p { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; letter-spacing: .5px; }

/* ---------- 诗文详情排版 ---------- */
.poem-page .poem-title { position: relative; padding-bottom: 13px; }
.poem-page .poem-title::after {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 38px; height: 3px; border-radius: 2px; background: var(--accent);
}
.poem-page .poem-meta {
  display: table; margin: 10px auto 14px;
  padding: 5px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  letter-spacing: .5px;
}
.poem-page .tts-row { margin-top: 2px; }

/* ---------- 底部导航指示条 ---------- */
.tabbar a { position: relative; transition: color .2s ease; }
.tabbar a::before {
  content: ""; position: absolute; top: 0; left: 50%;
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--accent);
  transform: translateX(-50%) scaleX(0);
  transition: transform .22s ease;
}
.tabbar a.active::before { transform: translateX(-50%) scaleX(1); }
.tabbar a svg { transition: transform .2s ease; }
.tabbar a.active svg { transform: translateY(-1px); }

/* ---------- 分享按钮(与朗读按钮同行) ---------- */
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-family: inherit;
  cursor: pointer;
}
.share-btn:active { transform: scale(.94); }

/* ---------- v19: 朗读高亮 / 注音 ruby / 重复版本 ---------- */
.tts-seg.active {
  background: var(--accent-soft);
  border-radius: 6px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.poem-content ruby, .chapter-content ruby { ruby-align: center; }
.poem-content rt, .chapter-content rt {
  font-size: 0.42em; color: var(--accent); letter-spacing: 0;
  font-family: var(--serif); font-weight: 400;
}
.read-btn.on { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.dup-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 12px 2px 0;
}
.dup-row .dup-note { font-size: 12px; color: var(--ink-3); }

/* ---------- v22: 热门诗文 / 我的页 / 收藏 ---------- */
.hot-list { display: flex; flex-direction: column; gap: 10px; }
.hot-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.hot-item:active { transform: scale(.99); }
.hot-rank {
  flex: 0 0 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 6px; font-size: 13px; font-weight: 700;
  color: var(--ink-3); background: rgba(162, 152, 129, .14);
}
.hot-rank.top { color: #fff; background: var(--accent); }
.hot-item .hot-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hot-item .t { font-size: 15px; font-weight: 700; }
.hot-item .m { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.hot-item .hot-n { font-size: 12px; color: var(--ink-3); flex: 0 0 auto; }

.mine-entry {
  display: block; text-align: center;
  margin-top: 26px; padding: 13px;
  border: 1rpx solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--accent); font-size: 14px;
}
.mine-page .section-head button.mine-clear {
  border: none; background: none; color: var(--ink-3); font-size: 12.5px; cursor: pointer;
}
.mine-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.mine-item .mine-main {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0;
  color: inherit; text-decoration: none;
}
.mine-item .star { color: var(--gold); flex: 0 0 auto; }
.mine-item .mine-txt { display: flex; flex-direction: column; min-width: 0; }
.mine-item .t { font-size: 15px; font-weight: 700; }
.mine-item .m { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.mine-item .mine-del {
  flex: 0 0 auto; width: 26px; height: 26px;
  border: none; background: none; color: var(--ink-3);
  font-size: 16px; cursor: pointer; border-radius: 50%;
}
.mine-item .mine-del:active { background: var(--accent-soft); color: var(--accent); }

.read-btn.faved { color: var(--gold); border-color: rgba(176, 141, 62, .5); }
.hit-text { color: var(--accent); }
