/* ==========================================================================
   版式参考：yinwang.org（王垠博客）
   设计要点：灰底 + 白卡、18px/1.78 正文、860px 阅读宽度、琥珀棕主题色、
             H2 用主题色、目录左侧吸顶、标签胶囊
   ========================================================================== */

:root {
  /* 琥珀棕主题色阶（对应原站 --theme-*） */
  --theme-50:  252 249 242;
  --theme-100: 247 240 223;
  --theme-200: 239 227 195;
  --theme-300: 228 207 154;
  --theme-400: 218 181 128;
  --theme-500: 212 165 116;
  --theme-600: 189 142 93;
  --theme-700: 165 118 71;
  --theme-800: 139 93 50;
  --theme-900: 111 70 32;

  --bg:        #f9fafb;   /* gray-50：冷灰底，卡片靠它衬托 */
  --card:      #ffffff;
  --fg:        #111827;
  --fg-body:   #374151;
  --muted:     #6b7280;
  --border:    #e5e7eb;   /* gray-200 */
  --border-theme: rgb(var(--theme-200));  /* 顶栏/页脚用主题色描边 */
  --link:      rgb(var(--theme-800));
  --link-hover:rgb(var(--theme-900));
  --heading-accent: rgb(var(--theme-800));
  --tag-bg:    rgb(var(--theme-100));
  --tag-fg:    rgb(var(--theme-900));
  --code-bg:   #0d1117;
  --code-fg:   #e6edf3;
  --inline-code-bg: rgb(0 0 0 / 0.055);
  --inline-code-fg: rgb(var(--theme-800));
  --shadow:    0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px -8px rgb(111 70 32 / 0.12);

  --measure:   860px;   /* 正文阅读宽度（≈47 汉字/行，且让宽表格能排下） */
  --card-pad-x: 32px;   /* 卡片内边距；表格外扩量与之绑定 */
  --toc-width: 200px;
  --radius:    8px;

  /* 字体：完全沿用 yinwang.org —— 纯系统字体，不加载任何 webfont */
  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
               "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  --font-ui:   var(--font-sans);
  --font-body: var(--font-sans);
}

html.dark {
  --bg:        #111827;
  --card:      #1f2937;   /* gray-800 */
  --fg:        #f3f4f6;
  --fg-body:   #d1d5db;
  --muted:     #9ca3af;
  --border:    rgb(255 255 255 / 0.09);
  --link:      rgb(var(--theme-400));
  --link-hover:rgb(var(--theme-300));
  --heading-accent: rgb(var(--theme-400));
  --tag-bg:    rgb(var(--theme-900) / 0.45);
  --tag-fg:    rgb(var(--theme-300));
  --inline-code-bg: rgb(255 255 255 / 0.09);
  --inline-code-fg: rgb(var(--theme-300));
  --shadow:    0 1px 2px rgb(0 0 0 / 0.3), 0 4px 20px -10px rgb(0 0 0 / 0.5);
}

* { box-sizing: border-box; }

/* hidden 属性必须压过组件自身的 display，否则两者会同时显示 */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg-body);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-autospace: normal;
}

/* ---------------------------------------------------------------- 顶部导航 */

.site-nav {
  background: var(--card);
  border-bottom: 1px solid var(--border-theme);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
}

.site-nav-inner {
  /* 通栏：内容左右只留 12px，与 yinwang 一致；不做居中限宽 */
  padding: 0 12px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-title {
  font-size: 24px;
  line-height: 1.33;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-title:hover { color: var(--link); }

.nav-links {
  display: flex;
  gap: 24px;
  font-size: 16px;
  font-weight: 500;
}

.nav-links a {
  color: var(--fg);
  text-decoration: none;
}

.nav-links a:hover { color: var(--link); }
.nav-links a.is-active { color: rgb(var(--theme-600)); font-weight: 600; }
html.dark .nav-links a.is-active { color: rgb(var(--theme-400)); }

/* 右侧工具区：推到最右，规格对齐 yinwang（36×36 / 内边距 8px / 圆角 8px / 间距 4px） */
.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.nav-icon:hover {
  background: #f3f4f6;
  color: var(--fg);
  text-decoration: none;
}
.nav-icon svg { width: 20px; height: 20px; }
html.dark .nav-icon:hover { background: rgb(255 255 255 / .08); }

.theme-toggle {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 36px;
  padding: 0 12px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.theme-toggle:hover { color: var(--link); border-color: var(--link); }

/* ------------------------------------------------------------------ 布局 */

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 72px;
}

.layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.layout-main { flex: 1; min-width: 0; max-width: calc(var(--measure) + 2 * var(--card-pad-x)); }

/* ------------------------------------------------------------------ 卡片 */

.card {
  background: var(--card);
  border: 0;
  border-radius: 8px;   /* yinwang：rounded-lg */
  box-shadow: none;     /* 无边框无阴影，靠灰底衬托 */
}

/* -------------------------------------------------------------- 首页列表 */

.page-title {
  font-size: 36px;
  line-height: 1.11;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.page-intro {
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 32px;
}

.post-list { list-style: none; margin: 0; padding: 0; }

.post-item { margin-bottom: 40px; }

.post-item-title {
  font-size: 24px;
  line-height: 1.33;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  display: inline-block;
}

.post-item-title:hover { color: var(--link); }

.post-item-desc {
  color: var(--muted);
  font-size: 16px;
  margin: 8px 0 10px;
}

.post-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 标签 */

.tag {
  display: inline-block;
  padding: 4px 12px;
  transition: background-color .15s cubic-bezier(.4, 0, .2, 1);
  border-radius: 9999px;
  background: var(--tag-bg);
  color: var(--tag-fg);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
}

/* ------------------------------------------------------------- 文章正文 */

.article-head { margin-bottom: 24px; }

.article-title {
  font-family: var(--font-body);
  font-size: 36px;
  line-height: 1.11;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-meta .tag-row {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 迁移文章的文末原文出处 */
.article-foot {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.article-foot p { margin: 0; }

.article-foot a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

.article-foot a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

.prose {
  /* 段落用子元素限宽；表格由独立容器负责滚动，不撑破正文。 */
  max-width: none;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.78;
  color: var(--fg-body);
}

.prose > * { max-width: var(--measure); }

/* 表格与代码块保持与段落对齐，超宽内容仅在组件内部滚动。 */
.prose > pre { max-width: 100%; }

.prose p { margin: 24px 0; }

.prose a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.prose a:hover { color: var(--link-hover); text-decoration: underline; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--fg);
  line-height: 1.33;
  scroll-margin-top: 80px;
  /* 标题与正文使用统一系统字体。 */
  font-family: var(--font-body);
}

.prose h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--heading-accent);
  margin: 48px 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 14px;
}

.prose h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
}

.prose strong { color: var(--fg); font-weight: 600; }

.prose ul, .prose ol { margin: 24px 0; padding-left: 1.6em; }

.prose li { margin: 8px 0; }

.prose li > p { margin: 12px 0; }

.prose blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid rgb(var(--theme-300));
  color: var(--muted);
}

.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* 代码：浅色模式下也用深底，与原站一致 */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--inline-code-bg);
  color: var(--inline-code-fg);
  font-weight: 600;
}

.prose pre {
  margin: 28px 0;
  padding: 18px 20px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-fg);
  overflow-x: auto;
  font-size: 0.875em;
  line-height: 1.7;
}

.prose pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-weight: 400;
  font-size: inherit;
}

.prose table {
  border-collapse: collapse;
  box-sizing: border-box;
  line-height: 1.7;
  display: block;
  overflow-x: auto;
}

/* 单元格内允许长串在必要时断行，否则 viking://user/... 这类长路径
   会把表格最小宽度撑到 780px 以上，逼出横向滚动条。
   用 anywhere 而非 break-word：只有 anywhere 会影响 min-content 计算。 */
.prose table th,
.prose table td { overflow-wrap: anywhere; }
.prose table code { overflow-wrap: anywhere; }

.prose table thead { border-bottom: 1px solid var(--border); }

.prose table th {
  color: var(--fg);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px 10px 0;
  white-space: nowrap;
}

.prose table td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.prose img { max-width: 100%; height: auto; margin: 28px 0; border-radius: 6px; }

/* ------------------------------------------------------------ 目录侧栏 */

.toc {
  font-family: var(--font-body);
  width: var(--toc-width);
  flex-shrink: 0;
  position: sticky;
  top: 88px;
  padding: 18px 20px;
  font-size: 14px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 10px;
}

.toc ul { list-style: none; margin: 0; padding: 0; }

.toc li { margin: 7px 0; line-height: 1.5; }

.toc a {
  color: var(--muted);
  text-decoration: none;
  display: block;
}

.toc a:hover { color: var(--link); }

.toc a.active { color: var(--link); font-weight: 600; }

.toc .toc-l3 a { padding-left: 14px; font-size: 13px; }

/* ------------------------------------------------------------------ 页脚 */

.site-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--link); }

/* ------------------------------------------------------------ 响应式 */

/* 低于此宽度收起目录，把横向空间让给正文与表格
   （卡片 924 + 目录 200 + 间距 32 + 页面内边距 48 ≈ 1204） */
@media (max-width: 1200px) {
  .toc { display: none; }
}

/* 字号缩小单独一档，别和上面的断点绑在一起 */
@media (max-width: 900px) {
  .article-title, .page-title { font-size: 28px; }
  .prose { font-size: 17px; }
  .prose h2 { font-size: 21px; }
}

@media (max-width: 600px) {
  .wrap { padding: 20px 16px 56px; }
  .site-nav-inner { padding: 0 12px; gap: 16px; }
  .site-title { font-size: 18px; }
  .nav-links { gap: 14px; font-size: 14px; }
  .article-title, .page-title { font-size: 24px; }
  .post-item-title { font-size: 20px; }
  .prose { font-size: 16px; line-height: 1.75; }
  .prose p { margin: 20px 0; }
  .article-meta .tag-row { margin-left: 0; width: 100%; }
}

/* -------------------------------------------------- 代码高亮（Rouge 映射到 github-dark） */

.highlight .c, .highlight .cm, .highlight .c1 { color: #8b949e; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kc, .highlight .kr { color: #ff7b72; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc { color: #a5d6ff; }
.highlight .mi, .highlight .mf, .highlight .m { color: #79c0ff; }
.highlight .nf, .highlight .fm { color: #d2a8ff; }
.highlight .nx, .highlight .nb { color: #ffa657; }
.highlight .o, .highlight .ow { color: #ff7b72; }
.highlight .nt { color: #7ee787; }
.highlight .err { color: inherit; background: none; }

/* 文章卡片内边距 */
.article-card { padding: 32px var(--card-pad-x); }

@media (max-width: 600px) {
  :root { --card-pad-x: 18px; }
  .article-card { padding: 24px var(--card-pad-x) 32px; }
}

/* ------------------------------------------------- 首页：列表页（对齐 yinwang） */

/* 容器 1120px = 主栏 776 + 间距 24 + 侧栏 320 */
/* 首页整体容器：标题、简介、标签页、列表共用同一条左边缘 */
.list-page {
  max-width: 1120px;
  margin: 0 auto;
}

.list-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.list-main { flex: 1; min-width: 0; }
.list-side { width: 320px; flex-shrink: 0; }

/* 标签页：激活项 2px 主题色下划线 */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-theme);
  margin-bottom: 24px;
}
.tab {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: #374151; }
.tab.is-active {
  color: rgb(var(--theme-600));
  border-bottom-color: rgb(var(--theme-600));
  font-weight: 600;
}

/* 文章卡：白底 + 主题色描边 + 16px 圆角 + 24px 内边距 */
.post-list { display: flex; flex-direction: column; gap: 20px; }
.post-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border-theme);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  /* yinwang：transition-all duration-300 + cubic-bezier(.4,0,.2,1) */
  transition: box-shadow .3s cubic-bezier(.4, 0, .2, 1),
              border-color .3s cubic-bezier(.4, 0, .2, 1);
}
.post-card:hover {
  border-color: rgb(var(--theme-400));
  /* Tailwind shadow-xl */
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);
}
html.dark .post-card:hover { border-color: rgb(var(--theme-600)); }

.post-card-title { font-size: 24px; font-weight: 700; line-height: 1.33; margin: 0 0 12px; }
.post-card-title a {
  color: var(--fg);
  text-decoration: none;
  transition: color .3s cubic-bezier(.4, 0, .2, 1);
}
/* group-hover：悬停整张卡就变标题色，不是只悬停标题 */
.post-card:hover .post-card-title a { color: rgb(var(--theme-700)); }
html.dark .post-card:hover .post-card-title a { color: rgb(var(--theme-400)); }

/* 整张卡可点：用标题链接的伪元素铺满卡片；
   底行抬到上层，保证标签仍然可点。 */
.post-card-title a::after { content: ''; position: absolute; inset: 0; }
.post-card-foot { position: relative; z-index: 1; }

.post-card-desc {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.625;
  margin: 0 0 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;      /* 描述最多 3 行，超出省略 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.post-card-date { font-size: 14px; color: var(--muted); }

/* 侧栏卡片 */
.side-card {
  background: var(--card);
  border: 1px solid var(--border-theme);
  border-radius: 12px;
  padding: 24px;
}
.side-card + .side-card { margin-top: 20px; }
.side-title { font-size: 17px; font-weight: 700; margin: 0 0 14px; }

.filter-select {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--fg-body);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  width: 100%;
  cursor: pointer;
}
.filter-select:hover { border-color: var(--link); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

/* 按分类浏览时的分组标题 */
.tag-group { margin-bottom: 28px; }
.tag-group-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-theme);
}

.tag-btn {
  font-family: var(--font-ui);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
a.tag:hover { background: rgb(var(--theme-200)); }
html.dark a.tag:hover { background: #4b5563; }   /* gray-600 */

.tag-btn:hover { background: rgb(var(--theme-200)); color: rgb(var(--theme-900)); }
.tag-btn.active { background: rgb(var(--theme-600)); color: #fff; border-color: rgb(var(--theme-600)); }
html.dark .tag-btn:hover { background: rgb(var(--theme-800)); color: rgb(var(--theme-100)); }
html.dark .tag-btn.active { background: rgb(var(--theme-400)); color: #1f2937; border-color: rgb(var(--theme-400)); }

.filter-empty { color: var(--muted); font-size: 15px; padding: 12px 0; }

@media (max-width: 1000px) {
  .list-layout { flex-direction: column-reverse; }
  .list-side { width: 100%; }
  .side-card + .side-card { margin-top: 16px; }
}
@media (max-width: 600px) {
  .post-card { padding: 18px; border-radius: 12px; }
  .post-card-title { font-size: 20px; }
  .side-card { padding: 18px; }
}

/* ------------------------------------------- 首页「按分类浏览」：分类卡片网格 */

/* 分类视图下侧栏隐藏，网格占满容器（与 yinwang 一致） */
.list-layout.is-cat-view .list-side { display: none; }
.list-layout.is-cat-view .list-main { flex: 1 1 100%; max-width: 100%; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border-theme);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: box-shadow .3s cubic-bezier(.4, 0, .2, 1),
              border-color .3s cubic-bezier(.4, 0, .2, 1);
}
.cat-card:hover {
  border-color: rgb(var(--theme-400));
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);
}
html.dark .cat-card:hover { border-color: rgb(var(--theme-600)); }

.cat-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }

.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgb(var(--theme-100));
  color: rgb(var(--theme-700));
}
.cat-icon svg { width: 26px; height: 26px; }
html.dark .cat-icon { background: rgb(var(--theme-900) / .5); color: rgb(var(--theme-300)); }

.cat-count { font-size: 14px; color: var(--muted); }

.cat-name { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 0 0 10px; color: var(--fg); }
.cat-card:hover .cat-name { color: rgb(var(--theme-700)); }
html.dark .cat-card:hover .cat-name { color: rgb(var(--theme-400)); }

.cat-desc { font-size: 15px; line-height: 1.6; color: var(--muted); margin: 0 0 16px; }

.cat-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.cat-tag {
  font-size: 13px;
  padding: 4px 11px;
  border-radius: 9999px;
  background: rgb(var(--theme-100));
  color: rgb(var(--theme-900));
  text-decoration: none;
  transition: background-color .15s cubic-bezier(.4, 0, .2, 1);
}
.cat-tag:hover { background: rgb(var(--theme-200)); text-decoration: none; }
html.dark .cat-tag { background: rgb(var(--theme-900) / .5); color: rgb(var(--theme-300)); }
html.dark .cat-tag:hover { background: rgb(var(--theme-800)); }

.cat-recent {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-theme);
}
.cat-recent-label { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.cat-recent-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-body);
  text-decoration: none;
  padding: 3px 0;
}
.cat-recent-item:hover { color: var(--link); text-decoration: none; }
.cat-recent-item time { flex-shrink: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.cat-recent-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1000px) { .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .cat-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; } .cat-card { padding: 18px; } }

/* ------------------------------------------------------------ 评论区 */

.comments {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-theme);
}

.comments-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 20px;
}

.comments-tip { color: var(--muted); font-size: 15px; }

/* giscus 未加载 / 加载中时给一个占位，避免布局跳动 */
.giscus { min-height: 120px; }
.giscus:empty::after {
  content: '评论加载中…';
  display: block;
  color: var(--muted);
  font-size: 15px;
}

/* 独立表格滚动：无脚本时 display:block 仍能兜底。 */
.prose table { width: 100%; max-width: 100%; font-size: max(14px, .84em); }
.prose table.table-wide { display: block; }
.prose table.table-wide > thead, .prose table.table-wide > tbody { min-width: 640px; display: table-row-group; }
.prose table.table-wide > thead { display: table-header-group; }
.prose table.table-wide th, .prose table.table-wide td { min-width: 120px; }
.table-scroll { max-width: 100%; overflow-x: auto; margin: 24px 0; }
.table-scroll table { display: table; max-width: none; overflow: visible; }
.table-scroll table.table-wide { display: table; min-width: 640px; }
.prose .table-scroll-hint { font-size: 14px; color: var(--muted); margin: 18px 0 -12px; }
.toc-inline { display: none; margin-bottom: 24px; border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; }
.toc-inline summary { cursor: pointer; color: var(--fg); font-weight: 600; min-height: 24px; }
.toc-inline ul { list-style: none; padding: 8px 0 0; margin: 0; }
.toc-inline a { display: block; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 14px; }
.toc-inline a.active { color: var(--link); font-weight: 600; }
@media (max-width: 1200px) { .toc-inline { display: block; } }

/* 内容优先：筛选按需展开，不占据窄屏首屏。 */
:where(a, button, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 4px;
}
.side-title { display: block; }
.filter-toggle, .cloud-toggle, .filter-status button {
  font: inherit;
  color: var(--link);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}
.filter-toggle { display: none; }
.cloud-toggle { margin-top: 16px; width: 100%; }
.filter-status { margin-top: 12px; font-size: 14px; }
.filter-status button { margin-left: 8px; padding: 4px 8px; }
.tag-btn.active { background: rgb(var(--theme-800)); border-color: rgb(var(--theme-800)); }
html.dark .tag-btn.active { background: rgb(var(--theme-400)); color: #1f2937; border-color: rgb(var(--theme-400)); }
.nav-links a.is-active, .tab.is-active { color: var(--link); }
.tab:hover { color: var(--fg); }
.prose { overflow-wrap: anywhere; }
.prose pre { overflow-wrap: normal; }
.prose a { text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
.cat-card { cursor: default; }
.cat-recent { margin-top: 0; margin-bottom: 18px; }
.cat-tags { margin-bottom: 0; }
.cat-more { margin-top: 10px; font-size: 14px; color: var(--muted); }
.cat-more summary { cursor: pointer; padding: 6px 0; }
.cat-more .cat-tags { margin-top: 8px; }

@media (max-width: 1000px) {
  .filters-ready { position: relative; }
  .list-main { width: 100%; }
  .post-card-title, .post-card-desc { overflow-wrap: anywhere; }
  .filters-ready .list-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
  }
  .filters-ready .side-card { padding: 0; border: 0; background: none; }
  .filters-ready .side-card + .side-card { margin: 0; }
  .filters-ready .sort-card .side-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .filters-ready .tags-card .side-title, .filters-ready .cloud-toggle { display: none; }
  .filters-ready .filter-toggle { display: block; width: 100%; min-height: 44px; }
  .filters-ready .filter-select { min-height: 44px; }
  .filters-ready .tag-cloud {
    margin-top: 12px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
  }
  .filters-ready .tag-cloud { width: calc(200% + 12px); margin-left: calc(-100% - 12px); }
  .filters-ready .filter-status { grid-column: 1 / -1; margin: 0; }
}
@media (max-width: 360px) {
  .nav-links { display: none; }
  .nav-actions { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
