/* 一家人 · 聊天室 v2
   深色底 + 蓝色主色，移动端优先；≥900px 时变成左侧会话栏 + 右侧聊天区。 */

:root {
  color-scheme: dark;
  --bg: #080c18;
  --bg-2: #0b1222;
  --panel: #111a30;
  --panel-2: #18223c;
  --panel-3: #1e2a48;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eef2ff;
  --dim: #94a1c4;
  --dim-2: #6b789b;
  --accent: #5b8cff;
  --accent-2: #7aa2ff;
  --bot: #ffb64d;
  --ok: #35d39a;
  --bad: #ff6b8a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-w: 300px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 70% at 8% -10%, rgba(91, 140, 255, 0.16) 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 0%, rgba(255, 182, 77, 0.08) 0%, transparent 60%),
    var(--bg);
}

::selection { background: rgba(91, 140, 255, 0.38); }

.hidden { display: none !important; }
.muted { color: var(--dim); }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 12px 0 0; text-align: center; }
.screen { height: 100dvh; display: flex; flex-direction: column; }

button { font: inherit; color: inherit; cursor: pointer; }

/* ───────────────── 登录 ───────────────── */
.login {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px);
  overflow: hidden;
}
.login-glow {
  position: absolute;
  width: 460px; height: 460px;
  top: -170px; left: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 50%, rgba(91, 140, 255, 0.30), transparent 62%),
    radial-gradient(circle at 62% 60%, rgba(255, 182, 77, 0.16), transparent 55%);
  filter: blur(18px);
  pointer-events: none;
}
.login-box { position: relative; width: 100%; max-width: 330px; text-align: center; }
.login-logo {
  width: 92px; height: 92px; margin: 0 auto;
  border-radius: 26px;
  padding: 3px;
  background: linear-gradient(160deg, rgba(122, 162, 255, 0.75), rgba(255, 182, 77, 0.35));
  box-shadow: 0 14px 40px rgba(20, 40, 90, 0.55);
}
.login-logo img { width: 86px; height: 86px; border-radius: 23px; display: block; }
.login-box h1 { font-size: 25px; margin: 20px 0 6px; letter-spacing: 3px; font-weight: 650; }
.login-sub { margin: 0; color: var(--dim); font-size: 13.5px; letter-spacing: 0.6px; }
.login-box form { margin-top: 26px; }
.login-box input {
  width: 100%; padding: 15px 16px;
  background: rgba(24, 34, 60, 0.82);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  font-size: 19px; text-align: center; letter-spacing: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.login-box input::placeholder { color: var(--dim-2); letter-spacing: 1px; font-family: inherit; font-size: 15px; }
.login-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.16); }
.login-box button {
  width: 100%; margin-top: 13px; padding: 15px;
  background: linear-gradient(160deg, #7aa2ff, #4a74f0);
  color: #fff; border: none; border-radius: 16px;
  font-size: 16px; font-weight: 650; letter-spacing: 1px;
  box-shadow: 0 10px 26px rgba(51, 90, 200, 0.35);
  transition: transform 0.12s, filter 0.12s, opacity 0.12s;
}
.login-box button:active { transform: scale(0.985); filter: brightness(0.92); }
.login-box button:disabled { opacity: 0.6; }
.login-foot { margin: 26px 0 0; font-size: 12px; color: var(--dim-2); letter-spacing: 0.3px; }

/* ───────────────── 框架 ───────────────── */
.app {
  position: fixed; inset: 0;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* ───────────────── 侧栏 ───────────────── */
.sidebar {
  display: flex; flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #0d1526 0%, #0a1120 100%);
  border-right: 1px solid var(--line);
  padding-top: var(--safe-top);
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon { width: 34px; height: 34px; border-radius: 11px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-size: 15.5px; font-weight: 650; letter-spacing: 0.6px; }
.brand-sub { font-size: 11px; color: var(--dim-2); letter-spacing: 0.4px; }

.conv-list {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: none;
}
.conv-list::-webkit-scrollbar { width: 0; }

.conv {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 9px 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  text-align: left;
  transition: background 0.14s, border-color 0.14s;
}
.conv:hover { background: rgba(255, 255, 255, 0.035); }
.conv.active { background: rgba(91, 140, 255, 0.13); border-color: rgba(91, 140, 255, 0.22); }
.conv-main { flex: 1 1 auto; min-width: 0; }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-top b { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { margin-left: auto; flex: none; font-size: 11px; color: var(--dim-2); font-variant-numeric: tabular-nums; }
.conv-bottom { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.conv-preview {
  flex: 1 1 auto; min-width: 0;
  font-size: 12.5px; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 650; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.side-foot { flex: none; padding: 8px 10px calc(var(--safe-bottom) + 10px); border-top: 1px solid var(--line); }
.me {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border: none; border-radius: 14px; background: transparent;
  transition: background 0.14s;
}
.me:hover { background: rgba(255, 255, 255, 0.04); }
.me-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.3; min-width: 0; }
.me-text b { font-size: 13.5px; font-weight: 600; }
.me-text small { font-size: 11px; color: var(--dim-2); }
.me-chev { margin-left: auto; color: var(--dim-2); }

/* ───────────────── 聊天区 ───────────────── */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }

.chat-head {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-top) + 9px) 12px 9px;
  background: rgba(8, 12, 24, 0.72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.chat-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.chat-id-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.chat-title { font-size: 16px; font-weight: 650; letter-spacing: 0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--dim-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim-2); transition: background 0.2s, box-shadow 0.2s; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(53, 211, 154, 0.7); }
.dot.off { background: var(--bad); }

.icon-btn {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent; border: none; border-radius: 12px;
  color: var(--dim);
  transition: background 0.14s, color 0.14s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.icon-btn:active { background: rgba(255, 255, 255, 0.08); }

/* 头像 */
.avatar {
  --size: 38px;
  flex: none;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: calc(var(--size) * 0.42);
  font-weight: 650;
  color: #fff;
  letter-spacing: 0;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { --size: 32px; }
.avatar.lg { --size: 54px; border-radius: 18px; }

/* 消息 */
.messages-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px 12px;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.messages::-webkit-scrollbar { width: 0; }

.day-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 4px 2px;
  color: var(--dim-2); font-size: 11px; letter-spacing: 0.5px;
}
.day-sep::before, .day-sep::after { content: ''; height: 1px; flex: 1; background: var(--line); }

.group { display: flex; gap: 9px; margin-top: 15px; align-items: flex-start; animation: floatIn 0.18s var(--ease); }
.group.mine { flex-direction: row-reverse; }
.g-avatar { flex: none; width: 30px; padding-top: 1px; cursor: pointer; }
.g-avatar .avatar { --size: 30px; }
.g-avatar:active { transform: scale(0.92); }
.g-avatar.poke-pop { animation: pokeWiggle 0.62s var(--ease); }
#chatAvatar.poked { animation: pokeWiggle 0.7s var(--ease); }
@keyframes pokeWiggle {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-4px) rotate(-7deg); }
  40% { transform: translateX(4px) rotate(7deg); }
  60% { transform: translateX(-3px) rotate(-4deg); }
  80% { transform: translateX(2px) rotate(3deg); }
}
/* 戳一戳是系统事件，不套气泡 */
.poke-line {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  margin: 7px 0;
  color: var(--dim-2);
  font-size: 11.5px;
  line-height: 1.35;
  text-align: center;
  animation: floatIn 0.2s var(--ease);
}
.poke-line b { color: var(--dim); font-weight: 600; }
.poke-icon { font-size: 12px; opacity: 0.85; }
.g-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: calc(100% - 42px); }
.group.mine .g-body { align-items: flex-end; max-width: 82%; }
.g-head { display: flex; align-items: baseline; gap: 7px; margin: 0 2px 5px; }
.g-name { font-size: 12.5px; font-weight: 600; }
.g-time { font-size: 10.5px; color: var(--dim-2); font-variant-numeric: tabular-nums; }

.bubble {
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  user-select: text;
  -webkit-touch-callout: none;
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.14);
}
.bubble + .bubble { margin-top: 3px; }
.group.theirs .bubble.g-first { border-top-left-radius: 7px; }
.group.theirs .bubble.g-last { border-bottom-left-radius: 7px; }
.group.mine .bubble {
  background: linear-gradient(160deg, #6f98ff 0%, #4a74f0 100%);
  border-color: rgba(255, 255, 255, 0.10);
  color: #fff;
}
.group.mine .bubble.g-first { border-top-right-radius: 7px; }
.group.mine .bubble.g-last { border-bottom-right-radius: 7px; }
.bubble.pending { opacity: 0.55; }
.bubble.failed {
  background: rgba(255, 107, 138, 0.10) !important;
  border-color: rgba(255, 107, 138, 0.45) !important;
  color: #ffd5de !important;
}
/* 表情单独成图：不套文字气泡 */
.bubble.sticker,
.group.mine .bubble.sticker {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 14px;
}
.bubble.sticker .sticker-img {
  display: block;
  width: 132px;
  height: 132px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}
.bubble.sticker.failed {
  background: transparent !important;
  box-shadow: 0 0 0 2px rgba(255, 107, 138, 0.65);
}
.bubble.sticker.pending { opacity: 0.55; }
/* 机器人画的图 / 本地收藏：图片气泡，点开看大图 */
.bubble.image,
.group.mine .bubble.image {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 14px;
}
.bubble.image .image-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(230px, 64vw);
  max-height: 280px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  cursor: zoom-in;
}
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 12, 0.88);
  backdrop-filter: blur(6px);
}
.image-viewer img {
  max-width: 94vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.image-viewer-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 24, 36, 0.7);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.g-meta {
  display: flex; align-items: center; gap: 5px;
  margin: 4px 3px 0;
  font-size: 10.5px; color: var(--dim-2);
  font-variant-numeric: tabular-nums;
}
.g-meta .warn { color: var(--bad); }

/* 空状态 */
.empty {
  margin: auto;
  text-align: center;
  padding: 30px 20px 60px;
  color: var(--dim);
  animation: floatIn 0.25s var(--ease);
}
.empty img { width: 74px; height: 74px; border-radius: 22px; opacity: 0.92; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); }
.empty h2 { font-size: 15px; margin: 16px 0 6px; font-weight: 600; color: var(--text); }
.empty p { margin: 0; font-size: 12.5px; color: var(--dim-2); }

@keyframes floatIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* 回到底部 */
.jump {
  position: absolute; left: 50%; bottom: 12px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 5px;
  padding: 7px 13px;
  background: rgba(30, 42, 72, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text); font-size: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  animation: floatIn 0.18s var(--ease);
  z-index: 5;
}

/* ───────────────── 输入 ───────────────── */
.composer {
  position: relative;
  z-index: 10;
  flex: none;
  padding: 6px 12px calc(var(--safe-bottom) + 8px);
  background: linear-gradient(180deg, rgba(8, 12, 24, 0) 0%, rgba(8, 12, 24, 0.9) 32%, var(--bg) 100%);
}
.composer-box {
  display: flex; align-items: flex-end; gap: 6px;
  max-width: 880px; margin: 0 auto;
  padding: 6px 6px 6px 14px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.composer-box:focus-within { border-color: rgba(91, 140, 255, 0.55); box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.11); }
.composer textarea {
  flex: 1 1 auto;
  resize: none;
  max-height: 132px;
  padding: 7px 0 8px;
  background: transparent;
  color: var(--text);
  border: none;
  font: inherit;
  font-size: 16px; /* 小于 16px iOS 会放大页面 */
  line-height: 1.45;
  outline: none;
}
.composer textarea::placeholder { color: var(--dim-2); }
.sticker-btn {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.14s, background 0.14s, transform 0.12s;
}
.sticker-btn:hover, .sticker-btn[aria-expanded="true"] { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.sticker-btn:active { transform: scale(0.9); }
/* 文件选择框：不能 display:none —— 有些 iOS / PWA 里点 label 触发不了隐藏的 input */
.file-hidden {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
/* @：只有群里出现；点开是成员选择，不是输入框里裸敲 */
.mention-btn {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--dim);
  font-size: 19px;
  font-weight: 650;
  line-height: 1;
  transition: color 0.14s, background 0.14s, transform 0.12s;
}
.mention-btn[hidden] { display: none; }
.mention-btn:hover, .mention-btn[aria-expanded="true"] { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.mention-btn:active { transform: scale(0.9); }
.send-btn {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: linear-gradient(160deg, #7aa2ff, #4a74f0);
  color: #fff;
  transition: transform 0.12s, opacity 0.12s, background 0.12s;
  box-shadow: 0 6px 16px rgba(51, 90, 200, 0.32);
}
.send-btn:active { transform: scale(0.92); }
.send-btn:disabled {
  background: var(--panel-3); color: var(--dim-2);
  box-shadow: none; opacity: 0.9;
}
.composer-meta {
  max-width: 880px; margin: 5px auto 0;
  display: flex; justify-content: space-between; gap: 10px;
  padding: 0 6px;
  font-size: 10.5px; color: var(--dim-2); min-height: 14px;
}
.kbd-hint { display: none; }
@media (hover: hover) and (pointer: fine) { .kbd-hint { display: inline; } }

/* 提到谁：和表情面板同一条底边，同一时刻只开一个 */
.mention-panel {
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc(100% - 2px);
  z-index: 20;
  max-width: 880px;
  margin: 0 auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: min(44vh, 340px);
  background: rgba(18, 26, 46, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: floatIn 0.16s var(--ease);
}
.mention-top { display: flex; align-items: center; gap: 6px; padding: 0 2px 1px; }
.mention-top b { flex: 1 1 auto; font-size: 12px; color: var(--dim); font-weight: 600; }
.mention-list { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; overscroll-behavior: contain; }
.mention-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  text-align: left;
}
.mention-item:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--line); }
.mention-item:active { transform: scale(0.985); }
.mention-item .mention-name { font-size: 14px; font-weight: 600; }
.mention-item .mention-sub { margin-left: auto; font-size: 10.5px; color: var(--dim-2); }
.mention-item.bot .mention-sub { color: #ffc46b; }
.mention-empty { margin: 8px 6px; font-size: 11.5px; color: var(--dim-2); text-align: center; }

/* 聊天里的 @ 名字：只高亮认得的成员，不把普通 @ 当成 mention */
.bubble .mention {
  padding: 0 2px;
  border-radius: 4px;
  color: #bcd1ff;
  background: rgba(91, 140, 255, 0.20);
}
.group.mine .bubble .mention { color: #fff; background: rgba(255, 255, 255, 0.20); }

/* 表情面板：贴在输入框上方，不挤压消息区 */
.sticker-panel {
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc(100% - 2px);
  z-index: 20;
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: min(52vh, 430px);
  background: rgba(18, 26, 46, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: floatIn 0.16s var(--ease);
}
.sticker-top { display: flex; align-items: center; gap: 6px; }
.sticker-tabs {
  flex: 1 1 auto;
  display: flex; gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.sticker-tabs::-webkit-scrollbar { display: none; }
.sticker-tab {
  flex: none;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
  font-size: 11.5px;
  white-space: nowrap;
}
.sticker-tab.active {
  color: #fff;
  background: rgba(91, 140, 255, 0.22);
  border-color: rgba(91, 140, 255, 0.4);
}
.sticker-close {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 6px;
  overflow-y: auto;
  padding: 2px;
  overscroll-behavior: contain;
}
.sticker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 3px 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--dim-2);
}
.sticker-item:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--line); }
.sticker-item:active { transform: scale(0.94); }
.sticker-item img {
  width: 54px; height: 54px;
  object-fit: contain;
  display: block;
}
.sticker-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9.5px;
  line-height: 1.2;
}
.sticker-empty {
  grid-column: 1 / -1;
  margin: 24px 0;
  text-align: center;
  font-size: 12px;
  color: var(--dim-2);
}
.sticker-foot {
  flex: none;
  padding: 0 3px;
  font-size: 9.5px;
  line-height: 1.35;
  color: var(--dim-2);
  opacity: 0.8;
}
@media (max-width: 420px) {
  .sticker-panel { left: 8px; right: 8px; max-height: 48vh; }
  .mention-panel { left: 8px; right: 8px; max-height: 46vh; }
  .sticker-item img { width: 50px; height: 50px; }
}

.install-hint {
  max-width: 880px; margin: 0 auto 7px;
  font-size: 11.5px; color: var(--dim); text-align: center;
  padding: 5px 10px;
  background: rgba(91, 140, 255, 0.08);
  border: 1px solid rgba(91, 140, 255, 0.18);
  border-radius: 12px;
}
.install-hint b { color: var(--text); font-weight: 600; }

/* ───────────────── 遮罩 / 抽屉 ───────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 25;
  background: rgba(3, 6, 14, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ───────────────── 我的 ───────────────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 14, 0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet {
  position: relative;
  width: 100%; max-width: 430px;
  background: linear-gradient(180deg, #16203a, #111a30);
  border: 1px solid var(--line-strong);
  border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(var(--safe-bottom) + 18px);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.45);
  animation: sheetUp 0.24s var(--ease);
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-grab { width: 38px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 4px auto 12px; }
.profile { display: flex; align-items: center; gap: 13px; padding: 4px 2px 16px; }
.profile-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.profile-text b { font-size: 17px; font-weight: 650; }
.profile-text small { font-size: 12px; color: var(--dim-2); }
.sheet-rows { border-top: 1px solid var(--line); margin-bottom: 16px; }
.sheet-rows .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px; color: var(--dim);
}
.sheet-rows .row b { color: var(--text); font-weight: 550; }
.btn {
  width: 100%; padding: 13px;
  border-radius: 15px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600;
  background: var(--panel-2);
  transition: filter 0.14s, background 0.14s;
}
.btn + .btn { margin-top: 9px; }
.btn:active { filter: brightness(0.9); }
.btn.danger { background: rgba(255, 107, 138, 0.11); border-color: rgba(255, 107, 138, 0.30); color: #ff97ab; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--dim); }

/* ───────────────── 提示 ───────────────── */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--safe-bottom) + 92px);
  transform: translateX(-50%);
  background: rgba(32, 44, 74, 0.97);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 9px 16px; border-radius: 999px;
  font-size: 13px; white-space: nowrap;
  pointer-events: none;
  animation: toastIn 0.18s ease-out;
  z-index: 70;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ───────────────── 新版本提示条 ───────────────── */
.update-bar {
  position: fixed;
  left: 50%; top: calc(var(--safe-top) + 10px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(32, 44, 74, 0.98);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 8px 10px 8px 16px; border-radius: 999px;
  font-size: 13px; white-space: nowrap;
  z-index: 90;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.2s ease-out;
}
.update-bar button {
  border: 0; cursor: pointer;
  background: var(--accent); color: #08101f;
  font: inherit; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
}
.update-bar[hidden] { display: none; }

/* ───────────────── 桌面 / 移动 ───────────────── */
.only-mobile { display: none; }

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: min(84vw, var(--sidebar-w));
    z-index: 30;
    transform: translateX(-102%);
    transition: transform 0.24s var(--ease);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.4);
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: grid; }
  .messages { padding: 8px 12px 10px; }
  .g-body { max-width: calc(100% - 40px); }
}

@media (min-width: 900px) {
  .chat-head { padding-left: 18px; padding-right: 18px; }
  .composer { padding-bottom: calc(var(--safe-bottom) + 14px); }
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 24px; padding-bottom: 18px; }
  .sheet-grab { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}