/* 首页版块表格 */
.forum-table { width: 100%; }
.forum-row {
  display: grid;
  grid-template-columns: 56px 1fr 90px 90px 200px;
  gap: 12px;
  padding: 14px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.forum-row:last-child { border-bottom: none; }
.forum-row:hover { background: var(--surface-2); }
.forum-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: var(--primary-dark);
}
.forum-icon.hot { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #b91c1c; }
.forum-icon.tech { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #047857; }
.forum-icon.life { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309; }
.forum-icon.game { background: linear-gradient(135deg, #e9d5ff, #d8b4fe); color: #6b21a8; }
[data-theme="dark"] .forum-icon { background: rgba(59,130,246,.15); color: #93c5fd; }
[data-theme="dark"] .forum-icon.hot { background: rgba(239,68,68,.15); color: #fca5a5; }
[data-theme="dark"] .forum-icon.tech { background: rgba(16,185,129,.15); color: #6ee7b7; }
[data-theme="dark"] .forum-icon.life { background: rgba(245,158,11,.15); color: #fcd34d; }
[data-theme="dark"] .forum-icon.game { background: rgba(168,85,247,.15); color: #d8b4fe; }
.forum-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.forum-name a { color: var(--text); }
.forum-name a:hover { color: var(--primary); text-decoration: none; }
.forum-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

.forum-stat { text-align: center; }
.forum-stat .num { font-size: 15px; font-weight: 600; color: var(--text); }
.forum-stat .lbl { font-size: 11px; color: var(--text-muted); }
.forum-last {
  font-size: 12px;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 12px;
}
.forum-last .t-title {
  color: var(--text);
  font-size: 13px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.forum-last .t-title:hover { color: var(--primary); }
.forum-last .t-meta { font-size: 11px; }

/* 版块页头部：标题 + 副标题 + 发新帖按钮 */
.forum-head { gap: 10px; }
.forum-head-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  /* min-width:0 必须有：否则副标题的 min-content 宽度会把按钮顶出卡片外，
     进而把整个页面撑宽出现横向滚动 */
  min-width: 0;
  flex: 1;
}
.forum-head-title { flex-shrink: 0; }
.forum-head-sub {
  min-width: 0;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forum-head-action {
  margin-left: auto;
  flex-shrink: 0;
  padding: 6px 14px;
  font-weight: 400;
}

@media (max-width: 900px) {
  /* 移动端标题与副标题上下排列，发新帖按钮始终贴右侧 */
  .forum-head-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .forum-head-title { flex-shrink: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .forum-head-sub { max-width: 100%; }
  .forum-head-action { padding: 6px 12px; font-size: 12px; }
}
@media (max-width: 480px) {
  .forum-head { gap: 8px; }
  .forum-head-action { padding: 6px 10px; }
}

/* Sidebar cards */
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.side-card-h {
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.side-card-h .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-red); }
.side-card-body { padding: 12px 14px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 12px; }
.stat-item { text-align: center; padding: 8px; background: var(--surface-2); border-radius: 6px; }
.stat-item .n { font-size: 18px; font-weight: 700; color: var(--primary); }
.stat-item .l { font-size: 11px; color: var(--text-muted); }

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.rank-list li .idx {
  width: 20px; height: 20px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
}
.rank-list li:nth-child(1) .idx { background: #ef4444; color: #fff; }
.rank-list li:nth-child(2) .idx { background: #f59e0b; color: #fff; }
.rank-list li:nth-child(3) .idx { background: #eab308; color: #fff; }
.rank-list li .r-title {
  flex: 1; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-list li .r-title:hover { color: var(--primary); }
.rank-list li .r-hot { font-size: 11px; color: var(--text-faint); }

/* 最新回复 / 最新帖子 列表 */
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.side-list li:first-child { padding-top: 0; }
.side-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.side-list .sl-main { flex: 1; min-width: 0; }
.side-list .sl-title {
  display: block;
  font-size: 13px; line-height: 1.5; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-list .sl-title:hover { color: var(--primary); }
.side-list .sl-excerpt {
  display: block;
  margin-top: 2px;
  font-size: 12px; line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.side-list .sl-excerpt:hover { color: var(--text); }
.side-list .sl-meta {
  margin-top: 2px;
  font-size: 11px; color: var(--text-faint);
  display: flex; align-items: center; gap: 6px;
}
.side-list .sl-author {
  max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-list .sl-time { margin-left: auto; flex-shrink: 0; }
.side-empty { font-size: 12px; color: var(--text-faint); }

@media (max-width: 900px) {
  .forum-row { grid-template-columns: 48px 1fr 70px; gap: 10px; padding: 12px; }
  /* 只保留"主题"一列。注意不能用 .forum-stat:last-of-type ——
     :last-of-type 按元素类型算，最后一个 div 是 .forum-last，选不中第二个统计列，
     多出来的格子会被挤到第二行导致整行错位。 */
  .forum-row .forum-stat + .forum-stat,
  .forum-row .forum-last { display: none; }
  .forum-icon { width: 40px; height: 40px; font-size: 19px; border-radius: 9px; }
  .forum-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  .forum-row { grid-template-columns: 40px 1fr 52px; gap: 8px; padding: 12px 10px; }
  .forum-name { font-size: 14px; }
  .forum-stat .num { font-size: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* 搜索页「用户」结果块 */
.user-hits { margin-bottom: 16px; }
.user-hit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px;
}
.user-hit {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  min-width: 0;
}
.user-hit:hover { background: var(--surface-2); text-decoration: none; }
.user-hit-main { display: flex; flex-direction: column; min-width: 0; }
.user-hit-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-hit:hover .user-hit-name { color: var(--primary); }
.user-hit-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.user-hit-more {
  padding: 8px 16px 12px;
  font-size: 12px; color: var(--text-faint);
}
