:root {
  --bg: #f7f3ea; --bg-raise: #fffdf7; --ink: #3a352c; --ink-soft: #8c8474;
  --hair: #e3dcce; --accent: #8a6a45; --accent-bg: #f0e7d8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) {
  --bg: #191714; --bg-raise: #22201c; --ink: #e6dfd2; --ink-soft: #8f887a;
  --hair: #35322c; --accent: #c2a071; --accent-bg: #2e2921; } }
:root[data-theme='dark'] {
  --bg: #191714; --bg-raise: #22201c; --ink: #e6dfd2; --ink-soft: #8f887a;
  --hair: #35322c; --accent: #c2a071; --accent-bg: #2e2921; }

* { box-sizing: border-box; margin: 0; }
/* hidden 属性必须真正隐藏：否则设了 display 的元素（如 .pager{display:flex}）会盖掉 UA 的 [hidden]{display:none} */
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink);
  font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased; }
main { max-width: 42rem; margin: 0 auto; padding: 1rem 1.25rem 6rem; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--hair);
  border-radius: 8px; padding: .4rem .9rem; cursor: pointer; }
button.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
input, textarea { font: inherit; color: var(--ink); background: var(--bg-raise);
  border: 1px solid var(--hair); border-radius: 8px; padding: .55rem .7rem; width: 100%; }
/* 系统默认的蓝色粗焦点框跟这套米色纸面格格不入，换成同色系的细描边 */
input:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg); }
.view { display: none; } .view.active { display: block; }

/* 底部导航 */
nav.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--bg-raise); border-top: 1px solid var(--hair);
  padding-bottom: env(safe-area-inset-bottom); }
nav.tabbar a { flex: 1; text-align: center; padding: .7rem 0 .6rem; color: var(--ink-soft);
  font-size: .82rem; }
nav.tabbar a.active { color: var(--accent); }

/* 读经 */
header.chapter-head { display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 0 1rem; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.chapter-nav { display: flex; gap: .4rem; align-items: center; min-width: 0; }
.nav-pill { font: inherit; font-size: 1rem; font-weight: 600; color: var(--ink);
  background: var(--bg-raise); border: 1px solid var(--hair); border-radius: 999px;
  padding: .3rem .8rem; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem;
  white-space: nowrap; }
.nav-pill::after { content: '▾'; font-size: .68em; font-weight: 400;
  color: var(--ink-soft); line-height: 1; }
.nav-pill:active { border-color: var(--accent); color: var(--accent); }
#nav-chapter { color: var(--ink-soft); font-weight: 500; }
.head-right { display: flex; align-items: center; gap: .7rem; }
.read-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--hair);
  padding: 0; }
.read-dot.on { background: var(--accent); border-color: var(--accent); }
/* 经文问答入口：灰描边圆钮，激活时实心 accent */
.ai-toggle { width: 30px; height: 30px; border-radius: 50%; padding: 0; font-size: .95rem;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.ai-toggle.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
/* AI 模式下选中的经节 */
.verse.sel { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
/* 分节版式的整段式经节（沉浸版式里 .verse 是行内片段，样式另设） */
#verses:not(.flow) .verse { font-size: 1.19rem; font-weight: 500; line-height: 2.1;
  letter-spacing: .02em; margin: .35rem 0; cursor: pointer; border-radius: 6px; padding: .1rem .3rem; }
.verse:active { background: var(--accent-bg); }
.verse .vnum { font-size: .72rem; color: var(--ink-soft); vertical-align: super;
  margin-right: .35em; font-family: ui-monospace, monospace; }
/* 写过评论的经节：整节下划线。比插一个 ※ 符号安静，也不跟标点抢位置。
   skip-ink 让下划线避开汉字的下伸笔画；offset 把线压低一点，别贴着字。 */
.verse.has-comment .vtext, #verses.flow .verse.has-comment {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: .28em;
  text-decoration-skip-ink: auto;
}
/* 版式切换按钮：小号文字钮 */
.layout-toggle { font-size: .8rem; padding: .28rem .7rem; color: var(--ink-soft); border-radius: 999px; }
/* 沉浸版式：无节号。散文=自然段（首行缩进）；诗歌书=一节一行，保留诗歌分行 */
#verses.flow .flow-para, #verses.flow .flow-line {
  font-size: 1.19rem; font-weight: 500; line-height: 2.1; letter-spacing: .02em; }
#verses.flow .flow-para { text-indent: 2em; text-align: justify; margin: 0 0 .35rem; }
/* 诗行：不缩进、不对齐拉伸；过长自动折行时用悬挂缩进，看得出是同一行诗 */
#verses.flow .flow-line { margin: 0 0 .1rem; padding-left: 1.4em; text-indent: -1.4em; }
/* 沉浸版式里经节是行内片段：可点、可高亮，但不参与块级排版 */
#verses.flow .verse { display: inline; cursor: pointer; border-radius: 4px; }
#verses.flow .verse.sel { box-shadow: none; background: var(--accent-bg); }
.pager { display: flex; justify-content: space-between; margin-top: 2rem; }

/* 选书选章面板 */
.picker { position: fixed; inset: 0; background: var(--bg); z-index: 20; overflow-y: auto;
  padding: 1rem 1.25rem 3rem; }
.picker h3 { margin: 1rem 0 .5rem; font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.grid { display: flex; flex-wrap: wrap; gap: .45rem; }
.grid button { padding: .45rem .7rem; font-size: .92rem; }
.grid button.current { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* 评论小窗：紧凑、左右配重。一次只做一件事，所以整体压扁，别撑成一块大板子。 */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg-raise);
  border-top: 1px solid var(--hair); border-radius: 14px 14px 0 0; padding: .75rem .9rem
  calc(.75rem + env(safe-area-inset-bottom)); z-index: 30; max-height: 70vh; overflow-y: auto; }
/* 出处：小一号的灰字，只是个坐标，不该跟正文抢分量 */
.sheet blockquote { color: var(--ink-soft); border-left: 2px solid var(--hair);
  margin: 0; padding-left: .55rem; font-size: .82rem; line-height: 1.5; }
.sheet .old-comment { border-top: 1px dashed var(--hair); padding: .5rem 0 .1rem; font-size: .92rem; }
.sheet .old-comment time { color: var(--ink-soft); font-size: .74rem; display: block; }
.sheet textarea { min-height: 4rem; padding: .5rem .6rem; border-radius: 10px; line-height: 1.6; }
/* 出处与「✦ 解释」同一行、垂直居中；两者字号相当，视觉上是一条压得住的顶栏 */
.sheet .cmt-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.sheet .cmt-top blockquote { flex: 1; min-width: 0; }
.sheet #cmt-explain { flex: none; font-size: .8rem; line-height: 1.5; padding: .18rem .62rem;
  border-radius: 999px; color: var(--accent); border-color: var(--accent); }
/* 两个动作靠右成组：主次分明，也不再把「收起」甩到另一头 */
.sheet .toolbar { justify-content: flex-end; gap: .45rem; margin-top: .5rem; }
.sheet .toolbar button { padding: .32rem .85rem; font-size: .9rem; }
.sheet #cmt-close { color: var(--ink-soft); border-color: transparent; }
/* 宽屏：贴着被评论的那一节就地开一个小窗（位置由 JS 算），别让视线跑到屏幕最下面 */
.sheet.anchored { left: auto; right: auto; bottom: auto; width: min(26rem, 92vw);
  padding: .65rem .75rem; border: 1px solid var(--hair); border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .18); max-height: 60vh; }

/* 悬停预览：鼠标停在有评论的经节上就地浮出已写的评论（只在有鼠标的设备上出现） */
.cmt-tip { position: fixed; z-index: 60; max-width: min(28rem, 90vw); pointer-events: none;
  background: var(--bg-raise); color: var(--ink); border: 1px solid var(--hair);
  border-radius: 10px; padding: .5rem .7rem; font-size: .92rem; line-height: 1.7;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .16); }
.cmt-tip .cmt-tip-row + .cmt-tip-row { border-top: 1px dashed var(--hair); margin-top: .45rem; padding-top: .45rem; }
.cmt-tip time { color: var(--ink-soft); font-size: .76rem; display: block; }

/* 经文问答（AI 对话）——手机：底部面板；桌面：右侧固定侧边栏 */
/* bottom 用 JS 量出的导航真实高度（含 safe-area），与导航上沿严丝合缝、不露缝 */
.ai-chat { position: fixed; left: 0; right: 0; bottom: var(--tabbar-h, 49px);
  max-height: 60vh; max-height: 60dvh; display: flex; flex-direction: column; z-index: 25;
  background: var(--bg-raise); border-top: 1px solid var(--hair); border-radius: 14px 14px 0 0;
  box-shadow: 0 -6px 20px rgba(58, 53, 44, .08); }
/* 用户拖过高度后：以内联 height 为准，上限放宽到 90dvh */
.ai-chat.resized { max-height: 90dvh; }
.ai-chat.min { height: auto !important; }   /* 压缩态不留空白 */
/* 拖动把手：上拖变高、下拖变矮 */
/* 视觉仍是一条细线，但热区从 ~14px 撑到 ~34px（再叠上可拖的标题栏），手指才抓得住 */
.ai-grip { flex: none; padding: 1.1rem 0 .55rem; display: flex; justify-content: center;
  cursor: ns-resize; touch-action: none; }
.ai-grip i { width: 56px; height: 4px; border-radius: 2px; background: var(--hair); display: block;
  transition: height .12s, background .12s; }
.ai-grip:active i, body.ai-resizing .ai-grip i { background: var(--accent); height: 6px; }
/* 标题栏空白处也可拖：禁掉它的默认触摸手势，别变成页面滚动 */
.ai-head { touch-action: none; cursor: ns-resize; }
.ai-head button { cursor: pointer; touch-action: auto; }
body.ai-resizing { user-select: none; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .9rem .4rem; }
.ai-head b { color: var(--accent); font-weight: 600; font-size: .95rem; }
.ai-head-btns { display: flex; gap: .4rem; }
.ai-head button { font-size: .8rem; padding: .2rem .6rem; color: var(--ink-soft); }
.ai-sel { padding: .1rem .9rem .3rem; }
.ai-ctx { font-size: .78rem; color: var(--accent); margin-bottom: .35rem; }
.ai-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.ai-sel-empty { color: var(--ink-soft); font-size: .82rem; }
.chip { display: inline-flex; align-items: center; gap: .3em; background: var(--accent-bg);
  color: var(--accent); border-radius: 6px; padding: .12rem .5rem; font-size: .8rem; }
.chip i { font-style: normal; opacity: .7; cursor: pointer; }
/* overscroll-behavior:contain 阻止滚到顶/底时把滚动"传染"给背后的经文正文 */
.ai-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: .5rem .9rem; min-height: 0; }
.ai-body:empty { display: none; }
.msg-q { background: var(--accent-bg); color: var(--ink); border-radius: 12px 12px 4px 12px;
  padding: .5rem .75rem; font-size: .95rem; margin: .4rem 0 .7rem auto; width: fit-content; max-width: 88%; }
.msg-q .msg-chips { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .3rem; }
.msg-a { font-size: .97rem; line-height: 1.9; color: var(--ink); margin-bottom: .9rem; }
.msg-a p { margin: .45rem 0; }
.msg-err { color: #a4422e; font-size: .88rem; margin: .3rem 0 .8rem; }
.ai-foot { display: flex; gap: .5rem; padding: .5rem .9rem calc(.6rem + env(safe-area-inset-bottom)); }
.ai-foot input { flex: 1; font: inherit; font-size: .95rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--hair); border-radius: 999px; padding: .5rem .9rem; }
.ai-send { border-radius: 999px; padding: .45rem 1rem; background: var(--accent);
  color: var(--bg); border-color: var(--accent); font-size: .92rem; }
/* 历史会话面板：与对话区同一位置，切换显示（history-open 时隐藏对话与选经文条） */
.ai-history { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-raise); padding: .3rem .4rem; }
.ai-chat.history-open .ai-body,
.ai-chat.history-open .ai-sel { display: none; }
.ai-hist-item { padding: .55rem .7rem; border-radius: 8px; cursor: pointer; }
.ai-hist-item.current { background: var(--accent-bg); }
.ai-hist-meta { font-size: .76rem; color: var(--ink-soft); }
.ai-hist-title { font-size: .92rem; color: var(--ink); margin-top: .1rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-hist-empty { color: var(--ink-soft); font-size: .85rem; padding: 1rem; text-align: center; }

/* 经文里的会话标记：与评论 ※ 不同，用 accent 描边的 ✦ */
.verse .ai-mark { color: var(--accent); font-size: .9rem; margin-left: .3em; cursor: pointer; }
.ch-ai-mark { display: inline-block; margin: 0 0 .8rem; font-size: .82rem; color: var(--accent);
  background: var(--accent-bg); border: 1px solid var(--accent); border-radius: 999px; padding: .2rem .8rem; }

/* 压缩态（手机）：只留选经文条 + 输入框，方便先选经文 */
.ai-chat.min .ai-body { display: none; }
#ai-collapse { display: inline-block; }

/* 手机：面板浮在经文之上，给正文垫出面板高度的底部留白，
   否则章末几节压在面板下滚不上来、点不到。--ai-pad 由 aichat.js 按面板真实高度维护。 */
body.ai-open main { padding-bottom: var(--ai-pad, 6rem); }

/* 手机软键盘弹起（visualViewport 测得 --kb）：把面板/评论框顶到键盘之上，输入框始终可见；
   隐藏会随键盘跳动的底部导航。--kb 由 aichat.js 设置，未弹起时为 0，不影响常态。 */
body.kb-open .ai-chat { bottom: var(--kb, 0px); max-height: 74dvh; }
body.kb-open .sheet { bottom: var(--kb, 0px); }
body.kb-open nav.tabbar { display: none; }

@media (min-width: 960px) {
  /* 桌面：右侧固定侧边栏，正文整体让出右侧空间；关闭压缩按钮 */
  body.ai-open main { margin-right: 400px; padding-bottom: 6rem; }   /* 侧边栏不遮正文，无需垫高 */
  /* 底部导航右缘让到侧边栏之外，四个标签重新自适应分布，不再被侧边栏遮住 */
  body.ai-open nav.tabbar { right: 400px; }
  /* 侧边栏铺满整高：height 用 !important 盖掉手机拖动留下的内联高度 */
  .ai-chat { top: 0; left: auto; right: 0; bottom: 0; width: 400px; max-height: none;
    height: auto !important;
    border-top: none; border-left: 1px solid var(--hair); border-radius: 0; box-shadow: none; }
  .ai-chat.resized { max-height: none; }
  .ai-chat.min .ai-body { display: block; }   /* 侧边栏够高，不需要压缩 */
  #ai-collapse, .ai-grip { display: none; }   /* 桌面无需拖动调高 */
  /* 桌面不拖动：标题栏恢复常规光标与手势 */
  .ai-head { padding: .9rem 1.1rem .5rem; border-bottom: 1px solid var(--hair);
    cursor: auto; touch-action: auto; }
  .ai-foot { padding: .7rem 1rem .8rem; border-top: 1px solid var(--hair); }
}

/* 地图 · 子标签（读经地图 / 年度地图 / 每日与主同行）
   分段控件：整组共用一条底槽，只有选中的那格浮起来，比三个各自描边的方块安静得多。 */
.map-tabs { display: inline-flex; gap: .15rem; margin: .2rem 0 1rem; padding: .2rem;
  background: var(--accent-bg); border: 1px solid var(--hair); border-radius: 999px; }
.map-tab { border: 1px solid transparent; border-radius: 999px; padding: .34rem 1.05rem;
  font-size: .92rem; line-height: 1.4; white-space: nowrap;
  color: var(--ink-soft); background: none; cursor: pointer;
  transition: color .18s ease, background-color .18s ease; }
.map-tab:hover { color: var(--ink); }
.map-tab.active { color: var(--accent); background: var(--bg-raise);
  border-color: var(--hair); box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
/* 键盘可达：焦点圈也走同色系，别冒出系统蓝 */
.map-tab:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }

/* 窄屏：三格挤不下就整组撑满一行，字号收一点，不换行不溢出 */
@media (max-width: 24rem) {
  .map-tabs { display: flex; width: 100%; }
  .map-tab { flex: 1; padding: .34rem .5rem; font-size: .86rem; }
}

/* 年度地图：按年→分月→展开到天，浅底=读经、褐字=灵修 */
.yr-head { display: flex; align-items: center; justify-content: space-between; margin: .2rem 0 .3rem; }
.yr-head .yr-year { font-size: 1.05rem; font-weight: 600; }
.yr-counts { text-align: center; color: var(--ink-soft); font-size: .82rem; margin: 0 0 .3rem; }
.yr-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem .9rem; margin-top: .6rem; }
.yr-month h4 { font-size: .8rem; color: var(--ink-soft); font-weight: 600; margin-bottom: .35rem; }
.yr-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

/* 一天一格，两件事各占一个通道，互不打架：
   「读了」＝格子填色（看的是块面），「有笔记」＝格子底下一点（看的是形状）。
   都做在颜色之外还有形状差别，色弱也分得出；一天两件事都做了就是「填色 + 点」，
   不需要第三种颜色。 */
.yr-cell { position: relative; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center; padding-bottom: 3px;
  font-size: .6rem; line-height: 1; border-radius: 4px; color: var(--ink); cursor: pointer;
  background: var(--bg-raise);                                  /* 过去但没读：空槽，让填色显出来 */
  font-family: ui-monospace, "DIN Alternate", monospace;
  transition: background-color .15s ease; }
.yr-cell.blank { visibility: hidden; cursor: default; }
/* 那天读了经：填色。比 --accent-bg 再实一点——空槽是浅色的，填色不够深的话
   "读了"反倒比"没读"更不显眼，一年的节奏就看不出来了。 */
.yr-cell.read { background: color-mix(in srgb, var(--accent) 30%, var(--bg-raise)); }
/* 那天写了灵修：底部一个小点。点只跟"有没有写"有关，不受填色影响，
   所以读了 + 写了 = 有底色也有点，一眼能拆开看。 */
.yr-cell.write::after { content: ''; position: absolute; left: 50%; bottom: 2px;
  width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%;
  background: var(--accent); }
.yr-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 700; }  /* 今天：圈 */
.yr-cell.future { background: none; color: var(--hair); cursor: default; }  /* 未来：留白不可点 */
.yr-cell:not(.future):hover { background: var(--accent-bg); }
.yr-cell:not(.future):active { background: var(--accent-bg); }

/* 地图 */
.map-book { display: flex; align-items: baseline; gap: .6rem; margin: .5rem 0; }
.map-book .bname { width: 6.5em; flex-shrink: 0; font-size: .88rem; color: var(--ink-soft); }
.cells { display: flex; flex-wrap: wrap; gap: 3px; }
.cell { width: 13px; height: 13px; border-radius: 3px; background: var(--hair);
  border: none; padding: 0; cursor: pointer; }
.cell.read { background: var(--accent); }

/* 每日与主同行：读经地图换一根左轴——书卷变成日期，其余（格子尺寸、间距、配色）一律照旧 */
.plan-day { margin: .3rem 0; }
.plan-day.week-start { margin-top: .9rem; }          /* 周与周之间松一口气，看得出以周为单位 */
.plan-day .plan-date { background: none; border: none; padding: 0; cursor: pointer;
  text-align: left; font-variant-numeric: tabular-nums; }   /* 等宽数字，日期列对得齐 */
/* 今天：打开就滚到这一行，得让眼睛一落下来就认出它。日期变褐加粗之外，
   左边加一道竖线——不铺底色，免得跟格子的"已读"填色抢同一套语言。 */
.plan-day.is-today { position: relative; }
.plan-day.is-today .plan-date { color: var(--accent); font-weight: 600; }
.plan-day.is-today::before { content: ''; position: absolute; left: -.6rem; top: -1px; bottom: -1px;
  width: 2px; border-radius: 1px; background: var(--accent); }
.plan-warn { font-size: .8rem; color: var(--ink-soft); }

/* 笔记 · 今日快写卡 */
.today-card { background: var(--bg-raise); border: 1px solid var(--hair); border-radius: 12px;
  padding: .8rem 1rem; margin: .2rem 0 1.2rem; cursor: pointer; }
.today-card h4 { font-weight: 600; }
.today-card p { color: var(--ink-soft); font-size: .92rem; margin-top: .25rem; }

/* 笔记 · 灵修月历（恩典式：读了/写了的日子温柔点亮，没写的只留白不谴责） */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: .2rem 0 .3rem; }
.cal-head .cal-month { font-size: 1.02rem; font-weight: 600; }
.cal-counts { text-align: center; color: var(--ink-soft); font-size: .82rem; margin: 0 0 .8rem; }
.cal-nav-btn { border: 1px solid var(--hair); border-radius: 8px; padding: .2rem .7rem;
  font-size: 1.1rem; line-height: 1; color: var(--ink); background: var(--bg-raise); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.cal-wd { text-align: center; font-size: .7rem; color: var(--ink-soft); padding: .2rem 0; }
.cal-cell { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: .9rem; color: var(--ink);
  cursor: pointer; font-family: ui-monospace, "DIN Alternate", monospace; }
.cal-cell.blank { visibility: hidden; cursor: default; }
.cal-cell.read-day { background: var(--accent-bg); }               /* 那天读了经：浅底 */
.cal-cell .cal-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.cal-cell .cal-dot.on { background: var(--accent); }               /* 那天写了灵修：圆点 */
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); }   /* 今天：圈 */
.cal-cell.future { color: var(--hair); cursor: default; }          /* 未来：留白不可点 */
.cal-cell:not(.future):active { background: var(--accent-bg); }
.cal-legend { display: flex; gap: 1.2rem; justify-content: center; margin: .7rem 0 0;
  font-size: .72rem; color: var(--ink-soft); }
.cal-legend i { display: inline-block; vertical-align: middle; margin-right: .3rem; }
.cal-legend .sw-read { width: 12px; height: 12px; border-radius: 3px; background: var(--accent-bg); }
.cal-legend .sw-write { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
/* 年度地图的图例：把格子原样缩小放进来，图例长什么样格子就长什么样 */
.cal-legend .sw-cell { position: relative; width: 12px; height: 12px; border-radius: 3px;
  background: var(--bg-raise); border: 1px solid var(--hair); }
.cal-legend .sw-cell.read { background: color-mix(in srgb, var(--accent) 30%, var(--bg-raise));
  border-color: transparent; }
.cal-legend .sw-cell.write::after { content: ''; position: absolute; left: 50%; bottom: 1px;
  width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%; background: var(--accent); }

/* 笔记编辑器：编辑框高度随内容自适应伸展，不出现内滚动条，长文交给页面整体滚动 */
#j-content { min-height: 16rem; overflow-y: hidden; resize: none; line-height: 1.9; }

/* 笔记编辑器：编辑 / 预览 tab 切换 */
.ed-tabs { display: flex; gap: .5rem; margin: .2rem 0 .8rem; }
.ed-tab { border: 1px solid var(--hair); border-radius: 8px; padding: .3rem .9rem;
  font-size: .9rem; color: var(--ink-soft); background: var(--bg-raise); cursor: pointer; }
.ed-tab.active { color: var(--accent); border-color: var(--accent); }

/* 笔记 */
.journal-item { border-bottom: 1px solid var(--hair); padding: .9rem 0; cursor: pointer; }
.journal-item h4 { font-weight: 600; } .journal-item p { color: var(--ink-soft);
  font-size: .92rem; margin-top: .25rem; }
.ref-chip { display: inline-block; background: var(--accent-bg); color: var(--accent);
  border-radius: 6px; padding: .1rem .5rem; font-size: .8rem; margin: 0 .3rem .3rem 0; }
.md-body h1, .md-body h2, .md-body h3 { margin: 1rem 0 .5rem; }
.md-body p { margin: .6rem 0; line-height: 1.9; }
.md-body blockquote { border-left: 2px solid var(--accent); padding-left: .8rem;
  color: var(--ink-soft); margin: .6rem 0; }
.toolbar { display: flex; gap: .5rem; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; flex-wrap: wrap; }

/* 笔记编辑器：顶部右侧「生成灵修 + 保存」并排；AI 生成状态提示 */
.tb-right { display: flex; gap: .5rem; align-items: center; }
.ai-hint { color: var(--ink-soft); font-size: .82rem; margin: .1rem 0 .5rem; line-height: 1.6; }

/* 登录页 */
.login-wrap { min-height: 100svh; display: flex; flex-direction: column;
  justify-content: center; max-width: 20rem; margin: 0 auto; padding: 1.5rem; gap: .9rem; }
.login-wrap h1 { font-size: 1.3rem; font-weight: 600; text-align: center; }
.login-wrap .err { color: #a4422e; font-size: .88rem; min-height: 1.2em; }
#login-box, #apply-box { display: flex; flex-direction: column; gap: .9rem; }
.login-alt { font-size: .86rem; color: var(--ink-soft); text-align: center; }
.login-tip { font-size: .84rem; color: var(--ink-soft); line-height: 1.7; }

/* 「我的」页 / 管理员后台 */
.acct-tip { color: var(--ink-soft); font-size: .88rem; line-height: 1.8; margin: .4rem 0 1rem;
  white-space: pre-wrap; }
.acct-h { font-size: 1rem; font-weight: 600; margin: 1.2rem 0 .4rem; }
.acct-sec { font-size: .82rem; color: var(--ink-soft); margin: 1rem 0 .3rem; }
.acct-item { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  border-bottom: 1px solid var(--hair); padding: .7rem 0; flex-wrap: wrap; }
.acct-name { font-size: .98rem; font-weight: 600; }
.acct-meta { font-size: .8rem; color: var(--ink-soft); margin-top: .15rem; }
.acct-acts { display: flex; gap: .4rem; flex-wrap: wrap; }
.acct-acts button { font-size: .82rem; padding: .3rem .8rem; }
