/* ============================================================
   个人博客 · 视觉系统
   风格：简约清爽 / 暖纸底 / 衬线标题 / 大面积留白
   ============================================================ */

/* 封面占位图配色：底色极淡、线条低饱和，只做氛围不做抢眼。
   用变量是为了让深色模式整套跟着换，不用在 SVG 里写死颜色。 */
:root {
  --cover-clay-bg: #f6efe8;   --cover-clay-line: #c8a184;
  --cover-blue-bg: #eef1f5;   --cover-blue-line: #9db0c5;
  --cover-green-bg: #eef2ee;  --cover-green-line: #a2b8a5;
  --cover-gold-bg: #f7f2e6;   --cover-gold-line: #c9b17f;
  --cover-purple-bg: #f2eff6; --cover-purple-line: #b2a2c4;
  --cover-gray-bg: #f2f1ef;   --cover-gray-line: #b9b5ae;
}

:root {
  /* 色板 */
  --paper:        #fbfaf7;
  --paper-2:      #f5f3ee;
  --paper-3:      #eeeae2;
  --ink:          #21201d;
  --ink-2:        #4a4741;
  /* ink-3/ink-4 对比度已按 WCAG AA 校准（纸底 ≥4.5:1）。
     ink-4 只用于图标、圆点、分隔符等装饰；≤13px 的文字一律从 ink-3 起。 */
  --ink-3:        #6f6a61;   /* 纸底 5.15:1 */
  --ink-4:        #736e64;   /* 纸底 4.86:1 */
  --line:         #e4dfd5;
  --line-soft:    #eeebe3;
  --accent:       #a2603d;   /* 陶土棕 */
  --accent-soft:  #f0e4db;
  --accent-ink:   #7c4526;
  --green:        #4d6b52;
  --green-soft:   #e6ece5;
  --blue:         #46617d;
  --blue-soft:    #e4eaf1;
  --red:          #a94b3f;

  /* 字体 */
  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", "STSong", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
           "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono:  "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --radius: 6px;
  --radius-lg: 8px;
  /* 吸顶层高：顶栏与首页筛选条的高度集中在这里，侧栏 sticky 的 top 由二者相加得出。
     以前是三处硬编码 68/128，改一次顶栏高度就会对不上、侧栏被玻璃条压住。 */
  --header-h: 68px;
  /* 行高三档：界面 1.6 / 摘要 1.8 / 阅读 2 —— 以前有 1.75/1.8/1.85/1.9/1.92/2 六种值，全站节奏靠手感 */
  --lh-ui: 1.6;
  --lh-text: 1.8;
  --lh-read: 2;
  --filter-h: 92px;    /* 筛选条实测占位：padding 8+16 + 胶囊约 54 + 下外边距 12。
                          取略大的整值，宁可多几像素空白，也不要让侧栏顶部被玻璃条压住。 */
  --shadow-1: 0 1px 2px rgba(33,32,29,.04), 0 2px 8px rgba(33,32,29,.04);
  --shadow-2: 0 4px 12px rgba(33,32,29,.06), 0 12px 32px rgba(33,32,29,.07);
  --maxw: 1080px;
}

[data-theme="dark"] {
  --cover-clay-bg: #28211b;   --cover-clay-line: #6f5340;
  --cover-blue-bg: #1e242c;   --cover-blue-line: #5d6d80;
  --cover-green-bg: #1f2721;  --cover-green-line: #5f7364;
  --cover-gold-bg: #282217;   --cover-gold-line: #75654a;
  --cover-purple-bg: #241f29; --cover-purple-line: #6b5c7c;
  --cover-gray-bg: #21201e;   --cover-gray-line: #6a675f;
  --paper:        #141513;
  --paper-2:      #1c1c1a;
  --paper-3:      #252523;
  --ink:          #e8e5dd;
  --ink-2:        #c3bfb6;
  --ink-3:        #95918a;   /* 深底 5.84:1 */
  --ink-4:        #8a8680;   /* 深底 5.06:1（原 #6f6c66 仅 3.5，已提亮） */
  --line:         #2f2e2b;
  --line-soft:    #232220;
  --accent:       #d09069;
  --accent-soft:  #3a2b21;
  --accent-ink:   #e3ab80;
  --green:        #8fb096;
  --green-soft:   #1f2b21;
  --blue:         #8fa9c4;
  --blue-soft:    #1d242c;
  --red:          #d8837a;

  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 2px 10px rgba(0,0,0,.25);
  --shadow-2: 0 4px 14px rgba(0,0,0,.4), 0 14px 36px rgba(0,0,0,.35);
}

[data-theme="dark"] .cat-purple { background: #2c2533; color: #b39fc9; }
[data-theme="dark"] .cat-gold   { background: #332b1c; color: #d0b077; }
[data-theme="dark"] .site-header { background: rgba(20,21,19,.88); }
[data-theme="dark"] .search-bar { background: rgba(20,21,19,.97); }
[data-theme="dark"] .btn.primary { background: var(--ink); color: var(--paper); }
[data-theme="dark"] .btn.primary:hover { background: #fff; }
[data-theme="dark"] .btn.ghost { background: var(--paper-2); border-color: var(--line); }
[data-theme="dark"] .user-chip { background: var(--paper-2); border-color: var(--line); }
[data-theme="dark"] .user-dropdown { background: var(--paper-2); border-color: var(--line); }
[data-theme="dark"] .user-dropdown button:hover { background: var(--paper-3); }
[data-theme="dark"] .modal,
[data-theme="dark"] .drawer,
[data-theme="dark"] .res-card,
[data-theme="dark"] .panel,
[data-theme="dark"] .about-card,
[data-theme="dark"] .admin-list { background: var(--paper-2); border-color: var(--line); }
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .editor-textarea,
[data-theme="dark"] .preview-pane { background: var(--paper-3); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .prose pre { background: var(--code-bg); }
[data-theme="dark"] .prose code { background: var(--paper-3); color: var(--accent-ink); }
[data-theme="dark"] .editor-toolbar { background: var(--paper-3); border-color: var(--line); }
[data-theme="dark"] .editor-toolbar button:hover { background: var(--paper-2); }
[data-theme="dark"] .inline-add { background: var(--paper-3); }
[data-theme="dark"] .check { background: var(--paper-3); border-color: var(--line); }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, var(--paper-2) 25%, var(--paper-3) 37%, var(--paper-2) 63%); }
[data-theme="dark"] .empty { background: rgba(255,255,255,.02); }
[data-theme="dark"] .avatar { background: var(--accent-soft); color: var(--accent-ink); }

/* 主题图标切换 */
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* 平滑过渡主题切换（不影响初次 no-JS 渲染） */
body, .site-header, .nav, .post-card, .panel, .res-card, .admin-list, .prose {
  transition: background-color .22s ease, border-color .22s ease;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
/* 横向溢出的兜底只挂在 html 上。
   千万别把 overflow-x 再加到 body：body 一旦变成滚动容器，
   文章侧栏的 position:sticky 就失去参照、再也不跟随了（headless 实测：
   html+body 都 hidden 时滚动 1370px 后侧栏跑到 -1266；只留 html 则稳稳停在 top:96）。
   支持 clip 的浏览器升级成 clip，连滚动容器都不创建。 */
html { overflow-x: hidden; }
/* 抽屉展开期间锁住背景滚动（关闭即恢复，不影响 sticky） */
body.sheet-open { overflow: hidden; }
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: var(--lh-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸纹质感的极淡背景 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0; background: 
    radial-gradient(900px 500px at 12% -8%, rgba(162,96,61,.045), transparent 65%),
    radial-gradient(700px 400px at 92% 4%, rgba(77,107,82,.04), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 calc(28px + env(safe-area-inset-left, 0px)) 0 calc(28px + env(safe-area-inset-right, 0px));
  position: relative;
  z-index: 1;
}

/* ============================ 顶栏 ============================ */

.site-header {
  position: sticky;
  position: -webkit-sticky;
  top: 0;
  z-index: 40;
  background: rgba(251,250,247,.86);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* 品牌：衬线字标 + 细竖线 + 灰色副名。不用方印，顶栏更轻 */
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.brand-word {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--ink);
  line-height: 1;
}

.brand-sep {
  width: 1px;
  height: 15px;
  background: var(--line);
  flex-shrink: 0;
}

.brand-sub {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-4);
  line-height: 1;
  position: relative;
  top: 1px;
}

.nav { display: flex; gap: 4px; margin-left: 6px; }

.nav-link {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--ink-3);
  transition: color .16s, background .16s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); background: var(--paper-2); }
.nav-link.active { color: var(--ink); background: var(--paper-3); font-weight: 500; }

.icon-btn {
  width: 40px; height: 40px;   /* 原 34px，低于 WCAG 2.5.8 的 24px 命中底线 */
  display: grid; place-items: center;
  border: none; background: transparent;
  border-radius: 8px;
  color: var(--ink-3);
  transition: background .16s, color .16s;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }

.menu-btn { display: none; width: 34px; height: 34px; place-items: center; border: none; background: transparent; color: var(--ink-2); border-radius: 8px; }

/* 用户区 */
.user-slot { display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  font-family: var(--serif);
  flex-shrink: 0;
}

.user-menu-wrap { position: relative; }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 12px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px; color: var(--ink-2);
}
.user-chip:hover { border-color: var(--ink-4); }

.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 176px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 6px;
  z-index: 50;
}
.user-dropdown button {
  width: 100%; text-align: left;
  padding: 8px 12px;
  border: none; background: transparent;
  border-radius: 6px;
  font-size: 13.5px; color: var(--ink-2);
}
.user-dropdown button:hover { background: var(--paper-2); color: var(--ink); }
.user-dropdown hr { border: none; border-top: 1px solid var(--line-soft); margin: 5px 4px; }

/* 键盘可达：全局统一焦点环。之前只有筛选 pill 有，其余按钮靠浏览器默认，
   而搜索框/内联输入框把 outline 清掉了又没补替代指示，Tab 过去完全看不见。 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 触控热区：勾选框/文件夹操作这类小控件视觉不能变大（会破坏排版节奏），
   用透明伪元素把命中区撑到 ≥24px（WCAG 2.5.8），视觉零变化。
   纵向只外扩到行内边距以内，避免吃到上下相邻行的点击。 */
.today-check::after,
.check::after,
.ft-toggle::after,
.ft-acts button::after {
  content: "";
  position: absolute;
  inset: -5px -12px;   /* 纵向 ±5 → 25/27px；横向放宽，落在同行空白上 */
  border-radius: 6px;
}
/* 文件夹行里的按钮是紧挨着排的，横向别扩太多，否则相邻热区互相吃掉点击 */
.ft-toggle::after,
.ft-acts button::after { inset: -6px -4px; }

/* 搜索条 */
.search-bar { border-top: 1px solid var(--line-soft); background: rgba(251,250,247,.96); padding: 16px 0 4px; }

.search-field {
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 8px;
  color: var(--ink-3);
}
.search-field input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  /* iOS：≥16px 防聚焦缩放 */
  font-size: 16px; color: var(--ink);
}
.search-field input::placeholder { color: var(--ink-4); }

.text-btn { border: none; background: transparent; color: var(--ink-3); font-size: 13.5px; padding: 4px 6px; border-radius: 6px; }
.text-btn:hover { color: var(--ink); background: var(--paper-2); }

/* outline 被清了，用底边框换色做聚焦指示（全站焦点环在这儿不适用） */
.search-field:focus-within { border-bottom-color: var(--accent); }
.search-results { max-height: 56vh; overflow-y: auto; padding: 12px 0 16px; }

.search-item {
  display: block;
  padding: 12px 12px;
  border-radius: var(--radius);
  transition: background .14s;
}
.search-item:hover { background: var(--paper-2); }
.search-item h4 { margin: 0 0 3px; font-size: 14.5px; font-weight: 600; font-family: var(--serif); }
.search-item p { margin: 0; font-size: 12.8px; color: var(--ink-3); line-height: var(--lh-ui);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-empty { padding: 24px 12px; color: var(--ink-4); font-size: 13.5px; }

/* ============================ 通用组件 ============================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .16s, border-color .16s, color .16s, opacity .16s;
  white-space: nowrap;
}
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #3a3833; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--ink-4); color: var(--ink); }
.btn.subtle { background: var(--paper-2); color: var(--ink-2); }
.btn.subtle:hover { background: var(--paper-3); }
.btn.danger { background: transparent; color: var(--red); border-color: transparent; }
.btn.danger:hover { background: #f7ece9; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 12px; }

.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  letter-spacing: .02em;
  background: var(--paper-3);
  color: var(--ink-3);
  border: 1px solid transparent;
  transition: background .14s, color .14s;
  white-space: nowrap;
}
/* 列表里的元信息一律不上底色，靠颜色和间距区分，比一排胶囊安静 */
.post-meta .tag {
  background: transparent; padding: 0; border-radius: 0;
  font-size: 12px; letter-spacing: .04em;
}

/* 分类色彩 */
.cat-blue   { background: var(--blue-soft);  color: var(--blue); }
.cat-green  { background: var(--green-soft); color: var(--green); }
.cat-clay   { background: var(--accent-soft); color: var(--accent-ink); }
.cat-gray   { background: var(--paper-3);    color: var(--ink-3); }
.cat-purple { background: #eae5f0;            color: #6a5480; }
.cat-gold   { background: #f3ecdb;            color: #7a5c26; }  /* 原 #8a6a2e 仅 4.26:1 */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}

.section-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
  display: flex; align-items: center; gap: 12px;
}
.section-title::before {
  content: ""; width: 3px; height: 16px; border-radius: 2px;
  background: var(--accent); display: inline-block;
}

.muted { color: var(--ink-4); font-size: 13.5px; }

.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--ink-4);
  font-size: 13.5px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.5);
}
.empty strong { display: block; color: var(--ink-2); font-family: var(--serif); font-size: 15px; margin-bottom: 6px; font-weight: 600; }

/* ============================ 首页 ============================ */

/* Hero：左边一行身份锚点（首次访客知道这是谁的地方），右边一行事实信息。
   不写标语、不做大标题 —— 上半屏仍主要让给每日一句。 */
.hero {
  padding: 24px 0 16px;
}

.hero-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-who { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hero-name {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  color: var(--ink); letter-spacing: .01em;
}
.hero-aff { font-size: 12px; color: var(--ink-3); letter-spacing: .02em; }

.hero-line {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-3);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.hero-line b {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-right: 1px;
}
.hero-sep { color: var(--ink-4); }

/* ---------- 每日一句（左右对照） ----------
   原来上下留白 26/30、英文 17px，把文章列表整个挤出首屏；
   收窄一档（18/22 + 英文 16px），列表顶部能露出来。 */
.daily {
  padding: 16px 0 24px;
}

.daily-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.daily-date {
  font-size: 12px; color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.daily-date b { font-family: var(--serif); font-weight: 600; color: var(--ink-3); }
.daily-next {
  font-size: 12px; color: var(--ink-4);
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; transition: color .16s;
}
.daily-next:hover { color: var(--accent-ink); }

.daily-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.daily-en {
  margin: 0;
  padding-right: 24px;
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  line-height: var(--lh-text);
  color: var(--ink);
}

.daily-cn {
  margin: 0;
  padding-left: 24px;
  border-left: 1px solid var(--line);
  font-size: 13.5px;
  line-height: var(--lh-text);
  color: var(--ink-3);
}
.daily-src {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-4);
  letter-spacing: .04em;
}

/* ---------- 右栏：今日 ---------- */
.side-today { gap: 0; }

/* 块与块之间用短横线，不贯穿整行 —— 避免整页被切成规整的格子 */
.today-block + .today-block { margin-top: 24px; }
.today-block + .today-block::before {
  content: ''; display: block;
  width: 26px; height: 1px;
  background: var(--line);
  margin: 0 0 24px;
}

.today-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.today-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .02em;
}
.today-head .today-aside { font-size: 12px; color: var(--ink-4); }

/* 待办：整行可点，勾选即刻生效（JS 侧做乐观更新，不等网络） */
.today-todo {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 7px 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.today-check {
  position: relative;
  width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px;
  border: 1.5px solid var(--line); border-radius: 3px;
  background: transparent; cursor: pointer; padding: 0;
  display: grid; place-items: center;
  transition: background .12s, border-color .12s;
}
.today-todo:hover .today-check { border-color: var(--accent); }
.today-check svg { opacity: 0; color: #fff; width: 9px; height: 9px; transition: opacity .12s; }
.today-todo.done .today-check { background: var(--accent); border-color: var(--accent); }
.today-todo.done .today-check svg { opacity: 1; }

.today-text {
  font-size: 13.5px; line-height: var(--lh-ui); color: var(--ink-2);
  min-width: 0; transition: color .12s;
}
.today-todo.done .today-text { color: var(--ink-4); text-decoration: line-through; }
.today-due {
  display: block; margin-top: 1px; font-size: 12px;
  color: var(--ink-4); text-decoration: none;
}
.today-todo.done .today-due { text-decoration: none; }

/* 近期：左边一个小日历块，比「日期 + 标题 + 倒计时」三行堆着清楚 */
.today-event {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 8px 0;
}
.ev-date {
  width: 32px; flex-shrink: 0; text-align: center; padding-top: 1px;
}
.ev-date b {
  display: block;
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  color: var(--ink); line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ev-date em {
  display: block; font-style: normal;
  font-size: 12px; color: var(--ink-4);
}
.ev-body { min-width: 0; flex: 1; }
.ev-title {
  font-size: 13.5px; color: var(--ink); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-left { font-size: 12px; color: var(--ink-4); margin-top: 1px; }
.today-event.is-today .ev-date b { color: var(--accent-ink); }
.today-event.is-today .ev-left { color: var(--accent); }

/* 本周记录：数字行 + 七日条 */
.week-sum {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 4px 12px; margin-bottom: 16px;
}
.week-num {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  color: var(--ink); line-height: 1;
}
.week-num em {
  font-style: normal; font-family: var(--sans);
  font-size: 12px; font-weight: 400; color: var(--ink-4);
  margin-left: 2px; letter-spacing: .04em;
}
.week-bars { display: flex; align-items: flex-end; gap: 4px; height: 28px; }
.week-bar {
  flex: 1; min-width: 0; min-height: 2px;
  border-radius: 1px;
  background: var(--paper-3);
}
.week-bar.has { background: var(--accent); opacity: .38; }
.week-bar.today { background: var(--accent); opacity: 1; }

.today-empty { font-size: 12px; color: var(--ink-4); line-height: var(--lh-text); }
.today-empty a { color: var(--accent-ink); }
.today-more { display: inline-block; margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.today-more:hover { color: var(--accent-ink); }

/* 首页主体布局 */
.home-body { padding: 48px 0 80px; }

.layout-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 56px;
  align-items: start;
}

/* 文章卡片 */
.post-list { display: flex; flex-direction: column; }

.post-card {
  display: grid;
  grid-template-columns: minmax(0,1fr) 168px;
  gap: 32px;
  align-items: start;
  padding: 24px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: opacity .16s;
}
.post-card:first-child { padding-top: 4px; }
.post-card:hover .post-title { color: var(--accent-ink); }
.post-card-body { min-width: 0; }
.post-thumb {
  aspect-ratio: 4/3; border-radius: 4px; overflow: hidden;
  background: var(--paper-2);
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-thumb .cover-art { width: 100%; height: 100%; display: block; }
/* 整张卡可点，但只变色太安静 —— 封面轻微放大给出可点反馈（容器已 overflow:hidden） */
.post-thumb img,
.post-thumb .cover-art { transition: transform .22s ease; }
.post-card:hover .post-thumb img,
.post-card:hover .post-thumb .cover-art { transform: scale(1.04); }
.post-thumb,
.post-card .post-title { transition: transform .22s ease, color .16s ease; }

.post-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--ink-4);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }

.post-title {
  font-family: var(--serif);
  font-size: 21.5px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 8px;
  letter-spacing: -.005em;
  transition: color .16s;
}

.post-summary {
  margin: 0 0 12px;
  color: var(--ink-3);
  font-size: 15px;
  line-height: var(--lh-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 侧栏 */
.side { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 32px; }

.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-row {
  display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; border-radius: 7px;
  font-size: 13.5px; color: var(--ink-2);
  transition: background .14s;
}
.cat-row:hover { background: var(--paper-2); }
.cat-row.active { background: var(--paper-3); font-weight: 500; }
.cat-row .count { font-size: 12px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud .tag { cursor: pointer; }


/* ============================ 归档（文件夹） ============================ */
.folders-wrap { padding: 40px 0 96px; }

.folders-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.folder-tree { position: sticky; top: 96px; }

.ft-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  font-family: var(--serif); font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); letter-spacing: .02em;
}
.ft-add, .fp-add {
  border: none; background: transparent; color: var(--ink-4);
  font-size: 14px; line-height: 1; cursor: pointer;
  padding: 3px 6px; border-radius: 4px;
  transition: color .14s, background .14s;
}
.ft-add:hover, .fp-add:hover { color: var(--ink); background: var(--paper-2); }

.ft-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13.5px; color: var(--ink-2);
  transition: background .14s;
}
.ft-row:hover { background: var(--paper-2); }
.ft-row.on { background: var(--paper-3); }
.ft-row.on .ft-name { color: var(--ink); font-weight: 500; }

.ft-toggle {
  position: relative;
  width: 14px; height: 14px; flex-shrink: 0;
  border: none; background: transparent; padding: 0;
  color: var(--ink-4); font-size: 14px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  font-family: var(--mono);
}
.ft-toggle.empty { visibility: hidden; }

.ft-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ft-count {
  font-size: 12px; color: var(--ink-4);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}

.ft-acts { display: none; gap: 1px; flex-shrink: 0; }
.ft-row:hover .ft-acts { display: flex; }
.ft-row:hover .ft-count { display: none; }
.ft-acts button {
  position: relative;
  width: 17px; height: 17px;
  border: none; background: transparent; padding: 0;
  color: var(--ink-4); font-size: 12px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; border-radius: 3px;
}
.ft-acts button:hover { color: var(--ink); background: var(--paper-3); }
.ft-acts [data-folder-del]:hover { color: var(--red); }

.ft-inline {
  width: 100%;
  font: inherit; font-size: 13.5px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 8px;
  outline: none;
}
.ft-inline:focus { border-color: var(--ink-4); }

/* 右侧面板 */
.fp-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 24px;
}
.fp-head h2 {
  font-family: var(--serif); font-size: 21px; font-weight: 600;
  margin: 0; letter-spacing: -.005em;
}
.fp-path { font-size: 12px; color: var(--ink-4); letter-spacing: .03em; }
.fp-head .muted { font-size: 12px; }

.fp-subs {
  display: flex; flex-wrap: wrap; gap: 6px 16px; padding-bottom: 16px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.fp-sub { font-size: 12px; color: var(--ink-3); cursor: pointer; }
.fp-sub:hover { color: var(--accent-ink); }
.fp-sub em { font-style: normal; font-size: 12px; color: var(--ink-4); margin-left: 4px; }

/* 编辑器里的文件夹选择 */
.folder-pick { display: flex; align-items: center; gap: 6px; }
.folder-pick select {
  flex: 1; min-width: 0;
  font: inherit; font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  outline: none;
}
.folder-pick select:focus { border-color: var(--ink-4); }
#edFolderSlot:empty { display: none; }
#edFolderSlot { margin-top: 6px; }

/* ============================ 文章详情 ============================ */

.article-wrap { padding-top: 48px; padding-bottom: 96px; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 56px;
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
}
.article-layout > * { min-width: 0; }
/* 没有目录的文章（无小节标题）不再渲染空列，正文独占一行 */
.article-layout.solo { grid-template-columns: minmax(0, 1fr); }

.article { max-width: 780px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; color: var(--ink-4);
  margin-bottom: 32px;
}
.back-link:hover { color: var(--ink); }

.article-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line-soft); }

.article-header h1 {
  font-family: var(--serif);
  font-size: clamp(26px, 3.6vw, 36px);
  line-height: 1.34;
  font-weight: 600;
  letter-spacing: -.015em;
  margin: 12px 0 16px;
  /* 折行不再留孤字，并去掉中文标点在行首占的空白 */
  text-wrap: balance;
  text-spacing-trim: trim-start;
}

.article-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 13.5px; color: var(--ink-4);
  flex-wrap: wrap;
}
/* Markdown 正文 */
.prose {
  font-size: 17.5px;
  line-height: var(--lh-read);
  color: var(--ink-2);
  word-break: break-word;
}
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.005em;
  margin: 2.1em 0 .7em;
  line-height: 1.45;
  /* 被目录 / 原生锚点定位时，留出顶栏的高度，标题不会贴在顶栏底下 */
  scroll-margin-top: 96px;
}
.prose h1 { font-size: 28px; }
.prose h2 { font-size: 23px; }
.prose h3 { font-size: 19.5px; }
.prose h4 { font-size: 17.5px; }
.prose p { margin: 0 0 1.35em; }
/* 导语段：正文第一段略大、略深，作为开篇提要 */
.prose > p:first-of-type { font-size: 18.5px; line-height: var(--lh-read); color: var(--ink); }
.prose a { color: var(--accent-ink); border-bottom: 1px solid var(--accent-soft); }
.prose a:hover { border-bottom-color: var(--accent); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.35em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--ink-4); }
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 24px;
  border-left: 2px solid var(--accent);
  color: var(--ink-3);
  font-style: normal;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--paper-3);
  padding: .16em .42em;
  border-radius: 4px;
  color: var(--accent-ink);
}
/* ---- 代码块 ---- */
:root {
  --code-bg: #f8f6f1;
  --code-head-bg: #f1eee7;
  --tok-kw: #a626a4; --tok-str: #50a14f; --tok-num: #b76b01; --tok-com: #9ca0a6;
  --tok-fn: #4078f2; --tok-type: #c18401; --tok-var: #e45649; --tok-punct: #5c6169;
}
[data-theme="dark"] {
  --code-bg: #191b18;
  --code-head-bg: #1f221e;
  --tok-kw: #c678dd; --tok-str: #98c379; --tok-num: #d19a66; --tok-com: #6b7280;
  --tok-fn: #61afef; --tok-type: #e5c07b; --tok-var: #e06c75; --tok-punct: #9aa2ad;
}

/* 注意：背景 / 圆角 / 滚动都放在 pre 本身，外层不做 overflow:hidden 裁剪
   —— iOS Safari 上「外层 hidden + 内层滚动」会导致内容溢出背景框（实测 bug） */
/* 代码块：不描边，只靠一层淡底色与正文区分，圆角收到 6px */
.code-block {
  margin: 1.7em 0;
  border-radius: 6px;
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px;
  background: var(--code-head-bg);
}
.code-lang {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);   /* 浅底上 ink-4 只有 4.37，提一档到 4.63 */
}
/* 复制按钮默认隐身，鼠标移到代码块上才淡出；键盘聚焦时也出现 */
.code-copy {
  font-size: 12px; color: var(--ink-3);
  background: transparent; border: none;
  padding: 2px 4px; cursor: pointer;
  font-family: inherit;
  opacity: 0;
  transition: opacity .16s, color .16s;
}
.code-block:hover .code-copy,
.code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--ink); }
.prose .code-block pre {
  margin: 0;
  background: var(--code-bg);
  padding: 16px 16px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.prose .code-block pre code { display: block; }

/* 关键：代码块内部的 code 不能再自带底色。
   深色模式下 `[data-theme="dark"] .prose code` 优先级(0,2,1)高于 `.prose pre code`(0,1,2)，
   会把 nl2br 般的内层 code 刷上一层别的底色，iOS 上表现为底色分块 / 文字溢出背景框。
   这里用同级高优先级兜底，浅色深色都封死。 */
.prose pre code,
.prose .code-block pre code,
[data-theme="dark"] .prose pre code,
[data-theme="dark"] .prose .code-block pre code,
.prose pre code.hljs,
[data-theme="dark"] .prose pre code.hljs {
  background: none;
  padding: 0;
  color: var(--ink-2);
}

.prose pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 16px 24px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  margin: 1.6em 0;
  line-height: var(--lh-text);
}
.prose pre code { background: none; padding: 0; color: var(--ink-2); font-size: 14px; }

/* highlight.js 配色（跟随深浅主题的 CSS 变量） */
.hljs-comment, .hljs-quote { color: var(--tok-com); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-meta, .hljs-doctag { color: var(--tok-kw); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-string, .hljs-char.escape_ { color: var(--tok-str); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link { color: var(--tok-num); }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: var(--tok-fn); }
.hljs-title.class_, .hljs-type, .hljs-built_in, .hljs-builtin-name, .hljs-class .hljs-title { color: var(--tok-type); }
.hljs-variable, .hljs-attr, .hljs-attribute, .hljs-template-variable, .hljs-property, .hljs-selector-attr, .hljs-deletion { color: var(--tok-var); }
.hljs-punctuation, .hljs-operator, .hljs-params, .hljs-selector-id, .hljs-selector-class, .hljs-tag { color: var(--tok-punct); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.6em 0; }
.prose img { border-radius: 10px; margin: 1.6em 0; border: 1px solid var(--line-soft); }
/* 带图注的图片：![说明](url) 会渲染成 figure + figcaption */
.prose figure { margin: 1.9em 0; }
.prose figure img { display: block; width: 100%; height: auto; margin: 0; }
.prose figcaption {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  line-height: var(--lh-text);
  color: var(--ink-4);
  letter-spacing: .02em;
}
/* ---- 数学公式 ---- */
.prose .katex { font-size: 1.06em; max-width: 100%; }
.prose .katex-display {
  margin: 1.7em 0;
  padding: 2px 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.prose .katex-display > .katex { white-space: normal; }

/* 长公式 / 长链接 / 长 URL 的兜底换行 */
.prose { overflow-wrap: break-word; }

/* KaTeX 未加载 / 渲染失败时的降级显示 */
.math-fallback {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--paper-2);
  padding: .2em .5em;
  border-radius: 5px;
  color: var(--accent-ink);
}
pre.math-fallback { padding: 16px 16px; margin: 1.5em 0; white-space: pre-wrap; }

.prose table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: 14px; }
/* 表格：只留横向细线，去掉竖线与外框 —— 纸张逻辑，不是 Excel 逻辑 */
.prose th, .prose td {
  border: none;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 16px 12px 0;
  text-align: left;
  vertical-align: top;
}
.prose th { font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line); }
.prose tbody tr:last-child td { border-bottom: none; }

.article-foot { margin-top: 48px; padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}

/* 文章目录：卡片式，跟随滚动 */
/* 目录：不套卡片。一条竖线建立层级，当前小节跟随滚动高亮。
   border-left 落在元素左缘，所以所有条目共用同一条直线，只有缩进不同。 */
.article-toc {
  position: sticky;
  position: -webkit-sticky;
  top: 96px;
  font-size: 13.5px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  /* 目录内部滚到底时不要把整页也带着滚下去 */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.article-toc .toc-head {
  font-size: 12px; color: var(--ink-4); margin-bottom: 12px; padding-left: 16px;
}
.article-toc a {
  display: block;
  padding: 6px 0 6px 16px;
  color: var(--ink-3);
  line-height: 1.55;
  overflow-wrap: anywhere;
  border-left: 1px solid var(--line-soft);
  transition: color .16s, border-color .16s;
}
.article-toc a:hover { color: var(--ink-2); }
.article-toc a.is-current {
  color: var(--ink);
  border-left-color: var(--accent);
  font-weight: 500;
}
.article-toc a.lvl-3 { padding-left: 32px; font-size: 12px; }

/* 封面：有图用图，没有就用按分类取色的线稿占位图 */
.article-cover {
  margin: 0 0 32px;
  aspect-ratio: 16/7;
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-2);
}
.article-cover img,
.article-cover .cover-art { width: 100%; height: 100%; display: block; object-fit: cover; }

/* 文末：上一篇 / 下一篇。只有文字和箭头，不套卡片 */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 56px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
.pn { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pn.next { text-align: right; }
.pn-label { font-size: 12px; color: var(--ink-4); }
.pn.prev .pn-label::before { content: '← '; }
.pn.next .pn-label::after { content: ' →'; }
.pn-title {
  font-size: 14.5px; color: var(--ink-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pn:hover .pn-title { color: var(--accent-ink); }

/* 文章头部：分类与标签一律纯文字，不套胶囊 */
.article-header .post-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px;
}
.meta-cat { color: var(--accent-ink); }
.meta-tag { color: var(--ink-4); }
.meta-tag::before { content: '#'; opacity: .5; margin-right: 1px; }

/* 手机端目录：折叠面板（桌面隐藏） */
.toc-mobile { display: none; }

/* ============================ 资料页 ============================ */

.page-head { padding: 56px 0 32px; }
.page-head h1 { font-family: var(--serif); font-size: 32px; font-weight: 600; margin: 0 0 12px; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--ink-3); font-size: 15.5px; max-width: 40em; line-height: var(--lh-read); }

.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
  padding: 8px 0 80px;
}

.res-card {
  display: flex; flex-direction: column;
  padding: 24px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line-soft);
  transition: border-color .16s, box-shadow .16s, transform .16s;
  min-height: 152px;
}
/* -1px 位移低于感知阈值，抬到 -2px 才看得出「浮起来」 */
.res-card:hover { border-color: var(--line); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.res-card h3 { transition: color .16s ease; }
.res-card:hover h3 { color: var(--accent-ink); }

.res-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.res-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--paper-2); color: var(--ink-3);
  flex-shrink: 0;
}

.res-card h3 {
  font-family: var(--serif); font-size: 15.5px; font-weight: 600;
  margin: 0 0 6px; line-height: 1.5; color: var(--ink);
}
.res-card .desc { margin: 0 0 16px; font-size: 14px; color: var(--ink-3); line-height: var(--lh-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1;
}
.res-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-4); margin-top: auto; }
.res-foot .open { margin-left: auto; color: var(--accent-ink); font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }

/* ============================ 待办 · 日程 ============================ */

.plan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  padding: 8px 0 80px;
  align-items: start;
}

.panel {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 {
  font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.panel-head .badge {
  font-size: 12px; padding: 1px 7px; border-radius: 999px;
  background: var(--paper-3); color: var(--ink-3); font-weight: 500;
}

.panel-body { padding: 12px 12px 16px; }

/* 待办条目 */
.todo-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 12px;
  border-radius: 8px;
  transition: background .14s;
  position: relative;
}
.todo-item:hover { background: var(--paper-2); }

.check {
  position: relative;
  width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: #fff;
  display: grid; place-items: center;
  transition: background .14s, border-color .14s;
  cursor: pointer;
  padding: 0;
}
.check:hover { border-color: var(--ink-4); }
.check svg { opacity: 0; color: #fff; }
.todo-item.done .check { background: var(--green); border-color: var(--green); }
.todo-item.done .check svg { opacity: 1; }

.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 14px; line-height: 1.55; color: var(--ink); word-break: break-word; }
.todo-item.done .todo-title { color: var(--ink-4); text-decoration: line-through; text-decoration-color: var(--ink-4); }

.todo-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 12px; color: var(--ink-4); flex-wrap: wrap; }

.pri-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.pri-high { background: var(--red); }
.pri-normal { background: var(--ink-4); }
.pri-low { background: var(--line); }

.todo-del {
  border: none; background: transparent; color: var(--ink-4);
  opacity: 0; padding: 2px 4px; border-radius: 5px; font-size: 15px; line-height: 1;
  transition: opacity .14s, color .14s;
}
.todo-item:hover .todo-del { opacity: 1; }
.todo-del:hover { color: var(--red); }

/* 内联添加 */
.inline-add {
  display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 8px 12px;
  border-radius: 8px;
  background: var(--paper-2);
}
.inline-add input[type="text"] {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  /* iOS：≥16px 防聚焦缩放 */
  font-size: 16px; padding: 4px 0;
}
.inline-add input[type="date"] {
  border: none; background: transparent; outline: none;
  font-size: 13.5px; color: var(--ink-3); width: 104px; flex-shrink: 0;
}
/* 两个输入框内部 outline 都被清了，焦点环挂到整条容器上 */
.inline-add:focus-within { box-shadow: 0 0 0 2px rgba(162,96,61,.22); }
.inline-add button {
  border: none; background: var(--ink); color: var(--paper);
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center; flex-shrink: 0;
}

/* 日程列表 */
.day-group { margin-bottom: 6px; }
.day-label {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 6px;
  font-size: 12px; letter-spacing: .08em; color: var(--ink-4);
  text-transform: uppercase; font-weight: 600;
}
.day-label .today {
  background: var(--accent); color: #fff; padding: 1px 7px; border-radius: 999px;
  font-size: 12px; letter-spacing: .04em;
}
.day-label::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.event {
  display: flex; gap: 12px;
  padding: 12px 12px;
  border-radius: 8px;
  position: relative;
}
.event:hover { background: var(--paper-2); }
.event:hover .todo-del { opacity: 1; }

.event-time {
  font-size: 12px; color: var(--ink-3); min-width: 44px; padding-top: 2px;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.event-bar { width: 3px; border-radius: 2px; flex-shrink: 0; background: var(--blue); }
.event-bar.blue { background: var(--blue); }
.event-bar.green { background: var(--green); }
.event-bar.clay { background: var(--accent); }
.event-bar.purple { background: #7d6693; }
.event-title { font-size: 14px; line-height: 1.5; color: var(--ink); }
.event-sub { font-size: 12px; color: var(--ink-4); margin-top: 2px; }

/* ============================ 关于页 ============================ */

.about-wrap { max-width: 640px; margin: 0 auto; padding: 56px 0 96px; }
.about-wrap h1 { font-family: var(--serif); font-size: 34px; font-weight: 600; margin: 0 0 24px; letter-spacing: -.015em; }
.about-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: #fff; border: 1px solid var(--line-soft);
  margin-bottom: 16px;
}

/* ============================ 页脚 ============================ */

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 24px 0;
  position: relative; z-index: 1;
}
.footer-inner { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ink-4); flex-wrap: wrap; }
.footer-inner a:hover { color: var(--ink-2); }
.footer-dot { color: var(--line); }

/* ============================ 后台管理 ============================ */

.admin-page { padding: 8px 0 0; }
.admin-list { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: #fff; overflow: hidden; }

.admin-row {
  display: flex; align-items: center; gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .14s;
}
.admin-row:last-child { border-bottom: none; }
.admin-row:hover { background: var(--paper-2); }

.admin-main { flex: 1; min-width: 0; }
.admin-title {
  font-family: var(--serif); font-size: 16px; font-weight: 600;
  line-height: 1.5; display: block; margin-bottom: 6px;
  word-break: break-word;
}
.admin-title:hover { color: var(--accent-ink); }
.admin-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-4); flex-wrap: wrap; }
.admin-actions { display: flex; gap: 7px; flex-shrink: 0; }

@media (max-width: 720px) {
  .admin-row { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 16px; }
  .admin-actions { justify-content: flex-end; }
}

/* ============================ 弹窗 / 抽屉 ============================ */

.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(33,32,29,.32);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes slideLeft { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }

.modal {
  width: 100%; max-width: 400px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 32px 32px 24px;
  box-shadow: var(--shadow-2);
  position: relative;
  animation: slideUp .22s cubic-bezier(.2,.8,.3,1);
}

.modal-close {
  position: absolute; right: 14px; top: 12px;
  width: 36px; height: 36px; border: none; background: transparent;
  font-size: 19px; color: var(--ink-4); border-radius: 6px;
}
.modal-close:hover { background: var(--paper-2); color: var(--ink); }

.modal-title { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.modal-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 24px; line-height: var(--lh-text); }
.modal-hint { font-size: 12px; color: var(--ink-4); text-align: center; margin: 16px 0 0; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 6px; letter-spacing: .04em; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
  /* iOS：小于 16px 的输入框聚焦时会强制缩放整页，必须 ≥16px */
  font-size: 16px;
  transition: border-color .16s, box-shadow .16s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(162,96,61,.09);
}
.field textarea { resize: vertical; line-height: var(--lh-text); min-height: 90px; }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; }

.form-error {
  font-size: 12.8px; color: var(--red);
  background: #f8ecea; padding: 8px 12px; border-radius: 7px; margin: 0 0 16px; line-height: var(--lh-ui);
}

/* 抽屉 */
.drawer-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(33,32,29,.28);
  backdrop-filter: blur(2px);
  display: flex; justify-content: flex-end;
  animation: fadeIn .16s ease;
}
.drawer {
  width: min(620px, 100%);
  height: 100%;
  background: var(--paper);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(33,32,29,.12);
  animation: slideLeft .24s cubic-bezier(.2,.8,.3,1);
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.drawer-head h2 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0; }
.drawer-head .icon-btn { font-size: 20px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 24px 24px; }

.drawer-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
  flex-shrink: 0;
}
.drawer-actions { display: flex; gap: 8px; }
.drawer-status { font-size: 12px; color: var(--ink-4); }

.editor-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
}
.editor-toolbar button {
  border: none; background: transparent; padding: 4px 8px; border-radius: 5px;
  font-size: 12px; color: var(--ink-3);
}
.editor-toolbar button:hover { background: #fff; color: var(--ink); }
.editor-toolbar .sep { width: 1px; height: 14px; background: var(--line); margin: 0 4px; }

.editor-textarea {
  width: 100%;
  min-height: 320px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: #fff;
  outline: none;
  font-family: var(--mono);
  /* iOS：≥16px 防止聚焦时整页缩放 */
  font-size: 16px;
  line-height: var(--lh-text);
  resize: vertical;
}
.editor-textarea:focus { border-color: var(--ink-4); }

.preview-pane {
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: #fff;
  padding: 24px 24px;
  min-height: 320px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%; bottom: 34px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow-2);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 25%, var(--paper-3) 37%, var(--paper-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

.sk-line { height: 13px; margin-bottom: 12px; }
.sk-title { height: 20px; width: 62%; margin-bottom: 16px; }

/* ============================ 响应式 ============================ */

@media (max-width: 900px) {
  .layout-main { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* 手机上「今日」不再隐藏，而是提到文章列表上方 —— 打开首页先看今天有什么事 */
  .side {
    position: static;
    order: 1;
    display: flex;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line-soft);
  }
  .layout-main > div { order: 2; }
    .today-block + .today-block { margin-top: 24px; }
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .article-toc { display: none; }
  .plan-layout { grid-template-columns: 1fr; gap: 24px; }
  .post-card { grid-template-columns: minmax(0,1fr) 132px; gap: 16px; }
  /* 窄屏上下篇改成竖排，右侧对齐在单列下会很怪 */
  .post-nav { grid-template-columns: 1fr; gap: 24px; }
  .pn.next { text-align: left; }
  /* 归档：窄屏把树放到列表上方 */
  .folders-layout { grid-template-columns: 1fr; gap: 0; }
  .folder-tree {
    position: static; padding-bottom: 24px; margin-bottom: 24px;
    border-bottom: 1px solid var(--line-soft);
  }
  /* 触屏没有 hover，操作按钮常驻，且放大到能点 */
  .ft-acts { display: flex; gap: 4px; }
  .ft-acts button { width: 26px; height: 26px; font-size: 13.5px; }
  .ft-row:hover .ft-count { display: block; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }

  /* —— 手机端阅读优化 —— */
  body { font-size: 16px; line-height: var(--lh-text); }
  .hero-line { font-size: 12px; gap: 7px; }
  .hero-line b { font-size: 14px; }
  .post-title { font-size: 19px; line-height: 1.5; }
  .post-summary { font-size: 14.5px; line-height: var(--lh-text); }
  /* 手机上封面收成一张小方图，11 篇不至于滚不到底 */
  .post-card { padding: 24px 0; grid-template-columns: minmax(0,1fr) 92px; gap: 16px; }
  .post-thumb { aspect-ratio: 1/1; }

  .article-wrap { padding-top: 24px; padding-bottom: 56px; }
  .article { max-width: none; }
  .article-header h1 { font-size: 25px; line-height: 1.38; }
  .article-header { margin-bottom: 24px; padding-bottom: 24px; }
  .article-cover { margin-bottom: 24px; }

  .prose { font-size: 17px; line-height: var(--lh-read); letter-spacing: .005em; }
  .prose p { margin-bottom: 1.45em; }
  .prose h1 { font-size: 23px; margin-top: 1.9em; }
  .prose h2 { font-size: 21px; margin-top: 1.9em; }
  .prose h3 { font-size: 18.5px; }
  .prose blockquote { padding: 2px 0 2px 16px; margin: 1.5em 0; }
  .prose img { width: 100%; height: auto; border-radius: 8px; margin: 1.4em 0; }
  .prose ul, .prose ol { padding-left: 1.25em; }
  .prose li { margin: .45em 0; }
  /* 代码块：允许横向滚动，不撑破页面 */
  .prose pre {
    border-radius: 9px;
    padding: 16px 16px;
    margin: 1.5em 0;
    -webkit-overflow-scrolling: touch;
    font-size: 13.5px;
    line-height: var(--lh-text);
  }
  .prose .code-block { margin: 1.5em 0; }
  .prose .code-block pre { padding: 12px 16px; border-radius: 0 0 10px 10px; }
  .prose .code-block .code-head { border-radius: 10px 10px 0 0; }
  .code-copy { padding: 3px 8px; }

  /* 手机端：侧栏目录隐藏，改为正文内的折叠目录 */
  .toc-mobile {
    display: block;
    margin: 0 0 24px;
    background: var(--paper-2);
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    padding: 4px 16px;
  }
  .toc-mobile summary {
    cursor: pointer; font-weight: 600; color: var(--ink); padding: 12px 0; font-size: 14px;
    list-style: none; display: flex; align-items: center; gap: 8px;
  }
  .toc-mobile summary::before { content: '☰'; color: var(--accent-ink); }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile nav { padding: 4px 0 12px; }
  .toc-mobile nav a { display: block; padding: 6px 0; color: var(--ink-3); font-size: 13.5px; line-height: 1.5; }
  .toc-mobile nav a.lvl-3 { padding-left: 16px; font-size: 13.5px; color: var(--ink-4); }
  /* 宽表格单独滚动 */
  .prose table { display: block; overflow-x: auto; white-space: nowrap; font-size: 13.5px; }

  .admin-row { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 16px; }
  .admin-actions { justify-content: flex-end; }

  /* 抽屉：手机上全屏，键盘弹出时正文可滚 */
  .drawer-body { padding: 16px 16px 40px; }
  .editor-textarea { min-height: 46vh; font-size: 14px; }
  .drawer-foot { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .drawer-actions { width: 100%; justify-content: flex-end; }
  .drawer-foot .drawer-status { width: 100%; order: 2; }

  /* —— 顶栏加固：保证搜索/主题/登录/菜单都放得下 —— */
  .header-inner { height: 60px; gap: 8px; }
  .brand { gap: 8px; }
  .header-tools { gap: 2px; }
  .icon-btn { width: 40px; height: 40px; }
  .nav {
    position: fixed; left: 0; right: 0; top: 60px;
    flex-direction: column; gap: 2px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 12px 16px 16px;
    box-shadow: var(--shadow-2);
    transform: translateY(-8px);
    opacity: 0; pointer-events: none;
    transition: opacity .18s, transform .18s;
    z-index: 45;
  }
  .nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-link { padding: 12px 12px; font-size: 15px; }
  .menu-btn { display: grid; }
  .brand-sub, .brand-sep { display: none; }
  .brand-word { font-size: 20px; }
  .hero { padding: 24px 0 16px; }

  /* 每日一句：窄屏上下堆叠，中间的竖线去掉 */
  .daily { padding: 16px 0 24px; }
  .daily-body { grid-template-columns: 1fr; gap: 8px; }
  .daily-en { padding-right: 0; font-size: 15.5px; }
  .daily-cn { padding-left: 0; border-left: none; font-size: 13.5px; }
  .hero-who { gap: 8px; }
  .hero-aff { display: none; }   /* 窄屏只留名字，学院信息挤不下 */
  .home-body { padding: 32px 0 64px; }
  .article-wrap { padding-top: 24px; padding-bottom: 64px; }
  .post-title { font-size: 18px; }
  .prose { font-size: 15.5px; }
  .drawer { width: 100%; }
  .drawer-body { padding: 16px; }
  .res-grid { grid-template-columns: 1fr; }
  .modal { padding: 24px 24px 24px; }
  .filter-row .spacer { display: none; }
  .user-chip span { display: none; }
}

/* ============================ 阅读进度 ============================ */

.read-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 80;
  pointer-events: none;
}
.read-progress-bar {
  height: 100%; width: 0;
  background: var(--accent);
  transition: width .08s linear;
}

/* 剩余阅读时间：右下角浮标，不遮挡顶栏按钮 */
.read-time {
  position: fixed; right: 18px; bottom: 18px;
  z-index: 55;
  pointer-events: none;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-1);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .02em;
  opacity: 0;
  transition: opacity .22s;
  white-space: nowrap;
}
.read-time.show { opacity: 1; }
.read-time b { color: var(--ink); font-weight: 500; }

/* ============================ 手机端目录抽屉 ============================ */
/* 窄屏侧栏被隐藏，读长文时没法随时定位 —— 用一个角落里的入口补上。
   桌面端整个不出现，右下角原本就留给阅读进度浮标了。 */
.toc-fab, .toc-sheet { display: none; }

@media (max-width: 900px) {
  .toc-fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 56;
    width: 42px; height: 42px; padding: 0; border-radius: 999px;
    background: var(--paper); color: var(--ink-3);
    border: 1px solid var(--line-soft);
    box-shadow: var(--shadow-1);
    -webkit-tap-highlight-color: transparent;
    /* 只在读过一段之后浮出来：刚进文章时顶部折叠目录就在眼前，两个入口会打架 */
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
  }
  .toc-fab.show { opacity: .92; transform: none; pointer-events: auto; }
  .toc-sheet { display: block; }
}

.toc-sheet-bg {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(24, 21, 18, .34);
  animation: sheetFade .2s ease;
}
.toc-sheet-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  max-height: 72vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border-top: 1px solid var(--line-soft);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
  padding: 0 18px calc(18px + env(safe-area-inset-bottom));
  animation: sheetUp .24s ease;
}
.toc-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  height: 44px; font-size: 12px; color: var(--ink-4);
  position: sticky; top: 0; background: var(--paper);
}
.toc-sheet-head button {
  background: none; border: none; padding: 6px; color: var(--ink-4);
  cursor: pointer; display: flex; align-items: center;
}
#tocSheetNav a {
  display: block;
  padding: 12px 0 12px 16px;
  color: var(--ink-3);
  font-size: 14px; line-height: var(--lh-ui);
  overflow-wrap: anywhere;
  border-left: 1px solid var(--line-soft);
}
#tocSheetNav a.lvl-3 { padding-left: 32px; font-size: 13.5px; color: var(--ink-4); }
#tocSheetNav a.is-current { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
/* iOS Safari：滚动 + 圆角必须落在同一个元素上，别让祖先去裁 */
@supports (-webkit-touch-callout: none) {
  .toc-sheet-panel { overflow-y: scroll; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheetFade { from { opacity: 0; } to { opacity: 1; } }

/* ============================ 首页筛选：一行常驻 pill ============================ */

/* 筛选条：悬浮玻璃胶囊 —— 吸顶悬浮在文章列表上方，滚动时始终可见 */
.filter-strip {
  position: sticky;
  position: -webkit-sticky;
  top: var(--header-h);   /* 贴住顶栏底部 */
  z-index: 30;
  padding: 8px 0 16px;
  margin: 0 0 12px;
}
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  background: rgba(251,250,247,.72);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  backdrop-filter: saturate(150%) blur(14px);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 7px 8px 7px 16px;
  box-shadow: var(--shadow-1);
}
[data-theme="dark"] .filter-bar { background: rgba(20,21,19,.72); }
.filter-pills {
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  min-width: 0;
}
.filter-pills::-webkit-scrollbar { display: none; }
.fp-pill {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 6px 12px; font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; font-family: inherit;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.fp-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--dot, var(--ink-3));
  transition: background .16s ease;
}
.fp-pill.on .fp-dot { background: currentColor; }
.fp-pill:hover { background: var(--paper-2); color: var(--ink); transform: translateY(-1px); }
.fp-pill.on {
  background: var(--accent); color: #fff; font-weight: 500;
  box-shadow: 0 1px 4px rgba(162,96,61,.28);
}
.fp-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 深色模式 accent 变浅棕，白字对比不够，改深字 */
[data-theme="dark"] .fp-pill.on { color: #221d18; box-shadow: none; }
.filter-bar-count {
  font-size: 12px; color: var(--ink-3); flex-shrink: 0;
  margin-left: auto; padding-right: 12px; white-space: nowrap;
}
/* 悬浮条占满整列，会盖住侧栏顶部 —— 侧栏起点 = 顶栏 + 筛选条（149px） */
.side.side-today { top: calc(var(--header-h) + var(--filter-h)); }

@media (max-width: 720px) {
  :root { --header-h: 64px; }   /* 移动端顶栏压到 60px + 1px 边框 */
  .filter-strip { top: var(--header-h); padding: 6px 0 12px; margin: 0 0 6px; }
  .filter-bar { padding: 6px 6px 6px 12px; }
  .fp-pill { padding: 6px 12px; font-size: 12px; }
  .filter-bar-count { padding-right: 8px; }
}

/* ============================ 代码块行号与高亮行 ============================ */

/* 行号用 CSS 计数器生成在 ::before 里，不进入 DOM 文本 ——
   所以复制按钮取 textContent 时不会把行号一起带走 */
.prose pre.lined { padding: 16px 0; }
.prose pre.lined code { display: block; padding: 0 16px 0 0; }
.prose pre.lined code .cl {
  display: block;
  min-width: max-content;
  padding-left: 16px;
  counter-increment: codeline;
}
.prose pre.lined code { counter-reset: codeline; }
.prose pre.lined code .cl::before {
  content: counter(codeline);
  display: inline-block;
  width: 2.2em;
  margin-right: 1.2em;
  text-align: right;
  color: var(--ink-4);
  opacity: .45;
  font-variant-numeric: tabular-nums;
  -webkit-user-select: none;
  user-select: none;
}
.prose pre.lined code .cl.hl {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
[data-theme="dark"] .prose pre.lined code .cl.hl {
  background: rgba(160, 96, 61, .18);
}

@media (max-width: 720px) {
  /* 窄屏隐藏行号，避免挤占本就紧张的横向空间 */
  .prose pre.lined code .cl::before { display: none; }
  .prose pre.lined code .cl { padding-left: 16px; }
  .prose pre.lined { padding: 16px 0; }
  .read-time { right: 12px; bottom: 12px; font-size: 12px; }
}

/* ============================================================
   无障碍：尊重系统的「减少动态效果」偏好（WCAG 2.3.3）
   骨架屏 shimmer、抽屉/弹窗入场、hover 位移、主题过渡一律关掉，
   保留布局与配色，只去掉运动。
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   第二轮改造 v=1024b
   结构：访客侧栏收编 / 卡片索引式 / 字阶行高 / 徽标对比度 / 圆角收口
   ============================================================ */

/* 访客没有待办/日程、本周也没写时，不渲染空侧栏；
   卡片顺势改成「左小图 + 右文字」的索引式排版 */
.layout-main.solo { grid-template-columns: minmax(0, 1fr); }
.layout-main.solo .side { display: none; }
.layout-main.solo .post-card {
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  max-width: 860px;
}
.layout-main.solo .post-thumb { order: -1; aspect-ratio: 1/1; }
.layout-main.solo .post-summary { max-width: 62ch; }

/* 字阶与行高：标题 22 / 摘要 15 / 正文 17·1.9，标题与正文拉开层级 */
.post-title { font-size: 22px; line-height: 1.45; letter-spacing: -0.012em; }
.post-summary {
  font-size: 15px; line-height: 1.75; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-top: 2px;
}
.post-meta { color: var(--ink-3); gap: 10px; }

.prose { font-size: 17px; line-height: 1.9; color: var(--ink-2); }
.prose > p:first-of-type { font-size: 17px; line-height: 1.9; color: var(--ink-2); }
.prose h2 { font-size: 25px; line-height: 1.4; margin: 2.2em 0 0.7em; }
.prose h3 { font-size: 21.5px; line-height: 1.45; margin: 2em 0 0.65em; }
.prose h4 { font-size: 19.5px; line-height: 1.5; margin: 1.8em 0 0.6em; }
.prose p { margin: 0 0 1.15em; }

/* 待办徽标：ink-3 落 paper-3 只有 4.48，换成 paper-2 底（4.86） */
.panel-head .badge { background: var(--paper-2); }

/* 圆角：图片与代码块从 10px 收到 8px 档 */
.prose img { border-radius: 8px; }

@media (max-width: 720px) {
  /* 筛选条：不再半截截断，右侧加渐隐提示「还有更多」，隐藏计数 */
  .filter-bar { padding: 6px 6px 6px 10px; }
  .filter-pills {
    position: relative;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 85%, transparent 100%);
  }
  .filter-bar-count { display: none; }
  .fp-pill { font-size: 12px; padding: 6px 10px; }

  .layout-main.solo .post-card { grid-template-columns: 76px minmax(0, 1fr); gap: 16px; max-width: none; }

  .prose h2 { font-size: 22px; }
  .prose h3 { font-size: 19.5px; }
  .prose h4 { font-size: 18px; }

  /* 移动端目录：不套卡片，用上下发丝线区分 */
  .toc-mobile {
    background: transparent; border: none;
    border-top: 1px solid var(--line-soft); border-radius: 0;
    padding: 0; margin: 0 0 28px;
  }
  .toc-mobile summary { padding: 14px 0; font-size: 13.5px; color: var(--ink-3); letter-spacing: .04em; }
  .toc-mobile[open] summary { border-bottom: 1px solid var(--line-soft); }

  .prose .code-block pre { border-radius: 0 0 8px 8px; }
  .prose .code-block .code-head { border-radius: 8px 8px 0 0; }
}
