/* ================= 大肥鱼聊天室 · 样式 ================= */
:root {
  --accent: #22d3ee;
  --accent-2: #4f8cff;
  --accent-ink: #06222c;

  --bg: #eef4f8;
  --bg-glow-1: rgba(34, 211, 238, .22);
  --bg-glow-2: rgba(79, 140, 255, .14);
  --panel: #ffffff;
  --panel-2: #f6fafc;
  --panel-3: #e9f1f6;
  --text: #0f2230;
  --text-2: #607688;
  --text-3: #8fa3b3;
  --line: rgba(15, 34, 48, .08);
  --line-strong: rgba(15, 34, 48, .14);

  --bubble-me: linear-gradient(135deg, var(--accent), var(--accent-2));
  --bubble-me-text: #ffffff;
  --bubble-other: #ffffff;

  --shadow-sm: 0 2px 8px rgba(13, 34, 51, .06);
  --shadow-md: 0 12px 32px rgba(13, 34, 51, .12);
  --shadow-lg: 0 24px 64px rgba(13, 34, 51, .18);

  --radius: 18px;
  --radius-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --head-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #07131c;
  --bg-glow-1: rgba(34, 211, 238, .16);
  --bg-glow-2: rgba(79, 140, 255, .1);
  --panel: #0e1f2b;
  --panel-2: #122634;
  --panel-3: #18313f;
  --text: #e8f3f8;
  --text-2: #93a9b8;
  --text-3: #6b8296;
  --line: rgba(232, 243, 248, .09);
  --line-strong: rgba(232, 243, 248, .16);
  --bubble-other: #162c3a;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, .42);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
}

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

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 8% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(760px 480px at 96% 8%, var(--bg-glow-2), transparent 62%),
    var(--bg);
  overscroll-behavior: none;
}

body { overflow: hidden; }

button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea { font-family: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; }

/* ================= 骨架 ================= */
.app {
  display: flex;
  height: 100dvh;
  height: 100vh;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0;
}

@media (min-width: 1180px) {
  .app { padding: 18px 20px; gap: 18px; }
  .sidebar, .chat {
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--line);
    overflow: hidden;
  }
}

/* ================= 侧栏 ================= */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 340px;
  flex: 0 0 340px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
  z-index: 3;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
  min-height: var(--head-h);
}

.avatar-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--panel-3);
  overflow: visible;
  transition: transform .16s ease;
}
.avatar-btn:active { transform: scale(.94); }
.avatar-btn img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--panel-3);
}
.avatar-btn.big { width: 54px; height: 54px; }

.status-dot {
  position: absolute; right: 1px; bottom: 1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #3ddc97;
  border: 2px solid var(--panel);
}

.side-title { flex: 1; min-width: 0; }
.side-title h1 {
  font-size: 17px; font-weight: 700; letter-spacing: .2px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.side-title p {
  font-size: 11.5px; color: var(--text-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 12px;
  color: var(--text-2);
  transition: background .16s, color .16s, transform .12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }

/* 搜索 */
.search-wrap {
  position: relative;
  margin: 2px 14px 10px;
}
.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 34px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--panel-2);
  font-size: 13.5px;
  outline: none;
  transition: border-color .18s, background .18s;
}
[data-theme="dark"] .search-wrap input { background: var(--panel-2); }
.search-wrap input:focus { border-color: var(--accent); background: var(--panel); }
.search-wrap input::placeholder { color: var(--text-3); }
.search-ico {
  position: absolute; left: 11px; top: 10px;
  width: 18px; height: 18px; color: var(--text-3); stroke-width: 2;
}
.clear-btn {
  position: absolute; right: 6px; top: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  color: var(--text-3); font-size: 18px; line-height: 1;
}
.clear-btn:hover { background: var(--panel-3); color: var(--text); }

/* 视图容器 */
.views { position: relative; flex: 1; min-height: 0; }
.view {
  position: absolute; inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 8px 12px;
  scrollbar-width: thin;
}
.view::-webkit-scrollbar { width: 6px; }
.view::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }

/* 会话条目 */
.conv-list { display: flex; flex-direction: column; gap: 2px; }

.conv {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.conv:hover { background: var(--panel-2); }
.conv.active { background: var(--panel-3); }
[data-theme="dark"] .conv.active { background: var(--panel-3); }

.conv .ava {
  position: relative;
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel-3);
  box-shadow: var(--shadow-sm);
}
.conv .ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.conv .ava .group-grid {
  display: grid; grid-template-columns: 1fr 1fr; width: 100%; height: 100%;
}
.conv .ava .group-grid img { width: 100%; height: 100%; }

.conv .meta { flex: 1; min-width: 0; }
.conv .top { display: flex; align-items: center; gap: 6px; }
.conv .name {
  font-size: 14.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.conv .time { font-size: 11px; color: var(--text-3); flex: 0 0 auto; }
.conv .bottom { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.conv .preview {
  font-size: 12.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.conv .badge, .tab .badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: #ff5d5d;
  color: #fff; font-size: 11px; font-style: normal;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.conv .pin-ico { width: 13px; height: 13px; color: var(--text-3); stroke-width: 2; flex: 0 0 auto; }
.conv .mute-ico { width: 13px; height: 13px; color: var(--text-3); stroke-width: 2; }

.conv.compact .ava { width: 40px; height: 40px; flex-basis: 40px; border-radius: 14px; }
.conv.compact .name { font-size: 14px; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 10px 8px;
  font-size: 12px; font-weight: 600; color: var(--text-3);
  letter-spacing: .4px;
}
.section-title .count { font-weight: 500; }
.text-btn { font-size: 12.5px; color: var(--accent-2); font-weight: 600; padding: 2px 4px; }
.text-btn:hover { opacity: .8; }

.empty-tip {
  padding: 26px 16px; text-align: center;
  font-size: 12.5px; color: var(--text-3); line-height: 1.7;
}

/* 我的 */
.profile-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 16px;
  margin: 12px 8px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(34,211,238,.16), rgba(79,140,255,.1));
  border: 1px solid var(--line);
}
.profile-card > div { flex: 1; min-width: 0; }
.profile-card h3 { font-size: 16px; }
.profile-card p { font-size: 12.5px; color: var(--text-2); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ghost-btn {
  padding: 6px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line-strong);
  font-size: 12.5px; font-weight: 600;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent-2); }

.group-card {
  margin: 10px 8px;
  padding: 6px 4px 10px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.group-title {
  padding: 12px 14px 6px;
  font-size: 12px; font-weight: 700; color: var(--text-3);
  letter-spacing: .4px;
  display: flex; align-items: center; gap: 8px;
}
.tag {
  font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 20px;
  background: rgba(255, 93, 93, .12); color: #ff5d5d;
}
.tag.ok { background: rgba(61, 220, 151, .14); color: #23a872; }

.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  font-size: 13.5px;
}
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 12px 14px;
  font-size: 13.5px; text-align: left;
  border-radius: 12px;
}
.list-row:hover { background: var(--panel); }
.list-row.danger { color: #ff5d5d; }
.chev { color: var(--text-3); font-size: 18px; }
.hint { padding: 4px 14px 8px; font-size: 11.5px; color: var(--text-3); line-height: 1.6; }
.version { text-align: center; font-size: 11px; color: var(--text-3); padding: 18px 0 24px; }

.segmented {
  display: inline-flex; padding: 3px;
  background: var(--panel-3); border-radius: 10px; gap: 2px;
}
.segmented button {
  padding: 5px 12px; border-radius: 8px;
  font-size: 12.5px; color: var(--text-2); font-weight: 500;
}
.segmented button.active {
  background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-sm); font-weight: 600;
}

.swatches { display: inline-flex; gap: 8px; }
.swatches button {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 3.5px transparent;
  transition: box-shadow .16s;
}
.swatches button.active { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 4px var(--c); }

/* 底部 tab */
.tabbar {
  display: flex;
  border-top: 1px solid var(--line);
  padding: 4px 8px calc(4px + var(--safe-b));
  background: var(--panel);
}
.tab {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 5px;
  border-radius: 12px;
  font-size: 10.5px; color: var(--text-3);
  transition: color .16s;
}
.tab svg { width: 21px; height: 21px; stroke-width: 1.7; }
.tab.active { color: var(--accent-2); }
.tab.active svg { stroke-width: 2.1; }
.tab .badge { position: absolute; top: 2px; right: 50%; transform: translateX(18px); }

/* ================= 聊天区 ================= */
.chat {
  display: flex;
  flex-direction: column;
  flex: 1; min-width: 0; min-height: 0;
  background: var(--panel);
  position: relative;
}

@media (min-width: 1180px) {
  .chat { background: var(--panel); }
  .messages { background:
    radial-gradient(700px 400px at 100% 0%, var(--bg-glow-2), transparent 60%),
    var(--panel); }
}

.chat-head {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--head-h);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(12px);
  z-index: 2;
}
.chat-head .back { display: none; }
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 {
  font-size: 15.5px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-title p {
  font-size: 11.5px; color: var(--text-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px 10px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 7px; }
.messages::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 7px; }

.welcome {
  max-width: 420px;
  margin: 12vh auto 0;
  text-align: center;
  padding: 0 24px;
  animation: fadeUp .5s ease both;
}
.welcome-fish {
  width: 78px; height: 78px; margin: 0 auto 18px;
  border-radius: 26px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(34,211,238,.18), rgba(79,140,255,.12));
  border: 1px solid var(--line);
}
.welcome-fish svg { width: 46px; height: 46px; stroke: none;
  fill: #ffb26b; filter: drop-shadow(0 4px 10px rgba(255,178,107,.35)); }
.welcome-fish svg circle { fill: #0d2233; }
.welcome-fish svg path:last-child { fill: var(--accent); }
.welcome h3 { font-size: 17px; margin-bottom: 8px; }
.welcome p { font-size: 13px; color: var(--text-2); line-height: 1.75; }
.welcome .tiny { font-size: 11.5px; color: var(--text-3); margin-top: 10px; }

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

/* 日期分隔 */
.day-sep {
  display: flex; align-items: center; justify-content: center;
  margin: 14px 0 10px;
}
.day-sep span {
  font-size: 10.5px; color: var(--text-3);
  padding: 3px 10px; border-radius: 20px;
  background: var(--panel-2);
}

/* 消息行 */
.msg {
  display: flex; gap: 10px;
  margin-bottom: 14px;
  align-items: flex-end;
  animation: msgIn .22s ease both;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

.msg .m-ava {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 12px; overflow: hidden;
  background: var(--panel-3);
}
.msg .m-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }

.msg .body { max-width: min(72%, 560px); display: flex; flex-direction: column; gap: 4px; }
.msg .sender { font-size: 11px; color: var(--text-3); padding: 0 4px; }

.bubble {
  position: relative;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.62;
  word-break: break-word;
  white-space: pre-wrap;
  background: var(--bubble-other);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  width: fit-content;
}
.msg.mine { flex-direction: row-reverse; }
.msg.mine .body { align-items: flex-end; }
.msg.mine .bubble {
  background: var(--bubble-me);
  color: var(--bubble-me-text);
  border: 0;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}
.bubble img.photo {
  display: block; max-width: 240px; max-height: 300px;
  border-radius: 10px; object-fit: cover; cursor: zoom-in;
  margin: -2px 0;
}
.bubble .mention {
  color: var(--accent-2); font-weight: 600;
}
.msg.mine .bubble .mention { color: #eafcff; text-decoration: underline; text-underline-offset: 2px; }

.bubble.recalled {
  background: transparent !important;
  border: 1px dashed var(--line-strong);
  color: var(--text-3);
  font-size: 12.5px;
  box-shadow: none;
}

.msg-foot {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--text-3);
  padding: 0 4px;
}
.msg.mine .msg-foot { justify-content: flex-end; }
.msg-foot .read { color: var(--accent-2); }

/* 系统消息 */
.msg.sys { justify-content: center; }
.msg.sys .body { max-width: none; }
.sys-bubble {
  background: transparent !important;
  border: 1px dashed var(--line-strong) !important;
  color: var(--text-3) !important;
  font-size: 12px !important;
  box-shadow: none !important;
}

/* 正在输入 */
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0);} 30% { opacity: 1; transform: translateY(-2px);} }

/* 输入区 */
.composer {
  position: relative;
  padding: 8px 14px calc(10px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.composer-inner {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 6px 6px 6px 4px;
  border-radius: 18px;
  background: var(--panel-2);
  border: 1px solid transparent;
  transition: border-color .18s, background .18s;
}
.composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--panel);
}

#input {
  flex: 1;
  min-height: 24px;
  max-height: 132px;
  padding: 8px 4px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
}
#input::placeholder { color: var(--text-3); }

.send-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 36px; padding: 0 14px;
  border-radius: 12px;
  background: var(--bubble-me);
  color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: opacity .16s, transform .12s;
}
.send-btn svg { width: 16px; height: 16px; stroke-width: 2; }
.send-btn:disabled { opacity: .4; box-shadow: none; cursor: default; }
.send-btn:not(:disabled):active { transform: scale(.95); }
.send-btn span { display: inline; }

.emoji-panel {
  position: absolute;
  left: 12px; bottom: calc(100% - 4px);
  width: 300px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 10px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 5;
  animation: pop .16s ease both;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(4px);} to {opacity:1; transform:none;} }
.emoji-panel button {
  font-size: 20px; line-height: 1;
  padding: 6px 0; border-radius: 8px;
}
.emoji-panel button:hover { background: var(--panel-2); }

/* ================= 弹层 / 菜单 ================= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(6, 18, 26, .45);
  backdrop-filter: blur(3px);
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-body {
  position: relative;
  width: min(400px, calc(100vw - 32px));
  max-height: min(78vh, 720px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2,.9,.3,1.15) both;
}

.modal-body h3 { font-size: 16px; margin-bottom: 4px; }
.modal-body .sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 14px; line-height: 1.6; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field input[type=text], .field input[type=password], .field input[type=url], .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  font-size: 13.5px;
  outline: none;
  transition: border-color .16s;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }

.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.btn {
  padding: 10px 18px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line);
}
.btn:hover { background: var(--panel-3); }
.btn.primary {
  background: var(--bubble-me); color: #fff; border: 0;
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn.primary:disabled { opacity: .5; }
.btn.danger { color: #ff5d5d; }
.btn.link { background: none; border: 0; color: var(--accent-2); }

.picker-list { max-height: 320px; overflow-y: auto; margin: 4px -6px; }
.picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 12px; cursor: pointer;
  font-size: 13.5px;
}
.picker-item:hover { background: var(--panel-2); }
.picker-item img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: var(--panel-3);
}
.picker-item .check {
  margin-left: auto;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 12px; color: #fff;
}
.picker-item.selected .check { background: var(--accent-2); border-color: var(--accent-2); }

.avatar-editor { display: grid; place-items: center; gap: 14px; }
.avatar-preview {
  width: 132px; height: 132px; border-radius: 50%;
  overflow: hidden; background: var(--panel-3);
  box-shadow: var(--shadow-md); position: relative;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { display: flex; gap: 10px; }

/* 右键/长按菜单 */
.ctxmenu {
  position: fixed; z-index: 120;
  min-width: 152px;
  padding: 6px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: pop .14s ease both;
}
.ctxmenu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px; text-align: left;
}
.ctxmenu button:hover { background: var(--panel-2); }
.ctxmenu button.danger { color: #ff5d5d; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(34px + var(--safe-b));
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(13, 34, 51, .92);
  color: #eafcff;
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toastIn .2s ease both;
  max-width: min(78vw, 420px);
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px);} to {opacity:1; transform: translate(-50%, 0);} }

/* 图片查看 */
.viewer {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(4, 12, 18, .92);
  display: grid; place-items: center;
  animation: fade .18s ease both;
}
.viewer img { max-width: 94vw; max-height: 88vh; border-radius: 12px; box-shadow: var(--shadow-lg); }

/* ================= 响应式：手机 ================= */
@media (max-width: 819px) {
  .app { height: 100dvh; }
  .sidebar {
    width: 100%; flex: 1; border-right: 0;
  }
  .chat {
    position: fixed; inset: 0;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.22,.9,.25,1);
    z-index: 40;
  }
  .app.mobile-chat .chat { transform: translateX(0); }
  .chat-head .back { display: inline-flex; }
  .chat-head { padding-left: 6px; }
  .messages { padding: 14px 12px 8px; }
  .msg .body { max-width: 78%; }
  .send-btn span { display: none; }
  .send-btn { width: 38px; padding: 0; justify-content: center; }
  .emoji-panel { width: calc(100vw - 24px); left: 12px; }
  .welcome { margin-top: 16vh; }
  .composer { padding: 8px 10px calc(8px + var(--safe-b)); }
  .profile-card, .group-card { margin-left: 4px; margin-right: 4px; }
}

@media (max-width: 380px) {
  .conv .ava { width: 42px; height: 42px; flex-basis: 42px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
