:root {
  --brand: #a4123f;        /* ACCA 酒红 */
  --brand-dark: #7d0e30;
  --navy: #1b2a4a;         /* 深蓝 */
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e6e8ec;
  --bg: #f4f5f7;
  --card: #ffffff;
  --accent: #c9a24a;       /* 金色点缀 */
  --ok: #1f8a52;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 顶栏 ---- */
.navbar {
  background: linear-gradient(100deg, var(--brand-dark), var(--brand));
  color: #fff;
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 16px;
  height: 58px; display: flex; align-items: center; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 19px; }
.logo:hover { text-decoration: none; }
.logo .badge {
  background: #fff; color: var(--brand); border-radius: 6px;
  padding: 2px 8px; font-weight: 800; letter-spacing: .5px; font-size: 15px;
}
.logo-site {
  color: #fff; opacity: .82; font-size: 12.5px; font-weight: 500;
  border: 1px solid rgba(255,255,255,.4); border-radius: 20px; padding: 2px 10px;
  margin-left: 2px;
}
.logo-site:hover { opacity: 1; text-decoration: none; background: rgba(255,255,255,.12); }
.nav-spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.nav-user a { color: #fff; opacity: .95; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}

/* ---- 布局 ---- */
.container { max-width: 1040px; margin: 22px auto; padding: 0 16px; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 18px; }

/* ---- 版块分组 ---- */
.group-title {
  font-size: 15px; font-weight: 700; color: var(--navy);
  padding: 12px 16px; background: #fbfbfc; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.group-title::before {
  content: ''; width: 4px; height: 15px; background: var(--brand); border-radius: 2px;
}
.cat-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.cat-row:last-child { border-bottom: none; }
.cat-icon {
  width: 42px; height: 42px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--navy), #334366);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; letter-spacing: .3px;
}
.cat-main { flex: 1; min-width: 0; }
.cat-main .name { font-weight: 600; font-size: 15px; }
.cat-main .desc { color: var(--muted); font-size: 13px; margin-top: 1px; }
.cat-stat { color: var(--muted); font-size: 13px; text-align: center; min-width: 70px; }
.cat-stat b { display: block; color: var(--ink); font-size: 15px; }

/* ---- 主题列表 ---- */
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: #fbfbfc;
}
.list-head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.thread-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: #fafbfc; }
.thread-main { flex: 1; min-width: 0; }
.thread-title { font-weight: 600; font-size: 15px; display: block; }
.thread-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.thread-meta .cat-tag { color: var(--navy); }
.thread-stat { color: var(--muted); font-size: 12.5px; text-align: center; min-width: 56px; }
.thread-stat b { display: block; color: var(--ink); }

.tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px;
}
.tag.pin { background: #fde8ee; color: var(--brand); }
.tag.essence { background: #fff4d9; color: #a8780d; }

/* ---- 主题详情 / 帖子 ---- */
.post {
  display: flex; gap: 14px; padding: 18px 16px; border-bottom: 1px solid var(--line);
}
.post:last-child { border-bottom: none; }
.post-side { width: 92px; flex-shrink: 0; text-align: center; }
.post-side .avatar { width: 48px; height: 48px; font-size: 20px; margin: 0 auto 6px; }
.post-side .uname { font-weight: 600; font-size: 13px; word-break: break-all; }
.post-side .ulevel { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.post-body { flex: 1; min-width: 0; }
.post-body .ptime { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.post-body .ptext { white-space: pre-wrap; word-wrap: break-word; }
.post-title {
  font-size: 21px; font-weight: 700; color: var(--ink);
  padding: 16px 16px 0; margin: 0; line-height: 1.4;
}

/* ---- 表单 / 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; border: none;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost:hover { background: #fdf0f4; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--navy); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { min-height: 180px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(164,18,63,.1);
}

.form-wrap { max-width: 440px; margin: 40px auto; }
.form-wrap.wide { max-width: 720px; }
.form-wrap .pad { padding: 24px; }
.form-wrap h1 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
.form-wrap .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.form-foot { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 16px; }

.msg { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg.error { background: #fdeaea; color: #b3261e; }
.msg.ok { background: #e7f6ee; color: var(--ok); }

/* ---- 分页 ---- */
.pager { display: flex; justify-content: center; gap: 6px; padding: 16px; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; font-size: 13.5px; color: var(--ink);
}
.pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .disabled { opacity: .45; pointer-events: none; }

/* ---- 其它 ---- */
.empty { text-align: center; color: var(--muted); padding: 50px 16px; font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding: 40px 16px; }
.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 28px 16px 40px; max-width: 1040px; margin: 0 auto; }
.footer-main { font-size: 13px; color: var(--ink); }
.footer-main a { color: var(--brand); }
.footer-sub { margin-top: 8px; line-height: 1.7; color: var(--muted); max-width: 760px; margin-left: auto; margin-right: auto; }

/* 首页 hero */
.hero { padding: 26px 20px; margin-bottom: 18px; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--navy), #2d4066); color: #fff; box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 6px; font-size: 23px; }
.hero p { margin: 0; opacity: .9; font-size: 14px; }

/* 版块页标题 */
.cat-h1 { margin: 0; font-size: 18px; color: var(--navy); }
.cat-h1-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.reply-box { padding: 16px; }
.reply-box h3 { margin: 0 0 12px; font-size: 15px; color: var(--navy); }
.login-hint { padding: 20px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- 管理员 ---- */
.admin-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: #fbf3f5; border-bottom: 1px solid var(--line);
}
.admin-tag {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--brand);
  padding: 2px 8px; border-radius: 4px; margin-right: 4px;
}
.admin-danger { color: #b3261e; border-color: #e3b4b0; }
.admin-danger:hover { background: #fdeaea; }
.post-del { font-size: 12px; color: #b3261e; margin-left: 8px; }
.post-del:hover { text-decoration: underline; }

/* ---- 后台管理 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; text-align: center;
}
.stat-num { font-size: 28px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td {
  padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.admin-table th { background: #fbfbfc; color: var(--navy); font-weight: 600; }
.admin-table tbody tr:hover { background: #fafbfc; }
.admin-table .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }
.role-admin { color: var(--brand); font-weight: 700; }

/* ---- 分享栏 ---- */
.share-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line); background: #fbfbfc; }
.share-label { color: var(--muted); font-size: 13px; }
.share-btn { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.share-btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.share-btn.wa:hover { border-color: #25d366; color: #128c3e; }
.share-btn.wx:hover { border-color: #09b83e; color: #09b83e; }
.share-btn.wb:hover { border-color: #e6162d; color: #e6162d; }

/* 微信二维码弹窗 */
.wx-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 999; }
.wx-pop { background: #fff; border-radius: 12px; padding: 24px; text-align: center; max-width: 300px; }
.wx-title { font-weight: 700; font-size: 16px; color: var(--navy); margin-bottom: 14px; }
.wx-tip { color: var(--muted); font-size: 12.5px; margin: 12px 0 16px; line-height: 1.6; }

@media (max-width: 640px) {
  .cat-stat, .thread-stat { display: none; }
  .post-side { width: 64px; }
  .post-side .avatar { width: 38px; height: 38px; font-size: 16px; }
  .nav-inner { gap: 10px; }
}
