/* ============================================================================
   觅智社区 · 首页内嵌样式（forum.css 的 namespace 子集）
   - 所有规则以 .community-section 为前缀，不污染其他页面
   - 复用 index.css 的 :root CSS 变量（与 forum.css 同色系，已对齐到 #4a5ce0 靛紫）
   - 不复制全局 reset（html/body/main 等），由 index.css 负责
   - 子类名（post-card / tag / meta / card-link ...）是 forum.js buildCard() 写死的，
     必须同名；通过父级 .community-section 隔离作用域即可
   - 例外：.cpm-* 为帖子详情弹窗样式，弹窗由 JS 懒挂载到 <body>（.community-section
     之外），故不加前缀；配套 body.cpm-open 滚动锁
   ============================================================================ */

.community-section {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 60px 40px 80px;
  /* 横向 padding 不做 900px 阶跃（40↔20），改连续渐变：视口 900→1000px 线性
     20→40px。阶跃会让容器宽在 900→901px 处骤降 ~40px、向下穿越瀑布流 4 列
     阈值（842px），出现「变宽反而 4→3→4 列」的凹陷；渐变后容器宽
     w = vw − 2·p(vw) 全区间连续且单调递增（渐变段斜率 0.6），列数曲线单调不减 */
  padding-inline: clamp(20px, calc((100vw - 900px) * 0.2 + 20px), 40px);
}

/* 标题区 */
.community-section .com-head { margin-bottom: 16px; }
.community-section .com-title {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
.community-section .com-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.06em;
}

/* 列表工具行：发布按钮右对齐 */
.community-section .com-list-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin: 16px 0 24px;
  flex-wrap: wrap;
}
.community-section .com-publish-btn {
  padding: 10px 22px;
  background: var(--accent);
  color: var(--text-on-accent);
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(74, 92, 224, 0.30);
  transition: all 0.18s ease;
  text-decoration: none;
  display: inline-block;
}
.community-section .com-publish-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* 瀑布流容器（自然高度：js 模式由库自设容器高度，css 模式 column 布局自适应；
   去内滚后随页面滚动，触底加载由 sentinel + IntersectionObserver 驱动） */
.community-section .com-waterfall {
  position: relative;
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg-card);
}
/* 触底加载观察锚点（js 模式下瀑布流子项为 absolute 布局，锚点须在容器外） */
.community-section .com-wf-sentinel {
  width: 100%;
  height: 1px;
}
.community-section .com-waterfall.css-fallback {
  column-count: 5;
  column-gap: 14px;
  padding: 14px;
  height: auto;
  overflow: visible;
}
@media (max-width: 600px) {
  .community-section .com-waterfall.css-fallback { column-count: 3; }
}
@media (max-width: 420px) {
  .community-section .com-waterfall.css-fallback { column-count: 2; }
}

/* 帖子卡片（子结构名由 forum.js buildCard() 写死，需保留同名） */
.community-section .post-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  margin: 0 0 16px 0;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  break-inside: avoid;
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.community-section .post-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(74, 92, 224, 0.10), 0 8px 24px rgba(0, 0, 0, 0.06);
}
.community-section .post-card .cover-wrap {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  overflow: hidden;
}
.community-section .post-card .cover {
  width: 100%;
  height: auto;
  display: block;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  object-fit: cover;
}
.community-section .post-card.cover-16-9 .cover-wrap { aspect-ratio: 16 / 9; }
.community-section .post-card.cover-3-4  .cover-wrap { aspect-ratio: 3 / 4; }
.community-section .post-card:not(.cover-16-9):not(.cover-3-4) .cover { min-height: 160px; }
/* 阶段5：媒体角标（视频帖 ▶ / 多图帖 n图） */
.community-section .post-card .media-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  pointer-events: none;
}
.community-section .post-card .media-badge.is-video { font-size: 12px; }
.community-section .post-card:nth-child(5n+1):not(.cover-16-9):not(.cover-3-4) .cover { min-height: 180px; }
.community-section .post-card:nth-child(5n+2):not(.cover-16-9):not(.cover-3-4) .cover { min-height: 260px; }
.community-section .post-card:nth-child(5n+3):not(.cover-16-9):not(.cover-3-4) .cover { min-height: 200px; }
.community-section .post-card:nth-child(5n+4):not(.cover-16-9):not(.cover-3-4) .cover { min-height: 240px; }
.community-section .post-card:nth-child(5n+5):not(.cover-16-9):not(.cover-3-4) .cover { min-height: 160px; }
.community-section .post-card .body { padding: 14px 16px 16px; }
.community-section .post-card h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 6px;
}
.community-section .post-card .summary {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.community-section .post-card .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-hint);
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.community-section .post-card .meta .avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
/* 真实头像图：撑满圆形容器（无图时仍为首字母圆点） */
.community-section .post-card .meta .avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.community-section .post-card .meta .name { color: var(--text-secondary); font-weight: 500; }
.community-section .post-card .meta .spacer { flex: 1; }
.community-section .post-card .tags {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.community-section .post-card .tag {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--bg-soft);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.community-section .post-card.is-top { border-color: #f59e0b; }
.community-section .post-card.is-top::before {
  content: '置顶';
  position: absolute;
  top: 8px; left: 8px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  z-index: 1;
  letter-spacing: 0.05em;
}

/* 整卡覆盖跳转 + 作者跳转 */
.community-section .post-card .card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  text-indent: -9999px;
  overflow: hidden;
  background: transparent;
}
.community-section .post-card .user-link {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  border-radius: 999px;
}
.community-section .post-card .user-link:hover .name { color: var(--accent); }
.community-section .post-card .user-link:hover .avatar { background: var(--accent); color: #fff; }

/* 喜欢按钮（卡片底部，位于 card-link 覆盖层之上） */
.community-section .like-btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-hint);
  line-height: 1;
  border-radius: 999px;
  transition: all .15s;
}
.community-section .like-btn svg { width: 15px; height: 15px; }
.community-section .like-btn:hover { background: #fef2f2; color: #dc2626; }
.community-section .like-btn.active { color: #dc2626; }
.community-section .like-btn.active svg { fill: currentColor; }

/* 骨架屏（首次加载 / 刷新列表；挂在瀑布流容器外的文档流中） */
.community-section .com-skeleton {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.community-section .com-skeleton .sk-card {
  flex: 0 1 200px;
  min-width: 0;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg-card);
  overflow: hidden;
}
.community-section .com-skeleton .sk-body { padding: 12px 14px 16px; }
.community-section .com-skeleton .sk-body .sk-line { height: 12px; margin-bottom: 8px; }
.community-section .com-skeleton .sk-body .sk-line:last-child { margin-bottom: 0; }
.community-section .sk-bone {
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
  border-radius: 6px;
}
.community-section .sk-bone::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.22), transparent);
  animation: comSkShimmer 1.4s ease-in-out infinite;
}
@keyframes comSkShimmer { 100% { transform: translateX(100%); } }
/* 追加加载态（滚动到底部加载下一页） */
.community-section .state-box.compact { padding: 28px 20px; }
.community-section .sk-spin {
  width: 22px;
  height: 22px;
  margin: 0 auto 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: comSkSpin 0.8s linear infinite;
}
@keyframes comSkSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .community-section .sk-bone::after { animation: none; }
  .community-section .sk-spin { animation: none; border-top-color: var(--border); }
}

/* 加载 / 空 / 错误态 */
.community-section .state-box {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 14px;
  grid-column: 1 / -1;
}
.community-section .state-box .icon { font-size: 32px; margin-bottom: 8px; }
.community-section .state-box.error { color: var(--danger); }
.community-section .state-box .retry-btn {
  margin-top: 12px;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.1em;
}

/* 查看全部 */
.community-section .com-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 24px;
  padding: 10px 22px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-decoration: none;
  transition: all 0.18s ease;
}
.community-section .com-more:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-on-accent);
}

/* 窄屏：仅压缩纵向留白；横向由基座的 clamp 连续渐变接管（≤900px 恒 20px），
   避免 900px 处容器宽阶跃造成瀑布流列数凹陷 */
@media (max-width: 900px) {
  .community-section { padding-top: 40px; padding-bottom: 60px; }
}

/* ============================================================================
   觅智社区 · SPA 视图样式（详情 / 发布 / 申诉 / 个人中心）
   ============================================================================ */

/* ---- 公共：返回按钮 + 状态框 ---- */
.community-section .com-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 7px 16px;
  margin-bottom: 14px;
  transition: all 0.18s ease;
  text-decoration: none;
}
.community-section .com-back-link:hover {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 4px 12px rgba(74, 92, 224, 0.25);
}
.community-section .com-state-box {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  margin: 12px 0;
}
.community-section .com-state-box .icon { font-size: 32px; margin-bottom: 8px; }
.community-section .com-state-box.error { color: var(--danger); border-color: var(--danger); }
.community-section .com-state-box a { color: var(--accent); text-decoration: underline; }

/* ============================================================================
   帖子详情弹窗（body 层单例 · .cpm- 前缀）
   - 由 community-on-home.js 的 PostModal 懒挂载到 <body>，不依赖 .community-section
   - 左图右文双栏；色系复用 index.css 的 CSS 变量
   ============================================================================ */

body.cpm-open { overflow: hidden; }

.cpm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: cpm-fade .18s ease;
}
.cpm-overlay[hidden] { display: none; }
@keyframes cpm-fade { from { opacity: 0; } to { opacity: 1; } }

.cpm-dialog {
  position: relative;
  width: min(1080px, 92vw);
  height: min(86vh, 860px);
  background: var(--bg-card, #fff);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .35);
  animation: cpm-pop .2s cubic-bezier(.21, 1.02, .55, 1.05);
}
@keyframes cpm-pop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* 左：封面媒体栏 */
.cpm-media {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg-card, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cpm-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.cpm-media-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(15, 23, 42, .62);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .1em;
  pointer-events: none;
}
.cpm-media-state {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #94a3b8;
  background: var(--bg-card, #fff);
}
.cpm-media-state.cpm-media-state-dark { background: #0f172a; }

/* 阶段5：详情媒体扩展（视频 / 多图轮播） */
.cpm-video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #0f172a;
}
.cpm-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}
.cpm-carousel-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.cpm-car-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cpm-car-btn:hover { background: rgba(15, 23, 42, 0.82); }
.cpm-car-btn.prev { left: 10px; }
.cpm-car-btn.next { right: 10px; }
.cpm-car-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 1px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  pointer-events: none;
}
.cpm-car-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}
.cpm-car-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  pointer-events: auto;
}
.cpm-car-dot.active { background: #fff; }
@media (max-width: 720px) {
  .cpm-car-btn { width: 28px; height: 28px; font-size: 16px; }
}

/* 右：信息栏（头部 / 滚动区 / 底部栏 三段） */
.cpm-side {
  flex: 0 0 420px;
  width: 420px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border-left: 1px solid var(--border-soft, #eef0f3);
}

.cpm-side-head {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft, #eef0f3);
}
.cpm-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent, #4a5ce0);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.cpm-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.cpm-author {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cpm-head-spacer { flex: 1; }
.cpm-follow {
  flex-shrink: 0;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--accent, #4a5ce0);
  background: transparent;
  border: 1px solid var(--accent, #4a5ce0);
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}
.cpm-follow:hover { background: rgba(74, 92, 224, .08); }
.cpm-follow.active { background: var(--accent, #4a5ce0); color: var(--text-on-accent, #fff); }
.cpm-more-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cpm-more-btn:hover { background: var(--bg-soft, #f5f6f8); }
.cpm-more-btn svg { width: 18px; height: 18px; }
.cpm-more-menu {
  position: absolute;
  top: 50px;
  right: 12px;
  z-index: 3;
  min-width: 150px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-soft, #eef0f3);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .16);
}
.cpm-more-menu[hidden] { display: none; }
.cpm-more-menu button {
  text-align: left;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary, #4b5563);
  cursor: pointer;
}
.cpm-more-menu button:hover { background: var(--bg-soft, #f5f6f8); }
.cpm-more-menu button.danger { color: var(--danger, #dc2626); }

/* 中部滚动区：标题 / 标签 / 日期 / 正文 / 评论流 */
.cpm-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.cpm-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary, #1f2937);
}
.cpm-tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.cpm-tag { font-size: 13px; color: var(--accent, #4a5ce0); }
.cpm-content .cpm-topic { color: var(--accent, #4a5ce0); font-weight: 500; }
.cpm-date { font-size: 12px; color: var(--text-hint, #9ca3af); margin-bottom: 12px; }
.cpm-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary, #1f2937);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
}
.cpm-cmt-head {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  padding: 12px 0;
  border-top: 1px solid var(--border-soft, #eef0f3);
}
.cpm-cmt { display: flex; gap: 10px; padding: 14px 0; }
.cpm-cmt + .cpm-cmt { border-top: 1px solid var(--border-soft, #f3f4f6); }
.cpm-cmt-body { flex: 1; min-width: 0; }
.cpm-cmt-name {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  font-weight: 500;
  margin-bottom: 3px;
}
.cpm-cmt-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary, #1f2937);
  white-space: pre-wrap;
  word-break: break-word;
}
.cpm-cmt-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-hint, #9ca3af);
}
.cpm-cmt-meta button {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11px;
  font-family: inherit;
  color: var(--text-hint, #9ca3af);
  cursor: pointer;
}
.cpm-cmt-meta button:hover { color: var(--accent, #4a5ce0); }
.cpm-reply-to { color: var(--text-hint, #9ca3af); }
.cpm-empty {
  text-align: center;
  color: var(--text-hint, #9ca3af);
  font-size: 13px;
  padding: 30px 0;
}

/* 加载 / 错误态 */
.cpm-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}
.cpm-state.error { color: var(--danger, #dc2626); }
.cpm-state-icon { font-size: 32px; }

/* 底部固定栏：评论输入 + 赞 / 藏 / 评 / 分享 */
.cpm-foot {
  position: relative;   /* 分享菜单（.cpm-share-menu）的定位锚点 */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border-soft, #eef0f3);
}
.cpm-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: var(--bg-soft, #f5f6f8);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary, #1f2937);
}
.cpm-input:focus { outline: none; background: #eef2ff; }
.cpm-actions { flex-shrink: 0; display: flex; align-items: center; gap: 14px; }
.cpm-act {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary, #4b5563);
  cursor: pointer;
}
.cpm-act-static { cursor: default; }
.cpm-act svg { width: 20px; height: 20px; }
.cpm-act:hover { color: var(--accent, #4a5ce0); }
.cpm-act.cpm-like.active { color: #ef4444; }
.cpm-act.cpm-like.active svg { fill: currentColor; }
.cpm-act.cpm-fav.active { color: #f59e0b; }
.cpm-act.cpm-fav.active svg { fill: currentColor; }

/* 分享·复制链接兜底：execCommand 用的临时 textarea（CSP 禁内联 style，独立 class 移出视口） */
.cpm-clip-helper {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

/* ---- 社区 toast（#comToast 挂载在 body 上，同 .cpm-* 例外不加 .community-section 前缀；
      样式对齐 index.css 的 .toast：默认透明，.show 淡入，success/error 变体换底色） ---- */
.com-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent, #4a5ce0);
  color: var(--text-on-accent, #fff);
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1200;   /* 高于帖子弹窗（.cpm-overlay z-index 1000），提示不被遮罩盖住 */
  box-shadow: 0 8px 24px rgba(74, 92, 224, 0.35);
}
.com-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.com-toast.success { background: var(--success, #10b981); }
.com-toast.error { background: var(--danger, #dc2626); }
.com-toast.warn { background: #d97706; }

/* ---- 私信好友选择浮层（帖子弹窗内二级模态，遮罩即容器） ---- */
.cpm-share-friends {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .45);
}
.cpm-share-friends[hidden] { display: none; }
.cpm-sf-card {
  width: min(320px, 86vw);
  max-height: 62%;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
  overflow: hidden;
}
.cpm-sf-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft, #eef0f3);
}
.cpm-sf-title { font-size: 14px; font-weight: 600; color: var(--text-primary, #1f2937); }
.cpm-sf-close {
  border: 0;
  background: none;
  padding: 2px 6px;
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary, #4b5563);
  cursor: pointer;
}
.cpm-sf-list { overflow-y: auto; padding: 6px; }
.cpm-sf-state { padding: 24px 10px; text-align: center; font-size: 13px; color: var(--text-secondary, #4b5563); }
.cpm-sf-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
}
.cpm-sf-row:hover { background: var(--bg-soft, #f5f6f8); }
.cpm-sf-row:disabled { opacity: .55; cursor: default; }
.cpm-sf-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-soft, #f5f6f8);
  color: var(--accent, #3b82f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  overflow: hidden;
}
.cpm-sf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cpm-sf-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cpm-sf-name { font-size: 13px; color: var(--text-primary, #1f2937); }
.cpm-sf-username { font-size: 12px; color: #9ca3af; }

/* ---- 分享菜单 popover（外观对齐 .cpm-more-menu；方位变体由 JS positionShareMenu 决定） ---- */
.cpm-share-menu {
  position: absolute;
  bottom: calc(100% + 8px);   /* 基准态：触发栏上方，GAP=8 与 JS 一致 */
  right: 0;
  z-index: 4;                 /* 好友浮层(5) > 分享菜单(4) > ⋯菜单(3) */
  min-width: 150px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-soft, #eef0f3);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .16);
}
.cpm-share-menu[hidden] { display: none; }
.cpm-share-menu.down { bottom: auto; top: calc(100% + 8px); }
.cpm-share-menu.align-left { right: auto; left: 0; }
.cpm-share-menu.clamp-center { right: auto; left: 50%; transform: translateX(-50%); }
.cpm-share-item {
  text-align: left;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary, #4b5563);
  cursor: pointer;
  white-space: nowrap;
}
.cpm-share-item:hover { background: var(--bg-soft, #f5f6f8); color: var(--text-primary, #1f2937); }

/* 窄屏：上下堆叠近全屏（上图下文） */
@media (max-width: 760px) {
  .cpm-overlay { padding: 0; }
  .cpm-dialog {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    flex-direction: column;
  }
  .cpm-media { flex: 0 0 auto; height: 38vh; }
  .cpm-side {
    flex: 1 1 auto;
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--border-soft, #eef0f3);
  }
}

/* ---- 视图 3：发布表单 ---- */
.community-section .com-publish-wrap { max-width: 720px; margin: 0 auto; }
.community-section .com-publish-title {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
.community-section .com-publish-form {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 32px;
}
.community-section .com-publish-form label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}
.community-section .com-publish-form input[type="text"],
.community-section .com-publish-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.community-section .com-publish-form input[type="text"]:focus,
.community-section .com-publish-form textarea:focus {
  outline: 0;
  border-color: var(--accent);
}
.community-section .com-publish-form textarea {
  min-height: 200px;
  resize: vertical;
}
.community-section .com-publish-form .com-hint {
  font-size: 11px;
  color: var(--text-hint);
  margin-top: -12px;
  margin-bottom: 8px;
}
/* 话题实时预览 */
.community-section .com-topic-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  min-height: 22px;
  align-items: center;
}
.community-section .com-topic-placeholder {
  font-size: 12px;
  color: var(--text-hint);
}
.community-section .com-topic-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-soft, rgba(59,130,246,0.12));
  color: var(--accent, #3b82f6);
  font-size: 12px;
  line-height: 18px;
}
.community-section .com-topic-warn {
  font-size: 12px;
  color: var(--danger, #ef4444);
}
.community-section .com-topic-preview.overlimit .com-topic-chip {
  background: var(--danger-soft, rgba(239,68,68,0.12));
  color: var(--danger, #ef4444);
}
/* ===== 发帖多媒体（多图 ≤9 / 单视频，小红书式；阶段3）===== */
.community-section .com-media-uploader { margin-bottom: 16px; }
.community-section .com-media-uploader.dragover .com-media-grid,
.community-section .com-media-uploader.dragover .com-media-empty {
  outline: 2px dashed var(--accent, #3b82f6);
  outline-offset: 2px;
  border-radius: 10px;
}
.community-section .com-media-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.community-section .com-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  max-width: 520px;
  margin-bottom: 8px;
}
.community-section .com-media-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-muted);
  border: 1px solid var(--border-soft);
}
.community-section .com-media-tile img,
.community-section .com-media-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.community-section .com-media-tile.is-uploading { opacity: 0.75; }
.community-section .com-media-veil {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}
.community-section .com-media-tile.is-uploading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: com-media-spin 0.8s linear infinite;
}
@keyframes com-media-spin { to { transform: rotate(360deg); } }
.community-section .com-media-cover-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}
.community-section .com-media-badge-play {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 24px;
  text-align: center;
}
.community-section .com-media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.community-section .com-media-remove:hover { background: var(--danger, #ef4444); }
.community-section .com-media-add {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-hint);
  cursor: pointer;
  font-family: inherit;
}
.community-section .com-media-add:hover { border-color: var(--accent); color: var(--accent); }
.community-section .com-media-add .plus { font-size: 22px; line-height: 1; }
.community-section .com-media-add .num { font-size: 11px; }
.community-section .com-media-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.community-section .com-media-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 26px;
  width: calc(100% - 16px);
  height: 6px;
  accent-color: var(--accent, #3b82f6);
}
.community-section .com-media-err-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  font-size: 11px;
  text-align: center;
}
.community-section .com-media-hint { font-size: 11px; color: var(--text-hint); }
.community-section .com-btn {
  padding: 10px 24px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  letter-spacing: 0.1em;
}
.community-section .com-btn.primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.community-section .com-btn:hover { border-color: var(--accent); color: var(--accent); }
.community-section .com-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-on-accent);
}
.community-section .com-btn:disabled { opacity: 0.6; cursor: wait; }
.community-section .com-publish-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ---- 视图 4 / 5：申诉 + 个人中心 共享卡片 ---- */
.community-section .com-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
}
.community-section .com-card-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.community-section .com-seg-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.community-section .com-seg {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  transition: all 0.18s ease;
}
.community-section .com-seg:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.community-section .com-seg.active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.community-section .com-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-hint);
  font-size: 13px;
}

/* 申诉条目 */
.community-section .com-appeal {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}
.community-section .com-appeal:last-child { border-bottom: 0; }
.community-section .com-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.community-section .com-post-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
}
.community-section .com-post-link:hover { color: var(--accent); }
.community-section .com-appeal-reason {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
  white-space: pre-wrap;
}
.community-section .com-appeal-meta {
  font-size: 11px;
  color: var(--text-hint);
}
.community-section .com-appeal-handle {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.community-section .com-appeal-note {
  margin-top: 4px;
  color: var(--text-secondary);
}

/* Pills */
.community-section .com-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.community-section .com-pill.pill-pending {
  background: #fef3c7;
  color: #92400e;
}
.community-section .com-pill.pill-approved {
  background: #d1fae5;
  color: #065f46;
}
.community-section .com-pill.pill-rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* Trash item */
.community-section .com-trash-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.community-section .com-trash-item:last-child { border-bottom: 0; }
.community-section .com-trash-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.community-section .com-trash-title {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}
.community-section .com-trash-title:hover { color: var(--accent); }
.community-section .com-trash-reason {
  font-size: 12px;
  color: #92400e;
  margin-top: 4px;
}

/* ---- 视图 5：个人中心 ---- */
.community-section .com-me-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.community-section .com-me-item:last-child { border-bottom: 0; }
.community-section .com-me-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.community-section .com-me-title {
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
}
.community-section .com-me-title:hover { color: var(--accent); }
.community-section .com-me-content {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 4px;
  white-space: pre-wrap;
}
.community-section .com-me-meta {
  font-size: 11px;
  color: var(--text-hint);
}
.community-section .com-me-reason {
  font-size: 11px;
  color: #92400e;
  margin-top: 4px;
}

/* ---- 窄屏 ---- */
@media (max-width: 900px) {
  .community-section .com-publish-form { padding: 20px; }
}

/* ---- 深色模式（token 随 index.css dark :root 生效，此处仅覆盖硬编码浅色） ---- */
@media (prefers-color-scheme: dark) {
  /* 封面占位渐变 */
  .community-section .post-card .cover-wrap,
  .community-section .post-card .cover-wrap .cover {
    background: linear-gradient(135deg, #1d2743, #26305a);
  }
  /* 卡片悬浮阴影加深 */
  .community-section .post-card:hover {
    box-shadow: 0 4px 12px rgba(124, 138, 240, 0.12), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
  /* 喜欢按钮 */
  .community-section .like-btn:hover { background: rgba(220, 38, 38, 0.16); color: #f87171; }
  .community-section .like-btn.active { color: #f87171; }
  /* 评论输入聚焦 */
  .cpm-input:focus { background: rgba(124, 138, 240, 0.14); }
  /* 状态 pill（浅底深字 → 深底亮字） */
  .community-section .com-pill.pill-pending { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
  .community-section .com-pill.pill-approved { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
  .community-section .com-pill.pill-rejected { background: rgba(220, 38, 38, 0.16); color: #fca5a5; }
  .community-section .com-trash-reason,
  .community-section .com-me-reason { color: #fcd34d; }
}
