/* 《一道》站点样式：移动优先，阅读为主 */
:root {
  --bg: #faf8f4;
  --fg: #2d2a26;
  --muted: #6f685d;
  --accent: #7a5c3e;
  --card: #ffffff;
  --border: #e8e2d8;
  --q-bg: #f3eee6;
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 17px;
}
html[data-theme="dark"] {
  --bg: #1c1a17;
  --fg: #d8d2c8;
  --muted: #8a8378;
  --accent: #c9a87c;
  --card: #262320;
  --border: #3a362f;
  --q-bg: #2a2622;
}
html[data-fontsize="large"] { font-size: 20px; }
html[data-fontsize="xlarge"] { font-size: 23px; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #1c1a17; --fg: #d8d2c8; --card: #262320;
    --border: #3a362f; --q-bg: #2a2622; --accent: #c9a87c;
    --muted: #8a8378;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  line-height: 1.9;
}
main { max-width: 42rem; margin: 0 auto; padding: 1rem 1.2rem 3rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.4; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .6rem; color: var(--accent); }
.muted { color: var(--muted); font-size: .9rem; }

/* 页眉页脚 */
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1.2rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.site-name { font-size: 1.2rem; font-weight: 700; letter-spacing: .3em; color: var(--fg); }
/* 内页左上角「‹ 首页」：棕色、明确可点（首页则不放，nav 靠右） */
.site-name.home-link { font-size: 1rem; font-weight: 400; letter-spacing: normal; color: var(--accent); }
.site-name.home-link:hover { text-decoration: underline; }
.site-nav { display: flex; gap: .8rem; align-items: center; margin-left: auto; }
.site-nav a { color: var(--muted); font-size: .9rem; padding: .4rem .3rem; }
.site-nav button {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); cursor: pointer; padding: .4rem .7rem; font-size: .85rem;
  font-family: inherit;
}
.site-nav button:hover { color: var(--accent); border-color: var(--accent); }
.site-footer {
  border-top: 1px solid var(--border); margin-top: 2rem;
  padding: 1.2rem; text-align: center; color: var(--muted); font-size: .8rem;
}

/* 首页 */
.hero { text-align: center; padding: 2rem 0 1rem; }
/* 书法主标题：一+道 合成一张字图（字间距已烘进图内），要么一起出、要么一起不出。--dao-h 控大小 */
.hero-title {
  --dao-h: 3.6rem;
  display: flex; align-items: center; justify-content: center;
  margin: .3rem 0 .5rem; line-height: 1;
}
.hero-title img { display: block; width: auto; height: var(--dao-h); }
@media (max-width: 480px) { .hero-title { --dao-h: 2.8rem; } }
/* 深色模式：黑字反白 */
html[data-theme="dark"] .hero-title img { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .hero-title img { filter: invert(1); }
}
.subtitle { color: var(--accent); }
.intro { color: var(--muted); font-size: .9rem; }
.searchbox { display: flex; gap: .5rem; margin: 1.2rem 0; }
.searchbox input {
  flex: 1; padding: .6rem .9rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--card); color: var(--fg);
  font-family: inherit; font-size: .95rem;
}
.searchbox button {
  padding: .6rem 1.1rem; border: none; border-radius: 8px;
  background: var(--accent); color: var(--bg); cursor: pointer;
  font-family: inherit; font-size: .95rem;
}
/* 搜索示例问题（点一下自动搜） */
.ask-eg {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  justify-content: center; margin: -.5rem 0 .4rem;
}
.ask-eg-hint { color: var(--muted); font-size: .82rem; }
.ask-eg .eg {
  border: 1px solid var(--border); background: none; color: var(--fg);
  border-radius: 999px; padding: .28rem .8rem; font-size: .84rem;
  font-family: inherit; cursor: pointer; line-height: 1.3;
}
.ask-eg .eg:hover { border-color: var(--accent); color: var(--accent); }
#search-results { text-align: left; }
#search-results .hit-snippet { color: var(--muted); font-size: .85rem; }
/* 结果里高亮命中的查询词——替读者回答"为什么给我看这段" */
.hl { background: rgba(122,92,62,.20); color: inherit; border-radius: 2px; padding: 0 .05em; }
html[data-theme="dark"] .hl { background: rgba(210,170,120,.26); }
@media (prefers-color-scheme: dark) { html:not([data-theme]) .hl { background: rgba(210,170,120,.26); } }
/* 语义检索命中的原文片段：作者原句，加大、宋体、加粗左框，突出「这是原文的真味」，引读者点进去 */
.article-list .passage {
  display: block; margin: .5rem 0 .3rem; padding: .65rem .95rem;
  background: var(--q-bg); border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0; color: var(--fg);
  font-family: "Songti SC", "SimSun", "STSong", serif;
  font-size: 1.04rem; line-height: 1.95; text-align: justify;
}
/* 深链定位到的最相关段落，短暂高亮 */
.hl {
  background: var(--q-bg); box-shadow: 0 0 0 .35rem var(--q-bg);
  border-radius: 4px; animation: hl-fade 2.4s ease;
}
@keyframes hl-fade { 0% { background: var(--accent); } 30% { background: var(--q-bg); } }

/* 整理提炼（默认随搜索触发，真流式逐字显现） */
#organize-summary:empty { display: none; }
.organize-result {
  margin: 0 0 1rem; padding: .9rem 1.1rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; text-align: left;
}
.organize-disclaimer { color: var(--muted); font-size: .8rem; margin: 0 0 .7rem; }
/* 免责声明末尾的「技术说明」入口：暖色小链接（书名号包裹，跟全站措辞一致），明确可点又不抢戏 */
.organize-note-link { color: var(--accent); white-space: nowrap; }
.organize-note-link:hover { text-decoration: underline; }
.sum-loading { margin: 0; }
/* 论点小标题：左对齐、带序号、短加粗暖色，读者扫一眼就能定位 */
.sum-h { font-size: 1rem; font-weight: 700; color: var(--accent); text-align: left; margin: 1rem 0 .4rem; }
.sum-h:first-of-type { margin-top: 0; }
.sum-h-num { margin-right: .45em; opacity: .75; }
.sum-p { text-align: justify; line-height: 1.9; margin: 0 0 .7rem; }
.sum-p:last-child { margin-bottom: 0; }
/* 流式光标：正文末尾闪烁的竖条，让读者感到"正在写" */
.sum-caret {
  display: inline-block; width: .12em; height: 1em; margin-left: 2px;
  background: var(--accent); opacity: .7; vertical-align: -.12em;
  animation: sum-blink 1s steps(1) infinite;
}
@keyframes sum-blink { 50% { opacity: 0; } }
/* 引用编号：上标数字，明显加大加深，主动招呼读者「这有出处、去读原文」；点击才弹确认，避免误触跳走 */
.cite-mark {
  cursor: pointer; color: var(--accent); font-size: .82rem; font-weight: 700;
  padding: 0 .16rem; text-decoration: none; font-family: inherit;
}
.cite-mark:hover { text-decoration: underline; }
/* 文末「去读原文」门：每篇一条醒目文字链——《篇名》+「读原文 ›」，暖色加大，悬停加下划线；不描边、不做药丸 */
.sum-src {
  margin-top: 1.1rem; padding-top: .85rem; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.15rem;
}
.sum-src-label { width: 100%; color: var(--accent); font-weight: 700; font-size: .95rem; margin-bottom: .3rem; }
.sum-src-item {
  display: inline-flex; align-items: baseline; gap: .3rem;
  font-size: 1rem; color: var(--accent); text-decoration: none;
}
.sum-src-item:hover { text-decoration: underline; }
.sum-src-num { color: var(--muted); font-size: .74rem; }
.sum-src-go { color: var(--accent); font-weight: 700; font-size: .88rem; white-space: nowrap; }
.cite-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem;
}
.cite-dialog {
  background: var(--card); border-radius: 10px; padding: 1.2rem;
  max-width: 20rem; width: 100%; text-align: center;
}
.cite-dialog p { margin: 0 0 1rem; color: var(--fg); }
.cite-actions { display: flex; gap: .7rem; justify-content: center; }
.cite-actions button, .cite-actions a {
  padding: .5rem 1rem; border-radius: 8px; font-size: .9rem; cursor: pointer;
  font-family: inherit; display: inline-block;
}
.cite-cancel { border: 1px solid var(--border); background: none; color: var(--muted); }
.cite-go { border: none; background: var(--accent); color: var(--bg); }

/* 说明类长文页（如「智能整理·技术说明」，由 content/*.md 渲染） */
.doc { line-height: 1.85; }
.doc h2 { margin: 0 0 1rem; }
.doc h3 { font-size: 1.02rem; color: var(--accent); margin: 1.7rem 0 .5rem; }
.doc p { margin: .85rem 0; }
.doc ul { margin: .7rem 0; padding-left: 1.3rem; }
.doc li { margin: .4rem 0; }
.doc strong { color: var(--fg); }
.doc hr { border: none; border-top: 1px solid var(--border); margin: 1.8rem 0 1rem; }
.doc hr + p { color: var(--muted); font-size: .9rem; }   /* 落款：分隔线后一段淡一点 */

/* 首页「按处境找文章」·甲式：两簇文字雅致排布 */
.cat-nav { display: flex; flex-direction: column; gap: .6rem; }
.cat-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .7rem; }
.cat-group-label { color: var(--muted); font-size: .85rem; margin-right: .5rem; min-width: 4em; }
.cat-group a { color: var(--accent); }   /* 棕色，明确可点 */
.cat-group a:hover { text-decoration: underline; }
.cat-n { color: var(--muted); font-size: .72rem; margin-left: .15rem; vertical-align: .1em; }

/* 文章列表 */
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { border-bottom: 1px solid var(--border); }
.article-list a { display: block; padding: .65rem .2rem; color: var(--fg); }
.article-list a:hover { text-decoration: none; background: var(--card); }
.article-list .num { color: var(--muted); font-size: .8rem; margin-right: .6rem; }
.article-list .t { font-weight: 600; }
.article-list .s { display: block; color: var(--muted); font-size: .85rem; }

/* 编辑推荐（首页每日一篇，置于最新收录之上） */
.editor-pick { margin: 0 0 1.6rem; }
.ep-card {
  display: block; text-decoration: none; color: var(--fg);
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 8px; padding: 1rem 1.1rem;
}
.ep-card:hover { border-color: var(--accent); }
.ep-blurb { margin: 0 0 .7rem; line-height: 1.95; text-align: justify; }
.ep-label { color: var(--accent); font-weight: 700; }
.ep-foot { margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.ep-title { font-weight: 700; color: var(--accent); }
.ep-go { color: var(--accent); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.browse-all .browse-link { color: var(--accent); font-weight: 600; }
.browse-all .browse-link:hover { text-decoration: underline; }

/* 主题索引：各辑目录折叠，避免第一辑几十条目录挡住下面几辑 */
.vol-group { border-bottom: 1px solid var(--border); }
.vol-group summary {
  padding: .8rem .2rem; cursor: pointer; list-style: none;
  font-size: 1.15rem; color: var(--accent); font-weight: 600;
}
.vol-group summary::-webkit-details-marker { display: none; }
.vol-group summary::before { content: "▸ "; }
.vol-group[open] summary::before { content: "▾ "; }
.vol-group summary .muted { font-weight: 400; font-size: .85rem; margin-left: .3rem; }
.vol-group .article-list { padding-bottom: .5rem; }

/* 文章页 */
.article-meta { color: var(--muted); font-size: .85rem; margin-bottom: -.5rem; }
.question {
  margin: 1.2rem 0; padding: .9rem 1.1rem; background: var(--q-bg);
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
}
.question .q-label {
  font-weight: 700; color: var(--accent); margin-right: .5rem;
}
.question p { margin: .3rem 0; }
.answer p { margin: 1.1rem 0; text-align: justify; }
.article-cats { margin: 1.5rem 0; }
.chip {
  display: inline-block; border: 1px solid var(--border); border-radius: 999px;
  padding: .1rem .7rem; font-size: .85rem; margin-right: .4rem; color: var(--muted);
}
.chip:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
/* 文末推荐：相关内容（语义算的 4 篇）+ 随缘一篇（客户端随机）。取代旧的上一篇/下一篇 */
.recommend { margin-top: 2.5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.recommend h2 { font-size: 1.05rem; margin: 1.4rem 0 .3rem; }
.recommend .article-list { margin-bottom: .3rem; }

/* 划词分享·金句卡片：选中问答区文字后浮现的小按钮 */
.quote-share-btn {
  position: fixed; z-index: 65; border: none; border-radius: 999px;
  background: var(--fg); color: var(--bg); padding: .4rem .9rem;
  font-family: inherit; font-size: .82rem; cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .25);
}
/* 触屏版：跟着选区末尾走，比桌面版稍大更好点 */
.quote-share-btn-touch { padding: .55rem 1.15rem; font-size: .9rem; }
/* 生成图片的弹窗（与「金句卡片」共用，画长图逻辑见 docs/分享图片设计经验.md） */
.card-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 1rem; overflow: auto;
}
.card-dialog { max-width: 24rem; width: 100%; text-align: center; }
.card-img {
  display: block; margin: 0 auto;
  max-width: 100%; max-height: 78vh; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.card-tip { color: #fff; font-size: 1rem; margin: .9rem 0 0; }

/* 文末动作行：转发 + 回到首页 */
.article-actions {
  display: flex; align-items: center; gap: 1rem;
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.act-home { color: var(--accent); font-size: .9rem; }   /* 回到首页在左（箭头朝左=退回） */
.act-home:hover { text-decoration: underline; }
.act-share {   /* 转发在右（外发）：纯文字 + 细 SVG 右上箭头，微信里也不会变粗 emoji */
  margin-left: auto; border: none; background: none; color: var(--accent);
  padding: 0; font-family: inherit; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center;
}
.act-share:hover { text-decoration: underline; }
.ic-share { width: .82em; height: .82em; margin-right: .3em; }
/* 复制链接等操作的轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translate(-50%, 1rem);
  background: var(--fg); color: var(--bg); padding: .6rem 1rem; border-radius: 8px;
  font-size: .85rem; max-width: 90%; text-align: center; opacity: 0;
  transition: opacity .25s, transform .25s; z-index: 60; pointer-events: none;
}
.toast.show { opacity: .95; transform: translate(-50%, 0); }

/* 首页：更新记录 */
.update-date { color: var(--muted); font-size: .85rem; margin: 1.2rem 0 .3rem; }
.update-date:first-child { margin-top: 0; }
.update-list { list-style: none; margin: 0 0 .3rem; padding: 0; }
.update-list li {
  padding: .3rem 0 .3rem .9rem; position: relative; line-height: 1.6;
}
.update-list li::before {
  content: "·"; position: absolute; left: 0; color: var(--accent);
}
.update-more { margin: .5rem 0 0; font-size: .9rem; }

/* 辑序、关于 */
.preface p, .prose p { text-align: justify; }
/* 帮助页：步骤有序列表 + 暖色提示框 */
.prose ol { padding-left: 1.4rem; }
.prose ol li { margin: .3rem 0; }
.prose .note {
  background: var(--q-bg); border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0; padding: .6rem .85rem; margin: .8rem 0; text-align: left;
}

/* 文章朗读条 */
.listen {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  margin: .3rem 0 1.5rem; padding: .5rem .7rem;
  background: var(--q-bg); border: 1px solid var(--border); border-radius: 10px;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.listen-btn {
  flex: 0 0 auto; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .32rem;
  background: var(--accent); color: #fff; border: 0; border-radius: 7px;
  padding: .3rem .68rem; font-size: .88rem;
}
.li-ic { width: .72em; height: .72em; fill: currentColor; flex: 0 0 auto; }
.listen-bar {
  flex: 1 1 6rem; min-width: 4rem; height: 6px; cursor: pointer;
  background: var(--border); border-radius: 3px; overflow: hidden;
}
.listen-fill { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.listen-time {
  flex: 0 0 auto; color: var(--muted); font-size: .78rem;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.listen-rate {
  flex: 0 0 auto; cursor: pointer; min-width: 2.7rem;
  background: transparent; color: var(--accent);
  border: 1px solid var(--border); border-radius: 7px;
  padding: .35rem .5rem; font-size: .85rem;
}
.listen-dur {
  flex: 0 0 auto; cursor: pointer; font-family: inherit;
  background: transparent; color: var(--accent);
  border: 1px solid var(--border); border-radius: 7px;
  padding: .32rem .4rem; font-size: .82rem;
}
.listen-now { flex: 1 1 100%; margin: .1rem 0 0; color: var(--muted); font-size: .78rem; }
.listen-now:empty { display: none; }
.listen-now a { color: var(--accent); text-decoration: underline; }
