/* 心声对话（只在这一页加载，配色全部取自 main 的 styles.css 变量） */
#dialogue-page {
  position: fixed;
  top: 60px; left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 296px 1fr;
  min-height: 0;
  transition: grid-template-columns .22s ease;
}
/* 收起名单：只留一条 46px 的窄轨，聊天区随之变宽 */
#dialogue-page.side-off { grid-template-columns: 46px 1fr; }
#dialogue-page.side-off .talk-side { display: none; }
.talk-rail {
  display: none; flex-direction: column; align-items: center; gap: 8px;
  padding-top: 12px; min-height: 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--paper-fiber), transparent);
}
#dialogue-page.side-off .talk-rail { display: flex; }
/* 窄屏名单抽屉的遮罩：只在小屏且名单展开时出现，桌面不占位也不拦截点击 */
.talk-backdrop { display: none; }
.rail-btn {
  width: 30px; height: 30px; border-radius: 8px; font-size: 14px; line-height: 1;
  color: var(--text-dim); background: var(--panel-solid); border: 1px solid var(--border);
}
.rail-btn:hover { color: var(--text); border-color: var(--accent); }
/* 面板显隐统一走 hidden；不强制一下，display:flex 会盖掉 [hidden] */
#dialogue-page [hidden] { display: none !important; }

/* ---------- 左：名单 ---------- */
.talk-side {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--paper-fiber), transparent);
}
.ts-head { padding: 16px 14px 10px; border-bottom: 1px solid var(--border); }
.ts-title { font-size: 13px; letter-spacing: 2px; color: var(--text-dim); }
.ts-title span { color: var(--gold); letter-spacing: 0; }
.ts-head input {
  width: 100%; margin-top: 10px; padding: 8px 10px; font-size: 13px;
  color: var(--text); background: var(--panel-solid);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
  font-family: inherit;
}
.ts-head input:focus { border-color: var(--accent); }
.ts-filters { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.ts-filters button {
  padding: 4px 10px; font-size: 12px; border-radius: 999px;
  color: var(--text-dim); background: transparent; border: 1px solid var(--border);
}
.ts-filters button.on { color: var(--panel-solid); background: var(--accent); border-color: var(--accent); }
.ts-body { flex: 1; overflow-y: auto; padding: 8px; }
.ts-body::-webkit-scrollbar { width: 6px; }
.ts-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-dim) 28%, transparent); border-radius: 3px;
}
.pitem {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: 9px; background: transparent;
  color: var(--text); text-align: left; border: 1px solid transparent;
}
.pitem:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.pitem.on {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
}
.pitem.locked { opacity: .42; cursor: default; }
.pitem .pa {
  width: 26px; height: 26px; border-radius: 6px; flex: none;
  display: grid; place-items: center; font-size: 13px; color: #2b2620; font-weight: 700;
}
/* 人物头像图片：沿用各容器原有的尺寸与圆角裁切，只把首字占位换成照片 */
.pitem .pa img,
.tc-av img,
.tmsg .tav img {
  width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block;
}
.pitem .pn { flex: 1; min-width: 0; }
.pitem .pn b { display: block; font-size: 13.5px; font-weight: 500; }
.pitem .pn i {
  display: block; font-style: normal; font-size: 11px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pitem .ps {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: color-mix(in srgb, var(--text-dim) 35%, transparent);
}
.pitem .ps.ready { background: var(--green); }

/* ---------- 右：主区 ---------- */
.talk-main { display: flex; flex-direction: column; min-height: 0; position: relative; }

.talk-empty { margin: auto; max-width: 560px; padding: 40px; text-align: center; }
.talk-empty p { font-size: 14px; line-height: 2; color: var(--text-dim); }
.talk-empty .te-dim { font-size: 14px; line-height: 2; opacity: .88; }

.talk-chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.tc-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 22px;
  border-bottom: 1px solid var(--border); flex: none;
}
.tc-av {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font-size: 18px; font-weight: 700; color: #2b2620; flex: none;
}
.tc-who b { font-size: 16px; letter-spacing: 1px; }
.tc-who span { margin-left: 8px; font-size: 12px; color: var(--text-dim); }
.tc-badges { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tc-badge {
  padding: 3px 10px; border-radius: 999px; font-size: 11px;
  color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  background: color-mix(in srgb, var(--gold) 9%, transparent);
}
.tc-badge.warn {
  color: var(--red); border-color: color-mix(in srgb, var(--red) 38%, transparent);
  background: color-mix(in srgb, var(--red) 9%, transparent);
}
.tc-view {
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
  color: var(--text-dim); border: 1px solid var(--border); background: transparent;
}
.tc-view:hover { color: var(--text); border-color: var(--accent); }
.tc-auto {
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
  color: var(--text-dim); border: 1px solid var(--border); background: transparent;
}
.tc-auto:hover { color: var(--text); border-color: var(--accent); }
.tc-auto.on {
  color: var(--gold); border-color: color-mix(in srgb, var(--gold) 42%, transparent);
  background: color-mix(in srgb, var(--gold) 9%, transparent);
}

.tc-body {
  flex: 1; min-height: 0; display: flex;
}
.tc-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- 苏轼沉浸版：伪满屏（八成宽主画面 + 同源模糊补边） ---------- */
.talk-chat { position: relative; overflow: hidden; }
/* 收起名单时视频不跟着变宽、不左移：只把左边空间让出来，画面尺寸位置都不动 */
#dialogue-page.film-page { transition: none; }
.tc-film {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  background: #17110c;            /* 补边压到最暗，不外露白 */
}
/* 补边层：同一段视频铺满、重度模糊 + 压暗 + 降饱和，色调贴住主画面 */
.tf-bg {
  position: absolute; left: -6%; top: -6%; width: 112%; height: 112%;
  display: block; object-fit: cover; object-position: 50% 32%;
  filter: blur(46px) saturate(.62) brightness(.40);
  transform: scale(1.06);
}
/* 主画面：宽度约八成、垂直居中 */
.tf-stage {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.tf-video {
  width: 80%; height: 100%; display: block;
  object-fit: cover;
  object-position: 50% 18%;       /* 只保脸和上半身，背景与下半身随裁 */
  /* 不叠 filter、不加 mask、不额外 scale：主画面保持原生清晰度和原片色彩 */
}
/* 页面级硬规则：心声对话里的人物影像只要「画面 + 循环播放」，
 * 不出现原生控件条，也不允许任何进度/时间浮层冒充控件（对以后新加的角色同样生效） */
#dialogue-page video::-webkit-media-controls,
#dialogue-page video::-webkit-media-controls-enclosure,
#dialogue-page video::-webkit-media-controls-panel {
  display: none !important;
}
#dialogue-page video { pointer-events: none; }
/* 两侧压暗 + 接缝柔化 + 大范围径向暗角：补边融进画面，视线收到中间偏下 */
.tc-film::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    /* 两条接缝带：从主画面边缘柔和过渡到补边，避免竖向硬线 */
    linear-gradient(90deg,
      transparent 2%,
      color-mix(in srgb, #120d09 46%, transparent) 10%,
      transparent 18%),
    linear-gradient(90deg,
      transparent 82%,
      color-mix(in srgb, #120d09 46%, transparent) 90%,
      transparent 98%),
    linear-gradient(90deg,
      color-mix(in srgb, #0b0805 48%, transparent) 0,
      transparent 20%,
      transparent 80%,
      color-mix(in srgb, #0b0805 48%, transparent) 100%),
    radial-gradient(76% 62% at 50% 46%,
      transparent 34%,
      color-mix(in srgb, #0c0906 38%, transparent) 68%,
      color-mix(in srgb, #090705 74%, transparent) 100%);
}
/* 底部渐暗：从画面柔和过渡到浮层面板，不硬碰 */
.tc-film::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg,
    transparent 46%,
    color-mix(in srgb, #140e0a 20%, transparent) 66%,
    color-mix(in srgb, #100b08 62%, transparent) 86%,
    color-mix(in srgb, #0d0906 84%, transparent) 100%);
}
/* ---------- 浅色主题：补边换成站点自己的米白底（--bg），暗角压轻 ---------- */
:root[data-theme='light'] .tc-film { background: var(--bg); }
:root[data-theme='light'] .tf-bg {
  /* 只留很淡的一层光影，整体是纸面而不是暗场 */
  filter: blur(46px) saturate(.85) brightness(1.16);
  opacity: .10;
}
:root[data-theme='light'] .tc-film::before {
  background:
    linear-gradient(90deg,
      transparent 2%,
      color-mix(in srgb, #7a6749 12%, transparent) 10%,
      transparent 18%),
    linear-gradient(90deg,
      transparent 82%,
      color-mix(in srgb, #7a6749 12%, transparent) 90%,
      transparent 98%),
    radial-gradient(80% 68% at 50% 46%,
      transparent 42%,
      color-mix(in srgb, #6b5a3f 7%, transparent) 78%,
      color-mix(in srgb, #6b5a3f 15%, transparent) 100%);
}
:root[data-theme='light'] .tc-film::after {
  background: linear-gradient(180deg,
    transparent 52%,
    color-mix(in srgb, var(--bg) 42%, transparent) 78%,
    color-mix(in srgb, var(--bg) 82%, transparent) 100%);
}
/* ≥901px 才有名单收起，只在这里改视频宽度；窄屏名单本来就没了 */
@media (min-width: 901px) {
  #dialogue-page.film-page.side-off .tc-film { left: auto; width: calc(100% - 250px); }
}

.talk-chat.film-mode .tc-panel {
  position: absolute; z-index: 2;
  left: 22px; right: 22px; bottom: 26px;
  height: min(46%, 380px);
  background: color-mix(in srgb, var(--panel-solid) 76%, transparent);
  backdrop-filter: blur(12px) saturate(1.06);
  -webkit-backdrop-filter: blur(12px) saturate(1.06);
  border: 1px solid color-mix(in srgb, #fffaf0 42%, transparent);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 48px color-mix(in srgb, #2a1e14 45%, transparent);
}
/* 面板瘦身：标题行压扁、旧标签藏掉、按钮只剩图标，把高度全留给对话 */
.talk-chat.film-mode .tc-head { flex: none; padding: 8px 14px; gap: 8px; }
.talk-chat.film-mode .tc-av { width: 28px; height: 28px; font-size: 14px; border-radius: 7px; }
.talk-chat.film-mode .tc-who b { font-size: 14px; }
.talk-chat.film-mode .tc-who span { font-size: 11px; }
.talk-chat.film-mode .tc-badge { display: none !important; }
.talk-chat.film-mode .tc-input { flex: none; padding: 8px 14px 8px; gap: 8px; }
.talk-chat.film-mode .tc-input textarea { min-height: 42px; padding: 10px 12px; font-size: 13.5px; }
.talk-chat.film-mode .tc-input button { height: 42px; padding: 0 18px; }
.talk-chat.film-mode .tc-stream { padding: 14px 16px 6px; }

/* 图标化：非 film-mode 显示文字，film-mode 只留图标 */
.bi { display: none; }
.talk-chat.film-mode .tc-auto,
.talk-chat.film-mode .tc-view {
  width: 26px; height: 26px; padding: 0; border-radius: 8px;
  display: grid; place-items: center; font-size: 13px; line-height: 1;
}
.talk-chat.film-mode .tc-auto .bt,
.talk-chat.film-mode .tc-view .bt,
.talk-chat.film-mode .tc-reset .bt { display: none; }
.talk-chat.film-mode .tc-auto .bi,
.talk-chat.film-mode .tc-view .bi,
.talk-chat.film-mode .tc-reset .bi { display: inline; }

/* ---------- 浮层可拖动 / 可缩放（只认 film-mode） ---------- */
.tc-reset, .tc-grip { display: none; }
.tc-reset {
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
  color: var(--text-dim); border: 1px solid var(--border); background: transparent;
}
.tc-reset:hover { color: var(--text); border-color: var(--accent); }
/* 复位：有影像的普通态照旧显示；铺满态下也留着，作为"退出铺满 + 恢复默认"的出口 */
.talk-chat.film-mode:not(.film-fixed) .tc-reset,
.talk-chat.chat-fs .tc-reset {
  display: grid; place-items: center; width: 26px; height: 26px;
  padding: 0; border-radius: 8px; font-size: 13px; line-height: 1;
}

/* 抓取区：标题栏（按钮除外）；文字不可选，避免拖出蓝色选区 */
.talk-chat.film-mode:not(.film-fixed) .tc-head { cursor: grab; user-select: none; touch-action: none; }
.talk-chat.film-mode:not(.film-fixed) .tc-head button { cursor: pointer; }
.talk-chat.film-mode:not(.film-fixed) .tc-panel.free .tc-head { cursor: grab; }

/* 拖拽后改成四边定位，覆盖默认的 left/right/bottom/height。
 * fixed + 视口坐标：才能拖出聊天区、压到左侧名单上面，也不被聊天区的 overflow 裁掉 */
.talk-chat.film-mode .tc-panel.free {
  position: fixed; z-index: 60;
  left: auto; top: auto; right: auto; bottom: auto;
}

/* 四边 + 四角缩放把手：边 6px、角 16px，避让标题按钮 */
.talk-chat.film-mode:not(.film-fixed) .tc-grip {
  display: block; position: absolute; z-index: 4; touch-action: none;
}
.talk-chat.film-mode:not(.film-fixed) .g-n { top: 0; left: 16px; right: 16px; height: 6px; cursor: ns-resize; }
.talk-chat.film-mode:not(.film-fixed) .g-s { bottom: 0; left: 16px; right: 16px; height: 6px; cursor: ns-resize; }
.talk-chat.film-mode:not(.film-fixed) .g-w { top: 16px; bottom: 16px; left: 0; width: 6px; cursor: ew-resize; }
/* 东侧把手往内让 8px：它原本正好压在正文 6px 滚动条上，
 * 鼠标按滚动条会先命中它，变成缩放面板而不是拖动滚动 */
.talk-chat.film-mode:not(.film-fixed) .g-e { top: 16px; bottom: 16px; right: 8px; width: 6px; cursor: ew-resize; }
.talk-chat.film-mode:not(.film-fixed) .g-nw { top: 0; left: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.talk-chat.film-mode:not(.film-fixed) .g-ne { top: 0; right: 0; width: 16px; height: 16px; cursor: nesw-resize; }
.talk-chat.film-mode:not(.film-fixed) .g-sw { bottom: 0; left: 0; width: 16px; height: 16px; cursor: nesw-resize; }
.talk-chat.film-mode:not(.film-fixed) .g-se { bottom: 0; right: 0; width: 16px; height: 16px; cursor: nwse-resize; }
/* 右下角给个看得见的抓痕，其余边靠光标提示 */
.talk-chat.film-mode:not(.film-fixed) .g-se {
  border-right: 2px solid color-mix(in srgb, var(--text-dim) 55%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--text-dim) 55%, transparent);
  border-bottom-right-radius: 8px;
}
/* ---------- 聊天记录铺满：只把记录列撑开，影像留在底下继续播 ---------- */
.tc-fs { display: none; }
.talk-chat.film-mode .tc-fs,
.talk-chat.chat-fs .tc-fs {
  display: grid; place-items: center; width: 26px; height: 26px;
  padding: 0; border-radius: 8px; font-size: 13px; line-height: 1;
  color: var(--text-dim); border: 1px solid var(--border); background: transparent;
}
.talk-chat.film-mode .tc-fs:hover,
.talk-chat.chat-fs .tc-fs:hover { color: var(--text); border-color: var(--accent); }
.talk-chat.film-mode .tc-fs.on,
.talk-chat.chat-fs .tc-fs.on {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.talk-chat.film-mode .tc-fs .bi,
.talk-chat.chat-fs .tc-fs .bi { display: inline; }
.talk-chat.film-mode .tc-fs .bt,
.talk-chat.chat-fs .tc-fs .bt { display: none; }

/* 铺满：跟着面板走，不跟人物走。有影像时画面透上来，没影像时用纯色底 */
.talk-chat.chat-fs .tc-panel,
.talk-chat.chat-fs .tc-panel.free {
  position: absolute !important;
  top: 8px !important; left: 8px !important; right: 8px !important; bottom: 8px !important;
  width: auto !important; height: auto !important; max-height: none !important;
  z-index: 55 !important; border-radius: 16px !important;
  background: var(--panel-solid) !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  border-color: color-mix(in srgb, #fffaf0 22%, transparent) !important;
  box-shadow: 0 24px 70px color-mix(in srgb, #1a120a 38%, transparent) !important;
}
.talk-chat.film-mode.chat-fs .tc-panel,
.talk-chat.film-mode.chat-fs .tc-panel.free {
  background: color-mix(in srgb, var(--panel-solid) 10%, transparent) !important;
}
/* 记录区：铺开的正文 + 很淡的渐变底衬，浅色画面下也读得清 */
.talk-chat.chat-fs .tc-stream {
  padding: 22px clamp(16px, 4vw, 56px) 12px;
  overflow-x: hidden;
  background: linear-gradient(180deg,
    color-mix(in srgb, #14100c 42%, transparent),
    color-mix(in srgb, #14100c 28%, transparent) 55%,
    color-mix(in srgb, #14100c 14%, transparent));
}
:root[data-theme='light'] .talk-chat.chat-fs .tc-stream {
  background: linear-gradient(180deg,
    color-mix(in srgb, #faf6ee 64%, transparent),
    color-mix(in srgb, #faf6ee 46%, transparent) 55%,
    color-mix(in srgb, #faf6ee 24%, transparent));
}
.talk-chat.chat-fs .tmsg { max-width: 900px; }
.talk-chat.chat-fs .tbubble { overflow-wrap: anywhere; }
.talk-chat.chat-fs .tc-input textarea { min-width: 0; }
/* 标题栏和输入区各垫一点底，按钮和输入框在画面上仍然清楚 */
.talk-chat.chat-fs .tc-head {
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  border-bottom-color: color-mix(in srgb, #fffaf0 14%, transparent);
}
.talk-chat.chat-fs .tc-input {
  background: color-mix(in srgb, var(--panel-solid) 84%, transparent);
  padding-bottom: 10px;
  border-top-color: color-mix(in srgb, #fffaf0 14%, transparent);
}
/* 窄屏右上角的设置入口会压住铺满按钮，铺满期间先让开 */
#dialogue-page:has(.talk-chat.chat-fs) .talk-cfg-fab { display: none; }

@media (max-width: 700px) {
  .talk-chat.chat-fs .tc-panel,
  .talk-chat.chat-fs .tc-panel.free {
    top: 6px !important; left: 6px !important; right: 6px !important; bottom: 6px !important;
    border-radius: 12px !important;
  }
}

/* 缩到很小时再省一点：藏副标题、收紧留白 */
.tc-panel.compact .tc-who span { display: none; }
.tc-panel.compact .tc-head { padding: 6px 10px; }
.tc-panel.compact .tc-stream { padding: 8px 12px 4px; }
.tc-panel.compact .tc-input { padding: 6px 10px; }

body.panel-dragging { user-select: none; cursor: grabbing; }
body.panel-dragging * { cursor: inherit !important; }

@media (max-width: 640px) {
  .talk-chat.film-mode .tc-panel {
    left: 10px; right: 10px; bottom: 16px;
    height: min(46%, 420px);
  }
}
@media (max-height: 560px) {
  .talk-chat.film-mode .tc-panel {
    top: 10px; bottom: 10px; height: auto;
  }
}

.tc-stream { flex: 1; overflow-y: auto; padding: 24px 22px 8px; }
.tc-stream::-webkit-scrollbar { width: 6px; }
.tc-stream::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-dim) 28%, transparent); border-radius: 3px;
}
.tmsg { display: flex; gap: 10px; margin-bottom: 20px; align-items: flex-start; max-width: 780px; }
.tmsg.me { flex-direction: row-reverse; margin-left: auto; }
.tmsg .tav {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #2b2620;
}
.tmsg.me .tav { background: var(--panel-solid); color: var(--text-dim); font-weight: 400; }
.tmsg .tbubble {
  max-width: 76%; font-size: 14.5px; line-height: 2; white-space: pre-wrap;
  padding: 11px 15px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--border);
}
.tmsg.me .tbubble {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}
.tmsg .tmeta { margin-top: 6px; font-size: 11px; color: var(--text-dim); }
.tmsg .tmeta b { color: var(--gold); font-weight: 500; }
/* 事实标注：一行小字，只在提到年份/引文或点名往事时出现，不打断阅读 */
.tmsg .tcite {
  margin-top: 4px; font-size: 11px; line-height: 1.6;
  color: var(--text-dim); opacity: .85; word-break: break-word;
}
.tmsg .tcite::before { content: '※ '; opacity: .55; }
.tmsg .tctrls { margin-top: 6px; }
.tplay {
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px;
  color: var(--text-dim); border: 1px solid var(--border); background: transparent;
}
.tplay:hover { color: var(--text); border-color: var(--accent); }
.tplay.on {
  color: var(--gold); border-color: color-mix(in srgb, var(--gold) 42%, transparent);
  background: color-mix(in srgb, var(--gold) 9%, transparent);
}
/* 朗读加载提示：按钮就地变成三个缓动的点（不盖正文），2 秒后旁边补一行小字 */
.tplay.loading {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 58px; gap: 3px;
}
.tplay .tdots { display: inline-flex; gap: 3px; font-size: 10px; }
.tplay-hint {
  font-size: 11px; line-height: 1.6; color: var(--text-dim);
  opacity: .85; align-self: center;
}
@media (prefers-reduced-motion: reduce) {
  .tplay .tdots span { animation: none; opacity: .6; }
}
/* 回复下的轻量操作：朗读 + 重说（图标）+ 复制（图标） */
.tmsg .tctrls { display: flex; flex-wrap: wrap; gap: 6px; }
.tact {
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px;
  color: var(--text-dim); border: 1px solid var(--border); background: transparent;
}
.tact:hover { color: var(--text); border-color: var(--accent); }
.tact:disabled { opacity: .45; cursor: default; }
/* 图标操作（重说 / 复制）：视觉 26px，和文字按钮同高；
 * ::after 把可点/可触范围撑到 40px，触屏不至于点不中 */
.tact.ticon {
  position: relative; width: 26px; height: 26px; padding: 0; margin: 0 4px;
  border-radius: 8px; display: inline-grid; place-items: center;
}
.tact.ticon::after { content: ''; position: absolute; inset: -7px; }
.tact.ticon svg { width: 16px; height: 16px; display: block; }
.tact.ticon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tmsg .tbubble.waiting { opacity: .55; }

/* 开场问题：气泡下方的可点胶囊，点了只填进输入框 */
.tq { margin: 2px 0 20px 40px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tq-tip { font-size: 11.5px; color: var(--text-dim); }
.tq-btn {
  max-width: 100%; text-align: left; padding: 6px 12px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.6; color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}
.tq-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* 失败块：一句人话 + 重试（必要时加"去填 Key"），替代一直转圈 */
.tfail {
  margin: 0 0 16px 40px; padding: 9px 12px; border-radius: 9px;
  font-size: 12px; line-height: 1.7; color: var(--red);
  background: color-mix(in srgb, var(--red) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 26%, transparent);
  word-break: break-word;
}
.tfail-acts { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 8px; }
.tfail-acts button {
  padding: 3px 12px; border-radius: 999px; font-size: 11.5px;
  color: var(--text); border: 1px solid color-mix(in srgb, var(--red) 34%, transparent);
  background: transparent;
}
.tfail-acts button:hover { border-color: var(--red); color: var(--red); }

/* 收尾引导：聊过几轮后，末尾一句"去人生地图看看"，不抢对话的戏 */
.tend {
  margin: 4px 0 18px 40px; padding: 10px 13px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.75; color: var(--text-dim);
  background: color-mix(in srgb, var(--gold) 7%, transparent);
  border: 1px dashed color-mix(in srgb, var(--gold) 34%, transparent);
}
.tend-tip { color: var(--text-dim); }
.tend-link {
  display: inline-block; margin-top: 7px; padding: 3px 12px; border-radius: 999px;
  font-size: 12px; color: var(--gold); text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--gold) 42%, transparent);
}
.tend-link:hover, .tend-link:focus-visible {
  color: var(--panel-solid); background: var(--gold); border-color: var(--gold);
}

/* 标题栏「清空」：只清当前人物的记录，人物包与影像不受影响 */
.tc-clear {
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
  color: var(--text-dim); border: 1px solid var(--border); background: transparent;
}
.tc-clear:hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 42%, transparent); }

/* 读屏播报区：视觉上不可见，只给辅助技术 */
.sr-live {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 逐字输出：末尾一根细光标；点气泡可停在当前位置 */
.tmsg .tbubble.typing { cursor: pointer; }
.tmsg .tbubble.typing::after {
  content: '▌'; margin-left: 2px; opacity: .55;
  animation: tcaret 1s steps(1) infinite;
}
@keyframes tcaret { 50% { opacity: 0; } }
.tact.tstop { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 42%, transparent); }
.tdots span { animation: tblink 1.2s infinite; }
.tdots span:nth-child(2) { animation-delay: .2s; }
.tdots span:nth-child(3) { animation-delay: .4s; }
@keyframes tblink { 0%,60%,100% { opacity:.2 } 30% { opacity:1 } }

.tc-input {
  display: flex; gap: 10px; padding: 12px 22px 6px; border-top: 1px solid var(--border);
  flex: none; align-items: flex-end;
}
.tc-input textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 150px; padding: 12px 14px;
  font-family: inherit; font-size: 14px; line-height: 1.7; color: var(--text);
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 10px; outline: none;
}
.tc-input textarea:focus { border-color: var(--accent); }
.tc-input textarea:disabled { opacity: .6; cursor: default; border-color: var(--border); }
.tc-input button {
  height: 46px; padding: 0 24px; border-radius: 10px; font-size: 14px; letter-spacing: 2px;
  color: var(--panel-solid); background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.tc-input button:disabled { opacity: .35; }

/* ---------- 观点卡弹层 ---------- */
.talk-modal {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, #2a1e14 52%, transparent); backdrop-filter: blur(4px);
}
.talk-modal[hidden] { display: none; }
.tm-box {
  width: min(760px, 92vw); max-height: 84vh; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow);
}
.tm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.tm-head b { letter-spacing: 2px; }
.tm-head button { background: none; color: var(--text-dim); font-size: 16px; }
.tm-body { padding: 16px 20px; overflow-y: auto; font-size: 13.5px; line-height: 1.95; }
.tm-sec { margin-bottom: 18px; }
.tm-sec h4 {
  font-size: 11.5px; letter-spacing: 2px; color: var(--gold); font-weight: 500; margin-bottom: 6px;
}
.tm-sec p { color: var(--text); }
.tm-sec .tm-kv { color: var(--text-dim); }
.tm-anec { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.tm-anec:last-child { border-bottom: none; }
.tm-anec b { color: var(--text); font-weight: 500; }
.tm-anec .ty { margin-right: 8px; color: var(--gold); font-size: 12px; }
.tm-anec .tg {
  display: inline-block; margin: 2px 4px 0 0; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.tm-anec p { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.tm-quotes li { margin-left: 18px; color: var(--text-dim); }

/* ---------- 模型设置（访客自己的 Key） ---------- */
.ts-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ts-acts { display: flex; align-items: center; gap: 6px; }
.ts-fold {
  width: 24px; height: 22px; padding: 0; border-radius: 6px; font-size: 12px; line-height: 1;
  color: var(--text-dim); background: transparent; border: 1px solid var(--border);
}
.ts-fold:hover { color: var(--text); border-color: var(--accent); }
.ts-cfg {
  padding: 3px 9px; font-size: 11.5px; border-radius: 999px; white-space: nowrap;
  color: var(--text-dim); background: transparent; border: 1px solid var(--border);
}
.ts-cfg:hover { color: var(--text); border-color: var(--accent); }
.ts-cfg.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }

.cfg-box { width: min(460px, 92vw); }
.cfg-body { display: flex; flex-direction: column; gap: 10px; }
.cfg-block { display: flex; flex-direction: column; gap: 10px; }
.cfg-state { font-size: 12.5px; color: var(--text-dim); }
.cfg-state span { color: var(--gold); }
.cfg-label { font-size: 11.5px; letter-spacing: 1px; color: var(--text-dim); }
.cfg-body input {
  width: 100%; padding: 9px 11px; font-size: 13px; font-family: inherit;
  color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.cfg-body input:focus { border-color: var(--accent); }
.cfg-actions { display: flex; gap: 8px; }
.cfg-save {
  padding: 7px 16px; font-size: 12.5px; color: var(--panel-solid);
  background: var(--accent); border: 1px solid var(--accent); border-radius: 8px;
}
.cfg-clear {
  padding: 7px 14px; font-size: 12.5px; color: var(--red);
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
}
.cfg-target { font-size: 11.5px; color: var(--text-dim); font-family: ui-monospace, Consolas, monospace; }
.cfg-msg { font-size: 12px; color: var(--gold); white-space: pre-wrap; word-break: break-all; }

/* 窄屏时左栏隐藏，用右上角浮一个入口 */
.talk-cfg-fab {
  display: none; padding: 5px 11px; font-size: 11.5px; border-radius: 999px;
  color: var(--text-dim); background: var(--panel-solid); border: 1px solid var(--border);
}
.talk-cfg-fab.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }

@media (max-width: 900px) {
  #dialogue-page { grid-template-columns: 1fr; }
  #dialogue-page.side-off { grid-template-columns: 1fr; }
  /* 名单改成覆盖式抽屉：默认收起，点左上角 ☰ 展开；点人物/遮罩或 « 收起 */
  .talk-side {
    display: none;
    position: fixed; top: 60px; bottom: 0; left: 0;
    width: min(86vw, 320px); z-index: 420;
    background: var(--panel-solid);
    border-right: 1px solid var(--border);
    box-shadow: 0 18px 48px rgba(42, 30, 20, .28);
  }
  #dialogue-page:not(.side-off) .talk-side { display: flex; }
  /* ☰ 入口在两种状态下都固定可见（不再依赖 hover，也不占网格列） */
  .talk-rail,
  #dialogue-page.side-off .talk-rail {
    display: flex; position: fixed; top: 70px; left: 10px; z-index: 300;
    padding: 0; border: 0; background: transparent;
  }
  #dialogue-page:not(.side-off) .talk-backdrop {
    display: block; position: fixed; top: 60px; right: 0; bottom: 0; left: 0;
    z-index: 410; background: rgba(42, 30, 20, .38);
  }
  .talk-cfg-fab {
    display: block; position: fixed; top: 70px; right: 12px; z-index: 50;
    box-shadow: var(--shadow);
  }
  .tc-stream, .tc-head, .tc-input { padding-left: 14px; padding-right: 14px; }
}
