/**
 * 动态广场（?type=feed）专属样式 —— 2026-11-16 社区化落地
 * 先例：library-list.css / museum-home.css。全走 theme-vars 既有令牌（--accent 系 / --ink 系 /
 * --bg 系 / --line 系 / --radius 系 / --shadow 系），零裸 hex；暗色主题自适应。
 * 结构约定见 _special.php::_sj_view_feed()（fd-* 前缀与设计原型 docs/动态广场-设计原型-2026-11-16.html 一致）。
 */

/* ---------- hero ---------- */
.fd-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 26px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.fd-hero-l { min-width: 0; }
.fd-hero .mh-ag-kicker { display: block; letter-spacing: 3px; font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.fd-hero .mh-ag-title { font-family: var(--font-serif); font-size: 26px; line-height: 1.3; color: var(--ink); margin: 0 0 6px; }
.fd-hero .mh-ag-sub { font-size: 13px; color: var(--ink-3); margin: 0; }
.fd-hero-stats { display: flex; gap: 26px; flex-shrink: 0; }
.fd-hero-stats div { text-align: center; }
.fd-hero-stats b { display: block; font-size: 20px; color: var(--accent); font-variant-numeric: tabular-nums; }
.fd-hero-stats span { font-size: 12px; color: var(--ink-3); }

/* ---------- 双栏骨架（显式锁定列位，防 grid 自动放置错位） ---------- */
.fd-body { display: grid; grid-template-columns: 1fr 300px; gap: 26px; align-items: start; padding-bottom: 40px; }
.fd-body > .fd-tabs, .fd-body > .fd-stream { grid-column: 1; }
.fd-body > .fd-rail { grid-column: 2; grid-row: 1 / span 4; }

/* ---------- Tabs ---------- */
.fd-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 6px 0 14px; }
.fd-tab { padding: 9px 16px; border: none; background: none; font-family: inherit; font-size: 14px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color var(--transition-fast, .15s); }
.fd-tab:hover { color: var(--ink); }
.fd-tab.on { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }

/* ---------- 发帖框 ---------- */
.fd-composer { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); }
.fd-composer-head { display: flex; gap: 10px; align-items: flex-start; }
/* v5.1：字数移入输入框内部（右下角绝对定位），textarea 让出底部空间防遮字 */
.fd-inputwrap { flex: 1; position: relative; min-width: 0; }
.fd-composer textarea { display: block; width: 100%; min-height: 64px; border: none; resize: vertical; font-family: inherit; font-size: 14px; line-height: 1.7; color: var(--ink); background: transparent; outline: none; padding-bottom: 24px; }
.fd-composer textarea::placeholder { color: var(--ink-3); }
/* v5.2：话题实时高亮（overlay）——textarea 文字透明只留光标，底层 fdHl 渲染同文本上色。
   两层必须同字体/行高/padding/换行规则，否则错位 */
.fd-composer textarea { color: transparent; caret-color: var(--accent); }
/* padding 必须与全局 textarea 基类（components.css: 9px 12px）逐值对齐，否则 overlay 错位 */
.fd-hl { position: absolute; inset: 0; padding: 9px 12px 24px; margin: 0; border: none; box-sizing: border-box; font-family: inherit; font-size: 14px; line-height: 1.7; color: var(--ink); background: transparent; pointer-events: none; white-space: pre-wrap; overflow-wrap: break-word; overflow: hidden; }
/* 话题底色外扩 3px 用负 margin 抵消，内联 padding 会推动后续排版造成光标错位 */
.fd-hl-topic { color: var(--accent); background: var(--accent-weak); border-radius: var(--radius-sm, 6px); padding: 0 3px; margin: 0 -3px; font-weight: 600; }
/* v5.1：工具按钮与发布按钮合并为一行、整体靠右 */
.fd-composer-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.fd-tool-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink-2); font-size: 12px; font-family: inherit; cursor: pointer; transition: color var(--transition-fast, .15s), border-color var(--transition-fast, .15s), background var(--transition-fast, .15s); }
.fd-tool-btn svg { width: 14px; height: 14px; }
.fd-tool-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); }
.fd-count { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; pointer-events: none; z-index: 1; }
.fd-cprev { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.fd-cprev-item { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-light); }
.fd-cprev-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fd-cprev-x { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border: none; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fd-cprev-x:hover { background: var(--accent); }
.fd-cprev-more { aspect-ratio: 1; border: 1px dashed var(--line); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-3); font-size: 11px; font-family: inherit; cursor: pointer; background: var(--bg); }
.fd-cprev-more:hover { color: var(--accent); border-color: var(--accent); }
.fd-cprev-more b { font-size: 16px; line-height: 1; }
.fd-cprev-item .fd-up-tag { position: absolute; left: 4px; bottom: 4px; font-size: 10px; padding: 1px 5px; border-radius: var(--radius); background: rgba(0, 0, 0, .5); color: #fff; }
.fd-post-btn { padding: 7px 22px; border: none; border-radius: var(--radius-full); background: var(--accent); color: #fff; font-size: 13px; font-family: inherit; cursor: pointer; transition: background var(--transition-fast, .15s); }
.fd-post-btn:hover { background: var(--accent-dark); }
.fd-post-btn.loading { opacity: .6; pointer-events: none; }
.fd-composer-guest { display: flex; align-items: center; gap: 12px; }
.fd-guest-tip { flex: 1; font-size: 13px; color: var(--ink-2); }

/* ---------- 头像 ---------- */
.fd-avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-family: var(--font-serif); font-size: 18px; overflow: hidden; text-decoration: none; }
.fd-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fd-avatar.is-link { cursor: pointer; transition: box-shadow var(--transition-fast, .15s), transform var(--transition-fast, .15s); }
.fd-avatar.is-link:hover { box-shadow: 0 0 0 2px var(--accent); transform: translateY(-1px); }

/* ---------- 动态卡 ---------- */
.fd-social { display: flex; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); transition: box-shadow var(--transition-fast, .15s); }
.fd-social:hover { box-shadow: var(--shadow-lift); }
.fd-social-main { flex: 1; min-width: 0; }
.fd-s-head { display: flex; align-items: center; gap: 8px; }
.fd-s-name { font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; }
.fd-s-name:hover { color: var(--accent); }
.fd-vip { padding: 1px 7px; border-radius: var(--radius-full); background: var(--accent-bg); color: var(--accent); font-size: 11px; font-weight: 700; }
.fd-s-time { font-size: 12px; color: var(--ink-3); }
.fd-follow { margin-left: auto; padding: 4px 14px; border: 1px solid var(--accent); border-radius: var(--radius-full); background: transparent; color: var(--accent); font-size: 12px; font-family: inherit; cursor: pointer; transition: all var(--transition-fast, .15s); }
.fd-follow:hover { background: var(--accent); color: #fff; }
.fd-follow.done { border-color: var(--line); color: var(--ink-3); }
.fd-follow.done:hover { background: transparent; color: var(--ink-3); }
.fd-card-menu { position: relative; margin-left: auto; }
.fd-follow + .fd-card-menu { margin-left: 0; }
.fd-menu-btn { border: none; background: none; color: var(--ink-3); font-size: 16px; letter-spacing: 1px; cursor: pointer; padding: 0 4px; border-radius: var(--radius); }
.fd-menu-btn:hover { color: var(--accent); background: var(--accent-weak); }
.fd-menu { position: absolute; right: 0; top: 24px; z-index: 25; min-width: 108px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 4px; display: none; flex-direction: column; }
.fd-menu.show { display: flex; }
.fd-menu button { border: none; background: none; padding: 7px 12px; text-align: left; font-size: 13px; font-family: inherit; color: var(--ink-2); cursor: pointer; border-radius: var(--radius); white-space: nowrap; }
.fd-menu button:hover { background: var(--bg-soft); color: var(--ink); }
.fd-menu button.danger { color: #B03A2E; }

/* 正文 */
.fd-s-text { margin-top: 8px; font-size: 14px; line-height: 1.8; color: var(--ink); word-break: break-word; }
.fd-s-text a { color: var(--accent); text-decoration: none; }
.fd-s-text a:hover { text-decoration: underline; }
.fd-topic { font-weight: 700; }
.fd-fold-mask { position: relative; max-height: 96px; overflow: hidden; }
.fd-fold-mask::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.fd-fold-btn { margin-top: 4px; padding: 0; border: none; background: none; color: var(--accent); font-size: 13px; font-family: inherit; cursor: pointer; }
.fd-fold-btn:hover { text-decoration: underline; }

/* 九宫格（点击经 [data-sj-img] 进 imgmodal 灯箱：放大/缩小/旋转/多图切换） */
.fd-gallery { display: grid; gap: 6px; margin-top: 10px; border-radius: var(--radius); overflow: hidden; }
.fd-gallery.g1 { grid-template-columns: minmax(0, 520px); }
.fd-gallery.g1 .fd-gitem { aspect-ratio: 16 / 10; }
.fd-gallery.g2 { grid-template-columns: 1fr 1fr; max-width: 520px; }
.fd-gallery.g2 .fd-gitem { aspect-ratio: 1; }
.fd-gallery.g3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; max-width: 520px; }
.fd-gallery.g3 .fd-gitem:first-child { grid-row: 1 / 3; }
.fd-gallery.g3 .fd-gitem:not(:first-child) { aspect-ratio: 16 / 10; }
.fd-gallery.g9 { grid-template-columns: repeat(3, 1fr); max-width: 520px; }
.fd-gallery.g9 .fd-gitem { aspect-ratio: 1; }
.fd-gitem { position: relative; overflow: hidden; background: var(--bg-soft); cursor: zoom-in; }
.fd-gitem img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.fd-gitem:hover img { transform: scale(1.04); }

/* 互动条 */
.fd-s-acts { display: flex; gap: 22px; margin-top: 12px; }
.fd-act { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; color: var(--ink-3); font-size: 13px; font-family: inherit; cursor: pointer; padding: 2px 0; transition: color var(--transition-fast, .15s); }
.fd-act svg { width: 17px; height: 17px; }
.fd-act:hover { color: var(--accent); }
.fd-act.on { color: var(--accent); }
.fd-act.on svg { fill: currentColor; }
.fd-act-count { font-variant-numeric: tabular-nums; }
@keyframes fd-pop { 0% { transform: scale(1); } 45% { transform: scale(1.45); } 100% { transform: scale(1); } }
.fd-act.pop svg { animation: fd-pop .45s ease; }

/* 点赞者 */
.fd-likers { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.fd-likers .stk { display: flex; }
.fd-likers .stk .fd-avatar { width: 20px; height: 20px; font-size: 10px; margin-left: -6px; border: 2px solid var(--bg); }
.fd-likers .stk .fd-avatar:first-child { margin-left: 0; }
.fd-likers .lb { font-size: 12px; color: var(--ink-3); }
.fd-likers .lb a { color: var(--ink-2); text-decoration: none; }
.fd-likers .lb a:hover { color: var(--accent); }

/* 评论面板（AJAX 展开渲染） */
.fd-cmtpanel { margin-top: 10px; border-top: 1px solid var(--line-light); padding-top: 10px; }
.fd-cmtpanel[hidden] { display: none; }
.fd-cmt { display: flex; gap: 8px; padding: 6px 0; }
.fd-cmt-sub { margin-left: 34px; }
.fd-cmt .fd-avatar { width: 26px; height: 26px; font-size: 12px; }
.fd-cmt .fd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fd-cmt-body { flex: 1; min-width: 0; font-size: 13px; line-height: 1.6; }
.fd-cmt-who { font-weight: 700; color: var(--ink-2); text-decoration: none; margin-right: 6px; }
.fd-cmt-who:hover { color: var(--accent); }
.fd-cmt-what { color: var(--ink); }
.fd-cmt-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 10px; align-items: center; }
.fd-cmt-floor { margin-left: auto; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fd-cmt-reply { color: var(--accent); background: none; border: none; font-size: 11px; font-family: inherit; cursor: pointer; padding: 0; }
.fd-cmt-reply:hover { text-decoration: underline; }
.fd-cmt-more { margin-top: 6px; font-size: 12px; color: var(--accent); cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; }
.fd-cmt-more:hover { text-decoration: underline; }
.fd-reply-box { display: flex; gap: 8px; margin-top: 8px; }
.fd-reply-box input { flex: 1; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-full); font-family: inherit; font-size: 13px; color: var(--ink); background: var(--bg); outline: none; }
.fd-reply-box input:focus { border-color: var(--accent); }
.fd-reply-box button { padding: 7px 16px; border: none; border-radius: var(--radius-full); background: var(--accent); color: #fff; font-size: 12px; font-family: inherit; cursor: pointer; }
.fd-reply-box button:hover { background: var(--accent-dark); }
.fd-cmt-empty { font-size: 12px; color: var(--ink-3); padding: 6px 0; }

/* ---------- 通用件 ---------- */
.fd-newbar { display: block; margin: 0 0 12px; padding: 8px 14px; border: 1px solid var(--accent); border-radius: var(--radius-full); background: var(--accent-bg); color: var(--accent); font-size: 12px; text-align: center; cursor: pointer; box-shadow: var(--shadow-lift); }
.fd-newbar[hidden] { display: none; }
@keyframes fd-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.fd-toast { position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%); z-index: 400; padding: 9px 20px; border-radius: var(--radius-full); background: rgba(31, 30, 27, .92); color: #fff; font-size: 13px; box-shadow: var(--shadow-lg); animation: fd-toast-in .25s ease; pointer-events: none; }
.fd-empty { padding: 34px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-lg); color: var(--ink-3); font-size: 13px; background: var(--bg); }
.fd-empty b { display: block; margin-bottom: 8px; color: var(--ink-2); font-size: 14px; }
.fd-more { display: block; width: 100%; margin: 4px 0 0; padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius-lg); background: var(--bg); color: var(--ink-2); font-size: 13px; font-family: inherit; cursor: pointer; transition: all var(--transition-fast, .15s); }
.fd-more:hover { color: var(--accent); border-color: var(--accent); }
.fd-more.loading { opacity: .6; pointer-events: none; }

/* ---------- 右栏 ---------- */
.fd-rail { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 16px; }
.fd-panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.fd-panel h3 { font-family: var(--font-serif); font-size: 14px; letter-spacing: 2px; color: var(--ink-2); padding-bottom: 8px; border-bottom: 1px solid var(--line-light); margin-bottom: 6px; }
.fd-rank { list-style: none; margin: 0; padding: 0; }
.fd-rank li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line-light); }
.fd-rank li:last-child { border-bottom: none; }
.fd-rank .no { width: 18px; height: 18px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fd-rank li:nth-child(-n+3) .no { background: var(--accent); color: #fff; }
.fd-rank .t { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.fd-rank .t:hover { color: var(--accent); }
.fd-rank .v { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fd-dist { list-style: none; margin: 0; padding: 0; }
.fd-dist li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.fd-dist .k { width: 34px; font-size: 12px; color: var(--ink-2); flex-shrink: 0; }
.fd-dist .bar { flex: 1; height: 8px; border-radius: var(--radius-full); background: var(--bg-soft); overflow: hidden; }
.fd-dist .bar i { display: block; height: 100%; border-radius: var(--radius-full); background: var(--accent); opacity: .75; }
.fd-dist .v { width: 44px; text-align: right; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .fd-hero { flex-direction: column; align-items: flex-start; gap: 10px; }
  .fd-body { grid-template-columns: 1fr; }
  .fd-body > .fd-rail { grid-column: 1; grid-row: auto; }
  .fd-rail { position: static; }
  .fd-hero-stats { gap: 18px; }
  .fd-gallery.g1, .fd-gallery.g2, .fd-gallery.g3, .fd-gallery.g9 { max-width: 100%; }
}

/* ---------- v5.1（2026-11-16）：置顶徽章 / 表情面板 / composer 增强 ---------- */
.fd-pin { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: var(--radius-sm, 6px); background: var(--accent-weak); color: var(--accent); font-size: 11px; font-weight: 600; line-height: 1.6; }

.fd-emoji-pop { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius, 10px); background: var(--bg); box-shadow: var(--shadow, 0 2px 10px rgba(0,0,0,.06)); }
.fd-emoji-pop[hidden] { display: none; }
.fd-emoji-item { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: none; background: transparent; border-radius: var(--radius-sm, 6px); font-size: 18px; cursor: pointer; transition: background var(--transition-fast, .15s); }
.fd-emoji-item:hover { background: var(--accent-weak); }

@media (max-width: 600px) {
  .fd-emoji-pop { grid-template-columns: repeat(6, 1fr); }
}
