:root {
  --accent: #30a1db;
  --accent-hover: #2890c7;
  --action-tile-bg: #d6ebf7;
  --action-tile-bg-active: #c2e0f4;
  --accent-soft: rgba(48, 161, 219, 0.14);
  --bg-page: #f5f7fa;
  --bg-header: #eef2f6;
  --bubble: #ffffff;
  --bubble-border: #e8ecf1;
  --text: #1c1c1e;
  --text-muted: #8e8e93;
  --text-user: #30a1db;
  --nav-inactive: #8e8e93;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* 会话顶栏：为 Telegram 原生「关闭」胶囊预留横向空间（略小于部分机型实际宽度，可按需微调） */
  --session-header-clear-close: 76px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  font-family: var(--font);
  background: var(--tg-theme-bg-color, var(--bg-page));
  color: var(--tg-theme-text-color, var(--text));
  -webkit-tap-highlight-color: transparent;
}

.app {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* 手机端原 480px 限制改为全宽，便于电脑 Telegram 客户端宽屏/接近满屏显示 */
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: calc(52px + var(--safe-bottom));
  overflow: hidden;
  box-sizing: border-box;
}

/* 「窗口大」：与 `.app` 默认一致，整页满宽；Telegram 侧由 app.js expand/requestFullscreen 尽量铺满视口 */

.header-simple {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* —— 顶栏（对齐参考图：浅灰底、标题偏左、四键浅蓝方格） —— */
.header {
  flex-shrink: 0;
  background: var(--tg-theme-secondary-bg-color, var(--bg-header));
  padding: 8px 12px 10px;
  padding-top: calc(6px + var(--safe-top));
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* 会话顶栏首行：仅副标题时为文案避让 Telegram「关闭」；无副标题时由 :has 折叠 */
#panel-sessions .header.header-simple .header-top--sessions-subonly {
  padding-left: calc(var(--safe-left) + var(--session-header-clear-close));
}

#panel-sessions .header.header-simple .header-top--sessions-subonly:has(#session-header-sub[hidden]) {
  display: none;
  margin-bottom: 0;
  padding-left: 0;
}

.session-header-text--subrow {
  flex: 1;
  min-width: 0;
  width: 100%;
}

#panel-sessions .session-header-text--subrow .session-header-sub {
  margin-top: 0;
}

.header-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.header-top-spacer {
  width: 36px;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn-icon--plain {
  background: transparent;
  box-shadow: none;
}

.header-title {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.header-title--left {
  text-align: left;
  padding-top: 6px;
  padding-right: 4px;
}

/* 群组主界面：标题在 Mini App 内容区水平居中，两侧留与 Telegram 顶栏按钮对称的占位 */
.header-top--title-screen-center {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: flex-start;
  column-gap: 8px;
}

.header-top--title-screen-center .header-top-spacer {
  width: 36px;
  max-width: 36px;
}

.header-top--title-screen-center .header-top-spacer:first-child {
  justify-self: start;
}

.header-top--title-screen-center .header-top-spacer:last-child {
  justify-self: end;
}

.header-top--title-screen-center .header-title {
  flex: unset;
  margin: 0;
  min-width: 0;
  padding-top: 6px;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
  justify-self: center;
  max-width: 100%;
}

/* 群组顶栏：浅蓝圆角方格 + 上图标下文字（含分享、商家列表等） */
.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 8px;
}

.header-action {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* 「成员」仅管理员可见：不依赖是否带 .header-action（避免选择器失配）；默认隐藏 */
#act-members {
  display: none !important;
  flex: 0 0 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

#act-members.header-action--visible-admin {
  display: flex !important;
  flex: 1 !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.header-action:active .header-action-box {
  background: var(--action-tile-bg-active);
  transform: scale(0.97);
}

.header-action-box {
  width: 100%;
  max-width: 72px;
  aspect-ratio: 1;
  max-height: 56px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--action-tile-bg);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.header-action svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-action-label {
  font-size: 11px;
  color: #636366;
  font-weight: 500;
  line-height: 1;
}

/* —— 群聊同步状态（全员可见 / 仅本机） —— */
.chat-sync-bar {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 12px;
  margin: 0;
  background: rgba(0, 0, 0, 0.04);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.chat-sync-bar--ok {
  color: #1f7a3a;
  background: rgba(31, 122, 58, 0.08);
}

.chat-sync-bar--bad {
  color: #b00020;
  background: rgba(176, 0, 32, 0.06);
}

/* —— Mini App 滚动公告（群组 / 会话）：双段无缝循环，translate 从左向右匀速（keyframes 由 JS 注入固定 px） —— */
.miniapp-marquee-wrap {
  flex-shrink: 0;
  align-self: stretch;
  width: 100%;
  height: 30px;
  line-height: 30px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(0, 122, 255, 0.07), rgba(0, 122, 255, 0.04));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 12px;
  font-weight: 500;
  color: #0a5cad;
}

.miniapp-marquee-wrap[hidden] {
  display: none !important;
}

.miniapp-marquee-viewport {
  overflow: hidden;
  width: 100%;
  height: 100%;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  transform: translateZ(0);
  isolation: isolate;
}

.miniapp-marquee-track {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  white-space: nowrap;
  width: max-content;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  contain: layout style;
  /* 动画名与 @keyframes 由 JS 按像素注入，避免 var() 在 keyframes 里插值异常导致顿挫 */
  animation: none;
}

/* Telegram 式超链接：与 Bot HTML 中 <a href> 一致，蓝色可点 */
.miniapp-marquee-wrap a.miniapp-marquee-a {
  color: #0b69c9;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  pointer-events: auto;
  font-weight: 600;
}

.miniapp-marquee-segment {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  /* 段与段之间的接缝；文案内部间隔由 JS 插入的 miniapp-marquee-gap 控制 */
  padding-right: 0.6em;
}

.miniapp-marquee-gap {
  opacity: 0.75;
  font-weight: inherit;
}

/* 多条公告之间的视觉间隔（竖线 + 全角空距） */
.miniapp-marquee-between {
  opacity: 0.72;
  font-weight: 500;
  padding: 0 0.15em;
}

/* 电脑宽屏：滚动公告更靠顶栏、字号加大加粗（与窄屏区分） */
@media (min-width: 900px) {
  .miniapp-marquee-wrap {
    height: 44px;
    line-height: 44px;
    font-size: 17px;
    font-weight: 700;
  }
  .miniapp-marquee-wrap a.miniapp-marquee-a {
    font-size: 17px;
    font-weight: 700;
  }
  /* 宽屏全幅跑马灯，不靠两侧渐变遮罩裁切 */
  .miniapp-marquee-viewport {
    mask-image: none;
    -webkit-mask-image: none;
  }
}

/* 会话 / 群组：跑马灯与消息区之间，右侧三键一排（勿再用 flex:1 占位把键区挤出可视区） */
.chat-top-util-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 36px;
  padding: 4px 10px 6px;
  box-sizing: border-box;
  gap: 0;
  background: var(--tg-theme-bg-color, var(--bg-page));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  overflow-x: visible;
  overflow-y: visible;
}

.chat-top-util-spacer {
  display: none;
}

/* 三个工具按钮成组，Telegram WebView 强缓存旧 HTML 时由内联/ app.js 补全 */
.chat-top-util-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 0 0 auto;
  flex-shrink: 0;
  gap: 5px;
  padding: 2px 4px;
  border-radius: 12px;
  margin-left: auto;
  background: rgba(0, 122, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.14);
  max-width: 100%;
}

.sound-toggle-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  color: #0b69c9;
  background: rgba(0, 122, 255, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.screen-size-toggle-btn {
  width: 34px;
  position: relative;
}

/* 中间的「本屏」键：虚线描边，与左右两键区分 */
.sound-toggle-btn.layout-mode-toggle-btn {
  border: 1px dashed rgba(11, 105, 201, 0.55);
  box-sizing: border-box;
}

/* 大/小窗切换：角标一眼可辨，避免与「本屏布局」仅看图标混淆 */
.screen-size-toggle-btn .screen-size-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  pointer-events: none;
  color: inherit;
  opacity: 0.92;
}

.screen-size-toggle-btn--small {
  color: #0b69c9;
  background: rgba(0, 122, 255, 0.1);
}

.screen-size-toggle-btn--large {
  color: #fff;
  background: linear-gradient(180deg, #2c8df0, #1f75d7);
}

.screen-size-toggle-btn--large .screen-size-badge {
  color: #fff;
  opacity: 0.95;
}

.screen-size-toggle-btn svg[hidden],
.layout-mode-toggle-btn svg[hidden] {
  display: none;
}

.sound-toggle-btn.sound-toggle-btn--muted {
  color: #6b7280;
  background: rgba(0, 0, 0, 0.05);
}

.sound-toggle-btn:active {
  transform: scale(0.96);
}

.sound-toggle-btn svg[hidden] {
  display: none;
}

/* —— 消息列表 —— */
.feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 10px;
  -webkit-overflow-scrolling: touch;
  background: var(--tg-theme-bg-color, var(--bg-page));
  display: flex;
  flex-direction: column;
}

/* 聊天区自定义背景：任意比例图片铺满可视区域、居中裁剪（cover），由脚本在设图时加 .feed--has-chat-bg */
.feed.feed--has-chat-bg {
  background-color: var(--tg-theme-bg-color, var(--bg-page));
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  -webkit-background-size: cover;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/*
 * 开启聊天背景图时（群组 #feed、会话 #session-feed 均为 .feed）：尽量透出底图，
 * 仅用极轻磨砂 + 文字阴影保证可读，避免大 blur 把背景糊掉。
 */
.feed.feed--has-chat-bg .bubble {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(232, 236, 241, 0.28);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  -webkit-backdrop-filter: blur(3px) saturate(1.05);
  backdrop-filter: blur(3px) saturate(1.05);
}

.feed.feed--has-chat-bg .bubble--self {
  background: linear-gradient(
    180deg,
    rgba(227, 244, 252, 0.22) 0%,
    rgba(214, 238, 249, 0.22) 100%
  );
  border-color: rgba(184, 220, 239, 0.26);
}

.feed.feed--has-chat-bg .bubble-actions-side button {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(232, 236, 241, 0.24);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* 高透背景下：正文与用户一致加黑加粗 + 亮边晕影；文内 @提及 / 超链同步，避免单独发蓝发灰 */
.feed.feed--has-chat-bg .bubble .text {
  color: #121212;
  font-weight: 700;
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.92),
    0 0 10px rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.28);
}

.feed.feed--has-chat-bg .bubble .text .mention-highlight,
.feed.feed--has-chat-bg .bubble .text a {
  color: #121212;
  font-weight: 700;
}

.feed.feed--has-chat-bg .bubble .text a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.feed.feed--has-chat-bg .bubble .user,
.feed.feed--has-chat-bg .bubble button.msg-user-link {
  color: #121212;
  font-weight: 700;
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.92),
    0 0 10px rgba(255, 255, 255, 0.55),
    0 1px 2px rgba(0, 0, 0, 0.3);
}

.feed.feed--has-chat-bg .bubble .time {
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.9),
    0 0 8px rgba(255, 255, 255, 0.55),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

.feed.feed--has-chat-bg .bubble .bubble-reply-user,
.feed.feed--has-chat-bg .bubble .bubble-reply-text,
.feed.feed--has-chat-bg .bubble .bubble-reply-time {
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.9),
    0 0 8px rgba(255, 255, 255, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.25);
}

.feed.feed--has-chat-bg .bubble .bubble-reply-jump {
  background: rgba(48, 161, 219, 0.2);
  box-shadow: inset 0 0 0 1px rgba(48, 161, 219, 0.18);
}

.feed.feed--has-chat-bg .bubble--self .bubble-reply-jump {
  background: rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 0 0 1px rgba(29, 143, 196, 0.18);
}

.feed.feed--has-chat-bg .bubble .bubble-attach-link {
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.92),
    0 0 8px rgba(255, 255, 255, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.25);
}

/* 群组页：禁止系统长按划选/跨气泡「全选」（Telegram WebView 默认会选中相邻文字）；长按仅走脚本的「回复」菜单 */
#panel-group-room #feed .bubble,
#panel-group-room #feed .bubble * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 会话私聊：与群组一致，禁止系统长按划选（否则出现灰层、选择柄，与「回复」菜单重叠错位） */
#panel-sessions #session-feed .bubble,
#panel-sessions #session-feed .bubble * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.feed > .msg-row:first-child {
  margin-top: auto;
}

/* 点击引用跳转后短暂高亮原消息所在行 */
@keyframes msg-row-jump-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(48, 161, 219, 0.55);
  }
  35% {
    box-shadow: 0 0 0 5px rgba(48, 161, 219, 0.2);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(48, 161, 219, 0);
  }
}
.msg-row--jump-flash {
  animation: msg-row-jump-flash 0.75s ease-out 2;
  border-radius: 14px;
  position: relative;
  z-index: 2;
}

.msg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-end;
  width: 100%;
}

/* 他人：头像在左，气泡在左 */
.msg-row--other {
  justify-content: flex-start;
}

.msg-row--other .msg-body {
  /* 勿 flex:1 铺满整行；随气泡内容变窄，最长不超过 78% */
  flex: 0 1 auto;
  min-width: 0;
  max-width: 78%;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

/* 本人：整体靠右，气泡在右、头像在最右 */
.msg-row--self {
  justify-content: flex-end;
}

.msg-row--self .msg-body {
  flex: 0 1 auto;
  max-width: 78%;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-direction: row-reverse;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(145deg, #b8c5d6, #8b9bb0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
  font-weight: 600;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  position: relative;
}

.avatar img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 1;
}

.avatar-letter {
  position: relative;
  z-index: 0;
  line-height: 1;
}

.bubble {
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--bubble);
  border: 1px solid var(--bubble-border);
  border-radius: 14px;
  /* 右侧为绝对定位时间戳留出宽度，避免极短正文与时间重叠 */
  padding: 10px 4.25rem 22px 12px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* 本人气泡：浅蓝底，与左侧他人区分 */
.bubble--self {
  background: linear-gradient(180deg, #e3f4fc 0%, #d6eef9 100%);
  border-color: #b8dcef;
}

.msg-row--self .bubble {
  flex: 0 1 auto;
}

.bubble .user {
  font-size: 14px;
  color: var(--text-user);
  font-weight: 500;
  margin-bottom: 5px;
  width: fit-content;
  max-width: 100%;
}

/* 群聊：点击对方用户名进入「会话」 */
.bubble button.msg-user-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--text-user);
  font-weight: 500;
  margin: 0 0 5px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bubble button.msg-user-link:active {
  opacity: 0.72;
}

.bubble .text {
  align-self: stretch;
  min-width: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.bubble .time {
  position: absolute;
  right: 10px;
  bottom: 7px;
  font-size: 11px;
  color: var(--text-muted);
}

/* 参考图：操作条在气泡右侧竖排 */
.bubble-actions-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.bubble-actions-side button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--bubble-border);
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.bubble-actions-side button:active {
  background: #f2f2f7;
}

/* —— 群组引用回复预览（气泡内，仿 Telegram 嵌套条，可点击跳转原消息） —— */
.bubble-reply-jump {
  display: block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 8px;
  padding: 7px 10px 7px 11px;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  text-align: start;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-inline-start: 3px solid var(--accent, #30a1db);
  background: rgba(48, 161, 219, 0.14);
  box-shadow: inset 0 0 0 1px rgba(48, 161, 219, 0.15);
}
.bubble-reply-jump:active {
  opacity: 0.9;
  filter: brightness(0.97);
}
.bubble--self .bubble-reply-jump {
  border-inline-start-color: #1d8fc4;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(29, 143, 196, 0.2);
}
.bubble-reply-user {
  font-weight: 600;
  font-size: 13px;
  color: var(--accent, #1d8fc4);
  margin-bottom: 4px;
}
.bubble--self .bubble-reply-user {
  color: #0b6a94;
}
.bubble-reply-text {
  color: #334155;
  word-break: break-word;
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
  max-height: min(50vh, 28rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bubble--self .bubble-reply-text {
  color: #1e293b;
}
.bubble-reply-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  text-align: right;
}
.bubble--self .bubble-reply-time {
  color: #64748b;
}

/* —— 群组长按「回复」菜单 —— */
.group-msg-ctx-menu {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  min-width: 148px;
}
.group-msg-ctx-item + .group-msg-ctx-item {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.group-msg-ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: #fff;
  padding: 14px 18px;
  font-size: 16px;
  text-align: left;
  font-family: inherit;
  color: #111;
  cursor: pointer;
}
.group-msg-ctx-item:active {
  background: #f1f5f9;
}

/* —— 群组输入框上方引用条 —— */
.group-reply-bar {
  flex-shrink: 0;
  padding: 8px 12px;
  background: #dfe8f2;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 13px;
}
.group-reply-bar-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.group-reply-bar-title {
  color: var(--accent, #30a1db);
  font-weight: 600;
  flex-shrink: 0;
}
.group-reply-bar-jump {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent, #1d8fc4);
  text-align: start;
  line-height: 1.4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(29, 143, 196, 0.65);
  text-underline-offset: 3px;
}
.group-reply-bar-jump:active {
  color: #0b6a94;
  text-decoration-color: rgba(11, 106, 148, 0.75);
}
.group-reply-bar-jump #group-reply-preview-text,
.group-reply-bar-jump span {
  display: block;
  max-height: min(30vh, 12rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  word-break: break-word;
  white-space: pre-wrap;
}
.group-reply-bar-dismiss {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #64748b;
  padding: 0 2px;
  cursor: pointer;
  flex-shrink: 0;
}

/* —— 输入区 —— */
.composer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px;
  padding-bottom: max(10px, var(--safe-bottom));
  background: #e8ecf0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 50;
}

.composer input {
  flex: 1;
  height: 42px;
  border: 1px solid #dde3ea;
  border-radius: 21px;
  padding: 0 16px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  outline: none;
}

.composer input::placeholder {
  color: #aeaeb2;
}

.composer .send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(48, 161, 219, 0.45);
  transition: opacity 0.15s ease, transform 0.15s ease, width 0.15s ease, padding 0.15s ease, margin 0.15s ease;
}

.composer .send.send--hidden {
  opacity: 0;
  width: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
  box-shadow: none;
}

.composer .send:active {
  background: var(--accent-hover);
  transform: scale(0.96);
}

.composer .composer-emoji-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--accent, #30a1db);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.composer .composer-emoji-btn:active {
  opacity: 0.72;
  transform: scale(0.94);
}

.miniapp-emoji-panel {
  position: fixed;
  z-index: 650;
  left: 8px;
  right: 8px;
  width: auto;
  max-width: 320px;
  margin: 0 auto;
  max-height: min(42vh, 300px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.miniapp-emoji-panel[hidden] {
  display: none !important;
}

.miniapp-emoji-panel-head {
  flex-shrink: 0;
  padding: 10px 12px 6px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.miniapp-emoji-panel-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px 6px 10px;
}

.miniapp-emoji-cell {
  border: none;
  margin: 0;
  padding: 6px 0;
  background: transparent;
  font-size: 26px;
  line-height: 1.2;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.miniapp-emoji-cell:active {
  background: rgba(48, 161, 219, 0.16);
}

.composer--with-attach .composer-attach-wrap {
  position: relative;
  flex-shrink: 0;
}
.composer-attach-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #dde3ea;
  background: #fff;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.composer-attach-btn:active {
  background: #f1f5f9;
  transform: scale(0.96);
}
.composer-attach-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  z-index: 200;
}

/* 群组页：底栏 fixed z-index:100，输入条 z-index:50 时弹出菜单易落在错误层叠上下文下；抬高避免部分 WebView 点附件闪退 */
#panel-group-room .composer {
  z-index: 120;
  overflow: visible;
}

#panel-group-room .composer-attach-menu {
  z-index: 300;
}

/* 群组 file input 移到 body 后隐藏展示（勿用 display:none，部分 WebView 下 label 关联会闪退） */
.mlkk-sr-file-input {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  width: 0.01px !important;
  height: 0.01px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  pointer-events: none !important;
}
.composer-attach-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: #fff;
  padding: 14px 18px;
  font-size: 16px;
  text-align: left;
  font-family: inherit;
  color: #111;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
.composer-attach-menu-item:active {
  background: #f1f5f9;
}

.bubble-attach {
  margin: 0 0 8px;
  border-radius: 10px;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}
.bubble-attach--image img {
  display: block;
  max-width: 100%;
  max-height: min(50vh, 320px);
  width: auto;
  height: auto;
  border-radius: 8px;
  vertical-align: middle;
}
.bubble-attach--video video {
  display: block;
  max-width: 100%;
  max-height: min(50vh, 320px);
  border-radius: 8px;
  background: #000;
}
.bubble-attach--audio audio {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 40px;
  margin: 4px 0;
}
.bubble-attach-link {
  display: inline-block;
  font-size: 15px;
  color: var(--accent, #1d8fc4);
  word-break: break-all;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* —— 底栏（选中项蓝色加粗，与参考图一致） —— */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  min-height: calc(52px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  padding-top: 4px;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  border: none;
  background: transparent;
  color: var(--nav-inactive);
  cursor: pointer;
  font-family: inherit;
}

.nav-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
}

.nav-icon-wrap--badge-host {
  position: relative;
}

.nav-icon-wrap--badge-host > svg {
  position: relative;
  z-index: 0;
}

/* 在「会话」页时，群组有新消息：图标右上角小红点 */
.nav-dot {
  position: absolute;
  top: -3px;
  right: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  z-index: 5;
  pointer-events: none;
}

.nav-dot[hidden] {
  display: none !important;
}

/* 群组页有新会话：会话项在红与固定蓝之间闪烁（避免 Telegram 主题 --accent 过浅导致「看不出变化」） */
@keyframes nav-session-alert-blink {
  0%,
  100% {
    color: #d32f2f;
  }
  50% {
    color: #2481cc;
  }
}

@keyframes nav-session-alert-blink-label {
  0%,
  100% {
    color: #d32f2f;
  }
  50% {
    color: #2481cc;
  }
}

/* WebView 内 SVG 有时不跟随父级 color 动画，单独动画 stroke */
@keyframes nav-session-alert-blink-stroke {
  0%,
  100% {
    stroke: #d32f2f;
  }
  50% {
    stroke: #2481cc;
  }
}

/* 未选中「会话」时才有提示动画，避免与 .active 静态蓝色冲突 */
.nav-item.nav-item--session-alert:not(.active) {
  animation: nav-session-alert-blink 1.1s ease-in-out infinite;
}

.nav-item.nav-item--session-alert:not(.active) .nav-label {
  font-weight: 800;
  animation: nav-session-alert-blink-label 1.1s ease-in-out infinite;
}

.nav-item.nav-item--session-alert:not(.active) svg {
  animation: nav-session-alert-blink-stroke 1.1s ease-in-out infinite;
  stroke-width: 2;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  font-size: 10px;
  line-height: 1;
  font-weight: 400;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active .nav-label {
  font-weight: 700;
}

.nav-item.active svg {
  stroke: var(--accent);
  stroke-width: 2;
}

.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel.active {
  display: flex;
}

.placeholder-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* 会话：空状态与消息区叠在同一区域，避免二者作为 flex 兄弟时各占一半高度 */
.session-main-slot {
  flex: 1;
  min-height: 0;
  position: relative;
}

.session-main-slot .session-empty-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 12px 16px 16px;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.session-main-slot .session-active {
  position: absolute;
  inset: 0;
  flex: none;
  width: 100%;
  height: 100%;
}

/* —— 成员弹层 —— */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-sheet {
  width: 100%;
  max-height: 72vh;
  background: var(--tg-theme-bg-color, #fff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.modal-body {
  overflow-y: auto;
  padding: 12px 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 12px 0 8px;
}

.modal-section-title:first-child {
  margin-top: 0;
}

.modal-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.4;
}

.modal-loading,
.modal-error,
.modal-empty {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 8px;
}

.modal-error {
  color: #b00020;
}

/* —— 历史对话弹层 —— */
.history-peers-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-peer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--action-tile-bg, #e8f4fd);
  color: var(--text, #1d1d1f);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.history-peer-chip .history-peer-avatar {
  width: 22px;
  height: 22px;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: var(--accent, #3390ec);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.history-peer-chip .history-peer-avatar:active {
  filter: brightness(0.92);
  transform: scale(0.96);
}

.history-peer-chip .history-peer-open {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.history-peer-chip .history-peer-open:active {
  opacity: 0.85;
}

.history-peers-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.history-pager-btn {
  padding: 6px 16px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--accent, #3390ec);
}

.history-pager-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.history-pager-btn:active:not(:disabled) {
  background: #f0f0f0;
}

.history-pager-info {
  font-size: 12px;
  color: var(--text-muted, #999);
  min-width: 60px;
  text-align: center;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.member-row:last-child {
  border-bottom: none;
}

.member-row .avatar {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.member-meta {
  flex: 1;
  min-width: 0;
}

.member-user-line {
  min-width: 0;
}

.member-user {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-user);
}

.member-id {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

button.member-user-btn {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-user);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

button.member-user-btn:active {
  opacity: 0.75;
}

.session-header-text {
  flex: 1;
  min-width: 0;
}

.session-header-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin: 2px 0 0;
  padding-right: 4px;
  line-height: 1.35;
}

.session-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 对等私聊：消息列表上方显示对方 ID，点击跳转 Telegram 私聊 */
.session-peer-chip-wrap {
  flex-shrink: 0;
  padding: 8px 12px 4px;
  background: var(--tg-theme-bg-color, var(--bg-page));
}

.session-peer-chip-wrap[hidden] {
  display: none !important;
}

.session-peer-chip-pill {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(33, 150, 243, 0.14);
  border: 1px solid rgba(33, 150, 243, 0.22);
  box-sizing: border-box;
}

.session-peer-chip-main {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 7px 4px 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #2196f3);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.session-peer-chip-main:active {
  background: rgba(33, 150, 243, 0.12);
}

.session-peer-chip-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-peer-chip-dismiss {
  flex-shrink: 0;
  width: 36px;
  border: none;
  border-left: 1px solid rgba(33, 150, 243, 0.2);
  background: transparent;
  color: var(--text-muted, #888);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.session-peer-chip-dismiss:active {
  background: rgba(0, 0, 0, 0.05);
}

.session-dm-toolbar {
  flex-shrink: 0;
  position: relative;
  z-index: 30;
  padding: 6px 12px 6px;
  background: var(--tg-theme-secondary-bg-color, var(--bg-header));
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.session-dm-toolbar[hidden] {
  display: none !important;
}

/* 会话区仅用于错误/说明（非可点击主按钮，旧版缓存 JS 无法命中此节点） */
.session-dm-notice {
  width: 100%;
  text-align: left;
  background: rgba(0, 0, 0, 0.045);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 0 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.45;
  box-sizing: border-box;
}

.session-dm-notice[hidden] {
  display: none !important;
}

/* —— 会话对方标签栏（所有对话伙伴） —— */
.admin-dm-tabs-wrap {
  flex-shrink: 0;
  padding: 6px 0 4px;
  background: var(--tg-theme-bg-color, #fff);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.admin-dm-tabs-wrap[hidden] {
  display: none !important;
}

.admin-dm-tabs-scroll {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 10px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.admin-dm-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  padding: 5px 10px;
  border-radius: 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.admin-dm-tab--active {
  border-color: var(--accent, #30a1db);
  background: var(--accent-soft, rgba(48, 161, 219, 0.1));
  color: var(--accent, #30a1db);
  font-weight: 600;
}

.admin-dm-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-dm-tab-close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  line-height: 16px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
}

.admin-dm-tab-close:active {
  opacity: 0.75;
}

.admin-dm-tab--unread {
  border-color: #e53935;
  background: rgba(229, 57, 53, 0.08);
  animation: dm-tab-pulse 1.5s ease-in-out infinite;
}

@keyframes dm-tab-pulse {
  0%, 100% { box-shadow: none; transform: scale(1); }
  50% { box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.25); transform: scale(1.03); }
}

.admin-dm-tab-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53935;
  margin-right: 2px;
  animation: dm-dot-blink 0.8s ease-in-out infinite alternate;
}

@keyframes dm-dot-blink {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* @mention autocomplete */
.mention-item:last-child { border-bottom: none !important; }
.mention-item:active, .mention-item--active { background: #e3f2fd !important; }

/* @mention highlight in chat bubbles */
.mention-highlight {
  color: #1976d2;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.mention-link:hover {
  text-decoration: underline;
}
.mention-link:active {
  opacity: 0.7;
}

/* floating @mention jump button */
.mention-jump-btn {
  position: fixed;
  right: 14px;
  bottom: 100px;
  z-index: 8000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mention-jump-btn:active {
  transform: scale(0.92);
  box-shadow: 0 1px 6px rgba(0,0,0,0.14);
}
.mention-jump-icon {
  font-size: 22px;
  font-weight: 700;
  color: #3390ec;
  line-height: 1;
}
.mention-jump-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #3390ec;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
  box-sizing: border-box;
}
.mention-jump-btn[hidden] {
  display: none !important;
}

/* auto-hide header & nav */
.header, .header-simple {
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease, border-width 0.3s ease;
  overflow: hidden;
}
.bottom-nav {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

body.bars-hidden .header,
body.bars-hidden .header-simple {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-bottom-width: 0 !important;
  opacity: 0;
  pointer-events: none;
}

body.bars-hidden .bottom-nav {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

body.bars-hidden .app {
  padding-bottom: 0 !important;
}

body.bars-hidden .chat-top-util-row {
  padding-top: 2px;
  min-height: 30px;
}
