/* ============================================================
   会员群聊
   ============================================================ */
/* ⚠️不能裸写 body{overflow:hidden}(糖哥 2026-08-04):
   群聊独立页需要锁死整页滚动(聊天窗自己滚),但推文页为了群聊面板也引了这份样式,
   结果整个推文信息流被连带锁死、根本滑不动,无限滚动自然也永远触发不了。
   收窄到「只有独立群聊页(.chat-app 直接挂在 body 下)才锁」。 */
body:has(> .chat-app) { overflow: hidden; }
/* :has() 不支持时的兜底:给独立群聊页的 body 加 .chat-page 类同样生效 */
body.chat-page { overflow: hidden; }

.chat-app {
  display: grid;
  grid-template-columns: 232px 1fr 268px;
  /* 100dvh 随手机浏览器动态工具栏自适应,避免底部输入框被顶出可视区(vh 回退给老浏览器) */
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  min-height: 0;
  overflow: hidden; /* 移动端离屏抽屉(左频道/右成员)translateX 出界时不产生横向空白滚动 */
}
.chat-app > * { min-height: 0; min-width: 0; }

/* ---------- channels ---------- */
.chat-channels { display: flex; flex-direction: column; padding: 14px 10px; border-right: 1px solid var(--line-soft); background: var(--bg-panel); overflow-y: auto; }
.cc-title { font-family: var(--font-mono); font-size: calc(11px * var(--sv-font-scale, 1)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); padding: 12px 10px 8px; }
.cc-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 9px 10px; margin-bottom: 2px; font-size: calc(14px * var(--sv-font-scale, 1)); font-weight: 500; color: var(--text-secondary); background: transparent; border: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left; transition: all var(--transition-fast); }
.cc-item:hover { background: var(--accent-soft); color: var(--text-main); }
.cc-item.active { background: var(--accent-soft); color: var(--text-main); }
.cc-hash { color: var(--text-muted); font-weight: 700; }
.cc-badge { margin-left: auto; font-family: var(--font-mono); font-size: calc(11px * var(--sv-font-scale, 1)); color: var(--text-muted); }
.cc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); }
.cc-me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line-soft); }
.cc-me .avatar { width: 32px; height: 32px; }
.cc-me .me-name { font-size: calc(13px * var(--sv-font-scale, 1)); font-weight: 600; }
.cc-me .me-role { font-family: var(--font-mono); font-size: calc(10px * var(--sv-font-scale, 1)); color: var(--up); }

/* avatars */
.avatar { display: grid; place-items: center; border-radius: 50%; font-family: var(--font-display); font-weight: 700; font-size: calc(13px * var(--sv-font-scale, 1)); color: var(--text-main); background: var(--bg-elevated); border: 1px solid var(--line-strong); flex-shrink: 0; }

/* ---------- main ---------- */
.chat-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg-core); }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.ch-name { font-family: var(--font-display); font-size: calc(17px * var(--sv-font-scale, 1)); font-weight: 700; }
.ch-sub { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: calc(12px * var(--sv-font-scale, 1)); color: var(--text-muted); }
.ch-actions { display: flex; gap: 8px; }
.ch-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); cursor: pointer; }
.ch-btn:hover { color: var(--text-main); border-color: var(--line-strong); }

.chat-stream { flex: 1; overflow-y: auto; padding: 20px 20px 8px; display: flex; flex-direction: column; gap: 4px; }

.msg { display: flex; gap: 12px; padding: 6px 10px; border-radius: var(--radius-md); }
.msg:hover { background: var(--accent-soft); }
.msg.grouped { padding-top: 0; padding-bottom: 2px; }
.msg.grouped .msg-avatar { visibility: hidden; height: 0; }
.msg-avatar { width: 38px; height: 38px; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.msg-name { font-size: calc(14px * var(--sv-font-scale, 1)); font-weight: 700; }
.msg-role { font-family: var(--font-mono); font-size: calc(10px * var(--sv-font-scale, 1)); font-weight: 600; padding: 1px 6px; border-radius: 3px; }
.msg-role.admin { color: var(--warn); background: var(--warn-soft); }
.msg-role.vip { color: var(--up); background: var(--up-soft); }
.msg-role.host { color: var(--ice); background: var(--ice-soft); }
.msg-time { font-family: var(--font-mono); font-size: calc(11px * var(--sv-font-scale, 1)); color: var(--text-disabled); }
.msg-text { font-size: calc(14px * var(--sv-font-scale, 1)); color: var(--text-secondary); line-height: 1.6; word-break: break-word; }
.msg-share-card { width: min(100%, 480px); margin-top: 7px; }
.msg-share-card .share-preview-card { width: 100%; }
.msg.own .msg-name { color: var(--text-main); }
.msg.own { background: rgba(110,168,254,0.05); }

.msg-share { margin-top: 6px; display: inline-flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-panel); }
.ms-sym { font-family: var(--font-display); font-weight: 700; font-size: calc(15px * var(--sv-font-scale, 1)); }
.ms-px { font-family: var(--font-mono); font-size: calc(14px * var(--sv-font-scale, 1)); font-weight: 600; }
.ms-px.up { color: var(--up); } .ms-px.down { color: var(--down); }
.ms-open { font-family: var(--font-mono); font-size: calc(12px * var(--sv-font-scale, 1)); color: var(--text-main); text-decoration: none; padding-left: 14px; border-left: 1px solid var(--line-soft); }
.ms-open:hover { color: var(--up); }

.msg-sys { text-align: center; font-size: calc(12px * var(--sv-font-scale, 1)); color: var(--text-disabled); padding: 8px 0; }
.msg-sys b { color: var(--text-muted); }

/* composer */
.composer { flex-shrink: 0; padding: 12px 20px 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line-soft); }
.composer-tools { display: flex; gap: 8px; margin-bottom: 8px; }
.cm-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; font-size: calc(12px * var(--sv-font-scale, 1)); font-weight: 600; color: var(--text-secondary); background: transparent; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); cursor: pointer; }
.cm-tool:hover { color: var(--text-main); border-color: var(--line-strong); }
.composer-input { display: flex; align-items: flex-end; gap: 10px; padding: 8px 8px 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--bg-panel); }
.composer-input:focus-within { border-color: var(--text-secondary); }
.composer-input textarea { flex: 1; max-height: 120px; resize: none; background: none; border: none; outline: none; color: var(--text-main); font-size: calc(14px * var(--sv-font-scale, 1)); font-family: var(--font-body); line-height: 1.5; padding: 6px 0; }
.cm-send { min-height: 44px; padding: 9px 20px; font-size: calc(14px * var(--sv-font-scale, 1)); font-weight: 700; color: var(--bg-core); background: var(--text-main); border: none; border-radius: var(--radius-sm); cursor: pointer; }
.cm-send:hover { filter: brightness(1.12); }

/* ---------- members ---------- */
.chat-members { border-left: 1px solid var(--line-soft); background: var(--bg-panel); overflow-y: auto; padding: 16px; }
.pinned { padding: 14px; border: 1px solid rgba(240,185,11,0.3); background: var(--warn-soft); border-radius: var(--radius-md); margin-bottom: 20px; }
.pinned-title { font-family: var(--font-mono); font-size: calc(11px * var(--sv-font-scale, 1)); font-weight: 700; color: var(--warn); margin-bottom: 8px; }
.pinned-body { font-size: calc(13px * var(--sv-font-scale, 1)); color: var(--text-secondary); line-height: 1.6; }
.mem-title { font-family: var(--font-mono); font-size: calc(11px * var(--sv-font-scale, 1)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.mem-list { display: flex; flex-direction: column; gap: 2px; }
.mem { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); }
.mem:hover { background: var(--accent-soft); }
.mem .avatar { width: 32px; height: 32px; position: relative; }
.mem-on { position: relative; }
.mem-on::after { content: ''; position: absolute; right: 0; bottom: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--up); border: 2px solid var(--bg-panel); }
.mem-info { min-width: 0; }
.mem-name { font-size: calc(13px * var(--sv-font-scale, 1)); font-weight: 600; }
.mem-status { font-size: calc(11px * var(--sv-font-scale, 1)); color: var(--text-muted); }

/* ---------- gate ---------- */
.chat-gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: gate-fade 0.3s ease; }
.chat-gate[hidden] { display: none; }
@keyframes gate-fade { from { opacity: 0; } to { opacity: 1; } }

.gate-card {
  position: relative; width: 100%; max-width: 404px; padding: 44px 40px 30px; text-align: center; overflow: hidden;
  background: var(--screen-bg);
  border: 1px solid var(--line-strong); border-radius: 18px;
  box-shadow: 0 40px 120px rgba(0,0,0,0.7);
  animation: gate-pop 0.42s cubic-bezier(0.16,1,0.3,1);
}
@keyframes gate-pop { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.gate-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(46,189,133,0.7), transparent); }
.gate-glow { position: absolute; top: -70px; left: 50%; transform: translateX(-50%); width: 240px; height: 180px; background: radial-gradient(closest-side, rgba(46,189,133,0.2), transparent); pointer-events: none; }

.gate-badge {
  position: relative; z-index: 1; width: 66px; height: 66px; margin: 0 auto 22px;
  display: grid; place-items: center; border-radius: 50%;
  color: var(--up); background: var(--up-soft); border: 1px solid rgba(46,189,133,0.45);
}
.gate-badge::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid rgba(46,189,133,0.35); animation: gate-ring 2.4s ease-out infinite; }
@keyframes gate-ring { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.55); opacity: 0; } }

.gate-eyebrow { position: relative; z-index: 1; font-family: var(--font-mono); font-size: calc(11px * var(--sv-font-scale, 1)); font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--up); margin-bottom: 10px; }
.gate-title { position: relative; z-index: 1; font-family: var(--font-display); font-size: calc(24px * var(--sv-font-scale, 1)); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.gate-desc { position: relative; z-index: 1; font-size: calc(14px * var(--sv-font-scale, 1)); color: var(--text-secondary); line-height: 1.7; margin-bottom: 22px; }

.gate-online { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 12px; padding: 7px 16px 7px 12px; margin-bottom: 26px; border: 1px solid var(--line-soft); border-radius: 100px; background: var(--bg-core); }
.gate-avatars { display: flex; }
.gate-avatars .ga { width: 26px; height: 26px; margin-left: -9px; display: grid; place-items: center; border-radius: 50%; font-size: calc(11px * var(--sv-font-scale, 1)); font-weight: 700; color: var(--text-main); background: var(--bg-tertiary); border: 2px solid var(--bg-elevated); }
.gate-avatars .ga:first-child { margin-left: 0; }
.gate-avatars .ga:nth-child(1) { color: #2ebd85; } .gate-avatars .ga:nth-child(2) { color: #6ea8fe; }
.gate-avatars .ga:nth-child(3) { color: #f0b90b; } .gate-avatars .ga:nth-child(4) { color: #b48cff; }
.gate-online-txt { font-size: calc(12px * var(--sv-font-scale, 1)); color: var(--text-secondary); }
.gate-online-txt b { color: var(--up); font-family: var(--font-mono); }

.gate-card .btn-block { position: relative; z-index: 1; display: flex; width: 100%; height: 48px; font-size: calc(15px * var(--sv-font-scale, 1)); }
.gate-back { position: relative; z-index: 1; display: block; margin-top: 16px; font-size: calc(13px * var(--sv-font-scale, 1)); color: var(--text-muted); text-decoration: none; }
.gate-back:hover { color: var(--text-main); }

/* mobile drawer toggles (hidden on desktop) */
.ch-head-title { flex: 1; min-width: 0; }
.chat-nav-btn {
  display: none; width: 44px; height: 44px; flex-shrink: 0;
  place-items: center; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); cursor: pointer;
}
.chat-nav-btn:hover { color: var(--text-main); border-color: var(--line-strong); }
.chat-nav-btn svg { display: block; }
.chat-drawer-scrim {
  position: absolute; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.5);
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease;
}
.chat-app.ch-open .chat-drawer-scrim, .chat-app.mem-open .chat-drawer-scrim { opacity: 1; visibility: visible; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .chat-app { grid-template-columns: 200px 1fr; position: relative; }
  .ch-members-btn { display: inline-grid; }
  .chat-members {
    display: block; position: absolute; top: 0; right: 0; bottom: 0;
    width: 280px; max-width: 82%; z-index: 40;
    transform: translateX(105%); transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5); border-left: 1px solid var(--line-strong);
  }
  .chat-app.mem-open .chat-members { transform: none; }
}
@media (max-width: 720px) {
  .chat-app { grid-template-columns: 1fr; }
  #chChannels { display: inline-grid; }
  .chat-channels {
    display: flex; position: absolute; top: 0; left: 0; bottom: 0;
    width: 264px; max-width: 80%; z-index: 40;
    transform: translateX(-105%); transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5); border-right: 1px solid var(--line-strong);
  }
  .chat-app.ch-open .chat-channels { transform: none; }
}

/* ---- 频道锁标识 / 管理员工具 ---- */
.cc-lock { font-size: calc(10px * var(--sv-font-scale, 1)); opacity: 0.8; }
.admin-bar { display: inline-flex; gap: 6px; margin-left: 10px; }
.admin-bar button { font-size: calc(11px * var(--sv-font-scale, 1)); padding: 3px 9px; border-radius: 6px; cursor: pointer; background: rgba(255,255,255,0.04); color: var(--text-muted, #8a8f9c); border: 1px solid var(--line-strong, rgba(255,255,255,0.09)); }
.admin-bar button:hover { color: var(--text-main, #f4f5f7); border-color: var(--up, #2ebd85); }
.mem { position: relative; }
.mem-mute { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: calc(10.5px * var(--sv-font-scale, 1)); padding: 2px 8px; border-radius: 6px; cursor: pointer; background: rgba(246,70,93,0.08); color: var(--down, #f6465d); border: 1px solid rgba(246,70,93,0.3); opacity: 0; transition: opacity .15s; }
.mem:hover .mem-mute { opacity: 1; }
.mem-empty { padding: 14px; text-align: center; color: var(--text-muted, #8a8f9c); font-size: calc(12px * var(--sv-font-scale, 1)); }
.moderation-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); min-width: 0; }
.moderation-panel[hidden] { display: none; }
.moderation-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.moderation-head .mem-title { margin: 0; }
.moderation-refresh { min-height: 44px; padding: 4px 10px; border-radius: 7px; cursor: pointer; color: var(--text-secondary); background: var(--surface-soft, rgba(255,255,255,.04)); border: 1px solid var(--line-strong); }
.moderation-list { display: grid; gap: 7px; margin-top: 9px; max-height: min(32dvh, 260px); overflow-y: auto; overscroll-behavior: contain; }
.moderation-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface-soft, rgba(255,255,255,.03)); }
.moderation-user { min-width: 0; }
.moderation-user strong, .moderation-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moderation-user strong { font-size: calc(12px * var(--sv-font-scale, 1)); color: var(--text-primary); }
.moderation-user span { margin-top: 2px; font-size: calc(10.5px * var(--sv-font-scale, 1)); color: var(--text-muted); }
.moderation-unmute { min-height: 44px; padding: 5px 10px; border-radius: 7px; cursor: pointer; color: var(--up, #0ecb81); background: rgba(14,203,129,.08); border: 1px solid rgba(14,203,129,.28); }
.moderation-platform { font-size: calc(10.5px * var(--sv-font-scale, 1)); color: var(--text-muted); text-align: right; }
.msg { position: relative; }
.msg-del { position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; line-height: 1; border-radius: 50%; cursor: pointer; background: rgba(246,70,93,0.1); color: var(--down, #f6465d); border: 1px solid rgba(246,70,93,0.3); font-size: calc(12px * var(--sv-font-scale, 1)); opacity: 0; transition: opacity .15s; }
.msg:hover .msg-del { opacity: 1; }
input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 表情面板(2026-07-21) ---- */
.composer { position: relative; }
.emoji-panel {
  position: absolute; left: 12px; bottom: calc(100% + 8px); z-index: 60; width: min(420px, calc(100vw - 48px));
  padding: 10px 12px; border-radius: 12px;
  background: var(--bg-elevated, #14181f); border: 1px solid var(--line-strong, rgba(255,255,255,0.09));
  box-shadow: 0 14px 36px rgba(0,0,0,0.35);
  display: flex; flex-direction: column; gap: 8px;
}
.ep-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ep-tab {
  padding: 3px 12px; border-radius: 999px; cursor: pointer; font-size: calc(12px * var(--sv-font-scale, 1)); white-space: nowrap;
  color: var(--text-secondary, #8a8f9c); background: none; border: 1px solid var(--line-soft, rgba(255,255,255,0.07));
}
.ep-tab.active { color: #F0B90B; border-color: rgba(240,185,11,0.5); background: rgba(240,185,11,0.08); font-weight: 600; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 216px; overflow-y: auto; scrollbar-width: thin; }
.ep-item {
  font-size: calc(22px * var(--sv-font-scale, 1)); line-height: 1; padding: 7px 0; border: none; background: none; cursor: pointer; border-radius: 8px;
  transition: transform 0.08s ease;
}
.ep-item:hover { background: rgba(240,185,11,0.10); transform: scale(1.22); }
/* 纯表情消息(1~3枚)放大显示,微信式高级感 */
.msg-text.emoji-only { font-size: calc(34px * var(--sv-font-scale, 1)); line-height: 1.25; }
