/* ==========================================================================
   传声筒 v230 UI 修复（最后加载，覆盖前面的样式）
   ========================================================================== */

/* 1. JS 用 style.display='none' 隐藏的按钮必须真的隐藏。
      原样式用 display:flex !important 把它们强制显示了：私聊顶部多出「邀请进群」、群聊顶部出现视频按钮、
      语音通话里出现摄像头 / 翻转按钮。 */
.wa-action-btn[style*="display: none"],
.call-btn-item[style*="display: none"] {
  display: none !important;
}

/* 2. 通话界面按钮：一排放下（麦克风 / 免提 / 摄像头 / 翻转 / 挂断），挂断固定在最右；
      原来 6 个按钮一排，手机上挂断键被挤出屏幕。顶部已有「小窗」按钮，下排不再重复。
      极窄屏（< 340px）放不下时自动折行，挂断仍可见。 */
#active-call-overlay .call-buttons {
  flex-wrap: wrap !important;
  justify-content: center !important;
  column-gap: 10px !important;
  row-gap: 14px !important;
  padding: 0 !important;
  max-width: 400px !important;
}
#active-call-overlay .call-btn-item {
  flex: 0 0 58px !important;
  width: 58px !important;
  gap: 6px !important;
}
#active-call-overlay .call-btn-item.call-btn-minimize-item {
  display: none !important;
}
#active-call-overlay .call-btn-item.call-btn-hangup-item {
  order: 99;
}
#active-call-overlay .call-tool-btn {
  width: 54px !important;
  height: 54px !important;
}
#active-call-overlay .call-tool-btn svg {
  width: 24px !important;
  height: 24px !important;
}
#active-call-overlay .call-btn-label {
  white-space: nowrap !important;
  font-size: 11.5px !important;
}

/* 3. 来电卡片：浅色主题下来电人名字是深色字 + 深色卡片，看不见 */
.call-modal .call-dialog-card h3,
#incoming-caller-name {
  color: #ffffff !important;
}
.call-modal .call-dialog-card p {
  color: #cbd5e1 !important;
}

/* 4. 大图查看：手机上隐藏放大 / 缩小 / 100% 按钮（双指缩放、双击即可），关闭按钮不再被挤出屏幕 */
@media (max-width: 767px), (pointer: coarse) {
  #image-lightbox #btn-zoom-out,
  #image-lightbox #btn-zoom-in,
  #image-lightbox #btn-reset-zoom,
  #image-lightbox .lightbox-badge-icon {
    display: none !important;
  }
  #image-lightbox .lightbox-meta {
    flex: 1 1 auto;
    min-width: 0;
  }
  #image-lightbox .lightbox-filename {
    max-width: 100% !important;
  }
  #image-lightbox .lightbox-toolbar {
    gap: 10px;
  }
  #image-lightbox .lightbox-tool-btn {
    width: 40px !important;
    height: 40px !important;
  }
  #image-lightbox .lightbox-btn-close {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
    color: #ffffff !important;
  }
}

/* 5. 表情面板：8 列在手机上放不下，最右一列被切掉 → 按宽度自动排列 */
.emoji-popover .emoji-grid {
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)) !important;
  overflow-x: hidden !important;
}

/* 6. 浅色主题自己发的语音：白色按钮 / 波形在浅绿气泡上几乎看不见 */
[data-theme="light"] .msg-row.me .voice-bubble-player .voice-play-btn {
  background: #00a884 !important;
  color: #ffffff !important;
}
[data-theme="light"] .msg-row.me .voice-bubble-player .voice-wave-bars span {
  background: #9fcf98 !important;
}
[data-theme="light"] .msg-row.me .voice-bubble-player .voice-wave-bars span.played {
  background: #00a884 !important;
  opacity: 1 !important;
}
[data-theme="light"] .msg-row.me .voice-bubble-player .voice-duration {
  color: #3b4a54 !important;
}
[data-theme="light"] .msg-row.me .voice-bubble-player .voice-speed-badge {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #3b4a54 !important;
}

/* 7. 引用回复：引用块独占一行，回复文字在下面（原来短消息时并排） */
.msg-inner-content > .msg-quote-block {
  flex: 0 0 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* 8. 群资料抽屉（半屏）：群主的「设为群主 / 移出群聊」放到成员名下面一行，不再把名字挤没、文字竖排 */
.drawer-member-item.has-admin-actions {
  flex-wrap: wrap !important;
}
.drawer-member-item .member-admin-actions {
  flex: 0 0 100% !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  padding-left: 0 !important;
  min-width: 0 !important;
  margin-top: 6px !important;
  box-sizing: border-box !important;
}
.btn-remove-member,
.btn-transfer-owner {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  min-height: 28px !important;
}
.drawer-member-item .drawer-member-info {
  min-width: 0;
  flex: 1 1 auto;
}
#btn-close-drawer {
  min-width: 36px !important;
  min-height: 36px !important;
}

/* 9. 群语音条的按钮太矮（25px），不好点 */
.btn-gv-action {
  min-height: 34px !important;
  padding: 6px 14px !important;
}

/* 10. 极窄屏（≤ 340px，老 SE / 小安卓）：通话 5 个按钮仍放一排 */
@media (max-width: 340px) {
  #active-call-overlay .call-buttons {
    column-gap: 4px !important;
  }
  #active-call-overlay .call-btn-item {
    flex: 0 0 54px !important;
    width: 54px !important;
  }
  #active-call-overlay .call-tool-btn {
    width: 48px !important;
    height: 48px !important;
  }
}

/* 11. 群资料「添加新成员」卡片：标题不被省略 */
.drawer-add-member-card .drawer-member-name {
  white-space: nowrap;
  overflow: visible;
}
