/* ============================================================
   云聊 - 设计系统 v3「赛博深空」
   整体 UI 重构：深空黑 + 霓虹青紫 + 玻璃拟态 + 精致动效
   保留全部类名兼容 JS，重定义视觉层
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  --bg-0: #030509;
  --bg-1: #070b14;
  --bg-2: #0c1220;
  --bg-3: #111a2e;
  --bg-card: rgba(255, 255, 255, 0.035);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(13, 19, 33, 0.72);

  --border: rgba(120, 160, 255, 0.12);
  --border-strong: rgba(0, 229, 255, 0.28);

  --text-0: #eef4ff;
  --text-1: #9fb0d4;
  --text-2: #5a6b90;

  --primary: #4f7cff;
  --primary-2: #00e5ff;
  --accent: #7c5cff;
  --danger: #ff3d6e;
  --success: #00e5a0;
  --warn: #ffb020;

  --grad-main: linear-gradient(135deg, #4f7cff 0%, #00e5ff 100%);
  --grad-accent: linear-gradient(135deg, #7c5cff 0%, #ff3d8b 100%);
  --grad-hot: linear-gradient(135deg, #ff5f6d 0%, #ffc371 100%);
  --grad-bg: radial-gradient(1100px 500px at 85% -10%, rgba(79,124,255,0.32), transparent 60%),
             radial-gradient(900px 480px at -10% 110%, rgba(0,229,255,0.22), transparent 55%),
             radial-gradient(800px 420px at 110% 85%, rgba(124,92,255,0.26), transparent 60%),
             radial-gradient(500px 300px at 45% 45%, rgba(255,61,139,0.10), transparent 70%),
             var(--bg-0);

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.06);
  --shadow-neon: 0 0 20px rgba(0, 229, 255, 0.22), 0 8px 32px rgba(124, 92, 255, 0.18);
  --shadow-btn: 0 6px 20px rgba(79, 124, 255, 0.35);

  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --tabbar-h: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-0);
  font-size: 15px;
  user-select: none;
  -webkit-user-select: none;
}

#app { height: 100%; }

/* ---------- 科技感背景 v3 ---------- */
.tech-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--grad-bg);
}
.tech-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 180, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 255, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 25%, transparent 78%);
}
.tech-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 28%, rgba(0, 229, 255, 0.18), transparent 32%),
    radial-gradient(circle at 82% 68%, rgba(124, 92, 255, 0.22), transparent 34%),
    radial-gradient(circle at 60% 20%, rgba(255, 61, 139, 0.10), transparent 30%);
  filter: blur(46px);
  animation: bgFloat 16s ease-in-out infinite alternate;
}
@keyframes bgFloat {
  0% { transform: translateY(-12px) scale(1); opacity: 0.75; }
  100% { transform: translateY(14px) scale(1.06); opacity: 1; }
}

/* ---------- 页面容器 v3 ---------- */
.page {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
  flex-direction: column;
  background: transparent;
}
.page.active {
  display: flex;
  animation: pageIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

.page-body {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 20px;
}
.page-body::-webkit-scrollbar { display: none; }

/* ---------- 顶部导航 v3 ---------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(8, 12, 24, 0.55);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid rgba(120, 160, 255, 0.10);
  z-index: 10;
  flex-shrink: 0;
  position: relative;
}
.navbar::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.75), rgba(124, 92, 255, 0.85), transparent);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.35);
  pointer-events: none;
}
.navbar .title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(120deg, #7c5cff, #00e5ff 60%, #4f7cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.navbar .nav-left, .navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 70px;
}
.navbar .nav-right { justify-content: flex-end; }

.nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.8), rgba(0, 229, 255, 0.7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 16px rgba(0, 229, 255, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-btn:active {
  transform: scale(0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 8px rgba(0, 229, 255, 0.2);
}

/* ---------- 玻璃卡片 ---------- */
.card,
.menu-list,
.conv-item,
.contact-item,
.search-result,
.discover-card {
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

/* ---------- 搜索框 v3 ---------- */
.search-bar {
  height: 42px;
  border-radius: 21px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(120, 160, 255, 0.12);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.10);
}
.search-bar .icon { font-size: 15px; opacity: 0.6; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-0);
  font-size: 14px;
}
.search-bar input::placeholder { color: var(--text-2); }

/* ---------- 会话列表 v3 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 1px;
  margin: 16px 4px 10px;
}
.conv-group { color: var(--primary-2); }
.conv-group::before {
  content: '';
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--grad-main);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

.conv-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.2s;
  animation: listIn 0.3s ease backwards;
}
.conv-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.05), transparent 45%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.conv-item:active {
  transform: scale(0.98);
  border-color: var(--border-strong);
}
.conv-item:active::before { opacity: 1; }

.conv-item.pinned {
  border-color: rgba(0, 229, 255, 0.30);
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.14), rgba(0, 229, 255, 0.05) 60%, rgba(124, 92, 255, 0.10));
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.10), var(--shadow-card);
}
.conv-item.pinned::before { opacity: 1; }
.conv-item.pinned .conv-name { color: var(--primary-2); }

.conv-main { flex: 1; min-width: 0; }
.conv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.conv-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-name .qq-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: 1px;
  font-family: Consolas, monospace;
}
.conv-preview {
  font-size: 12.5px;
  color: var(--text-1);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time {
  font-size: 11px;
  color: var(--text-2);
  flex-shrink: 0;
  margin-left: auto;
}
.conv-time.hot { color: var(--primary-2); font-weight: 600; }

.conv-unread {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff3d6e, #ff7a59);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(255, 61, 110, 0.55);
  z-index: 2;
}

.pin-flag {
  position: absolute;
  top: -6px;
  left: 10px;
  font-size: 12px;
  filter: drop-shadow(0 2px 6px rgba(0, 229, 255, 0.5));
  z-index: 2;
}
.mute-icon { margin-right: 4px; font-size: 11px; }

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

/* ---------- 推荐位 ---------- */
.discover-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(0, 229, 255, 0.32);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  animation: listIn 0.3s ease backwards;
}
.discover-card:active { transform: scale(0.97); border-color: var(--border-strong); }
.d-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.14), rgba(124, 92, 255, 0.14));
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.2);
}
.d-title { font-size: 13.5px; font-weight: 700; color: var(--text-0); }
.d-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.d-arrow { margin-left: auto; font-size: 22px; color: rgba(0, 229, 255, 0.7); }

/* ---------- 头像 v3 ---------- */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.avatar img { width: 100%; height: 100%; border-radius: 16px; object-fit: cover; }
.avatar.svc { background: linear-gradient(135deg, #00e5ff, #4f7cff); }
.avatar[data-g="0"] { background: linear-gradient(135deg, #4f7cff, #7c5cff); }
.avatar[data-g="1"] { background: linear-gradient(135deg, #00e5ff, #4f7cff); }
.avatar[data-g="2"] { background: linear-gradient(135deg, #ff5f6d, #ffc371); }
.avatar[data-g="3"] { background: linear-gradient(135deg, #00e5a0, #00e5ff); }
.avatar[data-g="4"] { background: linear-gradient(135deg, #7c5cff, #ff3d8b); }
.avatar[data-g="5"] { background: linear-gradient(135deg, #ffb020, #ff5f6d); }
.avatar .online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 8px rgba(0, 229, 160, 0.6);
}

/* ---------- 联系人 ---------- */
.contact-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-2);
  margin: 14px 4px 8px;
}
.contact-group-title .cg-count {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1px 7px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.2s;
  animation: listIn 0.3s ease backwards;
}
.contact-item:active {
  transform: scale(0.98);
  border-color: var(--border-strong);
}
.contact-item .avatar { width: 44px; height: 44px; border-radius: 14px; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 15px; font-weight: 600; color: var(--text-0); }
.contact-qq {
  font-size: 11px;
  color: var(--text-2);
  font-family: Consolas, monospace;
  margin-top: 2px;
}
.contact-bio { font-size: 12px; color: var(--text-2); margin-top: 1px; }

/* ---------- 聊天页 ---------- */
.chat-page { background: transparent; }
.chat-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 10px;
  scroll-behavior: smooth;
}
.chat-body::-webkit-scrollbar { display: none; }

.chat-friend-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(8, 12, 24, 0.5);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
  animation: msgIn 0.25s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.msg-row.mine { flex-direction: row-reverse; }
.msg-row .avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 16px; }

.msg-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}
.msg-bubble img { max-width: 100%; border-radius: 10px; display: block; }

.msg-row.theirs .msg-bubble {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(120, 160, 255, 0.12);
  border-bottom-left-radius: 5px;
  color: var(--text-0);
  backdrop-filter: blur(10px);
}
.msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.85), rgba(0, 229, 255, 0.75));
  border: none;
  border-bottom-right-radius: 5px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.18);
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-2);
  margin-bottom: 3px;
  padding: 0 2px;
}
.msg-row.mine .msg-meta { justify-content: flex-end; }
.msg-row.failed .msg-bubble {
  opacity: 0.55;
  border: 1px dashed var(--danger);
}
.msg-row.failed .msg-meta { color: var(--danger); }

.msg-center { text-align: center; margin: 14px 0; }
.msg-date {
  display: inline-block;
  font-size: 11px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px 12px;
}

/* 输入栏 v3 */
.chat-inputbar {
  flex-shrink: 0;
  background: rgba(8, 12, 24, 0.6);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  padding-bottom: calc(8px + var(--safe-bottom));
}
.inputbar-top {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-inputbar textarea {
  flex: 1;
  min-height: 38px;
  max-height: 110px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-0);
  font-size: 15px;
  line-height: 1.4;
  padding: 9px 14px;
  resize: none;
  outline: none;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-inputbar textarea:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.10);
}

.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  transition: transform 0.15s, background 0.2s;
  flex-shrink: 0;
}
.tool-btn:active { transform: scale(0.88); background: var(--bg-card-hover); }

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: #fff;
  background: var(--grad-main);
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.3);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.send-btn:active { transform: scale(0.88); }

/* 表情面板 */
.emoji-panel {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 12px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.emoji-cell {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}
.emoji-cell:active { background: var(--bg-card-hover); transform: scale(1.2); }

/* ---------- 我的页 ---------- */
.profile-header {
  position: relative;
  padding: 30px 0 24px;
  text-align: center;
}
.profile-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.12), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
}
.profile-header .avatar {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  font-size: 32px;
  margin: 0 auto 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 8px 28px rgba(124, 92, 255, 0.35);
}
.profile-header .nick { font-size: 21px; font-weight: 800; color: var(--text-0); }
.profile-header .qq {
  font-size: 13px;
  color: var(--text-2);
  font-family: Consolas, monospace;
  margin-top: 5px;
}
.profile-header .bio {
  font-size: 12.5px;
  color: var(--text-1);
  font-style: italic;
  margin-top: 8px;
}

.menu-list {
  margin-top: 18px;
  border-radius: var(--radius);
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--bg-card-hover); }
.menu-item .m-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.15), rgba(0, 229, 255, 0.10));
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.15);
  transition: transform 0.2s;
}
.menu-item:active .m-icon { transform: scale(0.9); }
.menu-item .m-label { flex: 1; font-size: 15px; font-weight: 600; color: var(--text-0); }
.menu-item .m-arrow { color: var(--text-2); font-size: 14px; }

.logout-btn {
  width: 100%;
  margin-top: 20px;
  height: 46px;
  border-radius: 23px;
  border: 1px solid rgba(255, 61, 110, 0.4);
  background: rgba(255, 61, 110, 0.08);
  color: var(--danger);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.logout-btn:active {
  background: rgba(255, 61, 110, 0.18);
  transform: scale(0.97);
}

.svc-fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--tabbar-h) + 24px);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.35);
  z-index: 50;
  transition: transform 0.2s;
}
.svc-fab:active { transform: scale(0.9); }

/* ---------- Tab 栏 v3 ---------- */
.tabbar {
  position: relative;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(8, 12, 24, 0.6);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border-top: 1px solid rgba(120, 160, 255, 0.10);
  flex-shrink: 0;
  z-index: 10;
}
.tabbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.35), transparent);
  pointer-events: none;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 10px;
  transition: color 0.2s;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}
.tab-item .tab-icon {
  width: auto;
  min-width: 48px;
  height: 30px;
  padding: 0 13px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  filter: grayscale(0.6) opacity(0.75);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tab-item.active { color: var(--primary-2); }
.tab-item.active span { font-weight: 700; font-size: 11px; }
.tab-item.active .tab-icon {
  filter: none;
  background: rgba(0, 229, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.30), 0 0 18px rgba(0, 229, 255, 0.22);
  transform: translateY(-1px) scale(1.1);
}
.tab-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 12px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff3d6e, #ff7a59);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 61, 110, 0.5);
}

/* ---------- 按钮 v3 ---------- */
.btn {
  height: 44px;
  border-radius: 22px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 22px;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  font-family: var(--font);
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-sm { height: 36px; font-size: 13px; border-radius: 18px; padding: 0 16px; }
.btn-primary {
  background: linear-gradient(135deg, #4f7cff, #00e5ff 55%, #4f7cff);
  color: #fff;
  box-shadow: var(--shadow-btn), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: btnShine 3s ease infinite;
}
@keyframes btnShine {
  0%, 60% { left: -60%; }
  100% { left: 120%; }
}
.btn-primary:active { box-shadow: 0 2px 10px rgba(79, 124, 255, 0.3); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-0);
  border: 1px solid var(--border);
}
.btn-danger {
  background: linear-gradient(135deg, #ff3d6e, #ff7a59);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 61, 110, 0.3);
}
.add-btn { border-radius: 12px; }

/* ---------- 表单 v3 ---------- */
.field { position: relative; margin-bottom: 14px; }
.field .label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.field .f-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 2;
}
.field input, .field textarea {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-0);
  font-size: 15px;
  padding: 0 16px;
  outline: none;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input.has-icon { padding-left: 42px; }
.field input:focus, .field textarea:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.10);
}
.field textarea { height: auto; padding: 12px 16px; resize: none; }
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.6;
  z-index: 2;
}

/* ---------- 登录/注册页 v3 ---------- */
/* 不用 flex 居中（小屏会上下溢出裁掉顶部），改正常流 + 上下留白 */
.auth-page .page-body {
  display: block;
  padding-top: max(8vh, 24px);
  padding-bottom: max(8vh, 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.auth-logo { text-align: center; margin-bottom: 36px; }
.auth-logo .logo-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  border-radius: 26px;
  background: var(--grad-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 229, 255, 0.35);
}
.auth-logo .logo-icon::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 32px;
  background: conic-gradient(from 0deg, transparent, rgba(0, 229, 255, 0.8), rgba(124, 92, 255, 0.8), transparent 40%);
  animation: spinRing 3s linear infinite;
  z-index: -1;
  opacity: 0.9;
}
@keyframes spinRing {
  to { transform: rotate(360deg); }
}
.auth-logo h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(120deg, #7c5cff, #00e5ff 60%, #4f7cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-logo p {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 10px;
  letter-spacing: 2px;
}
.auth-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 4px;
  margin-bottom: 22px;
}
.auth-switch .sw-item {
  flex: 1;
  height: 38px;
  border-radius: 19px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}
.auth-switch .sw-item.active {
  background: var(--grad-main);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.3);
}
.auth-tip { text-align: center; color: var(--text-2); font-size: 12px; margin-top: 18px; line-height: 1.8; }
.auth-tip .link { color: var(--primary-2); cursor: pointer; }

/* 选号 */
.num-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 8px 0 4px;
}
.num-cell {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.num-cell .num {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-0);
  font-family: Consolas, monospace;
  letter-spacing: 1px;
}
.num-cell .sub { font-size: 10px; color: var(--text-2); margin-top: 3px; }
.num-cell:active { transform: scale(0.94); }
.num-cell.selected {
  border-color: var(--border-strong);
  background: rgba(0, 229, 255, 0.08);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
}
.num-cell.selected .num { color: var(--primary-2); }
.num-cell.lucky { border-color: rgba(255, 176, 32, 0.45); }
.num-cell.lucky .num { color: #ffc371; }
.badge-lucky {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #ffb020;
  background: rgba(255, 176, 32, 0.12);
  border: 1px solid rgba(255, 176, 32, 0.35);
  border-radius: 6px;
  padding: 0 5px;
  margin-left: 4px;
}
.refresh-btn {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: rgba(0, 229, 255, 0.05);
  color: var(--primary-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.2s;
}
.refresh-btn:active { transform: scale(0.97); background: rgba(0, 229, 255, 0.1); }
.refresh-btn.spinning .icon { animation: spin 0.6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 弹窗 v3 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 10, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(86%, 340px);
  background: linear-gradient(160deg, rgba(20, 28, 48, 0.96), rgba(10, 15, 28, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 255, 0.06);
  animation: modalIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.modal h3 {
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 14px;
  background: linear-gradient(120deg, #7c5cff, #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.modal .avatar { margin: 0 auto; }
.modal .modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal .modal-btns .btn { flex: 1; }

/* 背景选项 */
.bg-option {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s;
}
.bg-option:active { transform: scale(0.95); border-color: var(--border-strong); }

/* ---------- Toast v3 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(13, 19, 33, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 22px;
  font-size: 14px;
  color: var(--text-0);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.success { border-color: rgba(0, 229, 160, 0.5); }
.toast.error { border-color: rgba(255, 61, 110, 0.5); }

/* 图片预览 */
.img-preview-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.2s;
}
.img-preview-mask img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 12px;
  object-fit: contain;
}

/* 消息预览（搜索/转发） */
.msg-preview { max-width: 260px; }
.msg-preview img { max-width: 100%; border-radius: 8px; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 0;
  color: var(--text-2);
}
.empty-state .e-icon { font-size: 52px; margin-bottom: 14px; opacity: 0.5; }
.empty-state .e-text { font-size: 14px; line-height: 1.8; }

/* 搜索结果 */
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.18s;
  animation: listIn 0.3s ease backwards;
}
.search-result:active { transform: scale(0.98); border-color: var(--border-strong); }
.search-result .avatar { width: 46px; height: 46px; }

/* 加载屏 */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s;
}
.loading-screen.hide { opacity: 0; pointer-events: none; }
.loading-inner { text-align: center; }
.loading-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: var(--grad-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  box-shadow: 0 12px 40px rgba(0, 229, 255, 0.3);
  animation: loadingPulse 1.6s ease-in-out infinite;
}
@keyframes loadingPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 12px 40px rgba(0, 229, 255, 0.3); }
  50% { transform: scale(1.06); box-shadow: 0 12px 48px rgba(124, 92, 255, 0.5); }
}
.loading-ring {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--primary-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text {
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: 2px;
}

/* ---------- 浅色主题 v3 ---------- */
[data-theme="light"] {
  --bg-0: #eef2fb;
  --bg-1: #f4f7fd;
  --bg-2: #e8edf7;
  --bg-3: #dfe6f4;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.72);

  --border: rgba(30, 60, 120, 0.10);
  --border-strong: rgba(0, 160, 255, 0.40);

  --text-0: #16213c;
  --text-1: #5a6b90;
  --text-2: #8a97b8;

  --shadow-card: 0 8px 28px rgba(30, 60, 120, 0.08), inset 0 1px 0 #fff;
  --shadow-neon: 0 0 20px rgba(0, 160, 255, 0.15);
  --shadow-btn: 0 6px 18px rgba(79, 124, 255, 0.25);

  --grad-bg: radial-gradient(1100px 500px at 85% -10%, rgba(79,124,255,0.10), transparent 60%),
             radial-gradient(900px 480px at -10% 110%, rgba(0,160,255,0.08), transparent 55%),
             radial-gradient(800px 420px at 110% 85%, rgba(124,92,255,0.08), transparent 60%),
             #eef2fb;
}
[data-theme="light"] .tech-bg { background: var(--grad-bg); }
[data-theme="light"] .navbar,
[data-theme="light"] .tabbar,
[data-theme="light"] .chat-inputbar {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
}
[data-theme="light"] .conv-item,
[data-theme="light"] .contact-item,
[data-theme="light"] .search-result,
[data-theme="light"] .discover-card {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 6px 20px rgba(30, 60, 120, 0.07), inset 0 1px 0 #fff;
}
[data-theme="light"] .conv-item.pinned {
  background: linear-gradient(135deg, #e6f0ff, #ecf8ff 60%, #efeaff);
  border-color: rgba(0, 150, 255, 0.4);
  box-shadow: 0 6px 20px rgba(0, 120, 255, 0.12);
}
[data-theme="light"] .conv-time { color: #8a97b8; }
[data-theme="light"] .conv-time.hot { color: #00a0ff; }
[data-theme="light"] .msg-row.theirs .msg-bubble {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(30, 60, 120, 0.10);
  color: var(--text-0);
}
[data-theme="light"] .msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, #4f7cff, #00a0ff);
  color: #fff;
}
[data-theme="light"] .search-bar,
[data-theme="light"] .field input,
[data-theme="light"] .field textarea,
[data-theme="light"] .chat-inputbar textarea {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(30, 60, 120, 0.12);
  color: var(--text-0);
}
[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-0);
  box-shadow: 0 12px 40px rgba(30, 60, 120, 0.15);
}
[data-theme="light"] .modal {
  background: linear-gradient(160deg, #ffffff, #f0f5ff);
  border-color: rgba(30, 60, 120, 0.12);
}
[data-theme="light"] .menu-item { border-bottom-color: rgba(30, 60, 120, 0.08); }
[data-theme="light"] .d-sub { color: #8a97b8; }
[data-theme="light"] .subtitle { color: #5a6b90; }
[data-theme="light"] .loading-screen { background: var(--bg-0); }
