/* SPDX-License-Identifier: Apache-2.0 */
:root {
  --bg: #0b0f1a;
  --panel: #131a2b;
  --panel-2: #1a2340;
  --accent: #2de2c4;
  --accent-2: #6c8cff;
  --text: #e7ecf5;
  --muted: #8a97b3;
  --danger: #ff5d6c;
  --ok: #38d39f;
  --warn: #ffcc66;
}

/* 🔆 ⑩ 浅色主题：data-theme="light" 时覆盖变量（其余结构样式沿用，仅换色板） */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #eef1f8;
  --accent: #0f9d8a;
  --accent-2: #3558d4;
  --text: #15203a;
  --muted: #5b6b8d;
  --danger: #e0354f;
  --ok: #1c9c6e;
  --warn: #c98a12;
}
:root[data-theme="light"] html, :root[data-theme="light"] body {
  background: radial-gradient(1200px 600px at 80% -10%, #e3ecff 0%, var(--bg) 55%);
}
:root[data-theme="light"] .topbar,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .msg,
:root[data-theme="light"] .modal,
:root[data-theme="light"] .composer,
:root[data-theme="light"] .ctx-header {
  border-color: #d4dbec;
  box-shadow: 0 1px 3px rgba(30, 50, 90, 0.06);
}
/* 🔆 浅色主题：自己发的消息框 → 浅绿底 + 黑字 */
:root[data-theme="light"] .msg.mine {
  background: #d8f3e3;
  border-color: #a6dcbb;
  color: #000000;
}
:root[data-theme="light"] .msg.mine .meta { color: #1c3a29; }
:root[data-theme="light"] .msg.mine .who { color: #0a7a52; }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: radial-gradient(1200px 600px at 80% -10%, #16213f 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;            /* 移动端动态视口高度，规避地址栏遮挡 */
  display: flex; flex-direction: column;
  padding: 14px; gap: 12px;
}

/* 移动端导航：汉堡按钮 + 遮罩层（默认桌面端隐藏） */
.nav-toggle, .overlay { display: none; }

/* 顶部栏（精简：品牌 + 汉堡） */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, var(--panel), var(--panel-2));
  border: 1px solid #233156; border-radius: 14px;
  padding: 10px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { color: var(--accent); font-size: 22px; }
.title { font-weight: 700; letter-spacing: .5px; }
.badge { font-size: 12px; background: #0e2a26; color: var(--accent); border: 1px solid #1d5b52; padding: 2px 8px; border-radius: 999px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #555; flex: 0 0 auto; align-self: center; transition: background .2s, box-shadow .2s; }
.conn-dot.off { background: #555; }
.conn-dot.down { background: #f0a020; box-shadow: 0 0 6px #f0a020; }
.conn-dot.live { background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }

/* 侧栏身份面板（从顶栏移入） */
.identity-panel { display: flex; flex-direction: column; gap: 8px; }
.id-addr-row { display: flex; align-items: center; gap: 6px; }
.id-addr-row .addr { flex: 1; min-width: 0; font-family: monospace; font-size: 12px; color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-addr-row #logoutBtn { flex-shrink: 0; }
.id-diag { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; background: rgba(255,255,255,.03); font-size: 12px; }
.diag-line { display: flex; justify-content: space-between; gap: 8px; }
.diag-k { color: var(--muted); }
.diag-v { font-family: monospace; color: var(--accent-2); }
.diag-v.ok { color: #3ddc84; }
.diag-v.warn { color: #ffb454; }
.diag-note { margin-top: 2px; color: var(--muted); line-height: 1.5; font-size: 11px; }
.identity-panel .lang-switch { align-self: flex-start; }

/* 按钮 */
.btn { border: none; border-radius: 10px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--text); background: var(--panel-2); transition: .15s; }
.btn:hover { filter: brightness(1.15); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #06121f; font-weight: 700; }
.btn.ghost { background: transparent; border: 1px solid #2a3a63; color: var(--muted); }
.btn.danger { background: transparent; border: 1px solid #5a2530; color: var(--danger); }
.btn.recording { background: #e74c3c; color: #fff; border-color: #e74c3c; animation: recPulse .9s ease-in-out infinite; }
@keyframes recPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(231,76,60,.55); } 50% { box-shadow: 0 0 0 7px rgba(231,76,60,0); } }

/* 主体布局 */
.body { flex: 1; display: flex; gap: 12px; min-height: 0; }
.sidebar { width: 270px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid #233156; border-radius: 14px; overflow: hidden; position: relative; }

/* 侧边栏面板 */
.panel { background: var(--panel); border: 1px solid #233156; border-radius: 12px; padding: 10px; }
.panel-head { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.row { display: flex; gap: 6px; margin-bottom: 8px; align-items: center; }
.nick-label { flex: 0 0 auto; color: var(--muted); font-size: 13px; min-width: 34px; }
.row input, .sidebar input[type=text] {
  flex: 1; background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 8px;
  color: var(--text); padding: 5px 8px; font-size: 13px; min-width: 0;
}
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.list li {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; background: var(--panel-2);
}
.list li:hover { filter: brightness(1.2); }
.list li.active { outline: 1px solid var(--accent); }
.list li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .sub { color: var(--muted); font-size: 11px; font-family: monospace; }
.list li .del { color: var(--danger); cursor: pointer; padding: 0 4px; }

.mykey code { display: block; font-size: 10px; color: var(--muted); word-break: break-all; background: var(--panel-2); padding: 6px; border-radius: 8px; margin-bottom: 6px; }
.pub-code { display: block; font-size: 11px; color: var(--muted); word-break: break-all; background: var(--panel-2); padding: 8px; border-radius: 8px; max-height: 42vh; overflow: auto; white-space: pre-wrap; line-height: 1.5; margin: 0 0 8px; }
.view-pub { align-self: flex-start; }
/* 频道 / 好友 面板可折叠 + 列表「前5 / 全部」切换 */
.collapse-toggle { cursor: pointer; font-size: 12px; color: var(--muted); transition: transform .2s; user-select: none; margin-left: auto; }
.panel.collapsed > *:not(.panel-head) { display: none; }
.panel.collapsed .collapse-toggle { transform: rotate(-90deg); }
.list-more-box { margin-top: 2px; }
.list-more { width: 100%; background: transparent; border: 1px solid #2a3a63; color: var(--accent); border-radius: 8px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.list-more:hover { filter: brightness(1.2); }

/* 聊天区 */
.ctx-header { position: relative; padding: 10px 14px; border-bottom: 1px solid #233156; font-weight: 700; color: var(--accent-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#ctxTitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 🔆 顶部频道名 → 可点击切换按钮（与 .ctx-header>.btn 同款） */
.ctx-title-btn { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 0; padding: 5px 9px; margin: -4px 0; border: 1px solid rgba(108,140,255,.38); border-radius: 8px; background: rgba(20,32,60,.55); color: rgba(160,180,220,.9); font-weight: 700; font-size: 14px; cursor: pointer; text-align: left; overflow: hidden; transition: all .15s; }
.ctx-title-btn:hover { background: rgba(40,65,120,.55); border-color: rgba(108,140,255,.6); color: #c8d6f0; }
.ctx-title-btn .ctx-caret { font-size: 11px; opacity: .7; flex: none; transition: transform .15s; }
.ctx-title-btn[aria-expanded="true"] .ctx-caret { transform: rotate(180deg); }
/* 切换弹窗 */
.ctx-switch-menu { position: absolute; top: calc(100% + 4px); left: 8px; z-index: 500; min-width: 230px; max-width: calc(100vw - 24px); max-height: 60vh; overflow-y: auto; background: var(--panel); border: 1px solid #2a3a63; border-radius: 12px; padding: 6px; box-shadow: 0 6px 22px rgba(0,0,0,.4); }
.ctx-switch-menu .cs-sec + .cs-sec { border-top: 1px solid rgba(108,140,255,.14); margin-top: 4px; padding-top: 4px; }
.ctx-switch-menu .cs-head { font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 8px; letter-spacing: .3px; }
.ctx-switch-menu .cs-list { list-style: none; margin: 0; padding: 0; }
.ctx-switch-menu .cs-list li { display: flex; align-items: center; gap: 6px; padding: 8px 8px; border-radius: 8px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-switch-menu .cs-list li .nm { overflow: hidden; text-overflow: ellipsis; }
.ctx-switch-menu .cs-list li:hover { background: rgba(108,140,255,.14); }
.ctx-switch-menu .cs-list li.active { background: rgba(108,140,255,.22); color: var(--accent); font-weight: 600; }
.ctx-switch-menu .cs-empty { padding: 10px; font-size: 13px; color: var(--muted); text-align: center; }
:root[data-theme="light"] .ctx-switch-menu { border-color: #d4dbec; box-shadow: 0 6px 22px rgba(30,50,90,.18); }
:root[data-theme="light"] .ctx-switch-menu .cs-sec + .cs-sec { border-top-color: rgba(30,50,90,.12); }
/* 🔆 顶部栏按钮统一风格：同色线框 + 浅底 + 突出可见 */
.ctx-header > .btn {
  border: 1px solid rgba(108,140,255,.38);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 14px;
  background: rgba(20,32,60,.55);
  color: rgba(160,180,220,.85);
  transition: all .15s;
}
.ctx-header > .btn:hover {
  background: rgba(40,65,120,.55);
  border-color: rgba(108,140,255,.6);
  color: #c8d6f0;
}
:root[data-theme="light"] .ctx-header > .btn {
  border-color: rgba(30,50,90,.22);
  background: rgba(240,244,252,.75);
  color: rgba(30,50,90,.7);
}
:root[data-theme="light"] .ctx-header > .btn:hover {
  background: rgba(218,228,248,.85);
  border-color: rgba(30,50,90,.35);
  color: #1a3050;
}
:root[data-theme="light"] .ctx-title-btn {
  border-color: rgba(30,50,90,.22);
  background: rgba(240,244,252,.75);
  color: rgba(30,50,90,.75);
}
:root[data-theme="light"] .ctx-title-btn:hover {
  background: rgba(218,228,248,.85);
  border-color: rgba(30,50,90,.35);
  color: #1a3050;
}

/* 新成员申请提示角标（路线 B）：显式 [hidden]{display:none} 覆盖，避免被 flex 容器顶掉 */
.req-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #fff; background: #e5484d; border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.req-badge[hidden] { display: none; }
.list-head { font-size: 12px; color: var(--muted); margin: 6px 0 2px; font-weight: 600; }
/* 私有频道勾选 */
.chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 8px; cursor: pointer; }
.chk input { width: auto; }

/* 成员面板模态框（路线 B） */
.modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }   /* 显式作者规则覆盖 UA 的 [hidden]，避免被 display:flex 顶掉 */
.modal-mask { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.55); }
.modal-card { position: relative; z-index: 1; width: min(420px, 92vw); max-height: 80vh; overflow: auto; background: var(--panel); border: 1px solid #2a3a63; border-radius: 14px; padding: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.modal-body { display: flex; flex-direction: column; gap: 8px; }
.modal-body .list { max-height: none; }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.msg { background: var(--panel-2); border: 1px solid #233156; border-radius: 12px; padding: 10px 12px; max-width: 82%; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: linear-gradient(135deg, #16313a, #15233f); border-color: #1d5b52; }
.msg .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.msg .meta .who { color: var(--accent-2); font-family: monospace; }
.msg .meta .verified { color: var(--ok); }
.msg .meta .unverified { color: var(--danger); }
.msg .meta .lock { color: var(--warn); }
/* SibyX-AI 官方认证角标（仅持有固定私钥的机器人消息会显示，验签通过才渲染） */
.msg .meta .bot-badge { display: inline-block; font-size: 11px; color: #fff; background: linear-gradient(135deg,#2b6cff,#1db954); border-radius: 8px; padding: 0 7px; margin-left: 6px; font-weight: 700; vertical-align: middle; box-shadow: 0 1px 3px rgba(43,108,255,.35); }
.msg .meta .add { color: var(--warn); cursor: pointer; border: 1px solid rgba(255,204,102,.45); border-radius: 6px; padding: 0 6px; }
/* 频道消息里的好友状态标识：等待接受=黄、互为好友=绿 */
.friend-tag { font-size: 12px; border-radius: 6px; padding: 1px 7px; margin-left: 6px; }
.friend-tag.waiting { color: var(--warn); background: rgba(255,204,102,.14); border: 1px solid rgba(255,204,102,.45); }
.friend-tag.mutual { color: #1db954; background: rgba(29,185,84,.14); border: 1px solid rgba(29,185,84,.45); }
.msg .body { font-size: 14px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
/* 附件渲染 */
.att-wrap { margin-top: 6px; }
/* 语音：去掉外层硬框结构，只在中间内容（播放器）背后加一层淡高亮，纵向压到最小 */
.att-voice { margin: 0; padding: 2px 4px; background: rgba(110,150,255,.10); border-radius: 8px; }
.att-voice .att { display: block; border: none; border-radius: 0; margin: 0; max-height: 40px; height: 34px; cursor: pointer; }
.att { display: block; max-width: 240px; max-height: 260px; border-radius: 10px; cursor: pointer; border: 1px solid #2a3a63; }
.att-file { display: inline-block; margin-top: 4px; padding: 6px 10px; background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 10px; color: var(--accent); text-decoration: none; font-size: 13px; }
.att-file:hover { border-color: var(--accent); }
.att-cap { margin-top: 4px; font-size: 12px; color: var(--muted); }

.empty { margin: auto; color: var(--muted); text-align: center; font-size: 14px; }

.composer { position: relative; display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid #233156; }
/* 三期 S8：官方公告提示条（welcome 频道只读时显示，替代输入栏） */
.announce-bar { margin: 8px 12px 0; padding: 9px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid #2a3a63; color: var(--accent); font-size: 13px; text-align: center; }
.composer input { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 12px; color: var(--text); padding: 12px 14px; font-size: 14px; }
.composer input:focus { outline: none; border-color: var(--accent); }
/* 待发附件预览芯片 */
.attach-preview { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid #233156; font-size: 13px; color: var(--muted); }
.att-chip { background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 999px; padding: 2px 10px; }
.att-x { cursor: pointer; color: var(--danger); font-weight: bold; padding: 0 4px; }

/* 表情 / 表情包选择器（浮在输入框上方） */
.emoji-panel {
  display: none;
  position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 8px;
  background: var(--panel); border: 1px solid #2a3a63; border-radius: 14px;
  box-shadow: 0 -8px 30px rgba(0,0,0,.45); z-index: 30; padding: 8px;
  max-height: 280px; flex-direction: column;
}
.emoji-panel.open { display: flex; }
.emoji-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.emoji-tab { flex: 1; background: var(--panel-2); border: 1px solid #2a3a63; color: var(--muted); border-radius: 8px; padding: 5px 0; font-size: 13px; cursor: pointer; }
.emoji-tab.active { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #06121f; font-weight: 700; border-color: transparent; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; overflow-y: auto; padding-right: 2px; }
/* ⑨ @提及自动补全下拉（风格对齐 emoji-panel） */
.mention-ac { display: none; position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 8px; background: var(--panel); border: 1px solid #2a3a63; border-radius: 14px; box-shadow: 0 -8px 30px rgba(0,0,0,.45); z-index: 30; padding: 6px; max-height: 240px; overflow-y: auto; flex-direction: column; }
.mention-ac.open { display: flex; }
.mac-item { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mac-item.active, .mac-item:hover { background: var(--panel-2); }
.mac-name { color: var(--text); font-size: 14px; font-weight: 600; }
.mac-addr { color: var(--muted); font-size: 12px; margin-left: auto; }
/* ⑨ 本地搜索弹窗 */
.search-card { width: min(560px, 94vw); }
#searchInput { width: 100%; background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 10px; color: var(--text); padding: 9px 12px; font-size: 14px; box-sizing: border-box; }
#searchInput:focus { outline: none; border-color: var(--accent); }
.search-results { display: flex; flex-direction: column; gap: 6px; max-height: 54vh; overflow-y: auto; margin-top: 4px; }
.sr-empty, .sr-count { color: var(--muted); font-size: 12px; padding: 4px 2px; }
.sr-item { padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid #233156; cursor: pointer; transition: .12s; }
.sr-item:hover { border-color: var(--accent); background: #1c2540; }
.sr-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.sr-ctx { color: var(--accent-2); font-size: 12px; font-weight: 700; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-who { color: var(--muted); font-size: 12px; }
.sr-time { color: var(--muted); font-size: 11px; margin-left: auto; flex: 0 0 auto; }
.sr-snip { color: var(--text); font-size: 13px; line-height: 1.5; word-break: break-word; }
.sr-snip mark { background: var(--accent); color: #06121f; border-radius: 3px; padding: 0 2px; font-weight: 600; }
/* A-05 搜索筛选器 + 结果分组头 */
.sr-filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 2px; }
.sr-f-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.sr-f-sel { background: var(--panel-2); color: var(--text); border: 1px solid #2a3a63; border-radius: 8px; padding: 3px 6px; font-size: 12px; }
.sr-f-sel:focus { outline: none; border-color: var(--accent); }
.sr-group { margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--accent-2); border-left: 2px solid var(--accent); padding-left: 6px; }
.sr-group:first-of-type { margin-top: 4px; }
.sticker-grid { grid-template-columns: repeat(6, 1fr); }
.emoji-cell { background: var(--panel-2); border: 1px solid #233156; border-radius: 8px; font-size: 20px; line-height: 1; padding: 4px 0; cursor: pointer; display: flex; align-items: center; justify-content: center; min-height: 34px; }
.emoji-cell:hover { filter: brightness(1.25); border-color: var(--accent); }
.emoji-cell img { width: 26px; height: 26px; display: block; }
.emoji-fallback { font-size: 20px; }
/* C-02 内置 SVG 贴纸：选择面板 + 气泡 */
.sticker-cell svg { width: 30px; height: 30px; display: block; }
.att-wrap.sticker { display: flex; }
.att.sticker-img { width: 96px; height: 96px; max-width: 96px; max-height: 96px; border: none; background: transparent; border-radius: 12px; object-fit: contain; }

/* 同步面板（已移入侧边栏） */
.sync-panel { display: flex; flex-direction: column; gap: 8px; }
.sync-panel .switch { margin-top: 2px; }
.sync-panel .row { margin-bottom: 0; }
.sync-panel .backup-row { gap: 6px; }
.sync-panel .hint { display: block; line-height: 1.4; }
.sync-panel .relay-edit { display: none; flex-wrap: wrap; }
.sync-panel .relay-edit.open { display: flex; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.hint { color: var(--muted); font-size: 12px; }
.hint.warn { color: #ffb454; }
.hint.err { color: #ff6b6b; }
/* D-04 维护/归档面板 */
.retain-panel .retain-cur { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.retain-panel .retain-cur b { color: var(--accent); font-weight: 600; word-break: break-all; }
.retain-panel .switch.retain-cap { gap: 6px; }
.retain-panel .switch.retain-cap input[type=number] { width: 78px; background: var(--input); color: var(--text); border: 1px solid #2a3a63; border-radius: 6px; padding: 3px 6px; }
.retain-panel .row { flex-wrap: wrap; }
.retain-panel .row .btn { margin-bottom: 6px; }
.vault { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #2a3a63; }
.vault-head { font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.vault #vaultId { width: 100%; margin-bottom: 6px; box-sizing: border-box; }
.vault .row { margin-bottom: 4px; }
.mnemonic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 10px; }
.mnemonic-grid .w { background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 8px; padding: 6px 8px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.mnemonic-grid .w .n { color: var(--muted); font-size: 11px; min-width: 16px; }
.mnemonic-grid .w .t { font-weight: 600; word-break: break-all; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs .tab { flex: 1; background: var(--panel-2); border: 1px solid #2a3a63; color: var(--muted); border-radius: 8px; padding: 7px; cursor: pointer; font-size: 13px; }
.tabs .tab.active { border-color: var(--accent); color: var(--accent); }
#mnemInput { width: 100%; box-sizing: border-box; min-height: 64px; resize: vertical; background: var(--panel-2); border: 1px solid #2a3a63; color: var(--text); border-radius: 8px; padding: 8px; font-size: 13px; line-height: 1.5; }
#passInput, #passConfirm, #backupPass { width: 100%; box-sizing: border-box; margin-bottom: 8px; background: var(--panel-2); border: 1px solid #2a3a63; color: var(--text); border-radius: 8px; padding: 9px; font-size: 14px; }

/* 滚动条 */
.messages::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .list::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .list::-webkit-scrollbar-thumb { background: #2a3a63; border-radius: 8px; }

/* =====================================================================
 * 响应式：≤768px 视为手机端 —— 侧边栏改为可滑出抽屉 + 聊天区优化
 * ===================================================================== */
@media (max-width: 768px) {
  .app { padding: 8px; gap: 8px; max-width: 100%; }

  /* 顶栏紧凑（仅品牌，不再需要换行） */
  .topbar { padding: 8px 12px; }
  .title { font-size: 15px; }
  .badge { display: none; }          /* 移动端省空间：模式徽标隐藏 */
  .conn-dot { width: 10px; height: 10px; }

  /* 汉堡按钮（桌面端隐藏） */
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 10px; border: 1px solid #2a3a63;
    background: var(--panel-2); color: var(--text); font-size: 18px; cursor: pointer;
  }

  /* 侧边栏 → 左侧抽屉（全高可滚动） */
  .body { position: relative; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: 84%; max-width: 320px; height: 100%;
    padding: 14px; background: var(--panel);
    border-right: 1px solid #233156; border-radius: 0;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
    overflow-y: auto;   /* 侧栏内容长时可滚动 */
    -webkit-overflow-scrolling: touch;
  }
  .app.nav-open .sidebar { transform: translateX(0); }

  /* 遮罩层 */
  .overlay {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40;
    background: rgba(0,0,0,.5); opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
  }
  .app.nav-open .overlay { opacity: 1; pointer-events: auto; }

  /* 聊天区全宽 + 触控优化 */
  .main { border-radius: 12px; min-height: 0; }
  .ctx-header { padding: 10px 12px; min-height: 44px; }   /* 触控最小高度 */
  #ctxTitle { font-size: 14px; }
  .memberBtn, #memberBtn { min-width: 38px; min-height: 38px; font-size: 16px; }

  /* 消息气泡更宽、间距适中 */
  .messages { gap: 8px; padding: 10px; -webkit-overflow-scrolling: touch; }
  .msg { max-width: 90%; padding: 9px 11px; border-radius: 14px; }
  .msg .meta { font-size: 11px; gap: 6px; }
  .msg .body { font-size: 14px; line-height: 1.55; }

  /* 输入区：大触控目标 */
  .composer { gap: 8px; padding: 10px; border-top: 1px solid #233156; align-items: center; }
  .composer input {
    padding: 12px 14px; font-size: 16px;   /* iOS 防缩放 */
    border-radius: 14px; min-height: 44px;   /* 触控最小高度 */
  }
  .composer .btn { min-width: 40px; min-height: 40px; font-size: 14px; flex-shrink: 0; }

  /* 附件预览芯片 */
  .attach-preview { padding: 5px 10px; font-size: 12px; }

  /* 表情面板：移动端更宽更高 */
  .emoji-panel { max-height: 320px; border-radius: 16px; margin-bottom: 6px; }
  .emoji-cell { min-height: 38px; border-radius: 10px; font-size: 22px; }
  .emoji-cell img { width: 28px; height: 28px; }

  /* 侧栏内面板纵向占满 */
  .sync-panel .row { width: 100%; }
  .sync-panel .row input { width: 100%; }
  .identity-panel .row { flex-wrap: wrap; }

  /* 列表更高 */
  .list { max-height: 42vh; }
}

/* 超小屏（≤420px）进一步收紧 */
@media (max-width: 420px) {
  .app { padding: 6px; gap: 6px; }
  .topbar { padding: 7px 10px; border-radius: 12px; }
  .logo { font-size: 18px; }
  .title { font-size: 13px; }

  .ctx-header { padding: 8px 10px; }
  .messages { gap: 6px; padding: 8px; }
  .msg { max-width: 92%; padding: 8px 10px; }
  .msg .body { font-size: 13px; }

  .composer { gap: 6px; padding: 8px; }
  .composer input { padding: 10px 12px; font-size: 16px; border-radius: 12px; }
  .composer .btn { min-width: 36px; min-height: 36px; padding: 6px 10px; }

  .lang-switch .lang-btn { padding: 3px 7px; font-size: 11px; }
}

/* ---------- 欢迎页（首屏） ---------- */
.welcome-screen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 24px;
  background:
    radial-gradient(1200px 720px at 50% -8%, #14233f 0%, rgba(11,15,26,0) 60%),
    radial-gradient(900px 600px at 50% 122%, #0e1b30 0%, var(--bg) 70%);
  color: var(--text);
}
.welcome-screen[hidden] { display: none !important; }
.welcome-bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; overflow: hidden; }
.wg-grid {
  position: absolute; top: -2px; right: -2px; bottom: -2px; left: -2px;
  background-image:
    linear-gradient(rgba(45,226,196,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,226,196,.06) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 28%, transparent 76%);
          mask-image: radial-gradient(circle at 50% 42%, #000 28%, transparent 76%);
}
.wg-glow { position: absolute; border-radius: 50%; filter: blur(64px); opacity: .5; }
.wg-glow-1 { width: 540px; height: 540px; left: -130px; top: -110px;
  background: radial-gradient(circle, rgba(45,226,196,.42), transparent 70%);
  animation: wgf 14s ease-in-out infinite alternate; }
.wg-glow-2 { width: 480px; height: 480px; right: -110px; bottom: -130px;
  background: radial-gradient(circle, rgba(108,140,255,.42), transparent 70%);
  animation: wgf 18s ease-in-out infinite alternate-reverse; }
@keyframes wgf { from { transform: translate(0,0) scale(1); } to { transform: translate(40px,30px) scale(1.15); } }
.wg-nodes { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; opacity: .55; }
.wg-lines line { stroke: var(--accent); stroke-width: 1.2; opacity: .35;
  stroke-dasharray: 6 10; animation: wgdash 3.2s linear infinite; }
@keyframes wgdash { to { stroke-dashoffset: -32; } }
.wg-dots circle { fill: var(--accent-2); filter: drop-shadow(0 0 6px rgba(108,140,255,.8)); animation: wgpulse 3.4s ease-in-out infinite; }
.wg-dots circle:nth-child(2n) { fill: var(--accent); }
@keyframes wgpulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.welcome-content {
  position: relative; z-index: 1; width: 100%; max-width: 660px;
  display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
  animation: wgup .6s ease both;
}
@keyframes wgup { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.welcome-logo { width: 88px; height: 88px; filter: drop-shadow(0 0 18px rgba(45,226,196,.5)); }
.welcome-title {
  margin: 0; font-size: 40px; font-size: clamp(28px, 6vw, 52px); font-weight: 800; letter-spacing: .5px; line-height: 1.15;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.welcome-sub { margin: 0; max-width: 92%; font-size: 16px; font-size: clamp(14px, 2.6vw, 19px); color: var(--muted); line-height: 1.6; }
.welcome-foot { margin: 6px 0 0; font-size: 12px; color: var(--muted); opacity: .7; }
.policy-row { display: flex; align-items: flex-start; gap: 8px; max-width: 92%; font-size: 13px; color: var(--muted); text-align: left; cursor: pointer; user-select: none; margin: 0; }
.policy-row input { margin: 2px 0 0; width: 15px; height: 15px; accent-color: var(--accent); flex: 0 0 auto; cursor: pointer; }
.policy-text { line-height: 1.5; }
.policy-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.policy-tip { display: none; margin: 0; font-size: 12px; color: #ff6b6b; }
.policy-tip:not([hidden]) { display: block; }
.policy-row.policy-warn { animation: pwarn .4s ease; }
@keyframes pwarn { 0%,100%{ transform: translateX(0); } 25%{ transform: translateX(-5px); } 75%{ transform: translateX(5px); } }
/* 欢迎页解码故障字标：乱码 → 逐字解码定形为 SibyX（源自 Logo V3 动效） */
.welcome-decode {
  margin: 2px 0; min-height: 1.15em;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 44px; font-size: clamp(34px, 7vw, 58px); font-weight: 700; letter-spacing: 8px; line-height: 1.15;
  color: #EAF1FF; user-select: none;
  text-shadow: 0 0 22px rgba(45,226,196,.25);
}
.welcome-decode.glitch { animation: wdglitch 2.6s infinite; }
@keyframes wdglitch {
  0%, 92%, 100% { transform: translate(0,0); text-shadow: 3px 0 #00D6C2, -3px 0 #FF3D7F, 0 0 22px rgba(45,226,196,.25); }
  93% { transform: translate(-2px,1px); text-shadow: 5px 0 #00D6C2, -5px 0 #FF3D7F, 0 0 22px rgba(45,226,196,.25); }
  96% { transform: translate(2px,-1px); text-shadow: -4px 0 #00D6C2, 4px 0 #FF3D7F, 0 0 22px rgba(45,226,196,.25); }
}
@media (max-width: 480px) { .welcome-decode { letter-spacing: 5px; } }
.welcome-topbar { position: absolute; top: 16px; right: 16px; z-index: 2; display: flex; gap: 8px; align-items: center; }
.welcome-topbar .btn { font-size: 13px; padding: 6px 12px; }
.lang-btn.active { color: var(--accent); border-color: var(--accent); }
.btn.lg { font-size: 17px; padding: 14px 40px; border-radius: 14px; }
.btn.lg:hover { box-shadow: 0 8px 30px rgba(45,226,196,.35); transform: translateY(-1px); }
.btn.lg:active { transform: translateY(0); }
@media (max-width: 480px) {
  .welcome-content { gap: 14px; }
  .welcome-logo { width: 66px; height: 66px; }
  .btn.lg { width: 100%; max-width: 320px; }
  .welcome-sub { font-size: 14px; }
  .welcome-topbar { top: 10px; right: 10px; gap: 6px; }
  .welcome-topbar .btn { font-size: 12px; padding: 5px 10px; }
}
/* 非安全上下文(HTTP)横幅：加密不可用，提示用 HTTPS 访问 */
.insecure-banner {
  margin: 14px 0 0; padding: 12px 16px; border-radius: 12px; max-width: 92%;
  font-size: 14px; line-height: 1.6; color: #ffd479;
  background: rgba(255,204,102,.14); border: 1px solid rgba(255,204,102,.5);
}

/* 频道重名警告条 */
.nick-warn { margin: 8px 12px 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; background: rgba(255,204,102,.12); border: 1px solid rgba(255,204,102,.45); color: var(--warn); }
.nick-warn[hidden] { display: none; }

/* 好友请求弹窗行 */
.freq-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 4px; border-bottom: 1px solid #2a3a63; }
.freq-row:last-child { border-bottom: none; }
.freq-info { min-width: 0; }
.freq-info .sub { color: var(--muted); font-size: 12px; }
.freq-actions { display: flex; gap: 6px; flex-shrink: 0; }
/* 好友列表：等待对方接受的徽标 */
.st.outgoing { font-size: 11px; color: var(--warn); background: rgba(255,204,102,.14); border: 1px solid rgba(255,204,102,.4); border-radius: 6px; padding: 1px 6px; margin-left: 4px; }

/* ③ 消息状态指示（仅"我发的"消息显示） */
.msg-status { font-size: 11px; margin-left: 6px; opacity: .85; white-space: nowrap; }
.msg-status.sending { color: var(--muted); }
.msg-status.sent { color: var(--muted); }
.msg-status.delivered { color: #7fd1ff; }
.msg-status.read { color: var(--accent, #2de2c4); }
.msg-status.failed { color: #ff6b6b; }
.msg-status .retry { cursor: pointer; text-decoration: underline; margin-left: 4px; }
.msg-status .retry:hover { opacity: .8; }

/* ④ 在线状态点 + 打字指示 */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; flex: 0 0 auto; }
.dot.online { background: #3ddc84; box-shadow: 0 0 6px rgba(61,220,132,.6); }
.dot.offline { background: #6b7280; opacity: .5; }
.typing-hint { font-size: 12px; color: var(--muted); padding: 2px 14px 0; font-style: italic; min-height: 16px; }
/* B-03：最后在线时间展示 */
.last-seen { font-size: 11px; color: var(--muted); margin-left: 6px; opacity: .85; }
.lastseen { font-size: 11px; color: var(--muted); opacity: .8; }
#stealthRow:has(input:disabled) { opacity: .45; }

/* ⑤ 撤回占位 + 撤回/编辑按钮 + 编辑框 + 已编辑标记 */
.recalled { color: var(--muted); font-style: italic; padding: 6px 14px; opacity: .8; }
.msg .recall, .msg .edit { cursor: pointer; margin-left: 6px; opacity: .5; font-size: 12px; user-select: none; }
.msg .recall:hover, .msg .edit:hover { opacity: 1; }
.edit-ta { width: 100%; min-height: 46px; margin: 2px 0 4px; box-sizing: border-box; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); padding: 6px 8px; font: inherit; resize: vertical; }
.edited-tag { font-size: 11px; color: var(--muted); margin-left: 4px; opacity: .8; }

/* ⑥ 回复引用：引用按钮 + 气泡内引用块 + 输入框上方回复预览条 + 高亮定位 */
.msg .recall, .msg .edit, .msg .quote { cursor: pointer; margin-left: 6px; opacity: .5; font-size: 12px; user-select: none; }
.msg .recall:hover, .msg .edit:hover, .msg .quote:hover { opacity: 1; }
.quote-block { border-left: 3px solid var(--accent-2, #6c8cff); background: rgba(108,140,255,.08); border-radius: 6px; padding: 4px 8px; margin-bottom: 5px; cursor: pointer; max-width: 100%; }
.quote-block:hover { background: rgba(108,140,255,.16); }
.quote-block .q-who { font-size: 11px; color: var(--accent-2, #6c8cff); font-family: monospace; margin-bottom: 1px; }
.quote-block .q-text { font-size: 12px; color: var(--muted); line-height: 1.4; word-break: break-word; white-space: pre-wrap; overflow: hidden; max-height: 2.8em; }
/* A-02 ① 引用来源会话名（跨会话引用显示"↗ # 频道/昵称"，可点跳转） */
.quote-block .q-ctx { font-size: 11px; color: var(--accent); opacity: .85; margin: 2px 0 0; cursor: pointer; }
.quote-block .q-ctx:hover { text-decoration: underline; }
/* A-02 ③ 长引用折叠"展开/收起"开关 */
.quote-block .q-toggle { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--accent); cursor: pointer; user-select: none; }
.quote-block .q-toggle:hover { text-decoration: underline; }
/* A-02 ② 列表"引用了我"未读红点 */
.quote-badge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e74c3c; margin-left: 4px; vertical-align: middle; box-shadow: 0 0 0 2px rgba(231,76,60,.25); }
/* A-02 ① 回复条内的跨会话来源名 */
.reply-ctx { font-size: 11px; color: var(--accent); margin-left: 6px; opacity: .9; }
.msg.flash { animation: quoteFlash 1.2s ease; }
@keyframes quoteFlash { 0% { box-shadow: 0 0 0 2px var(--accent-2, #6c8cff); } 100% { box-shadow: 0 0 0 2px transparent; } }
.reply-bar { padding: 6px 12px; border-top: 1px solid var(--border); background: rgba(108,140,255,.06); font-size: 12px; }
.reply-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.reply-who { color: var(--accent-2, #6c8cff); font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.reply-snip { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.reply-x { color: var(--danger); cursor: pointer; font-size: 15px; line-height: 1; flex: 0 0 auto; padding: 0 4px; }
.reply-x:hover { opacity: .8; }

/* A-04 焚毁策略条 + 🔥 按钮 + 浮层菜单 */
.burn-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid #ff7043; background: rgba(255,112,67,.10); font-size: 12px; }
.burn-bar[hidden] { display: none; }   /* 修复：display:flex 会架空 hidden 属性，导致空条始终显示成橙色多余区域 */
.burn-chip { display: inline-flex; align-items: center; color: #ff7043; font-weight: 600; white-space: nowrap; }
.burn-x { color: #ff7043; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.burn-x:hover { opacity: .8; }
#burnBtn.on { color: #ff7043; border-color: #ff7043; background: rgba(255,112,67,.12); }
#burnBtn.locked { opacity: .4; cursor: not-allowed; }
#burnBtn.locked::after { content: ' 🔒'; font-size: .72em; vertical-align: middle; }   /* VIP 专属锁 */
.burn-menu { min-width: 178px; background: var(--bg, #fff); border: 1px solid var(--border, #e2e6f0); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 4px; max-height: 70vh; overflow: auto; }
.burn-head { font-size: 11px; color: var(--muted, #8a90a6); padding: 6px 8px 2px; font-weight: 700; letter-spacing: .3px; }
.burn-item { padding: 7px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.burn-item:hover { background: rgba(108,140,255,.12); }
.recalled.burned { color: #ff7043; font-style: normal; font-weight: 600; }

/* ⑦ @提及：正文高亮（@我=醒目橙、@好友=蓝）+ 气泡@我角标 + 列表@我徽标 */
.mention { font-weight: 600; padding: 0 2px; border-radius: 4px; }
.mention.me { color: #ff8a3d; background: rgba(255,138,61,.16); }      /* @我：醒目橙 */
.mention.friend { color: var(--accent-2, #6c8cff); background: rgba(108,140,255,.12); }  /* @好友：蓝 */
.atme { font-size: 11px; color: #fff; background: #ff8a3d; border-radius: 4px; padding: 0 5px; margin-left: 6px; font-weight: 600; }  /* 气泡@我角标 */
.atme-badge { display: inline-block; font-size: 10px; color: #fff; background: #ff8a3d; border-radius: 8px; padding: 0 6px; margin-left: 4px; font-weight: 700; vertical-align: middle; }  /* 列表@我徽标 */

/* ⑧ 表情回应 reactions：气泡底部汇总条 + 「+」入口 + emoji 选择器 */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0 14px; }
.reaction-chip { font-size: 12px; line-height: 1.6; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 0 7px; cursor: pointer; user-select: none; }
.reaction-chip.mine { background: rgba(108,140,255,.18); border-color: var(--accent-2, #6c8cff); }
.reaction-chip:hover { border-color: var(--accent-2, #6c8cff); }
.react-add { font-size: .66em; cursor: pointer; opacity: 1; color: var(--accent-2); background: rgba(108,140,255,.16); border: 1px solid rgba(108,140,255,.55); border-radius: 999px; padding: 0 5px; margin-left: 2px; user-select: none; line-height: 1.3; }
.react-add:hover { background: rgba(108,140,255,.3); border-color: rgba(108,140,255,.85); }
.emoji-picker { position: fixed; z-index: 1000; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 6px; display: flex; gap: 4px; flex-wrap: wrap; max-width: 230px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.emoji-picker .emoji-opt { font-size: 18px; background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.emoji-picker .emoji-opt:hover { background: rgba(108,140,255,.15); }

/* 🔆 ⑩ 日期分割线 / 置顶栏 / 收藏 */
.day-divider { display: flex; align-items: center; justify-content: center; margin: 14px 0 10px; }
.day-divider span { font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid #233156; border-radius: 999px; padding: 2px 12px; letter-spacing: .03em; }
:root[data-theme="light"] .day-divider span { border-color: #d4dbec; }

/* 置顶栏：贴在消息区上方，列出本会话置顶消息，点击跳转 */
.pin-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; padding: 6px 8px; background: var(--panel); border: 1px solid #233156; border-radius: 10px; }
.pin-bar[hidden] { display: none; }   /* 同 burn-bar：防止空置顶条被 display:flex 架空而显示 */
:root[data-theme="light"] .pin-bar { border-color: #d4dbec; }
.pin-bar .pin-head { font-size: 11px; color: var(--accent); width: 100%; opacity: .85; }
.pin-item { font-size: 12px; color: var(--text); background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 8px; padding: 4px 8px; cursor: pointer; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-item:hover { border-color: var(--accent); }

/* 消息操作：⋯ 更多按钮（置顶/收藏入口） */
.msg .more { cursor: pointer; opacity: .4; margin-left: 4px; user-select: none; font-size: 14px; }
.msg .more:hover { opacity: 1; }
.msg .more.on { opacity: 1; color: var(--warn); }

/* ⋯ 更多弹出菜单 */
.more-menu { background: var(--panel); border: 1px solid #2a3a63; border-radius: 10px; padding: 4px 0; min-width: 140px; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.more-item { padding: 8px 14px; font-size: 13px; color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.more-item:hover { background: rgba(108,140,255,.12); }
:root[data-theme="light"] .more-menu { border-color: #d4dbec; box-shadow: 0 4px 16px rgba(0,0,0,.15); }

/* 收藏列表弹窗 */
.fav-list { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; }
.fav-item { background: var(--panel-2); border: 1px solid #2a3a63; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.fav-item:hover { border-color: var(--accent); }
.fav-item .f-who { font-size: 12px; color: var(--accent); margin-bottom: 2px; }
.fav-item .f-text { font-size: 13px; color: var(--text); word-break: break-word; }
.fav-item .f-ctx { font-size: 11px; color: var(--muted); margin-top: 3px; }
.fav-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }

/* ⑪ 浏览器通知：应用内 toast（前台必定可见，无需系统权限） */
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 1200; display: flex; flex-direction: column; gap: 10px; max-width: min(320px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel); border: 1px solid #2a3a63; border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4); cursor: pointer; animation: toast-in .18s ease-out; }
.toast:hover { border-color: var(--accent); }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.toast-body { font-size: 12px; color: var(--muted); word-break: break-word; max-height: 3.2em; overflow: hidden; }
:root[data-theme="light"] .toast { border-color: #d4dbec; border-left-color: var(--accent); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
/* 新消息提示：顶部居中（区别于右下角通用 toast） */
.notify-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: min(440px, 92vw); pointer-events: none; }
.notify-wrap .toast { pointer-events: auto; width: 100%; box-sizing: border-box; animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* P2 隐藏入口：增加中继按钮默认 hidden，强制隐藏（防 .btn 的 display 覆盖 [hidden]） */
#relayEditBtn[hidden]{display:none!important}

/* A-03 全局传输进度条（上传/下载大附件时显示） */
.transfer-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 70; display: flex; align-items: center; gap: 8px; width: min(360px, 90vw); padding: 6px 10px; background: var(--panel); border: 1px solid #2a3a63; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.45); font-size: 12px; color: var(--muted); }
.transfer-bar[hidden]{display:none}
.transfer-bar .t-label { white-space: nowrap; }
.transfer-bar .t-track { flex: 1; height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.transfer-bar .bar { width: 0%; height: 100%; background: linear-gradient(90deg, var(--accent), #6ea8ff); border-radius: 999px; transition: width .2s ease; }

/* A-03 图片灯箱 */
.lb-card { width: min(92vw, 880px); max-height: 88vh; display: flex; flex-direction: column; }
.lb-body { display: flex; align-items: center; justify-content: center; padding: 8px 0; overflow: auto; }
.lb-img { max-width: 100%; max-height: 70vh; border-radius: 10px; background: #0b1020; }
.lb-foot { text-align: right; margin-top: 6px; }

/* === 欢迎页：订阅按钮 / copyright / 订阅弹窗（2026-07-22f） === */
.welcome-copy { margin: 12px 0 0; font-size: 12px; color: var(--muted); opacity: .6; letter-spacing: .3px; }
.sub-email { margin: 10px 0 6px; font-size: 18px; font-weight: 700; color: var(--accent); word-break: break-all; text-align: center; }
#subModal .modal-card { max-width: 380px; }
#subModal .modal-body { text-align: center; }
#subModal { z-index: 1100; }   /* 须高于欢迎页 z-index:1000，否则弹窗被压在欢迎页底下看不见 */

/* ===== 邀请得 Pro 弹窗 ===== */
#inviteModal .modal-card { max-width: 420px; }
#inviteModal .modal-body { display: flex; flex-direction: column; gap: 10px; }
.invite-link-label { font-weight: 600; font-size: 13px; opacity: 0.9; }
.invite-link-row { display: flex; gap: 8px; align-items: center; }
.invite-link-row input { flex: 1; min-width: 0; font-size: 12px; }
.invite-qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 4px 0; }
.invite-qr { background: #fff; padding: 10px; border-radius: 10px; line-height: 0; }
.invite-qr svg { width: 180px; height: 180px; display: block; }
.invite-progress { font-weight: 600; color: var(--accent, #3B6BFF); text-align: center; min-height: 18px; }
#inviteModal .hint { text-align: center; margin: 0; }

/* ===== 侧栏显示设置板块 ===== */
#displayPanel .disp-row { align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
#displayPanel:not(.collapsed) .disp-row { display: flex; }
#displayPanel .disp-key { font-size: 13px; opacity: 0.92; }
#displayPanel .btn { min-width: 46px; }

/* ===== S7 引导卡（新用户无频道时覆盖消息区）===== */
.onboarding {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
}
.onboarding[hidden] { display: none; }
.onboarding-card {
  width: 100%; max-width: 460px;
  background: var(--panel); border: 1px solid var(--panel-2);
  border-radius: 16px; padding: 28px 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}
.onboarding-card .ob-title { margin: 0 0 6px; font-size: 22px; color: var(--text); }
.onboarding-card .ob-desc { margin: 0 0 18px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.ob-actions { display: grid; gap: 10px; }
.ob-btn {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 13px 16px; border-radius: 12px; cursor: pointer;
  background: var(--panel-2); border: 1px solid transparent;
  color: var(--text); transition: border-color .15s, transform .05s;
}
.ob-btn:hover { border-color: var(--accent-2); }
.ob-btn:active { transform: scale(0.99); }
.ob-btn .ob-main { font-size: 15px; font-weight: 600; }
.ob-btn .ob-sub { font-size: 12px; color: var(--muted); }

/* ===== S4 只读频道目录 ===== */
.dir-list { display: grid; gap: 8px; margin-top: 6px; }
.dir-row {
  padding: 11px 14px; border-radius: 10px; cursor: pointer;
  background: var(--panel-2); border: 1px solid transparent;
  color: var(--text); font-size: 14px; word-break: break-word;
  transition: border-color .15s;
}
.dir-row:hover { border-color: var(--accent-2); }
