/* ===========================================================
   技术博客 · 设计系统
   默认主题：③ 海盐苏打（sky）
   其余 4 套通过 <html data-theme="..."> 切换
   =========================================================== */

/* ---------- 主题变量 ----------
   纯 CSS 驱动：body:has(#t-xxx:checked) 覆盖变量，
   不依赖 JavaScript 也能切换。默认 = 海盐苏打。

   配色规则（改主题时照着来，别破坏统一感）：
   · 底色接近白，只带一点色相，避免大面积彩色背景
   · 主色饱和 40%~46%、亮度 42%，白字对比度 ≥ 4.5:1
   · 强调色只用在极小面积（高亮条、置顶角标）
   · 所有颜色从同一个 H 推导，页面才不会花 */
/* 色相放在 :root，其余颜色必须在 body 上推导。
   原因：自定义属性在声明处就完成 var() 替换，
   写在 :root 里的 --primary 会永远锁死在默认色相上。 */
:root { --h: 198; }

body {
  --bg: hsl(var(--h) 30% 97%);
  --bg-2: hsl(var(--h) 32% 95%);
  --surface: #FFFFFF;
  --ink: hsl(var(--h) 24% 14%);
  --muted: hsl(var(--h) 10% 44%);
  --primary: hsl(var(--h) 44% 42%);
  --primary-dp: hsl(var(--h) 46% 34%);
  --accent: hsl(36 72% 54%);
  --soft: hsl(var(--h) 42% 94%);
  --link: hsl(var(--h) 46% 37%);
  --rule: hsl(var(--h) 22% 90%);
  --shadow: hsl(220 12% 32% / .07);
  --shadow-2: hsl(220 12% 32% / .13);
  --hl: hsl(38 88% 68% / .5);
  --ok: hsl(160 52% 36%);
  --warn: hsl(14 70% 54%);
}

body:has(#t-mint:checked) { --h: 162; --accent: hsl(192 62% 48%); --hl: hsl(160 60% 62% / .4); }
body:has(#t-peach:checked) { --h: 18; --accent: hsl(38 82% 56%); }
body:has(#t-berry:checked) { --h: 300; --accent: hsl(328 64% 60%); --hl: hsl(42 90% 70% / .45); }
body:has(#t-lime:checked) { --h: 85; --accent: hsl(150 46% 42%); }

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  /* 顶部一层极淡的中心光，左右对称，不再用两个大色斑（容易显脏） */
  background:
    radial-gradient(900px 420px at 50% -8%, var(--bg-2), transparent 72%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3, h4 {
  font-family: "Noto Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.012em;
  margin: 0;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--primary-dp); }

code, pre, .mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
}

::selection { background: var(--hl); color: var(--ink); }

/* hidden 属性优先于任何 display 声明，避免 flex/grid 元素隐藏失效 */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

img { max-width: 100%; }

/* ---------- 布局 ---------- */
/* 宽屏铺开、窄屏自适应：max-width 在大屏生效，小屏自动收缩到 100% */
:root { --wrap: 1440px; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 clamp(18px, 3vw, 44px);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--rule);
}

.topbar-in {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 14px clamp(20px, 3vw, 44px);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 1.16rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand .mark {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 4px 12px var(--shadow-2);
  transition: transform .45s cubic-bezier(.34,1.56,.64,1);
  flex: none;
}
.brand:hover .mark { transform: rotate(-12deg) scale(1.06); }

/* 顶栏标识改成 SVG（燕子）：渐变与圆角都画在图形里，
   这里只保留尺寸；悬停时轻转一下，正好是「扑棱」的意思 */
.brand .mark[src] {
  background: none;
  box-shadow: none;
  border-radius: 0;
  object-fit: contain;
  display: block;
}
.brand:hover .mark[src] { transform: rotate(-9deg) scale(1.08); }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav a {
  color: var(--muted);
  font-size: .9rem;
  padding: 6px 13px;
  border-radius: 999px;
  transition: background .18s, color .18s;
}
.nav a:hover { background: var(--soft); color: var(--primary-dp); }
.nav a.on { background: var(--soft); color: var(--primary-dp); font-weight: 600; }

/* 主题圆点（纯 CSS，radio 驱动，无 JS 也能切） */
.theme-picker {
  display: flex;
  gap: 7px;
  align-items: center;
  padding-left: 12px;
  margin-left: 6px;
  border-left: 1px solid var(--rule);
}
.theme-picker input { position: absolute; opacity: 0; pointer-events: none; }
.theme-picker label {
  width: 15px; height: 15px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--surface);
  background: var(--dot);
  box-shadow: 0 0 0 1px var(--rule);
  transition: transform .18s, box-shadow .18s;
}
.theme-picker label:hover { transform: scale(1.25); }
.theme-picker input:checked + label {
  box-shadow: 0 0 0 1px var(--dot), 0 0 0 3px color-mix(in srgb, var(--dot) 22%, transparent);
}
.theme-picker input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .16s, box-shadow .18s, background .18s, color .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px var(--shadow-2);
}
.btn-primary:hover { background: var(--primary-dp); color: #fff; box-shadow: 0 8px 22px var(--shadow-2); }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule);
}
.btn-ghost:hover { background: var(--soft); border-color: var(--primary); color: var(--primary-dp); }
.btn-danger { background: transparent; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.btn-sm { padding: 6px 13px; font-size: .8rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 卷首 ---------- */
.hero { padding: 60px 0 40px; }
.hero .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--primary-dp);
  background: var(--soft);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero .chip .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .35; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1); }
}

.hero h1 {
  font-size: clamp(2rem, 3.6vw, 3.4rem);
  margin-bottom: 16px;
}
.hero h1 .hl {
  position: relative;
  white-space: nowrap;
  color: var(--primary-dp);
}
.hero h1 .hl::after {
  content: "";
  position: absolute;
  left: -3px; right: -3px; bottom: .1em;
  height: 34%;
  background: var(--hl);
  border-radius: 5px;
  z-index: -1;
}
.hero p {
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px;
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 26px;
}

.search {
  position: relative;
  flex: 1 1 240px;
  min-width: 180px;
  max-width: 480px;
}
.toolbar { justify-content: space-between; }
.search input {
  width: 100%;
  font: inherit;
  font-size: .92rem;
  padding: 10px 38px 10px 38px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.search input::placeholder { color: var(--muted); opacity: .8; }
.search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--soft);
}
.search .ico {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  opacity: .5;
  pointer-events: none;
}
.search .clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.search .clear:hover { background: var(--soft); color: var(--primary-dp); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tag-btn {
  font: inherit;
  font-size: .78rem;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .16s;
}
.tag-btn:hover { border-color: var(--primary); color: var(--primary-dp); }
.tag-btn.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--shadow-2);
}

/* ---------- 文章列表 ---------- */
.post-list { display: flex; flex-direction: column; gap: 10px; }

.post-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px;
  box-shadow: 0 3px 14px var(--shadow);
  color: inherit;
  transition: transform .22s cubic-bezier(.34,1.2,.64,1), box-shadow .24s, border-color .24s;
  animation: rise .42s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px var(--shadow-2);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--rule));
  color: inherit;
}
.post-card h3 {
  font-size: 1.18rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.post-card h3 .arrow {
  opacity: 0;
  transform: translateX(-5px);
  transition: all .22s;
  color: var(--primary);
  font-size: .95rem;
}
.post-card:hover h3 .arrow { opacity: 1; transform: none; }
.post-card .excerpt {
  color: var(--muted);
  font-size: .89rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .rail {
  text-align: right;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}
.post-card .rail .tags-row {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  margin-top: 8px;
  flex-wrap: wrap;
}
.pill {
  background: var(--soft);
  color: var(--primary-dp);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .68rem;
}
.cover-thumb {
  width: 100%;
  height: 132px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
  display: block;
}

/* ---------- 空态 / 骨架 ---------- */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
}
.empty .big { font-size: 2rem; margin-bottom: 10px; opacity: .5; }
.empty h3 { color: var(--ink); font-size: 1.1rem; margin-bottom: 8px; }

.skeleton {
  height: 92px;
  border-radius: 18px;
  background: linear-gradient(100deg, var(--surface) 30%, var(--soft) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
  border: 1px solid var(--rule);
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 68px;
  padding: 30px 0 44px;
  border-top: 1px solid var(--rule);
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
}

/* ---------- 文章详情 ---------- */
.article { padding: 52px 0 20px; }
.article-head { margin-bottom: 34px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
  color: var(--muted);
  margin-bottom: 20px;
}
.back-link:hover { color: var(--primary-dp); }
.article-head h1 {
  font-size: clamp(1.7rem, 4.4vw, 2.4rem);
  margin: 10px 0 16px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .74rem;
  color: var(--muted);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}
.article-meta .tags-row { display: flex; gap: 5px; }

.prose {
  max-width: 76ch;
  font-size: 1.02rem;
  line-height: 1.86;
}
.prose h2 { font-size: 1.42rem; margin: 2.2em 0 .7em; }
.prose h3 { font-size: 1.16rem; margin: 1.9em 0 .6em; }
.prose p { margin: 0 0 1.15em; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin-bottom: .4em; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--primary);
  color: var(--muted);
}
.prose code {
  background: var(--soft);
  color: var(--primary-dp);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: .88em;
}
.prose pre {
  background: color-mix(in srgb, var(--ink) 94%, black);
  color: #E7EFF4;
  padding: 18px 20px;
  border-radius: 14px;
  overflow-x: auto;
  font-size: .86rem;
  line-height: 1.62;
  margin: 0 0 1.3em;
}
.prose pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.prose img { border-radius: 14px; margin: .6em 0; box-shadow: 0 6px 20px var(--shadow); }
.prose hr { border: none; border-top: 1px solid var(--rule); margin: 2.4em 0; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.3em; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 9px 12px; text-align: left; }
.prose th { background: var(--soft); }

.callout {
  margin: 1.3em 0;
  padding: 14px 18px;
  border-radius: 14px;
  border-left: 3px solid var(--primary);
  background: var(--soft);
  font-size: .95rem;
}
.callout.tip { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.callout.warn { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }

/* ---------- 卡片容器（登录/后台） ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 22px;
  box-shadow: 0 10px 34px var(--shadow);
  padding: 30px;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; margin-bottom: 8px; font-size: 1.3rem; }
.auth-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  margin: 0 0 26px;
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}
.input, .textarea, .select {
  width: 100%;
  font: inherit;
  font-size: .94rem;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.textarea { line-height: 1.7; resize: vertical; min-height: 96px; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--soft);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .75; }

.hint { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.preview-empty {
  font-size: .86rem;
  line-height: 1.8;
  color: var(--muted);
  padding: 26px 22px;
  border: 1px dashed var(--rule);
  border-radius: 12px;
  background: color-mix(in srgb, var(--soft) 40%, transparent);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

.msg {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: .86rem;
  margin-bottom: 14px;
  display: none;
}
.msg.show { display: block; }
.msg.err { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent); }
.msg.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 34%, transparent); }

/* ---------- 后台 ---------- */
.admin-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 34px 0 22px;
}
.admin-head h1 { font-size: 1.5rem; flex: 1 1 auto; }
.who {
  font-size: .82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.who .dot-ok {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}
.tab-btn {
  font: inherit;
  font-size: .9rem;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .16s, border-color .16s;
}
.tab-btn:hover { color: var(--primary-dp); }
.tab-btn.on { color: var(--primary-dp); border-bottom-color: var(--primary); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.on { display: block; animation: rise .3s ease both; }

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}
.tool {
  font: inherit;
  font-size: .8rem;
  min-width: 32px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .14s;
}
.tool:hover { background: var(--soft); color: var(--primary-dp); }
.tool.sep { pointer-events: none; width: 1px; padding: 0; min-width: 1px; background: var(--rule); margin: 4px 5px; height: 22px; }

.editor-area {
  border-radius: 0 0 12px 12px;
  min-height: 320px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .88rem;
}

.preview-box {
  border: 1px dashed var(--rule);
  border-radius: 12px;
  padding: 18px 20px;
  background: var(--bg);
  min-height: 120px;
  max-height: 460px;
  overflow: auto;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 15px 18px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 9px;
  transition: border-color .18s, box-shadow .18s;
}
.list-item:hover { border-color: var(--primary); box-shadow: 0 6px 18px var(--shadow); }
.list-item .t { font-weight: 600; font-size: .96rem; margin-bottom: 3px; }
.list-item .m { font-size: .76rem; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.list-item .acts { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  font-size: .68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dp);
  font-family: ui-monospace, Consolas, monospace;
  vertical-align: middle;
}
.badge.draft { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 780px) { .split { grid-template-columns: 1fr; } }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 24px);
  background: var(--ink);
  color: #fff;
  font-size: .86rem;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(0,0,0,.24);
  opacity: 0;
  pointer-events: none;
  transition: all .3s cubic-bezier(.34,1.3,.64,1);
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--primary-dp);
  cursor: pointer;
  box-shadow: 0 6px 20px var(--shadow-2);
  display: none;
  z-index: 90;
  font-size: 1rem;
}
.to-top.show { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .wrap, .topbar-in { padding: 0 18px; }
  .topbar-in { padding: 12px 18px; gap: 10px; }
  .nav a { padding: 6px 10px; font-size: .84rem; }
  .theme-picker { padding-left: 8px; }
  .theme-picker label { width: 15px; height: 15px; }
  .hero { padding: 38px 0 26px; }
  .toolbar { padding: 14px; border-radius: 16px; }
  .post-card { grid-template-columns: 1fr; gap: 10px; padding: 16px 18px; }
  .post-card .rail { text-align: left; display: flex; align-items: center; gap: 10px; }
  .post-card .rail .tags-row { justify-content: flex-start; margin-top: 0; }
  .panel { padding: 20px; border-radius: 18px; }
  .admin-head { padding: 24px 0 16px; }
}

/* 窄屏：导航换到第二行，避免链接被挤没 */
@media (max-width: 520px) {
  .topbar-in { flex-wrap: wrap; padding: 10px 16px 8px; row-gap: 0; }
  .brand { margin-right: auto; }
  .nav {
    order: 3;
    width: 100%;
    margin: 2px 0 0;
    padding-top: 7px;
    border-top: 1px solid var(--rule);
    justify-content: space-between;
  }
  .nav a { padding: 5px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 滚动显现：动画被关掉或打印时，内容必须直接可见 */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
}
@media print {
  .reveal, .pcard, .feature { opacity: 1 !important; transform: none !important; }
}

/* ===========================================================
   以下为「扑棱一下」自托管版新增部分
   =========================================================== */

/* ---------- 置顶标记 ---------- */
.pin {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent);
  color: #4a3608;
  flex: none;
}

/* ---------- 页脚 ---------- */
.site-footer .wrap { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--primary-dp); }
.icp-sep { opacity: .5; }
.icp { font-size: .78rem; }

/* ---------- 关于页 ---------- */
.about-page { padding: 56px 0 30px; }
.about-page h1 { font-size: clamp(1.9rem, 4.6vw, 2.5rem); margin-bottom: 14px; }
.about-lead {
  color: var(--muted);
  font-size: 1.04rem;
  max-width: 50ch;
  margin: 0 0 34px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--rule);
}
.about-page .prose { max-width: 66ch; }

/* ---------- 代码块复制按钮 ---------- */
.prose pre { position: relative; }
.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  font: inherit;
  font-size: .7rem;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.08);
  color: #cdd9e0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s, background .18s;
}
.prose pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ---------- 提示框补充类型 ---------- */
.callout.info { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.callout.danger { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.callout > :last-child { margin-bottom: 0; }
.callout h2, .callout h3 { margin-top: .2em; }

/* ---------- 任务列表 ---------- */
.prose .tasks { list-style: none; padding-left: 0; }
.prose .task { display: flex; align-items: flex-start; gap: 8px; }
.prose .task input { margin-top: .45em; }
.prose .task.done { color: var(--muted); text-decoration: line-through; }

/* ---------- 紧凑密度 ---------- */
[data-density="compact"] .post-card { padding: 14px 18px; }
[data-density="compact"] .post-list { gap: 7px; }
[data-density="compact"] .hero { padding: 38px 0 26px; }
[data-density="compact"] .post-card h3 { font-size: 1.08rem; margin-bottom: 3px; }

/* ===========================================================
   后台
   =========================================================== */

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.editor-wrap { margin-top: 22px; }
.editor-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.editor-top h2 { font-size: 1.16rem; flex: 1 1 auto; }

.note {
  font-size: .86rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 20px;
  line-height: 1.7;
}
.note b { color: var(--ink); }
.note code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .82em;
  background: var(--soft);
  color: var(--primary-dp);
  padding: 1px 5px;
  border-radius: 4px;
}

.sec-title {
  font-size: 1.06rem;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

/* ---------- 文案分组 ---------- */
.group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 20px;
}
.group-btn {
  font: inherit;
  font-size: .84rem;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all .16s;
}
.group-btn:hover { border-color: var(--primary); color: var(--primary-dp); }
.group-btn.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--shadow-2);
}
.group-btn .cnt {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .68rem;
  opacity: .75;
  margin-left: 3px;
}

/* ---------- 单个文案字段 ---------- */
.cf {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 15px 17px;
  margin-bottom: 11px;
  transition: border-color .18s, box-shadow .18s;
}
.cf:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--soft);
}
.cf-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}
.cf-label { font-size: .88rem; font-weight: 600; }
.cf-key {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .7rem;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 5px;
}
.cf-del {
  margin-left: auto;
  width: 24px; height: 24px;
  line-height: 1;
  font-size: .95rem;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .16s;
}
.cf-del:hover { background: var(--warn); border-color: var(--warn); color: #fff; }

/* ---------- 底部保存条 ---------- */
.sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 13px 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: 0 -4px 20px var(--shadow);
}
.sticky-bar .hint { flex: 1 1 auto; margin: 0; }

/* ---------- 折叠面板 ---------- */
.add-block {
  margin-top: 20px;
  border: 1px dashed var(--rule);
  border-radius: 14px;
  padding: 14px 18px;
  background: var(--surface);
}
.add-block summary {
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  color: var(--primary-dp);
  list-style: none;
}
.add-block summary::-webkit-details-marker { display: none; }
.add-block summary::before { content: ""; }
.add-block[open] summary { margin-bottom: 6px; }

/* ---------- 主题选择 ---------- */
.theme-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.theme-choices label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .84rem;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: all .16s;
}
.theme-choices label:hover { border-color: var(--primary); }
.theme-choices input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choices input:checked + .swatch { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
  transition: box-shadow .18s;
}
.theme-choices input:checked ~ span:last-child { color: var(--primary-dp); }

/* ---------- 开关组 ---------- */
.switches {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.switches label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .88rem;
  cursor: pointer;
}
.switches input[type="checkbox"] { width: auto; }

/* ---------- 提示条错误态 ---------- */
.toast.err { background: var(--warn); }

/* ---------- 小屏后台 ---------- */
@media (max-width: 720px) {
  .sticky-bar { flex-direction: column; align-items: stretch; }
  .sticky-bar .btn { width: 100%; }
  .cf { padding: 13px 14px; }
  .editor-top { flex-wrap: wrap; }
  .copy-btn { opacity: 1; }
}

/* ---------- 登录页标题 ---------- */
.auth-title {
  text-align: center;
  font-size: 1.18rem;
  margin: 16px 0 6px;
}
.auth-card .brand { margin-bottom: 4px; }

/* ===========================================================
   V2 · 图片卡片 / 排序 / 目录 / 后台侧栏
   =========================================================== */

/* ---------- 通用：渐入 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s cubic-bezier(.22,.61,.36,1), transform .5s cubic-bezier(.22,.61,.36,1);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 首页：工具条 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0 22px;
}
.toolbar .search { flex: 1 1 260px; }
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sortbar {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: 0 2px 10px var(--shadow);
}
.sortbar button {
  font: inherit;
  font-size: .84rem;
  padding: 6px 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.sortbar button:hover { color: var(--primary-dp); }
.sortbar button.on {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px var(--shadow-2);
}

/* ---------- 置顶特稿 ---------- */
.feature {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1fr);
  gap: 0;
  min-height: 250px;
  margin: 0 0 28px;
  border: 1px solid var(--rule);
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 8px 30px var(--shadow);
  transition: transform .28s cubic-bezier(.22,.61,.36,1), box-shadow .28s;
  color: inherit;
}
.feature:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 44px var(--shadow-2);
  color: inherit;
}
.feature-cover {
  position: relative;
  min-height: 210px;
  background: linear-gradient(135deg, var(--soft), var(--bg-2));
  overflow: hidden;
}
.feature-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .6s cubic-bezier(.22,.61,.36,1);
}
.feature:hover .feature-cover img { transform: scale(1.045); }
.feature-body {
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.feature-badge {
  align-self: flex-start;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #4a3608;
}
.feature-body h2 {
  font-size: clamp(1.4rem, 2.1vw, 1.82rem);
  letter-spacing: -.02em;
  line-height: 1.3;
}
.feature-body p {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 文章卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.pcard {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  box-shadow: 0 2px 12px var(--shadow);
  transition: transform .26s cubic-bezier(.22,.61,.36,1), box-shadow .26s, border-color .26s;
}
.pcard:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px var(--shadow-2);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--rule));
  color: inherit;
}
.pcard-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--soft), var(--bg-2));
  overflow: hidden;
}
.pcard-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .55s cubic-bezier(.22,.61,.36,1);
}
.pcard:hover .pcard-cover img { transform: scale(1.06); }

/* 无封面时的占位：同一主题色相的三档深浅，不引入杂色 */
.ph {
  --ph-a: .17;
  --ph-b: .09;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-indent: .14em;
  color: color-mix(in srgb, hsl(var(--h) 46% 42%) 62%, var(--ink));
  background:
    radial-gradient(124% 98% at 12% 0%, hsl(var(--h) 58% 52% / var(--ph-a)), transparent 64%),
    radial-gradient(96% 86% at 100% 100%, hsl(var(--h) 58% 52% / var(--ph-b)), transparent 60%);
  transition: transform .55s cubic-bezier(.22,.61,.36,1);
}
.ph.v1 { --ph-a: .24; --ph-b: .13; }
.ph.v2 { --ph-a: .11; --ph-b: .05; }
.ph.en { font-size: 2.8rem; letter-spacing: 0; text-indent: 0; }
/* 极淡点阵，让纯色块有纸质感，不显得空 */
.ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 15px 15px;
  opacity: .1;
  pointer-events: none;
}
.feature-cover .ph { font-size: clamp(2rem, 3vw, 2.8rem); letter-spacing: .18em; text-indent: .18em; }
.pcard:hover .ph,
.feature:hover .ph { transform: scale(1.05); }
.pcard-pin {
  position: absolute;
  top: 10px; left: 10px;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #4a3608;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.pcard-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.pcard-title {
  font-size: 1.06rem;
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pcard:hover .pcard-title { color: var(--primary-dp); }
.pcard-excerpt {
  margin: 0;
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.68;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.pcard-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .76rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  margin-top: 2px;
}
.pcard-meta .sep { opacity: .45; }
.pcard-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.pcard-tags .pill { font-size: .68rem; padding: 2px 8px; }

/* ---------- 加载更多 ---------- */
.load-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 44px;
}
.load-wrap .btn { min-width: 150px; }
.load-wrap .end {
  font-size: .82rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- 文章页：阅读进度 ---------- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 60;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .1s linear;
}

/* ---------- 文章页：封面头图 ---------- */
.post-hero {
  position: relative;
  margin: 0 0 30px;
  border-radius: 0 0 26px 26px;
  overflow: hidden;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(135deg, var(--soft), var(--bg-2));
}
.post-hero img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.post-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16,26,32,0) 30%, rgba(16,26,32,.72) 100%);
}
.post-hero-in {
  position: relative;
  z-index: 2;
  width: 100%;
  /* 左右内边距跟随正文容器的居中位置，标题与正文左边界对齐 */
  padding: 34px 0 32px;
  padding-left: max(clamp(18px, 3vw, 44px), calc((100% - 1040px) / 2));
  padding-right: max(clamp(18px, 3vw, 44px), calc((100% - 1040px) / 2));
  color: #fff;
}
.post-hero-in h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.7rem);
  line-height: 1.26;
  margin: 10px 0 14px;
  text-shadow: 0 2px 18px rgba(0,0,0,.35);
}
.post-hero-in .article-meta { color: rgba(255,255,255,.86); }
.post-hero-in .pill {
  background: rgba(255,255,255,.18);
  color: #fff;
  border-color: rgba(255,255,255,.25);
}
.post-hero-in .back-link { color: rgba(255,255,255,.9); }

/* ---------- 文章页：正文布局 ---------- */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  /* 正文超过 ~50 字/行就不好读了，整体居中限宽，两侧留白 */
  max-width: 1040px;
  margin: 0 auto;
  padding-bottom: 40px;
}
@media (min-width: 1080px) {
  .post-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; }
  .post-layout .toc-rail { order: 2; }
}
.toc-rail { display: none; }
@media (min-width: 1080px) { .toc-rail { display: block; } }

.toc {
  position: sticky;
  top: 88px;
  border-left: 2px solid var(--rule);
  padding-left: 14px;
}
.toc-title {
  font-size: .74rem;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.toc a {
  display: block;
  font-size: .8rem;
  line-height: 1.5;
  padding: 4px 0;
  color: var(--muted);
  border-left: 2px solid transparent;
  margin-left: -16px;
  padding-left: 14px;
  transition: color .18s, border-color .18s;
}
.toc a.lv3 { padding-left: 26px; font-size: .8rem; }
.toc a:hover { color: var(--primary-dp); }
.toc a.on {
  color: var(--primary-dp);
  border-left-color: var(--primary);
  font-weight: 600;
}

/* ---------- 文章页：底部互动 ---------- */
.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 34px 0 26px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
}
.post-actions .spacer { flex: 1 1 auto; }
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: transform .18s, background .18s, border-color .18s, color .18s;
}
.like-btn:hover { border-color: var(--primary); color: var(--primary-dp); transform: translateY(-1px); }
.like-btn.on {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  border-color: var(--primary);
  color: var(--primary-dp);
}
.like-btn .ico { font-size: 1rem; line-height: 1; }
.like-btn.pop { animation: likePop .38s cubic-bezier(.22,.61,.36,1); }
@keyframes likePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.13); }
  100% { transform: scale(1); }
}

/* ---------- 上一篇 / 下一篇 ---------- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 26px;
}
.post-nav a {
  display: block;
  padding: 15px 18px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.post-nav a:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow);
  color: inherit;
}
.post-nav .k {
  display: block;
  font-size: .7rem;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--muted);
  margin-bottom: 5px;
}
.post-nav .v { font-size: .9rem; font-weight: 600; line-height: 1.45; }
.post-nav .next { text-align: right; }
.post-nav.only { grid-template-columns: 1fr; }
.post-nav.only .next { text-align: left; }
@media (max-width: 620px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}

/* ---------- 相关推荐 ---------- */
.related {
  margin-bottom: 40px;
}
.related-title {
  font-size: .8rem;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 12px;
}
.related-list { display: grid; gap: 10px; }
.related-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  transition: border-color .18s, transform .18s;
}
.related-item:hover { border-color: var(--primary); transform: translateX(3px); color: inherit; }
.related-item .t { flex: 1; font-size: .9rem; font-weight: 500; }
.related-item .m { font-size: .74rem; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }

/* ---------- 未发布提示 ---------- */
.draft-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 0 0 22px;
  border-radius: 12px;
  font-size: .86rem;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--rule));
  color: var(--ink);
}

/* ===========================================================
   后台
   =========================================================== */

.shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: calc(100vh - 62px);
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
}

.sidenav {
  padding: 22px 14px 30px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 62px;
  align-self: start;
  max-height: calc(100vh - 62px);
  overflow-y: auto;
}
@media (max-width: 900px) {
  .sidenav {
    position: static;
    max-height: none;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 12px 14px;
    gap: 6px;
  }
}
/* 后台侧栏的分组标题。必须限定 .sidenav 作用域：
   首页侧栏也用 .side-title，不限定会让首页标题在窄屏消失。 */
.sidenav .side-title {
  font-size: .7rem;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 4px 12px 8px;
}
@media (max-width: 900px) { .sidenav .side-title { display: none; } }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: .88rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .16s, color .16s;
  white-space: nowrap;
}
.side-link:hover { background: var(--soft); color: var(--primary-dp); }
.side-link.on {
  background: color-mix(in srgb, var(--primary) 13%, var(--surface));
  color: var(--primary-dp);
  font-weight: 600;
}
.side-link .ico { width: 17px; text-align: center; flex: none; opacity: .85; }
.side-link .cnt {
  margin-left: auto;
  font-size: .68rem;
  font-family: ui-monospace, Consolas, monospace;
  background: var(--bg-2);
  color: var(--primary-dp);
  padding: 1px 7px;
  border-radius: 999px;
}
.side-link .cnt.alert { background: var(--warn); color: #fff; }

.admin-main { padding: 26px 26px 60px; min-width: 0; }
/* 超宽屏上别让表格行拉成一条线 */
.admin-main > .view { max-width: 1320px; }
@media (max-width: 620px) { .admin-main { padding: 18px 16px 50px; } }

.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 1.34rem; }
.page-head .who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .8rem;
  color: var(--muted);
}

/* ---------- 看板 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 16px 17px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 2px 10px var(--shadow);
}
.stat-card .k {
  font-size: .74rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .04em;
}
.stat-card .v {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 6px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-card .d { font-size: .74rem; color: var(--muted); margin-top: 4px; }
.stat-card.accent { border-color: color-mix(in srgb, var(--primary) 40%, var(--rule)); }

.dash-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.dash-cols > .panel:only-child { grid-column: 1 / -1; }
@media (max-width: 1080px) { .dash-cols { grid-template-columns: 1fr; } }

/* ---------- 趋势柱状 ---------- */
.trend {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 108px;
  padding: 10px 4px 0;
}
.trend .bar {
  flex: 1;
  min-width: 4px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--surface)));
  position: relative;
  transition: opacity .18s;
}
.trend .bar:hover { opacity: .75; }
.trend .bar[data-n="0"] { background: var(--bg-2); }
.trend-axis {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  margin-top: 6px;
}

/* ---------- 列表行 ---------- */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--rule);
  border-radius: 13px;
  background: var(--surface);
  transition: border-color .16s, box-shadow .16s;
}
.row-item:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--rule)); box-shadow: 0 4px 14px var(--shadow); }
.row-item.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.row-item .main { flex: 1; min-width: 0; }
.row-item .t {
  font-size: .94rem;
  font-weight: 600;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.row-item .t a { color: inherit; }
.row-item .t a:hover { color: var(--primary-dp); }
.row-item .m {
  font-size: .75rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.row-item .m .sep { opacity: .4; }
.row-item .acts { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .row-item { flex-wrap: wrap; }
  .row-item .acts { width: 100%; justify-content: flex-start; }
}

.row-check {
  width: 17px; height: 17px;
  flex: none;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- 状态徽章 ---------- */
.st {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.st.published { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.st.draft { background: var(--bg-2); color: var(--muted); border-color: var(--rule); }
.st.pending { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); color: #7a5a00; border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.st.rejected { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.st.pinned { background: var(--accent); color: #4a3608; }
.st.trash { background: color-mix(in srgb, var(--muted) 16%, var(--surface)); color: var(--muted); }

/* ---------- 筛选条 ---------- */
.filters {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.segmented button {
  font: inherit;
  font-size: .8rem;
  padding: 5px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .16s, color .16s;
  white-space: nowrap;
}
.segmented button:hover { color: var(--primary-dp); }
.segmented button.on { background: var(--primary); color: #fff; }

/* ---------- 批量操作条 ---------- */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 15px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--rule));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  font-size: .84rem;
}
.bulk-bar .n { font-weight: 700; color: var(--primary-dp); }
.bulk-bar .spacer { flex: 1; }
/* hidden 属性要能盖住 display:flex，否则隐藏不生效 */
.bulk-bar[hidden] { display: none; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  font-size: .84rem;
  color: var(--muted);
}
.pager .btn { min-width: 78px; }

/* ---------- 编辑器抽屉 ---------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 34, .42);
  backdrop-filter: blur(3px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s;
}
.drawer-mask.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(1120px, 100vw);
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
  box-shadow: -12px 0 40px rgba(0,0,0,.16);
}
.drawer.on { transform: none; }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  flex: none;
}
.drawer-head h2 { font-size: 1.04rem; }
.drawer-head .spacer { flex: 1; }
.drawer-body {
  flex: 1;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
@media (max-width: 900px) { .drawer-body { grid-template-columns: 1fr; } }
.drawer-pane { overflow-y: auto; padding: 20px 22px 40px; }
.drawer-pane + .drawer-pane {
  border-left: 1px solid var(--rule);
  background: var(--surface);
}
@media (max-width: 900px) {
  .drawer-pane + .drawer-pane { border-left: 0; border-top: 1px solid var(--rule); }
}
.drawer-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--rule);
  background: var(--surface);
}
.drawer-foot .spacer { flex: 1; }

/* ---------- 审核卡片 ---------- */
.review-card {
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  padding: 17px 19px;
  margin-bottom: 12px;
}
.review-card .rh {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.review-card h3 { font-size: 1.02rem; flex: 1; min-width: 180px; }
.review-card .rm {
  font-size: .75rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.review-card .ex {
  font-size: .87rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 13px;
  max-height: 4.9em;
  overflow: hidden;
}
.review-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 审计日志 ---------- */
.audit-list { display: flex; flex-direction: column; gap: 2px; }
.audit-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--rule);
  font-size: .83rem;
}
.audit-item:last-child { border-bottom: 0; }
.audit-item .when {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .73rem;
  color: var(--muted);
  flex: none;
  width: 130px;
}
.audit-item .act {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .72rem;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--bg-2);
  color: var(--primary-dp);
  flex: none;
}
.audit-item .act.danger { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); color: var(--warn); }
.audit-item .txt { flex: 1; min-width: 0; }
.audit-item .ip {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .7rem;
  color: var(--muted);
  flex: none;
}
@media (max-width: 620px) {
  .audit-item { flex-wrap: wrap; }
  .audit-item .when { width: 100%; }
}

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}
.empty-state .big { font-size: 2rem; opacity: .35; margin-bottom: 10px; }
.empty-state h3 { font-size: 1rem; margin-bottom: 6px; color: var(--ink); }
.empty-state p { font-size: .86rem; margin: 0; }

/* ---------- 小屏隐藏 ---------- */
@media (max-width: 720px) {
  .hide-sm { display: none !important; }
  .feature { grid-template-columns: 1fr; }
  .feature-cover { min-height: 170px; }
  .feature-body { padding: 20px 20px 24px; }
  .card-grid { grid-template-columns: 1fr; }
  .post-hero { min-height: 220px; border-radius: 0 0 18px 18px; }
  .post-hero-in { padding: 24px 18px 22px; }
}

/* ---------- 无封面时的文章头 ----------
   不用整块深色压在上面：浅色渐变 + 深色文字，和正文衔接更自然 */
.post-hero.no-cover {
  min-height: 0;
  background:
    radial-gradient(120% 120% at 18% 0%, hsl(var(--h) 58% 58% / .22), transparent 62%),
    linear-gradient(160deg, hsl(var(--h) 40% 96%), hsl(var(--h) 34% 90%));
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
}
.post-hero.no-cover::after { display: none; }
.post-hero.no-cover .post-hero-in {
  padding-top: 30px;
  padding-bottom: 30px;
  color: var(--ink);
}
.post-hero.no-cover .post-hero-in h1 { text-shadow: none; }
.post-hero.no-cover .back-link { color: var(--muted); }
.post-hero.no-cover .back-link:hover { color: var(--primary-dp); }
.post-hero.no-cover .article-meta { color: var(--muted); }
.post-hero.no-cover .pill {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--muted);
}

/* ---------- 文章头部返回链接 ---------- */
.back-link {
  font-size: .82rem;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .02em;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .8rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}
.article-meta .sep { opacity: .45; }

/* ---------- 后台表格滚动容器 ---------- */
.list-scroll { min-height: 80px; }

/* ---------- 文章页微调 ---------- */
.post-layout .article { padding-top: 0; }
.post-hero-in .back-link { margin-bottom: 14px; }

/* ===========================================================
   首页：主栏 + 侧栏（参考主流个人博客的编辑式排版）
   列表行不依赖封面：有图放缩略图，无图纯文字，
   避免「每张卡顶一块字母色块」这种没图硬做图的观感。
   =========================================================== */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  padding-bottom: 40px;
}
@media (min-width: 1080px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 288px; gap: 56px; }
}

/* ---------- 文章列表行 ---------- */
.plist { display: flex; flex-direction: column; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 20px;
  padding: 24px 4px 24px 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  transition: transform .22s ease, background-color .22s ease;
}
.row:first-child { border-top: 1px solid var(--rule); }
.row:hover { color: inherit; }

/* 悬停时左侧浮出一条主色竖线，替代整块背景变色的廉价感 */
.row::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 26px;
  bottom: 26px;
  width: 2px;
  border-radius: 2px;
  background: var(--primary);
  opacity: 0;
  transform: scaleY(.3);
  transform-origin: top;
  transition: opacity .22s ease, transform .22s ease;
}
.row:hover::before { opacity: 1; transform: scaleY(1); }

.row-date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 1px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--muted);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
/* 月份在上、日期在下：读起来是「10月 22」，视觉重心落在数字上 */
.row-date span {
  font-size: .68rem;
  letter-spacing: .06em;
  opacity: .75;
}
.row-date b {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.02em;
  margin-top: 5px;
  transition: color .22s ease;
}
.row:hover .row-date b { color: var(--primary); }

.row-main { min-width: 0; }

.row-title {
  font-size: 1.3rem;
  line-height: 1.4;
  margin: 0 0 7px;
  transition: color .22s ease;
}
.row:hover .row-title { color: var(--primary-dp); }

.row-desc {
  margin: 0 0 11px;
  font-size: .9rem;
  line-height: 1.72;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: .76rem;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--muted);
}
.row-meta .sep { opacity: .4; }
.row-meta .pill { font-size: .7rem; }

/* 有封面才出现的小缩略图，放在标题行右侧 */
.row-thumb {
  display: none;
  width: 116px;
  height: 78px;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--soft);
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.22,.61,.36,1); }
.row:hover .row-thumb img { transform: scale(1.05); }

/* 宽屏时把缩略图并进网格第三列 */
@media (min-width: 620px) {
  .row.has-thumb { grid-template-columns: 58px minmax(0, 1fr) 116px; align-items: start; }
  .row.has-thumb .row-thumb { display: block; }
}

/* ---------- 侧栏 ---------- */
.home-side { min-width: 0; }
@media (min-width: 1080px) {
  .home-side {
    position: sticky;
    top: 84px;
    padding-top: 24px;
  }
}

.side-card { padding: 0 0 26px; margin-bottom: 26px; border-bottom: 1px solid var(--rule); }
.side-card:last-child { border-bottom: 0; margin-bottom: 0; }

.side-title {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.side-about p {
  margin: 0 0 12px;
  font-size: .88rem;
  line-height: 1.8;
  color: var(--muted);
}
.side-about .more {
  font-size: .82rem;
  font-family: ui-monospace, Consolas, monospace;
}

/* 热门排行：序号用等宽字，标题两行截断 */
.rank { list-style: none; margin: 0; padding: 0; counter-reset: rk; }
.rank li { counter-increment: rk; margin-bottom: 14px; }
.rank li:last-child { margin-bottom: 0; }
.rank a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.55;
  transition: color .2s ease;
}
.rank a::before {
  content: counter(rk);
  font-family: ui-monospace, Consolas, monospace;
  font-size: .74rem;
  color: var(--primary);
  opacity: .65;
  padding-top: 2px;
}
.rank a:hover { color: var(--primary-dp); }
.rank .t {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 订阅入口 */
.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: .84rem;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .2s ease, color .2s ease, transform .2s ease;
}
.rss-link:hover { color: var(--primary-dp); border-color: var(--primary); transform: translateY(-1px); }
.rss-link .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.side-hint { margin: 12px 0 0; font-size: .8rem; line-height: 1.7; color: var(--muted); }

/* 手机端隐藏侧栏里的「关于」，但保留热门与订阅 */
@media (max-width: 720px) {
  .side-card.about { display: none; }
}

/* 列表行的骨架：不用卡片圆角，表现得像一条条正在加载的条目 */
.skeleton-row {
  height: 118px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(100deg, transparent 30%, var(--soft) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}

/* 行内「置顶」标记 */
.pill-pin {
  background: var(--primary);
  color: #fff;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: .04em;
}

/* 列表行的键盘焦点：整行描边 */
.row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  border-radius: 4px;
}

/* 元信息里的小图标（心形等），与文字基线对齐 */
.row-meta .mk,
.pcard-meta .mk {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.row-meta .mk svg,
.pcard-meta .mk svg { opacity: .75; }
.row-meta .sep { margin: 0 1px; }

/* ===========================================================
   暗色模式
   只换变量，所有组件自动跟随；个别写死颜色的地方单独补。
   色相仍然由 --h 决定，所以暗色下五套主题依然成立。
   =========================================================== */
html[data-mode="dark"] body {
  --bg: hsl(var(--h) 16% 7%);
  --bg-2: hsl(var(--h) 17% 10%);
  --surface: hsl(var(--h) 14% 11%);
  --ink: hsl(var(--h) 14% 92%);
  --muted: hsl(var(--h) 9% 62%);
  --primary: hsl(var(--h) 50% 61%);
  --primary-dp: hsl(var(--h) 54% 72%);
  --soft: hsl(var(--h) 18% 16%);
  --link: hsl(var(--h) 54% 66%);
  --rule: hsl(var(--h) 12% 19%);
  --shadow: hsl(0 0% 0% / .38);
  --shadow-2: hsl(0 0% 0% / .55);
  --hl: hsl(38 84% 58% / .22);
  --ok: hsl(160 46% 52%);
  --warn: hsl(14 74% 62%);
  color-scheme: dark;
}

/* 主色变亮后，主色块上的白字对比不足，改用深色字 */
html[data-mode="dark"] .btn-primary,
html[data-mode="dark"] .pill-pin,
html[data-mode="dark"] .segmented button.on,
html[data-mode="dark"] .badge-primary { color: hsl(var(--h) 30% 8%); }

/* 代码块：原色是「墨色 94%」，暗色下会变成浅灰底，必须单独压黑 */
html[data-mode="dark"] .prose pre {
  background: hsl(var(--h) 18% 5%);
  border: 1px solid var(--rule);
}
html[data-mode="dark"] .prose code { background: var(--soft); }

/* 暗色下阴影几乎不可见，用描边补层次 */
html[data-mode="dark"] .feature,
html[data-mode="dark"] .panel,
html[data-mode="dark"] .side-card,
html[data-mode="dark"] .rss-link { border-color: var(--rule); }

/* 图片在暗底上过亮，轻微压一档 */
html[data-mode="dark"] .prose img,
html[data-mode="dark"] .row-thumb img,
html[data-mode="dark"] .feature-cover img { filter: brightness(.92); }

/* ---------- 明暗切换按钮 ---------- */
.mode-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.mode-btn:hover { color: var(--primary); border-color: var(--primary); transform: rotate(-12deg); }
.mode-btn svg { width: 15px; height: 15px; }
.mode-btn .i-moon { display: none; }
html[data-mode="dark"] .mode-btn .i-moon { display: block; }
html[data-mode="dark"] .mode-btn .i-sun { display: none; }

/* 无封面的文章头在暗色下要压深，否则浅底 + 浅字直接糊成一片 */
html[data-mode="dark"] .post-hero.no-cover {
  background:
    radial-gradient(120% 120% at 18% 0%, hsl(var(--h) 54% 46% / .30), transparent 62%),
    linear-gradient(160deg, hsl(var(--h) 20% 13%), hsl(var(--h) 17% 9%));
}
html[data-mode="dark"] .post-hero.no-cover .pill {
  background: hsl(var(--h) 45% 34% / .38);
  color: var(--ink);
}

/* 卡片占位块同理：原色按浅底设计，暗色下要换一套深浅 */
html[data-mode="dark"] .ph {
  color: color-mix(in srgb, hsl(var(--h) 50% 70%) 76%, var(--ink));
  background:
    radial-gradient(124% 98% at 12% 0%, hsl(var(--h) 54% 42% / .42), transparent 64%),
    radial-gradient(96% 86% at 100% 100%, hsl(var(--h) 50% 36% / .30), transparent 60%);
}

/* 后台的浅色面板不属于前台暗色范围，这里显式兜底 */
html[data-mode="dark"] .admin-body .panel { background: var(--surface); }

/* ---------- 正文图片灯箱 ---------- */
.prose img { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vmin;
  background: hsl(0 0% 4% / .9);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: lb-in .22s ease both;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 30px 80px hsl(0 0% 0% / .5);
}
.lightbox .lb-close {
  position: absolute;
  top: 18px; right: 20px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid hsl(0 0% 100% / .3);
  background: hsl(0 0% 100% / .1);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox .lb-close:hover { background: hsl(0 0% 100% / .22); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

/* 打印时必须全部可见：屏幕上的渐入在纸上会变成整块空白 */
@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
  .topbar, .mode-btn, .theme-picker, .to-top { display: none !important; }
}

/* ===========================================================
   列表行：密度与细节收尾
   =========================================================== */
.row { padding: 20px 4px 20px 0; }
.row::before { top: 22px; bottom: 22px; }
.row-title { margin: 0 0 6px; }
.row-desc { margin: 0 0 9px; font-size: .885rem; line-height: 1.66; }

/* 月份与日期贴紧，别像两个独立元素 */
.row-date span { font-size: .66rem; letter-spacing: .08em; }
.row-date b { margin-top: 3px; font-size: 1.5rem; }

/* 标签与前面的数字之间留一口气 */
.row-meta .pill { margin-left: 4px; }

/* ---------- 特稿占位：加一条细线与微型标签，避免"一块空色" ---------- */
.feature-cover .ph::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% - 30px);
  width: 22px;
  height: 1px;
  transform: translateX(-50%);
  background: currentColor;
  opacity: .4;
}
.feature-cover .ph::after { opacity: .12; }

/* ---------- 手机端：日期列收窄，给正文多留宽度 ---------- */
@media (max-width: 560px) {
  .row { grid-template-columns: 46px minmax(0, 1fr); gap: 14px; padding: 18px 0; }
  .row::before { left: -10px; }
  .row-date b { font-size: 1.3rem; margin-top: 2px; }
  .row-title { font-size: 1.1rem; }
  .row-desc { font-size: .86rem; -webkit-line-clamp: 2; }
}

/* 工具条已移入主栏：宽度收在主栏内，搜索框跟着放大一点 */
.search { max-width: 620px; }
.hero p { max-width: 40em; }

/* 主栏顶部不要额外留白，靠工具栏自身的间距 */
.home-main > .toolbar:first-child { margin-top: 0; }

/* 月份再大一点、清楚一点 */
.row-date span { font-size: .72rem; opacity: .85; }

/* 两行副标题尽量等长，避免"不追热 / 点"这种断词 */
.hero p { text-wrap: balance; }

/* ===========================================================
   文章页底部：宽度跟正文走
   =========================================================== */
.post-nav { margin: 30px 0 34px; }
.post-nav a { padding: 16px 18px; }

/* 相关推荐改成分隔线列表，比三个独立卡片更像博客 */
.related { margin: 0 0 10px; }
.related-title { margin-bottom: 2px; font-size: .74rem; letter-spacing: .1em; }
.related-list { display: block; gap: 0; }
.related-item {
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  padding: 13px 2px;
  transition: color .18s, padding-left .18s;
}
.related-item:first-child { border-top: 1px solid var(--rule); }
.related-item:hover {
  border-color: var(--rule);
  transform: none;
  color: var(--primary-dp);
  padding-left: 8px;
}
.related-item .t { font-size: .92rem; }
.related-item .m { font-size: .72rem; }

/* 关于页：单栏阅读，限宽居中，别让内容缩在左边一条 */
.about-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 46px 0 70px;
}
.about-page .prose { max-width: none; }
.about-lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 10px 0 34px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 720px) {
  .about-page { padding: 30px 0 50px; }
}

/* 手机端工具条：搜索占满一行，排序按钮跟在下面右侧，别把输入框挤成一条缝 */
@media (max-width: 560px) {
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  /* 关键：flex-basis 在纵向布局里作用在高度上，不改这里搜索框会撑成 240px 高 */
  .toolbar .search { flex: 0 0 auto; max-width: none; width: 100%; }
  .toolbar-right { justify-content: flex-end; }
}

/* 手机端特稿：封面区不要占掉半屏 */
@media (max-width: 620px) {
  .feature { grid-template-columns: 1fr; }
  .feature-cover { min-height: 148px; }
  .feature-body { padding: 20px 20px 24px; }
  .feature-body h2 { font-size: 1.3rem; }
  .feature-body p { -webkit-line-clamp: 2; font-size: .9rem; }
}

/* 平板及以下：侧栏下沉到列表下方，改成两列并排，别一路竖着堆 */
@media (max-width: 1079px) {
  .home-side {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 26px 40px;
    padding: 26px 0 0;
    margin-top: 6px;
    border-top: 1px solid var(--rule);
  }
  .side-card { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
}
@media (max-width: 620px) {
  .home-side { grid-template-columns: 1fr; gap: 22px; padding-top: 20px; }
}

/* 平板：关于通栏，热门与订阅并排，避免订阅孤零零落在左下角 */
@media (min-width: 621px) and (max-width: 1079px) {
  .side-card.about { grid-column: 1 / -1; }
  .side-card.about .side-about p { max-width: 62ch; }
}
