:root {
  /* 对齐 78 / tokens.css：teal + 玻璃，告别微信平灰 */
  --qq: #0d9488;
  --qq-deep: #0f766e;
  --qq-dark: #0b1220;
  --bubble-me: linear-gradient(145deg, #5eead4 0%, #2dd4bf 42%, #0d9488 100%);
  --bubble-peer: rgba(255, 255, 255, 0.96);
  --chat-bg: #e4eaf1;
  --chat-bg-mesh:
    radial-gradient(ellipse 90% 58% at 12% -8%, rgba(45, 212, 191, 0.18), transparent 56%),
    radial-gradient(ellipse 70% 48% at 96% 12%, rgba(100, 116, 139, 0.1), transparent 52%),
    linear-gradient(168deg, #f2f5f9 0%, #e7edf4 46%, #dde5ee 100%);
  --list-bg: transparent;
  --page-bg: #e4eaf1;
  --line: rgba(15, 23, 42, 0.06);
  --ink: #0b1220;
  --muted: #8b95a5;
  --danger: #fa5151;
  --wechat-head: rgba(255, 255, 255, 0.78);
  --radius-sm: 13px;
  --radius-md: 17px;
  --radius-bubble: 18px;
  --glass-blur: 28px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.045), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-bubble-me:
    0 8px 22px rgba(13, 148, 136, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  --shadow-bubble-peer: 0 2px 8px rgba(15, 23, 42, 0.05);
  --font: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --app-h: 100dvh;
  --vv-top: 0px;
  --kb-offset: 0px;
  --composer-bottom: 0px;
  --vv-h: 100dvh;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  color-scheme: only light;
  background: var(--chat-bg-mesh);
  background-color: var(--page-bg);
}
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--chat-bg-mesh);
  background-color: var(--page-bg);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
/* 键盘弹出：页面保持全屏，只上移输入条 */
html.kb-open,
html.kb-open body {
  background: var(--chat-bg);
  overflow: hidden !important;
}
html.kb-open .composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--composer-bottom, 0px);
  z-index: 100;
  flex-shrink: 0;
  /* 键盘已盖住 Home 条，不要再垫 safe-area，否则输入条和键盘之间会空一截 */
  padding-bottom: 8px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(255, 255, 255, 0.9) 100%
  );
  border-top: 1px solid var(--line);
}
html.kb-open .input-row textarea {
  max-height: 40px !important;
  min-height: 40px !important;
  height: 40px !important;
}
html.kb-open #messages {
  padding-bottom: calc(72px + var(--composer-bottom, 0px));
}
.error { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  padding: 48px 24px;
  margin: 0;
}
.empty[hidden] { display: none !important; }

/* —— 登录 —— */
/* .auth { display:grid } 会盖掉 UA 的 [hidden]，必须强制隐藏，否则「我的」透出登录页 */
#auth[hidden],
.auth[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  z-index: -1 !important;
}
#app[hidden],
.app[hidden],
.panel[hidden],
#panel-chats[hidden],
#panel-contacts[hidden],
#panel-me[hidden] {
  display: none !important;
}
.auth {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px 16px calc(20px + var(--safe-b));
  background:
    radial-gradient(800px 420px at 15% 0%, #9ad8ff 0%, transparent 55%),
    linear-gradient(165deg, #6ec0f2 0%, #b7e3ff 45%, #eaf7ff 100%);
}
.qq-win {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(30, 90, 140, .22);
  overflow: visible;
  padding-bottom: 6px;
}
.qq-titlebar {
  height: 34px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; position: relative; z-index: 2; border-radius: 12px 12px 0 0; background: #fff;
}
.qq-title { font-size: 13px; color: #666; font-weight: 600; }
.qq-winbtns { display: flex; gap: 7px; }
.qq-winbtns span { width: 11px; height: 11px; border-radius: 50%; background: #e5e5e5; }
.qq-winbtns .close { background: #ff605c; }
.qq-banner {
  height: 130px; margin-top: -34px; border-radius: 12px 12px 0 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.28), transparent 42%),
    linear-gradient(180deg, #4eb8f5, #12b7f5 70%);
  position: relative; overflow: hidden;
}
.qq-banner::before {
  content: ""; position: absolute; width: 160px; height: 160px; right: -36px; top: -48px;
  border-radius: 50%; background: rgba(255,255,255,.14);
}
.qq-avatar-wrap { display: flex; justify-content: center; margin-top: -46px; position: relative; z-index: 3; }
.qq-avatar {
  width: 92px; height: 92px; border-radius: 50%; background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); display: grid; place-items: center; border: 3px solid #fff;
  overflow: hidden;
}
.qq-avatar img {
  width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 50%;
  image-rendering: -webkit-optimize-contrast;
}
.qq-body { padding: 16px 28px 20px; }
.qq-field { border-bottom: 1px solid #e6e6e6; }
.qq-field input {
  width: 100%; border: 0; outline: none; background: transparent;
  padding: 14px 2px; font-size: 16px; color: #222;
}
.qq-field input::placeholder { color: #b0b0b0; }
.qq-login {
  width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #3fc0ff, #12b7f5);
  color: #fff;
  font-size: 16px;
  letter-spacing: 6px;
  padding: 13px 0;
  margin-top: 18px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(18, 183, 245, .32);
}
.qq-login:disabled { opacity: .7; }
/* 手机端登录：去掉假窗口交通灯 */
@media (max-width: 859px) {
  .qq-winbtns { display: none; }
  .qq-title { font-size: 14px; color: #888; }
  .auth {
    padding-top: max(20px, env(safe-area-inset-top, 0px));
  }
}
.qq-links {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; font-size: 12px; color: #aaa;
}
.qq-link { border: 0; background: none; color: var(--qq); font-size: 12px; cursor: pointer; padding: 0; }
#auth-error { min-height: 18px; display: none; margin-top: 8px; text-align: center; }

/* —— 主壳：手机单栏 / 电脑双栏 —— */
.app {
  display: none;
  height: 100%;
  min-height: 100dvh;
}
.app:not([hidden]) { display: block; }

/* 手机优先壳：Cap / 苹果PWA / 手机浏览器 —— 整屏铺满，禁止 500px 居中留白 */
html.phone-shell,
html.standalone,
html.native-shell {
  width: 100%;
  height: 100%;
}
html.phone-shell body,
html.standalone body,
html.native-shell body {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}
html.phone-shell .app:not([hidden]),
html.standalone .app:not([hidden]),
html.native-shell .app:not([hidden]) {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  width: 100% !important;
  max-width: none !important;
  height: 100%;
  min-height: 100dvh;
  max-height: 100dvh;
  margin: 0 !important;
}
html.phone-shell .shell,
html.standalone .shell,
html.native-shell .shell {
  flex: 1 1 0;
  align-self: stretch;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: 0;
  max-height: none !important;
}
html.phone-shell .list-pane,
html.standalone .list-pane,
html.native-shell .list-pane {
  width: 100% !important;
  max-width: none !important;
  flex: 1 1 0 !important;
  min-width: 0;
  border-right: 0 !important;
}
html.phone-shell .chat-pane,
html.standalone .chat-pane,
html.native-shell .chat-pane {
  display: none !important;
}
html.phone-shell .app.show-chat .list-pane,
html.standalone .app.show-chat .list-pane,
html.native-shell .app.show-chat .list-pane {
  display: none !important;
}
html.phone-shell .app.show-chat .chat-pane,
html.standalone .app.show-chat .chat-pane,
html.native-shell .app.show-chat .chat-pane {
  display: flex !important;
  width: 100% !important;
  flex: 1 1 0 !important;
}

/* 手机浏览器/PWA：整页平铺，勿留两侧灰边（不依赖 standalone） */
@media (max-width: 859px) {
  html, body {
    max-height: none;
    height: 100%;
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    padding: 0 !important;
    margin: 0;
  }
  .app:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0 !important;
  }
  .shell {
    flex: 1 1 0;
    align-self: stretch;
    min-height: 0;
    max-height: none;
    display: flex;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .list-pane {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100% !important;
    max-width: none !important;
    display: flex;
    flex-direction: column;
  }
  .app.show-chat .chat-pane {
    flex: 1 1 0;
    min-height: 0;
    width: 100% !important;
    display: flex;
    flex-direction: column;
  }
  .panel,
  .messages {
    flex: 1 1 0;
    min-height: 0;
  }
  .tabbar,
  .composer {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
  }
}

.shell {
  height: 100%;
  max-height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  position: relative;
  display: flex;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
  overflow: hidden;
}

/* 宽屏但仍是触摸设备（iPad 等）：同样平铺单栏，不走桌面双栏留白 */
@media (min-width: 860px) and (pointer: coarse) {
  body {
    padding: 0 !important;
    background: var(--page-bg) !important;
  }
  .app:not([hidden]) {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    width: 100% !important;
    max-width: none !important;
    height: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
  }
  .shell {
    flex: 1 1 0;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    height: auto !important;
    max-height: none !important;
  }
  .list-pane {
    width: 100% !important;
    flex: 1 1 0 !important;
    max-width: none !important;
    border-right: 0 !important;
  }
  .chat-pane {
    display: none !important;
  }
  .app.show-chat .list-pane {
    display: none !important;
  }
  .app.show-chat .chat-pane {
    display: flex !important;
    width: 100% !important;
    flex: 1 1 0 !important;
  }
  .back,
  .chat-head__back {
    display: flex !important;
  }
}

.list-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg-mesh);
  background-color: var(--page-bg);
  min-height: 0;
}
.chat-pane {
  display: none;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  background: var(--chat-bg-mesh);
  background-color: var(--chat-bg);
  min-height: 0;
  position: relative;
}

/* 手机：进入聊天后隐藏列表 */
.app.show-chat .list-pane { display: none; }
.app.show-chat .chat-pane { display: flex; }

.main-tab-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: max(10px, var(--safe-t)) 14px 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.76) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.main-tab-header__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: center;
}
.main-tab-header__actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}
.main-tab-header__btn {
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-sm);
  background: rgba(13, 148, 136, 0.12);
  color: var(--qq);
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  -webkit-tap-highlight-color: transparent;
}
.main-tab-header__btn:active {
  transform: scale(0.96);
  background: rgba(13, 148, 136, 0.2);
}
.main-tab-header__btn.install-top {
  background: var(--qq);
  color: #fff;
  border-color: transparent;
}
/* 兼容旧类名（若别处仍引用） */
.qq-top { display: none !important; }
.avatar {
  width: 42px; height: 42px; border-radius: 8px;
  display: grid; place-items: center; color: #fff; font-weight: 600; flex-shrink: 0;
}
.avatar.round { border-radius: 50%; border: 1px solid rgba(0,0,0,.06); }
.avatar.clickable,
.me-name.clickable { cursor: pointer; }
.me-name.clickable:hover { text-decoration: underline; }
.avatar.clickable { position: relative; overflow: hidden; }
.avatar.clickable:active { transform: scale(0.96); }
.avatar.has-img {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  text-shadow: none;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}
.me-name { font-size: 16px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 11px; color: #888; opacity: 1; margin-top: 2px; }

.search-wrap {
  padding: 10px 14px 8px;
  background: transparent;
  display: flex;
  gap: 8px;
  align-items: center;
}
.search {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
  box-shadow: var(--shadow-sm);
}
.btn-new-group {
  border: 0;
  background: var(--qq);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
#btn-add-friend {
  /* 样式由 .main-tab-header__btn 接管 */
}
.tab-badge {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #fa5151;
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.friend-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.friend-actions button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.friend-accept { background: var(--qq); color: #fff; }
.friend-reject { background: #f0f0f0; color: #666; }
.friend-cancel { background: #f0f0f0; color: #666; }
.modal-okmsg { color: var(--qq); font-size: 13px; margin: 8px 0 0; }
.item.friend-req {
  cursor: default;
}
.item.friend-req .item-body { min-width: 0; }
.chat-head-info {
  cursor: pointer;
}
.members-gid-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.members-gid-row code {
  font-size: 12px;
  word-break: break-all;
}
.linkish {
  border: 0;
  background: none;
  color: var(--qq);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.members-manage-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.members-manage-list .mem-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.members-manage-list .mem-kick,
.members-manage-list .mem-tag {
  flex-shrink: 0;
  font-size: 12px;
}
.members-manage-list .mem-kick {
  border: 0;
  background: #ffecec;
  color: #fa5151;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.members-manage-list .mem-tag {
  color: #888;
}
.members-foot {
  display: flex;
  gap: 8px;
}
.members-foot .diag-btn {
  flex: 1;
}

.group-tag {
  display: inline-block;
  font-size: 10px;
  color: #fff;
  background: #12b7f5;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.bubble-name {
  font-size: 12px;
  color: #888;
  margin-bottom: 3px;
  font-weight: 500;
}
.row.mine .bubble-name { display: none; }
.row.system-row {
  justify-content: center;
  margin-bottom: 10px;
}
.system-tip {
  font-size: 12px;
  color: #999;
  background: rgba(0,0,0,.05);
  border-radius: 4px;
  padding: 4px 10px;
  max-width: 80%;
  text-align: center;
}
.msg-time-sep {
  display: block;
  text-align: center;
  font-size: 12px;
  color: #b2b2b2;
  margin: 12px 0 10px;
  line-height: 1.4;
  user-select: none;
}

.modal {
  /* 需高于 .sub-page(240)，否则伪装设置等子页会挡住弹窗 */
  position: fixed; inset: 0; z-index: 280;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  max-height: min(85vh, calc(100dvh - 32px - env(safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  background: var(--wechat-head);
  color: #111;
  border-bottom: 1px solid #e5e5e5;
}
.modal-head strong { font-size: 16px; font-weight: 600; }
.modal-x {
  border: 0; background: transparent; color: #888; font-size: 24px; cursor: pointer; line-height: 1;
  padding: 0 2px;
}
.modal-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body input[type="tel"],
.modal-body input:not([type]),
.modal-body textarea,
.modal-body select {
  width: 100%; border: 1px solid #e5e5e5; border-radius: var(--radius-md);
  padding: 11px 12px; font-size: 15px; outline: none; margin-bottom: 10px;
  font-family: inherit; background: #fff; box-sizing: border-box;
}
.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
  border-color: var(--qq);
}
.modal-tip { margin: 0 0 10px; font-size: 13px; color: #888; line-height: 1.45; padding: 0 16px; }
.modal-tip-flush { padding: 0; }
.app-download-card .modal-tip { padding: 0; margin-bottom: 10px; }
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid #f2f2f2;
}
.pick-list li input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #cfcfcf;
  background: #fff;
  flex-shrink: 0;
  position: relative;
  margin: 0;
}
.pick-list li input[type="checkbox"]:checked {
  background: var(--qq);
  border-color: var(--qq);
}
.pick-list li input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pick-list .avatar { width: 36px; height: 36px; border-radius: 50%; font-size: 14px; }
.modal-foot { padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px)); }
.modal-foot .qq-login { letter-spacing: 4px; margin-top: 0; }

.help-card { width: min(480px, 100%); max-height: 88vh; }
.help-body { font-size: 14px; line-height: 1.55; color: #333; }
.help-badge {
  display: inline-block; margin: 0 0 8px;
  padding: 3px 8px; border-radius: 999px;
  background: #f0f7fc; color: #0aa1db; font-size: 12px; font-weight: 600;
}
.help-body h3 { margin: 8px 0 8px; font-size: 16px; }
.help-body p { margin: 0 0 12px; color: #555; }
.help-steps { margin: 0 0 16px; padding-left: 18px; }
.help-steps li { margin: 0 0 10px; }
.help-steps b { display: block; color: #111; margin-bottom: 2px; }
.help-body code {
  font-family: inherit; background: #f4f6f8; padding: 1px 5px; border-radius: 4px;
}
.help-list { margin: 0; padding-left: 18px; color: #555; }
.help-list li { margin: 0 0 8px; }

.panel {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  background: var(--list-bg);
}
.list { list-style: none; margin: 0; padding: 4px 0 10px; flex-shrink: 0; }
.list-sec {
  padding: 14px 18px 6px;
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.list-hint {
  padding: 10px 16px 14px;
  font-size: 13px;
  color: #aaa;
  border-bottom: 1px solid var(--line);
}
.item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; cursor: pointer;
  margin: 0 12px 8px;
  border-radius: var(--radius-md);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.78);
}
.item:active, .item.active {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
}
#panel-chats,
#panel-contacts {
  padding: 0 0 8px;
  background: transparent;
}
.item .avatar {
  width: 48px; height: 48px; border-radius: 14px; font-size: 17px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.item-body { flex: 1; min-width: 0; }
.item-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; align-items: baseline; }
.item-name { font-size: 16px; font-weight: 500; color: #191919; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-time { font-size: 12px; color: #b2b2b2; flex-shrink: 0; }
.item-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.item-preview {
  font-size: 13px; color: #888;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #fa5151; color: #fff; border-radius: 9px;
  font-size: 11px; line-height: 18px; text-align: center; flex-shrink: 0;
}
.online-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--qq);
  display: inline-block; margin-left: 5px; vertical-align: middle;
}
.tag-online { font-size: 11px; color: var(--qq); }

.tabbar {
  display: flex;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  padding: 4px 0 max(4px, env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  margin-bottom: 0;
  position: relative;
  z-index: 5;
  box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.045);
}
.tab {
  flex: 1; border: 0; background: transparent; padding: 6px 0 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: #7f7f7f; cursor: pointer;
  position: relative;
  font-family: inherit;
}
.tab.active { color: var(--qq); font-weight: 600; }
.tab-ico {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  line-height: 1;
}
.tab-ico svg {
  width: 24px;
  height: 24px;
  display: block;
}
.tab .tab-label { line-height: 1.2; }

.panel-me {
  /* 对齐 78：无顶栏；覆盖 .panel 的 flex 列，避免小屏把资料卡压扁裁切 */
  display: block;
  padding: max(14px, env(safe-area-inset-top, 0px)) 0 16px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1 1 0;
  min-height: 0;
  align-self: stretch;
}
.panel-me > * {
  flex-shrink: 0;
}
/* 顶距≈状态栏：PWA 20 / Cap 32；!important 防被 .panel{padding:0} 清掉 */
/* iPhone 8 PWA：勿用 max(var/env)，部分 WebKit 整条声明失效会回落成 0 */
html.standalone .panel-me,
html.standalone .panel.panel-me {
  display: block !important;
  padding-top: 20px !important;
  padding-bottom: 16px !important;
}
html.native-shell .panel-me,
html.native-shell .panel.panel-me {
  display: block !important;
  padding-top: 32px !important;
  padding-bottom: 16px !important;
}
.list-pane.nav-me {
  background: var(--page-bg);
  width: 100%;
  max-width: none;
}
.me-top,
.me-top-title { display: none !important; }
.me-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  overflow: visible;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.88) 100%
  );
  border-radius: var(--radius-md);
  padding: 18px 16px;
  margin: 4px 14px 12px;
  width: auto;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
}
.me-page-avatar {
  width: 64px;
  height: 64px;
  font-size: 24px;
  flex-shrink: 0;
  border-radius: 16px !important;
}
.me-card-info { min-width: 0; flex: 1; }
.me-page-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}
.me-page-user {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.me-page-uid-row {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.me-page-uid-row code {
  font-size: 11px;
  word-break: break-all;
  color: #64748b;
}
.me-menu-group {
  margin: 0 14px 12px;
}
.me-menu {
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.88) 100%
  );
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 100%;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
}
.me-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
}
.me-row:last-child { border-bottom: 0; }
.me-row-arrow { color: #cbd5e1; font-size: 18px; line-height: 1; }
.me-row-toggle { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.me-row-toggle input {
  /* 真开关，不再用原生大方块 checkbox */
  -webkit-appearance: none;
  appearance: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border: 0;
  border-radius: 14px;
  background: #e5e5e5;
  flex-shrink: 0;
  pointer-events: auto;
  position: relative;
  z-index: 1;
  cursor: pointer;
  transition: background .2s ease;
}
.me-row-toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s ease;
}
.me-row-toggle input:checked {
  background: var(--qq);
}
.me-row-toggle input:checked::after {
  transform: translateX(18px);
}
.me-row-danger {
  color: #fa5151;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  width: calc(100% - 28px);
  margin: 4px 14px 0;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}
.me-version {
  margin: 16px 4px 8px;
  text-align: center;
  font-size: 12px;
  color: #b2b2b2;
}
.list-pane.nav-me .search-wrap,
.list-pane.nav-me .main-tab-header { display: none !important; }
/* 我的页整壳铺灰，杜绝白边/登录透底 */
html.nav-me,
html.nav-me body,
.app.nav-me,
.app.nav-me .shell,
.app.nav-me .list-pane {
  background: var(--page-bg) !important;
}
.app.nav-me .shell {
  max-width: none !important;
  width: 100% !important;
  box-shadow: none !important;
}
.app.nav-me .chat-pane {
  display: none !important;
}

/* 聊天 */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 28px;
  gap: 8px;
  background: transparent;
}
.chat-empty[hidden],
#chat-empty[hidden] {
  display: none !important;
}
.chat-empty__mark {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(145deg, #5eead4 0%, #14b8a6 45%, #0d9488 100%);
  box-shadow:
    0 12px 28px rgba(13, 148, 136, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.chat-empty__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.chat-empty__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 220px;
}
.empty-logo {
  font-size: 22px; font-weight: 600; color: #666; letter-spacing: 1px; margin-bottom: 8px;
}
#panel-chats > .empty,
#panel-contacts > .empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}
#chat-active { display: flex; flex-direction: column; height: 100%; min-height: 0; }
#chat-active[hidden] { display: none !important; }

.chat-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 52px;
  padding: max(8px, var(--safe-t)) 8px 10px 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.76) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035);
}
.chat-head__icon-btn,
.back {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  font-size: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}
.chat-head__icon-btn svg,
.back svg {
  width: 28px;
  height: 28px;
  display: block;
}
.chat-head__icon-btn:active,
.back:active {
  background: rgba(15, 23, 42, 0.08);
}
.chat-head__back {
  position: absolute;
  left: 0;
  top: max(8px, var(--safe-t));
  z-index: 2;
}
.chat-head__back:active {
  transform: none;
  opacity: 0.6;
  background: transparent;
}
.chat-head-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  padding: 0 96px 0 48px;
  box-sizing: border-box;
  cursor: pointer;
}
.peer-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}
.peer-status {
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  margin-top: 0;
  text-align: center;
}
.peer-status.peer-typing { color: var(--qq); }
.chat-head__actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}
.ttl-head {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 0;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}
.ttl-head label { color: var(--qq-deep); white-space: nowrap; font-weight: 600; }
.ttl-head select {
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  padding: 2px 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  max-width: 72px;
  outline: none;
  cursor: pointer;
}

.messages {
  flex: 1; overflow-y: auto; padding: 14px 12px; min-height: 0;
  -webkit-overflow-scrolling: touch;
  background: transparent;
}
.row {
  display: flex; gap: 8px; margin-bottom: 14px; align-items: flex-start;
  animation: fadein .18s ease;
}
.row.mine { flex-direction: row-reverse; }
.row .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 14px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.msg-body {
  display: flex;
  flex-direction: column;
  max-width: min(72%, 420px);
  min-width: 0;
}
.row.mine .msg-body { align-items: flex-end; }
.row.peer .msg-body { align-items: flex-start; }
.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  align-items: stretch;
}
.row.mine .msg-bubble-wrap { align-items: flex-end; }
.row.peer .msg-bubble-wrap { align-items: flex-start; }
.quote-bubble-simple {
  display: block;
  margin-top: 6px;
  max-width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
  cursor: pointer;
}
.quote-bubble-simple--in {
  background: rgba(15, 23, 42, 0.06);
  color: #5b6778;
}
.quote-bubble-simple--out {
  background: rgba(4, 47, 46, 0.1);
  color: rgba(4, 47, 46, 0.72);
}
.quote-sender {
  font-weight: 600;
  margin-right: 6px;
  color: var(--qq-deep);
}
.row.quote-flash .bubble {
  outline: 2px solid rgba(13, 148, 136, 0.55);
  outline-offset: 2px;
}
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 0 10px 0;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.reply-bar[hidden] { display: none !important; }
.reply-bar__label {
  flex-shrink: 0;
  color: var(--qq);
  font-weight: 700;
}
.reply-bar__content {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar__cancel {
  flex-shrink: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
}
.msg-menu {
  position: fixed;
  z-index: 70;
  display: flex;
  gap: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm), 0 12px 36px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.8);
  min-width: 160px;
}
.msg-menu[hidden] { display: none !important; }
.msg-menu button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  padding: 11px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.msg-menu button:active { background: rgba(13, 148, 136, 0.1); }
.msg-menu button[hidden] { display: none !important; }
.msg-menu button + button { border-left: 1px solid var(--line); }
.bubble {
  max-width: 100%;
  padding: 8px 14px;
  border-radius: var(--radius-bubble);
  font-size: 16px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: none;
  position: relative;
}
.row.mine .bubble {
  background: var(--bubble-me);
  color: #042f2e;
  box-shadow: var(--shadow-bubble-me);
  border: none;
}
.row.pending .bubble { opacity: 0.72; }
.row.pending .pending-label,
.row.pending-failed .pending-label,
.row.pending .msg-read-status,
.row.pending-failed .msg-read-status {
  font-size: 11px;
  color: #888;
}
.row.pending-failed .bubble { opacity: 0.85; outline: 1px solid #e57373; }
.row.pending-failed .msg-read-status { color: #e57373; }
.row.peer .bubble {
  background: var(--bubble-peer);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-bubble-peer);
}
.bubble-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.2;
  flex-wrap: wrap;
}
.row.mine .bubble-meta { justify-content: flex-end; }
.bubble-meta:empty { display: none; }
/* 气泡外状态：倒计时 / 待已读 / 已读 */
.msg-ttl-status {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.2;
  color: #fa9d3b;
  font-variant-numeric: tabular-nums;
}
.row.mine .msg-ttl-status { text-align: right; }
.msg-ttl-status .ttl-tag { color: inherit; }
.msg-ttl-status .ttl-tag.waiting { color: var(--muted); }
.msg-read-status {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.2;
  color: var(--qq);
  background: transparent !important;
  padding: 0;
  border: 0;
}
.row.mine .msg-read-status { text-align: right; }
.msg-read-status--unread { color: var(--muted); }
.ttl-tag { color: #fa9d3b; font-variant-numeric: tabular-nums; }
.ttl-tag.waiting { color: var(--muted); }
.bubble.media { padding: 4px; background: transparent !important; box-shadow: none; }
.bubble img.chat-img {
  display: block; max-width: min(220px, 62vw); max-height: 280px;
  border-radius: 6px; cursor: zoom-in;
  background: #e8e8e8;
  object-fit: cover;
  content-visibility: auto;
}
.bubble video.chat-vid {
  display: block; max-width: min(240px, 70vw); max-height: 220px;
  border-radius: 6px; background: #000;
}
.chat-vid-lazy {
  position: relative;
  display: block;
  width: min(240px, 70vw);
  max-width: min(240px, 70vw);
  min-height: 120px;
  max-height: 220px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chat-vid-lazy .chat-vid-cover,
.chat-vid-lazy .chat-vid-ph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 120px;
  max-height: 220px;
  object-fit: cover;
  background: #1a1a1a;
}
.chat-vid-lazy .chat-vid-ph {
  min-height: 140px;
}
.chat-vid-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.chat-vid-play::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 13px;
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent #fff;
}
.file-card {
  display: flex; align-items: center; gap: 10px; min-width: 170px; max-width: 250px;
  padding: 10px 12px; border-radius: 8px; background: #fff; text-decoration: none; color: inherit;
}
.row.mine .file-card { background: var(--bubble-me); }
.file-ico {
  width: 36px; height: 36px; border-radius: 6px; background: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--qq); flex-shrink: 0;
}
.file-name {
  font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}
.file-size { font-size: 11px; color: var(--muted); margin-top: 2px; }

.composer {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(255, 255, 255, 0.86) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.55);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 4;
  box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.045);
}
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  min-height: 54px;
  box-sizing: border-box;
}
.input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font: inherit;
  font-size: 16px;
  max-height: 120px;
  outline: none;
  background: rgba(255, 255, 255, 0.96);
  line-height: 1.35;
  min-height: 38px;
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
}
.input-row textarea::placeholder { color: #a8b0bd; }
.tool {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--ink);
  margin-bottom: 1px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.tool-ico {
  display: block;
  color: currentColor;
}
.tool:active { background: rgba(15, 23, 42, 0.08); }
.tool.active {
  background: rgba(13, 148, 136, 0.14);
  box-shadow: none;
  color: var(--qq);
}
.send-btn {
  border: 0;
  background: transparent;
  color: var(--qq);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 16px;
  font-weight: 700;
  height: 38px;
  min-width: 48px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: none;
  letter-spacing: -0.01em;
  margin-bottom: 1px;
  font-family: inherit;
}
.send-btn:active { opacity: 0.65; }
.send-btn[hidden] { display: none !important; }
.send-err {
  margin: 0;
  padding: 0 12px 8px;
  text-align: right;
  display: none;
  font-size: 12px;
}

.plus-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 0;
  padding: 18px 14px 12px;
  background: rgba(248, 250, 252, 0.72);
  border-top: 1px solid var(--line);
}
.plus-panel[hidden] { display: none !important; }
.plus-item {
  border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #64748b; font-size: 12px; font-family: inherit;
}
.plus-item .ico {
  width: 56px; height: 56px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.96);
  display: grid; place-items: center; font-size: 22px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm); font-style: normal;
}

.calc-pad {
  background: rgba(248, 250, 252, 0.72);
  padding: 8px 8px 6px;
  border-top: 1px solid var(--line);
}
.calc-pad[hidden] { display: none !important; }
.calc-lcd {
  display: none; /* 去掉计算器风格顶栏，更接近微信表情面板 */
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px 4px;
  margin-bottom: 6px;
  /* 先露出约 4 行，其余上滑查看 */
  max-height: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.calc-grid button {
  border: 0;
  background: transparent;
  color: #111;
  border-radius: 6px;
  height: 42px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
.calc-grid button.emoji-item {
  display: grid;
  place-items: center;
  padding: 4px;
}
.calc-grid button.emoji-item img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
}
.calc-grid .emoji-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #888;
  font-size: 13px;
  padding: 18px 0;
}
.calc-grid button:active {
  background: rgba(0, 0, 0, .06);
}
.bubble-dy-emoji {
  width: 28px;
  height: 28px;
  vertical-align: -6px;
  margin: 0 1px;
  object-fit: contain;
}
.calc-keys { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 6px; }
.calc-keys button {
  border: 0; height: 36px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.key-ac { background: #e8e8e8; color: #666; }
.key-del { background: #e8e8e8; color: #666; }
.key-eq { background: var(--qq); color: #fff; }

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.88);
  display: grid; place-items: center; z-index: 50; cursor: zoom-out;
}
.lightbox img { max-width: 94vw; max-height: 90vh; }

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

/* —— 电脑自适应：仅鼠标桌面双栏；手机/平板触摸一律单栏平铺 —— */
@media (min-width: 860px) and (hover: hover) and (pointer: fine) {
  body { background: #b7dcf2; padding: 16px; height: 100%; }
  .app:not([hidden]) {
    display: block;
    height: calc(100% - 0px);
  }
  .shell {
    height: calc(100dvh - 32px);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(30, 80, 120, .2);
  }
  .list-pane {
    width: 340px;
    flex: 0 0 340px;
    border-right: 1px solid var(--line);
    display: flex !important;
  }
  .chat-pane {
    display: flex !important;
  }
  .app.show-chat .list-pane { display: flex !important; }
  .back,
  .chat-head__back { display: none; }
  .chat-head-info {
    padding-left: 18px;
    padding-right: 110px;
    align-items: flex-start;
    text-align: left;
  }
  .peer-name,
  .peer-status { text-align: left; }
  .chat-head__actions {
    right: 12px;
  }
  /* PWA/原生壳：即使宽屏也强制手机全宽单栏，消息/联系人铺满 */
  html.standalone body,
  html.native-shell body {
    padding: 0 !important;
    background: #fff !important;
  }
  html.standalone .shell,
  html.native-shell .shell {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  html.standalone .list-pane,
  html.native-shell .list-pane {
    width: 100% !important;
    flex: 1 1 0 !important;
    max-width: none !important;
    border-right: 0 !important;
  }
  html.standalone .chat-pane,
  html.native-shell .chat-pane {
    display: none !important;
  }
  html.standalone .app.show-chat .list-pane,
  html.native-shell .app.show-chat .list-pane {
    display: none !important;
  }
  html.standalone .app.show-chat .chat-pane,
  html.native-shell .app.show-chat .chat-pane {
    display: flex !important;
  }
  html.standalone .back,
  html.native-shell .back {
    display: flex !important;
  }
  /* 以下仅桌面双栏：勿泄漏到手机，否则会冲掉 safe-area */
  .main-tab-header,
  .chat-head {
    height: 62px;
    padding: 0 14px;
    box-sizing: border-box;
    align-items: center;
  }
  .chat-head { padding-right: 12px; }
  .main-tab-header {
    position: relative;
    z-index: 1;
    margin-right: -1px;
    border-right: 1px solid var(--line);
  }
  .tabbar,
  .composer {
    box-sizing: border-box;
    min-height: 56px;
    padding-bottom: 0;
    border-top: 1px solid var(--line);
  }
  .tabbar {
    height: 56px;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
  }
  .composer {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: #f7f7f7;
  }
  .input-row {
    min-height: 55px;
    padding: 10px 12px;
    align-items: center;
    box-sizing: border-box;
  }
  .input-row textarea {
    min-height: 34px;
  }
  .calc-grid {
    grid-template-columns: repeat(8, 1fr);
    max-height: 168px;
  }
}

@media (max-width: 380px) {
  .calc-grid {
    grid-template-columns: repeat(7, 1fr);
    max-height: 168px;
  }
  .qq-body { padding: 14px 20px 18px; }
}

.help-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 8px;
}

/* —— APP 壳 / 安装 —— */
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: block;
  /* 对齐 78：冷启动纯白，不放图标/文案 */
  background: #ffffff;
  transition: opacity .28s ease, visibility .28s ease;
}
.app-splash .splash-logo,
.app-splash .splash-name {
  display: none !important;
}
/* App 壳用原生 Splash，隐藏网页启动图标，避免启动时两个图标 */
html.native-shell .app-splash {
  display: none !important;
}
html.native-shell,
html.native-shell body {
  background: var(--wechat-head) !important;
}
/* 登录页：底色跟蓝渐变起点一致，键盘弹起时不闪系统默认白 */
html.native-shell:not(.disguise-active):not(.app-ready),
html.native-shell:not(.disguise-active):not(.app-ready) body {
  background: #6ec0f2 !important;
}
html.native-shell .auth {
  min-height: 100%;
  height: 100%;
  max-height: 100%;
  position: fixed;
  inset: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  /* 覆盖通用 100dvh，避免 IME 改 visualViewport 时整页塌成白 */
  min-height: 100% !important;
}
html.native-shell.app-ready,
html.native-shell.app-ready body {
  background: var(--wechat-head) !important;
}
html.native-shell .app,
html.native-shell .tabbar {
  background: transparent;
}
html.native-shell .tabbar {
  background: rgba(255, 255, 255, 0.9);
}
/* 登录后盖住固定定位的 #auth，避免「我的」透底 */
html.native-shell.app-ready #auth,
html.app-ready #auth {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}
html.native-shell .app:not([hidden]) {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background: #ffffff;
}
html.native-shell .list-pane.nav-me,
html.native-shell .panel-me {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  background: var(--page-bg) !important;
}
/* 状态栏与页头同色；Android/Cap 常 env=0 但仍沉浸绘制，必须兜底顶距 */
html.native-shell .qq-top,
html.native-shell .main-tab-header,
html.native-shell .chat-head {
  padding-top: calc(10px + var(--safe-t, 32px));
  background: var(--wechat-head);
}
html.native-shell .main-tab-header,
html.native-shell .chat-head {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.76) 100%
  );
}
html.native-shell .chat-head__back {
  top: calc(10px + var(--safe-t, 32px));
}
html.native-shell .me-top {
  display: none !important;
}
html.native-shell.nav-me,
html.native-shell.nav-me body {
  background: var(--page-bg) !important;
}
html.native-shell .chat-pane {
  background: var(--chat-bg);
}
.app-splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-logo {
  text-align: center;
  color: #333;
}
.splash-logo img {
  display: block;
  margin: 0 auto 14px;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
}
.splash-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
}

.install-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(18, 183, 245, .4);
  background: #f0faff;
  color: var(--qq-deep);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.install-btn:active { background: #e4f5ff; }
.install-btn[hidden],
.install-top[hidden] { display: none !important; }

.download-app-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 0;
  /* 对齐登录主色蓝，不用全局 teal */
  background: linear-gradient(180deg, #3fc0ff, #12b7f5);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 12px 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: none;
}
.download-app-btn:active { filter: brightness(.96); }
.download-app-btn[hidden] { display: none !important; }

/* 登录页：说明 / 安装按钮也跟主体蓝 */
.auth .qq-link { color: #12b7f5; }
.auth .install-btn {
  border-color: rgba(18, 183, 245, 0.45);
  color: #12b7f5;
}

.app-download-card { max-width: 360px; }
.app-download-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.download-app-link {
  display: block;
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: linear-gradient(180deg, #3fc0ff, #12b7f5);
  color: #fff;
  font-weight: 600;
}
.download-app-link:active { filter: brightness(.96); }
.app-download-actions .qq-link {
  width: 100%;
  text-align: center;
  padding: 8px;
}

/* 安装成应用后：全屏壳，更像原生小应用 */
html.standalone,
html.standalone body {
  background: #fff !important;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
html.standalone input,
html.standalone textarea {
  user-select: text;
  -webkit-user-select: text;
}
/* 只在页头垫顶部安全区，与状态栏同色融合 */
html.standalone .app {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding-top: 0;
  background: #fff;
  height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  max-height: 100dvh;
}
html.standalone .shell {
  flex: 1 1 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  box-shadow: none;
  background: #fff;
}
html.standalone .list-pane,
html.standalone .chat-pane {
  flex: 1 1 0;
  min-height: 0;
}
html.standalone .list-pane {
  background: var(--chat-bg-mesh);
  background-color: var(--page-bg);
}
html.standalone .list-pane.nav-me {
  background: var(--page-bg);
}
html.standalone .panel {
  background: transparent;
  padding: 0;
}
html.standalone .panel.panel-me {
  display: block !important;
  width: 100%;
  max-width: none;
  background: var(--page-bg);
  padding-top: 20px !important;
  padding-bottom: 16px !important;
}
html.native-shell .panel.panel-me {
  display: block !important;
  width: 100%;
  max-width: none;
  background: var(--page-bg);
  padding-top: 32px !important;
  padding-bottom: 16px !important;
}
/* 消息/联系人：保持玻璃卡片，不要微信平灰全宽 */
html.standalone #panel-chats,
html.standalone #panel-contacts,
html.native-shell #panel-chats,
html.native-shell #panel-contacts {
  padding: 0 0 8px !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  background: transparent !important;
}
html.standalone .list,
html.native-shell .list {
  margin: 0 !important;
  padding: 4px 0 10px !important;
  width: 100% !important;
}
html.standalone .search-wrap {
  background: transparent;
  border-bottom: none;
  padding: 10px 14px 8px;
  gap: 8px;
}
html.standalone .search {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
}
html.standalone .main-tab-header,
html.standalone .qq-top,
html.standalone .chat-head,
html.standalone .me-top {
  padding-top: calc(10px + var(--safe-t));
}
html.standalone .main-tab-header {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.76) 100%
  );
}
html.standalone .chat-head {
  padding-left: 0;
  padding-right: 8px;
  padding-bottom: 10px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.76) 100%
  );
}
html.standalone .chat-head__back {
  top: calc(10px + var(--safe-t));
}
html.standalone .tabbar {
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  padding: 4px 0 max(4px, env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.045);
  margin-top: auto;
}
html.standalone .auth {
  /* 解锁后若需登录，不要纯白底看起来像白屏 */
  background:
    radial-gradient(800px 420px at 15% 0%, #9ad8ff 0%, transparent 55%),
    linear-gradient(165deg, #6ec0f2 0%, #b7e3ff 45%, #eaf7ff 100%) !important;
  padding: calc(12px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  box-sizing: border-box;
}
html.native-shell .auth {
  background:
    radial-gradient(800px 420px at 15% 0%, #9ad8ff 0%, transparent 55%),
    linear-gradient(165deg, #6ec0f2 0%, #b7e3ff 45%, #eaf7ff 100%) !important;
}
html.standalone .qq-win {
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 40, 80, .2);
}
html.standalone .qq-winbtns { display: none; }
html.standalone .install-btn,
html.standalone .install-top { display: none !important; }

@media (display-mode: standalone), (display-mode: fullscreen) {
  .install-btn,
  .install-top { display: none !important; }
  .app {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding-top: 0;
    background: var(--page-bg);
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    max-height: 100dvh;
  }
  .main-tab-header {
    padding-top: calc(10px + var(--safe-t));
  }
  .chat-head {
    padding-top: calc(10px + var(--safe-t));
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.9) 0%,
      rgba(255, 255, 255, 0.76) 100%
    );
  }
  .chat-head__back {
    top: calc(10px + var(--safe-t));
  }
  .shell {
    flex: 1 1 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    box-shadow: none;
  }
  .list-pane,
  .chat-pane {
    flex: 1 1 0;
    min-height: 0;
  }
  .list-pane {
    background: transparent;
  }
  .list-pane.nav-me {
    background: var(--page-bg);
  }
  .panel {
    background: transparent;
    padding: 0;
  }
  .panel.panel-me {
    display: block !important;
    padding-top: 20px !important;
    padding-bottom: 16px !important;
    background: var(--page-bg);
  }
  body {
    padding: 0 !important;
    background: var(--page-bg) !important;
  }
  .shell {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    height: 100% !important;
    max-height: none !important;
  }
  .list-pane {
    width: 100% !important;
    flex: 1 1 0 !important;
    border-right: 0 !important;
  }
  .chat-pane {
    display: none !important;
  }
  .app.show-chat .list-pane {
    display: none !important;
  }
  .app.show-chat .chat-pane {
    display: flex !important;
  }
  .tabbar {
    background: #fff;
    box-shadow: 0 -1px 8px rgba(0, 0, 0, .04);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom, 0px));
    margin-top: auto;
  }
}

/* —— PWA 诊断面板 —— */
.diag-panel {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, .45);
  display: grid;
  place-items: end;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.diag-panel[hidden] { display: none !important; }
.diag-card {
  width: min(480px, 100%);
  max-height: min(78vh, 620px);
  background: #fff;
  border-radius: 14px 14px 12px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}
.diag-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #12b7f5;
  color: #fff;
}
.diag-x {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.diag-body {
  padding: 12px 14px;
  overflow-y: auto;
  flex: 1;
}
.diag-tip {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.55;
  color: #666;
}
.diag-list { font-size: 13px; }
.diag-row {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  align-items: flex-start;
}
.diag-row:last-child { border-bottom: 0; }
.diag-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}
.diag-tag.ok { background: #e8f8ef; color: var(--qq); }
.diag-tag.warn { background: #fff7e6; color: #fa8c16; }
.diag-tag.bad { background: #ffecec; color: #fa5151; }
.diag-name { font-weight: 600; }
.diag-detail { color: #888; margin-top: 2px; word-break: break-all; font-size: 12px; }
.diag-foot {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #eee;
}
.diag-btn {
  border: 0;
  border-radius: 8px;
  background: #12b7f5;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 6px;
}
.diag-btn.sec { background: #f5f6f8; color: #333; }

/* —— 计算器伪装壳（浅色） —— */
/* 对齐 Y：壳层 overlay，仅 visibility 在滑动/多任务时仍可能合成露聊天 */
.shell-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: #f2f2f7;
  display: none;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}
html.disguise-active .shell-overlay,
html.disguise-boot .shell-overlay,
html.chat-sealed .shell-overlay,
.shell-overlay.shell-overlay--on {
  display: block;
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}

html.disguise-active,
html.disguise-active body {
  background: #f2f2f7 !important;
  color-scheme: only light !important;
  overflow-x: hidden !important;
  overscroll-behavior-x: none !important;
  overscroll-behavior-y: none;
  touch-action: pan-y !important;
}
/* display:none：仅 visibility 在横滑/橡皮筋时仍会合成露聊天（对齐 Y） */
html.disguise-active #app-splash,
html.disguise-active #auth,
html.disguise-active #app,
html.chat-sealed #app,
html.chat-sealed #auth {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}
html.disguise-active.native-shell,
html.disguise-active.native-shell body {
  background: #f2f2f7 !important;
}

.calc-shell {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10050;
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  flex-direction: column;
  overflow: hidden;
  overflow-x: hidden !important;
  background: #f2f2f7;
  color: #1c1c1e;
  padding: 0;
  box-sizing: border-box;
  justify-content: flex-end;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y !important;
  overscroll-behavior-x: none !important;
}
html.disguise-active .calc-shell {
  display: flex;
}
html.disguise-active .calc-shell,
html.disguise-active .calc-shell * {
  overscroll-behavior-x: none !important;
  touch-action: pan-y !important;
}

.calc-shell__intro-veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: #f2f2f7;
  opacity: 0;
  transition: opacity 0.62s ease;
}
.calc-shell--intro .calc-shell__intro-veil { opacity: 1; }
.calc-shell--intro.calc-shell--intro-in .calc-shell__intro-veil { opacity: 0; }
.calc-shell--intro .calc-shell__history,
.calc-shell--intro .calc-shell__stage,
.calc-shell--intro .calc-shell__keys {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
}
.calc-shell--intro.calc-shell--intro-in .calc-shell__history,
.calc-shell--intro.calc-shell--intro-in .calc-shell__stage,
.calc-shell--intro.calc-shell--intro-in .calc-shell__keys {
  opacity: 1;
  transform: none;
  transition: opacity 0.68s ease, transform 0.74s cubic-bezier(0.22, 1, 0.36, 1);
}
.calc-shell--intro.calc-shell--intro-in .calc-shell__stage { transition-delay: 0.04s; }
.calc-shell--intro.calc-shell--intro-in .calc-shell__keys { transition-delay: 0.08s; }

.calc-shell__history {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: min(72vw, 280px);
}
.calc-shell__history-item {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(28, 28, 30, 0.38);
  font-size: clamp(16px, 4.6vw, 20px);
  font-weight: 400;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.calc-shell__history-item:active { opacity: 0.7; }
.calc-shell__history-expr {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calc-shell__history-eq { flex: 0 0 auto; opacity: 0.8; }
.calc-shell__history-result {
  flex: 0 0 auto;
  color: rgba(28, 28, 30, 0.62);
}

.calc-shell__stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: max(72px, calc(env(safe-area-inset-top, 0px) + 64px)) 24px 0;
  box-sizing: border-box;
  overflow: hidden;
}
.calc-shell__unlock-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 18px;
  margin-bottom: 6px;
  color: rgba(28, 28, 30, 0.42);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.calc-shell__display {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 0 20px;
  font-size: clamp(64px, 20vw, 96px);
  font-weight: 200;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  overflow: hidden;
  width: 100%;
  color: #1c1c1e;
}
.calc-shell__display--small { font-size: clamp(48px, 14vw, 72px); }
.calc-shell__display--tiny { font-size: clamp(36px, 10vw, 56px); letter-spacing: -0.01em; }

.calc-shell__keys {
  --calc-pad: 12px;
  --calc-gap: 12px;
  --calc-btn: min(80px, calc((100vw - var(--calc-pad) * 2 - var(--calc-gap) * 3) / 4));
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, var(--calc-btn));
  grid-auto-rows: var(--calc-btn);
  gap: var(--calc-gap);
  padding: var(--calc-pad) var(--calc-pad) max(16px, env(safe-area-inset-bottom, 0px));
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

.calc-shell .calc-key {
  border: none;
  margin: 0;
  padding: 0;
  width: var(--calc-btn);
  height: var(--calc-btn);
  border-radius: 50%;
  font-size: clamp(32px, 8.8vw, 40px);
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  color: #1c1c1e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.calc-shell .calc-key--fn {
  background: #e5e5ea;
  color: #1c1c1e;
  font-size: clamp(28px, 7.5vw, 36px);
}
.calc-shell .calc-key--num {
  background: #ffffff;
  color: #1c1c1e;
}
.calc-shell .calc-key--op {
  background: #ff9f0a;
  color: #fff;
  font-size: clamp(36px, 10vw, 46px);
  box-shadow: 0 1px 3px rgba(255, 159, 10, 0.35);
}
.calc-shell .calc-key--op.calc-key--selected {
  background: #fff;
  color: #ff9f0a;
  box-shadow: inset 0 0 0 2px #ff9f0a;
}
.calc-shell .calc-key--zero {
  grid-column: span 2;
  width: calc(var(--calc-btn) * 2 + var(--calc-gap));
  height: var(--calc-btn);
  border-radius: calc(var(--calc-btn) / 2);
  justify-content: flex-start;
  padding-left: calc(var(--calc-btn) * 0.36);
}
.calc-shell .calc-key--decimal {
  font-size: clamp(36px, 10vw, 46px);
  font-weight: 500;
}
.calc-shell .calc-key__decimal-wrap {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
}
.calc-shell .calc-key__decimal-label {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
  pointer-events: none;
}
.calc-shell .calc-key__msg-dot {
  position: absolute;
  left: 50%;
  bottom: 0.12em;
  transform: translate(-50%, 50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 6px rgba(255, 59, 48, 0.65);
  pointer-events: none;
}
.calc-shell .calc-key--fn:active { background: #d1d1d6; }
.calc-shell .calc-key--num:active { background: #e8e8ed; }
.calc-shell .calc-key--op:active { background: #ffb340; }
.calc-shell .calc-key--op.calc-key--selected:active {
  background: #fff7eb;
  color: #ff9f0a;
}

/* —— 伪装设置子页 / 一键回壳 / 假空间（对齐密聊） —— */
.sub-page {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
  color: #111;
}
.sub-page[hidden] { display: none !important; }
.sub-page__header {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
  background: var(--page-bg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.sub-page__back {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #111;
  cursor: pointer;
}
.sub-page__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.sub-page__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px calc(24px + env(safe-area-inset-bottom, 0px));
}
.sub-page .contact-section {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}
.setting-row-hint {
  margin: -4px 16px 12px;
  font-size: 12px;
  color: #888;
  line-height: 1.4;
}
.profile-tip {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 13px;
  text-align: center;
}
.profile-tip[hidden] { display: none !important; }

.cover-shell-fab {
  position: fixed;
  right: 18px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #e11d48;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cover-shell-fab[hidden] { display: none !important; }
.cover-shell-fab:active { transform: scale(0.96); }
.cover-shell-fab__tip {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  z-index: 201;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.cover-shell-fab__tip[hidden] { display: none !important; }
html.disguise-active .cover-shell-fab,
html.disguise-active .cover-shell-fab__tip,
html.decoy-active .cover-shell-fab,
html.decoy-active .cover-shell-fab__tip {
  display: none !important;
}

.decoy-shell {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  flex-direction: column;
  background: #f5f5f7;
  color: #111;
  overflow: hidden;
}
.decoy-shell[hidden] { display: none !important; }
.decoy-shell__head {
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 12px;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}
.decoy-shell__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.decoy-shell__sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: #888;
}
.decoy-shell__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px calc(24px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 10px;
}
.decoy-tool {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: pointer;
}
.decoy-tool strong { display: block; font-size: 16px; }
.decoy-tool p { margin: 6px 0 0; font-size: 13px; color: #888; }
.decoy-tool-panel {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #f5f5f7;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}
.decoy-tool-panel[hidden] { display: none !important; }
.decoy-tool-back {
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--qq);
  padding: 0 0 12px;
  cursor: pointer;
}
.decoy-tool-title { margin: 0 0 14px; font-size: 18px; }
.decoy-tool-form {
  display: grid;
  gap: 10px;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
}
.decoy-tool-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #666;
}
.decoy-tool-form input,
.decoy-tool-form select {
  height: 40px;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
}
.decoy-tool-form button {
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--qq);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.decoy-tool-result {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  color: #111;
  min-height: 1.4em;
}
html.decoy-active #app,
html.decoy-active #auth,
html.decoy-active #app-splash,
html.decoy-active .shell-overlay,
html.decoy-active .calc-shell {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
html.decoy-active,
html.decoy-active body {
  overflow: hidden !important;
  background: #f5f5f7 !important;
}
/* 壳上锁横向侧滑，避免露聊天 */
html.disguise-active,
html.disguise-active body {
  overflow-x: hidden !important;
  overscroll-behavior-x: none !important;
  touch-action: pan-y !important;
}
html.disguise-active #app {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
