:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #2b2b2b;
  --ink-2: #6b6b6b;
  --line: #e7e2d8;
  --accent: #b05a2e;
  --accent-dark: #8f4522;
  --accent-soft: #f3e3d6;
  --ok: #3a7d44;
  --warn: #c0392b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(60, 40, 20, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}

.container { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* 头部 */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo {
  font-size: 24px; font-weight: 800; color: var(--accent);
  text-decoration: none; letter-spacing: 1px;
}
.logo-sub { font-size: 12px; color: var(--ink-2); font-weight: 400; margin-left: 8px; letter-spacing: 0; }
.nav { display: flex; align-items: center; gap: 16px; }
.nav-link { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.nav-link.active { color: var(--accent); font-weight: 600; }

/* 主视觉 */
.hero { padding: 36px 0 12px; }
.hero h1 { font-size: 28px; font-weight: 800; }
.hero p { color: var(--ink-2); margin-top: 6px; font-size: 15px; }

/* 版块 */
.board { margin: 20px 0 40px; }
.board-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.cats { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 4px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.post-count { font-size: 13px; color: var(--ink-2); }

/* 帖子列表 */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); transition: border-color .15s;
  display: block; text-decoration: none; color: inherit;
}
.post-card:hover { border-color: var(--accent); }
.post-card .post-title { font-size: 17px; font-weight: 700; }
.post-card .post-excerpt { color: var(--ink-2); font-size: 14px; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  font-size: 12px; color: var(--ink-2);
}
.badge {
  background: var(--accent-soft); color: var(--accent-dark);
  padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.post-author { font-weight: 600; color: var(--ink); }
.reply-count { margin-left: auto; }

.loading, .empty { text-align: center; color: var(--ink-2); padding: 40px 0; }
.empty { font-size: 15px; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; }
.pager span { font-size: 13px; color: var(--ink-2); }

/* 按钮 */
.btn {
  border: none; border-radius: 8px; cursor: pointer; font-size: 14px;
  padding: 9px 18px; transition: all .15s; font-weight: 600;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #d9c8ba; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #fff; border: 1px solid var(--warn); color: var(--warn); font-size: 12px; padding: 3px 10px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30,20,10,.45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 0;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  padding: 22px 24px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-close { border: none; background: none; font-size: 24px; color: var(--ink-2); cursor: pointer; line-height: 1; }
.modal label { display: block; font-size: 13px; color: var(--ink-2); margin: 12px 0 4px; }
.modal input, .modal textarea, .modal select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.modal textarea { resize: vertical; }
.modal input:focus, .modal textarea:focus, .modal select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.hint { font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.form-msg { font-size: 13px; color: var(--warn); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }

/* 帖子详情 */
.post-detail { margin: 24px 0 40px; }
.detail-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow); }
.detail-title { font-size: 24px; font-weight: 800; line-height: 1.4; }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 12px 0 20px; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.detail-content { font-size: 15.5px; line-height: 1.9; word-break: break-word; }
.detail-content h1, .detail-content h2, .detail-content h3 { margin: 18px 0 8px; }
.detail-content p { margin: 10px 0; }
.detail-content ul, .detail-content ol { margin: 10px 0 10px 24px; }
.detail-content li { margin: 4px 0; }
.detail-content blockquote { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 14px; margin: 12px 0; color: var(--ink-2); border-radius: 0 6px 6px 0; }
.detail-content pre { background: #f2efe9; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 13.5px; }
.detail-content code { background: #f2efe9; padding: 1px 6px; border-radius: 4px; font-size: 13.5px; }
.detail-content a { color: var(--accent); }
.detail-content figure { margin: 16px 0; text-align: center; }
.detail-content figure img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.detail-content figure figcaption { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }

/* 评论区 */
.comments { margin-top: 22px; }
.comments h3 { font-size: 17px; margin-bottom: 12px; }
.comment-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.comment-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit; resize: vertical; min-height: 70px; }
.comment-form .row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.comment-form input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; flex: 1; max-width: 200px; }
.comment-form .btn { margin-left: auto; }
.comment-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.comment-item .c-head { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.comment-item .c-author { font-weight: 700; color: var(--ink); font-size: 14px; }
.comment-item .c-body { font-size: 14.5px; word-break: break-word; }
.c-delete { margin-left: auto; }

/* 页脚 */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; text-align: center; color: var(--ink-2); font-size: 13px; margin-top: 30px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 22px; }
  .detail-card { padding: 18px 16px; }
  .detail-title { font-size: 20px; }
}
