/* ==========================================================================
   脉络 PsyGraph · 可玩原型 —— 样式（星空中的一段通道）
   暗黑沉浸式主题：深空背景 #05060a / 玻璃卡片 / 文字浅灰蓝 #cfd6e4
   ========================================================================== */

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #05060a;
  color: #cfd6e4;
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  color-scheme: dark;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* ---------- 全局光效：星云柔光 + 暗角 ---------- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 72% 18%, rgba(90, 120, 220, .10), transparent 70%),
    radial-gradient(ellipse 50% 40% at 22% 78%, rgba(140, 100, 220, .08), transparent 70%),
    radial-gradient(ellipse 70% 55% at 50% 55%, rgba(60, 90, 180, .05), transparent 75%);
  animation: nebula-breathe 14s ease-in-out infinite alternate;
}
@keyframes nebula-breathe {
  from { opacity: .7; }
  to { opacity: 1.15; }
}
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 92% 82% at 50% 50%, transparent 52%, rgba(0, 0, 0, .48) 100%);
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
textarea, input, select { font-family: inherit; font-size: 13px; }

/* 深色滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.02); }
::-webkit-scrollbar-thumb { background: rgba(140,160,210,.18); border-radius: 999px; border: 2px solid #05060a; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,160,210,.32); }
* { scrollbar-width: thin; scrollbar-color: rgba(140,160,210,.25) rgba(255,255,255,.02); }

/* ---------- 星空粒子层 ---------- */
#sky {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* ---------- 顶栏 ---------- */
#topbar {
  position: relative;
  z-index: 40;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: rgba(8, 10, 18, .6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(160, 180, 230, .12);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #e8edff;
  text-shadow: 0 0 14px rgba(130, 160, 255, .35);
  white-space: nowrap;
}
/* 会话名：未命名时更暗 */
.session-name-display {
  font-size: 12px;
  color: #9fb2d8;
  background: rgba(120, 150, 220, .1);
  border: 1px solid rgba(160, 180, 230, .18);
  border-radius: 999px;
  padding: 1px 10px;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-name-display.unnamed { color: #5d6b86; background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.08); }
.chip { font-size: 11px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.chip-probe { background: rgba(120,150,220,.12); color: #9fb2d8; border-color: rgba(160,180,230,.16); }
.chip-stable { background: rgba(140,120,220,.14); color: #b3a6e8; border-color: rgba(180,160,255,.2); }
.chip-llm { background: rgba(80,200,160,.1); color: #7fd6b8; border-color: rgba(80,200,160,.2); }
.chip-mock { background: rgba(230,170,80,.1); color: #e6b877; border-color: rgba(230,170,80,.2); }
.top-actions { display: flex; gap: 8px; }
.top-btn {
  background: rgba(120, 150, 220, .06);
  border: 1px solid rgba(160, 180, 230, .18);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: #aebcd6;
  transition: all .18s;
}
.top-btn:hover {
  border-color: rgba(150, 180, 255, .45);
  color: #e8edff;
  background: rgba(120, 150, 220, .12);
  box-shadow: 0 0 12px rgba(130, 160, 255, .15);
}

/* ---------- 命名条：浮在内容上方，不打断流程 ---------- */
#naming-bar {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(12, 15, 26, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(160, 180, 230, .2);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  max-width: calc(100vw - 32px);
}
.naming-label { font-size: 13px; font-weight: 600; color: #c3cfea; white-space: nowrap; }
#naming-input {
  width: 220px;
  border: 1px solid rgba(160, 180, 230, .2);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
  background: rgba(255, 255, 255, .04);
  color: #dbe4f5;
}
#naming-input::placeholder { color: #5d6b86; }
#naming-input:focus { border-color: rgba(150, 180, 255, .5); }

/* ---------- 主布局：顶栏 / 通道 / 打字区 的 flex 列 ---------- */
#main {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}
#chat-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center; /* 通道内容+打字框整组垂直居中 */
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 0;
}

/* ---------- 通道显示区：文字直接浮在星空上 ---------- */
#messages {
  position: relative;
  flex: 0 1 auto; /* 收缩包裹：随内容长高，整组居中 */
  min-height: 0;
  max-height: 62vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 14px;
  background: none;
  border: none;
}
#channelText {
  width: 100%;
  max-width: 720px;
  font-size: 1.4rem;
  line-height: 1.9;
  letter-spacing: .05em;
  color: #dbe4f5;
  text-align: center;
  text-shadow: 0 0 10px rgba(190, 210, 255, .55), 0 0 28px rgba(130, 160, 255, .35), 0 0 64px rgba(110, 140, 240, .22);
  animation: channel-glow 5s ease-in-out infinite alternate;
  white-space: pre-wrap;
  word-break: break-word;
}
@keyframes channel-glow {
  from { opacity: .9; }
  to { opacity: 1; }
}

/* 旧气泡列表样式已删除；.msg 仅保留容器布局（app.js 仍会创建该包裹层） */
.msg { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 620px; }
.user-msg, .ai-msg { width: 100%; }

/* ---------- 悬浮在通道区的暗色玻璃卡片 ---------- */
.card {
  width: 100%;
  max-width: 560px;
  background: rgba(14, 18, 32, .62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(160, 180, 230, .16);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
  transition: background .18s, border-color .18s, box-shadow .18s;
}
.card:hover { background: rgba(22, 28, 48, .68); border-color: rgba(160, 190, 255, .3); box-shadow: 0 0 18px rgba(130, 160, 255, .12); }
/* 确认卡：冷蓝调 */
.confirm-card { background: rgba(16, 26, 44, .6); border-color: rgba(120, 160, 255, .28); }
/* 方法转向卡：蓝紫→青绿渐变亮边 */
.switch-card {
  border: 1px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(rgba(14, 18, 32, .66), rgba(14, 18, 32, .66)) padding-box,
    linear-gradient(135deg, rgba(150, 130, 255, .55), rgba(90, 200, 180, .55)) border-box;
}
/* 已处理：置暗 */
.card-done { opacity: .5; filter: grayscale(.4); }
.card-main { display: block; margin: 2px 0; color: #dbe4f5; font-size: 14px; }
.card-state { color: #5d6b86; font-size: 12px; margin-top: 6px; }
.card-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.btn-mini {
  border: 1px solid rgba(160, 180, 230, .22);
  background: rgba(120, 150, 220, .08);
  color: #aebcd6;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  transition: all .15s;
}
.btn-mini:hover { border-color: rgba(150, 180, 255, .5); color: #eef2ff; background: rgba(120, 150, 220, .14); }
.btn-ok { border-color: rgba(90, 200, 160, .35); color: #7fd6b8; background: rgba(60, 170, 130, .08); }
.btn-ok:hover { border-color: rgba(90, 200, 160, .55); background: rgba(60, 170, 130, .16); }
.btn-no { border-color: rgba(200, 160, 140, .25); color: #c9a08a; }
.btn-danger { border-color: rgba(240, 110, 110, .35); color: #ff8f8f; background: rgba(200, 60, 60, .08); }
.btn-danger:hover { border-color: rgba(240, 110, 110, .6); background: rgba(200, 60, 60, .18); }

/* 行动卡（下一步）：编号圆点 + 行动文字 */
.action-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  background: rgba(16, 22, 40, .6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(160, 180, 230, .18);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.action-card:hover { background: rgba(26, 34, 60, .72); border-color: rgba(150, 180, 255, .4); box-shadow: 0 0 18px rgba(130, 160, 255, .12); }
.step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(140, 130, 255, .9); color: #fff;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(150, 140, 255, .45);
}
.step-text { font-size: 13px; line-height: 1.6; color: #cfd8ea; }
.action-card.done { opacity: .6; }
.action-card.done .step-num { background: rgba(80, 180, 150, .9); box-shadow: none; }
.action-card.done .step-text { text-decoration: line-through; color: #5d6b86; }

/* 打字指示：三点，通道区内底部居中，浅色弱光 */
#typing {
  position: sticky;
  bottom: 12px;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(8, 10, 18, .45);
  border: 1px solid rgba(160, 180, 230, .12);
  width: fit-content;
}
#typing .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9fb2d8;
  box-shadow: 0 0 8px rgba(150, 180, 255, .6);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
#typing .dot:nth-child(2) { animation-delay: .15s; }
#typing .dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- 浅黑打字区 ---------- */
.input-row {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin: 14px 12px 0;
  padding: 10px 12px;
  background: rgba(8, 10, 16, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  box-shadow: 0 0 26px rgba(120, 150, 255, .16), 0 8px 30px rgba(0, 0, 0, .45);
  transition: opacity .5s ease, visibility .5s ease;
}
/* 发送后打字框淡出（app.js 在吞噬动画时加类、交换结束后摘类） */
.input-row.fade-out {
  opacity: 0;
  visibility: hidden;
}
#input {
  flex: 1;
  resize: none;
  height: 44px;
  min-height: 44px;
  padding: 10px 4px;
  border: none;
  outline: none;
  background: transparent;
  color: #e6ebf8;
  line-height: 1.5;
}
#input::placeholder { color: #5d6b86; }
#btn-send {
  background: transparent;
  border: 1px solid rgba(150, 180, 255, .35);
  color: #bcd0ff;
  border-radius: 10px;
  padding: 0 20px;
  height: 40px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  transition: all .18s;
  box-shadow: 0 0 12px rgba(130, 160, 255, .08);
}
#btn-send:hover {
  background: rgba(120, 150, 220, .14);
  border-color: rgba(160, 190, 255, .6);
  color: #fff;
  box-shadow: 0 0 16px rgba(130, 160, 255, .22);
}

/* ---------- 模态框（暗色玻璃） ---------- */
.modal-mask, .modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: rgba(12, 16, 28, .88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(160, 180, 230, .16);
  border-radius: 16px;
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .6), 0 0 30px rgba(120, 150, 230, .06);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
  color: #e8edff;
  border-bottom: 1px solid rgba(160, 180, 230, .12);
}
.modal-close, #history-close { border: none; background: none; font-size: 15px; color: #7d8aa6; padding: 2px 6px; }
.modal-close:hover, #history-close:hover { color: #ff8f8f; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* 表单字段 */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: #7d8aa6; margin-bottom: 4px; }
.field input, .field select {
  width: 100%;
  border: 1px solid rgba(160, 180, 230, .2);
  border-radius: 8px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, .04);
  color: #dbe4f5;
  outline: none;
}
.field input::placeholder { color: #5d6b86; }
.field input:focus, .field select:focus { border-color: rgba(150, 180, 255, .5); }
select option { background: #10141f; color: #dbe4f5; }
.hint { color: #5d6b86; font-size: 12px; display: block; margin-top: 4px; }

/* 会话列表 */
.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-bottom: 1px solid rgba(160, 180, 230, .08);
  border-radius: 8px;
}
.session-row:hover { background: rgba(120, 150, 220, .06); }
.session-row.cur { background: rgba(120, 150, 220, .1); }
.session-info { flex: 1; min-width: 0; cursor: pointer; }
.session-title { font-weight: 600; color: #dbe4f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-title.unnamed { color: #5d6b86; font-weight: 400; }
.session-sub { font-size: 11px; color: #5d6b86; }
.session-btns { display: flex; gap: 6px; flex-shrink: 0; }

.empty-tip { color: #5d6b86; text-align: center; padding: 24px 0; }

/* 历史记录列表 */
#history-list { display: flex; flex-direction: column; gap: 8px; }
#history-list > div {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(160, 180, 230, .1);
  color: #cfd8ea;
  font-size: 13px;
  transition: background .15s, border-color .15s;
}
#history-list > div:hover { background: rgba(120, 150, 220, .08); border-color: rgba(160, 180, 230, .22); }

/* ---------- 危机横幅：安全兜底，保持高对比，不做氛围化 ---------- */
#risk-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  background: rgba(60, 10, 16, .82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 90, 90, .35);
  color: #ff8f8f;
  padding: 10px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}
#risk-banner span { flex: 1; max-width: 760px; color: #ffb3b3; }
#risk-close {
  background: rgba(255, 80, 80, .14);
  border: 1px solid rgba(255, 110, 110, .5);
  color: #ff9d9d;
  border-radius: 8px;
  padding: 3px 12px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
#risk-close:hover { background: rgba(255, 80, 80, .26); color: #fff; }

/* ---------- 顶部提示 ---------- */
#toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(16, 22, 40, .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(160, 180, 230, .2);
  color: #e8edff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  transition: all .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 桌面端微调（移动端优先） ---------- */
@media (min-width: 640px) {
  .input-row { margin: 14px 24px 0; }
  #messages { padding: 8px 28px 14px; }
  .top-actions { gap: 10px; }
}

/* ==========================================================================
   星空通道改版追加：对话记录模态 + 错误卡
   ========================================================================== */
.history-row {
  padding: 10px 2px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.history-meta {
  font-size: .72rem;
  letter-spacing: .08em;
  color: rgba(160, 175, 205, .75);
  margin-bottom: 4px;
}
.history-text {
  font-size: .9rem;
  line-height: 1.75;
  color: #dbe4f5;
  white-space: pre-wrap;
  word-break: break-word;
}
.history-text.history-err { color: #ff9d9d; }
.history-cards { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.history-card {
  font-size: .78rem;
  line-height: 1.6;
  color: #b9c6e2;
  background: rgba(120, 140, 200, .08);
  border: 1px solid rgba(160, 180, 230, .18);
  border-radius: 8px;
  padding: 5px 8px;
}
/* 错误提示：暗色玻璃卡（原 .bubble 样式已随改版移除，这里兜底） */
.msg.ai-msg .error-bubble {
  background: rgba(60, 20, 30, .55);
  border: 1px solid rgba(255, 120, 140, .35);
  border-radius: 12px;
  padding: 12px 14px;
  color: #ffc2c9;
  margin-top: 10px;
}
.error-bubble .err-text { margin-bottom: 8px; font-size: .88rem; line-height: 1.6; }

/* ---------- v3 阶段组件：进度条 / 三选一卡片 / 阶段徽章 ---------- */
.progress-track {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 3px;
  margin: 0 0 14px;
  background: rgba(255, 255, 255, .06);
  border-radius: 3px;
  overflow: visible;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(140, 170, 255, .9), rgba(120, 220, 200, .9));
  box-shadow: 0 0 8px rgba(150, 180, 255, .5);
  border-radius: 3px;
  transition: width .6s ease;
}
#progress-label {
  position: absolute;
  right: 0;
  top: 6px;
  font-size: 10px;
  color: rgba(170, 190, 230, .7);
  letter-spacing: .5px;
}
.choice-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(8, 10, 18, .55);
  border: 1px solid rgba(160, 180, 230, .14);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* dilemma 候选确认卡：核心矛盾概括，用户确认后才进入三选一 */
.dilemma-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(20, 24, 40, .62);
  border: 1px solid rgba(160, 180, 230, .28);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dilemma-label { font-size: 12px; color: rgba(200, 215, 245, .55); letter-spacing: .12em; }
#dilemma-text { font-size: 15px; color: rgba(230, 240, 255, .98); line-height: 1.7; }
.dilemma-btns { display: flex; gap: 8px; flex-wrap: wrap; }
#choice-focus {
  font-size: 14px;
  color: rgba(200, 215, 245, .95);
  line-height: 1.6;
}
.choice-option {
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(160, 180, 230, .18);
  border-radius: 8px;
  color: #d8e2f5;
  margin: 4px 0;
  cursor: pointer;
  transition: all .2s ease;
  font-size: 14px;
  line-height: 1.6;
}
.choice-option:hover {
  background: rgba(140, 170, 255, .12);
  border-color: rgba(170, 200, 255, .4);
}
.choice-other {
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: rgba(255, 255, 255, .02);
  border: 1px dashed rgba(160, 180, 230, .25);
  border-radius: 8px;
  color: rgba(170, 190, 230, .8);
  margin: 2px 0;
  cursor: pointer;
  transition: all .2s ease;
  font-size: 13px;
}
.choice-other:hover {
  background: rgba(140, 170, 255, .08);
  border-color: rgba(170, 200, 255, .35);
}
.choice-other-input {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
#choice-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(8, 10, 16, .6);
  border: 1px solid rgba(160, 180, 230, .18);
  color: #dfe7f5;
  font-size: 13px;
  outline: none;
}
#choice-input:focus {
  border-color: rgba(170, 200, 255, .4);
}
.chip-stage {
  background: rgba(120, 160, 255, .15);
  color: #a9c2ff;
}

/* ==========================================================================
   手机端适配（成员用手机/微信内置浏览器访问公网链接）
   移动优先基础之上：触控尺寸 / iOS 聚焦缩放 / 底部安全区 / 窄屏顶栏压缩
   ========================================================================== */
@media (max-width: 639px) {
  /* 防 iOS 聚焦时自动放大页面 */
  textarea, input, select { font-size: 16px; }
  /* 窄屏顶栏：隐藏会话名与阶段/模式徽章，压缩按钮，必要时折行（375px 一行放不下） */
  .session-name-display { display: none; }
  .chip { display: none; }
  #topbar { height: auto; min-height: 52px; flex-wrap: wrap; padding: 6px 10px; row-gap: 6px; }
  .brand { gap: 6px; }
  .brand-name { font-size: 14px; letter-spacing: 1px; }
  .top-actions { gap: 6px; }
  .top-btn { padding: 6px 9px; font-size: 11px; }
  /* 命名条手机端堆叠（label+输入+按钮换行，避免挤爆） */
  #naming-bar { flex-wrap: wrap; justify-content: center; top: 60px; row-gap: 8px; }
  #naming-input { width: 100%; flex-basis: 100%; }
  /* 触控目标 ≥44px */
  #btn-send { height: 44px; padding: 0 18px; }
  .btn-mini { padding: 8px 14px; font-size: 13px; }
  /* 输入区贴底留安全区（iPhone 底部横条） */
  .input-row { margin: 12px 10px calc(env(safe-area-inset-bottom, 0px) + 6px); }
  /* 动作按钮行：手机端加宽触控、贴输入区 */
  .input-actions { margin: 8px 10px 0; padding: 6px 10px; }
  .input-actions .btn-mini { padding: 10px 16px; font-size: 14px; }
  /* 通道区收窄、字号微调 */
  #messages { max-height: 58vh; padding: 8px 12px 12px; }
  #channelText { font-size: 1.22rem; line-height: 1.8; }
  /* 三选一选项加大触控区 */
  .choice-option { padding: 12px 14px; }
  .choice-other { padding: 10px 0; }
  #choice-input { padding: 10px 12px; font-size: 16px; }
  /* dilemma 确认卡触控 */
  .dilemma-btns .btn-mini { padding: 10px 14px; }
  /* 模态框更贴边 */
  .modal-card { width: calc(100vw - 24px); }
}

/* ---------- 关键人物名字高亮 + 命名条色板 ---------- */
.name-tag { font-weight: 700; letter-spacing: .02em; text-shadow: 0 0 12px currentColor; }
.color-swatches { display: flex; gap: 6px; align-items: center; }
.color-swatches .swatch {
  width: 20px; height: 20px; border-radius: 50%;
  cursor: pointer; border: 2px solid rgba(255,255,255,.15);
  transition: transform .15s ease, border-color .15s ease;
}
.color-swatches .swatch:hover { transform: scale(1.15); }
.color-swatches .swatch.active { border-color: #eef3ff; transform: scale(1.2); box-shadow: 0 0 10px rgba(255,255,255,.35); }

/* ---------- 跳过按钮（不知道/不想回答） ---------- */
.btn-skip { background: rgba(255,255,255,.06); color: rgba(238,243,255,.5); }
.btn-skip:hover { color: #eef3ff; background: rgba(255,255,255,.12); }
.choice-unknown { color: rgba(238,243,255,.5); }
.choice-unknown:hover { color: #eef3ff; }

/* ---------- 聊天框下方的动作按钮行（什么意思 / 跳过） ---------- */
.input-actions {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  margin: 10px 24px 0; padding: 6px 14px;
  background: rgba(8,10,16,.45); backdrop-filter: blur(10px);
  border: 1px solid rgba(120,150,255,.12);
  border-radius: 14px; box-shadow: 0 0 26px rgba(120,150,255,.10);
  transition: opacity .5s ease, visibility .5s ease;
}
.input-actions.fade-out { opacity: 0; visibility: hidden; }
.btn-soft { background: rgba(255,255,255,.06); color: rgba(238,243,255,.65); }
.btn-soft:hover { color: #eef3ff; background: rgba(255,255,255,.12); }
