#view-room .chat-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* bottom / height 由 JS 根据 visualViewport 动态设置，适配所有设备键盘 */
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ===== 顶栏 ===== */
.chat-header .room-title {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 连接状态指示：圆点模式（默认）。文字模式请启用下方注释的样式 ===== */
.chat-header .online-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff9800; /* 默认橙色（连接中），实际颜色由 room.js 内联设置 */
  flex-shrink: 0;
  margin-left: 6px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
}

/* ===== 连接状态指示：文字模式（需要时启用，并注释上面的圆点样式） ===== */
/*
.chat-header .online-badge {
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
*/

.chat-header .users-btn {
  font-size: 1.3rem;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 4px;
  min-width: 36px;
  cursor: pointer;
  position: relative;
}

/* ===== 公告栏 ===== */
.notice-bar {
  background: #fffbe6;
  border-bottom: 1px solid #ffe082;
  padding: .5rem 1rem;
  font-size: .82rem;
  color: #8d6e00;
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.notice-bar.show {
  display: block;
}

.notice-bar i {
  color: #ff9800;
  margin-right: 4px;
  padding-right:10px;
}

/* ===== 消息列表 ===== */
.msg-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: .75rem;
  -webkit-overflow-scrolling: touch;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background-color: #e9edf6;
  background-image: url('../img/chat-bg-light.svg');
  background-repeat: repeat;
  background-size: 240px 240px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  margin-bottom: 8px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  align-items: flex-end;
}

.chat-msg.mine {
  flex-direction: row-reverse;
  margin-left: auto;
}

/* 连续消息：间距压缩、昵称只在组首显示、头像只在组尾显示 */
.chat-msg.cont {
  margin-bottom: .2rem;
}
.chat-msg.no-sender .sender {
  display: none;
}
.chat-msg.no-avatar .avatar {
  visibility: hidden;
}

/* 消息体（气泡 + 昵称 + 时间） */
.chat-msg .msg-body {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  min-width: 0;
}
.chat-msg.mine .msg-body {
  align-items: flex-end;
}

.chat-msg .msg-body .sender {
  font-size: .72rem;
  color: var(--text-2);
  margin-bottom: 3px;
  font-weight: 600;
  padding-left: 4px;
}
.chat-msg.mine .msg-body .sender {
  padding-left: 0;
  padding-right: 4px;
}

.chat-msg .msg-body .time-tag {
  font-size: .65rem;
  color: var(--text-3);
  margin-top: 4px;
  padding-left: 4px;
}
.chat-msg.mine .msg-body .time-tag {
  padding-left: 0;
  padding-right: 4px;
}

.role-badge { display:inline-block; font-size:.6rem; padding:0 4px; border-radius:4px; vertical-align:middle; margin-left:2px; line-height:1.4; font-weight:600; }
.role-badge.role-admin { background:#dc3545; color:#fff; }
.role-badge.role-assist { background:var(--primary); color:#fff; }

/* 管理角色可见的敏感词提示 */
.sensitive-hint { display:inline-block; font-size:.66rem; color:#dc3545; margin-top:4px; padding-left:4px; font-weight:600; }
.chat-msg.mine .sensitive-hint { padding-left:0; padding-right:4px; }

/* ===== 在线用户侧边栏 ===== */
.user-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .3);
  z-index: 500;
}

.user-panel-overlay.show {
  display: block;
}

.user-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 60px;
  width: 280px;
  max-width: 85vw;
  background: var(--surface);
  z-index: 501;
  transform: translateX(100%);
  transition: transform .25s;
  display: flex;
  flex-direction: column;
  
}

.user-panel.open {
  transform: translateX(0);
}

.user-panel .up-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1rem;
  border-bottom: 1px solid var(--border);
}

.user-panel .up-header h6 {
  margin: 0;
  font-weight: 700;
}

.user-panel .up-list {
  flex: 1;
  overflow-y: auto;
  padding: .5rem;
}

.user-panel .up-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: .55rem .5rem;
  border-bottom: 1px solid var(--border);
}

.user-panel .up-item .up-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.user-panel .up-item .up-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-panel .up-item .up-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #28a745;
  border: 2px solid #fff;
  flex-shrink: 0;
}

.user-panel .up-item .up-name {
  flex: 1;
  font-size: .9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-panel .up-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* 回复缩略图 / 公告图片：透明区域同样显示棋盘格 */
.quote-bar .quote-thumb,
#noticeDetailBody img {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* ===== 成员弹窗简介块（与 index 个人信息弹窗一致的底色，左对齐） ===== */
.member-action-signature {
  background: rgba(102, 126, 234, .10);
  color: var(--text-2);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .85rem;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  text-align: left;
}
[data-theme="dark"] .member-action-signature {
  background: rgba(138, 155, 255, .12);
}

/* ===== 粘贴提示 ===== */
.paste-hint {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .75);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: .8rem;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}

.paste-hint.show {
  opacity: 1;
}

/* @提及高亮 */
.mention-at { color: #4a90d9; font-weight: 500; }

#noticeDetailBody { white-space:pre-wrap; }
#noticeDetailBody img { max-width:100%; height:auto; }
#noticeDetailBody video { max-width:100%; height:auto; }
#noticeDetailBody blockquote { border-left:3px solid var(--primary); margin:8px 0; padding:4px 12px; background:rgba(102,126,234,.06); color:var(--text-2); }
#noticeDetailBody pre { background:#f4f4f4; padding:8px 12px; border-radius:4px; font-size:.85rem; white-space:pre-wrap; }
#noticeDetailBody ol, #noticeDetailBody ul { padding-left:20px; }
/* Quill 对齐类 */
#noticeDetailBody .ql-align-center { text-align:center; }
#noticeDetailBody .ql-align-right { text-align:right; }
#noticeDetailBody .ql-align-justify { text-align:justify; }
#noticeDetailBody .ql-indent-1 { padding-left:3em; }
#noticeDetailBody .ql-indent-2 { padding-left:6em; }
#noticeDetailBody .ql-indent-3 { padding-left:9em; }

/* ==================== 深色主题 ==================== */
[data-theme="dark"] .msg-container {
  background-color: #0e1621;
  background-image: url('../img/chat-bg-dark.svg');
}

/* 在线徽章（文字模式深色，需要时启用；圆点模式颜色由 room.js 内联控制，无需深色覆盖） */
/*
[data-theme="dark"] .chat-header .online-badge {
  background: #1e3a2a;
  color: #7bd88f;
}
*/

/* 公告栏（暗黄） */
[data-theme="dark"] .notice-bar {
  background: #2b2a1a;
  border-bottom-color: #4a4420;
  color: #d4c26a;
}

/* 头像透明区域棋盘格背景（有头像时透明区域显示棋盘格，而非容器紫色） */
.chat-msg .avatar img,
.user-panel .up-item .up-avatar img,
.mention-drawer .md-list .md-item .md-avatar img,
#roomAvatarImg {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
