:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e6e8eb;
  --text: #1f2329;
  --muted: #8a9099;
  --primary: #3b6ef5;
  --primary-dark: #2f5bd0;
  --primary-soft: #eaf0ff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

/* 用户自定义背景层(固定铺满,置于内容之下) */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  transform: scale(1.12); /* 放大以遮盖模糊后的透明边缘 */
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.nav-links a:hover { color: var(--primary); }
.nav-user { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.badge-admin {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  vertical-align: middle;
}

/* 当前论坛标识 */
.realm-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.realm-outer { background: #eef2fb; color: #3b6ef5; }
.realm-inner { background: #fdeaf3; color: #c0347d; }

/* 管理员论坛切换控件 */
.realm-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 4px;
}
.realm-switch-label {
  font-size: 12px;
  color: var(--muted);
  padding-left: 6px;
}
.realm-switch-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  transition: all 0.15s;
}
.realm-switch-btn:hover {
  color: var(--text);
}
.realm-switch-btn.active {
  background: var(--primary);
  color: #fff;
}
.realm-switch-btn.active:hover {
  color: #fff;
}

/* Container */
.container {
  max-width: 920px;
  margin: 24px auto;
  padding: 0 20px;
}

/* 未登录时的论坛说明横幅 */
.realm-banner {
  background: #eef2fb;
  border: 1px solid #d6e0fb;
  color: #2f4a8f;
  font-size: 14px;
  line-height: 1.7;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.realm-banner b { color: #1f3a78; }
.realm-banner a { color: var(--primary); }

/* Headings */
.page-title { font-size: 22px; margin: 0 0 16px; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.lock-hint {
  background: #fdf3e7;
  color: #a9651a;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

/* Board grid */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.board-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.board-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.board-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.board-name { font-weight: 700; font-size: 16px; }
.board-count { font-size: 12px; color: var(--muted); }
.board-desc { color: var(--muted); font-size: 14px; margin: 8px 0; }
.board-latest {
  font-size: 13px;
  color: var(--primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thread list */
.thread-list { list-style: none; padding: 0; margin: 0; }
.thread-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.thread-title { font-weight: 600; color: var(--text); text-decoration: none; font-size: 16px; }
.thread-title:hover { color: var(--primary); }
.thread-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Post / reply cards */
.post-card, .reply-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-author { font-weight: 600; color: var(--primary); }
.post-time { font-size: 12px; color: var(--muted); }
.post-title { margin: 0 0 12px; font-size: 20px; }
.post-body { white-space: pre-wrap; word-break: break-word; }
.reply-title { font-size: 16px; margin: 22px 0 12px; }

/* Forms */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 560px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-card label { font-size: 14px; font-weight: 600; margin-top: 4px; }
.form-card input,
.form-card textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  resize: vertical;
}
.form-card input:focus,
.form-card textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* 注册页:选择加入的论坛 */
.realm-choice {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.realm-opt {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 400;
  margin: 0;
}
.realm-opt:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.realm-opt input { width: 16px; height: 16px; }
.realm-opt b { display: block; font-size: 15px; }
.realm-opt small { color: var(--muted); font-size: 12px; }
.form-hint { font-size: 12px; color: var(--muted); margin: 0 0 4px; }

.reply-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 18px;
  box-shadow: var(--shadow);
}
.reply-form h3 { margin: 0 0 10px; font-size: 16px; }
.reply-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.reply-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Buttons */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-row { margin-top: 6px; }
.reset-form { margin: -4px 0 14px; }

/* Auth */
.auth-wrap { max-width: 420px; margin: 20px auto; }
.auth-alt { text-align: center; color: var(--muted); font-size: 14px; }

/* Misc */
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--primary); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.login-hint { color: var(--muted); }
.login-hint a { color: var(--primary); }

/* 头像 */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
.avatar-default {
  color: #fff;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
}
.thread-meta .avatar { margin-right: 2px; }
.avatar-card { margin-bottom: 24px; }
.avatar-preview { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.card-title { font-size: 18px; margin: 0 0 4px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}
.pager a { color: var(--primary); text-decoration: none; }

/* Flash messages */
.flash-wrap { margin-bottom: 16px; }
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}
.flash-success { background: #e8f7ee; color: #1a7f4b; }
.flash-warning { background: #fdf3e7; color: #a9651a; }
.flash-info { background: #eef2fb; color: #3b6ef5; }

/* Footer */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 30px 0 40px;
}
