/* ===== v12.0 对话页：气泡列表 + 底部输入栏（单屏内独立滚动） =====
   加载于 shell.css 之后；只在 #scr-chat 内生效，不影响其他分区 */

#scr-chat{padding:0; overflow:hidden}
#scr-chat.on{display:flex; flex-direction:column; height:100%}

/* ===== v12.1 对话对象条：横滑 chips（档案库每人 + 最近合盘）+「⋯」选择器 ===== */
/* 模型失败提示条：不再静默回退，让原因可见 */
.chat-alert{flex:0 0 auto; display:flex; align-items:center; gap:8px;
  padding:8px 10px; background:#fdf3ef; border-bottom:1px solid #f0d9cf}
.chat-alert.quota{background:#fdf6e7; border-bottom-color:#f0e0bd}
.chat-alert .ca-dot{flex:0 0 auto; width:16px; height:16px; border-radius:50%;
  background:var(--accent); color:#fff; font-size:11px; line-height:16px;
  text-align:center; font-weight:700}
.chat-alert.quota .ca-dot{background:#c8891f}
.chat-alert .ca-txt{flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:1px}
.chat-alert .ca-txt b{font-size:11.5px; color:var(--accent); font-weight:600}
.chat-alert.quota .ca-txt b{color:#a2701a}
.chat-alert .ca-txt span{font-size:11px; color:var(--ink2); line-height:1.35;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.chat-alert .ca-btn{flex:0 0 auto; padding:4px 10px; border-radius:999px;
  border:1px solid var(--accent); background:#fff; color:var(--accent);
  font-size:11px; font-family:inherit}
.chat-alert.quota .ca-btn{border-color:#c8891f; color:#a2701a}
.chat-alert .ca-x{flex:0 0 auto; width:22px; height:22px; border:none; background:none;
  color:#b0a696; font-size:15px; line-height:1; padding:0}

.chat-ctx{flex:0 0 auto; display:flex; align-items:center; gap:6px;
  padding:7px 10px; border-bottom:1px solid var(--line);
  background:rgba(250,247,241,.98)}
.ctx-scroll{flex:1 1 auto; min-width:0; display:flex; align-items:center; gap:6px;
  overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain; scrollbar-width:none}
.ctx-scroll::-webkit-scrollbar{display:none}
.ctx-chip{flex:0 0 auto; max-width:158px; overflow:hidden; text-overflow:ellipsis;
  padding:5px 12px; border-radius:999px; border:1px solid var(--line); background:#fff;
  color:var(--ink2); font-size:12px; letter-spacing:.3px; white-space:nowrap;
  font-family:inherit; transition:background .16s, color .16s}
.ctx-chip.on{background:linear-gradient(180deg,#a8452d,#8f331e); color:#fff;
  border-color:transparent; font-weight:600; box-shadow:0 1px 5px rgba(154,59,38,.24)}
.ctx-chip.hp.on{background:linear-gradient(180deg,#5a7d6a,#476554);
  box-shadow:0 1px 5px rgba(71,101,84,.26)}
.ctx-chip:active{background:var(--accent-soft); color:var(--accent)}
.ctx-chip.on:active{background:linear-gradient(180deg,#a8452d,#8f331e); color:#fff}
.ctx-empty{font-size:11.5px; color:#a99e8e; padding:4px 2px; white-space:nowrap}
.ctx-more{flex:0 0 auto; width:30px; height:30px; padding:0; border-radius:9px;
  border:1px solid var(--line); background:#fff; color:var(--ink2); font-size:15px;
  line-height:1; display:flex; align-items:center; justify-content:center}
.ctx-more:active{background:#f6f1e7}

/* 选择器：单人列表 + 合盘组合器 */
.ctx-rows{display:flex; flex-direction:column; gap:8px; margin-top:8px}
.ctx-row{position:relative; display:flex; flex-direction:column; gap:2px; width:100%;
  text-align:left; padding:10px 12px; border-radius:12px;
  border:1px solid var(--line); background:#fff; font-family:inherit}
.ctx-row.on{border-color:var(--accent); background:#fdf6f2}
.ctx-row-n{font-size:13.5px; color:var(--ink); letter-spacing:.5px}
.ctx-row-s{font-size:11px; color:var(--ink2); line-height:1.5}
.ctx-row-t{position:absolute; right:10px; top:10px; font-size:10.5px; color:var(--accent);
  background:var(--accent-soft); border-radius:999px; padding:2px 8px}
.ctx-hp{display:flex; align-items:center; gap:8px; margin-top:8px}
.ctx-hp select{flex:1 1 0; min-width:0; padding:9px 10px; border:1px solid var(--line);
  border-radius:10px; background:#fff; font-size:13px; color:var(--ink); font-family:inherit}
.ctx-x{flex:0 0 auto; color:var(--ink2); font-size:12px}
.ctx-go{display:block; width:100%; margin-top:10px; padding:11px 0; border:none;
  border-radius:12px; color:#fff; font-size:13.5px; letter-spacing:1px;
  background:linear-gradient(180deg,#5a7d6a,#476554);
  box-shadow:0 2px 8px rgba(71,101,84,.2)}
.ctx-go:active{transform:translateY(1px); box-shadow:none}
.ctx-go[disabled]{opacity:.45; pointer-events:none; box-shadow:none}

/* 列表区 */
.chat-list{flex:1 1 auto; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain; padding:14px 14px 6px}

/* 消息行 */
.msg{display:flex; align-items:flex-start; margin-bottom:13px}
.msg.me{justify-content:flex-end}
.msg-av{flex:0 0 auto; width:26px; height:26px; border-radius:9px; margin-right:8px;
  display:flex; align-items:center; justify-content:center;
  background:var(--accent-soft); color:var(--accent); font-size:11px; letter-spacing:.5px}
.msg-body{max-width:80%; padding:11px 13px; border-radius:14px;
  font-size:13.5px; line-height:1.88; word-break:break-word; white-space:pre-wrap}
.msg.ai .msg-body{background:#fff; border:1px solid var(--line); border-top-left-radius:5px;
  box-shadow:0 1px 3px rgba(90,70,40,.05); color:var(--ink)}
.msg.me .msg-body{background:var(--accent); color:#fff; border-top-right-radius:5px;
  box-shadow:0 2px 8px rgba(154,59,38,.18)}
.msg-foot{margin:5px 0 0 34px; font-size:10.5px; color:#a99e8e; letter-spacing:.3px}
.msg-foot.rp-more-tag{color:var(--ink2)}

/* 打字态：三点呼吸 */
/* 文字渐显：打字中在末尾留一根呼吸光标 */
.msg.ai .msg-body.tw-on::after{content:''; display:inline-block; width:2px; height:.92em;
  margin-left:3px; vertical-align:-.06em; border-radius:1px; background:var(--accent);
  animation:tw-caret 1s steps(1,end) infinite}
@keyframes tw-caret{0%,49%{opacity:.85} 50%,100%{opacity:0}}

.typing{display:flex; gap:4px; padding:3px 0}
.typing i{width:5px; height:5px; border-radius:50%; background:#c2b6a4;
  animation:tp 1.1s infinite ease-in-out}
.typing i:nth-child(2){animation-delay:.16s}
.typing i:nth-child(3){animation-delay:.32s}
@keyframes tp{0%,70%,100%{opacity:.35; transform:translateY(0)} 35%{opacity:1; transform:translateY(-3px)}}

/* 开场卡 + 话题 chips */
.chat-hello{text-align:center; padding:22px 16px 8px}
.chat-hello .h-t{font-size:14.5px; letter-spacing:1px; margin-bottom:7px}
.chat-hello .h-d{font-size:12px; line-height:1.85; color:var(--ink2)}
.chat-chips{display:flex; flex-wrap:wrap; gap:7px; margin:14px 0 16px}
.chat-chips button{background:#fff; border:1px solid var(--line); color:var(--ink);
  border-radius:999px; padding:6px 12px; font-size:12.5px; letter-spacing:.3px}
.chat-chips button:active{background:var(--accent-soft); color:var(--accent); border-color:var(--accent)}
.chat-tip{font-size:11px; color:#a99e8e; line-height:1.75; text-align:center; margin:6px 6px 12px}

/* 输入栏 */
.chat-bar{flex:0 0 auto; display:flex; align-items:flex-end; gap:8px;
  padding:9px 12px calc(9px + env(safe-area-inset-bottom));
  border-top:1px solid var(--line); background:rgba(255,255,255,.98);
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px)}
.chat-bar textarea{flex:1 1 auto; min-width:0; resize:none; max-height:104px;
  border:1px solid var(--line); border-radius:12px; background:#faf8f4;
  padding:9px 11px; font-size:13.5px; line-height:1.6; color:var(--ink);
  font-family:inherit; outline:none}
.chat-bar textarea:focus{border-color:var(--accent); background:#fff;
  box-shadow:0 0 0 3px rgba(154,59,38,.08)}
.chat-bar .send{flex:0 0 auto; border:none; border-radius:12px; padding:10px 15px;
  font-size:13px; letter-spacing:1px; color:#fff;
  background:linear-gradient(180deg,#a8452c,#8f3520);
  box-shadow:0 2px 8px rgba(154,59,38,.22)}
.chat-bar .send:active{transform:translateY(1px); box-shadow:none}
.chat-bar .send[disabled]{opacity:.45; pointer-events:none}
.chat-bar .ico{flex:0 0 auto; width:36px; height:36px; border-radius:11px;
  border:1px solid var(--line); background:#fff; color:var(--ink2);
  display:flex; align-items:center; justify-content:center; font-size:15px}
.chat-bar .ico:active{background:#f6f1e7}

/* 引擎标识 */
.chat-eng{display:flex; align-items:center; justify-content:center; gap:5px;
  font-size:10.5px; color:#b0a696; padding:6px 0 0}
.chat-eng b{color:var(--accent); font-weight:500}

/* ===== v12.3 对话引擎配置抽屉 ===== */
.llm-state{background:var(--card); border:1px solid var(--line); border-radius:12px;
  padding:11px 13px; margin-top:4px}
.llm-cur{display:flex; align-items:baseline; gap:8px; font-size:13px; color:var(--ink)}
.llm-cur b{font-weight:600; letter-spacing:.3px}
.llm-cur b.ok{color:var(--c-mu)}
.llm-cur span{font-size:12px; color:var(--ink2)}
.llm-cur-base{font-size:11px; line-height:1.7; color:#a99e8e; margin-top:4px; word-break:break-all}

.llm-presets{display:flex; gap:8px; overflow-x:auto; -webkit-overflow-scrolling:touch;
  padding:2px 0 4px; scrollbar-width:none}
.llm-presets::-webkit-scrollbar{display:none}
.llm-presets button{flex:0 0 auto; border:1px solid var(--line); background:#fff; color:var(--ink2);
  border-radius:999px; padding:7px 14px; font-size:12.5px; font-family:inherit; letter-spacing:.3px}
.llm-presets button.on{border-color:var(--accent); color:var(--accent); background:var(--accent-soft)}
.llm-note{font-size:11px; color:#a99e8e; min-height:16px; margin:2px 0 2px}

.llm-field{display:block; margin:12px 0}
.llm-field span{display:block; font-size:12px; color:var(--ink2); letter-spacing:.6px; margin-bottom:5px}
.llm-field input{width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px;
  background:#fff; color:var(--ink); font-size:13px; font-family:inherit; letter-spacing:.2px}
.llm-field input:focus{outline:none; border-color:var(--accent)}

.llm-hint{font-size:11px; line-height:1.75; color:#a99e8e; margin:12px 0 14px}
.llm-acts{display:flex; gap:10px}
.llm-acts button{flex:1; font-family:inherit; font-size:14px; border-radius:12px; padding:12px 10px}
.llm-acts .ghost{border:1px solid var(--line); background:#fff; color:var(--ink2)}
.llm-acts .primary{border:none; background:var(--accent); color:#fff; letter-spacing:1px}
.llm-acts button:disabled{opacity:.55}

.llm-result{min-height:18px; margin-top:12px; font-size:12.5px; line-height:1.75; color:var(--ink2)}
.llm-result b.ok{color:var(--c-mu); font-weight:600}
.llm-result b.bad{color:var(--c-huo); font-weight:600}
.llm-det{margin-top:6px; font-size:11px; line-height:1.65; color:#a99e8e; word-break:break-all}

.llm-clear{width:100%; margin-top:18px; padding:9px; background:none; border:none;
  color:#a99e8e; font-size:12px; font-family:inherit}

