/* =====================================================================
   BBS 前台样式
   ===================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #fff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --danger: #dc2626;
  --ok: #16a34a;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; -webkit-text-size-adjust: 100%; touch-action: manipulation; }
/* 全局禁止复制：展示界面不可选中文本（输入框/编辑器/弹窗提示除外，避免影响注册登录与发帖） */
body { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
input, textarea, select, [contenteditable="true"], .editor, .CodeMirror, .toast-item, .reject-modal-box, .trash-edit-box { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; }
/* 移动端触控目标最小尺寸 */
@media (max-width: 768px) {
  .btn, .nav a, .mobile-nav a, .dropdown-menu a { min-height: 44px; align-items: center; display: inline-flex; }
  .form-group input, .form-group select, .form-group textarea { font-size: 16px; } /* 防止 iOS 聚焦缩放 */
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-size: 13px; }
.danger { color: var(--danger); }

/* ---------- 顶部导航 ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 58px; }
.logo { font-size: 20px; font-weight: 700; color: var(--text); }
.logo i { color: var(--primary); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 7px 13px; border-radius: 6px; color: #334155; font-size: 14px; }
.nav a:hover { background: #f1f5f9; color: var(--primary); }
.nav a.active { background: #eff6ff; color: var(--primary); font-weight: 600; }
.user-area { display: flex; align-items: center; gap: 12px; position: relative; }
.nav-icon { position: relative; color: #334155; font-size: 17px; padding: 6px; }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; min-width: 16px; text-align: center; display: inline-block; }

/* 下拉菜单 */
.dropdown { position: relative; }
.dropbtn { background: none; border: 0; display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 14px; padding: 5px 8px; border-radius: 6px; }
.dropbtn:hover { background: #f1f5f9; }
.dropdown-menu { display: none; position: absolute; right: 0; top: 105%; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.1); min-width: 170px; padding: 6px; }
.dropdown-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: #334155; font-size: 14px; }
.dropdown-menu a:hover { background: #f1f5f9; }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 0; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: #334155; border: 1px solid var(--border); padding: 8px 16px; border-radius: 8px; font-size: 14px; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: #334155; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 8px; border-radius: 6px; }
.btn-link:hover { color: var(--primary); background: #f1f5f9; }
.btn-link.danger:hover { color: var(--danger); }
.btn-link.liked, .btn-link.fav { color: var(--primary); }
.btn-link.ok { color: var(--ok); }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 18px; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }

/* 首页 hero */
.home-hero { text-align: center; padding: 34px 16px 10px; }
.home-hero h1 { font-size: 26px; }
.home-hero p { color: var(--muted); margin-top: 6px; }
.home-hero .home-search { max-width: 560px; margin: 16px auto 0; background: var(--card-bg, #fff); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.home-hero .home-search input[type=text] { background: transparent; border: none; box-shadow: none; outline: none; }

/* 板块 */
.board-grid { padding: 8px 0; }
.board-item { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.board-item:hover { background: #f8fafc; }
.board-info h3 { font-size: 15px; }
.board-stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.sub-boards { padding: 6px 18px 10px 18px; display: flex; gap: 6px; flex-wrap: wrap; background: #f8fafc; }
.sub-boards a { font-size: 13px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 13px; }
.table tr:last-child td { border-bottom: 0; }
.thread-table .td-title { max-width: 420px; }
.td-num, .th-num { text-align: center; width: 60px; }

/* 标签 */
.tag { display: inline-block; background: #eff6ff; color: var(--primary); font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.tag-active { background: var(--primary); color: #fff; }
.tag.danger { background: #fef2f2; color: var(--danger); }

/* 分页 */
.pagination { padding: 14px 18px; }
.pagination ul { display: flex; gap: 6px; list-style: none; justify-content: center; }
.pagination a, .pagination span { display: inline-block; padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: #334155; }
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 面包屑 / 页头 */
.breadcrumb { padding: 14px 0 6px; font-size: 13px; color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 0 12px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; }
.page-actions { display: flex; gap: 8px; }

/* 排序栏 */
.sort-bar { padding: 4px 2px 12px; display: flex; align-items: center; gap: 8px; }

/* 主题帖 */
.thread-head { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.thread-head h1 { font-size: 20px; }
.thread-meta { margin-top: 8px; font-size: 13px; }
.post-row { display: flex; padding: 20px; }
.post-side { width: 130px; text-align: center; flex-shrink: 0; }
.post-side .username { margin-top: 8px; font-weight: 600; }
.post-content { flex: 1; min-width: 0; padding-left: 20px; }
.post-actions { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; gap: 8px; }

/* Markdown 渲染内容（已净化，仍按安全底线渲染） */
.markdown-body { font-size: 15px; word-break: break-word; }
.markdown-body p { margin: 8px 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 14px 0 8px; }
.markdown-body pre { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; margin: 10px 0; }
.markdown-body code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { border-left: 4px solid var(--primary); background: #f8fafc; padding: 8px 14px; margin: 10px 0; color: #475569; }
.markdown-body img { max-width: 100%; border-radius: 8px; }
.markdown-body a { text-decoration: none; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; margin: 8px 0; }
.markdown-body table { border-collapse: collapse; margin: 10px 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 12px; }

/* 回复 */
.reply { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.reply-child { margin: 10px 0 0 40px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.reply-main { display: flex; }
.reply-side { width: 60px; flex-shrink: 0; }
.reply-body { flex: 1; min-width: 0; padding-left: 12px; }
.reply-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.reply-actions { margin-top: 8px; display: flex; gap: 4px; }
.reply-to { font-size: 12px; }

/* 头像 */
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }
.avatar-xl { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; }

/* 角色徽章 */
.role-badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.role-badge.admin { background: #fef2f2; color: #b91c1c; }
.role-badge.mod { background: #eff6ff; color: var(--primary); }

/* 签名 */
.signature { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 13px; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: #475569; margin-bottom: 6px; }
.form-group input[type=text], .form-group input[type=password], .form-group input[type=email], .form-group input[type=file], .form-group input[type=number],
.form-group select, .form-group textarea, .editor {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.form-group textarea, .editor { resize: vertical; line-height: 1.6; }
.form-group input:focus, .form-group textarea:focus, .editor:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* 编辑器工具栏 */
.editor-toolbar { display: flex; gap: 4px; align-items: center; border: 1px solid var(--border); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 6px 8px; background: #f8fafc; flex-wrap: wrap; }
.editor-toolbar + .editor { border-radius: 0 0 8px 8px; }
.editor-toolbar button { background: #fff; border: 1px solid var(--border); border-radius: 6px; width: 30px; height: 28px; cursor: pointer; color: #475569; }
.editor-toolbar button:hover { color: var(--primary); border-color: var(--primary); }
.toolbar-hint { font-size: 12px; margin-left: auto; }

/* 引用回复栏 */
.quote-bar { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; display: none; gap: 8px; align-items: center; }

/* 认证页 */
.auth-wrap { display: flex; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 26px; }
.auth-title { text-align: center; margin-bottom: 18px; font-size: 19px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; }

/* 消息/私信 */
.msg-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.msg-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.msg-item:hover { background: #f8fafc; }
.msg-preview { display: block; font-size: 12px; }
.chat-box { height: 60vh; max-height: 640px; min-height: 320px; overflow-y: auto; padding: 16px; background: #f8fafc; }
.chat-msg { margin-bottom: 12px; }
.chat-bubble { display: inline-block; background: #f1f5f9; padding: 8px 14px; border-radius: 12px; max-width: 80%; font-size: 14px; }
.chat-msg.mine { text-align: right; }
.chat-msg.mine .chat-bubble { background: var(--primary); color: #fff; }
.chat-time { font-size: 11px; }
.msg-chat form { padding: 12px; border-top: 1px solid var(--border); }
.msg-chat form textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px; resize: vertical; }

/* 提醒列表 */
.notice-list { list-style: none; }
.notice-list li { padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 14px; }

/* 个人主页 */
.profile-head { display: flex; gap: 22px; padding: 24px; align-items: center; }
.profile-info h1 { font-size: 20px; }
.profile-info p { margin-top: 6px; }

/* 设置页 */
.settings-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-wrap .card { padding-bottom: 6px; }
.settings-wrap form { padding: 0 18px 18px; }

/* 搜索 */
.search-form { display: flex; gap: 8px; padding: 14px 18px; }
.search-form input[type=text] { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; }
.search-form select { padding: 8px; border: 1px solid var(--border); border-radius: 8px; }

/* 过滤条 */
.filter-bar { display: flex; gap: 8px; padding: 12px 16px; align-items: center; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; }
.filter-bar input[type=text] { flex: 1; min-width: 160px; }

/* 提示 */
.alert { padding: 11px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* 页脚 */
.site-footer { border-top: 1px solid var(--border); padding: 22px 0; margin-top: 30px; text-align: center; background: #fff; }

/* ---------- 移动端汉堡按钮 ---------- */
.menu-toggle { display: none; background: none; border: 0; font-size: 20px; color: #334155; cursor: pointer; padding: 8px 10px; border-radius: 6px; }
.menu-toggle:hover { background: #f1f5f9; }

/* 移动端抽屉导航（body 直接子级，不受 header 堆叠上下文限制） */
.mobile-nav-mask { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.45); z-index: 998; }
.mobile-nav { display: block; position: fixed; top: 0; left: 0; bottom: 0; width: 260px; max-width: 80vw; background: #fff; z-index: 999; box-shadow: 4px 0 20px rgba(0,0,0,.15); overflow-y: auto; transform: translateX(-105%); transition: transform .25s ease; }
.mobile-nav-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.mobile-nav-head button { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.mobile-nav a { display: flex; align-items: center; gap: 10px; padding: 13px 18px; color: #334155; font-size: 15px; border-bottom: 1px solid #f1f5f9; }
.mobile-nav a:hover { background: #f8fafc; color: var(--primary); }
.mobile-nav a i { width: 20px; text-align: center; }
.mobile-nav-divider { height: 1px; background: var(--border); margin: 6px 0; }
body.nav-open .mobile-nav-mask { display: block; }
body.nav-open .mobile-nav { transform: translateX(0); }

/* =====================================================================
   响应式断点
   PC:    >= 1025px （默认样式）
   平板:  769px - 1024px
   手机:  <= 768px
   小屏:  <= 480px
   ===================================================================== */

/* ---------- 平板（769-1024px） ---------- */
@media (max-width: 1024px) {
  .container { max-width: 100%; padding: 0 20px; }
  .msg-layout { grid-template-columns: 220px 1fr; }
  .post-side { width: 100px; }
}

/* ---------- 手机（<=768px） ---------- */
@media (max-width: 768px) {
  .container { padding: 0 12px; }

  /* 顶部导航：桌面 nav 隐藏，显示汉堡 */
  .menu-toggle { display: block; }
  .nav { display: none; }
  .header-inner { gap: 10px; height: 52px; }
  .logo { font-size: 17px; }
  .user-area { gap: 8px; }
  .user-name { display: none; }
  .btn { padding: 6px 12px; font-size: 13px; }

  /* Hero */
  .home-hero { padding: 22px 12px 6px; }
  .home-hero h1 { font-size: 20px; }

  /* 板块列表 */
  .board-item { padding: 11px 14px; flex-wrap: wrap; gap: 6px; }
  .board-stats { gap: 10px; font-size: 12px; }
  .sub-boards { padding: 6px 14px 10px; }

  /* 卡片 */
  .card-header { padding: 12px 14px; }
  .card-header h2 { font-size: 14px; }

  /* 表格：横向滚动 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { font-size: 13px; min-width: 560px; }
  .table th, .table td { padding: 8px 10px; }

  /* 主题帖 */
  .thread-head { padding: 14px 16px; }
  .thread-head h1 { font-size: 18px; }
  .post-row { flex-direction: column; padding: 16px; }
  .post-side { width: 100%; text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 12px; }
  .post-side .avatar-lg { margin: 0 auto 4px; }
  .post-side .username { margin-top: 0; }
  .post-content { padding-left: 0; }
  .post-actions { flex-wrap: wrap; }

  /* 回复 */
  .reply { padding: 12px 14px; }
  .reply-child { margin-left: 0; }
  .reply-side { width: 40px; }

  /* Markdown */
  .markdown-body { font-size: 14px; }
  .markdown-body pre { padding: 10px; font-size: 12px; }

  /* 分页 */
  .pagination ul { flex-wrap: wrap; }

  /* 页头 */
  .page-head { padding: 14px 0 8px; }
  .page-head h1 { font-size: 18px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }

  /* 表单 */
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .form-group input, .form-group select, .form-group textarea { font-size: 16px; }
  .editor-toolbar { overflow-x: auto; flex-wrap: nowrap; }

  /* 私信 */
  .msg-layout { grid-template-columns: 1fr; gap: 0; align-items: stretch; }
  /* 手机：会话列表只显示一个紧凑头部，聊天区整面 */
  .msg-chat { min-height: calc(100vh - 56px); display: flex; flex-direction: column; }
  .msg-chat .card-header { flex: none; }
  .msg-chat .chat-box { flex: 1; height: auto; min-height: 0; padding: 12px; }
  .msg-chat form { flex: none; }
  /* 会话列表收窄成一条横栏 */
  .msg-list { max-height: 140px; overflow-y: auto; border-bottom: 2px solid var(--border); }
  .msg-list .card-header { display: none; }
  .msg-item { padding: 8px 12px; font-size: 13px; display: block; }
  .msg-preview { display: block; }

  /* 个人主页 */
  .profile-head { flex-direction: column; text-align: center; padding: 18px; gap: 14px; }
  .avatar-xl { width: 80px; height: 80px; }

  /* 设置 */
  .settings-wrap { grid-template-columns: 1fr; }

  /* 搜索 */
  .search-form { flex-wrap: wrap; padding: 12px 14px; }
  .search-form input[type=text] { min-width: 100%; }

  /* 过滤条 */
  .filter-bar { padding: 10px 12px; }
  .filter-bar input[type=text] { min-width: 100%; }

  /* 认证页 */
  .auth-wrap { padding: 24px 12px; }
  .auth-card { padding: 20px; }

  /* 排序栏 */
  .sort-bar { flex-wrap: wrap; }

  /* 引用栏 */
  .quote-bar { flex-wrap: wrap; }
}

/* ---------- 小屏手机（<=480px） ---------- */
@media (max-width: 480px) {
  .container { padding: 0 10px; }
  .logo { font-size: 15px; }
  .home-hero h1 { font-size: 18px; }
  .btn { font-size: 12px; padding: 5px 10px; }
  .board-info h3 { font-size: 14px; }
  .thread-head h1 { font-size: 16px; }
  .markdown-body h1 { font-size: 18px; }
  .markdown-body h2 { font-size: 16px; }
}

/* ---------------- 公告弹窗 ---------------- */
.ann-modal {
  position: fixed !important; top: 0 !important; left: 0 !important;
  right: 0 !important; bottom: 0 !important; z-index: 9999 !important;
  display: none !important; align-items: center; justify-content: center;
}
.ann-modal.show {
  display: flex !important;
}
.ann-modal-mask {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55);
}
.ann-modal-box {
  position: relative; background: #fff; border-radius: 12px;
  width: 90%; max-width: 480px; max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  animation: annPop .25s ease;
}
@keyframes annPop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ann-modal-head {
  padding: 16px 20px; border-bottom: 1px solid #eee;
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 16px;
}
.ann-modal-head i { color: #2563eb; }
.ann-type-badge {
  margin-left: auto; font-size: 12px; padding: 2px 8px; border-radius: 10px;
}
.ann-type-info { background: #dbeafe; color: #1d4ed8; }
.ann-type-warning { background: #fef3c7; color: #b45309; }
.ann-type-important { background: #fee2e2; color: #b91c1c; }
.ann-modal-body {
  padding: 20px; line-height: 1.7; font-size: 14px; color: #334155;
  overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  flex: 1;
}
.ann-modal-foot {
  padding: 12px 20px; border-top: 1px solid #eee;
  display: flex; gap: 10px; justify-content: flex-end;
}
.uid-badge {
  display: inline-block; background: #f1f5f9; color: #475569;
  padding: 2px 8px; border-radius: 4px; font-size: 12px;
  font-family: monospace;
}

/* UID 小字显示（灰色，和注册时间同色） */
.uid-text { color: #94a3b8; font-size: 12px; font-family: monospace; }

/* UID 文字样式（灰色、小字号，与注册时间同色） */
.uid-text {
  color: #94a3b8;
  font-size: 12px;
  font-family: monospace;
}

/* ===== 公告弹窗（从内联移至外部，CSP 友好） ===== */
.ann-modal{position:fixed !important;top:0 !important;left:0 !important;right:0 !important;bottom:0 !important;z-index:9999 !important;display:none !important;align-items:center;justify-content:center}
.ann-modal.show{display:flex !important}
.ann-modal-mask{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.55)}
.ann-modal-box{position:relative;background:#fff;border-radius:12px;width:90%;max-width:480px;max-height:80vh;display:flex;flex-direction:column;box-shadow:0 10px 40px rgba(0,0,0,.25);animation:annPop .25s ease}
@keyframes annPop{from{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}
.ann-modal-head{padding:16px 20px;border-bottom:1px solid #eee;display:flex;align-items:center;gap:8px;font-weight:600;font-size:16px}
.ann-modal-head i{color:#2563eb}
.ann-type-badge{margin-left:auto;font-size:12px;padding:2px 8px;border-radius:10px}
.ann-type-info{background:#dbeafe;color:#1d4ed8}
.ann-type-warning{background:#fef3c7;color:#b45309}
.ann-type-important{background:#fee2e2;color:#b91c1c}
.ann-modal-body{padding:20px;line-height:1.7;font-size:14px;color:#334155;overflow-y:auto;white-space:pre-wrap;word-break:break-word;flex:1}
.ann-modal-foot{padding:12px 20px;border-top:1px solid #eee;display:flex;gap:10px;justify-content:flex-end}
.ann-modal-foot .btn{cursor:pointer}

/* 引用回复提示条（CSP 友好，用 class 控制显隐） */
.quote-bar { display: none; }
.quote-bar.show { display: flex; }

/* ===== 公告横条兜底（纯 CSS 显示，JS 失效也能看到公告） ===== */
.ann-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 13px; line-height: 1.5;
  border-bottom: 1px solid rgba(0,0,0,.06); position: relative; z-index: 999;
}
.ann-banner.ann-type-info { background: #eff6ff; color: #1e40af; }
.ann-banner.ann-type-warning { background: #fffbeb; color: #92400e; }
.ann-banner.ann-type-important { background: #fef2f2; color: #991b1b; }
.ann-banner .ann-banner-title { font-weight: 700; white-space: nowrap; }
.ann-banner .ann-banner-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ann-banner .ann-banner-close {
  background: none; border: 0; cursor: pointer; font-size: 16px;
  color: inherit; opacity: .7; padding: 2px 6px; line-height: 1;
}
.ann-banner .ann-banner-close:hover { opacity: 1; }

/* ===== 后台驳回理由弹框（CSP 友好，class 控制显隐） ===== */
.reject-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 10000;
  display: none; align-items: center; justify-content: center;
}
.reject-modal.show { display: flex; }
.reject-modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.55); z-index: 1;
}
.reject-modal-box {
  position: relative; z-index: 2; background: #fff; border-radius: 12px; width: 92%;
  max-width: 460px; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.reject-modal-box h3 { margin-bottom: 8px; font-size: 16px; }
.reject-modal-box textarea {
  width: 100%; box-sizing: border-box; margin-top: 10px;
  border: 1px solid #d1d5db; border-radius: 8px; padding: 10px;
  font-size: 14px; resize: vertical; min-height: 90px;
}
.reject-modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px;
}

/* ===== 站内消息列表 ===== */
.msg-list { display: flex; flex-direction: column; }
.msg-item { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; }
.msg-item:last-child { border-bottom: 0; }
.msg-unread { background: #f8fafc; border-left: 3px solid #2563eb; }
.msg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.msg-from { font-weight: 600; color: #2563eb; font-size: 14px; }
.msg-content { line-height: 1.7; color: #334155; white-space: pre-wrap; word-break: break-word; }
.msg-actions { margin-top: 8px; text-align: right; }
.pager { display: flex; gap: 6px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pager-link { padding: 5px 11px; border-radius: 6px; background: #f1f5f9; color: #475569; text-decoration: none; font-size: 13px; }
.pager-link.active { background: #2563eb; color: #fff; }

/* ===== Toast 提示（1.2 秒自动消失） ===== */
.toast-wrap { position: fixed; top: 12px; left: 0; right: 0; z-index: 30000; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.toast-item {
  display: flex; align-items: center; gap: 8px;
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
  margin-bottom: 8px; max-width: 92%; transition: opacity .3s, transform .3s;
  /* CSS 动画兜底：即使 JS 未加载/失效，提示也会在约 1 秒后自动淡出消失 */
  animation: toastAutoHide 1.4s ease forwards;
}
@keyframes toastAutoHide {
  0%   { opacity: 0; transform: translateY(8px); }
  6%   { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); visibility: hidden; pointer-events: none; }
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-out { opacity: 0; transform: translateY(-8px); animation: none; }
@media (max-width: 768px) {
  .toast-item { font-size: 13px; padding: 9px 14px; }
}

/* ===== 站内消息整屏界面 ===== */
.sysmsg-full {
  display: flex; flex-direction: column; gap: 12px;
  min-height: calc(100vh - 64px);
}
.sysmsg-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
}
.sysmsg-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.sysmsg-head h2 i { color: #2563eb; }
.sysmsg-count { background: #eff6ff; color: #2563eb; border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.sysmsg-list { flex: 1; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.sysmsg-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px; border-bottom: 1px solid #f1f5f9; transition: background .2s;
}
.sysmsg-item:last-child { border-bottom: 0; }
.sysmsg-item:hover { background: #f8fafc; }
.sysmsg-icon { flex: none; width: 38px; height: 38px; border-radius: 50%; background: #eff6ff; color: #2563eb; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.sysmsg-body { flex: 1; min-width: 0; }
.sysmsg-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.sysmsg-from { font-weight: 600; color: #2563eb; font-size: 14px; }
.sysmsg-content { line-height: 1.7; color: #334155; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.sysmsg-del { flex: none; }
.sysmsg-del button { font-size: 15px; padding: 6px 8px; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.sysmsg-del button:hover { background: #fef2f2; }
.sysmsg-empty { flex: 1; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #94a3b8; padding: 60px 0; }
.sysmsg-empty i { font-size: 44px; }
@media (max-width: 768px) {
  .sysmsg-full { min-height: calc(100vh - 56px); }
  .sysmsg-item { padding: 13px 12px; gap: 10px; }
  .sysmsg-icon { width: 32px; height: 32px; font-size: 13px; }
}

/* ===== 审核驳回横幅 ===== */
.reject-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.reject-banner i.fa-triangle-exclamation { font-size: 20px; }
.reject-banner strong { display: block; }
.reject-banner .btn { margin-left: auto; }
@media (max-width: 600px) {
  .reject-banner { flex-direction: column; align-items: flex-start; }
  .reject-banner .btn { margin-left: 0; }
}

/* ===== 我的帖子 / 我的回复 ===== */
.my-list { display: flex; flex-direction: column; }
.my-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #f1f5f9; }
.my-item:last-child { border-bottom: 0; }
.my-item-main { flex: 1; min-width: 0; }
.my-title { font-size: 15px; font-weight: 600; color: #1e293b; text-decoration: none; display: inline-block; margin-bottom: 4px; }
.my-title:hover { color: var(--primary); }
.my-preview { font-size: 14px; color: #334155; margin-bottom: 4px; word-break: break-word; }
.my-meta { font-size: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.my-item-actions { flex: none; display: flex; gap: 6px; }
.my-rejected { display: inline-block; margin-top: 4px; color: #b45309; background: #fef3c7; border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.warn-badge { background: #d97706; color: #fff; }
@media (max-width: 768px) {
  .my-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .my-item-actions { width: 100%; }
  .my-item-actions .btn { flex: 1; justify-content: center; }
}

/* ===== 站内消息：未读标签 ===== */
.sysmsg-unread { display: inline-block; background: var(--danger); color: #fff; font-size: 11px; border-radius: 4px; padding: 1px 6px; margin-right: 6px; }
.sysmsg-ops { flex: none; display: flex; gap: 4px; }

/* ===== 注册验证码 ===== */
.captcha-row { display: flex; align-items: center; gap: 10px; }
.captcha-question { font-size: 18px; font-weight: 700; color: var(--primary); background: #eef6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 14px; min-width: 90px; text-align: center; white-space: nowrap; }
.captcha-input { flex: 1; min-width: 70px; }


/* ===== 邮箱验证码 ===== */
.captcha-row { display: flex; gap: 8px; align-items: center; }
.code-input { letter-spacing: 4px; font-size: 18px; font-weight: 600; text-align: center; flex: 1; }
#codeSendBtn { flex: none; white-space: nowrap; }
#codeSendBtn.disabled { opacity: .6; cursor: not-allowed; }
.code-hint { margin-top: 6px; font-size: 12px; }
.code-hint.text-success { color: #16a34a; }
.code-hint.text-danger { color: #dc2626; }

/* ===== 邮箱可用性检查提示 ===== */
.email-check-hint { margin-top: 4px; font-size: 12px; }
.email-check-hint.text-success { color: #16a34a; }
.email-check-hint.text-danger { color: #dc2626; }

/* =====================================================================
 * v2.19 响应式卡片化（手机 ≤640px / 平板 641-1024px / 桌面 >1024px）
 * 参考：手机端卡片式信息展示（label-value 网格），信息完整不截断
 * ===================================================================== */

/* 表格横向滚动兜底（任何宽度下超宽不破版） */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 平板：双列卡片自适应 */
@media (min-width: 641px) and (max-width: 1024px) {
  .board-grid .card, .thread-table .card, .card.list-card { margin-left: 0; margin-right: 0; }
}

/* 手机：表格 → 卡片（行卡片 + label-value 网格，信息完整显示） */
@media (max-width: 640px) {
  /* 仅对系统数据表格卡片化；Markdown 内容表格保持横向滚动 */
  .table-wrap:has(> table.table) { overflow-x: visible; }
  .table-wrap:not(:has(> table.table)) { overflow-x: auto; }
  table.table { display: block; min-width: 0; }
  table.table thead { display: none; }
  table.table tbody { display: block; }
  table.table tbody tr {
    display: block;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 4px 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
  }
  table.table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 8px 0;
    border: 0;
    text-align: right;
    white-space: normal !important;
    word-break: break-word;
    min-width: 0;
  }
  table.table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--muted, #64748b);
    text-align: left;
    font-size: 12px;
    padding-top: 2px;
  }
  table.table td.nowrap, table.table td.td-title { white-space: normal !important; max-width: none; }
  table.table td:last-child { border-bottom: 0; }
  /* 操作按钮区完整显示、可换行 */
  table.table td:last-child { display: flex; flex-wrap: wrap; gap: 6px; }
  table.table td:last-child::before { content: attr(data-label); }
  table.table td:last-child .inline-inline, table.table td:last-child form.inline-inline,
  table.table td:last-child button.btn, table.table td:last-child .btn { margin: 0; white-space: normal; }

  /* 前台：板块/主题卡片手机单列、间距紧凑 */
  .board-grid, .board-grid .card { padding: 6px 10px; }
  .card-header { padding: 12px 14px; }
  .post-row { padding: 14px; }
  .post-side { flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; }
  .post-side .avatar-lg { margin: 0 auto 4px; }
  .reply-side { display: none; }
  .thread-card .post-side .username { margin-top: 0; }
  /* 回复嵌套缩进在手机上减少，防横向溢出 */
  .reply-child { margin-left: 8px; padding-left: 8px; }
  .markdown-body pre, .markdown-body code { max-width: 100%; overflow-x: auto; }
  .markdown-body img, .markdown-body table { max-width: 100%; }
  /* 信息完整：列表标题/摘要不截断 */
  .thread-table .td-title, .list-title, .ellipsis { white-space: normal !important; overflow: visible; text-overflow: clip; max-width: none; }

  /* 表单与按钮自适应 */
  .form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .form-actions .btn { flex: 1 1 auto; min-width: 120px; justify-content: center; }
  input[type=text], input[type=email], input[type=password], input[type=search], select, textarea { max-width: 100%; box-sizing: border-box; }
  .pagination ul { flex-wrap: wrap; gap: 4px; }
  .pagination a, .pagination span { padding: 6px 10px; }
}

/* 页脚声明（平台声明 + ICP + 反馈邮箱） */
.site-footer { border-top: 1px solid var(--border); padding: 22px 0; margin-top: 30px; text-align: center; background: #fff; }
.site-footer .footer-declare { font-size: 12px; color: var(--muted); line-height: 1.9; max-width: 900px; margin: 0 auto 6px; padding: 0 16px; }
.site-footer .footer-meta { font-size: 12px; color: var(--muted); }
.site-footer .footer-meta a { color: var(--muted); text-decoration: none; }

/* 网络出口 IP（个人主页） */
.net-ip-box { margin-top: 8px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; max-width: 100%; word-break: break-word; flex-wrap: wrap; }
.ip-loc { margin-top: 6px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; max-width: 100%; word-break: break-all; white-space: normal; }
/* 后台审核配置区 */
.audit-fieldset { border:1px solid var(--border,#e3e6ea); border-radius:10px; padding:12px 14px; margin:14px 0; }
.audit-fieldset legend { padding:0 8px; font-weight:600; color:var(--primary,#2f6fed); font-size:13px; }
.audit-fieldset .form-group { margin-bottom:10px; }
