/* ===== 轻论坛 样式（响应式美化版） ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f1f5f9;
  --bg-grad: linear-gradient(180deg, #eef2ff 0%, #f1f5f9 240px);
  --card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --ok: #16a34a;
  --ok-light: #f0fdf4;
  --warn: #d97706;
  --warn-light: #fffbeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow: 0 4px 6px -1px rgba(15,23,42,.06), 0 2px 4px -2px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 25px -5px rgba(15,23,42,.08), 0 8px 10px -6px rgba(15,23,42,.05);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); }

/* ---------- 顶栏 ---------- */
.site-header {
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo {
  font-size: 20px; font-weight: 800; color: var(--primary);
  text-decoration: none; letter-spacing: -.3px;
  display: inline-flex; align-items: center; gap: 6px;
}
.logo::before { content: "💬"; font-size: 18px; }
.nav { display: flex; align-items: center; gap: 14px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--text-soft); text-decoration: none; font-weight: 500; padding: 4px 2px; }
.nav a:hover { color: var(--primary); }
.nav .hi { color: var(--muted); font-weight: 400; }

/* ---------- 主内容 ---------- */
main { flex: 1; padding: 28px 0 48px; }
h1 { font-size: 24px; margin-bottom: 18px; font-weight: 800; letter-spacing: -.3px; }
h2 { font-size: 18px; margin: 24px 0 12px; font-weight: 700; }
h3 { font-size: 16px; margin: 18px 0 10px; font-weight: 600; }
p { margin-bottom: 10px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.toolbar h1 { margin: 0; }
.toolbar-center {
  flex-direction: column; align-items: center; text-align: center;
  gap: 14px; margin-bottom: 22px;
}
.toolbar-center h1 { margin-bottom: 0; font-size: 26px; }
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow); }
.card.narrow { max-width: 460px; }
.card.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 14px; font-weight: 500;
  transition: opacity .4s ease, transform .4s ease, margin .4s ease, padding .4s ease;
}
.alert.success { background: var(--ok-light); border: 1px solid #bbf7d0; color: #166534; }
.alert.error { background: var(--danger-light); border: 1px solid #fecaca; color: #991b1b; }
.alert.fade-out { opacity: 0; transform: translateY(-10px); margin-bottom: 0; padding-top: 0; padding-bottom: 0; height: 0; overflow: hidden; border-width: 0; }

/* ---------- 帖子列表 ---------- */
.post-list { list-style: none; }
.post-item {
  padding: 18px 24px;
  transition: box-shadow .2s, transform .15s, border-color .2s;
  border-left: 3px solid transparent;
}
.post-item:hover { box-shadow: var(--shadow); transform: translateX(2px); border-left-color: var(--primary); }
.post-item { display: flex; align-items: flex-start; gap: 14px; }
.post-avatar-col { flex-shrink: 0; padding-top: 2px; }
.post-avatar-col a { display: block; }
.post-main { flex: 1; min-width: 0; }
.post-title { font-size: 17px; font-weight: 700; color: var(--text); text-decoration: none; line-height: 1.5; }

/* 通用头像 */
.avatar {
  border-radius: 50%; object-fit: cover; display: inline-block;
  vertical-align: middle; flex-shrink: 0;
}
.avatar-default {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-weight: 700; text-align: center; overflow: hidden;
}
.meta-avatar { display: inline-flex; flex-shrink: 0; margin-right: 2px; }
.meta-avatar .avatar { display: block; }
.post-title:hover { color: var(--primary); }
.post-meta { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.post-meta .author { color: var(--primary); font-weight: 600; }
.post-meta .time { color: #94a3b8; }
.post-item.unread { border-left-color: var(--primary); background: var(--primary-light); }

/* ---------- 帖子详情 ---------- */
.breadcrumb {
  font-size: 13px; color: var(--muted); margin-bottom: 14px;
  white-space: nowrap; overflow-x: auto; padding-bottom: 4px;
}
.breadcrumb::-webkit-scrollbar { height: 3px; }
.breadcrumb::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.post-title-big { font-size: 26px; line-height: 1.4; font-weight: 800; }
.post-content { margin-top: 16px; white-space: normal; word-break: break-word; font-size: 15px; line-height: 1.8; }
.post-content p { margin-bottom: 12px; }
.post-content h2, .post-content h3, .post-content h4 { margin: 18px 0 10px; }
.post-content blockquote {
  margin: 12px 0; padding: 10px 16px; border-left: 3px solid var(--primary);
  background: var(--primary-light); color: var(--text-soft); border-radius: 0 8px 8px 0;
}
.post-content ul, .post-content ol { margin: 10px 0 10px 24px; }
.post-content li { margin-bottom: 4px; }
.section-title { font-size: 17px; font-weight: 700; margin: 24px 0 14px; }
.reply-list { list-style: none; }
.reply-item { padding: 18px 24px; border-bottom: 1px solid var(--border-light); }
.reply-item:last-child { border-bottom: none; }
.reply-head { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.reply-head .author { color: var(--primary); font-weight: 600; }
.reply-content { margin-top: 10px; word-break: break-word; font-size: 15px; line-height: 1.8; }
.reply-content p { margin-bottom: 10px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.field textarea { resize: vertical; min-height: 100px; line-height: 1.7; }
.hint { font-size: 13px; color: var(--muted); margin-top: 12px; }
.hint a { color: var(--primary); }
.muted { color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-soft);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-lg { font-size: 16px; padding: 13px 36px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 14px; font-size: 13px; border-radius: 8px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 24px 0; flex-wrap: wrap; }
.page-info { font-size: 13px; color: var(--muted); }

/* ---------- 安装页 ---------- */
.install-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 20px; }
.install-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.install-table .ok { color: var(--ok); font-weight: 600; }
.install-table .bad { color: var(--danger); font-weight: 600; }
.install-form { margin-top: 20px; }
.install-form label.hint { display: block; margin: 6px 0 14px; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  padding: 20px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ---------- 板块 ---------- */
.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--text-soft); font-size: 13px;
  text-decoration: none; font-weight: 500; transition: all .15s;
}
.cat-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.cat-item.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.25); }
.cat-count { font-size: 11px; opacity: .75; }
.cat-tag {
  display: inline-block; padding: 2px 10px; border-radius: 6px;
  background: var(--primary-light); color: var(--primary); font-size: 12px;
  text-decoration: none; font-weight: 500;
}
.cat-tag:hover { background: var(--primary); color: #fff; }

/* ---------- 站点统计栏 ---------- */
.stats-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: nowrap; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 18px;
  margin-bottom: 14px; font-size: 13px; color: var(--muted);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.stats-left { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; white-space: nowrap; }
.stats-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap; }
.stats-icon { font-size: 15px; }
.stats-bar strong { color: var(--text); font-weight: 600; }
.stats-sep { color: var(--border); user-select: none; }
.stats-newuser { color: var(--primary) !important; }
.stats-right a { color: var(--muted); text-decoration: none; font-weight: 500; transition: color .15s; }
.stats-right a:hover { color: var(--primary); }
.stats-right a.active { color: var(--primary); font-weight: 700; }

/* ---------- 管理操作（编辑/删除） ---------- */
.manage-links { display: inline-flex; align-items: center; gap: 12px; }
.manage-links a { color: var(--primary); font-weight: 500; }
.inline-form { display: inline; }
.link-danger {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--danger); font-size: inherit; font-family: inherit; font-weight: 500;
}
.link-danger:hover { text-decoration: underline; }
.link-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--primary); font-size: inherit; font-family: inherit; font-weight: 500;
}
.link-link:hover { text-decoration: underline; }

/* ---------- 置顶 ---------- */
.sticky-tag {
  display: inline-block; padding: 2px 10px; margin-right: 8px; border-radius: 6px;
  background: var(--warn-light); color: var(--warn); font-size: 12px; font-weight: 700; vertical-align: 2px;
}

/* ---------- 富文本编辑器 ---------- */
.editor { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; transition: border-color .15s, box-shadow .15s; }
.editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.editor-toolbar {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); background: #f8fafc;
}
.editor-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor-btn {
  position: relative;
  min-width: 28px; height: 28px; padding: 0 8px; box-sizing: border-box;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text-soft); font-size: 13px; line-height: 26px;
  cursor: pointer; white-space: nowrap; transition: all .12s;
}
.editor-btn:hover { border-color: var(--border); background: #fff; color: var(--primary); }
.editor-btn.open { border-color: var(--primary); background: #fff; color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.1); }
.editor-btn .caret { font-size: 10px; color: var(--muted); margin-left: 2px; }
.editor-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  min-width: 130px; max-height: 280px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px;
}
.editor-menu-item {
  padding: 8px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap;
  margin-bottom: 2px; transition: background .12s;
}
.editor-menu-item:hover { background: var(--primary-light); color: var(--primary); }
.editor-menu-item.upload { color: #15803d; font-weight: 500; }
.editor-menu-item.upload:hover { background: #f0fdf4; color: #15803d; }
.editor-menu-item + .editor-menu-item { border-top: 1px solid #f1f5f9; padding-top: 8px; margin-top: 2px; }
.editor-menu-grid { display: grid; grid-template-columns: repeat(6, 28px); gap: 3px; padding: 2px; }
.editor-menu-cell {
  width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 15px; cursor: pointer; line-height: 26px; transition: border-color .12s;
}
.editor-menu-cell:hover { border-color: var(--primary); background: var(--primary-light); }
.editor-menu-swatches { grid-template-columns: repeat(5, 28px); }
.editor-menu .swatch { border: 1px solid rgba(0,0,0,.12); }
.editor-area {
  min-height: 180px; padding: 14px 16px; font-size: 15px; line-height: 1.8;
  outline: none; word-break: break-word;
}
.editor-area:empty::before { content: attr(data-placeholder); color: #94a3b8; }
.editor-area p { margin: 0 0 8px; }
.editor-area blockquote {
  margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--primary); color: var(--muted);
  background: var(--primary-light); border-radius: 0 6px 6px 0;
}
.editor-area ul, .editor-area ol { margin: 8px 0 8px 24px; }
.editor-area a { color: var(--primary); }
.editor-area img { max-width: 100%; border-radius: 8px; }
.editor-area table { border-collapse: collapse; margin: 10px 0; max-width: 100%; }
.editor-area th, .editor-area td { border: 1px solid #cbd5e1; padding: 6px 10px; min-width: 24px; }
.editor-area th { background: #f1f5f9; }
.editor-area pre {
  background: #0f172a; color: #e2e8f0; border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; font-size: 13px; line-height: 1.6;
}
.editor-area code {
  font-family: Consolas, Menlo, Monaco, 'Courier New', monospace;
  background: #f1f5f9; color: #0f172a; border-radius: 5px; padding: 2px 6px;
  font-size: 13px;
}
.editor-area pre code { background: transparent; color: inherit; padding: 0; border-radius: 0; }

/* 帖子 / 回复渲染端的表格与代码 */
.post-content table, .reply-content table { border-collapse: collapse; margin: 12px 0; max-width: 100%; }
.post-content th, .post-content td, .reply-content th, .reply-content td {
  border: 1px solid #cbd5e1; padding: 8px 12px;
}
.post-content th, .reply-content th { background: #f1f5f9; font-weight: 600; }
.post-content pre, .reply-content pre {
  background: #0f172a; color: #e2e8f0; border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.6;
}
.post-content img, .reply-content img {
  max-width: 100%; height: auto; border-radius: 8px; cursor: zoom-in;
  transition: opacity .15s;
}
.post-content img:hover, .reply-content img:hover { opacity: .9; }
.post-content code, .reply-content code {
  font-family: Consolas, Menlo, Monaco, 'Courier New', monospace;
  background: #f1f5f9; color: #0f172a; border-radius: 5px; padding: 2px 6px; font-size: 13px;
}
.post-content pre code, .reply-content pre code { background: transparent; color: inherit; padding: 0; border-radius: 0; }
.hl-keyword { color: #93c5fd; font-weight: 600; }
.hl-string  { color: #86efac; }
.hl-comment { color: #94a3b8; font-style: italic; }
.hl-number  { color: #fca5a5; }

/* ---------- 图片灯箱（点击放大） ---------- */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,23,42,.9);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox-overlay[hidden] { display: none !important; }
.lightbox-img {
  max-width: 92vw; max-height: 88vh;
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: zoomIn .25s ease;
}
@keyframes zoomIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 28px; line-height: 1; width: 44px; height: 44px;
  border-radius: 50%; cursor: pointer; transition: background .15s, transform .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); transform: rotate(90deg); }

/* ---------- 管理后台 ---------- */
.admin-form { max-width: 460px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.admin-table th, .admin-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-light); text-align: left;
}
.admin-table th { background: #f8fafc; font-weight: 600; color: var(--text-soft); font-size: 13px; }
.admin-table tr:hover td { background: #fafbfc; }
.admin-table input[type="text"],
.admin-table input[type="number"] {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  transition: border-color .12s;
}
.admin-table input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.1); }
.admin-table input[type="number"] { width: 110px; }
.admin-table .input-sort { width: 64px; }
.admin-actions { white-space: nowrap; }
.form-tip { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

/* ---------- 搜索框 ---------- */
.search-form { flex: 1; max-width: 340px; margin: 0 12px; min-width: 0; }
.search-form input {
  width: 100%; padding: 8px 16px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-family: inherit; color: var(--text);
  background: #f8fafc; transition: all .15s;
}
.search-form input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.result-count { color: var(--muted); font-weight: 400; font-size: 14px; }

/* ---------- 个人主页 ---------- */
.profile-card { display: flex; align-items: center; gap: 20px; }
.profile-avatar {
  flex-shrink: 0;
  line-height: 0;
}
.profile-name { font-size: 24px; margin-bottom: 8px; font-weight: 800; }
.profile-stats { color: var(--muted); font-size: 13px; display: flex; gap: 18px; flex-wrap: wrap; }
.profile-email { margin-top: 10px; font-size: 13px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 等级徽章 ---------- */
.lv-badge { display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; white-space: nowrap; font-weight: 600; }
.lv-badge.lv1 { background: #f1f5f9; color: #64748b; }
.lv-badge.lv2 { background: #dcfce7; color: #15803d; }
.lv-badge.lv3 { background: #dbeafe; color: #2563eb; }
.lv-badge.lv4 { background: #fef3c7; color: #b45309; }
.lv-badge.lv5 { background: #fce7f3; color: #be185d; }

/* ---------- 点赞 ---------- */
.like-bar { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.like-count { color: var(--muted); font-size: 13px; }
.btn-liked { background: #fce7f3; color: #be185d; border-color: #f9a8d4; }
.btn-liked:hover { background: #be185d; color: #fff; border-color: #be185d; }

/* ---------- 私信 / 未读 / 邮箱 ---------- */
.nav-badge {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px;
  background: #ef4444; color: #fff; font-size: 11px; line-height: 18px;
  border-radius: 999px; text-align: center; font-weight: 600;
}
.unread-tag { background: var(--warn-light); color: var(--warn); font-size: 12px; padding: 2px 10px; border-radius: 999px; font-weight: 500; }
.verified-tag { background: var(--ok-light); color: var(--ok); font-size: 12px; padding: 2px 10px; border-radius: 999px; font-weight: 500; }
.msg-time { margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.msg-body { line-height: 1.8; }

/* ---------- 登录/注册 紧凑小浮窗 ---------- */
.auth-pop {
  position: fixed; top: 70px; right: 20px; z-index: 100;
  width: 320px; max-width: calc(100vw - 40px);
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  animation: popIn .2s ease;
}
@keyframes popIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.auth-pop[hidden] { display: none !important; }
.modal-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 50%;
  transition: background .12s;
}
.modal-close:hover { color: var(--text); background: var(--border-light); }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tab {
  flex: 1; padding: 8px 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text-soft); font-size: 14px; cursor: pointer;
  font-weight: 500; transition: all .15s;
}
.auth-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.auth-msg { padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 12px; display: none; font-weight: 500; }
.auth-msg.ok { display: block; background: var(--ok-light); border: 1px solid #bbf7d0; color: #166534; }
.auth-msg.err { display: block; background: var(--danger-light); border: 1px solid #fecaca; color: #991b1b; }
.auth-pop .field { margin-bottom: 12px; }
.auth-pop .field label { font-size: 12px; margin-bottom: 4px; }
.auth-pop .field input[type="text"],
.auth-pop .field input[type="password"],
.auth-pop .field input[type="email"] {
  padding: 9px 12px; font-size: 13px;
}

/* ============================================================
   响应式自适应
   ============================================================ */

/* 平板及以下（≤ 900px） */
@media (max-width: 900px) {
  .container { max-width: 100%; padding: 0 16px; }
  .post-title-big { font-size: 22px; }
}

/* 手机（≤ 640px） */
@media (max-width: 640px) {
  body { line-height: 1.65; }
  .container { padding: 0 14px; }
  main { padding: 20px 0 36px; }
  h1 { font-size: 20px; margin-bottom: 14px; }
  h2 { font-size: 16px; margin: 20px 0 10px; }

  /* 顶栏 */
  .header-inner { height: auto; min-height: 56px; padding: 8px 0; flex-wrap: wrap; gap: 8px; }
  .logo { font-size: 18px; }
  .logo::before { font-size: 16px; }
  .nav { gap: 10px; font-size: 13px; width: 100%; justify-content: flex-start; }
  .nav .hi { display: none; }
  .search-form { max-width: 100%; margin: 4px 0; order: 10; width: 100%; }

  /* 卡片 */
  .card { padding: 16px 18px; margin-bottom: 12px; border-radius: 12px; }
  .card.narrow { max-width: 100%; }
  .card.empty { padding: 28px 16px; }

  /* 帖子列表 */
  .post-item { padding: 14px 18px; }
  .post-item:hover { transform: none; }
  .post-title { font-size: 15px; }
  .post-meta { gap: 10px; font-size: 12px; }
  .post-title-big { font-size: 20px; }
  .post-content { font-size: 14px; line-height: 1.75; margin-top: 12px; }
  .reply-item { padding: 14px 18px; }
  .reply-content { font-size: 14px; line-height: 1.75; }
  .section-title { font-size: 15px; margin: 20px 0 12px; }

  /* 按钮 */
  .btn { padding: 8px 16px; font-size: 13px; }
  .btn-lg { padding: 11px 28px; font-size: 15px; }
  .btn-sm { padding: 5px 12px; font-size: 12px; }

  /* 表单 */
  .field { margin-bottom: 14px; }
  .field input, .field textarea, .field select { padding: 9px 12px; font-size: 14px; }

  /* 工具栏 */
  .toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1; }

  /* 个人主页 */
  .profile-card { flex-direction: column; text-align: center; gap: 14px; }
  .profile-avatar .avatar,
  .profile-avatar .avatar-default { width: 64px !important; height: 64px !important; font-size: 26px !important; line-height: 64px !important; }
  .profile-name { font-size: 20px; margin-bottom: 6px; }
  .profile-stats { justify-content: center; gap: 12px; }
  .profile-email { justify-content: center; }
  .profile-actions { justify-content: center; }

  /* 管理后台表格：横向滚动 */
  .card { overflow-x: auto; }
  .admin-table { min-width: 560px; font-size: 13px; }
  .admin-table th, .admin-table td { padding: 8px 10px; }

  /* 编辑器：工具栏横向滚动 */
  .editor-toolbar { flex-wrap: nowrap; overflow-x: auto; padding: 6px 8px; -webkit-overflow-scrolling: touch; }
  .editor-toolbar::-webkit-scrollbar { height: 4px; }
  .editor-toolbar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .editor-area { min-height: 140px; padding: 12px 14px; font-size: 14px; }

  /* 板块导航 */
  .cat-nav { gap: 6px; }
  .cat-item { padding: 5px 12px; font-size: 12px; }

  /* 分页 */
  .pagination { gap: 8px; margin: 18px 0; }

  /* 登录浮窗：靠近顶部，全宽 */
  .auth-pop {
    top: 60px; right: 10px; left: 10px;
    width: auto; max-width: none;
    padding: 16px;
  }

  /* 统计栏 */
  .stats-bar { padding: 8px 14px; font-size: 12px; gap: 8px; }
  .stats-left { gap: 4px; }
  .stats-right { flex-shrink: 0; }

  /* 帖子列表头像 */
  .post-item { gap: 10px; padding: 14px 16px; }
  .post-avatar-col .avatar,
  .post-avatar-col .avatar-default { width: 36px !important; height: 36px !important; font-size: 15px !important; line-height: 36px !important; }

  /* 灯箱 */
  .lightbox-close { top: 12px; right: 14px; width: 40px; height: 40px; font-size: 24px; }
  .lightbox-img { max-width: 96vw; max-height: 82vh; }

  /* 点赞栏 */
  .like-bar { gap: 10px; margin-top: 14px; padding-top: 12px; }
}

/* 小屏手机（≤ 400px） */
@media (max-width: 400px) {
  .container { padding: 0 12px; }
  .card { padding: 14px 16px; }
  .post-title { font-size: 14px; }
  .post-meta { font-size: 11px; gap: 8px; }
  .nav { gap: 8px; font-size: 12px; }
  .btn { padding: 7px 14px; font-size: 12px; }
  .profile-stats { gap: 8px; font-size: 12px; }
}

/* 自助广告位 */
.ad-zone {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  position: relative;
}
.ad-zone-empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  text-align: center;
  padding: 14px;
}
.ad-zone-empty a { color: var(--primary); font-weight: 600; text-decoration: none; }
.ad-zone-label {
  position: absolute; top: -10px; left: 14px;
  background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}
.ad-list { display: flex; flex-wrap: wrap; gap: 12px; }
.ad-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 8px; padding: 8px 12px;
  text-decoration: none; color: var(--text); flex: 1; min-width: 200px;
  border: 1px solid rgba(245,158,11,.2); transition: box-shadow .2s, transform .2s;
}
.ad-item:hover { box-shadow: 0 4px 12px rgba(245,158,11,.2); transform: translateY(-1px); }
.ad-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.ad-info { min-width: 0; flex: 1; }
.ad-title { font-weight: 700; font-size: 14px; color: #92400e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-desc { font-size: 12px; color: #78716c; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-zone-buy { text-align: right; margin-top: 8px; font-size: 12px; }
.ad-zone-buy a { color: #92400e; font-weight: 600; text-decoration: none; }

/* 广告天数选择 */
.ad-days { display: flex; gap: 10px; flex-wrap: wrap; }
.ad-day-option {
  display: flex; flex-direction: column; align-items: center;
  border: 2px solid #e2e8f0; border-radius: 10px; padding: 10px 18px;
  cursor: pointer; transition: all .2s; min-width: 80px;
}
.ad-day-option input { display: none; }
.ad-day-option:has(input:checked) {
  border-color: var(--primary); background: rgba(79,70,229,.06);
}
.ad-day-num { font-weight: 700; font-size: 15px; color: var(--text); }
.ad-day-price { font-size: 12px; color: var(--primary); margin-top: 2px; font-weight: 600; }

@media (max-width: 640px) {
  .ad-list { flex-direction: column; }
  .ad-item { min-width: 0; }
  .ad-days { gap: 8px; }
  .ad-day-option { padding: 8px 12px; min-width: 70px; }
}

/* 签到页面 */
.checkin-card { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); border: 1px solid #7dd3fc; }
.checkin-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.checkin-icon { font-size: 48px; line-height: 1; }
.checkin-info { flex: 1; min-width: 200px; }
.checkin-info h1 { margin: 0 0 4px; font-size: 22px; }
.checkin-info p { margin: 0; color: var(--muted); font-size: 14px; }
.checkin-info strong { color: var(--primary); font-size: 18px; }
.checkin-action { flex-shrink: 0; }
.checkin-rewards { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.reward-item {
  background: #fff; border-radius: 8px; padding: 10px 16px;
  border: 1px solid #bae6fd; display: flex; flex-direction: column; gap: 2px;
}
.reward-label { font-size: 12px; color: var(--muted); }
.reward-value { font-weight: 700; color: #0369a1; font-size: 15px; }
.reward-progress { font-size: 11px; color: #64748b; margin-top: 2px; }
.checkin-week { margin-top: 20px; }
.week-title { font-weight: 600; margin-bottom: 10px; font-size: 14px; color: var(--text); }
.week-days { display: flex; gap: 8px; flex-wrap: wrap; }
.week-day {
  flex: 1; min-width: 60px; text-align: center; padding: 10px 4px;
  border-radius: 8px; background: #f1f5f9; border: 1px solid #e2e8f0;
  position: relative;
}
.week-day.checked { background: #dcfce7; border-color: #86efac; }
.week-day.today { border-color: var(--primary); border-width: 2px; }
.week-day-icon { font-size: 18px; font-weight: 700; color: #94a3b8; }
.week-day.checked .week-day-icon { color: #16a34a; }
.week-day-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.week-day-today { font-size: 10px; color: var(--primary); font-weight: 700; margin-top: 1px; }

/* 顶栏签到脉冲提示 */
.nav-pulse { position: relative; }
.nav-pulse::after {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 8px; height: 8px; background: #ef4444; border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(1.3); }
}

@media (max-width: 640px) {
  .checkin-header { flex-direction: column; text-align: center; }
  .checkin-info { min-width: 0; }
  .checkin-rewards { flex-direction: column; }
  .reward-item { flex-direction: row; justify-content: space-between; align-items: center; }
  .week-days { gap: 4px; }
  .week-day { min-width: 40px; padding: 8px 2px; }
}

/* 积分商店 */
.shop-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.shop-balance { display: flex; gap: 16px; }
.balance-item { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.balance-label { font-size: 12px; color: var(--muted); }
.balance-value { font-weight: 700; font-size: 18px; color: var(--primary); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.shop-item { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.shop-item-img { width: 100%; height: 140px; overflow: hidden; background: #f1f5f9; display: flex; align-items: center; justify-content: center; }
.shop-item-img img { width: 100%; height: 100%; object-fit: cover; }
.shop-item-img-default { font-size: 48px; }
.shop-item-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.shop-item-name { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.shop-item-desc { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }
.shop-item-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.shop-item-price { font-weight: 700; color: #d97706; font-size: 15px; }
.shop-item-stock { font-size: 12px; color: var(--muted); }
.shop-item-stock.out { color: #ef4444; font-weight: 600; }
.btn-block { width: 100%; }
.btn-danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

@media (max-width: 640px) {
  .shop-header { flex-direction: column; align-items: flex-start; }
  .shop-balance { width: 100%; justify-content: space-between; }
  .shop-grid { grid-template-columns: 1fr; }
}
