/* ============================================================
   小白的笔记本 - 全局样式
   主题：纸感阅读（日间） / 深色玻璃（夜间）
   全部颜色收敛在 CSS 变量里，切换主题只需改 html[data-theme]
   ============================================================ */

/* ---------------- 变量：日间 · 纸感 ---------------- */
:root {
  --font-serif: Georgia, "Times New Roman", "Songti SC", "STSong",
    "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  --paper: #faf7f2;
  --paper-deep: #f2ece1;
  --card: #ffffff;
  --card-soft: #fdfbf6;

  --ink: #201b15;
  --ink-2: #6f6759;
  --ink-3: #a49a8c;

  --line: #ece2d2;
  --line-strong: #ddd0b9;

  --brand: #b03a2e;
  --brand-deep: #8f2c22;
  --brand-soft: #f8ece9;

  --accent: #4a6b5a;
  --accent-soft: #eef2ee;

  --gradient: linear-gradient(135deg, #bc4a3c 0%, #b03a2e 55%, #8b2b21 100%);
  --gradient-soft: linear-gradient(135deg, rgba(176, 58, 46, .1), rgba(74, 107, 90, .1));

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --shadow-1: 0 1px 2px rgba(72, 56, 32, .05), 0 6px 18px rgba(72, 56, 32, .045);
  --shadow-2: 0 2px 6px rgba(72, 56, 32, .07), 0 16px 38px rgba(72, 56, 32, .1);

  --glow-a: rgba(176, 58, 46, .07);
  --glow-b: rgba(74, 107, 90, .07);

  --header-bg: rgba(250, 247, 242, .86);
  --code-bg: #2b2622;
  --code-fg: #f0e9df;
}

/* ---------------- 变量：夜间 · 深色玻璃 ---------------- */
/* 可读性优先：底色整体抬亮一档、正文避开纯白（深底纯白会晕光）、
   线条提亮让卡片有边界、光晕减半避免字后铺雾 */
html[data-theme="dark"] {
  --paper: #151a26;
  --paper-deep: #1b2130;
  --card: #1e2434;
  --card-soft: #252c3e;

  --ink: #f2f4fa;
  --ink-2: #c3cad9;
  --ink-3: #9aa3b6;

  --line: #343c52;
  --line-strong: #4b5573;

  --brand: #38d9f0;
  --brand-deep: #9beeff;
  --brand-soft: #12333f;

  --accent: #b49bfb;
  --accent-soft: #241f3d;

  --gradient: linear-gradient(135deg, #38d9f0 0%, #b49bfb 55%, #f78ac4 100%);
  --gradient-soft: linear-gradient(135deg, rgba(56, 217, 240, .14), rgba(180, 155, 251, .14));

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .38), 0 6px 18px rgba(0, 0, 0, .26);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .42), 0 14px 34px rgba(0, 0, 0, .36);

  --glow-a: rgba(56, 217, 240, .07);
  --glow-b: rgba(180, 155, 251, .07);

  --header-bg: rgba(21, 26, 38, .96);
  --code-bg: #10141d;
  --code-fg: #dde5f2;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.72;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

/* 纸面柔光（暗色时为霓虹光晕） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(880px 420px at 10% -10%, var(--glow-a), transparent 62%),
    radial-gradient(720px 380px at 92% -6%, var(--glow-b), transparent 64%);
}

.site-header, main, .site-footer { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; letter-spacing: .2px; }

a { color: var(--brand); text-decoration: none; transition: color .18s, opacity .18s; }
a:hover { color: var(--brand-deep); }

::selection { background: var(--brand-soft); color: var(--brand-deep); }

.container { max-width: 1000px; margin: 0 auto; padding: 0 18px; }

/* ---------------- 顶部导航 ---------------- */
.site-header {
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}
/* 夜间：顶栏接近不透明 + 弱模糊，滚动时导航文字不发虚 */
html[data-theme="dark"] .site-header {
  backdrop-filter: saturate(120%) blur(6px);
  -webkit-backdrop-filter: saturate(120%) blur(6px);
}
.site-header .container {
  display: flex;
  align-items: center;
  height: 62px;
  gap: 20px;
}
/* 公共返回按钮（二级及以上页面，首页不显示） */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}
.back-btn svg { width: 15px; height: 15px; }
.back-btn:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: var(--brand-soft);
  transform: translateX(-2px);
}
html[data-theme="dark"] .back-btn:hover { color: var(--brand); }

.logo {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .5px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  white-space: nowrap;
  position: relative;
  transition: background .2s, color .2s;
}
.site-nav a:hover { background: var(--brand-soft); color: var(--brand-deep); }
.site-nav a.active {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 500;
}
.site-nav a.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: var(--gradient);
}

.user-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.user-nav a {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 14px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  transition: border-color .2s, color .2s, background .2s;
}
.user-nav a:hover { border-color: var(--line-strong); color: var(--ink); }
.user-nav a.btn-primary {
  background: var(--gradient);
  color: #fff;
  border: none;
  font-weight: 500;
  box-shadow: 0 4px 14px -4px rgba(176, 58, 46, .5);
}
html[data-theme="dark"] .user-nav a.btn-primary {
  color: #08131a;
  box-shadow: 0 4px 14px -4px rgba(34, 211, 238, .5);
}
.user-nav a.btn-primary:hover { opacity: .92; color: #fff; }
html[data-theme="dark"] .user-nav a.btn-primary:hover { color: #08131a; }

.avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line-strong);
}

/* 主题开关 */
.theme-toggle {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  transition: color .2s, border-color .2s, transform .3s;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--line-strong); transform: rotate(18deg); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------------- 首屏 ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 40px 36px 34px;
  margin: 26px 0 30px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  animation: riseIn .6s cubic-bezier(.22, .61, .36, 1) both;
}
.hero::after {
  content: '';
  position: absolute;
  right: -90px; top: -110px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: var(--gradient-soft);
  opacity: .9;
  pointer-events: none;
}
.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: 38px;
  line-height: 1.25;
  letter-spacing: 2px;
  margin-bottom: 10px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  width: fit-content;
}
.hero-sub {
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 22px;
  font-family: var(--font-serif);
  letter-spacing: 1px;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.hero-stat {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  min-width: 84px;
}
.hero-stat b {
  display: block;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.3;
}
.hero-stat span { font-size: 12.5px; color: var(--ink-3); }
/* 可点击的统计框（如「N 位作者」→ 作者列表） */
.hero-stat-link { position: relative; transition: border-color .22s, transform .22s, box-shadow .22s; }
.hero-stat-link::after {
  content: '→';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 12px;
  color: var(--ink-3);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity .22s, transform .22s;
}
.hero-stat-link:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-1);
}
.hero-stat-link:hover::after { opacity: 1; transform: none; color: var(--brand); }
.hero-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.hero-cats a {
  font-size: 13px;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  background: var(--card);
  transition: all .2s;
}
.hero-cats a:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: var(--brand-soft);
  transform: translateY(-1px);
}

/* ---------------- 筛选栏 ---------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0 18px;
  flex-wrap: wrap;
}
/* 有首屏时，hero 的 30px 下边距与其折叠，间距保持不变 */
.hero + .filter-bar { margin-top: 0; }
.filter-bar .sort-tabs { display: flex; gap: 6px; }
.filter-bar .sort-tabs a {
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  transition: all .2s;
}
.filter-bar .sort-tabs a:hover { color: var(--brand-deep); border-color: var(--line-strong); }
.filter-bar .sort-tabs a.active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px -6px rgba(176, 58, 46, .7);
}
html[data-theme="dark"] .filter-bar .sort-tabs a.active {
  color: #08131a;
  box-shadow: 0 4px 16px -6px rgba(56, 217, 240, .55);
}
.filter-bar .search-box {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.filter-bar .search-box input {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  width: 180px;
  background: var(--card);
  color: var(--ink);
  transition: border-color .2s, width .25s;
}
.filter-bar .search-box input::placeholder { color: var(--ink-3); }
.filter-bar .search-box input:focus { border-color: var(--brand); }

/* ---------------- 文章卡片 ---------------- */
.article-list { display: flex; flex-direction: column; gap: 12px; }

.article-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  transition: box-shadow .25s, transform .25s, border-color .25s;
  display: flex;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.article-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity .25s;
}
.article-card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-3px);
  border-color: var(--line-strong);
}
.article-card:hover::before { opacity: 1; }

.article-card .thumb {
  width: 116px; height: 116px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--paper-deep);
}
/* 无封面时的首字封面 */
.thumb-text {
  width: 116px; height: 116px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 700;
  color: var(--brand);
  background: var(--gradient-soft);
  border: 1px solid var(--line);
  user-select: none;
}

.article-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.article-card .title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.badge.article { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--line); }
.badge.book { background: var(--accent-soft); color: var(--accent); border-color: var(--line); }

.article-card .title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: .3px;
}
.article-card .title:hover { color: var(--brand); }

.cat-chip {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 10px;
}

.article-card .meta {
  font-size: 13.5px;
  color: var(--ink-3);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.article-card .meta > span { display: inline-flex; align-items: center; gap: 12px; }
.article-card .meta .author { gap: 6px; color: var(--ink-2); }
.article-card .meta .author a { color: inherit; }
.article-card .meta .author a:hover { color: var(--brand); }
.article-card .meta > span + span::before {
  content: '';
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}
.article-card .summary {
  font-size: 14px;
  color: var(--ink-2);
  margin: 9px 0 0;
  line-height: 1.72;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag-list span {
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
}

/* ---------------- 用户头像 & 署名 ---------------- */
.avatar {
  display: inline-block;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  overflow: hidden;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}
.avatar-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(140deg, hsl(var(--av-hue, 8) 44% 58%), hsl(var(--av-hue, 8) 50% 40%));
  user-select: none;
}
html[data-theme="dark"] .avatar-text {
  background: linear-gradient(140deg, hsl(var(--av-hue, 8) 42% 36%), hsl(var(--av-hue, 8) 46% 22%));
  color: #eaeef7;
}

/* 导航栏用户 */
.user-chip { display: inline-flex; align-items: center; gap: 7px; }
.user-chip:hover { color: var(--ink); }

/* 详情页作者条 */
.byline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.byline .avatar { border-color: var(--line-strong); }
.byline-av-link { display: inline-flex; flex-shrink: 0; border-radius: 50%; transition: transform .2s; }
.byline-av-link:hover { transform: translateY(-2px); }
.byline-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.byline-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .3px;
  width: fit-content;
}
.byline-name:hover { color: var(--brand); }
.byline-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-3);
}
.byline-sub span + span::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* 个人中心头部 */
.hero-me { display: flex; align-items: center; gap: 16px; }
.hero-me .avatar { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.hero-me .avatar-text { box-shadow: 0 6px 18px var(--glow-a); }

/* ---------------- 作者列表 / 作者主页 ---------------- */
.page-head {
  margin: 26px 0 20px;
  animation: riseIn .5s cubic-bezier(.22, .61, .36, 1) both;
}
.page-head h1 {
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}
.page-head p { font-size: 13.5px; color: var(--ink-2); }

.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(298px, 1fr));
  align-items: stretch;
  gap: 14px;
}
.author-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  height: 100%;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  animation: riseIn .5s cubic-bezier(.22, .61, .36, 1) both;
  transition: border-color .22s, transform .22s, box-shadow .22s;
}
.author-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}
.author-card .avatar { border-color: var(--line-strong); }
.author-card-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.author-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .3px;
  transition: color .2s;
}
.author-card:hover .author-card-name { color: var(--brand); }
.author-card-sign {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.62;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.author-card-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-3);
}
.author-card-stat span + span::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}
.author-card-empty { font-size: 13px; color: var(--ink-3); }

/* ---------------- 文章详情 ---------------- */
.article-detail {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 34px 40px 30px;
  margin-top: 26px;
  animation: riseIn .55s cubic-bezier(.22, .61, .36, 1) both;
}
.article-detail h1.title {
  font-family: var(--font-serif);
  font-size: 28px;
  line-height: 1.45;
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.article-detail .meta {
  font-size: 13.5px;
  color: var(--ink-3);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.article-detail .meta span { display: inline-flex; align-items: center; gap: 14px; }
.article-detail .meta span + span::before {
  content: '';
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}
.article-detail .content {
  font-size: 16px;
  line-height: 1.95;
  word-break: break-word;
  color: var(--ink);
}
.article-detail .content p { margin: 0 0 16px; }
.article-detail .content h2,
.article-detail .content h3 { margin: 28px 0 12px; letter-spacing: .5px; }
.article-detail .content h2 { font-size: 21px; }
.article-detail .content h3 { font-size: 18px; }
.article-detail .content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 8px 0; }
.article-detail .content a { border-bottom: 1px solid var(--brand); }
.article-detail .content blockquote {
  margin: 18px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--brand);
  background: var(--card-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
  font-family: var(--font-serif);
}
.article-detail .content pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 15px 17px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  margin: 16px 0;
}
.article-detail .content code { font-family: var(--font-mono); }
.article-detail .content :not(pre) > code {
  background: var(--paper-deep);
  color: var(--brand-deep);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 13.5px;
}
.article-detail .content table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.article-detail .content table th,
.article-detail .content table td { border: 1px solid var(--line); padding: 7px 12px; text-align: left; }
.article-detail .content table th { background: var(--card-soft); font-weight: 500; }
.article-detail .content ul,
.article-detail .content ol { margin: 0 0 16px 22px; }
.article-detail .content li { margin-bottom: 6px; }

.pager {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.pager a {
  flex: 1;
  padding: 11px 14px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all .2s;
}
.pager a:first-child { text-align: left; }
.pager a:last-child { text-align: right; }
.pager a:hover { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--line-strong); }

/* ---------------- 书籍目录 ---------------- */
.chapter-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.chapter-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14px;
  transition: all .2s;
}
.chapter-list a::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  opacity: .55;
}
.chapter-list a:hover {
  background: var(--brand-soft);
  color: var(--brand-deep);
  border-color: var(--line-strong);
  transform: translateX(3px);
}

/* ---------------- 表单 ---------------- */
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-1);
  padding: 34px 32px 28px;
  max-width: 430px;
  margin: 42px auto;
  animation: riseIn .5s cubic-bezier(.22, .61, .36, 1) both;
}
.form-card h2 {
  text-align: center;
  font-family: var(--font-serif);
  margin-bottom: 6px;
  font-size: 22px;
  letter-spacing: 1px;
}
.form-sub { font-size: 13px; color: var(--ink-3); margin: -2px 0 22px; letter-spacing: .3px; }
.form-card .form-sub { text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 7px;
  color: var(--ink-2);
  letter-spacing: .3px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--card-soft);
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--ink-3); }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--brand);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
/* ---------------- 图片上传组件（头像 / 封面） ---------------- */
.uploader { position: relative; width: fit-content; }
.uploader [hidden] { display: none !important; }

.form-group .uploader-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 0;
  background: var(--card-soft);
  border: 1px dashed var(--line-strong);
  transition: border-color .2s, background .2s;
}
.form-group .uploader-stage:hover { border-color: var(--brand); background: var(--brand-soft); }
.uploader-stage input[type="file"] { display: none; }

.uploader-round .uploader-stage { width: 96px; height: 96px; border-radius: 50%; }
.uploader-cover .uploader-stage { width: 240px; height: 150px; border-radius: var(--radius-sm); }

.uploader-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.uploader-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 12.5px;
  letter-spacing: .5px;
  font-weight: 400;
}
.uploader-empty svg { width: 22px; height: 22px; }
.uploader-round .uploader-empty { gap: 4px; font-size: 11px; }
.uploader-round .uploader-empty svg { width: 20px; height: 20px; }

.uploader-hover {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(28, 22, 16, .46);
  color: #fff;
  font-size: 12.5px;
  letter-spacing: 1px;
}
.uploader-stage:hover .uploader-hover,
.uploader-stage:focus-within .uploader-hover { display: flex; }
html[data-theme="dark"] .uploader-hover { background: rgba(6, 10, 16, .58); }

.uploader-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(28, 22, 16, .6);
}
.uploader.is-loading .uploader-loading { display: flex; }
.uploader.is-loading .uploader-hover { display: none; }
.uploader-loading i {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, .32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: uploaderSpin .7s linear infinite;
}
@keyframes uploaderSpin { to { transform: rotate(360deg); } }

.uploader-del {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  padding: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.uploader-del svg { width: 12px; height: 12px; }
.uploader-del:hover {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  transform: scale(1.08);
}
html[data-theme="dark"] .uploader-del:hover { color: #08131a; }

.form-group .code-row { display: flex; gap: 8px; }
.form-group .code-row input { flex: 1; }
.form-group .code-row .btn { flex-shrink: 0; padding: 0 16px; font-size: 13px; }

.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 1px;
  transition: opacity .18s, transform .1s, box-shadow .2s;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  width: 100%;
  font-weight: 500;
  box-shadow: 0 6px 18px -8px rgba(176, 58, 46, .8);
}
html[data-theme="dark"] .btn-primary {
  color: #08131a;
  box-shadow: 0 6px 18px -8px rgba(34, 211, 238, .8);
}
.btn-primary:hover { opacity: .93; }
.btn-ghost {
  background: var(--card-soft);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn-block { width: 100%; }
.form-tip { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 18px; }

/* ---------------- 发布 / 编辑 ---------------- */
.editor-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 30px 34px;
  max-width: 840px;
  margin: 26px auto;
  animation: riseIn .5s cubic-bezier(.22, .61, .36, 1) both;
}
.editor-card h2 { margin-bottom: 22px; font-size: 21px; letter-spacing: 1px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; min-width: 0; }
.form-group textarea.content-input {
  min-height: 420px;
  line-height: 1.75;
  font-size: 14.5px;
  font-family: var(--font-mono);
}

/* ---------------- 富文本编辑器（wangEditor v5） ---------------- */
.field-tip {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 8px;
  line-height: 1.7;
}

.editor-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
  transition: border-color .2s;
}
.editor-wrap:focus-within { border-color: var(--brand); }

/* 工具栏 */
.editor-wrap .w-e-toolbar {
  background: var(--card-soft) !important;
  border-bottom: 1px solid var(--line) !important;
  padding: 4px 6px !important;
}
.editor-wrap .w-e-bar { background: transparent !important; }
.editor-wrap .w-e-bar-item { padding: 1px !important; }
.editor-wrap .w-e-bar-item button {
  height: 30px !important;
  border-radius: 6px !important;
  color: var(--ink-2) !important;
  transition: background .16s, color .16s;
}
.editor-wrap .w-e-bar-item button:hover,
.editor-wrap .w-e-bar-item button.active {
  background: var(--brand-soft) !important;
  color: var(--brand-deep) !important;
}
.editor-wrap .w-e-bar-item button svg { fill: currentColor !important; width: 16px; height: 16px; }
.editor-wrap .w-e-bar-item button .title { font-size: 13px; }
.editor-wrap .w-e-bar-divider {
  background: var(--line) !important;
  height: 16px !important;
  margin: 0 4px !important;
}

/* 编辑区 */
.editor-wrap .w-e-text-container {
  background: var(--card) !important;
  color: var(--ink) !important;
}
.editor-wrap .w-e-text-container [data-slate-editor] {
  color: var(--ink) !important;
  padding: 18px 20px !important;
  min-height: 420px;
  font-size: 15px;
  line-height: 1.9;
}
.editor-wrap .w-e-text-placeholder {
  top: 18px !important;
  left: 20px !important;
  font-style: normal !important;
  font-size: 15px !important;
  color: var(--ink-3) !important;
}
.editor-wrap .w-e-text-container h1,
.editor-wrap .w-e-text-container h2,
.editor-wrap .w-e-text-container h3,
.editor-wrap .w-e-text-container h4,
.editor-wrap .w-e-text-container h5 { font-family: var(--font-serif); }
.editor-wrap .w-e-text-container blockquote {
  border-left: 3px solid var(--brand) !important;
  background: var(--card-soft) !important;
  color: var(--ink-2) !important;
  margin: 12px 0 !important;
}
/* 代码块：压掉 wangEditor 内层的浅色底，统一为深色底 + 浅色字（含语法高亮 token） */
.editor-wrap .w-e-text-container pre,
.editor-wrap .w-e-text-container pre * {
  background: var(--code-bg) !important;
  color: var(--code-fg) !important;
  border-color: transparent !important;
}
.editor-wrap .w-e-text-container pre {
  padding: 14px 16px !important;
  border-radius: var(--radius-sm) !important;
}
.editor-wrap .w-e-text-container code { font-family: var(--font-mono); }
/* 行内代码：与详情页阅读态保持一致 */
.editor-wrap .w-e-text-container :not(pre) > code {
  background: var(--paper-deep) !important;
  color: var(--brand-deep) !important;
  padding: 1px 6px !important;
  border-radius: 5px !important;
}
.editor-wrap .w-e-text-container img { max-width: 100%; }
.editor-wrap .w-e-text-container a { border-bottom: 1px solid var(--brand); }
.editor-wrap .w-e-text-container table th { background: var(--card-soft) !important; }
.editor-wrap .w-e-text-container table th,
.editor-wrap .w-e-text-container table td { border-color: var(--line) !important; }

/* 底部字数统计 */
.editor-status {
  border-top: 1px solid var(--line);
  background: var(--card-soft);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
}

/* 下拉面板 / 选择器 / 弹窗（部分挂到 body 下，故不加 .editor-wrap 前缀） */
.w-e-drop-panel, .w-e-select-list {
  background: var(--card) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-2) !important;
}
.w-e-select-list .w-e-select-list-item { color: var(--ink) !important; }
.w-e-select-list .w-e-select-list-item:hover { background: var(--brand-soft) !important; }
.w-e-drop-panel .w-e-panel-content-color .w-e-color-item { border-color: var(--line) !important; }
.w-e-modal {
  background: var(--card) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-2) !important;
}
.w-e-modal input, .w-e-modal textarea {
  background: var(--card) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
}
.w-e-modal .w-e-button-container button {
  background: var(--brand) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
}
html[data-theme="dark"] .w-e-modal .w-e-button-container button { color: #08131a !important; }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--ink-3);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
}
.empty a { font-weight: 500; border-bottom: 1px solid var(--brand); }

/* ---------------- 分页 ---------------- */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; align-items: center; }
.pagination a, .pagination span {
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  font-size: 13.5px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-2);
  transition: all .2s;
}
.pagination a:hover { border-color: var(--brand); color: var(--brand-deep); }
.pagination .current { background: var(--gradient); color: #fff; border-color: transparent; }
html[data-theme="dark"] .pagination .current { color: #08131a; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding: 26px 18px 32px;
  font-size: 13px;
  color: var(--ink-3);
}
.site-footer .foot-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.site-footer .foot-links { display: flex; gap: 16px; }
.site-footer .foot-links a { color: var(--ink-3); font-size: 13px; }
.site-footer .foot-links a:hover { color: var(--brand); }
.site-footer .foot-motto { font-family: var(--font-serif); letter-spacing: 1px; }
.site-footer .foot-legal {
  max-width: 1000px;
  margin: 16px auto 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}
.site-footer .foot-icp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--ink-3);
  letter-spacing: .3px;
}
.site-footer .foot-icp .icp-badge {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: .82;
  transition: opacity .18s;
}
.site-footer .foot-icp:hover { color: var(--brand); }
.site-footer .foot-icp:hover .icp-badge { opacity: 1; }

/* ---------------- 轻提示 ---------------- */
.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translate(-50%, -18px);
  background: rgba(32, 27, 21, .94);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: .3s;
  pointer-events: none;
  box-shadow: var(--shadow-2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: linear-gradient(135deg, #4a6b5a, #3c5749); }
.toast.error { background: linear-gradient(135deg, #b03a2e, #8f2c22); }

/* ---------------- 动效 ---------------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.reveal-init { opacity: 0; transform: translateY(14px); }
.reveal-in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s cubic-bezier(.22, .61, .36, 1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-init { opacity: 1; transform: none; }
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 720px) {
  .site-header .container { height: 56px; gap: 10px; padding: 0 14px; }
  .logo { font-size: 16px; letter-spacing: 0; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 5px 10px; font-size: 13px; }
  .site-nav a.active::after { display: none; }
  .user-nav { gap: 4px; }
  .user-nav a { padding: 4px 9px; font-size: 12.5px; }
  .theme-toggle { width: 30px; height: 30px; }
  .theme-toggle svg { width: 14px; height: 14px; }
  .back-btn { width: 30px; padding: 0; justify-content: center; }
  .back-btn span { display: none; }
  .back-btn:hover { transform: none; }

  .page-head { margin: 20px 0 16px; }
  .page-head h1 { font-size: 22px; letter-spacing: 1px; }
  .author-grid { grid-template-columns: 1fr; gap: 12px; }
  .author-card { padding: 16px; gap: 12px; }

  .hero { padding: 28px 20px 24px; margin: 18px 0 22px; border-radius: 16px; }
  .hero-title { font-size: 28px; letter-spacing: 1px; }
  .hero-sub { font-size: 14px; margin-bottom: 18px; }
  .hero-stat { padding: 8px 13px; min-width: 74px; }
  .hero-stat b { font-size: 18px; }

  .filter-bar .search-box { margin-left: 0; width: 100%; }
  .filter-bar .search-box input { width: 100%; }

  .article-card { padding: 14px; gap: 12px; }
  .article-card .thumb, .thumb-text { width: 78px; height: 78px; }
  .thumb-text { font-size: 28px; }
  .article-card .title { font-size: 15.5px; }
  .article-card .summary { -webkit-line-clamp: 2; }
  .cat-chip { display: none; }

  .article-detail { padding: 22px 18px 20px; border-radius: 12px; }
  .article-detail h1.title { font-size: 22px; letter-spacing: .5px; }
  .article-detail .content { font-size: 15.5px; line-height: 1.9; }

  .form-card, .editor-card { padding: 24px 18px; margin: 20px 0; border-radius: 14px; }
  .form-row { flex-direction: column; gap: 0; }
  .pager { flex-direction: column; }
  .pager a + a { text-align: left; }
  .site-footer .foot-inner { flex-direction: column; text-align: center; gap: 8px; }
}
