/* ============================================================================
   博客前台样式
   设计原则：深色为主、双主题、移动端优先、不依赖任何外部字体或图标库。
   ========================================================================== */

:root {
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --surface: #161a23;
  --surface-2: #1d2230;
  --border: #262c3a;
  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --text-faint: #6b7688;
  --accent: #6ea8fe;
  --accent-strong: #4d8ef7;
  --accent-soft: rgba(110, 168, 254, 0.13);
  --danger: #ff6b6b;
  --ok: #4ade80;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.42);
  --wrap: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

/* 浅色主题 */
html[data-theme='light'] {
  --bg: #f7f8fa;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --border: #e2e6ee;
  --text: #1a1f2b;
  --text-dim: #5b6577;
  --text-faint: #8b94a6;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --shadow: 0 12px 32px rgba(20, 30, 60, 0.1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.75 var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.muted { color: var(--text-dim); font-size: 13.5px; }
.dot { margin: 0 6px; color: var(--text-faint); }

/* ------------------------------- 顶栏 --------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 13px 0;
}

.brand { display: flex; align-items: center; gap: 11px; color: inherit; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), #a86efe);
  color: #08101e; font-size: 19px; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--text-dim); font-size: 12px; }

.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link {
  color: var(--text-dim); font-size: 14.5px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  white-space: nowrap; transition: background .15s, color .15s;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link.is-active { color: var(--accent); background: var(--accent-soft); }

.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.icon-btn {
  appearance: none; border: 1px solid transparent; background: transparent;
  color: var(--text-dim); width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px; cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-toggle { display: none; }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px;
  padding: 8px 15px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-color: transparent; color: #06101f; font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(180deg, #82b6ff, var(--accent)); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: rgba(255,107,107,.14); border-color: rgba(255,107,107,.4); color: #ffb3b3; }

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

.main { padding: 28px 0 48px; flex: 1 0 auto; }

.layout-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 30px;
  align-items: start;
}
.content-col { min-width: 0; }

.sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 78px; }
.side-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.side-title {
  margin: 0 0 11px; font-size: 13px; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em;
}
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 0; font-size: 14px;
  border-bottom: 1px dashed var(--border);
}
.side-list li:last-child { border-bottom: none; }
.side-list a { color: var(--text); flex: 1; min-width: 0; }
.side-list a:hover { color: var(--accent); text-decoration: none; }
.side-count { color: var(--text-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.side-empty { color: var(--text-faint); font-size: 13.5px; margin: 0; }

.author-card { text-align: center; }
.author-avatar {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 10px;
  object-fit: cover; border: 2px solid var(--border);
}
.author-avatar-fallback {
  display: grid; place-items: center; font-size: 26px;
  background: var(--surface-2); color: var(--accent);
}
.author-name { margin: 0 0 6px; font-size: 16px; }
.author-bio { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); }
.author-links { display: flex; justify-content: center; gap: 12px; font-size: 13px; }

.chip-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px;
  transition: color .15s, border-color .15s;
}
.chip:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.chip-count { color: var(--text-faint); font-size: 11px; }

/* ------------------------------ 区块标题 ------------------------------- */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 0 16px;
}
.section-title { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .01em; }
.section-title .count { color: var(--text-faint); font-size: 14px; font-weight: 400; }
.section-head .more { font-size: 13.5px; color: var(--text-dim); white-space: nowrap; }
.section-head .more:hover { color: var(--accent); }

/* ------------------------------ 文章卡片 ------------------------------- */

.post-list { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.post-card:hover { border-color: #39415a; transform: translateY(-2px); box-shadow: var(--shadow); }
.post-card.has-cover { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; padding: 14px; }
.card-cover { border-radius: var(--radius-sm); overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; }
.card-body { min-width: 0; }
.card-title { margin: 0 0 8px; font-size: 18.5px; font-weight: 600; line-height: 1.45; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.pin { font-size: 13px; margin-left: 6px; }
.card-summary { margin: 0 0 12px; color: var(--text-dim); font-size: 14.5px; line-height: 1.7; }
.card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  font-size: 12.5px; color: var(--text-faint);
}
.card-meta a, .card-meta .meta-cat { color: var(--text-dim); }
.card-meta .chip { font-size: 11.5px; padding: 2px 8px; }

/* -------------------------------- 分页 --------------------------------- */

.pagination {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  justify-content: center; margin: 28px 0 8px;
}
.page-link {
  min-width: 36px; height: 36px; padding: 0 11px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text-dim);
}
.page-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-link.is-current { background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 600; }
.page-gap { color: var(--text-faint); padding: 0 2px; }

/* ------------------------------- 文章页 -------------------------------- */

.breadcrumb { font-size: 13px; color: var(--text-faint); margin-bottom: 16px; }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb .sep { margin: 0 7px; color: var(--text-faint); }

.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 34px; }
.post-header { padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.post-title { margin: 0 0 12px; font-size: 28px; line-height: 1.35; font-weight: 700; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-faint); }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* 目录 */
.toc {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 24px;
}
.toc-head { font-size: 12.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { padding: 3px 0; font-size: 14px; }
.toc-list .toc-lv3 { padding-left: 18px; font-size: 13.5px; }
.toc-list a { color: var(--text-dim); }
.toc-list a:hover { color: var(--accent); text-decoration: none; }

/* 正文排版 */
.post-body { font-size: 16px; line-height: 1.85; }
.post-body > *:first-child { margin-top: 0; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
  margin: 1.8em 0 .7em; line-height: 1.4; font-weight: 650;
  scroll-margin-top: 80px;
}
.post-body h1 { font-size: 25px; }
.post-body h2 {
  font-size: 21px; padding-bottom: .35em; border-bottom: 1px solid var(--border);
}
.post-body h3 { font-size: 18px; }
.post-body h4 { font-size: 16.5px; }
.post-body p { margin: 0 0 1.15em; }
.post-body ul, .post-body ol { margin: 0 0 1.15em; padding-left: 1.6em; }
.post-body li { margin: .35em 0; }
.post-body blockquote {
  margin: 0 0 1.15em; padding: 12px 18px;
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-dim);
}
.post-body blockquote > :last-child { margin-bottom: 0; }
.post-body img { border-radius: var(--radius-sm); margin: 1.2em auto; box-shadow: var(--shadow); }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.post-body table {
  width: 100%; border-collapse: collapse; margin: 0 0 1.3em;
  font-size: 14.5px; display: block; overflow-x: auto;
}
.post-body th, .post-body td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; }
.post-body th { background: var(--surface-2); font-weight: 600; }
.post-body a { text-decoration: underline; text-underline-offset: 2px; }
.post-body mark, .search-hit mark { background: rgba(110,168,254,.3); color: inherit; padding: 0 3px; border-radius: 3px; }

/* 行内代码 */
.post-body code {
  font-family: var(--mono); font-size: .875em;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px;
}

/* 代码块（高亮的 token 配色） */
.code-block {
  margin: 0 0 1.3em; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-soft);
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 13px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.code-lang { font-size: 12px; color: var(--text-faint); font-family: var(--mono); text-transform: lowercase; }
.code-copy {
  appearance: none; border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font: inherit; font-size: 12px;
  padding: 2px 9px; border-radius: 6px; cursor: pointer;
}
.code-copy:hover { color: var(--accent); border-color: var(--accent); }
.code-copy.is-done { color: var(--ok); border-color: var(--ok); }
.code-body {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.65;
  background: transparent;
}
.code-body code { background: none; border: none; padding: 0; font-size: inherit; }

.tok-keyword { color: #ff7ab2; }
.tok-string  { color: #9ae26a; }
.tok-comment { color: var(--text-faint); font-style: italic; }
.tok-number  { color: #ffb86c; }
.tok-tag     { color: #ff7ab2; }
.tok-function { color: #6ea8fe; }
.tok-builtin { color: #c792ea; }
.tok-doctype { color: var(--text-faint); }

html[data-theme='light'] .tok-keyword { color: #c2185b; }
html[data-theme='light'] .tok-string  { color: #2e7d32; }
html[data-theme='light'] .tok-number  { color: #e65100; }
html[data-theme='light'] .tok-function { color: #1565c0; }
html[data-theme='light'] .tok-builtin { color: #6a1b9a; }

/* 上一篇/下一篇 */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0 0; }
.pn-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 5px;
}
.pn-item:hover { border-color: var(--accent); text-decoration: none; }
.pn-item span { font-size: 12.5px; color: var(--text-faint); }
.pn-item b { font-size: 14.5px; font-weight: 500; color: var(--text); }
.pn-next { text-align: right; }

/* 相关文章 */
.related { margin-top: 26px; }
.related-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.related-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 15px;
  display: flex; flex-direction: column; gap: 5px;
}
.related-item:hover { border-color: var(--accent); text-decoration: none; }
.related-item b { font-size: 14.5px; font-weight: 500; }
.related-item small { color: var(--text-faint); font-size: 12.5px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

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

.comments { margin-top: 30px; }
.comment-list, .comment-children { list-style: none; margin: 0; padding: 0; }
.comment-children { margin: 12px 0 0 22px; padding-left: 16px; border-left: 2px solid var(--border); }
.comment {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 18px; margin-bottom: 12px;
}
.c-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }
.c-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.c-author { font-size: 14.5px; font-weight: 600; color: var(--text); }
.c-time { font-size: 12.5px; color: var(--text-faint); margin-left: auto; }
.c-reply {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--text-faint); font: inherit; font-size: 12.5px; padding: 2px 4px;
}
.c-reply:hover { color: var(--accent); }
.c-body { font-size: 14.5px; line-height: 1.75; color: var(--text-dim); word-break: break-word; }

.comment-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-top: 18px;
}
.cf-title { margin: 0 0 14px; font-size: 16px; }
.cf-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  font-size: 13.5px; color: var(--text-dim); background: var(--accent-soft);
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.cf-cancel {
  appearance: none; border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font: inherit; font-size: 12.5px;
  padding: 2px 9px; border-radius: 6px; cursor: pointer; margin-left: auto;
}
.cf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text-dim); }
.field i { color: var(--danger); font-style: normal; }

.input {
  appearance: none; background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 14.5px;
  padding: 9px 12px; border-radius: var(--radius-sm); min-width: 0; width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 110px; font-size: 15px; line-height: 1.7; }

.cf-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.cf-hint { font-size: 12.5px; color: var(--text-faint); }
.cf-error {
  margin: 12px 0 0; font-size: 13.5px; color: #ffb3b3;
  background: rgba(255,107,107,.13); border: 1px solid rgba(255,107,107,.35);
  border-radius: var(--radius-sm); padding: 8px 12px;
}

/* ------------------------------ 标签/分类 ------------------------------ */

.tag-cloud { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tag-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 15px;
}
.tag-item:hover { border-color: var(--accent); text-decoration: none; }
.tag-name { color: var(--text); font-size: 14.5px; }
.tag-count { color: var(--text-faint); font-size: 12.5px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 5px;
}
.cat-card:hover { border-color: var(--accent); text-decoration: none; }
.cat-name { font-size: 16px; font-weight: 600; color: var(--text); }
.cat-count { font-size: 12.5px; color: var(--text-faint); }
.cat-desc { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.cat-intro { color: var(--text-dim); margin: 0 0 18px; }

/* -------------------------------- 归档 --------------------------------- */

.archive-item { margin-bottom: 26px; }
.archive-month {
  font-size: 16px; margin: 0 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li {
  display: flex; gap: 14px; padding: 7px 0; font-size: 14.5px;
  border-bottom: 1px dashed var(--border);
}
.archive-list li:last-child { border-bottom: none; }
.archive-list time { color: var(--text-faint); font-variant-numeric: tabular-nums; flex: none; font-size: 13.5px; }
.archive-list a { color: var(--text); }
.archive-list a:hover { color: var(--accent); text-decoration: none; }

/* -------------------------------- 搜索 --------------------------------- */

.search-form { display: flex; gap: 10px; margin-bottom: 22px; }
.search-form .input { flex: 1; font-size: 15px; }

/* -------------------------------- 关于 --------------------------------- */

.page-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 34px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; margin: 22px 0 26px; }
.about-item {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px; text-align: center;
}
.about-item b { display: block; font-size: 24px; color: var(--accent); font-variant-numeric: tabular-nums; }
.about-item span { font-size: 12.5px; color: var(--text-dim); }
.prose { font-size: 15.5px; line-height: 1.85; }
.prose h2 { font-size: 19px; margin: 1.6em 0 .6em; }
.prose ul { padding-left: 1.5em; }
.prose li { margin: .35em 0; }
.prose code { font-family: var(--mono); font-size: .875em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }

/* -------------------------------- 相册 --------------------------------- */

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.gallery-item {
  margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .18s, border-color .18s;
}
.gallery-item:hover { transform: translateY(-2px); border-color: #39415a; }
.gallery-link { display: block; }
.gallery-link img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.gallery-cap {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  font-size: 12.5px; color: var(--text-dim);
}
.g-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.g-meta { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
.g-dl { color: var(--text-dim); font-size: 15px; }
.g-dl:hover { color: var(--accent); }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 6, 10, .94); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 28px;
}
.lb-figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb-figure img {
  /*
   * width 必须显式给。容器是 flex + align-items:center，图片没设宽度时按自身
   * 内在尺寸渲染，浏览器据此推断不出真实显示宽度，srcset 就会挑大一号的档位
   * （实测手机端因此拉了 1600 档 392 KB，而 800 档只要 134 KB）。
   * 给了宽度后它能算出「显示 395px × DPR2 = 790px」，才会正确选 800 档。
   */
  width: 100%;
  max-width: min(1500px, 94vw); max-height: 80vh; object-fit: contain;
  border-radius: var(--radius-sm); box-shadow: var(--shadow); background: var(--surface);
}
.lb-figure figcaption { color: rgba(232,236,244,.75); font-size: 13.5px; text-align: center; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; appearance: none; border: 1px solid var(--border);
  background: rgba(22,26,35,.9); color: #e8ecf4;
  width: 44px; height: 44px; border-radius: 50%; font-size: 22px;
  cursor: pointer; display: grid; place-items: center;
}
.lb-close { top: 20px; right: 20px; font-size: 18px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

/*
 * 「下载原图」按钮。
 * 灯箱里看到的是压缩后的展示图（原图的 1/20 左右），想拿原始文件就点这里，
 * 所以它必须显眼但不抢画面——放在底部居中，与上一张/下一张的大按钮区分开。
 */
.lb-download {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--border); background: rgba(22,26,35,.9);
  color: #e8ecf4; text-decoration: none; white-space: nowrap;
}
.lb-download:hover { background: rgba(38,44,58,.95); border-color: var(--accent); color: #fff; }

/* -------------------------------- 音乐 --------------------------------- */

.tracklist { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.track {
  display: grid; grid-template-columns: 38px minmax(0, 2fr) minmax(0, 1.2fr) 70px 40px;
  align-items: center; gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .14s;
}
.track:last-child { border-bottom: none; }
.track:hover { background: var(--surface-2); }
.track.is-playing { background: var(--accent-soft); }
.track.is-playing .t-title { color: var(--accent); }
.t-index { color: var(--text-faint); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.t-main { display: flex; flex-direction: column; min-width: 0; }
.t-title { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-artist { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-album { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-time { font-size: 13px; color: var(--text-dim); text-align: right; font-variant-numeric: tabular-nums; }

.player {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.player-inner {
  width: min(var(--wrap), 100% - 40px); margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 1.5fr) auto;
  align-items: center; gap: 20px; height: 80px;
}
.p-now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.p-cover {
  width: 46px; height: 46px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 19px; color: var(--accent);
  background: linear-gradient(145deg, var(--surface-2), var(--bg-soft));
  border: 1px solid var(--border);
}
.p-meta { display: flex; flex-direction: column; min-width: 0; }
.p-meta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta small { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-center { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.p-controls { display: flex; align-items: center; gap: 6px; }
.icon-btn-main {
  width: 44px; height: 44px; border-radius: 50%; font-size: 18px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong)); color: #06101f;
}
.icon-btn-main:hover { background: linear-gradient(180deg, #82b6ff, var(--accent)); color: #06101f; }
.p-progress { display: flex; align-items: center; gap: 10px; width: 100%; }
.time { font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 36px; }
.time:last-child { text-align: right; }
.seek { flex: 1; height: 16px; display: flex; align-items: center; cursor: pointer; }
.seek-bg { position: relative; width: 100%; height: 4px; border-radius: 999px; background: var(--surface-2); overflow: visible; }
.seek-fill { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #a86efe); }
.p-right { display: flex; align-items: center; gap: 4px; }
body.has-player { padding-bottom: 92px; }

/* ------------------------------- 404 ---------------------------------- */

.notfound { text-align: center; padding: 70px 20px; }
.nf-code { font-size: 74px; font-weight: 700; margin: 0; color: var(--accent); line-height: 1; }
.nf-title { font-size: 21px; margin: 14px 0 8px; }
.nf-hint { color: var(--text-dim); margin: 0 0 22px; }
.nf-actions { display: flex; gap: 10px; justify-content: center; }

/* ------------------------------ 首页相册带 ------------------------------ */

.home-gallery { margin-top: 34px; }
.thumb-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; aspect-ratio: 1/1; object-fit: cover; transition: transform .25s; }
.thumb:hover img { transform: scale(1.06); }

/* ------------------------------- 提示 --------------------------------- */

.empty { color: var(--text-faint); text-align: center; padding: 34px 0; font-size: 14.5px; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-faint); }
.empty-state p { margin: 0 0 6px; font-size: 15px; }
.empty-state small { font-size: 13px; }

.toast-area { position: fixed; top: 16px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13.5px;
  box-shadow: var(--shadow); max-width: 340px;
}
.toast.err { border-color: rgba(255,107,107,.45); }
.toast.ok { border-color: rgba(74,222,128,.4); }

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

.site-footer { border-top: 1px solid var(--border); padding: 22px 0; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-faint);
}
.footer-right { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.footer-right a { color: var(--text-dim); }
/* 备案号带图标时，图标跟文字对齐、不撑行高 */
.footer-right .beian { display: inline-flex; align-items: center; gap: 5px; }
.footer-right .beian-icon { display: block; border-radius: 2px; }

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

@media (max-width: 980px) {
  .layout-with-sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  .post-card.has-cover { grid-template-columns: minmax(0, 1fr); }
  .card-cover img { aspect-ratio: 16/9; }
}

@media (max-width: 720px) {
  .wrap { width: calc(100% - 28px); }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px; padding: 10px 14px 14px;
    background: var(--bg-soft); border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav-toggle { display: grid; }
  .topbar-inner { position: relative; }
  .brand-text small { display: none; }
  .post, .page-article { padding: 20px 18px; }
  .post-title { font-size: 22px; }
  .post-body { font-size: 15.5px; }
  .cf-grid { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .pn-next { text-align: left; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .track { grid-template-columns: 30px minmax(0, 1fr) 60px; }
  .t-album, .track .icon-btn { display: none; }
  .player-inner { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'now right' 'center center'; height: auto; padding: 10px 0; row-gap: 8px; }
  .p-now { grid-area: now; }
  .p-center { grid-area: center; }
  .p-right { grid-area: right; }
}

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

@media print {
  .topbar, .sidebar, .site-footer, .comment-form, .post-nav, .related, .toc { display: none; }
  .post { border: none; padding: 0; }
}
