/* ============================================================
 * 梓曰传讯 · 黑白水墨主题
 * 宣纸为底、墨色为骨、云海为境。全无彩色，只分浓淡。
 * 主色由 config.js 注入 --primary，其余变量在此调整。
 * ============================================================ */
:root {
  --paper: #f4f1e8;        /* 宣纸底 */
  --paper-deep: #eae6d8;   /* 古卷深纸（聊天区/发现页底） */
  --ink: #2b2925;          /* 浓墨（正文/主色） */
  --ink-light: #8d8677;    /* 淡墨（次要文字） */
  --ink-head: #232019;     /* 头部沉墨 */
  --head-text: #e9e3d2;    /* 头部文字（宣纸白） */
  --bubble-mine: #d9d4c4;  /* 灰绢（自己气泡） */
  --bubble-peer: #fffef8;  /* 绢白（对方气泡） */
  --line: #d8d1bd;         /* 分隔线（楮色） */
  --danger: #4a453c;       /* 黑白主题下危险色也用深墨灰 */
  --cloud-1: rgba(255,255,255,.55);
  --cloud-2: rgba(210,205,190,.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "Noto Serif SC", serif;
  color: var(--ink);
  background: var(--paper);
  max-width: 750px; margin: 0 auto; /* 桌面浏览器调试时限宽，模拟手机 */
  position: relative; overflow: hidden;
}
.hidden { display: none !important; }
.view { height: 100vh; display: flex; flex-direction: column; }

/* ---------- 登录页 ---------- */
#view-login { justify-content: center; align-items: center; background: var(--paper); }
.login-box { width: 78%; display: flex; flex-direction: column; gap: 14px; }
.login-logo {
  text-align: center; color: var(--primary, #a63a2b); font-size: 46px;
  letter-spacing: 12px; margin-bottom: 24px; text-indent: 12px;
}
.btn-primary {
  height: 44px; border: none; border-radius: 4px;
  background: var(--primary, #a63a2b); color: #f6f1e5;
  font-size: 17px; font-family: inherit; letter-spacing: 6px; cursor: pointer;
}
.btn-primary:disabled { opacity: .45; }
.btn-danger {
  display: block; width: 90%; margin: 30px auto; height: 44px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--bubble-peer);
  color: var(--danger); font-size: 16px; font-family: inherit; letter-spacing: 4px; cursor: pointer;
}
.login-note { text-align: center; font-size: 13px; color: var(--ink-light); margin: -8px 0 4px; }
.login-links { display: flex; justify-content: space-between; font-size: 13px; }
.login-links a { color: #6c5b7b; cursor: pointer; }

/* ---------- 头部 ---------- */
#header, #chat-header {
  background: var(--ink-head); color: var(--head-text);
  height: 48px; line-height: 48px; padding: 0 14px; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px; font-size: 18px; letter-spacing: 2px;
  border-bottom: 2px solid var(--primary, #a63a2b);
}
#header { justify-content: space-between; }
#header-actions { display: flex; align-items: center; gap: 10px; }
#conn-status { font-size: 11px; opacity: .85; letter-spacing: 0; }
#conn-status.online { color: #9dbf88; }
#conn-status.offline { color: #e08a7a; }
#btn-plus { background: none; border: none; color: var(--head-text); font-size: 24px; cursor: pointer; }
#btn-back { background: none; border: none; color: var(--head-text); font-size: 26px; cursor: pointer; width: 30px; }
#chat-typing { font-size: 12px; color: #b7ab8d; letter-spacing: 0; }
/* 暗号手势区：禁选中禁系统长按菜单，否则触屏长按变选词 */
#chat-title { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: default; }

/* ---------- 会话列表 ---------- */
#main { flex: 1; overflow-y: auto; background: var(--paper); }
.tab-page { display: none; min-height: 100%; }
.tab-page.active { display: block; }
.empty-tip { text-align: center; color: var(--ink-light); padding: 60px 0; font-size: 14px; }
.conv-item { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv-item:active { background: var(--paper-deep); }
.avatar {
  width: 44px; height: 44px; border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #f6f1e5; font-size: 18px; background: #5b6b8c;
}
.conv-body { flex: 1; margin-left: 10px; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; }
.conv-name { font-size: 16px; color: var(--ink); }
.conv-time { font-size: 12px; color: var(--ink-light); flex-shrink: 0; }
.conv-digest { font-size: 13px; color: var(--ink-light); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  min-width: 18px; height: 18px; border-radius: 9px; background: var(--primary, #a63a2b); color: #f6f1e5;
  font-size: 11px; line-height: 18px; text-align: center; padding: 0 5px; flex-shrink: 0;
}

/* ---------- tabbar ---------- */
#tabbar { display: flex; flex-shrink: 0; background: var(--paper); border-top: 1px solid var(--line); height: 52px; }
.tab-btn { position: relative; flex: 1; border: none; background: none; font-size: 14px; font-family: inherit; color: var(--ink-light); cursor: pointer; letter-spacing: 2px; }
.tab-btn.active { color: var(--primary, #a63a2b); font-weight: bold; }
.tab-btn .badge { position: absolute; top: 4px; left: calc(50% + 10px); }
.tab-btn .badge.badge-dot { top: 9px; }

/* 纯红点（免打扰会话未读 / tab 红点） */
.badge-dot { min-width: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--primary, #a63a2b); }

/* 角标拖开手势：回弹动画，拖动中禁用过渡 */
#conv-list .badge, #tabbar .badge { transition: transform .15s ease; touch-action: none; user-select: none; -webkit-user-select: none; }
#conv-list .badge.dragging, #tabbar .badge.dragging { transition: none; z-index: 60; position: relative; }

/* ---------- 发现 ---------- */
#page-discover { background: var(--paper-deep); }
.discover-group { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 12px; }
.discover-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  font-size: 16px; cursor: pointer; border-bottom: 1px solid var(--line);
}
.discover-item:last-child { border-bottom: none; }
.discover-item:active { background: var(--paper-deep); }
.discover-glyph {
  width: 30px; height: 30px; border-radius: 4px; background: var(--ink-head);
  color: var(--head-text); display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.discover-soon { margin-left: auto; font-size: 12px; color: var(--ink-light); }

/* ---------- 聊天页 ---------- */
/* 云雾意境：多层径向渐变叠出云雾，无需图片素材 */
#msg-area {
  flex: 1; overflow-y: auto; padding: 10px 12px;
  background:
    radial-gradient(ellipse 90% 28% at 20% 8%, var(--cloud-1), transparent 70%),
    radial-gradient(ellipse 80% 24% at 80% 30%, var(--cloud-2), transparent 70%),
    radial-gradient(ellipse 95% 26% at 30% 62%, var(--cloud-1), transparent 70%),
    radial-gradient(ellipse 85% 22% at 75% 88%, var(--cloud-2), transparent 70%),
    var(--paper-deep);
}
.time-divider { text-align: center; font-size: 12px; color: var(--ink-light); margin: 10px 0; }
.msg-row { display: flex; margin-bottom: 14px; align-items: flex-start; }
.msg-row.mine { flex-direction: row-reverse; }
.msg-row .avatar { width: 38px; height: 38px; font-size: 15px; }
.bubble {
  max-width: 68%; margin: 0 8px; padding: 9px 12px; border-radius: 4px;
  font-size: 16px; line-height: 1.45; word-break: break-word; white-space: pre-wrap;
  background: var(--bubble-peer); border: 1px solid var(--line); position: relative; user-select: text;
}
.msg-row.mine .bubble { background: var(--bubble-mine); }
/* 媒体消息（图片/视频）采用微信式：无边框透明气泡，媒体自带圆角与封面 */
.bubble.no-pad { padding: 0; background: transparent; border-color: transparent; }
.bubble img.chat-img {
  display: block; max-width: 200px; max-height: 240px; border-radius: 8px;
  cursor: zoom-in; background: rgba(0, 0, 0, .06);
}
.bubble video.chat-video { display: block; max-width: 220px; max-height: 260px; border-radius: 3px; background: #000; }
/* 视频封面卡片（点击进全屏播放，微信式） */
.bubble .chat-video-card {
  position: relative; width: 200px; height: 112px; border-radius: 8px;
  background: linear-gradient(150deg, #403a33, #221d18); overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .10);
}
/* 无本地封面（他人视频首次见）时，fallback 居中播放钮；有封面后隐藏 */
.chat-video-card .chat-video-play {
  position: relative; z-index: 2; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255, 255, 255, .32); border: 1px solid rgba(255, 255, 255, .65);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .30);
  transition: transform .12s ease, background .12s ease;
}
.chat-video-card:active .chat-video-play { transform: scale(.92); background: rgba(255, 255, 255, .5); }
.chat-video-card.has-poster .chat-video-play { display: none; }
.chat-video-play i {
  width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 11px;
  border-color: transparent transparent transparent #fff; margin-left: 3px;
}
/* 右下角：黑半透明胶囊 = 小三角 + 时长 */
.chat-video-card .chat-video-badge {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  display: flex; align-items: center; gap: 5px;
  background: rgba(0, 0, 0, .55); color: #fff; border-radius: 999px;
  padding: 4px 8px 4px 6px; font-size: 11px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.chat-video-badge i {
  width: 0; height: 0; border-style: solid; border-width: 4px 0 4px 7px;
  border-color: transparent transparent transparent rgba(255, 255, 255, .95);
}
.chat-video-badge em { font-style: normal; }
.chat-video-badge em:empty { display: none; }
.chat-video-card img.chat-video-poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
/* 消息视频全屏播放器（含黑边，方向随视频真实比例） */
.player-mask {
  position: fixed; inset: 0; z-index: 999; background: #000;
  display: flex; align-items: center; justify-content: center;
}
.player-mask video { width: 100%; height: 100%; object-fit: contain; }
.bubble.voice { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 70px; }
.msg-row.mine .bubble.voice { flex-direction: row-reverse; }
.voice-icon { font-size: 14px; }
.voice-dur { font-size: 14px; color: var(--ink-light); }
.bubble.file-card { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 200px; }
.file-icon {
  width: 40px; height: 40px; border-radius: 4px; background: var(--ink-head);
  color: var(--head-text); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.file-name { font-size: 15px; word-break: break-all; }
.file-size { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
.msg-status { font-size: 11px; color: var(--ink-light); align-self: flex-end; flex-shrink: 0; }
.msg-status.failed { color: var(--danger); cursor: pointer; }
.read-mark { text-align: right; font-size: 11px; color: var(--ink-light); margin: -8px 0 10px; }

/* ---------- 输入栏与附件面板 ---------- */
#input-bar {
  display: flex; gap: 5px; padding: 8px 8px; background: var(--paper);
  border-top: 1px solid var(--line); flex-shrink: 0; align-items: center;
}
.bar-btn {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer; flex-shrink: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.bar-btn svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#btn-voice-mode .ic-kbd { display: none; }
#btn-voice-mode.to-kbd .ic-mic { display: none; }
#btn-voice-mode.to-kbd .ic-kbd { display: block; }
#msg-input {
  flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bubble-peer); color: var(--ink);
  padding: 0 10px; font-size: 16px; font-family: inherit; outline: none;
}
#btn-hold-talk {
  flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bubble-peer); color: var(--ink); font-size: 16px; font-family: inherit; letter-spacing: 2px;
  cursor: pointer; user-select: none; touch-action: none;
}
#btn-hold-talk.recording { background: var(--bubble-mine); }
#input-bar .btn-primary { width: auto; height: 32px; padding: 0 14px; font-size: 14px; letter-spacing: 2px; flex-shrink: 0; }
#attach-panel {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px;
  padding: 18px 14px; background: var(--paper); border-top: 1px solid var(--line); flex-shrink: 0;
}
#emoji-panel {
  display: grid; grid-template-columns: repeat(8, 1fr);
  padding: 10px 8px; background: var(--paper); border-top: 1px solid var(--line);
  flex-shrink: 0; max-height: 240px; overflow-y: auto;
}
#emoji-panel span { text-align: center; font-size: 24px; padding: 6px 0; cursor: pointer; user-select: none; }
#emoji-panel span:active { background: var(--paper-deep); border-radius: 6px; }
.attach-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); cursor: pointer; }
.attach-glyph {
  width: 60px; height: 60px; border-radius: 14px; background: #fff;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
}
.attach-glyph svg { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.attach-item:active .attach-glyph { background: var(--paper-deep); }
.attach-item.disabled { opacity: .4; cursor: default; }

/* ---------- 图片查看器 / 录音浮层 ---------- */
#img-viewer {
  position: fixed; inset: 0; z-index: 60; background: rgba(20,18,14,.92);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
  overflow: hidden; touch-action: none;
}
#img-viewer img {
  max-width: 96%; max-height: 96%;
  transform-origin: center center; will-change: transform;
  user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
  touch-action: none;
}
#voice-hint {
  position: fixed; left: 50%; bottom: 160px; transform: translateX(-50%);
  background: rgba(58,53,45,.92); color: var(--head-text); border-radius: 6px;
  padding: 14px 26px; text-align: center; z-index: 55;
}
#voice-hint.cancel { background: rgba(166,58,43,.92); color: #f6f1e5; }
#voice-hint-time { font-size: 22px; margin-top: 6px; }

/* ---------- 位置选点（高德地图） ---------- */
#view-location {
  position: fixed; inset: 0; z-index: 85; background: var(--paper);
  display: flex; flex-direction: column; max-width: 750px; margin: 0 auto;
}
#loc-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--paper); border-bottom: 1px solid var(--line); }
#loc-search {
  flex: 1; min-width: 0; height: 36px; border: 1px solid var(--line); border-radius: 18px;
  padding: 0 14px; font-size: 14px; font-family: inherit; background: #fff; outline: none;
}
#btn-loc-search {
  height: 36px; padding: 0 16px; border: none; border-radius: 18px;
  background: var(--primary, #a63a2b); color: #f6f1e5; font-size: 14px; font-family: inherit; cursor: pointer;
}
#loc-map-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#loc-map-area { flex: 1; position: relative; overflow: hidden; }
#loc-map { position: absolute; inset: 0; }
#loc-pin {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%);
  width: 36px; height: 36px; fill: var(--primary, #a63a2b);
  pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}
#loc-pin circle { fill: var(--paper, #f6f1e5); }
/* 附近地点列表占底部固定区域（不再悬浮盖图），地图变矮后中心钉自然居中 */
#loc-results {
  max-height: 40%; overflow-y: auto; flex-shrink: 0;
  background: var(--paper); border-top: 1px solid var(--line);
}
.loc-poi { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.loc-poi:active { background: var(--paper-deep); }
.loc-poi.active { background: var(--paper-deep); }
.loc-poi-name { font-size: 15px; color: var(--ink); }
.loc-poi-addr { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
#btn-loc-send { margin: 12px; height: 44px; flex-shrink: 0; }

/* ---------- 位置查看页（卡片点入） ---------- */
#view-loc-view {
  position: fixed; inset: 0; z-index: 86; background: var(--paper);
  display: flex; flex-direction: column; max-width: 750px; margin: 0 auto;
}
#loc-view-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 17px; }
#loc-view-bar .back-btn { color: var(--ink); }
#loc-view-map { flex: 1; }
#loc-view-info { padding: 12px 14px; border-top: 1px solid var(--line); }
#loc-view-addr { font-size: 13px; color: var(--ink-light); margin-bottom: 10px; }
#btn-loc-nav { width: 100%; height: 42px; }

/* ---------- 转发选择器 ---------- */
#forward-search-wrap { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
#forward-search {
  width: 100%; box-sizing: border-box; height: 36px; border: 1px solid var(--line);
  border-radius: 18px; padding: 0 14px; font-size: 14px; font-family: inherit; background: #fff; outline: none;
}
#forward-list { flex: 1; overflow-y: auto; }

/* ---------- 气泡长按菜单 / toast ---------- */
#msg-menu { position: fixed; z-index: 70; background: rgba(58,53,45,.95); border-radius: 8px; display: flex; overflow: hidden; }
#msg-menu button { background: none; border: none; color: var(--head-text); padding: 10px 18px; font-size: 14px; font-family: inherit; cursor: pointer; }

/* ---------- 底部动作表（会话操作 / actionSheet 共用，微信风） ---------- */
.sheet-mask { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.sheet {
  width: 100%; background: #f2f2f2; border-radius: 16px 16px 0 0; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom); animation: sheet-up .18s ease-out;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-title {
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 12px 16px; font-size: 13px; color: var(--ink-light); text-align: center;
}
#conv-sheet-items button, .sheet-item {
  display: block; width: 100%; height: 47px; background: var(--paper); border: none; border-bottom: 1px solid var(--line);
  font-size: 16px; font-family: inherit; color: var(--ink); cursor: pointer; text-align: center;
}
#conv-sheet-items button:last-child, .sheet-item:last-child { border-bottom: none; }
#conv-sheet-items button.danger, .sheet-item.danger { color: #a63a2b; }
.sheet-cancel {
  display: block; width: 100%; height: 47px; margin-top: 8px; background: var(--paper); border: none;
  font-size: 16px; font-family: inherit; color: var(--ink); cursor: pointer;
}
#toast {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%,-50%);
  background: rgba(58,53,45,.9); color: var(--head-text); padding: 10px 20px;
  border-radius: 4px; font-size: 14px; z-index: 99; max-width: 80%;
}

/* ---------- 页内弹窗（微信对话框风，替代 prompt/confirm/alert，APK WebView 不支持 JS 弹窗） ---------- */
.ask-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.ask-box {
  width: 78%; max-width: 320px; background: var(--paper); border-radius: 12px;
  padding: 20px 20px 0; display: flex; flex-direction: column; overflow: hidden;
}
.ask-title { font-size: 16px; font-weight: bold; color: var(--ink-head); text-align: center; }
.ask-text { margin-top: 12px; font-size: 15px; color: var(--ink); white-space: pre-line; text-align: center; line-height: 1.5; }
.ask-input {
  margin-top: 12px; border: none; border-radius: 6px; background: #f2f2f2;
  padding: 10px 12px; font-size: 15px; outline: none; font-family: inherit;
}
/* 按钮配色必须在 .ask-btns 作用域内写全（优先级高于 .btn-primary） */
.ask-btns { display: flex; margin: 18px -20px 0; border-top: 1px solid var(--line); }
.ask-btns button {
  flex: 1; padding: 12px 0; border: none; background: transparent;
  font-size: 16px; font-family: inherit; color: var(--ink); cursor: pointer;
}
.ask-btns button + button { border-left: 1px solid var(--line); }
.ask-btns .ask-ok { background: transparent; color: var(--primary, #a63a2b); }
.ask-btns button:active { background: var(--paper-deep); }

/* ---------- 我的 ---------- */
#me-card { display: flex; align-items: center; background: var(--paper); padding: 24px 16px; border-bottom: 1px solid var(--line); }
#me-card .avatar { width: 60px; height: 60px; font-size: 24px; }
#me-info { margin-left: 14px; }
#me-nickname { font-size: 20px; }
#me-zyid { font-size: 13px; color: var(--ink-light); margin-top: 4px; }
.me-row {
  display: flex; justify-content: space-between; background: var(--paper);
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 15px;
}
/* ---------- 我的二维码 ---------- */
.me-row .me-row-val { color: var(--ink-light); }
#qr-body { flex: 1; overflow-y: auto; background: var(--paper-deep); display: flex; align-items: center; justify-content: center; }
#qr-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 28px 24px; text-align: center; box-shadow: 0 4px 18px rgba(35,32,25,.12);
}
#qr-user { font-size: 17px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; justify-content: center; }
#qr-user .avatar { width: 40px; height: 40px; }
#qr-img { width: 230px; height: 230px; margin: 0 auto; }
#qr-img img, #qr-img canvas { width: 100%; height: 100%; }
#qr-tip { font-size: 12px; color: var(--ink-light); margin-top: 14px; }
.me-row.clickable { cursor: pointer; }

/* ---------- 扫一扫 ---------- */
#scan-body { flex: 1; position: relative; background: #000; overflow: hidden; display: flex; align-items: center; justify-content: center; }
#scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#scan-frame {
  position: relative; width: 220px; height: 220px;
  border: 2px solid rgba(255,255,255,.85); border-radius: 8px;
  box-shadow: 0 0 0 2000px rgba(0,0,0,.35);
}
#scan-tip { position: absolute; bottom: 18%; width: 100%; text-align: center; color: rgba(255,255,255,.9); font-size: 14px; }

/* ---------- 设置 ---------- */
#settings-body { flex: 1; overflow-y: auto; }


/* ---------- 好友（通讯录） ---------- */
.contact-entry {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--paper); border-bottom: 1px solid var(--line);
  font-size: 16px; cursor: pointer;
}
.contact-entry:active { background: var(--paper-deep); }
.contact-glyph {
  width: 40px; height: 40px; border-radius: 4px; background: var(--ink-head);
  color: var(--head-text); display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.contact-entry .badge { margin-left: auto; }
.friend-item { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; background: var(--paper); }
.friend-item:active { background: var(--paper-deep); }
.friend-name { font-size: 16px; margin-left: 10px; }
.friend-sub { font-size: 12px; color: var(--ink-light); margin-left: 10px; margin-top: 2px; }

/* ---------- 好友申请页 ---------- */
#apply-header {
  background: var(--ink-head); color: var(--head-text); height: 48px; line-height: 48px;
  padding: 0 14px; display: flex; align-items: center; gap: 10px; font-size: 18px; letter-spacing: 2px;
  border-bottom: 1px solid #000;
}
.back-btn { background: none; border: none; color: var(--head-text); font-size: 26px; cursor: pointer; width: 30px; }
#apply-list { flex: 1; overflow-y: auto; background: var(--paper); }
.apply-item { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); gap: 10px; }
.apply-body { flex: 1; min-width: 0; }
.apply-name { font-size: 16px; }
.apply-msg { font-size: 13px; color: var(--ink-light); margin-top: 3px; }
.apply-actions { display: flex; gap: 6px; flex-shrink: 0; }
.apply-actions button {
  border: 1px solid var(--ink); border-radius: 4px; padding: 6px 12px;
  font-size: 13px; font-family: inherit; cursor: pointer; background: var(--ink); color: var(--paper);
}
.apply-actions button.refuse { background: none; color: var(--ink-light); border-color: var(--line); }
.apply-status { font-size: 13px; color: var(--ink-light); flex-shrink: 0; }

/* ---------- ＋ 号菜单 ---------- */
#plus-menu {
  position: fixed; top: 50px; right: 12px; z-index: 65;
  background: rgba(35,32,25,.96); border-radius: 4px; overflow: hidden; min-width: 130px;
}
#plus-menu button {
  display: block; width: 100%; background: none; border: none; color: var(--head-text);
  padding: 12px 18px; font-size: 15px; font-family: inherit; text-align: left; cursor: pointer;
  border-bottom: 1px solid rgba(233,227,210,.12); letter-spacing: 2px;
}
#plus-menu button:last-child { border-bottom: none; }

/* ---------- 建群页 ---------- */
#group-create-body { flex: 1; overflow-y: auto; padding: 14px; background: var(--paper); }
#gc-name {
  width: 100%; height: 44px; border: none; border-bottom: 1px solid var(--line);
  background: transparent; font-size: 16px; font-family: inherit; outline: none; color: var(--ink);
}
#gc-cats { margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
#gc-cats label { display: flex; align-items: center; gap: 8px; font-size: 16px; cursor: pointer; }
#gc-cats small { color: var(--ink-light); font-size: 12px; margin-left: 6px; }
.gc-sub { font-size: 13px; color: var(--ink-light); margin: 12px 0 6px; }
.gc-friend { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 15px; }
.gc-friend input { width: 18px; height: 18px; accent-color: var(--ink); }
#btn-gc-create { width: 100%; margin: 18px 0 30px; }

/* ---------- 群管理页 ---------- */
#group-manage { flex: 1; overflow-y: auto; background: var(--paper-deep); }
#gm-members {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px 6px;
  background: var(--paper); padding: 16px 12px; border-bottom: 1px solid var(--line);
}
.gm-member { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-light); cursor: pointer; }
.gm-member .avatar { width: 46px; height: 46px; }
.gm-member .gm-role { color: var(--ink); }
.gm-add {
  width: 46px; height: 46px; border: 1px dashed var(--ink-light); border-radius: 4px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--ink-light);
}
.gm-row {
  display: flex; justify-content: space-between; gap: 12px; background: var(--paper);
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 15px; cursor: pointer;
}
.gm-row .gm-val { color: var(--ink-light); text-align: right; word-break: break-all; max-width: 65%; }

/* 群聊气泡上的发送者昵称 */
.msg-sender { font-size: 12px; color: var(--ink-light); margin: 0 8px 2px; }
.msg-row .msg-col { display: flex; flex-direction: column; max-width: 75%; }
.msg-row.mine .msg-col { align-items: flex-end; }
.msg-row .msg-col .bubble { margin: 0; max-width: 100%; } /* 气泡在 msg-col 内不再二次限宽（修群聊对方消息两三字换行） */

/* 系统消息（群内通知） */
.system-msg { text-align: center; font-size: 12px; color: var(--ink-light); margin: 10px 0; }

/* ---------- 位置 / 名片 / 红包卡片 ---------- */
.bubble.loc-card, .bubble.card-card, .bubble.rp-card { cursor: pointer; min-width: 210px; padding: 10px 12px; }
.loc-name { font-size: 16px; }
.loc-addr { font-size: 12px; color: var(--ink-light); margin-top: 3px; }
.loc-map-wrap, #loc-view-map { position: relative; width: 220px; height: 110px; margin: 6px -2px -2px; border-radius: 4px; overflow: hidden; background: #e3ded1; }
#loc-view-map { width: 100%; height: 100%; margin: 0; border-radius: 0; }
.loc-map-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.loc-map-pin {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%);
  width: 28px; height: 28px; fill: var(--primary, #a63a2b);
  pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}
.loc-map-pin circle { fill: var(--paper, #f6f1e5); }
/* 位置查看页：AMap.Marker 的 SVG 内容（anchor bottom-center，针随地图移动） */
.loc-view-pin {
  display: block; width: 36px; height: 36px; fill: var(--primary, #a63a2b);
  pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}
.loc-view-pin circle { fill: var(--paper, #f6f1e5); }
.card-row { display: flex; align-items: center; gap: 10px; }
.card-row .avatar { width: 40px; height: 40px; }
.card-name { font-size: 16px; }
.card-sub { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
.card-tag { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; font-size: 11px; color: var(--ink-light); }
.rp-card { background: var(--ink-head) !important; color: var(--head-text); border: none !important; }
.rp-top { display: flex; align-items: center; gap: 10px; }
.rp-icon {
  width: 38px; height: 46px; border-radius: 4px; background: var(--head-text); color: var(--ink-head);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.rp-bless { font-size: 15px; }
.rp-tag { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(233,227,210,.2); font-size: 11px; opacity: .75; }
.rp-card.done { opacity: .55; }

/* ---------- 灵石钱包 ---------- */
#wallet-body { flex: 1; overflow-y: auto; background: var(--paper); }
#wallet-balance-box { text-align: center; padding: 36px 0 24px; border-bottom: 1px solid var(--line); }
#wallet-balance { font-size: 44px; color: var(--ink); }
#wallet-balance-label { font-size: 13px; color: var(--ink-light); margin: 6px 0 16px; }
#wallet-balance-box .btn-primary { width: 70%; }
#wallet-logs { padding: 0 14px 30px; }
.wallet-log { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wallet-log .wl-change.plus { color: var(--ink); font-weight: bold; }
.wallet-log .wl-change.minus { color: var(--ink-light); }
.wl-remark { color: var(--ink); }
.wl-time { font-size: 11px; color: var(--ink-light); }

/* 会话免打扰：灰点代替红数字 */
.badge.muted { background: var(--ink-light); }

/* ---------- 私密聊天 ---------- */
#btn-lock.sealed { color: var(--head-text); background: rgba(233,227,210,.18); border-radius: 4px; }
.ci-btn {
  display: block; width: 92%; margin: 10px auto; height: 42px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--bubble-peer);
  color: var(--ink); font-size: 15px; font-family: inherit; cursor: pointer;
}
.ci-btn.danger { color: var(--danger); }
#chat-info-body { flex: 1; overflow-y: auto; background: var(--paper-deep); }
#ci-peer { display: flex; align-items: center; background: var(--paper); padding: 20px 16px; border-bottom: 1px solid var(--line); }
#ci-peer .avatar { width: 54px; height: 54px; font-size: 22px; }
#ci-peer #me-info { margin-left: 12px; }
#ci-seal-panel { padding: 8px 0 20px; }

/* 伪装消息编辑器 */
#fake-edit-body { flex: 1; overflow-y: auto; padding: 12px; background: var(--paper); }
.fake-tip { font-size: 12px; color: var(--ink-light); margin-bottom: 10px; }
.fake-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.fake-row select {
  width: 64px; height: 38px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bubble-peer); font-family: inherit; font-size: 14px; color: var(--ink);
}
.fake-row input[type="text"] {
  flex: 1; height: 38px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bubble-peer); padding: 0 8px; font-family: inherit; font-size: 14px; color: var(--ink);
}
.fake-row input[type="datetime-local"] {
  width: 168px; height: 38px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bubble-peer); padding: 0 4px; font-family: inherit; font-size: 12px; color: var(--ink);
}
.fake-row .fake-del {
  width: 30px; height: 38px; border: none; background: none; color: var(--ink-light);
  font-size: 18px; cursor: pointer; flex-shrink: 0;
}
#btn-fake-save { width: 100%; margin-top: 10px; }

/* ---------- 音视频通话 ---------- */
#view-call {
  position: fixed; inset: 0; z-index: 80; background: #181613;
  display: flex; flex-direction: column; max-width: 750px; margin: 0 auto;
}
#call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #181613; }
#call-local {
  position: absolute; top: 16px; right: 16px; width: 110px; height: 150px;
  object-fit: cover; border-radius: 6px; border: 1px solid rgba(233,227,210,.3); background: #000; z-index: 2;
  touch-action: none; cursor: pointer; transition: all .25s ease;
}
#call-local.swap-main { top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; border: none; border-radius: 0; z-index: 1; }
#call-remote.swap-pip { position: absolute; top: 16px; right: 16px; width: 110px; height: 150px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(233,227,210,.3); background: #000; z-index: 2; }
#call-info { position: relative; z-index: 3; text-align: center; padding-top: 90px; color: #e9e3d2; text-shadow: 0 1px 4px rgba(0,0,0,.6); transition: opacity .3s ease; }
#call-name { font-size: 24px; letter-spacing: 4px; }
#call-status { font-size: 14px; opacity: .8; margin-top: 10px; }
#call-actions {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: center; gap: 18px; padding: 30px 0 40px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  transition: opacity .3s ease;
}
#call-avatar { transition: opacity .3s ease; }
#view-call.ui-hidden #call-info,
#view-call.ui-hidden #call-actions,
#view-call.ui-hidden #call-avatar {
  opacity: 0;
  pointer-events: none;
}
.call-btn {
  width: 62px; height: 62px; border-radius: 50%; border: 1px solid rgba(233,227,210,.4);
  background: rgba(58,53,45,.6); color: #e9e3d2; font-size: 13px; font-family: inherit; cursor: pointer;
}
.call-btn.accept { background: #3f6b3a; border-color: #3f6b3a; }
.call-btn.reject { background: #7a3a30; border-color: #7a3a30; }
.call-btn.on { background: #e9e3d2; color: #232019; }
#call-avatar {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding-bottom: 120px;
}
#call-avatar-glyph {
  width: 110px; height: 110px; border-radius: 8px; background: #3a352d; color: #e9e3d2;
  display: flex; align-items: center; justify-content: center; font-size: 46px;
}

/* ---------- 朋友圈 / 文章 ---------- */
.sub-header {
  background: var(--ink-head); color: var(--head-text); height: 48px; line-height: 48px;
  padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 18px; letter-spacing: 2px; flex-shrink: 0; border-bottom: 1px solid #000;
}
#moment-list, #article-list, #group-list, #apply-list { flex: 1; overflow-y: auto; background: var(--paper); }
.back-btn.publish { width: auto; font-size: 15px; letter-spacing: 2px; }
#article-tabs { display: flex; background: var(--paper); border-bottom: 1px solid var(--line); flex-shrink: 0; }
#article-tabs button { flex: 1; border: none; background: none; padding: 10px; font-size: 15px; font-family: inherit; color: var(--ink-light); cursor: pointer; }
#article-tabs button.active { color: var(--ink); border-bottom: 2px solid var(--ink); }

.moment-item { background: var(--paper); padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.moment-main { flex: 1; min-width: 0; }
.moment-author { font-size: 15px; color: #4a5a75; }
.moment-text { font-size: 15px; margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.moment-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 0; max-width: 300px; }
.moment-media img { width: 100%; height: 96px; object-fit: cover; border-radius: 3px; cursor: zoom-in; }
.moment-media video { width: 100%; max-height: 200px; border-radius: 3px; background: #000; }
.moment-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.moment-time { font-size: 12px; color: var(--ink-light); }
.moment-ops { display: flex; gap: 12px; }
.moment-ops button { border: 1px solid var(--line); background: var(--bubble-peer); border-radius: 4px; padding: 3px 10px; font-size: 12px; font-family: inherit; color: var(--ink); cursor: pointer; }
.moment-likes { font-size: 13px; color: #4a5a75; background: var(--paper-deep); padding: 5px 8px; border-radius: 3px; margin-top: 6px; }
.moment-comments { background: var(--paper-deep); border-radius: 3px; margin-top: 4px; padding: 4px 8px; }
.moment-comment { font-size: 13px; padding: 3px 0; }
.moment-comment .mc-name { color: #4a5a75; }

.article-item { background: var(--paper); padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; }
.article-item:active { background: var(--paper-deep); }
.article-title { font-size: 16px; }
.article-digest { font-size: 13px; color: var(--ink-light); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta { font-size: 11px; color: var(--ink-light); margin-top: 6px; }
.article-body { padding: 18px 16px; background: var(--paper); }
.article-h1 { font-size: 21px; margin-bottom: 8px; }
.article-info { font-size: 12px; color: var(--ink-light); margin-bottom: 16px; }
.article-body p { font-size: 16px; line-height: 1.8; margin-bottom: 12px; }
.article-body img { max-width: 100%; border-radius: 4px; }
.article-body video { max-width: 100%; border-radius: 4px; background: #000; }
.article-actions { display: flex; gap: 10px; padding: 14px; background: var(--paper); border-top: 1px solid var(--line); }
.article-actions button { flex: 1; }
.comment-row { padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 14px; background: var(--paper); }
.comment-row .mc-name { color: #4a5a75; margin-right: 6px; }

.editor-body { flex: 1; overflow-y: auto; padding: 14px; background: var(--paper); }
.editor-body input[type="text"], .editor-body textarea {
  width: 100%; border: none; border-bottom: 1px solid var(--line); background: transparent;
  font-size: 16px; font-family: inherit; color: var(--ink); outline: none; padding: 8px 2px; margin-bottom: 10px;
}
.editor-row { display: flex; gap: 8px; margin: 10px 0; }
.editor-row select { height: 38px; border: 1px solid var(--line); border-radius: 4px; background: var(--bubble-peer); font-family: inherit; padding: 0 8px; }
.ci-btn.half, .btn-primary.half { flex: 1; width: auto; margin: 0; }
#mc-media, #ae-blocks { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mc-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.ae-block { width: 100%; margin-bottom: 8px; }

/* ============ 附件管理页 ============ */
#view-attach { display: flex; flex-direction: column; position: relative; }
#attach-summary { padding: 10px 14px 6px; border-bottom: 1px solid var(--line); background: var(--paper); }
#attach-size { font-weight: 600; font-size: 15px; }
#attach-summary .attach-tip { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
#attach-clean-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 6px; }
#attach-clean-chips .chips {
  border: 1px solid var(--line); background: var(--bubble-peer); color: var(--ink);
  border-radius: 14px; padding: 3px 12px; font-size: 12px; cursor: pointer; line-height: 1.5;
}
#attach-clean-chips .chips:active { opacity: .7; }
#attach-list { flex: 1; overflow-y: auto; padding: 6px 0 76px; }
#attach-list .att-group { color: var(--ink-light); font-size: 12px; padding: 10px 14px 2px; }
.att-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer;
}
.att-row:active { background: var(--bubble-peer); }
.att-row .att-check {
  width: 20px; height: 20px; flex: none; border: 1.5px solid var(--line); border-radius: 50%;
  display: none; align-items: center; justify-content: center; color: #fff; font-size: 13px;
}
body.att-manage .att-check { display: inline-flex; }
.att-row.sel .att-check { background: var(--primary, #a63a2b); border-color: var(--primary, #a63a2b); }
.att-row.sel { background: var(--bubble-peer); }
.att-ico {
  width: 40px; height: 40px; flex: none; border-radius: 6px; object-fit: cover;
  background: var(--bubble-peer); display: flex; align-items: center; justify-content: center;
  font-size: 20px; overflow: hidden; color: var(--ink-light);
}
.att-ico video { width: 100%; height: 100%; object-fit: cover; }
.att-meta { flex: 1; min-width: 0; }
.att-name { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-sub { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
#attach-empty { padding: 48px 20px; text-align: center; color: var(--ink-light); font-size: 13px; }
#attach-selbar {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--paper);
  border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; z-index: 5;
}
#attach-selbar.hidden { display: none; }
#attach-selbar button {
  border: none; background: none; color: var(--primary, #a63a2b); font-size: 14px; cursor: pointer; padding: 4px 6px;
}
#attach-selbar button:disabled { color: var(--ink-light); opacity: .5; }
#attach-selbar #attach-sel-count { flex: 1; text-align: center; font-size: 13px; color: var(--ink); }
.att-video-mask {
  position: fixed; inset: 0; z-index: 999; background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center;
}
.att-video-mask video { max-width: 100%; max-height: 100%; }
.att-video-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, .2); color: #fff; font-size: 16px; cursor: pointer;
}
.att-row img.att-ico-img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.ae-block textarea { border: 1px solid var(--line) !important; border-radius: 4px; }
.ae-block .ae-del { float: right; border: none; background: none; color: var(--ink-light); cursor: pointer; font-size: 16px; }
