/* ============ MyBBS 潮流主题 ============ */
:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 6px rgba(0,0,0,.04);
  --shadow-hover: 0 20px 40px rgba(99,102,241,.12), 0 4px 12px rgba(0,0,0,.06);
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #667eea10 0%, #764ba208 50%, #f0f4ff 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-hover); }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ========== 顶部导航 ========== */
.topbar {
  background: linear-gradient(135deg, rgba(99,102,241,.92) 0%, rgba(139,92,246,.92) 50%, rgba(168,85,247,.92) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99,102,241,.25);
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; height: 52px; }
.brand { color: #fff; font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; text-decoration: none; cursor: pointer; transition: opacity .2s; }
.brand:hover { opacity: .85; }
.brand img { border-radius: 6px; display: block; }
.topnav { display: flex; align-items: center; }
.topnav a, .topnav .hello { color: rgba(255,255,255,.85); margin-left: 16px; font-size: 13.5px; transition: color .15s; }
.topnav a:hover { color: #fff; }
.topnav .nav-group { display: contents; border: none; padding: 0; }
.topnav .nav-welcome { display: inline-flex; align-items: center; gap: 10px; margin-left: 16px; color: rgba(255,255,255,.85); font-size: 13.5px; background: none; padding: 0; border: none; }
.topnav .nav-welcome a { margin-left: 0; }
.nav-sep { color: rgba(255,255,255,.3); margin: 0 8px; }

/* ========== 面包屑 ========== */
.crumbs {
  padding: 10px 16px; font-size: 13px; color: var(--text-muted);
  background: rgba(255,255,255,.7); border-radius: 8px;
  margin: 14px 0; backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.5);
}
.crumbs a { color: var(--primary); }
.crumbs a:hover { opacity: .8; }

/* ========== Hero Banner ========== */
.hero-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
  color: #fff; border-radius: 12px; padding: 36px 32px; margin: 20px 0;
  text-align: center; box-shadow: 0 4px 20px rgba(79,70,229,.3);
}
.hero-banner h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; }
.hero-banner p { margin: 0; opacity: .9; font-size: 15px; }

/* ========== 卡片通用 ========== */
.board-group, .latest, .reply-box, .profile-card, .search-box, .admin-panel, .auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.03);
  overflow: hidden;
}
.board-group { margin: 14px 0; }
.board-group-title {
  margin: 0; padding: 12px 18px; font-size: 15px; font-weight: 600;
  background: linear-gradient(90deg, var(--primary-light) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  color: var(--primary-hover);
}

/* ========== 表格 ========== */
.board-table, .thread-table { width: 100%; border-collapse: collapse; }
.board-table th, .board-table td,
.thread-table th, .thread-table td {
  padding: 11px 18px; text-align: left; border-bottom: 1px solid #f3f4f6;
}
.board-table th, .thread-table th {
  background: #fafafa; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
}
.board-table tr:last-child td, .thread-table tr:last-child td { border-bottom: none; }
.board-table tbody tr:hover, .thread-table tbody tr:hover { background: #fafbff; }
.num { text-align: right; width: 70px; color: var(--text-muted); }
.board-name a { font-size: 14.5px; font-weight: 600; }
.lastpost { width: 220px; color: var(--text-muted); font-size: 12.5px; }

/* ========== 最新列表 ========== */
.latest { padding: 6px 18px 14px; margin: 14px 0; }
.latest-list { list-style: none; padding: 0; margin: 0; }
.latest-list li { padding: 9px 0; border-bottom: 1px dashed #f0f2f5; display: flex; justify-content: space-between; align-items: center; }
.latest-list li:last-child { border-bottom: none; }
.latest-list a { font-weight: 500; }

/* ========== 标签 ========== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-right: 4px;
}
.badge.stick { background: #fef2f2; color: #dc2626; }
.badge.digest { background: #fffbeb; color: #d97706; }
.badge.cat { background: #667eea; color: #fff; }

/* ========== 帖子 ========== */
.thread-header-card {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  border-radius: 12px;
  padding: 30px 24px;
  text-align: center;
  margin: 16px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  border: 1px solid rgba(255,255,255,.6);
}
.thread-header-card .thread-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--text);
  line-height: 1.4;
}
.thread-meta-line {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.thread-meta-line .badge { margin: 0; }

.thread-title { margin: 16px 0 4px; font-size: 22px; font-weight: 700; }
.post-list { margin-top: 14px; }
.post-item {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius); padding: 18px 22px;
  margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.6);
  transition: all .25s;
}
.post-item:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.post-head {
  border-bottom: 1px solid #f1f5f9; padding-bottom: 10px; margin-bottom: 14px;
  font-size: 13px; display: flex; align-items: center;
}
.floor {
  display: inline-block; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
  padding: 2px 12px; border-radius: 6px; margin-right: 8px; font-weight: 700; font-size: 12px;
}
.post-body { font-size: 14.5px; word-wrap: break-word; line-height: 1.8; }
.post-body blockquote {
  border-left: 3px solid var(--primary); margin: 10px 0; padding: 8px 14px;
  background: var(--primary-light); color: var(--text-muted); border-radius: 0 6px 6px 0;
}
.post-body img { max-width: 100%; height: auto; border-radius: 6px; margin: 6px 0; }
.post-body p { margin: 6px 0; }
.post-body pre.code, .post-body pre.wy-code {
  background: #1e293b; color: #e2e8f0; padding: 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; line-height: 1.6;
}

/* 帖子操作栏 */
.post-footer-bar { margin-top: 12px; padding-top: 10px; border-top: 1px solid #f3f4f6; display: flex; align-items: center; gap: 10px; }
.post-meta-right { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.post-meta-right .floor { color: #94a3b8; }
.post-meta-right strong { color: var(--text); }
.vote-btn { margin-right: 14px; font-size: 13px; color: var(--text-muted); padding: 3px 10px; border-radius: 4px; transition: all .15s; }
.vote-btn:hover { background: var(--primary-light); color: var(--primary); }
.vote-btn.voted { color: var(--primary); font-weight: 600; }
.post-signature { margin-top: 10px; padding-top: 8px; font-size: 12px; color: #9ca3af; font-style: italic; border-top: 1px dashed #f0f2f5; }
.thread-actions { margin: 14px 0; }

/* 帖子页管理栏 */
.thread-admin-bar {
  background: linear-gradient(90deg, #fef3c7, #fef9c3); border: 1px solid #fde68a;
  border-radius: 8px; padding: 10px 14px; margin: 12px 0;
}
.post-actions a, .post-actions button { margin-left: 8px; font-size: 12.5px; cursor: pointer; }
.btn-link-danger { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 12.5px; padding: 0; }

/* ========== 按钮 ========== */
.btn {
  display: inline-block; padding: 8px 20px; border-radius: 10px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; font-size: 13.5px; font-weight: 600;
  transition: all .2s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px rgba(102,126,234,.4);
}
.btn.primary:hover { background: linear-gradient(135deg, #5a67d8, #6b46c1); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102,126,234,.5); }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.form-input {
  width: 100%; max-width: 500px; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; box-sizing: border-box; transition: all .2s;
  background: #fff;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.12); }
select.form-input { height: 42px; }

/* ========== 统计卡片 ========== */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin: 16px 0; }
.stat-card {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius); padding: 20px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.6);
  transition: all .25s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-card .num { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* ========== 登录注册 ========== */
.auth-card {
  max-width: 420px; margin: 40px auto; padding: 36px 36px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(102,126,234,.15);
  border: 1px solid rgba(255,255,255,.6);
}
.auth-card h1 { margin: 0 0 20px; font-size: 22px; text-align: center; }
.auth-card label { display: block; margin-bottom: 14px; font-size: 13.5px; color: var(--text); font-weight: 500; }
.auth-card input, .auth-card textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; margin-top: 5px; box-sizing: border-box;
}
.auth-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.auth-alt { margin-top: 16px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* ========== 个人中心 ========== */
.profile-card { padding: 22px 24px; margin: 16px 0; }
.profile-head { display: flex; align-items: center; gap: 18px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.avatar-lg { width: 80px; height: 80px; font-size: 32px; }
.profile-tabs { margin-top: 18px; padding-top: 14px; border-top: 1px solid #f3f4f6; }
.profile-tabs a {
  display: inline-block; padding: 7px 18px; margin-right: 8px; border-radius: 6px;
  color: var(--text-muted); font-size: 13.5px; font-weight: 500; transition: all .15s;
}
.profile-tabs a.active { background: var(--primary); color: #fff; }
.profile-tabs a:hover { background: var(--primary-light); text-decoration: none; color: var(--primary); }
.profile-tabs a.active:hover { background: var(--primary-hover); color: #fff; }

/* ========== 搜索 ========== */
.search-box { padding: 16px 20px; margin: 16px 0; }
.search-box form { display: flex; gap: 8px; }
.search-box input[type=text] { flex: 1; padding: 9px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.search-box input:focus { outline: none; border-color: var(--primary); }
.search-box select { padding: 9px; border: 1px solid var(--border); border-radius: 6px; }

/* ========== 回复框 ========== */
.reply-box { padding: 18px 20px; margin: 16px 0; }
.reply-box h3 { margin: 0 0 12px; font-size: 16px; }

/* ========== 提示 ========== */
.alert { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13.5px; }
.alert.error { background: #fef2f2; color: #dc2626; }
.upload-tip {
  padding: 9px 14px; color: var(--primary); font-size: 13px;
  background: var(--primary-light); border-radius: 6px; margin: 8px 0;
}

/* ========== 分页 ========== */
.pagination { margin: 20px 0; text-align: center; }
.pagination .page {
  display: inline-block; padding: 5px 12px; margin: 0 3px; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; transition: all .15s;
}
.pagination a.page:hover { border-color: var(--primary); color: var(--primary); }
.pagination .page.current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.pagination .dots { padding: 0 4px; color: #c0c4cc; border: none; }

/* ========== 页脚 ========== */
.footer {
  margin-top: 50px; padding: 28px 0; text-align: center;
  color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border);
  background: var(--card);
}
.footer-nav { margin-bottom: 10px; }
.footer-nav a { margin: 0 8px; color: var(--text-muted); }
.footer-links { margin-bottom: 8px; }
.footer-links a { margin: 0 8px; color: var(--primary); font-size: 12.5px; }
.nav-sep { color: var(--border); margin: 0 6px; }

/* ========== WYSIWYG 编辑器 ========== */
.wy-wrap {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: #fff; margin: 8px 0; transition: border-color .15s, box-shadow .15s;
}
.wy-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.wy-bar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px;
  background: #fafafa; border-bottom: 1px solid var(--border);
}
.wy-btn {
  min-width: 32px; padding: 5px 10px; border: 1px solid var(--border);
  background: #fff; border-radius: 5px; cursor: pointer; font-size: 13px; color: var(--text);
  transition: all .12s;
}
.wy-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.wy-sep { width: 1px; background: var(--border); margin: 2px 3px; align-self: stretch; }
.wy-editor {
  min-height: 200px; padding: 16px 18px; font-size: 14.5px; line-height: 1.75;
  outline: none; overflow-y: auto; max-height: 500px; word-wrap: break-word;
}
.wy-editor img { max-width: 100%; border-radius: 6px; margin: 6px 0; }
.wy-editor blockquote {
  border-left: 3px solid var(--primary); margin: 8px 0; padding: 6px 14px;
  background: var(--primary-light); color: var(--text-muted); border-radius: 0 6px 6px 0;
}
.wy-editor a { color: var(--primary); }
.wy-file-link {
  display: inline-block; padding: 5px 12px; background: var(--primary-light);
  border: 1px solid #c7d2fe; border-radius: 6px; margin: 4px 0; color: var(--primary-hover);
}

/* 附件区 */
.wy-att-area { border-top: 1px dashed var(--border); background: #fafbfc; padding: 12px 14px; }
.wy-att-label { font-size: 12px; color: #9ca3af; margin-bottom: 8px; }
.wy-att-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 50px; }
.wy-empty { color: #c0c4cc; font-size: 13px; padding: 8px; }
.wy-att-item {
  position: relative; width: 84px; padding: 5px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; text-align: center;
  transition: all .15s;
}
.wy-att-item:hover { border-color: var(--primary); box-shadow: 0 2px 6px rgba(79,70,229,.15); }
.wy-thumb { width: 74px; height: 60px; object-fit: cover; border-radius: 5px; }
.wy-file-icon { font-size: 28px; line-height: 60px; }
.wy-del {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  background: #ef4444; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.wy-tip { padding: 6px 12px; color: var(--primary); font-size: 13px; }

/* 帖子底部附件缩略图 */
.post-attachments { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 10px; }
.att-thumb { width: 120px; }
.att-thumb img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.post-attachments .attach-file { flex-basis: 100%; }
.attach-file a { padding: 5px 12px; background: var(--primary-light); border-radius: 5px; display: inline-block; }

/* ========== 后台 ========== */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.admin-panel { padding: 18px 20px; }
.admin-panel h3 {
  margin: 0 0 14px; font-size: 15px; padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-light); color: var(--text);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; text-align: left; }
.admin-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.admin-table input, .admin-table select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; width: 100%; }

/* 头像上传 */
.avatar-upload { width: 80px; height: 80px; border-radius: 50%; overflow: hidden; background: var(--border); display: flex; align-items: center; justify-content: center; }
.avatar-upload img { width: 100%; height: 100%; object-fit: cover; }

/* 响应式 */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .topnav a, .topnav .hello { font-size: 12.5px; }
  .board-table th, .board-table td, .thread-table th, .thread-table td { padding: 8px 10px; }
  .lastpost { display: none; }
  .thread-masonry { grid-template-columns: 1fr !important; }
}

/* ========== 主题卡片瀑布流 ========== */
.section-title {
  font-size: 20px; font-weight: 800; margin: 24px 0 14px;
  padding-left: 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.thread-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.thread-card {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.6);
  transition: all .3s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  color: var(--text);
}
.thread-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
  color: var(--text);
}
.card-cover {
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: #f1f5f9;
}
.card-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.thread-card:hover .card-cover img { transform: scale(1.08); }
.card-cover.no-img {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
}
.card-cover.no-img::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.15) 0%, transparent 50%);
}
.card-cover.no-img span {
  font-size: 52px; font-weight: 800; color: rgba(255,255,255,.9);
  text-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.card-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 14px; font-weight: 600; line-height: 1.5;
  margin-bottom: 8px; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.card-stats {
  font-size: 11px; color: #94a3b8; margin-top: auto;
  display: flex; gap: 8px; padding-top: 6px; border-top: 1px solid #f3f4f6;
}
.card-forum { margin-left: auto; color: #a5b4fc; font-size: 11px; }

/* 版块入口 chips */
.forum-chips {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 18px;
  background: var(--card);
}
.forum-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; background: var(--primary-light); color: var(--primary-hover);
  border-radius: 20px; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.forum-chip:hover { background: var(--primary); color: #fff; text-decoration: none; }
.chip-count {
  background: rgba(255,255,255,.4); padding: 0 7px; border-radius: 10px; font-size: 11px;
}
.forum-chip:hover .chip-count { background: rgba(255,255,255,.25); color: #fff; }

/* 无限滚动加载提示 */
.load-more {
  text-align: center; padding: 20px; color: #9ca3af; font-size: 13px;
}

/* ========== 左右布局：侧边栏 + 主内容 ========== */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  margin: 16px 0;
  align-items: start;
}
.sidebar {
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(102,126,234,.12);
  border: 1px solid rgba(199,210,254,.5);
  position: sticky;
  top: 68px;
}
.sidebar-group-title {
  color: #6366f1 !important;
  background: linear-gradient(135deg, rgba(102,126,234,.08), rgba(118,75,162,.08)) !important;
}
.sidebar-link {
  color: #475569 !important;
  font-size: 13px;
}
.sidebar-link:hover {
  background: rgba(102,126,234,.1) !important;
  color: #6366f1 !important;
}
.sidebar-count {
  background: rgba(102,126,234,.12) !important;
  color: #818cf8 !important;
  font-size: 11px;
  box-shadow: none;
}
/* header.php里的移动端侧边栏只在移动端显示 */
.mobile-sidebar { display: none !important; }
.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.sidebar-stat {
  padding: 12px 8px;
  text-align: center;
}
.sidebar-stat .num {
  display: block;
  font-size: 18px; font-weight: 700; color: var(--primary);
}
.sidebar-stat .num.online { color: #16a34a; }
.sidebar-stat .lbl { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { padding: 12px; }
.sidebar-group {
  margin-bottom: 10px;
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  transition: all .25s;
}
.sidebar-group:hover {
  border-color: rgba(167,139,250,.4);
  box-shadow: 0 0 20px rgba(139,92,246,.2);
  transform: translateX(2px);
}
.sidebar-group-title {
  padding: 10px 14px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; user-select: none;
  transition: all .15s;
  touch-action: manipulation;
  color: #a78bfa;
  text-shadow: 0 0 10px rgba(167,139,250,.3);
}
.sidebar-group-title:hover { color: var(--primary); }
.sidebar-group-title:active { background: var(--primary-light); }
.sidebar-group-title .arrow {
  display: inline-block; font-size: 10px; width: 14px;
}
.sidebar-link {
  padding: 8px 14px 8px 24px;
  font-size: 13.5px;
}
.sidebar-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  font-size: 13.5px; color: var(--text);
  transition: all .12s;
}
.sidebar-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
  padding-left: 20px;
}
.sidebar-count {
  font-size: 11px; color: var(--text-muted);
  background: #f3f4f6; padding: 1px 7px; border-radius: 8px;
}
.sidebar-link:hover .sidebar-count { background: #ddd6fe; color: var(--primary); }

.sidebar-toggle {
  display: none;
  position: fixed;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 28px;
  padding: 20px 0;
  background: var(--primary); color: #fff;
  border: none; border-radius: 0 8px 8px 0;
  font-size: 14px; cursor: pointer;
  z-index: 180;
  writing-mode: vertical-lr;
  letter-spacing: 4px;
  box-shadow: 2px 0 12px rgba(0,0,0,.2);
}
.sidebar-toggle:hover { background: var(--primary-dark, #5b21b6); }

/* 广告位 */
.ad-banner { margin: 20px 0; border-radius: 12px; overflow: hidden; }
.ad-banner img { max-width: 100%; display: block; }

/* 推荐轮播 */
.carousel {
  position: relative; margin: 20px 0; border-radius: 12px; overflow: hidden;
  height: 380px; box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.carousel-track {
  display: flex; height: 100%; transition: transform .5s ease;
}
.carousel-slide {
  min-width: 100%; height: 100%; position: relative; display: block; color: #fff;
}
.carousel-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: brightness(.5);
}
.carousel-bg.default {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.carousel-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 60px 28px 20px;
  background: linear-gradient(transparent, rgba(100,100,100,.55) 60%);
}
.carousel-overlay h3 {
  margin: 0; font-size: 24px; font-weight: 800; line-height: 1.3;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
  letter-spacing: .5px;
  transition: transform .3s ease, color .3s ease;
}
.carousel:hover .carousel-overlay h3 {
  transform: scale(1.05);
  color: #fff;
  animation: titleWiggle .4s ease;
}
@keyframes titleWiggle {
  0%, 100% { transform: scale(1.05) rotate(0); }
  25% { transform: scale(1.05) rotate(-.5deg); }
  75% { transform: scale(1.05) rotate(.5deg); }
}
.carousel-forum {
  position: absolute; bottom: 16px; right: 24px;
  font-size: 12px; opacity: .7;
}
.carousel-tag {
  position: absolute; top: 16px; left: 16px; z-index: 3;
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 14px; border-radius: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(239,68,68,.4);
}
.carousel-meta .dot-sep { opacity: .5; }

/* 标题滑入动画 */
.carousel-slide.active .carousel-overlay {
  animation: slideUp .6s ease .2s both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,.4); color: #fff; border: none; font-size: 22px;
  cursor: pointer; z-index: 5; transition: background .15s;
}
.carousel-btn:hover { background: rgba(0,0,0,.7); }
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-dots {
  position: absolute; bottom: 12px; right: 20px; z-index: 5;
}
.carousel-dots .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.4); margin: 0 3px; cursor: pointer;
}
.carousel-dots .dot.active { background: #fff; width: 20px; border-radius: 4px; }

/* 轮播特效 */
.carousel-track { transition: transform .6s cubic-bezier(.25,.8,.25,1); }

/* 淡入淡出 */
.effect-fade .carousel-track {
  transform: none !important; transition: none;
}
.effect-fade .carousel-slide {
  position: absolute; top: 0; left: 0; opacity: 0;
  transition: opacity .6s ease; pointer-events: none;
}
.effect-fade .carousel-slide.active {
  opacity: 1; pointer-events: auto;
}

/* 缩放 */
.effect-zoom .carousel-track {
  transform: none !important; transition: none;
}
.effect-zoom .carousel-slide {
  position: absolute; top: 0; left: 0; opacity: 0;
  transform: scale(1.2);
  transition: opacity .6s ease, transform .6s ease;
  pointer-events: none;
}
.effect-zoom .carousel-slide.active {
  opacity: 1; transform: scale(1); pointer-events: auto;
}

/* 翻转 */
.effect-flip .carousel-track {
  transform: none !important; transition: none;
  transform-style: preserve-3d;
}
.effect-flip .carousel-slide {
  position: absolute; top: 0; left: 0; opacity: 0;
  transform: rotateY(-90deg);
  transition: opacity .5s ease, transform .5s ease;
  pointer-events: none;
}
.effect-flip .carousel-slide.active {
  opacity: 1; transform: rotateY(0); pointer-events: auto;
}

/* 回到顶部 */
#backToTop {
  position: fixed; right: 20px; bottom: 30px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: none; align-items: center; justify-content: center;
  font-size: 20px; text-decoration: none; z-index: 100;
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
  transition: transform .15s;
}
#backToTop:hover { transform: translateY(-3px); }

/* 汉堡包按钮 */
.topbar-toggle {
  display: none;
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 10px;
}

/* 简洁统计栏 */
.stats-bar {
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 12px 20px; margin: 14px 0;
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted);
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.6);
}
.stats-bar span { white-space: nowrap; }
.online-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 4px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50% { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* 移动端：侧边栏变下拉 */
@media (max-width: 768px) {
  .sidebar-count { display: none; }
  .layout { grid-template-columns: 1fr !important; }
  .layout > .sidebar { display: none !important; }
  .sidebar-toggle { display: block; }
  .mobile-sidebar {
    display: block !important;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 240px;
    z-index: 200;
    border-radius: 0 12px 12px 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
    max-height: none;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .25s ease-out;
    background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  }
  body.sidebar-open .mobile-sidebar { transform: translateX(0); }
  /* 移动端默认展开所有版块 */
  .sidebar-group .sidebar-group-items { display: block !important; }
  .sidebar-group-title .arrow { transform: rotate(90deg) !important; }
  body.sidebar-open::after {
    content: '';
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 150;
  }
  /* 移动端顶栏汉堡包 */
  .topbar-toggle { display: block; }
  .topbar-inner { position: relative; flex-wrap: nowrap; }
  .topnav {
    display: none;
    position: absolute; top: 100%; right: 0; left: 0;
    background: #1e1b4b;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0; font-size: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,.25);
    z-index: 300;
  }
  body.nav-open .topnav { display: flex; }
  .topnav a, .topnav .nav-welcome {
    margin-left: 0 !important;
    padding: 12px 20px;
    color: #e0e7ff;
    border-bottom: 1px solid rgba(255,255,255,.06);
    text-align: left;
    display: block;
  }
  .topnav a:hover { background: rgba(255,255,255,.06); color: #fff; }
  .nav-group { border-bottom: 4px solid rgba(255,255,255,.08); }
  .nav-group:last-child { border-bottom: none; }
  .nav-welcome {
    color: #c7d2fe; font-size: 13px;
    background: rgba(99,102,241,.15);
    display: flex; justify-content: space-between; align-items: center;
  }
  .nav-welcome a {
    padding: 0 !important; border: none !important;
    display: inline !important; margin-left: 0 !important;
  }
  .badge-dot {
    display: inline-block; background: #ef4444; color: #fff;
    font-size: 11px; padding: 1px 6px; border-radius: 8px; margin-left: 4px;
  }
  .carousel { height: 240px; }
  .carousel-overlay h3 { font-size: 16px; }
}
