/* 手机端优先：数字人居中主视觉区 + 底部输入/快捷问题 */

:root {
  /* 仅输入栏高度（无底栏快捷区）；数字人 bottom = 此值 + 10px */
  --dh-bottom-h: 72px;
  --dh-answer-h: 0px;
  --dh-safe-bottom: env(safe-area-inset-bottom, 0px);
  --dh-stage-gap: 10px;
  /* 数字人区底悬浮服务钮：固定高度，不随内容跳动 */
  --dh-stage-services-h: 36px;
  /* 问答区最大高度：原 32vh + 约两行正文（13px × 1.55 × 2） */
  --dh-answer-max-h: calc(32vh + 40px);
  /* 网页版舞台列宽：默认占位；出画后由 JS 写成视频流显示宽 */
  --dh-stage-w: min(420px, 56vh);
}

html,
body,
#app,
.rendu-page,
.rendu-content,
.rendu-content-full {
  width: 100% !important;
  height: 100% !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background-color: #eef2f8 !important;
  background-image: url('/custom/assets/dh-bg-party.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

.rendu-header,
.face-attention-video,
.radar-trigger-zone,
.h5-chat-title {
  display: none !important;
}

/* 始终保持数字人主区域可见，防止原站切聊天页后消失 */
.rendu-content,
.rendu-content-full,
.rendu-left {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#rtc_media_player,
.digital-people,
.digital-people video,
.h5-digital-people {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* 原站聊天面板默认隐藏（由自定义底栏接管输入） */
.rendu-page > div[style*="background-color"] {
  display: none !important;
}

/* 数字人主视觉：贴输入栏上方 10px；问答区叠加在其上，不挤占高度 */
.rendu-left {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: calc(var(--dh-bottom-h) + var(--dh-stage-gap, 10px)) !important;
  width: 100vw !important;
  height: auto !important;
  z-index: 1 !important;
  display: block !important;
  background-color: transparent !important;
  background-image: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.digital-people,
#rtc_media_player {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  height: 100% !important;
  width: auto !important;
  max-width: none !important;
  max-height: none !important;
  min-height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  margin: 0 !important;
}

/* 原站浮动话筒/输入图标：藏起，改由底栏统一入口 */
.mike-box,
.mike-box.mike-box,
.rendu-left .mike-box,
.mike-ex-box,
.mike-tips,
.send-img-box,
.send-box .send-img,
.right-box .send-img-box,
.right-box .mike-box {
  position: fixed !important;
  left: -9999px !important;
  top: 0 !important;
  bottom: auto !important;
  transform: none !important;
  width: 1px !important;
  height: 1px !important;
  max-width: 1px !important;
  max-height: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

.rendu-left .tips,
.rendu-left [class*="tip"],
.rendu-left .welcome-text,
.rendu-left [class*="subtitle"],
.rendu-left [class*="Subtitle"],
.rendu-left [class*="caption"],
.rendu-left [class*="Caption"],
.rendu-left [class*="asr"],
.rendu-left [class*="Asr"],
.rendu-left [class*="speak"],
.rendu-left [class*="Speak"],
.rendu-left [class*="reply"],
.rendu-left [class*="Reply"],
.rendu-left [class*="answer"],
.rendu-left [class*="Answer"],
.rendu-left [class*="msg"],
.rendu-left [class*="Msg"],
.rendu-left [class*="text-box"],
.rendu-left [class*="result"],
.rendu-left .color-1c2129,
.right-box .text-box,
.chat-content .text-box,
.chat-content [class*="copy"],
/* 数字人脚下的原站字幕/回答条（不要误伤话筒） */
.rendu-content > .tips:not(.mike-box),
.rendu-page .h5-digital-people + *:not(.mike-box):not(.digital-people):not(#rtc_media_player),
.dh-hide-origin-answer {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* 顶栏 */
#dh-custom-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  color: #1f2a44;
  background: linear-gradient(180deg, rgba(238, 242, 248, 0.95), transparent);
  pointer-events: none;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#dh-custom-topbar .dh-topbar-left {
  min-width: 0;
  flex: 1;
}

#dh-custom-topbar .dh-brand {
  font-size: 17px;
  font-weight: 700;
}

#dh-custom-topbar .dh-sub {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}

#dh-custom-topbar .dh-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  pointer-events: auto;
}

#dh-custom-topbar .dh-topbar-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(31, 42, 68, 0.16);
  background: rgba(255, 255, 255, 0.88);
  color: #1f2a44;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

/* 喇叭：圆圈=可用/不可用；图标色=开/关（关永远灰，不再用青绿底） */
#dh-custom-topbar #dh-btn-speak {
  border-width: 1px;
  background: rgba(255, 255, 255, 0.92);
}

#dh-custom-topbar #dh-btn-speak.is-avail {
  border-color: #22c55e;
  box-shadow:
    0 0 0 2px rgba(34, 197, 94, 0.14),
    0 0 8px rgba(34, 197, 94, 0.35),
    0 2px 6px rgba(15, 23, 42, 0.05);
}

#dh-custom-topbar #dh-btn-speak.is-unavail {
  border-color: rgba(31, 42, 68, 0.16);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

#dh-custom-topbar #dh-btn-speak.is-speak-on {
  color: #1f2a44;
}

#dh-custom-topbar #dh-btn-speak.is-speak-off {
  color: #94a3b8;
}

#dh-custom-topbar .dh-topbar-user-wrap {
  position: relative;
  pointer-events: auto;
}

#dh-custom-topbar .dh-topbar-user {
  color: #1f2a44;
}

#dh-custom-topbar .dh-user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: max-content;
  min-width: 0;
  max-width: min(66vw, 240px);
  box-sizing: border-box;
  padding: 10px 8px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(31, 42, 68, 0.12);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 40;
  overflow: visible;
}

#dh-custom-topbar .dh-user-menu.is-open {
  display: block;
}

#dh-custom-topbar .dh-user-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 8px;
}

#dh-custom-topbar .dh-user-menu-name-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: #64748b;
  line-height: 0;
  margin-left: -6px;
}

#dh-custom-topbar .dh-user-menu-name-ico svg {
  display: block;
  width: 22px;
  height: 22px;
}

#dh-custom-topbar .dh-user-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2a44;
  word-break: break-all;
  min-width: 0;
  line-height: 24px;
  padding-top: 2px;
}

#dh-custom-topbar .dh-user-menu-cid {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 0 8px 10px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.3;
}

#dh-custom-topbar .dh-user-cid-label {
  flex-shrink: 0;
}

#dh-custom-topbar .dh-user-cid-short {
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 28px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #475569;
}

#dh-custom-topbar .dh-user-cid-copy {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  user-select: none;
}

#dh-custom-topbar .dh-user-cid-copy svg {
  display: block;
  width: 12px;
  height: 12px;
  pointer-events: none;
  fill: currentColor;
}

#dh-custom-topbar .dh-user-cid-copy:active,
#dh-custom-topbar .dh-user-cid-copy.is-copied {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
}

#dh-custom-topbar .dh-user-menu-sep {
  height: 1px;
  margin: 0 4px 6px;
  background: rgba(31, 42, 68, 0.1);
}

#dh-custom-topbar .dh-user-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #1f2a44;
  font-size: 14px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

#dh-custom-topbar .dh-menu-item-ico {
  flex-shrink: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
}

#dh-custom-topbar .dh-menu-item-ico svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
  margin-top: -2px;
}

#dh-custom-topbar .dh-user-menu-item:active {
  background: rgba(31, 42, 68, 0.06);
}

/* 问答区：叠加在数字人区域底部（半透明浮层，不挤占数字人高度） */
#dh-custom-answer {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(
    var(--dh-bottom-h) + 10px + var(--dh-stage-services-h, 36px) + 8px
  );
  z-index: 350;
  max-height: var(--dh-answer-max-h, calc(32vh + 40px));
  display: none;
  flex-direction: column;
  overflow: hidden !important;
  padding: 10px 12px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(219, 227, 240, 0.3);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  color: #1f2a44;
  font-size: 13px;
  line-height: 1.45;
  box-sizing: border-box;
  pointer-events: auto;
}

#dh-custom-answer.is-show {
  display: flex;
}

/* —— 多轮气泡（qaDisplayMode=chat）—— */
#dh-custom-answer.is-chat {
  max-height: calc(48vh + 40px);
  /* 左右 0：头像贴底板左右边 */
  padding: 8px 0 6px;
  /* 气泡区整体透明，透出背后数字人 */
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  --dh-chat-avatar: 40px;
  --dh-chat-avatar-gap: 2px;
  /* 对侧头像列完整空出：头像宽 + 间距 */
  --dh-chat-side: calc(var(--dh-chat-avatar) + var(--dh-chat-avatar-gap));
  /* 问/答气泡共用透明度（alpha=不透明度；0.15 叠深色西装时字发虚） */
  --dh-chat-bubble-alpha: 0.55;
}

#dh-custom-answer.is-loading .dh-answer-text,
#dh-custom-answer.is-loading .dh-chat-bubble-bot {
  color: #5b6b8c;
}

#dh-custom-answer .dh-chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/旧 Edge */
  /* 水平不再加垫，头像贴底板左右边 */
  padding: 2px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 仅当内容已滚过顶部（触达 max-height 裁切边）时渐隐，未滚动不加遮罩 */
#dh-custom-answer .dh-chat-scroll.is-fade-top {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 28px, #000 100%);
}

#dh-custom-answer .dh-chat-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

#dh-custom-answer .dh-chat-turn {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#dh-custom-answer .dh-chat-user-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--dh-chat-avatar-gap, 2px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* 左侧完整空出助手头像列，与右侧问话者头像列对称 */
  padding-left: var(--dh-chat-side);
}

#dh-custom-answer .dh-chat-user {
  display: flex;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
}

#dh-custom-answer .dh-chat-bot-row {
  display: flex;
  align-items: flex-start;
  gap: var(--dh-chat-avatar-gap, 2px);
  width: 100%;
  /* 右侧完整空出问话者头像列 */
  max-width: calc(100% - var(--dh-chat-side));
  box-sizing: border-box;
  padding-right: 0;
}

#dh-custom-answer .dh-chat-avatar {
  flex: 0 0 var(--dh-chat-avatar, 40px);
  width: var(--dh-chat-avatar, 40px);
  height: var(--dh-chat-avatar, 40px);
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

#dh-custom-answer .dh-chat-avatar-user {
  background: #94a3b8
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4.4 0-8 2.2-8 5v1h16v-1c0-2.8-3.6-5-8-5z'/%3E%3C/svg%3E")
    center 58% / 58% no-repeat;
}

#dh-custom-answer .dh-chat-avatar.is-fallback {
  background: #94a3b8
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4.4 0-8 2.2-8 5v1h16v-1c0-2.8-3.6-5-8-5z'/%3E%3C/svg%3E")
    center 60% / 60% no-repeat;
}

/* 全身海报裁头像：对焦点在面部下沿/颈，约 4.2 倍（避免切到眼、也避免到腰） */
#dh-custom-answer .dh-chat-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 50% 16%;
  transform: scale(4.2);
  transform-origin: 50% 16%;
  display: block;
  pointer-events: none;
}

#dh-custom-answer .dh-chat-bot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

#dh-custom-answer .dh-chat-bubble {
  max-width: 100%;
  /* 左右内边距一致 */
  padding: 10px 12px;
  border-radius: 12px;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.55;
  box-sizing: border-box;
  position: relative;
}

#dh-custom-answer .dh-chat-bubble-user {
  /* 与回答气泡同透明度；红底白字保证叠深色背景仍可读 */
  background: rgba(225, 29, 72, var(--dh-chat-bubble-alpha, 0.55));
  color: #fff;
  border: 1px solid rgba(225, 29, 72, 0.35);
  border-bottom-right-radius: 4px;
  max-width: 100%;
  margin-left: auto;
  padding-left: 12px;
  padding-right: 12px;
}

#dh-custom-answer .dh-chat-bubble-bot {
  /* fit-content：长文可拉满右侧；短文不左右不等宽留白感 */
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  padding-left: 12px !important;
  padding-right: 8px !important;
  /* 与问题气泡共用 --dh-chat-bubble-alpha */
  background: rgba(255, 255, 255, var(--dh-chat-bubble-alpha, 0.55));
  color: #1f2a44;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-bottom-left-radius: 4px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#dh-custom-answer .dh-chat-bubble-bot.dh-md,
#dh-custom-answer .dh-chat-bubble-bot .dh-md-p {
  padding-left: 0;
  padding-right: 0;
  margin-left: 0;
  margin-right: 0;
}

#dh-custom-answer .dh-chat-turn.is-welcome .dh-chat-meta {
  display: none;
}

#dh-custom-answer .dh-chat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  padding-left: 2px;
}

#dh-custom-answer .dh-chat-status {
  font-size: 11px;
  color: #4f6ef7;
  line-height: 1.2;
}

#dh-custom-answer .dh-chat-status.is-idle,
#dh-custom-answer .dh-chat-status:empty {
  color: #6b7a99;
}

#dh-custom-answer .dh-chat-copy {
  transform: none;
}

#dh-custom-answer .dh-chat-cites {
  margin: 2px 0 0;
  padding: 0;
}

/* 开场白 turn 内快捷标签：紧跟气泡、对齐气泡列；右侧加宽到右头像一半处 */
#dh-custom-answer .dh-chat-turn.is-welcome .dh-chat-quick-tags {
  margin: 4px 0 0;
  padding-left: calc(var(--dh-chat-avatar, 40px) + var(--dh-chat-avatar-gap, 4px));
  padding-right: calc(var(--dh-chat-avatar, 40px) / 2);
  box-sizing: border-box;
  width: 100%;
}

/* 数字人区底边上方 10px：四钮固定悬浮，不随问答滚动 */
#dh-stage-services {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(var(--dh-bottom-h) + 10px);
  z-index: 360;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: stretch;
  gap: 6px;
  height: var(--dh-stage-services-h, 36px);
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  pointer-events: auto;
}

#dh-stage-services .dh-service-chip {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border: none;
  background: #e11d48;
  color: #fff;
  border-radius: 8px;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.28);
}

#dh-stage-services .dh-service-chip:active {
  background: #be123c;
}

#dh-custom-answer .dh-chat-quick-tags,
#dh-chat-quick-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  position: relative;
}

/* 答后追问：跟在最近一轮 turn 后，仍在 scroll 里；右侧加宽到右头像一半处 */
#dh-chat-scroll > #dh-chat-quick-tags {
  margin: 0;
  padding-left: calc(var(--dh-chat-avatar, 40px) + var(--dh-chat-avatar-gap, 4px));
  padding-right: calc(var(--dh-chat-avatar, 40px) / 2);
  box-sizing: border-box;
  width: 100%;
}

#dh-custom-answer .dh-chat-quick-chip,
#dh-chat-quick-tags .dh-chat-quick-chip {
  flex: 0 0 auto;
  border: 1px solid #dbe3f0;
  background: rgba(245, 248, 255, 0.92);
  color: #1f2a44;
  border-radius: 14px;
  padding: 7px 10px;
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  max-width: 100%;
}

#dh-custom-answer .dh-chat-quick-tags[data-mode='followup'] .dh-chat-quick-chip {
  border-color: rgba(225, 29, 72, 0.35);
  color: #be123c;
  background: rgba(255, 255, 255, 0.55);
}

#dh-custom-answer .dh-chat-quick-chip:active {
  background: #e8eefc;
}

#dh-custom-answer .dh-md-a {
  color: #3d5bd9;
  text-decoration: none;
  word-break: break-word;
}

/*
 * 回答区 Markdown 外链 CTA：对齐参考「打开政务AI」——
 * 白底蓝边、文案居中；行左右各约 1em（当前字宽），按钮铺满该行。
 */
#dh-custom-answer .dh-md-link-row,
#dh-custom-answer .dh-md-img-row {
  display: block;
  margin: 8px 1em;
  box-sizing: border-box;
  max-width: 100%;
}

#dh-custom-answer .dh-md-a--btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  min-height: 40px;
  border: 1px solid #5b7cfa;
  border-radius: 8px;
  background: #ffffff;
  color: #3d5bd9;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

#dh-custom-answer .dh-md-a--btn:active {
  background: #f0f4ff;
  border-color: #3d5bd9;
}

#dh-custom-answer .dh-md-a-label {
  pointer-events: none;
}

/* Markdown 图片 ![说明](url) ：同宽铺满，可点看原图 */
#dh-custom-answer .dh-md-img-a {
  display: block;
  width: 100%;
  line-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
}

#dh-custom-answer .dh-md-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 0;
  vertical-align: middle;
}

/* 问题区：固定在分割线上方，绝不进入滚动 */
#dh-custom-answer .dh-answer-qrow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  margin: 2px 0 8px;
  padding: 0 0 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.45);
  background: transparent;
  position: relative;
  z-index: 2;
}

#dh-custom-answer .dh-answer-question {
  display: block;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

/* 仅分割线以下滚动；高度上限不含问题行与回答标题行 */
#dh-custom-answer .dh-answer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(var(--dh-answer-max-h, calc(32vh + 40px)) - 90px);
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
}

#dh-custom-answer .dh-answer-head > div {
  display: flex;
  align-items: center;
  gap: 0px;
  min-height: 18px;
}

#dh-custom-answer .dh-answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

#dh-custom-answer .dh-answer-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  line-height: 0;
  display: inline-flex;
  align-items: center;
}

#dh-custom-answer .dh-answer-status {
  font-size: 11px;
  color: #4f6ef7;
  margin-left: 8px;
  line-height: 0;
  display: inline-flex;
  align-items: center;
}

#dh-custom-answer .dh-answer-status.is-idle {
  color: #6b7a99;
}

#dh-custom-answer .dh-ans-clip {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #22c55e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  user-select: none;
  transition: color 0.15s ease;
  transform: translateX(3px);
}

#dh-custom-answer .dh-ans-clip svg {
  display: block;
  width: 14px;
  height: 14px;
  pointer-events: none;
  fill: currentColor;
}

#dh-custom-answer .dh-ans-clip.is-hidden {
  display: none;
}

#dh-custom-answer .dh-ans-clip:active,
#dh-custom-answer .dh-ans-clip.is-copied {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
}

#dh-custom-stop {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-top: -2px !important;
  transform: translateY(-2px);
  border: 1px solid #f0c2c2;
  background: rgba(255, 255, 255, 0.75);
  color: #d4380d;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}

#dh-custom-answer .dh-answer-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 6px;
}

#dh-more-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
}

#dh-more-panel.is-show {
  display: block;
}

#dh-more-panel .dh-more-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

#dh-more-panel .dh-more-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12);
  padding: 12px 14px 18px;
  box-sizing: border-box;
}

#dh-more-panel .dh-more-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

#dh-more-panel .dh-more-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #1f2a44;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

/* 问答记录 / 问答统计 / 详情：屏幕到外卡片边距 < 卡片内边距（对齐全员汇总移动端 10px / 14px） */
#dh-more-panel.is-history .dh-more-sheet {
  top: 0;
  max-height: none;
  height: 100%;
  height: 100dvh;
  border-radius: 0;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-right: 10px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: 10px;
  background:
    radial-gradient(1200px 480px at 12% -10%, rgba(61, 91, 217, 0.12), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(185, 28, 28, 0.06), transparent 50%),
    linear-gradient(180deg, #edf1f8, #f7f9fc 40%, #eef2f7);
}

#dh-more-panel.is-history .dh-more-head {
  margin-bottom: 10px;
}

#dh-more-panel .dh-hist-block {
  margin: 0;
  padding-bottom: 8px;
}

#dh-more-panel .dh-hist-block .dh-hist-list {
  margin-top: 0;
  padding-bottom: 0;
}

#dh-more-panel .dh-hist-block .dh-hist-foot {
  padding: 10px 8px 0;
}

#dh-more-panel .dh-hist-block .dh-more-empty {
  padding: 28px 8px;
}

#dh-more-panel .dh-more-back,
#dh-more-panel .dh-more-close {
  border: none;
  background: transparent;
  color: #4f6ef7;
  font-size: 14px;
  padding: 4px 6px;
  cursor: pointer;
}

#dh-more-panel .dh-more-close {
  font-size: 20px;
  line-height: 1;
  color: #64748b;
}

#dh-more-panel .dh-more-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  flex: 1 1 auto;
  min-height: 0;
}

#dh-more-panel .dh-more-link,
#dh-more-panel .dh-more-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #e6ecf5;
  background: #f8faff;
  color: #1f2a44;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 8px;
  font-size: 14px;
  cursor: pointer;
  box-sizing: border-box;
}

#dh-more-panel .dh-more-item-q {
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
}

#dh-more-panel .dh-more-item-meta {
  font-size: 12px;
  color: #64748b;
}

#dh-more-panel .dh-more-loading,
#dh-more-panel .dh-more-empty {
  color: #64748b;
  font-size: 13px;
  padding: 24px 8px;
  text-align: center;
}

/* 历史记录卡片：对齐汇总页问答记录（不含 cid） */
#dh-more-panel .dh-hist-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 0 8px;
}

#dh-more-panel .dh-hist-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 227, 240, 0.85);
  color: #1f2a44;
  font-size: 13px;
  line-height: 1.45;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#dh-more-panel .dh-hist-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0 0 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.45);
}

#dh-more-panel .dh-hist-qmain {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

#dh-more-panel .dh-hist-right {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

#dh-more-panel .dh-hist-question {
  margin: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

#dh-more-panel .dh-hist-tag {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  border: 1px solid #d5deee;
  background: rgba(247, 249, 255, 0.95);
  color: #3d5bd9;
}

#dh-more-panel .dh-hist-tag.is-status {
  border-color: #c9d4f5;
  background: #eef2ff;
  color: #4f6ef7;
}

#dh-more-panel .dh-hist-tag.is-speak {
  border-color: #b7e0c4;
  background: #f0faf3;
  color: #2f9e5c;
}

#dh-more-panel .dh-hist-tag.is-playing {
  border-color: #9ec5fe;
  background: #e8f3ff;
  color: #1d4ed8;
}

#dh-more-panel .dh-hist-tag.is-stop {
  border-color: #f5d0a9;
  background: #fff7ed;
  color: #c2410c;
}

#dh-more-panel .dh-hist-tag.is-no-answer {
  border-color: #f0c2c2;
  background: #fff1f0;
  color: #d4380d;
}

#dh-more-panel .dh-hist-tag.is-idle {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

#dh-more-panel .dh-hist-time {
  flex: 0 0 auto;
  font-size: 11px;
  color: #6b7a99;
  white-space: nowrap;
  line-height: 1.45;
  padding-top: 1px;
}

#dh-more-panel .dh-hist-scroll {
  flex: 0 0 auto;
  /* 答：正文固定最高 4 行，超出滚动（不用省略号） */
  height: calc(13px * 1.55 * 4);
  max-height: calc(13px * 1.55 * 4);
  overflow-x: hidden;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: auto;
  padding-right: 2px;
}

#dh-more-panel .dh-hist-scroll.is-scrollable {
  overflow-y: auto;
  overscroll-behavior: contain;
}

#dh-more-panel .dh-hist-text {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: #1f2937;
  line-height: 1.55;
  text-overflow: clip;
  overflow: visible;
}

#dh-more-panel .dh-hist-foot {
  padding: 12px 8px 4px;
  text-align: center;
  font-size: 12px;
  color: #6b7a99;
}

#dh-more-panel .dh-hist-foot.is-end {
  color: #94a3b8;
}

#dh-more-panel .dh-more-detail-q {
  font-weight: 600;
  color: #334155;
  margin-bottom: 10px;
  line-height: 1.45;
}

#dh-more-panel .dh-more-detail-a {
  color: #1f2a44;
  line-height: 1.55;
  font-size: 14px;
  white-space: pre-wrap;
}

#dh-more-panel .dh-more-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
  color: #334155;
}

#dh-more-panel .dh-more-stat-row strong {
  color: #3d5bd9;
  font-weight: 600;
}

/* —— 问答统计页 —— */
#dh-more-panel .dh-stats-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 0;
}

#dh-more-panel.is-history .dh-stats-page .dh-stats-section:last-child .dh-stats-block {
  margin-bottom: 0;
}

#dh-more-panel .dh-stats-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin: 0 0 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

#dh-more-panel .dh-stats-day-tip {
  font-weight: 400;
  color: #94a3b8;
  font-size: 12px;
  margin-left: 0;
}

#dh-more-panel .dh-stats-block {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 227, 240, 0.95);
  border-radius: 14px;
  padding: 14px;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

#dh-more-panel .dh-stats-cid-tip {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
  margin: 0 0 10px;
  text-align: left;
  padding: 0;
}

#dh-more-panel .dh-stats-cid-tip code {
  font-size: 10px;
  color: #64748b;
}

#dh-more-panel .dh-stats-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(219, 227, 240, 0.9);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

#dh-more-panel .dh-stats-summary-main .dh-stats-card:last-child {
  margin-bottom: 0;
}

#dh-more-panel .dh-stats-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

#dh-more-panel .dh-stats-compare {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(219, 227, 240, 0.9);
  border-radius: 12px;
  min-width: 0;
  box-sizing: border-box;
}

#dh-more-panel .dh-stats-compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

#dh-more-panel .dh-stats-compare-head .dh-stats-card-label {
  margin-bottom: 0;
  text-align: left;
  flex: 1;
  min-width: 0;
}

#dh-more-panel .dh-stats-compare-head .dh-stats-legend {
  margin-bottom: 0;
  flex-shrink: 0;
  justify-content: flex-end;
}

#dh-more-panel .dh-stats-legend-static {
  cursor: default;
}

#dh-more-panel .dh-stats-compare-chart-wrap {
  margin-top: 0;
}

#dh-more-panel .dh-stats-compare-chart-wrap canvas {
  height: 280px;
}

@media (min-width: 900px) {
  #dh-more-panel .dh-stats-summary-grid {
    grid-template-columns: minmax(0, 45%) minmax(0, 55%);
  }
}

#dh-more-panel .dh-stats-total {
  text-align: center;
  padding: 14px;
}

#dh-more-panel .dh-stats-total-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

#dh-more-panel .dh-stats-total-num {
  font-size: 32px;
  font-weight: 700;
  color: #3d5bd9;
  line-height: 1.1;
}

#dh-more-panel .dh-stats-total-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  margin: 0;
}

#dh-more-panel .dh-stats-total-line .dh-stats-total-label::after {
  content: none;
}

#dh-more-panel .dh-stats-type-row,
#dh-more-panel .dh-stats-status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 4px;
  justify-items: stretch;
  box-sizing: border-box;
}

#dh-more-panel .dh-stats-type-row .dh-stats-chip,
#dh-more-panel .dh-stats-status-row .dh-stats-tag {
  display: inline-flex;
  justify-content: flex-start;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: left;
}

#dh-more-panel .dh-stats-card-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
  text-align: left;
}

#dh-more-panel .dh-stats-chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid #d5deee;
  background: #f7f9ff;
  color: #3d5bd9;
}

#dh-more-panel .dh-stats-tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

#dh-more-panel .dh-stats-tag.is-speak {
  border-color: #b7e0c4;
  background: #f0faf3;
  color: #2f9e5c;
}

#dh-more-panel .dh-stats-tag.is-stop {
  border-color: #f5d0a9;
  background: #fff7ed;
  color: #c2410c;
}

#dh-more-panel .dh-stats-tag.is-playing {
  border-color: #9ec5fe;
  background: #e8f3ff;
  color: #1d4ed8;
}

#dh-more-panel .dh-stats-tag.is-idle {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

#dh-more-panel .dh-stats-avg {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #334155;
}

#dh-more-panel .dh-stats-avg strong {
  color: #3d5bd9;
  font-weight: 600;
}

#dh-more-panel .dh-stats-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

#dh-more-panel .dh-stats-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

#dh-more-panel .dh-stats-legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

#dh-more-panel .dh-stats-legend-item.is-off {
  opacity: 0.4;
  text-decoration: line-through;
}

#dh-more-panel .dh-stats-chart-wrap {
  position: relative;
  background: #fff;
  border: 1px solid rgba(219, 227, 240, 0.9);
  border-radius: 12px;
  padding: 8px 6px 4px;
  box-sizing: border-box;
  overflow: hidden;
}

#dh-more-panel .dh-stats-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 220px;
  touch-action: manipulation;
}

#dh-more-panel .dh-stats-tip {
  position: absolute;
  z-index: 2;
  min-width: 128px;
  max-width: 200px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  pointer-events: none;
}

#dh-more-panel .dh-stats-tip-date {
  font-weight: 600;
  margin-bottom: 6px;
  color: #e2e8f0;
}

#dh-more-panel .dh-stats-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

#dh-more-panel .dh-stats-tip-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

#dh-more-panel .dh-stats-tip-row span {
  flex: 1;
  min-width: 0;
  color: #cbd5e1;
}

#dh-more-panel .dh-stats-tip-row strong {
  font-weight: 600;
  color: #fff;
}

#dh-custom-stop:active {
  background: #fff1f0;
}

#dh-custom-stop:disabled {
  opacity: 0.45;
  cursor: default;
}

#dh-custom-answer .dh-answer-text {
  font-size: 13px !important;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1f2937;
  line-height: 1.55;
}

#dh-custom-answer .dh-answer-text.dh-md {
  white-space: normal;
}

/* 回答区后代统一 13px，杜绝 strong/em/li 被原站放大 */
#dh-custom-answer .dh-answer-text,
#dh-custom-answer .dh-answer-text * {
  font-size: 13px !important;
  line-height: 1.55 !important;
}

#dh-custom-answer .dh-md-strong {
  font-size: 11px !important;
  font-weight: 600 !important;
  font-style: normal !important;
  font-synthesis: none !important;
  line-height: 1.55 !important;
  color: inherit;
}

#dh-custom-answer .dh-md-em {
  font-size: 12px !important;
  font-style: italic !important;
  font-weight: inherit !important;
  line-height: 1.55 !important;
}

#dh-custom-answer .dh-md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px !important;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

#dh-custom-answer .dh-md-p {
  margin: 0 0 6px;
  white-space: pre-wrap;
}

/* 元状态原文（思考中…）；正式回答用 .dh-md + renderMarkdownLite */
#dh-custom-answer .dh-md-raw {
  white-space: pre-wrap;
  word-break: break-word;
}

#dh-more-panel .dh-hist-text.dh-md {
  white-space: normal;
  word-break: break-word;
}

#dh-more-panel .dh-hist-text .dh-md-p {
  margin: 0 0 6px;
}

#dh-more-panel .dh-hist-text .dh-md-p:last-child {
  margin-bottom: 0;
}

#dh-more-panel .dh-hist-text .dh-md-strong {
  font-weight: 600;
}

#dh-more-panel .dh-hist-text .dh-md-ul,
#dh-more-panel .dh-hist-text .dh-md-ol {
  margin: 4px 0 6px;
  padding-left: 1.2em;
}

#dh-more-panel .dh-hist-text .dh-md-ul {
  list-style: disc;
}

#dh-more-panel .dh-hist-text .dh-md-ol {
  list-style: none;
  padding-left: 0;
}

#dh-more-panel .dh-hist-text .dh-md-ord {
  font-weight: 600;
}

#dh-custom-answer .dh-md-p:last-child {
  margin-bottom: 0;
}

#dh-custom-answer .dh-md-ul,
#dh-custom-answer .dh-md-ol {
  margin: 4px 0 8px;
  padding-left: 0;
  list-style: none !important;
}

#dh-custom-answer .dh-md-ul {
  padding-left: 1.1em;
  list-style: disc !important;
  list-style-position: inside !important;
}

#dh-custom-answer .dh-md-ol {
  /* 序号写在 .dh-md-ord 里，避免 overflow:hidden 裁掉原生标记 */
  padding-left: 0;
}

#dh-custom-answer .dh-md-ord {
  font-variant-numeric: tabular-nums;
}

#dh-custom-answer .dh-md-ul .dh-md-ul,
#dh-custom-answer .dh-md-ul .dh-md-ol,
#dh-custom-answer .dh-md-ol .dh-md-ul,
#dh-custom-answer .dh-md-ol .dh-md-ol {
  margin: 2px 0 4px;
}

#dh-custom-answer .dh-md-ul li,
#dh-custom-answer .dh-md-ol li {
  margin: 2px 0;
}

#dh-custom-answer .dh-md-table-wrap {
  width: 100%;
  overflow-x: hidden;
  margin: 6px 0 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
}

#dh-custom-answer .dh-md-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 12px;
  line-height: 1.5;
}

#dh-custom-answer .dh-md-table th,
#dh-custom-answer .dh-md-table td {
  border: 1px solid rgba(15, 23, 42, 0.1);
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 33%;
}

#dh-custom-answer .dh-md-table th {
  background: rgba(61, 91, 217, 0.08);
  color: #1f2a44;
  font-weight: 600;
}

/* 知识库引用：圆形徽章（链标 + 序号），正文下方；详情用弹出页 */
#dh-custom-answer .dh-answer-cites {
  margin: 8px 0px 1px;
  padding: 0;
}

#dh-custom-answer .dh-cite-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

#dh-custom-answer .dh-cite-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: #4b5563;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

#dh-custom-answer .dh-cite-chip.dh-cite-link {
  color: #6b7280;
  cursor: default;
  pointer-events: none;
}

#dh-custom-answer .dh-cite-chip.dh-cite-link svg {
  display: block;
}

#dh-custom-answer .dh-cite-chip:active {
  background: rgba(61, 91, 217, 0.16);
  color: #3d5bd9;
}

/* 引用弹出页（底部 sheet，对齐「更多」面板风格） */
#dh-cite-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1300;
  pointer-events: auto;
}

#dh-cite-popup.is-show {
  display: block;
}

#dh-cite-popup .dh-cite-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

#dh-cite-popup .dh-cite-sheet {
  position: absolute;
  left: 0;
  right: 0;
  /* 上沿 = 回答区最大高度顶边再上移；下沿铺到屏幕底 */
  top: calc(100% - (var(--dh-bottom-h, 72px) + var(--dh-safe-bottom, 0px) + 8px + var(--dh-answer-max-h, 32vh)) - 100px);
  bottom: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.14);
  padding: 12px 16px calc(12px + var(--dh-safe-bottom, 0px));
  box-sizing: border-box;
}

#dh-cite-popup .dh-cite-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex: 0 0 auto;
  min-height: 28px;
}

#dh-cite-popup .dh-cite-title {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
  color: #1f2a44;
  white-space: nowrap;
}

#dh-cite-popup .dh-cite-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: #6b7280;
  pointer-events: none;
}

#dh-cite-popup .dh-cite-title-icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

#dh-cite-popup .dh-cite-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  margin-left: auto;
}

#dh-cite-popup .dh-cite-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
}

#dh-cite-popup .dh-cite-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border: none;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
  color: #4b5563;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
}

#dh-cite-popup .dh-cite-tab.is-active {
  background: rgba(61, 91, 217, 0.14);
  color: #3d5bd9;
}

#dh-cite-popup .dh-cite-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}

#dh-cite-popup .dh-cite-popup-doc {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.45;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  word-break: break-all;
}

#dh-cite-popup .dh-cite-popup-content {
  font-size: 13px;
  color: #374151;
  line-height: 1.65;
  word-break: break-word;
}

#dh-cite-popup .dh-md-p {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

#dh-cite-popup .dh-md-strong,
#dh-cite-popup strong,
#dh-cite-popup b {
  font-size: inherit !important;
  font-weight: 600 !important;
  line-height: inherit !important;
}

#dh-cite-popup .dh-md-em,
#dh-cite-popup em,
#dh-cite-popup i {
  font-size: inherit !important;
  font-style: italic !important;
  line-height: inherit !important;
}

#dh-cite-popup .dh-md-p:last-child {
  margin-bottom: 0;
}

#dh-cite-popup .dh-md-ul,
#dh-cite-popup .dh-md-ol {
  margin: 4px 0 8px;
  padding-left: 0;
  list-style: none !important;
}

#dh-cite-popup .dh-md-ul {
  padding-left: 1.1em;
  list-style: disc !important;
  list-style-position: inside !important;
}

#dh-cite-popup .dh-md-ol {
  padding-left: 0;
}

#dh-cite-popup .dh-md-ord {
  font-variant-numeric: tabular-nums;
}

#dh-cite-popup .dh-md-ul li,
#dh-cite-popup .dh-md-ol li {
  margin: 2px 0;
}

#dh-cite-popup .dh-md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}

#dh-cite-popup .dh-md-table-wrap {
  width: 100%;
  overflow-x: hidden;
  margin: 0 0 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
}

#dh-cite-popup .dh-md-table {
  width: 100%;
  border-collapse: collapse;
  /* 按内容自动分配列宽 */
  table-layout: auto;
  font-size: 12px;
  line-height: 1.5;
}

#dh-cite-popup .dh-md-table th,
#dh-cite-popup .dh-md-table td {
  border: 1px solid rgba(15, 23, 42, 0.1);
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  /* 单列最低占 33%，其余随内容伸缩 */
  min-width: 33%;
}

#dh-cite-popup .dh-md-table th {
  background: rgba(61, 91, 217, 0.08);
  color: #1f2a44;
  font-weight: 600;
}

#dh-cite-popup .dh-md-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

/* 底部交互区：容器穿透，子控件自己接事件 */
#dh-custom-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400 !important;
  min-height: auto;
  padding: 8px 12px calc(10px + var(--dh-safe-bottom));
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  pointer-events: none !important;
}

#dh-voice-tip {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  /* 浮在输入行上方（底栏已无快捷区） */
  top: 8px;
  bottom: calc(8px + var(--dh-safe-bottom));
  z-index: 450;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  pointer-events: none !important;
}

#dh-voice-tip.is-show {
  display: flex;
}

#dh-voice-tip.is-cancel {
  background: rgba(212, 56, 13, 0.72);
  color: #fff;
  font-weight: 600;
}

#dh-custom-input,
#dh-custom-send,
#dh-custom-stop,
#dh-custom-answer,
#dh-custom-answer button,
#dh-answer-scroll,
#dh-hold-talk,
#dh-hold-talk *,
#dh-input-mode-toggle,
#dh-shot-mode,
#dh-chat-quick-tags,
#dh-chat-quick-tags button,
#dh-stage-services,
#dh-stage-services button,
#dh-party-sheet,
#dh-party-sheet button,
#dh-party-sheet a {
  pointer-events: auto !important;
  touch-action: manipulation;
}

#dh-hold-talk {
  touch-action: none !important;
  position: relative;
  z-index: 480;
}

/* 底栏快捷区已移除；标签改挂开场白下 #dh-chat-quick-tags */

#dh-custom-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

#dh-input-mode-toggle {
  flex: 0 0 auto;
  width: 36px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #4f6ef7;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#dh-input-mode-toggle svg {
  display: block;
}

/* 语音模式：全宽按住说话 */
#dh-hold-talk {
  flex: 1;
  height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid #d5deee;
  border-radius: 8px;
  background: #f7f8fa;
  color: #1f2a44;
  font-size: 15px;
  font-weight: 500;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
  opacity: 1;
}

#dh-hold-talk:disabled {
  opacity: 1;
  color: #1f2a44;
  background: #f7f8fa;
  border-color: #d5deee;
  cursor: pointer;
}

#dh-hold-talk .dh-hold-label {
  pointer-events: none;
}

#dh-hold-talk.is-recording {
  border-color: #4f6ef7;
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.15);
  background: rgba(79, 110, 247, 0.1);
  color: #3d5bd9;
}

#dh-hold-talk.is-recording.is-cancel {
  border-color: #ff7875;
  box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.15);
  background: rgba(255, 77, 79, 0.1);
  color: #d4380d;
}

/* 互动：自动聆听，按钮仅作状态展示 */
#dh-hold-talk.is-auto-listen {
  pointer-events: none !important;
  cursor: default;
  opacity: 1;
}

#dh-hold-talk.is-auto-listen.is-listening {
  background: #eef2ff;
  border-color: #c5d0f5;
  color: #3d5bd9;
}

#dh-hold-talk.is-auto-listen.is-thinking {
  background: #f5f6f8;
  border-color: #d5deee;
  color: #5c6b8a;
}

#dh-hold-talk.is-auto-listen.is-replying {
  background: #e8f3ff;
  border-color: #9ec5fe;
  color: #1d4ed8;
}

html.dh-mode-voice #dh-custom-input,
html.dh-mode-voice #dh-custom-send {
  display: none !important;
}

html.dh-mode-text #dh-hold-talk,
html.dh-mode-text #dh-shot-mode {
  display: none !important;
}

html.dh-mode-text #dh-voice-tip {
  display: none !important;
}

/* 与发送同位置：圆形「单次 / 互动」 */
#dh-shot-mode {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid #9db0f5;
  border-radius: 50%;
  background: #dce4fc;
  color: #3d5bd9;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  user-select: none;
}

#dh-shot-mode.is-interactive {
  background: #4f6ef7;
  border-color: #4f6ef7;
  color: #fff;
}

#dh-shot-mode:active {
  transform: scale(0.96);
}

#dh-custom-input {
  flex: 1;
  min-height: 40px;
  max-height: 88px;
  resize: none;
  border: 1px solid #d5deee;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  font-family: inherit;
}

#dh-custom-input:focus {
  border-color: #4f6ef7;
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.15);
}

#dh-custom-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin-left: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#dh-custom-send .dh-send-slot {
  display: block;
  width: 40px;
  height: 40px;
}

#dh-custom-send img {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

#dh-custom-send:active {
  transform: scale(0.96);
}

#dh-custom-send.is-text-fallback {
  display: none;
}

/* 调试状态条已隐藏 */
#dh-custom-status {
  display: none !important;
}

@media (min-width: 768px) {
  /* 网页版：整页不铺党建底图；舞台列用数字人海报（党建图宽度不够） */
  html,
  body,
  #app,
  .rendu-page,
  .rendu-content,
  .rendu-content-full {
    background-image: none !important;
    background-color: #eef2f8 !important;
  }

  /* 顶栏 / 舞台 / 问答 / 底栏同宽居中，不铺满整屏 */
  #dh-custom-topbar {
    left: 50%;
    right: auto;
    width: var(--dh-stage-w);
    max-width: 92vw;
    transform: translateX(-50%);
    padding-left: 12px;
    padding-right: 12px;
  }

  .rendu-left {
    left: 50% !important;
    right: auto !important;
    width: var(--dh-stage-w) !important;
    transform: translateX(-50%) !important;
    background-color: #eef2f8 !important;
    /* Web：舞台列始终用海报（与列宽匹配）；手机端不走这里 */
    background-image: url('/custom/assets/dh-idle-poster.jpg') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
  }

  #dh-custom-answer {
    left: 50%;
    right: auto;
    width: var(--dh-stage-w);
    max-width: 92vw;
    transform: translateX(-50%);
  }

  #dh-stage-services {
    left: 50%;
    right: auto;
    width: calc(var(--dh-stage-w) - 20px);
    max-width: calc(92vw - 20px);
    transform: translateX(-50%);
  }

  #dh-custom-bottom {
    left: 50%;
    transform: translateX(-50%);
    width: var(--dh-stage-w);
    max-width: 92vw;
    border-radius: 16px 16px 0 0;
  }
}

/* 手机端：上线前仍是整页党建底图；上线后海报才垫到舞台铺满 */
@media (max-width: 767px) {
  html.dh-dh-online .rendu-left {
    background-image: url('/custom/assets/dh-idle-poster.jpg') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
  }
}

/* 党建列表/详情壳（底部 sheet；CMS 未接时空态） */
#dh-party-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  pointer-events: none;
}

#dh-party-sheet.is-show {
  display: block;
  pointer-events: auto;
}

#dh-party-sheet .dh-party-sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

#dh-party-sheet .dh-party-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.12);
  padding-bottom: calc(12px + var(--dh-safe-bottom));
  box-sizing: border-box;
}

#dh-party-sheet .dh-party-sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid #eef2f7;
}

#dh-party-sheet .dh-party-sheet-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: #1f2a44;
  text-align: center;
}

#dh-party-sheet .dh-party-back,
#dh-party-sheet .dh-party-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

#dh-party-sheet .dh-party-back {
  font-size: 13px;
  font-weight: 600;
  width: auto;
  padding: 0 10px;
}

#dh-party-sheet .dh-party-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 8px;
  -webkit-overflow-scrolling: touch;
}

#dh-party-sheet .dh-party-empty {
  padding: 28px 8px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

#dh-party-sheet .dh-party-empty-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #94a3b8;
}

#dh-party-sheet .dh-party-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#dh-party-sheet .dh-party-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  box-sizing: border-box;
}

#dh-party-sheet .dh-party-item-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1f2a44;
}

#dh-party-sheet .dh-party-item-summary {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

#dh-party-sheet .dh-party-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f2a44;
  margin: 0 0 10px;
}

@media (min-width: 768px) {
  #dh-party-sheet .dh-party-sheet-panel {
    left: 50%;
    right: auto;
    width: min(var(--dh-stage-w), 92vw);
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}

