/* ====================================================
   Z-BLOG Desktop Styles
   ==================================================== */

/* ── CSS 变量 ────────────────────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --surface-2:      #f1f5f9;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-link:      #2563eb;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08);
  --radius:         10px;
  --transition:     .2s ease;
  --header-h:       60px;

  /* category colors */
  --c-article: #28a745;
  --c-image:   #0969da;
  --c-video:   #d73a49;
  --c-note:    #6f42c1;
  --c-link:    #e36209;
}

/* 系统暗黑偏好（未手动设置时生效） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #2b2b2b;   /* Darcula 背景，温暖深灰 */
    --surface:    #3c3f41;   /* 卡片/面板背景 */
    --surface-2:  #454a4d;   /* hover 态，略亮 */
    --border:     #585c60;   /* 边框，可见但不刺眼 */
    --text:       #d0d4d9;   /* 主文字：亮度83%，清晰不刺眼 */
    --text-muted: #90959a;   /* 次要文字：日期/摘要，层次分明 */
    --text-link:  #6b9de8;   /* 链接：IntelliJ 蓝，深色背景可见 */
    --shadow-sm:  0 1px 4px rgba(0,0,0,.45);
    --shadow-md:  0 4px 14px rgba(0,0,0,.55);
  }
}

/* 手动切换暗黑模式（IDEA Darcula + 舒适度优化） */
:root[data-theme="dark"] {
  --bg:         #2b2b2b;
  --surface:    #3c3f41;
  --surface-2:  #454a4d;
  --border:     #585c60;
  --text:       #d0d4d9;
  --text-muted: #90959a;
  --text-link:  #6b9de8;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.45);
  --shadow-md:  0 4px 14px rgba(0,0,0,.55);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.layout { display: grid; grid-template-columns: 1fr 280px; gap: 28px; padding-top: 28px; padding-bottom: 60px; }

/* ── Header ──────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header__inner {
  display: flex; align-items: center; gap: 16px;
  height: 100%;
}
.header__logo {
  font-weight: 700; font-size: 1.25rem; color: var(--primary);
  letter-spacing: -.5px; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.header__logo:hover { text-decoration: none; }
.header__nav {
  display: flex; gap: 2px; flex: 1;
}
.header__nav-item {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px;
  font-size: .875rem; color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  background: none; border: none;
  cursor: pointer; font-family: inherit;
}
.header__nav-item svg { flex-shrink: 0; opacity: .75; }
.header__nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.header__nav-item:hover svg { opacity: 1; }
.header__nav-item.active {
  background: var(--surface-2); color: var(--primary);
  font-weight: 600;
}
.header__nav-item.active svg { opacity: 1; }
.header__search {
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1.5px solid var(--border);
  padding: 4px 0;
  transition: border-color var(--transition);
}
.header__search:focus-within { border-color: var(--primary); }
.header__search-icon { color: var(--text-muted); flex-shrink: 0; }
.header__search input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: .875rem; width: 140px;
}
.header__search input::placeholder { color: var(--text-muted); }

/* ── Theme Toggle Button ──────────────────────────────── */
.header__theme-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform .15s ease;
  position: relative; overflow: hidden;
}
.header__theme-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--primary);
  transform: scale(1.05);
}
.header__theme-btn svg {
  position: absolute;
  transition: opacity .2s ease, transform .3s ease;
}
.header__theme-btn .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
.header__theme-btn .icon-sun  { opacity: 0; transform: rotate(90deg) scale(.6); }
[data-theme="dark"] .header__theme-btn .icon-moon { opacity: 0; transform: rotate(-90deg) scale(.6); }
[data-theme="dark"] .header__theme-btn .icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .header__theme-btn .icon-moon { opacity: 0; transform: rotate(-90deg) scale(.6); }
  html:not([data-theme="light"]) .header__theme-btn .icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
}

/* ── Color Picker Button ──────────────────────────────── */
.header__color-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2);
  transition: background var(--transition), border-color var(--transition), transform .15s ease;
  position: relative;
}
.header__color-btn:hover {
  background: var(--surface); border-color: var(--primary);
  transform: scale(1.05);
}
.header__color-btn__ring {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--primary);
  background: transparent;
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--primary) 25%, transparent);
  transition: border-color .2s, box-shadow .2s;
  pointer-events: none;
}

/* ── Color Picker Popup ──────────────────────────────────── */
.color-picker-popup {
  position: absolute; top: calc(var(--header-h) + 6px); right: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0,0,0,.04);
  z-index: 200; width: 196px;
  opacity: 0; transform: translateY(-8px) scale(.97);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.color-picker-popup.open {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}
.color-picker-popup__label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 10px;
}
.color-swatches {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  margin-bottom: 12px;
}
.color-swatch {
  width: 100%; aspect-ratio: 1; border-radius: 6px;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
  position: relative;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}
.color-picker-popup__divider {
  height: 1px; background: var(--border); margin-bottom: 12px;
}
.color-picker-custom {
  display: flex; align-items: center; gap: 8px;
}
.color-picker-custom__label {
  font-size: .78rem; color: var(--text-muted); flex: 1;
}
.color-picker-custom input[type="color"] {
  width: 32px; height: 26px; border-radius: 6px;
  border: 1px solid var(--border); padding: 2px;
  cursor: pointer; background: var(--surface-2);
}
.color-picker-custom__reset {
  font-size: .72rem; color: var(--text-muted);
  background: none; border: 1px solid var(--border);
  border-radius: 5px; padding: 3px 7px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.color-picker-custom__reset:hover { color: var(--primary); border-color: var(--primary); }

/* ── Main area ───────────────────────────────────────────── */
.main { min-width: 0; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.sidebar > .section-header { margin-bottom: 0; }
.sidebar-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm);
}
.sidebar-card__title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 14px;
}
.sidebar-card__avatar-link { display: block; width: fit-content; margin: 0 auto 14px; }
.sidebar-card__avatar {
  width: 80px; height: 80px; border-radius: 50%;
  display: block;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  transition: transform var(--transition), box-shadow var(--transition);
}
.sidebar-card__avatar-link:hover .sidebar-card__avatar {
  transform: scale(1.06); box-shadow: 0 4px 18px rgba(0,0,0,.15);
}
.sidebar-card__name {
  font-weight: 700; text-align: center; font-size: 1.05rem;
  color: var(--text);
}
.sidebar-card__handle {
  text-align: center; font-size: .78rem; color: var(--text-muted);
  margin-top: 2px; font-weight: 400;
}
.sidebar-card__handle {
  text-align: center; font-size: .78rem;
  color: var(--primary); margin-top: 2px; font-weight: 500;
}
.sidebar-card__desc {
  font-size: .8rem; color: var(--text-muted); text-align: center;
  margin-top: 8px; line-height: 1.6;
  padding: 0 4px;
}
.sidebar-card__metas {
  display: flex; flex-direction: column; gap: 5px;
  margin-top: 12px; align-items: center;
}
.sidebar-card__meta {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; color: var(--text-muted);
}
.sidebar-card__meta a { color: var(--text-muted); text-decoration: none; }
.sidebar-card__meta a:hover { color: var(--primary); }
.sidebar-meta-icon { display: flex; align-items: center; flex-shrink: 0; color: var(--text-muted); }
.sidebar-tags-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-card__stats {
  display: flex; justify-content: center; gap: 16px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sidebar-stat {
  display: flex; align-items: center; gap: 5px;
  font-size: .82rem; color: var(--text-muted); text-decoration: none;
  transition: color var(--transition);
}
.sidebar-stat:hover { color: var(--text); text-decoration: none; }
.sidebar-stat svg { color: var(--text-muted); }
.sidebar-stat:hover svg { color: var(--text); }
.sidebar-card__github-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 14px; padding: 7px 0;
  font-size: .82rem; font-weight: 600; color: var(--text);
  background: var(--surface-2); border-radius: 6px;
  text-decoration: none; transition: background var(--transition), color var(--transition);
}
.sidebar-card__github-btn:hover { background: var(--text); color: var(--surface); text-decoration: none; }
.sidebar-card__github-btn:hover svg { color: var(--surface); }
.sidebar-card__link {
  display: block; margin-top: 12px; text-align: center;
  font-size: .8rem; color: var(--primary);
  padding: 6px 0; border-top: 1px solid var(--border);
}

/* Category list in sidebar */
.cat-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cat-list__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  transition: background var(--transition);
  background: none; border: none; width: 100%;
  font-family: inherit; font-size: .875rem; color: var(--text);
  text-align: left;
}
.cat-list__item:hover { background: var(--surface-2); }
.cat-list__item.active { background: var(--primary)18; color: var(--primary); font-weight: 600; }
.cat-list__icon { font-size: 1rem; width: 20px; text-align: center; }
.cat-list__name { flex: 1; }
.cat-list__count {
  font-size: .75rem; background: var(--surface-2);
  border-radius: 99px; padding: 1px 7px; color: var(--text-muted);
}
/* 标签圆点（替代 emoji 图标） */
.tag-dot {
  width: 10px; height: 10px; border-radius: 50%;
  font-size: 0 !important; flex-shrink: 0;
  display: inline-block;
}
.tag-count-loading { opacity: .45; }
.cat-list__item[data-tag].active {
  background: color-mix(in srgb, var(--tag-color, var(--primary)) 12%, transparent);
  color: var(--tag-color, var(--primary));
  font-weight: 600;
}

/* 激活标签提示条（PC 列表顶部） */
.tag-active-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; padding: 9px 14px;
  background: #eff6ff; border-radius: 8px;
  border: 1.5px solid #bfdbfe;
}
.tag-active-bar__label { flex: 1; font-size: .875rem; font-weight: 600; color: #1d4ed8; }
.tag-active-bar__clear {
  font-size: .8rem; color: #94a3b8; cursor: pointer;
  background: none; border: none; padding: 2px 8px;
  border-radius: 4px; transition: background var(--transition);
}
.tag-active-bar__clear:hover { background: #dbeafe; color: #1d4ed8; }

/* ── Moments-style Feed ──────────────────────────────────── */
.post-list { display: flex; flex-direction: column; gap: 10px; }

.moment-card {
  background: var(--surface);
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.moment-card:hover { background: var(--surface-2); }

.moment-card__author {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.moment-card__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background: var(--border);
}
.moment-card__username {
  font-size: .8rem; font-weight: 600; color: var(--text); flex: 1;
}
.moment-card__date { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; }

.moment-card__title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  line-height: 1.5; word-break: break-word;
}
.moment-card__badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.moment-card__excerpt {
  font-size: .85rem; color: var(--text-muted); line-height: 1.5;
  margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* 九宫格图片 */
.moment-grid { display: grid; gap: 3px; margin: 10px 0; }
.moment-grid--one  { grid-template-columns: 1fr;           max-width: 260px; }
.moment-grid--two  { grid-template-columns: repeat(2, 1fr); max-width: 200px; }
.moment-grid--three{ grid-template-columns: repeat(3, 1fr); max-width: 220px; }
.moment-grid--four { grid-template-columns: repeat(2, 1fr); max-width: 200px; }
.moment-grid--many { grid-template-columns: repeat(3, 1fr); max-width: 220px; }
.moment-grid__item { overflow: hidden; aspect-ratio: 1; }
.moment-grid--one .moment-grid__item { aspect-ratio: 4/3; }
.moment-grid__item img {
  width: 100%; height: 100%; object-fit: cover;
  cursor: zoom-in; transition: transform .25s;
}
.moment-grid__item:hover img { transform: scale(1.05); }

.moment-grid__more {
  background: rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer;
}
.moment-grid__more-num { font-size: 1.4rem; font-weight: 700; color: #fff; line-height: 1.1; }
.moment-grid__more-sub { font-size: .7rem; color: rgba(255,255,255,.8); margin-top: 2px; }

.moment-card__photos-link {
  display: block; margin-top: 8px;
  font-size: .8rem; color: var(--primary);
}
.moment-card__photos-link:hover { text-decoration: underline; }

.moment-card__footer {
  display: flex; justify-content: flex-end; align-items: center;
  margin-top: 8px;
}
.moment-card__date     { font-size: .78rem; color: var(--text-muted); }
.moment-card__comments { font-size: .78rem; color: var(--text-muted); }

/* ── 视频嵌入播放器 ──────────────────────────────────────── */
.video-list { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }
.video-embed {
  position: relative; width: 100%; padding-bottom: 56.25%; /* 16:9 */
  border-radius: 10px; overflow: hidden; background: #000;
}
.video-embed iframe,
.video-embed video {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
}
.video-embed--direct { padding-bottom: 0; }
.video-embed--direct video {
  position: static; border-radius: 10px;
  width: 100%; height: auto; max-height: 480px;
  background: #000;
}

/* ── GitHub Labels ────────────────────────────────────────── */
.gh-label {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 99px; font-size: .75rem;
  font-weight: 600; border: 1px solid; white-space: nowrap;
}

/* ── Badges & Tags (Ant Design Tag style) ────────────────── */
.badge, .tag {
  display: inline-flex; align-items: center;
  padding: 0 7px; height: 22px; line-height: 22px;
  border-radius: 4px; font-size: 12px;
  border: 1px solid; white-space: nowrap;
  box-sizing: border-box;
}
.badge { font-weight: 600; }
.tag { font-weight: 500; }

/* ── Post Detail ─────────────────────────────────────────── */
.post-detail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.post-detail__header { padding: 32px 36px 24px; border-bottom: 1px solid var(--border); }
.post-detail__badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.post-detail__title { font-size: 1.6rem; font-weight: 800; line-height: 1.3; margin-bottom: 14px; }
.post-detail__meta {
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; color: var(--text-muted); flex-wrap: wrap;
}
.post-detail__avatar { width: 28px; height: 28px; border-radius: 50%; }
.post-detail__github-link { margin-left: auto; color: var(--primary); font-size: .8rem; }

.post-detail__content { padding: 32px 36px; }
.post-detail__footer { padding: 24px 36px; border-top: 1px solid var(--border); text-align: center; }

/* ── Markdown Body ────────────────────────────────────────── */
.markdown-body { color: var(--text); line-height: 1.8; }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  margin: 1.6em 0 .8em; font-weight: 700; line-height: 1.3;
  padding-bottom: .3em; border-bottom: 1px solid var(--border);
}
.markdown-body h1 { font-size: 1.7rem; }
.markdown-body h2 { font-size: 1.4rem; }
.markdown-body h3 { font-size: 1.15rem; border-bottom: none; }
.markdown-body p { margin: 0 0 1em; }
.markdown-body ul, .markdown-body ol { margin: 0 0 1em 1.5em; }
.markdown-body li { margin: .3em 0; }
.markdown-body blockquote {
  margin: 1em 0; padding: .5em 1em;
  border-left: 4px solid var(--primary);
  background: var(--surface-2); border-radius: 0 6px 6px 0;
  color: var(--text-muted);
}
.markdown-body code {
  background: var(--surface-2); padding: .15em .4em;
  border-radius: 4px; font-size: .875em; font-family: 'SFMono-Regular', Consolas, monospace;
}
.markdown-body pre {
  background: #1e293b; color: #e2e8f0;
  padding: 1.2em 1.4em; border-radius: 8px; overflow-x: auto;
  margin: 1em 0; font-size: .875rem; line-height: 1.6;
}
.markdown-body pre code { background: none; padding: 0; color: inherit; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.markdown-body th, .markdown-body td {
  padding: .6em 1em; border: 1px solid var(--border); text-align: left;
}
.markdown-body th { background: var(--surface-2); font-weight: 600; }
.markdown-body img { border-radius: 8px; margin: 1em auto; }
.markdown-body a { color: var(--primary); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* ── Image Gallery ────────────────────────────────────────── */
.image-gallery {
  display: grid; gap: 10px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.image-gallery__item {
  border-radius: 8px; overflow: hidden; cursor: zoom-in;
  aspect-ratio: 4/3; background: var(--surface-2);
}
.image-gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.image-gallery__item:hover img { transform: scale(1.05); }

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.92); align-items: center; justify-content: center;
}
.lightbox--open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 4px; object-fit: contain; }
.lightbox__close {
  position: absolute; top: 18px; right: 22px;
  color: #fff; font-size: 2rem; cursor: pointer; line-height: 1;
  background: none; border: none;
}

/* ── Link Cards ───────────────────────────────────────────── */
.link-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.link-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.link-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); text-decoration: none; }
.link-card__icon { font-size: 1.2rem; }
.link-card__title { flex: 1; font-weight: 600; color: var(--text); }
.link-card__host { font-size: .8rem; color: var(--text-muted); }

/* ── 收藏链接页（PC）──────────────────────────────────────── */
.links-grid-pc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.lk {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  text-decoration: none; overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.lk:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.lk__ico {
  width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
}
.lk__name {
  font-size: .8rem; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── 链接页内的主题标签网格 ─────────────────────────────── */
.tags-grid-pc {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tag-pc {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 8px; height: 28px; line-height: 28px;
  border-radius: 4px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--tc, #64748b) 40%, transparent);
  background: color-mix(in srgb, var(--tc, #64748b) 8%, var(--surface));
  color: var(--tc, #64748b);
  font-family: inherit; font-size: .82rem; font-weight: 500;
  transition: all var(--transition);
}
.tag-pc:hover {
  border-color: var(--tc, #64748b);
  background: color-mix(in srgb, var(--tc, #64748b) 15%, var(--surface));
}
.tag-pc__name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag-pc__count {
  font-size: .72rem; opacity: .7;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: .875rem;
  font-weight: 500; border: none; cursor: pointer; transition: all var(--transition);
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--outline {
  background: transparent; color: var(--primary);
  border: 1px solid var(--primary);
}
.btn--outline:hover { background: var(--primary); color: #fff; }
.btn--ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 28px;
}
.pagination__page { font-size: .875rem; color: var(--text-muted); }

/* ── Back button ──────────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 20px; color: var(--text-muted); font-size: .875rem;
  background: none; border: none; cursor: pointer; padding: 6px 10px;
  border-radius: 6px; transition: background var(--transition), color var(--transition);
}
.back-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── Section header ───────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-header__title {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.section-header__sub { font-size: .875rem; color: var(--text-muted); }

/* ── 标签筛选条 ────────────────────────────────────────────── */
.tag-filter {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}
.tag-filter__chip {
  padding: 4px 14px; border-radius: 99px; font-size: .78rem; font-weight: 500;
  border: 1.5px solid #e2e8f0; background: transparent; color: #64748b;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.tag-filter__chip:hover { background: #f1f5f9; }
.tag-filter__chip--active {
  background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); color: #fff;
}

/* ── Skeleton ─────────────────────────────────────────────── */
.skeleton-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px; height: 14px;
}
.skeleton--line { width: 100%; }
.skeleton--short { width: 30%; }
.skeleton--medium { width: 65%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Empty / Error state ──────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state__icon { display: block; margin-bottom: 12px; color: var(--text-muted); }
.error-msg {
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  border-radius: 8px; padding: 16px 20px; font-size: .875rem;
}
@media (prefers-color-scheme: dark) {
  .error-msg { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 10px 20px;
  border-radius: 99px; font-size: .875rem; z-index: 9999;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast--show { opacity: 1; }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border); padding: 24px 0;
  text-align: center; color: var(--text-muted); font-size: .8rem;
  margin-top: auto;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--primary); }

/* 备案信息 */
.footer__beian {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 16px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.footer__beian:empty { display: none; }
.beian-item {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-muted); font-size: .75rem;
  text-decoration: none; transition: color var(--transition);
  white-space: nowrap;
}
.beian-item:hover { color: var(--primary); text-decoration: none; }
.beian-item svg { flex-shrink: 0; opacity: .7; }
.beian-item:hover svg { opacity: 1; }


/* ── Responsive ───────────────────────────────────────────── */

/* 汉堡按钮（桌面隐藏） */
.header__hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 4.5px; width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2);
  transition: background var(--transition), border-color var(--transition);
}
.header__hamburger:hover { background: var(--surface); border-color: var(--primary); }
.hamburger-line {
  display: block; width: 16px; height: 1.5px;
  background: var(--text-muted); border-radius: 2px;
  transition: transform .22s ease, opacity .22s ease, width .22s ease;
}
.header__hamburger.open .hamburger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.header__hamburger.open .hamburger-line:nth-child(2) { opacity: 0; width: 0; }
.header__hamburger.open .hamburger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* 移动端导航面板 */
.mobile-nav-panel {
  display: none;
  position: sticky; top: var(--header-h); z-index: 99;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden; max-height: 0;
  transition: max-height .28s cubic-bezier(.4,0,.2,1), padding .28s ease;
}
.mobile-nav-panel.open { max-height: 360px; padding: 12px 0 16px; }
.mobile-nav-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--surface-2);
}
.mobile-nav-search svg { color: var(--text-muted); flex-shrink: 0; }
.mobile-nav-search input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: .9rem; width: 100%;
}
.mobile-nav-search input::placeholder { color: var(--text-muted); }
.mobile-nav-links {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.mobile-nav-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 20px;
  font-size: .85rem; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.mobile-nav-item:hover, .mobile-nav-item.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ── 平板适配 (≤960px) ──────────────────────── */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .sidebar { order: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 0; }
  .sidebar-card { margin-top: 0 !important; }
  .sidebar > .section-header { display: none; }
}

/* ── 手机适配 (≤768px) ──────────────────────── */
@media (max-width: 768px) {
  /* Header */
  .header__nav   { display: none; }
  .header__search { display: none; }
  .header__hamburger { display: flex; }
  .mobile-nav-panel  { display: block; }
  .header__logo { font-size: 1.1rem; }

  /* Layout */
  .container { padding: 0 14px; }
  .layout { padding-top: 16px; padding-bottom: 40px; gap: 16px; }

  /* Sidebar: 单列，移到内容下方 */
  .sidebar { grid-template-columns: 1fr; order: 1; }

  /* Post cards */
  .moment-card { padding: 14px 16px; }
  .moment-card__title { font-size: 1rem; }
  .moment-card__thumb { width: 70px; height: 70px; }

  /* Section header */
  .section-header { flex-wrap: wrap; gap: 6px; }
  .section-header__title { font-size: 1rem; }

  /* Post detail */
  .post-detail__header,
  .post-detail__content,
  .post-detail__footer { padding: 16px; }
  .post-detail__title { font-size: 1.25rem; }
  .post-detail__content { font-size: .9rem; }
  .post-detail__content pre { font-size: .8rem; overflow-x: auto; }

  /* Pagination */
  .pagination { gap: 6px; }
  .pagination button { padding: 6px 10px; font-size: .8rem; }

  /* Footer */
  .footer { padding: 16px 0; font-size: .75rem; }
  .footer__beian { gap: 10px; }

  /* Photo wall */
  .pw-grid { grid-template-columns: repeat(3, 1fr); gap: 3px; }

  /* Color picker popup */
  .color-picker-popup { right: 10px; }

  /* Lightbox nav buttons */
  .photo-lightbox__nav { width: 36px; height: 36px; font-size: 1.4rem; }
}

/* ── 小屏手机 (≤480px) ──────────────────────── */
@media (max-width: 480px) {
  .header__inner { gap: 10px; }
  .header__theme-btn, .header__color-btn { width: 30px; height: 30px; }
  .header__hamburger { width: 30px; height: 30px; }
  .layout { padding-top: 12px; }
  .moment-card__thumb { display: none; }
  .pw-grid { grid-template-columns: repeat(2, 1fr); }
  .post-detail__title { font-size: 1.1rem; }
  .section-header__title { font-size: .95rem; }
}

/* ── 思考时间线 ──────────────────────────────────────────────── */
.timeline-list {
  --tl-color: #d73a49;
  padding: 4px 0 40px;
}
.tl-year-group { margin-bottom: 4px; }
.tl-year {
  padding: 12px 0 8px 32px;
  font-size: .7rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.tl-item {
  display: flex; cursor: pointer; padding: 2px 0;
  border-radius: 8px; transition: background .15s;
}
.tl-item:hover { background: var(--surface-2); }
.tl-item:hover .tl-title { color: var(--primary); }

.tl-left {
  width: 32px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 6px;
}
.tl-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--tl-color);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--tl-color);
  flex-shrink: 0; z-index: 1;
  transition: transform .15s;
}
.tl-item:hover .tl-dot { transform: scale(1.3); }
.tl-line {
  width: 2px; flex: 1; min-height: 16px;
  background: var(--border); margin-top: 4px;
}
.tl-item:last-child .tl-line { opacity: 0; }

.tl-body { flex: 1; padding: 2px 8px 20px 10px; }
.tl-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 5px;
}
.tl-date { font-size: .72rem; color: var(--text-muted); }
.tl-tag {
  display: inline-flex; align-items: center;
  padding: 0 5px; height: 17px; line-height: 17px;
  font-size: .68rem; border-radius: 3px; border: 1px solid;
  white-space: nowrap;
}
.tl-title {
  font-size: .95rem; font-weight: 700; color: var(--text);
  line-height: 1.5; margin-bottom: 3px;
  transition: color .15s;
}
.tl-excerpt {
  font-size: .82rem; color: var(--text-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px;
}
.tl-footer { display: flex; align-items: center; gap: 10px; }
.tl-comments {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .72rem; color: var(--text-muted);
}
/* 加载骨架 */
.tl-skeleton {
  height: 72px; background: var(--surface-2);
  border-radius: 8px; margin-bottom: 10px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@media (max-width: 600px) {
  .tl-left { width: 24px; }
  .tl-body { padding: 2px 4px 16px 10px; }
}

/* ── 照片墙（内嵌在主内容区）───────────────────────────────── */
.pw-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px; padding: 4px 0 40px;
}
@media (max-width: 860px) { .pw-grid { grid-template-columns: repeat(3, 1fr); } }
.pw-cell {
  position: relative; aspect-ratio: 1;
  overflow: hidden; background: #1e293b; cursor: zoom-in;
  border-radius: 4px;
}
.pw-cell:hover .pw-img { transform: scale(1.06); filter: brightness(1.08); }
.pw-skeleton {
  position: absolute; inset: 0;
  background: linear-gradient(110deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 300% 100%;
  animation: pw-shimmer 1.4s infinite;
}
@keyframes pw-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.pw-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0;
  transition: opacity .35s, transform .4s, filter .4s;
}
.pw-img.loaded { opacity: 1; }
.pw-date-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 18px 8px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.68));
}
.pw-date { display: block; font-size: .68rem; color: rgba(255,255,255,.88); font-weight: 500; }
.pw-title-bar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 6px 8px 18px;
  background: linear-gradient(rgba(0,0,0,.55), transparent);
  opacity: 0; transition: opacity .25s;
}
.pw-cell:hover .pw-title-bar { opacity: 1; }
.pw-title { display: block; font-size: .7rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 年份/月份筛选 */
.album-bar { padding: 4px 0; }
.year-bar { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
.month-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 14px; border-top: 1px solid var(--border); }
.album-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 4px; font-size: .82rem;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.album-chip:hover { border-color: var(--primary); color: var(--primary); }
.album-chip--active { background: var(--primary); border-color: var(--primary); color: #fff; }
.album-chip--sm { padding: 3px 10px; font-size: .78rem; }

/* 照片增强灯箱 */
.photo-lightbox {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.96);
  flex-direction: column; align-items: center; justify-content: center;
}
.photo-lightbox.open { display: flex; }
.photo-lightbox__img-wrap { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; padding: 20px; }
.photo-lightbox__img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 4px; }
.photo-lightbox__info { width: 100%; padding: 12px 20px 20px; text-align: center; color: #fff; }
.photo-lightbox__title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.photo-lightbox__meta { font-size: .8rem; color: rgba(255,255,255,.6); }
.photo-lightbox__meta a { color: rgba(255,255,255,.7); }
.photo-lightbox__close {
  position: absolute; top: 16px; right: 20px; color: #fff; font-size: 1.8rem; cursor: pointer;
  background: rgba(255,255,255,.1); border: none; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.photo-lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.photo-lightbox__nav:hover { background: rgba(255,255,255,.3); }
.photo-lightbox__prev { left: 16px; }
.photo-lightbox__next { right: 16px; }
.photo-lightbox__counter {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.7); font-size: .8rem; background: rgba(0,0,0,.4);
  padding: 4px 12px; border-radius: 99px;
}

/* ── 暗黑模式细节层级优化 ──────────────────────────────────── */

/* 标题三层亮度：标题 > 正文 > 摘要/时间 */
[data-theme="dark"] .moment-card__title,
[data-theme="dark"] .post-detail__title,
[data-theme="dark"] .section-header__title,
[data-theme="dark"] .links-group__title {
  color: #e4e6ea;  /* 近白，清晰突出 */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .moment-card__title,
  :root:not([data-theme="light"]) .post-detail__title,
  :root:not([data-theme="light"]) .section-header__title,
  :root:not([data-theme="light"]) .links-group__title {
    color: #e4e6ea;
  }
}

/* 代码块：比卡片背景深一档，营造编辑器沉浸感 */
[data-theme="dark"] .markdown-body pre {
  background: #1e2124;
  color: #d4d8de;
  border: 1px solid #454a4e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .markdown-body pre {
    background: #1e2124;
    color: #d4d8de;
    border: 1px solid #454a4e;
  }
}

/* 行内代码 */
[data-theme="dark"] .markdown-body code {
  background: #3a3d40;
  color: #c9a96e;  /* 温暖的琥珀色，IntelliJ 风格 */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .markdown-body code {
    background: #3a3d40;
    color: #c9a96e;
  }
}

/* 引用块 */
[data-theme="dark"] .markdown-body blockquote {
  background: #363940;
  border-left-color: var(--primary);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .markdown-body blockquote {
    background: #363940;
    border-left-color: var(--primary);
  }
}

/* Header 暗黑下更深沉稳 */
[data-theme="dark"] .header {
  background: #313335;
  border-bottom-color: #4a4d50;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .header {
    background: #313335;
    border-bottom-color: #4a4d50;
  }
}

/* 侧边栏卡片微调 */
[data-theme="dark"] .sidebar-card {
  background: #383b3e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar-card {
    background: #383b3e;
  }
}
