:root {
  --bg: #f4f7f4;
  --card: #ffffff;
  --text: #26332b;
  --text-light: #6b7a71;
  --primary: #2e7d4f;
  --primary-dark: #22633d;
  --primary-soft: #e6f2ea;
  --border: #e0e7e2;
  --danger: #c0392b;
  --warning: #b7791f;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(38, 51, 43, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ---------- 头部 ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
  text-decoration: none;
  white-space: nowrap;
}

.nav-boards {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.nav-boards a {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
  transition: all 0.15s;
}

.nav-boards a:hover { color: var(--primary); background: var(--primary-soft); }

.nav-boards a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.nav-user a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 15px;
}

.nav-user a:hover { color: var(--primary); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}

/* ---------- 通用 ---------- */
main {
  flex: 1;
  padding: 24px 0 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.hint { color: var(--text-light); font-size: 14px; }

.empty {
  text-align: center;
  color: var(--text-light);
  padding: 48px 0;
}

/* ---------- 表单 ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}

.form-wide { max-width: none; }

.form label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.form input[type="text"],
.form input[type="password"],
.form textarea,
.form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fbfdfb;
  color: var(--text);
}

.form textarea { resize: vertical; min-height: 90px; }

.form input:focus, .form textarea:focus, .form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary.small { padding: 6px 16px; font-size: 14px; border-radius: 999px; }

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.btn-ghost:hover { color: var(--danger); border-color: var(--danger); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.btn-ok {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
  margin: 0;
}

.form-footer {
  font-size: 14px;
  color: var(--text-light);
  text-align: center;
}

.form-footer a { color: var(--primary); font-weight: 600; }

/* ---------- 帖子列表 ---------- */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

.post-card:hover { border-color: var(--primary); }

.post-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.board-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.board-tag.board-study { background: #e8f0fe; color: #1a56b0; }
.board-tag.board-life { background: #fdf0e3; color: #b05e16; }

.post-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.post-title:hover { color: var(--primary); }

.post-excerpt {
  margin: 8px 0 10px;
  color: var(--text-light);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
}

.post-meta .author { font-weight: 600; color: var(--text); }

.reply-count { margin-left: auto; }

/* ---------- 头像 ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar.large { width: 36px; height: 36px; font-size: 16px; }

/* ---------- 帖子详情 ---------- */
.post-detail-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  font-size: 22px;
}

.post-detail-content {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 16px 0;
  font-size: 15.5px;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover { color: var(--primary); }

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-light);
  margin: 24px 0 12px;
}

/* ---------- 回帖 ---------- */
.reply-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.reply-item:last-child { border-bottom: none; }

.reply-body { flex: 1; min-width: 0; }

.reply-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.reply-head .author { font-weight: 600; color: var(--text); font-size: 14px; }

.reply-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}

.floor {
  margin-left: auto;
  font-size: 12px;
}

.reply-form { margin-top: 16px; }

/* ---------- 管理面板 ---------- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.admin-table th { color: var(--text-light); font-weight: 600; }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-pending { background: #fdf3e0; color: var(--warning); }
.status-approved { background: var(--primary-soft); color: var(--primary-dark); }
.status-rejected { background: #fbe9e7; color: var(--danger); }

.admin-actions { display: flex; gap: 8px; }

.admin-count {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  padding: 0 7px;
  margin-left: 6px;
}

/* ---------- 页脚 / 提示 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  background: var(--card);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 100;
  max-width: 90vw;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: var(--primary); }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .header-inner { gap: 10px; height: auto; padding: 8px 0; flex-wrap: wrap; }
  .nav-user { margin-left: auto; }
  .card { padding: 16px; }
  .post-card { padding: 14px 16px; }
}
