/* ============================================================
   KKDays v2 — 二次元清新风格
   柔和渐变 / 大图封面 / 圆润卡片 / 亮暗双主题
   ============================================================ */

:root {
  --background: #f8f6f4;
  --foreground: #2d2d3a;
  --card: #ffffff;
  --card-foreground: #2d2d3a;
  --primary: #e8758a;
  --primary-foreground: #fff;
  --secondary: #f3eff1;
  --muted: #f3eff1;
  --muted-foreground: #8a8a9a;
  --border: #e8e4e0;
  --radius: 16px;

  --pink-a: #f4a0b5;
  --pink-b: #e8758a;
  --shoka-pink: #f18bb3;
  --grad-pink: linear-gradient(135deg, #f4a0b5 0%, #e8758a 50%, #d46b82 100%);
  --grad-soft: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 50%, #f48fb1 100%);
  --grad-button: linear-gradient(135deg, #f4a0b5 0%, #e8758a 100%);

  --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.04), 0 1px 4px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 12px 40px rgba(232, 117, 138, 0.15), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-btn: 0 4px 20px rgba(232, 117, 138, 0.3);
  --shadow-sider: 0 2px 16px rgba(0, 0, 0, 0.03);

  --ff-round: "寒蝉全圆体", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", system-ui, sans-serif;
  --ff-round-bold: "寒蝉全圆体 Bold", "寒蝉全圆体", "Noto Sans SC", -apple-system,
    BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  --header-h: 64px;
  --max-w: 1100px;
  --side-w: 268px;

  /* ── 视觉 v2（首页 D）新增令牌 ── */
  --p50: #fdf3f5; --p100: #fbdfe5; --p400: #ee9bac; --p600: #e8758a; --p800: #c05268;
  --sh: 0 1px 2px rgba(70, 45, 52, .04), 0 10px 28px -12px rgba(70, 45, 52, .12);
  --sh-hi: 0 2px 4px rgba(70, 45, 52, .05), 0 20px 44px -16px rgba(70, 45, 52, .18);
  --ins: inset 0 1px 0 rgba(255, 255, 255, .8);
  --fm: "JetBrains Mono", Consolas, Monaco, monospace;
  --noise-op: .035;
  --noise-blend: multiply;
}

[data-theme="dark"] {
  --background: #16171d;
  --foreground: #e8e6f0;
  --card: #1e1f28;
  --card-foreground: #e8e6f0;
  --primary: #f4a0b5;
  --primary-foreground: #16171d;
  --secondary: #252630;
  --muted: #252630;
  --muted-foreground: #8a8a9a;
  --border: #2e2f3a;

  --grad-pink: linear-gradient(135deg, #f4a0b5 0%, #e8758a 50%, #d46b82 100%);
  --grad-soft: linear-gradient(135deg, #2a1f24 0%, #2e2228 50%, #332530 100%);

  --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 12px 40px rgba(232, 117, 138, 0.12), 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-sider: 0 2px 16px rgba(0, 0, 0, 0.2);

  /* ── 视觉 v2（首页 D）新增令牌 · 暗色 ── */
  --p50: #2a1f26; --p100: #3a2530; --p400: #ee9bac; --p600: #f08ca0; --p800: #f4a0b5;
  --sh: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -14px rgba(0, 0, 0, .5);
  --sh-hi: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 50px -18px rgba(0, 0, 0, .6);
  --ins: inset 0 1px 0 rgba(255, 255, 255, .05);
  --noise-op: .05;
  --noise-blend: overlay;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  font-family: var(--ff-round);
  font-size: 15px;
  line-height: 1.75;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

b, strong, h1, h2, h3, h4, h5, th, .ico { font-family: var(--ff-round-bold); font-weight: 700; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

.ico { flex: 0 0 auto; vertical-align: -0.15em; }

/* ── 滚动进度条 ─────────────────────────────────────── */
.scroll-progress {
  position: fixed; inset: 0 auto auto 0; height: 3px; width: 100%;
  background: var(--grad-pink); transform: scaleX(0); transform-origin: 0 50%;
  opacity: 0; transition: opacity .3s ease;
  z-index: 100; pointer-events: none;
}
.scroll-progress.on { opacity: .9; }

/* ── 顶栏 ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.header-inner {
  max-width: var(--max-w); margin: 0 auto; height: var(--header-h);
  display: flex; align-items: center; gap: 18px; padding: 0 24px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border); background: var(--muted);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 15px; letter-spacing: .02em; }
.brand-text i { font-style: normal; font-size: 11px; color: var(--muted-foreground); letter-spacing: .06em; }

.nav-tabs { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 10px;
  font-size: 14px; letter-spacing: .04em; color: var(--muted-foreground);
  transition: color .2s ease; white-space: nowrap;
}
.tab:hover { color: var(--p600); }
.tab.active { color: var(--p600); font-family: var(--ff-round-bold); }

.header-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  color: var(--muted-foreground); background: var(--card);
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
  transition: all .25s ease;
}
.icon-btn:hover { color: var(--p600); transform: translateY(-1px); }
#themeToggle .ico { position: absolute; transition: all .3s ease; }
#themeToggle { position: relative; }
#themeToggle .ico:last-child { opacity: 0; transform: rotate(-90deg) scale(.6); }
[data-theme="dark"] #themeToggle .ico:first-child { opacity: 0; transform: rotate(90deg) scale(.6); }
[data-theme="dark"] #themeToggle .ico:last-child { opacity: 1; transform: none; }

/* ── 装饰层（噪点 + 两处光晕 + 渐隐过渡）────────────── */
.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: var(--noise-op); mix-blend-mode: var(--noise-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}
.glow-a {
  position: absolute; top: -120px; left: 0; right: 0; height: 560px;
  pointer-events: none; z-index: 0;
  background: radial-gradient(900px 380px at 70% -5%, rgba(232, 117, 138, .16), rgba(232, 117, 138, 0) 70%);
}
.glow-b {
  position: absolute; top: 0; left: 0; width: 100%; height: 420px;
  pointer-events: none; z-index: 0;
  background: radial-gradient(600px 300px at 10% 8%, rgba(124, 158, 245, .10), transparent 70%);
}
.fade-into {
  height: 60px; margin-top: -60px; position: relative; z-index: 2;
  background: linear-gradient(180deg, rgba(248, 246, 244, 0), var(--background));
}
[data-theme="dark"] .fade-into {
  background: linear-gradient(180deg, rgba(22, 23, 29, 0), var(--background));
}

/* ── 英雄区 · 大图 banner ─────────────────────────── */
.hero {
  position: relative; overflow: hidden; height: 380px;
  background-color: #f0e7ea;
  background-image: var(--lq, linear-gradient(135deg, #f2e7e9, #e7ecf7));
  background-size: cover; background-position: center;
}
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  opacity: 0; transition: opacity .6s ease;
}
.hero-img.on { opacity: 1; }
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(30, 24, 28, .10) 0%, rgba(30, 24, 28, .15) 45%, rgba(30, 24, 28, .62) 100%);
}
.hero-inner {
  position: absolute; left: 0; right: 0; bottom: 44px;
  max-width: var(--max-w); margin: 0 auto; padding: 0 24px; color: #fff;
}
.hero-inner h1 {
  margin: 0; font-size: 36px; line-height: 46px;
  letter-spacing: .5px; text-shadow: 0 2px 18px rgba(30, 24, 28, .45);
}
.hero-sub {
  margin: 10px 0 0; font-size: 16px; line-height: 26px; letter-spacing: 2px;
  color: rgba(255, 255, 255, .9);
}
.hero-stats {
  margin: 16px 0 0; display: flex; gap: 26px; flex-wrap: wrap;
  font-size: 12.5px; color: rgba(255, 255, 255, .82); font-family: var(--fm);
}
.hero-stats b { font-family: var(--ff-round-bold); font-size: 17px; color: #fff; margin-right: 5px; }

/* ── 布局 ─────────────────────────────────────────── */
.layout {
  max-width: var(--max-w); margin: 0 auto; padding: 8px 24px 60px;
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr; gap: 28px; align-items: start;
}
.layout.home {
  grid-template-columns: minmax(0, 1fr) var(--side-w);
}
.layout:not(.home) .sider { display: none; }
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 24px; }

.panel {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 8px 24px 24px;
}

/* ── 工具条（搜索框，直接输入跳转搜索结果）─────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 2px; flex-wrap: wrap; }
.searchbox {
  flex: 1 1 auto; min-width: 0; height: 46px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  color: var(--muted-foreground); font-size: 15px; text-align: left;
  box-shadow: var(--shadow-card), var(--ins);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.searchbox:focus-within { border-color: var(--p400); box-shadow: var(--shadow-card), 0 0 0 3px color-mix(in srgb, var(--p400) 15%, transparent); }
.searchbox input {
  flex: 1 1 auto; border: none; outline: none; background: none;
  font-size: 15px; color: var(--foreground); min-width: 0;
}
.searchbox input::placeholder { color: var(--muted-foreground); }

/* ── 标题 ─────────────────────────────────────────── */
.sec-title { display: flex; align-items: baseline; gap: 14px; margin: 24px 0 20px; }
.sec-title .rule { display: none; }
.sec-title h2 {
  margin: 0; font-size: 23px; line-height: 34px; letter-spacing: .4px;
  color: var(--foreground); white-space: nowrap;
}
.sec-title h2::after {
  content: ""; display: block; width: 60px; height: 6px; margin-top: 8px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='6'><path d='M0 4 Q7.5 0 15 4 T30 4 T45 4 T60 4' fill='none' stroke='%23E8758A' stroke-width='2' stroke-linecap='round'/></svg>") no-repeat;
}
.sec-sub { margin: 0; color: var(--muted-foreground); font-size: 14px; }

/* ── 分类大卡：/categories 专用 ────────────────────── */
/* 命名边界（勿混用）：
     .chip     → 仅「分类总览页配图大卡」，只在 .category-chips 内出现
     .post-cat → 卡片元信息行的分类药丸
     .tag      → 标签药丸
   曾有一条全局裸 .chip 药丸规则，因 .chip 不再有第二个使用者而成为死代码，
   且它声明的 border:1px solid var(--p400) 未被 .category-chips .chip 覆盖，
   会向大卡泄漏粉色描边。已删除，并在下方显式 border:0 兜底。 */
.category-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.category-chips .chip {
  position: relative; height: 100px; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 14px 18px;
  color: #fff; background-size: cover; background-position: center;
  border: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  transition: transform .3s ease, box-shadow .3s ease;
}
.category-chips .chip::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 20%, rgba(0,0,0,.45) 100%);
  pointer-events: none;
}
.category-chips .chip:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0, 0, 0, .22); }
.category-chips .chip-name, .category-chips .chip-count { position: relative; z-index: 1; }
.category-chips .chip-name { font-family: var(--ff-round-bold); font-size: 16px; letter-spacing: .08em; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.category-chips .chip-count { font-size: 11px; opacity: .9; text-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ══════════════════════════════════════════════════════
   文章卡片 — 横向栅格：左图右文，整行可点
   ══════════════════════════════════════════════════════ */
.post-list { display: flex; flex-direction: column; gap: 14px; }

.post-card {
  position: relative; display: grid;
  grid-template-columns: 240px minmax(0, 1fr); gap: 20px;
  padding: 14px; overflow: hidden;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-card), var(--ins);
  transition: box-shadow .35s ease, transform .35s cubic-bezier(.2, .6, .2, 1);
  /* 分类色阶由 --cat 推导（render.js 在卡片上注入 --cat），供封面占位与角标使用 */
  --c50: color-mix(in srgb, var(--cat, var(--p600)) 8%, #fff);
  --c100: color-mix(in srgb, var(--cat, var(--p600)) 18%, #fff);
  --c600: color-mix(in srgb, var(--cat, var(--p600)) 85%, #000);
}
[data-theme="dark"] .post-card {
  --c50: color-mix(in srgb, var(--cat, var(--p600)) 14%, #1e1f28);
  --c100: color-mix(in srgb, var(--cat, var(--p600)) 24%, #1e1f28);
  --c600: color-mix(in srgb, var(--cat, var(--p600)) 88%, #fff);
}
.post-card:hover {
  box-shadow: var(--shadow-hover); transform: translateY(-3px);
}

/* 封面：占位画在容器背景上（随 HTML 同一次请求到达），真 <img> load 后淡入 */
.post-cover {
  position: relative; z-index: 2; align-self: center;
  height: 150px; border-radius: 12px; overflow: hidden;
  background-color: var(--c50);
  background-image: var(--lq, linear-gradient(135deg, var(--c100), var(--c50)));
  background-size: cover; background-position: center;
}
.post-cover img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.92) brightness(1.03) contrast(.98);
  opacity: 0; transition: transform .4s cubic-bezier(.2, .6, .2, 1), opacity .5s ease;
}
.post-cover img.on { opacity: 1; }
.post-card:hover .post-cover img { transform: scale(1.05); }
.post-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(30, 24, 28, .5) 100%);
  pointer-events: none;
}
.post-cover-name {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  color: #fff; font-family: var(--ff-round-bold); font-size: 11.5px;
  letter-spacing: .12em; text-shadow: 0 1px 8px rgba(0, 0, 0, .45);
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 3px 10px; border-radius: 999px;
}

.post-body {
  align-self: center; min-width: 0; padding: 4px 6px 4px 0;
  display: flex; flex-direction: column; gap: 10px;
}
/* 整行可点：标题链接的伪元素铺满整卡；分类/标签/封面在上层，仍可各自点击 */
.post-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.post-meta {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; font-size: 12.5px; line-height: 20px;
  color: var(--muted-foreground); font-family: var(--fm);
  font-variant-numeric: tabular-nums;
}
.post-cat {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px;
  font-family: var(--ff-round);
  color: var(--cat, #378ADD); background: color-mix(in srgb, var(--cat, #378ADD) 10%, transparent);
  transition: opacity .25s;
}
.post-cat:hover { opacity: .75; }
.meta-group { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.meta-group > span { display: inline-flex; align-items: center; gap: 4px; }

.post-title { margin: 0; font-size: 19px; line-height: 30px; letter-spacing: .3px; }
.post-title a { transition: color .25s; }
.post-title a:hover { color: var(--p600); }
.pin {
  font-style: normal; font-size: 10px; margin-left: 8px; padding: 2px 8px;
  border-radius: 6px; background: var(--grad-pink); color: #fff; vertical-align: 2px;
}
.post-excerpt {
  margin: 0; font-size: 14px; line-height: 25px; color: var(--muted-foreground);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.more-link {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start;
  font-size: 12.5px; color: var(--p600); transition: gap .25s ease;
}
.more-link:hover { gap: 10px; }

/* ── 标签 ─────────────────────────────────────────── */
.tag-row { position: relative; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; padding: 4px 11px; border-radius: 999px;
  background: var(--p50); color: var(--p800);
  transition: all .25s ease;
}
.tag:hover { background: var(--p600); color: #fff; }
.tag i { font-style: normal; opacity: .65; font-size: 10px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud .tag { font-size: 12px; padding: 5px 14px; }
.tag-cloud .size-2 { font-size: 13px; }
.tag-cloud .size-3 { font-size: 14px; }
.tag-cloud .size-4 { font-size: 15px; }
.tag-cloud .size-5 { font-size: 16.5px; }

/* ── 分页 ─────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 14px; border-radius: 12px;
  display: inline-grid; place-items: center; font-size: 13px;
  background: var(--card); box-shadow: var(--shadow-card); color: var(--muted-foreground);
  transition: all .25s ease;
}
.page-btn:hover { color: var(--pink-b); transform: translateY(-2px); }
.page-btn.active { background: var(--grad-pink); color: #fff; box-shadow: var(--shadow-btn); }
.page-gap { color: var(--muted-foreground); }

/* ── 侧栏 ─────────────────────────────────────────── */
.sider { display: grid; gap: 16px; align-content: start; position: sticky; top: calc(var(--header-h) + 20px); }
.sider-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-card), var(--ins);
}
.sider-title {
  margin: 0 0 12px; font-family: var(--ff-round-bold); font-size: 15px;
  letter-spacing: .4px; color: var(--foreground);
  display: flex; align-items: center; gap: 6px;
}
.side-note { margin: 0; font-size: 13px; line-height: 22px; color: var(--muted-foreground); }
.side-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  font-size: 14px; color: var(--muted-foreground); transition: all .16s ease;
}
.side-row:hover { background: var(--p50); color: var(--p600); }
.side-row b { margin-left: auto; font-size: 12px; font-family: var(--fm); opacity: .7; }
.side-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

.toc { display: flex; flex-direction: column; gap: 2px; max-height: 380px; overflow: auto; }
.toc-item {
  font-size: 12.5px; color: var(--muted-foreground); padding: 5px 10px;
  border-left: 2px solid var(--border); transition: all .22s ease; line-height: 1.5;
  border-radius: 0 6px 6px 0;
}
.toc-item.lv3 { padding-left: 22px; font-size: 12px; }
.toc-item:hover, .toc-item.active { color: var(--pink-b); border-left-color: var(--pink-b); background: color-mix(in srgb, var(--pink-b) 6%, transparent); }

/* ── 页头 ─────────────────────────────────────────── */
.page-head { max-width: var(--max-w); margin: 0 auto; padding: 36px 24px 16px; }
.page-head h1 {
  margin: 0; font-size: 26px; letter-spacing: .08em; display: flex; align-items: center; gap: 10px;
}
.page-head h1 .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--cat, var(--pink-b)); }
.page-head p { margin: 6px 0 0; font-size: 13px; color: var(--muted-foreground); letter-spacing: .04em; }

/* ── 文章页（旧版式，保留用于分类/标签页）──────────────── */
.article {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 32px 42px 36px;
}
.article-header { border-bottom: 1px dashed var(--border); padding-bottom: 20px; margin-bottom: 26px; }
.article-title { margin: 12px 0 14px; font-size: 28px; line-height: 1.45; letter-spacing: .01em; }

/* ── 文章页 P1 窄栏沉浸版式 ───────────────────────── */
.article-p1 {
  max-width: 760px; margin: 0 auto; padding: 40px 24px 60px;
  background: none; border-radius: 0; box-shadow: none;
}
.article-p1 .article-header { border-bottom: none; padding-bottom: 0; margin-bottom: 32px; text-align: center; }
.article-p1 .article-title { font-size: 32px; line-height: 1.5; letter-spacing: .02em; margin: 16px 0 20px; }
.article-p1 .post-meta { justify-content: center; }

/* 目录导航（P1 版式） */
.article-toc {
  position: sticky; top: 80px; z-index: 50;
  max-width: 280px; margin: 0 0 32px; padding: 16px 20px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); float: right; margin-left: 24px;
}
.toc-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--foreground); margin-bottom: 12px;
}
.article-toc ul { list-style: none; margin: 0; padding: 0; }
.article-toc li { margin: 4px 0; }
.article-toc a {
  display: block; padding: 6px 12px; font-size: 13px; color: var(--muted-foreground);
  border-left: 2px solid var(--border); border-radius: 0 8px 8px 0;
  transition: all .22s ease; line-height: 1.5;
}
.article-toc .toc-lv3 a { padding-left: 24px; font-size: 12px; }
.article-toc a:hover, .article-toc a.active {
  color: var(--pink-b); border-left-color: var(--pink-b);
  background: color-mix(in srgb, var(--pink-b) 6%, transparent);
}

.article-body { font-size: 15px; line-height: 1.95; color: var(--foreground); }
.article-body > *:first-child { margin-top: 0; }
.article-body h2 {
  font-size: 20px; margin: 36px 0 14px; padding-left: 14px;
  border-left: 4px solid var(--pink-b); line-height: 1.5;
}
.article-body h3 { font-size: 17px; margin: 28px 0 10px; }
.article-body h4 { font-size: 15.5px; margin: 22px 0 8px; }
.article-body p { margin: 14px 0; }
.article-body ul, .article-body ol { padding-left: 24px; margin: 14px 0; }
.article-body li { margin: 6px 0; }
.article-body a { color: var(--primary); border-bottom: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); }
.article-body a:hover { color: var(--pink-b); border-bottom-color: var(--pink-b); }
.article-body blockquote {
  margin: 20px 0; padding: 14px 20px; border-left: 4px solid var(--shoka-pink);
  background: var(--muted); border-radius: 0 12px 12px 0; color: var(--muted-foreground);
}
.article-body blockquote p { margin: 6px 0; }
.article-body code {
  font-family: "JetBrains Mono", Consolas, Monaco, monospace; font-size: .88em;
  background: var(--muted); padding: 2px 7px; border-radius: 6px; color: var(--pink-b);
}
.article-body pre {
  background: #1e1f28; color: #e6e6e6; padding: 18px 20px; border-radius: 14px;
  overflow: auto; margin: 20px 0; font-size: 13px; line-height: 1.7;
  border: 1px solid rgba(255,255,255,.06);
}
.article-body pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.article-body img { border-radius: 14px; margin: 20px auto; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.article-body hr { border: none; border-top: 1px dashed var(--border); margin: 32px 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13.5px; border-radius: 12px; overflow: hidden; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.article-body th { background: var(--muted); font-weight: 600; }
.prose-block { padding: 4px 0; }

.article-tags { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 32px; padding-top: 22px; border-top: 1px dashed var(--border); }
.at-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted-foreground); }

.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.pn-btn {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 18px;
  border-radius: 14px; background: var(--muted); transition: all .28s ease;
}
.pn-btn:hover { background: var(--grad-pink); color: #fff; }
.pn-btn.right { text-align: right; }
.pn-btn em { font-style: normal; font-size: 11.5px; opacity: .7; }
.pn-btn span { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── 归档 ─────────────────────────────────────────── */
.arch-year { margin-bottom: 36px; }
.arch-year-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.arch-year-head b { font-size: 32px; color: color-mix(in srgb, var(--foreground) 15%, transparent); letter-spacing: .04em; }
.arch-year-head span { font-size: 12px; color: var(--muted-foreground); }
.arch-month { margin: 0 0 18px 6px; padding-left: 22px; border-left: 2px dashed var(--border); }
.arch-month h4 { margin: 0 0 8px; font-size: 13px; color: var(--pink-b); letter-spacing: .08em; }
.arch-month ul { list-style: none; margin: 0; padding: 0; }
.arch-month li a {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px;
  font-size: 13.5px; transition: background .25s ease;
}
.arch-month li a:hover { background: var(--muted); }
.arch-month time { flex: 0 0 auto; font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.arch-month li span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-month li i { font-style: normal; font-size: 11px; color: var(--cat); flex: 0 0 auto; }

/* ── 友链 / 下载 ──────────────────────────────────── */
.friend-card, .dl-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 12px;
  border-radius: 14px; background: var(--muted); transition: all .3s ease;
}
.friend-card:hover, .dl-card:hover { background: var(--grad-pink); color: #fff; transform: translateX(4px); }
.friend-card b { font-size: 15px; }
.friend-card span, .friend-card i { font-size: 12px; opacity: .75; font-style: normal; margin-left: auto; }
.friend-card i { margin-left: 12px; opacity: .55; }
.dl-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--card); color: var(--pink-b); flex: 0 0 auto; }
.dl-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.dl-info b { font-size: 15px; }
.dl-info span { font-size: 12px; opacity: .75; }
.dl-size { font-style: normal; margin-left: 8px; opacity: .85; }
.dl-size::before { content: '·'; margin-right: 6px; opacity: .5; }
.dl-go { margin-left: auto; opacity: .6; flex: 0 0 auto; }

/* 下载中心网格布局（桌面 2 列，手机 1 列） */
/* ── 下载中心：整宽单列（不设右侧栏，卡片平铺更好找）── */
.dl-page {
  max-width: var(--max-w); margin: 0 auto; padding: 8px 24px 60px;
  position: relative; z-index: 2;
}
.dl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
@media (max-width: 720px) {
  .dl-page { padding: 4px 16px 46px; }
  .dl-grid { grid-template-columns: 1fr; gap: 12px; }
  .dl-card { padding: 12px 14px; }
  .dl-ico { width: 36px; height: 36px; border-radius: 10px; }
  .dl-info b { font-size: 14px; }
  .dl-info span { font-size: 11.5px; }
}

/* ── 空态 ─────────────────────────────────────────── */
.empty { padding: 48px 0; text-align: center; color: var(--muted-foreground); font-size: 14px; }
.empty a { color: var(--pink-b); }
.empty-page { max-width: 560px; margin: 90px auto; text-align: center; padding: 0 20px; }
.empty-page h1 { font-size: 80px; margin: 0; color: color-mix(in srgb, var(--foreground) 10%, transparent); letter-spacing: .08em; }
.empty-page p { color: var(--muted-foreground); margin: 6px 0 24px; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 28px; border-radius: 14px; background: var(--grad-pink);
  color: #fff; font-size: 14px; letter-spacing: .06em; box-shadow: var(--shadow-btn);
  transition: opacity .25s ease, transform .25s ease;
}
.btn-primary:hover { opacity: .9; transform: translateY(-2px); }

/* ── 搜索浮层 ─────────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: start center;
  padding-top: 14vh; background: rgba(248, 246, 244, .72); backdrop-filter: blur(12px);
}
[data-theme="dark"] .search-overlay { background: rgba(22, 23, 29, .72); }
.search-panel {
  display: flex; align-items: center; gap: 12px; width: min(560px, 92vw);
  padding: 14px 20px; border-radius: 16px; background: var(--card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18); color: var(--muted-foreground);
}
.search-panel input { flex: 1 1 auto; border: none; outline: none; background: none; font-size: 15px; color: var(--foreground); }
.search-panel kbd { font-size: 10.5px; padding: 2px 8px; border-radius: 6px; background: var(--muted); }

/* ── 页脚 ─────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); margin-top: 20px; padding: 28px 24px 36px; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--muted-foreground); }
.footer-copy, .footer-icp { margin: 0; }
.footer-slogan { margin: 0; letter-spacing: .2em; color: var(--pink-b); }
.footer-icp::before, .footer-slogan::before { content: "·"; margin-right: 16px; opacity: .5; }

.to-top {
  position: fixed; right: 26px; bottom: 30px; z-index: 70;
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--grad-pink); color: #fff; box-shadow: var(--shadow-btn);
  transition: transform .3s ease, opacity .3s ease;
}
.to-top:hover { transform: translateY(-4px); }

/* ── 响应式 ───────────────────────────────────────── */
/* 平板横屏：单列，侧栏叠到主内容下方 */
@media (max-width: 980px) {
  .layout, .layout.home { grid-template-columns: 1fr !important; }
  .layout:not(.home) .sider { display: block; }
  .sider { position: static; }
  .category-chips { grid-template-columns: repeat(2, 1fr); }
}
/* 平板竖屏 + 手机：紧凑间距与字体 */
@media (max-width: 768px) {
  .hero { height: 240px; }
  .hero-inner { bottom: 18px; padding: 0 16px; }
  .hero-inner h1 { font-size: 24px; line-height: 32px; }
  .hero-sub { letter-spacing: .5px; font-size: 13px; }
  .hero-stats { gap: 12px; font-size: 11px; }
  .hero-stats b { font-size: 14px; }
  .fade-into { height: 32px; margin-top: -32px; }
  .header-inner { gap: 8px; padding: 0 12px; }
  .brand-text i { display: none; }
  .tab { padding: 5px 8px; font-size: 12.5px; }
  .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
  .layout { padding: 4px 12px 36px; gap: 14px; }
  .panel { padding: 4px 14px 16px; }
  .sec-title h2 { font-size: 17px; line-height: 24px; }
  .post-card { grid-template-columns: 100px minmax(0, 1fr); gap: 12px; padding: 10px; }
  .post-cover { height: 80px; border-radius: 8px; }
  .post-cover-name { left: 6px; bottom: 6px; padding: 2px 6px; font-size: 10px; }
  .post-title { font-size: 14.5px; line-height: 22px; }
  .post-excerpt { -webkit-line-clamp: 2; font-size: 12px; line-height: 20px; }
  .post-body { padding: 0; gap: 6px; }
  .meta-group > span:nth-child(n + 3) { display: none; }
  .sider-card { padding: 12px 14px; }
  .sider-title { font-size: 13px; }
  .side-row { padding: 5px 6px; font-size: 12px; }
  .category-chips { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .category-chips .chip { height: 68px; padding: 8px 12px; }
  .category-chips .chip-name { font-size: 13px; }
  .tag { font-size: 11px; padding: 3px 8px; }
  .tag-cloud .tag { font-size: 11px; padding: 3px 8px; }
  .article-p1 { padding: 20px 14px 32px; }
  .article-p1 .article-title { font-size: 22px; line-height: 1.35; }
  .article-toc { display: none; }
  .dl-grid { grid-template-columns: 1fr; gap: 10px; }
  .dl-card { padding: 10px 12px; gap: 8px; }
  .dl-ico { width: 34px; height: 34px; border-radius: 9px; }
  .dl-info b { font-size: 13px; }
  .friend-card { padding: 10px 12px; gap: 8px; }
  .pagination { gap: 4px; }
  .page-btn { min-width: 30px; height: 30px; padding: 0 8px; font-size: 11px; border-radius: 8px; }
  .site-footer { padding: 20px 14px 28px; }
  .footer-inner { gap: 8px; }

  /* ── 返回顶部 ── */
  .to-top { right: 16px; bottom: 20px; width: 40px; height: 40px; border-radius: 12px; }

  /* ── 上下篇 ── */
  .prevnext { grid-template-columns: 1fr; }
  .page-head { padding: 26px 16px 12px; }
  .page-head h1 { font-size: 22px; }
}
@media (max-width: 480px) {
  .hero { height: 200px; }
  .hero-inner { bottom: 14px; }
  .hero-inner h1 { font-size: 20px; line-height: 28px; }
  .hero-stats { gap: 8px; font-size: 10px; }
  .hero-stats b { font-size: 13px; }
  .post-card { grid-template-columns: 86px minmax(0, 1fr); gap: 10px; padding: 8px; }
  .post-cover { height: 70px; }
  .post-title { font-size: 13.5px; }
  .post-excerpt { font-size: 11.5px; -webkit-line-clamp: 2; }
  .category-chips { grid-template-columns: 1fr; gap: 6px; }
  .category-chips .chip { height: 56px; }
  .sider-card { padding: 10px 12px; }
  .dl-card { padding: 8px 10px; }
  .site-footer { padding: 16px 12px 24px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
