:root {
  --bg: #f6f3ee;
  --panel: #ffffff;
  --fg: #3d3a35;
  --muted: #9a928a;
  --accent: #b0745a;
  --accent-deep: #8a5a44;
  --accent-soft: #f3e6de;
  --border: #e8e1d7;
  --tag-bg: #f6ece3;
  --shadow: 0 2px 12px rgba(138, 90, 68, .08);
  --shadow-hover: 0 8px 24px rgba(138, 90, 68, .14);
  --radius: 12px;
  --sidebar-w: 280px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.8;
  font-size: 15px;
}
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, #fdfaf6 0%, #f6efe7 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 36px 26px;
  display: flex;
}
.sidebar-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.brand-block { text-align: center; }
.brand-logo {
  width: 72px; height: 72px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(138, 90, 68, .3);
  user-select: none;
}
.brand-name { font-size: 1.3rem; font-weight: 700; letter-spacing: 3px; color: var(--accent-deep); }
.brand-desc { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--fg);
  font-size: .95rem;
  transition: all .2s;
}
.side-nav a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.side-nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.side-section h3.side-title {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 2px;
  margin-bottom: 12px;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a, .tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--accent-deep);
  font-size: .78rem;
  transition: all .2s;
}
.tag-cloud a:hover { background: var(--accent); color: #fff; }
.post-category .category, .category {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}
.sidebar-footer { margin-top: auto; text-align: center; }
.sidebar-footer a { font-size: .75rem; color: var(--muted); }

/* ===== 内容区 ===== */
.content {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 48px 60px;
  min-width: 0;
}
.hero { padding: 10px 0 28px; }
.hero-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-deep);
  letter-spacing: 4px;
}
.hero::after {
  content: "";
  display: block;
  width: 56px; height: 4px;
  margin-top: 14px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
}
.hero-sub { color: var(--muted); margin-top: 10px; font-size: .9rem; }

/* ===== 文章卡片 ===== */
.post-list { display: flex; flex-direction: column; gap: 18px; }
.post-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: transform .2s, box-shadow .2s;
  box-shadow: var(--shadow);
}
.post-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.post-item h2 { font-size: 1.2rem; font-weight: 600; }
.post-item h2 a { color: var(--fg); }
.post-item h2 a:hover { color: var(--accent-deep); }
.post-item .post-meta { margin-top: 6px; font-size: .82rem; color: var(--muted); display: flex; gap: 12px; align-items: center; }
.post-excerpt { margin-top: 10px; font-size: .9rem; color: #6e675f; }
.post-excerpt p { display: inline; }
.read-more { font-size: .82rem; font-weight: 600; margin-top: 12px; display: inline-block; }
.read-more::after { content: " →"; }

/* ===== 文章页 ===== */
.post-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.post-full { padding: 40px 44px; }
.post-title { font-size: 1.8rem; line-height: 1.4; font-weight: 700; color: var(--accent-deep); }
.post-meta { margin-top: 10px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.post-meta time { color: var(--muted); font-size: .85rem; }
.post-tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.post-body { margin-top: 28px; font-size: 1rem; }
.post-body h2 {
  font-size: 1.35rem; margin: 32px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
  color: var(--accent-deep);
}
.post-body h3 { font-size: 1.1rem; margin: 24px 0 10px; color: var(--accent-deep); }
.post-body p { margin-bottom: 16px; }
.post-body strong { color: var(--accent-deep); }
.post-body ul, .post-body ol { margin: 0 0 16px 26px; }
.post-body li { margin-bottom: 6px; }
.post-body a { border-bottom: 1px solid var(--accent); }
.post-body blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 12px 18px;
  border-radius: 0 8px 8px 0;
  color: #6e675f;
  margin: 16px 0;
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body code {
  background: #f0e9e0;
  color: var(--accent-deep);
  padding: 2px 7px;
  border-radius: 5px;
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
  font-size: .88em;
}
.post-body pre {
  background: #2f2a25;
  color: #f0e9e0;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 16px 0;
  line-height: 1.6;
}
.post-body pre code { background: none; color: inherit; padding: 0; }
.post-body img { max-width: 100%; border-radius: 10px; margin: 8px 0; box-shadow: var(--shadow); }
.post-body hr { border: none; border-top: 1px dashed var(--border); margin: 28px 0; }
.post-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .92em; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.post-body th { background: var(--accent-soft); color: var(--accent-deep); }

/* ===== 归档页 / 标签页 ===== */
.tag-banner h2 {
  font-size: 1.3rem;
  color: var(--accent-deep);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-soft);
}
.archive-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.archive-item {
  display: flex; align-items: center; gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: var(--shadow);
  transition: all .2s;
}
.archive-item:hover { transform: translateX(4px); box-shadow: var(--shadow-hover); }
.archive-item time {
  color: var(--muted); font-size: .82rem;
  flex-shrink: 0; min-width: 90px;
}
.archive-item a { color: var(--fg); font-size: .95rem; }
.archive-item a:hover { color: var(--accent-deep); }

/* ===== 上一篇/下一篇 ===== */
.post-nav {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: .9rem;
}
.post-nav a {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all .2s;
}
.post-nav a:hover { background: var(--accent-soft); border-color: var(--accent); }
.post-nav a.prev::before { content: "← "; }
.post-nav a.next::after { content: " →"; }

/* ===== TOC ===== */
.toc { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; max-height: 50vh; overflow-y: auto; }
.toc a { color: #7d746a; padding: 5px 8px; border-radius: 6px; transition: all .15s; }
.toc a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.toc a.toc-sub { padding-left: 20px; font-size: .8rem; }
.toc-empty { font-size: .8rem; color: var(--muted); }

/* ===== 页脚 ===== */
.content-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
}
.content-footer a { color: var(--muted); }

/* ===== 返回顶部 ===== */
#back-top {
  position: fixed;
  right: 26px; bottom: 30px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(138, 90, 68, .35);
  transition: all .2s;
  z-index: 50;
}
#back-top:hover { background: var(--accent-deep); transform: translateY(-2px); }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8cec2; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-inner { gap: 14px; }
  .side-nav { flex-direction: row; justify-content: center; gap: 10px; }
  .side-section { display: none; }
  .brand-logo { width: 56px; height: 56px; font-size: 24px; margin-bottom: 8px; }
  .content { padding: 24px 20px 40px; }
  .hero-title { font-size: 1.6rem; }
  .post-full { padding: 24px 22px; }
  .post-title { font-size: 1.4rem; }
}
