/* =========================================================
   助理页 · 对话界面（v22）
   按 design-demos/assistant-chat-v1.html 落地：
   顶部只留一个「念念 · 智能体 ▾」胶囊，中间一条对话流，底部一个输入区。
   手机壳（.m-ac）与桌面壳（.m-desktop 内）共用同一套 .ac-* 类名。

   这套界面自带 --ac-* 材料令牌，不跟皮肤走：瓷面/霜玻璃/默认皮肤下
   看起来是同一个对话界面，只有深色模式换色。
   ========================================================= */

:root {
  --ac-bg: #FFFFFF;
  --ac-wash: #F7F8FA;
  --ac-ink: #101319;
  --ac-ink-2: #4B5563;
  --ac-ink-3: #8A919E;
  --ac-ink-4: #AEB4BF;
  --ac-line: rgba(17, 24, 39, .09);
  --ac-line-2: rgba(17, 24, 39, .055);
  --ac-field: #F2F3F5;
  --ac-field-2: #ECEEF2;
  /* 抬起来的面：需要和页面本体分出层次的实体卡用它（计划确认卡）。
     亮色就是白，暗色比 --ac-bg 亮一档——不然卡和背景同色，只剩一条边框。 */
  --ac-raise: #FFFFFF;
  --ac-accent: #2E5BFF;
  --ac-accent-2: #1E44D6;
  --ac-accent-soft: #E9EEFF;
  --ac-sh-sm: 0 1px 1px rgba(16, 24, 40, .03), 0 6px 16px -4px rgba(16, 24, 40, .06);
  --ac-sh-float: 0 2px 4px rgba(16, 24, 40, .04), 0 12px 28px -6px rgba(16, 24, 40, .10);
  /* 语音房自己的声纹色：比 --ac-accent 更哑一点，连续对话不是「在干活」。 */
  --vr-accent: #4E6A86;
  --vr-wave: rgba(78, 106, 134, .55);
  --vr-glow: rgba(78, 106, 134, .32);
}

html[data-mode="dark"] {
  --ac-bg: #171A21;
  --ac-wash: #1F232C;
  --ac-ink: #EDF0F5;
  --ac-ink-2: #B7BECA;
  --ac-ink-3: #8B93A3;
  --ac-ink-4: #61697A;
  --ac-line: rgba(255, 255, 255, .10);
  --ac-line-2: rgba(255, 255, 255, .06);
  --ac-field: #232833;
  --ac-field-2: #2A303C;
  --ac-raise: #1B1F27;
  --ac-accent: #5B84FF;
  --ac-accent-2: #9BB1FF;
  --ac-accent-soft: rgba(91, 132, 255, .16);
  --ac-sh-sm: 0 1px 1px rgba(0, 0, 0, .28), 0 6px 16px -6px rgba(0, 0, 0, .40);
  --ac-sh-float: 0 2px 4px rgba(0, 0, 0, .30), 0 14px 32px -8px rgba(0, 0, 0, .50);
  --vr-accent: #9BB1FF;
  --vr-wave: rgba(155, 177, 255, .44);
  --vr-glow: rgba(155, 177, 255, .22);
}

/* 手机壳默认藏起来，≤760px 才露出来（与 .m-today 等同一条约定）。
   写成 .ac-page.m-ac 是为了压过下面那条 .ac-page { display: flex }——
   同权重时后写的会赢，只留 .m-ac 会让手机壳在桌面宽度也露出来。 */
.ac-page.m-ac { display: none; }

/* ---------- 骨架 ---------- */
.ac-page {
  display: flex; flex-direction: column;
  background: var(--ac-bg);
  color: var(--ac-ink);
}
.ac-bar {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--ac-line-2);
  background: var(--ac-bg);
}
.ac-sp { flex: 1 1 auto; }
.ac-picker {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 9px 0 10px;
  border: 1px solid var(--ac-line-2); border-radius: 999px;
  background: var(--ac-wash);
  font: inherit; font-size: 13.5px; font-weight: 550; color: var(--ac-ink);
  max-width: 62%;
}
.ac-picker:active { transform: scale(.97); }
.ac-picker .ic { width: 13px; height: 13px; color: var(--ac-ink-3); stroke-width: 1.8; }
.ac-picker-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ac-ink-4); }
.ac-dot.is-live { background: var(--ac-accent); }
.ac-icobtn {
  flex: none; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ac-ink-2);
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.ac-icobtn:active { background: var(--ac-wash); transform: scale(.93); }
.ac-icobtn .ic { width: 19px; height: 19px; stroke-width: 1.7; }

.ac-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ac-thread {
  flex: 1 0 auto;
  display: flex; flex-direction: column; gap: 20px;
  padding: 18px 14px 10px;
}
.ac-inner { width: 100%; max-width: 660px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

/* ---------- 一轮对话 ---------- */
.ac-turn { display: flex; flex-direction: column; gap: 12px; }
.ac-me {
  align-self: flex-end; max-width: 82%;
  padding: 10px 14px; border-radius: 20px 20px 6px 20px;
  background: var(--ac-field); color: var(--ac-ink);
  font-size: 15px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.ac-ai { display: flex; align-items: flex-start; gap: 11px; }
.ac-av {
  flex: none; width: 26px; height: 26px; margin-top: 2px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--ac-accent-soft); color: var(--ac-accent-2);
  font-size: 12.5px; font-weight: 650;
}
.ac-av .ic { width: 15px; height: 15px; }
.ac-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.ac-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ac-ink-3); }
.ac-meta b { font-size: 13px; font-weight: 650; color: var(--ac-ink); }
.ac-meta .ag-flag { padding: 1px 7px; border-radius: 999px; background: var(--ac-field); color: var(--ac-ink-3); font-size: 11px; }
.ac-txt { font-size: 15px; line-height: 1.75; color: var(--ac-ink); overflow-wrap: anywhere; }
.ac-txt p + p, .ac-txt .ag-line + .ag-line { margin-top: 9px; }
.ac-txt b { font-weight: 600; }
.ac-say { font-size: 15px; line-height: 1.75; color: var(--ac-ink); }

/* 「用了 N 个工具」：默认收成一颗胶囊，点开才列步骤 */
.ac-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--ac-line-2); border-radius: 999px;
  background: var(--ac-wash);
  font: inherit; font-size: 12.5px; color: var(--ac-ink-3);
  align-self: flex-start;
}
.ac-pill .ic { width: 12px; height: 12px; stroke-width: 2; }
.ac-pill:active { transform: scale(.97); }
.ac-step-list {
  display: flex; flex-direction: column; gap: 6px;
  margin: 0; padding: 10px 12px;
  border: 1px solid var(--ac-line-2); border-radius: 14px;
  background: var(--ac-wash);
  font-size: 12.5px; color: var(--ac-ink-2);
}
.ac-step { display: flex; align-items: center; gap: 7px; }
.ac-step .ic { width: 12px; height: 12px; color: var(--ac-ink-3); flex: none; }
.ac-step.is-done .ic { color: var(--ac-accent); }
.ac-step i { font-style: normal; color: var(--ac-ink-3); }

/* 回答下面的动作行：复制 / 重新生成 / 移除，本地结果还要在这行长按钮 */
.ac-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ac-acts .btn { height: 30px; padding: 0 13px; border-radius: 999px; font-size: 13px; }
.ac-icon {
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--ac-ink-4);
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.ac-icon:active { background: var(--ac-wash); color: var(--ac-ink-3); transform: scale(.93); }
.ac-icon .ic { width: 15px; height: 15px; stroke-width: 1.7; }
.ac-note { font-size: 11.5px; color: var(--ac-ink-4); margin-left: 4px; }

/* ---------- 回执卡：智能体刚写完的任务 ----------
   和计划确认卡是同一族材料（抬起的实体卡），但用途相反：
   计划卡是「还没写入，等你点头」，回执卡是「已经写入，给你看，也能当场再改」。 */
.ac-tasks { display: flex; flex-direction: column; gap: 8px; }
.ac-task {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 13px 11px;
  border: 1px solid var(--ac-line); border-radius: 16px;
  background: var(--ac-raise); box-shadow: var(--ac-sh-sm);
  animation: ac-plan-in .24s cubic-bezier(.22, .61, .36, 1) both;
}
.ac-task-head { display: flex; align-items: center; gap: 7px; }
.ac-task-ic {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--ac-accent-soft); color: var(--ac-accent-2);
}
.ac-task-ic .ic { width: 13px; height: 13px; stroke-width: 1.8; }
.ac-task-head b { font-size: 13.5px; font-weight: 650; color: var(--ac-ink); letter-spacing: -.005em; }
.ac-task-saved { margin-left: auto; height: 20px; font-size: 11px; }
.ac-task-saved .ic { width: 11px; height: 11px; }
.ac-task-title {
  font-size: 15px; line-height: 1.5; font-weight: 550; color: var(--ac-ink);
  letter-spacing: -.005em; overflow-wrap: anywhere;
}
.ac-task-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  font-size: 12px; color: var(--ac-ink-3);
}
.ac-task-meta span { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.ac-task-meta .ic { width: 12px; height: 12px; stroke-width: 1.8; color: var(--ac-ink-4); }
.ac-task-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 1px; }
.ac-task-acts .btn { height: 32px; padding: 0 13px; border-radius: 999px; font-size: 13px; }
.ac-task-acts .btn-primary { background: var(--ac-accent); border-color: var(--ac-accent); color: #fff; }
.ac-task-acts .btn-primary:hover { background: var(--ac-accent-2); border-color: var(--ac-accent-2); }
.ac-task-acts .btn-primary .ic { color: rgba(255, 255, 255, .9); }
.ac-task-acts .btn-ghost { background: transparent; border: 1px solid var(--ac-line); color: var(--ac-ink-2); }
.ac-task-acts .btn-ghost:hover { background: var(--ac-wash); color: var(--ac-ink); }
.ac-task-note { font-size: 11.5px; color: var(--ac-ink-4); }

/* 卡上直接改：同一张卡换成一张小表单，边框取焦点色 */
.ac-task.is-editing { border-color: rgba(46, 91, 255, .32); box-shadow: 0 0 0 3px var(--ac-accent-soft); animation: none; }
.ac-tf { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 11.5px; color: var(--ac-ink-3); }
.ac-tf > span { padding-left: 2px; }
.ac-tf input, .ac-tf select {
  width: 100%; height: 34px; padding: 0 9px;
  border: 1px solid var(--ac-line); border-radius: 10px;
  background: var(--ac-wash); color: var(--ac-ink);
  font: inherit; font-size: 13px;
  -webkit-appearance: none; appearance: none;
}
.ac-tf input:focus, .ac-tf select:focus {
  outline: none; border-color: rgba(46, 91, 255, .45);
  background: var(--ac-bg); box-shadow: 0 0 0 3px var(--ac-accent-soft);
}
.ac-tf-wide { width: 100%; }
.ac-tf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ac-tf-err { margin: 0; font-size: 12px; line-height: 1.5; color: #C44343; }
.ac-tf-err:empty { display: none; }

@media (max-width: 760px) {
  .ac-tf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ac-task-acts .btn { flex: 1 1 auto; height: 38px; justify-content: center; }
}

/* ---------- 所有对话（管理弹层） ---------- */
.acs { display: flex; flex-direction: column; gap: 10px; }
.acs-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ac-ink-3); }
.acs-status .ac-dot { width: 7px; height: 7px; }
.acs-say.is-on { color: var(--ac-accent-2); }
.acs-status .link {
  margin-left: auto; padding: 4px 2px;
  border: 0; background: none; font: inherit; font-size: 12.5px;
  color: var(--ac-accent);
}
.acs-status .link:active { opacity: .6; }
.acs-new {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 44px;
  border: 1px dashed rgba(46, 91, 255, .45); border-radius: 14px;
  background: var(--ac-accent-soft); color: var(--ac-accent-2);
  font: inherit; font-size: 14px; font-weight: 550;
}
.acs-new:active { transform: scale(.99); }
.acs-new .ic { width: 16px; height: 16px; }
.acs-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: min(52vh, 420px); overflow-y: auto; overscroll-behavior: contain;
  padding: 2px;
}
.acs-row {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 4px 2px 2px;
  border: 1px solid var(--ac-line-2); border-radius: 14px;
  background: var(--ac-bg);
}
.acs-row.is-current { border-color: rgba(46, 91, 255, .28); background: var(--ac-accent-soft); }
.acs-open {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px;
  border: 0; border-radius: 12px; background: transparent;
  font: inherit; text-align: left;
}
.acs-row-title {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; font-weight: 550; color: var(--ac-ink);
}
.acs-row.is-current .acs-row-title { color: var(--ac-accent-2); }
.acs-row-sub { font-size: 11.5px; color: var(--ac-ink-3); }
.acs-del {
  flex: none; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--ac-ink-4);
  display: grid; place-items: center;
}
.acs-del .ic { width: 15px; height: 15px; }
.acs-del:active { background: rgba(209, 67, 67, .10); color: #C44343; }
.acs-confirm { flex: none; display: flex; align-items: center; gap: 4px; padding-right: 4px; }
.acs-confirm button {
  height: 30px; padding: 0 10px;
  border: 1px solid var(--ac-line); border-radius: 9px;
  background: var(--ac-bg); font: inherit; font-size: 12.5px; color: var(--ac-ink-2);
}
.acs-confirm .acs-yes { border-color: transparent; background: #C44343; color: #fff; }
.acs-confirm .acs-yes:disabled { opacity: .6; }
.acs-empty { margin: 0; padding: 18px 4px; text-align: center; font-size: 13px; color: var(--ac-ink-3); }
.acs-foot-note { align-self: center; font-size: 11.5px; color: var(--ac-ink-4); }
@media (max-width: 760px) { .acs-foot-note { display: none; } }

/* ---------- 计划确认卡（任务书 §33） ----------
   本地结果（.ac-card）是「已经算完、给你看」，扁平洗色就够；这张是
   「还没写、等你点头」，所以抬成白底带影的实体卡，动作键排在内容后面。
   三种收尾态：is-sent 已经交出去、is-edit 等用户改、is-gone 已取消。 */
.ac-plan {
  display: flex; flex-direction: column; gap: 9px;
  padding: 12px 13px 11px;
  border: 1px solid var(--ac-line); border-radius: 16px;
  background: var(--ac-raise); box-shadow: var(--ac-sh-sm);
  animation: ac-plan-in .24s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes ac-plan-in {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.ac-plan-head { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.ac-plan-head .ic { width: 14px; height: 14px; color: var(--ac-accent); flex: none; stroke-width: 1.8; }
.ac-plan-head b { font-size: 13.5px; font-weight: 650; color: var(--ac-ink); letter-spacing: -.005em; }
.ac-plan-head .small { font-size: 12px; color: var(--ac-ink-3); }
.ac-plan-rows {
  display: flex; flex-direction: column; gap: 4px;
  margin: 0; padding: 0; list-style: none;
}
.ac-plan-rows li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: 11px; background: var(--ac-wash);
}
.ac-plan-rows b {
  font-size: 13px; font-weight: 500; color: var(--ac-ink);
  min-width: 0; overflow-wrap: anywhere;
}
.ac-plan-rows .mono { font-size: 11.5px; color: var(--ac-ink-3); flex: none; font-variant-numeric: tabular-nums; }
.ac-plan-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 1px; }
.ac-plan-acts .btn {
  height: 34px; padding: 0 15px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
}
.ac-plan-acts .btn-primary { background: var(--ac-accent); border-color: var(--ac-accent); color: #fff; }
.ac-plan-acts .btn-primary:hover { background: var(--ac-accent-2); border-color: var(--ac-accent-2); }
.ac-plan-acts .btn-primary .ic { color: rgba(255, 255, 255, .88); }
.ac-plan-acts .btn-ghost { background: transparent; border: 1px solid var(--ac-line); color: var(--ac-ink-2); }
.ac-plan-acts .btn-ghost:hover { background: var(--ac-wash); color: var(--ac-ink); }
.ac-plan-note { margin: 0; font-size: 11.5px; line-height: 1.6; color: var(--ac-ink-4); }
.ac-plan-note .chip { height: 20px; margin-right: 6px; font-size: 11px; }
.ac-plan-note .chip .ic { width: 11px; height: 11px; }

/* 已交给智能体：卡留在原地当作凭据，内容压暗、只剩动作痕迹 */
.ac-plan.is-sent { background: var(--ac-wash); box-shadow: none; border-color: var(--ac-line-2); }
.ac-plan.is-sent .ac-plan-rows li { background: var(--ac-bg); }
/* 已写入：同一张卡收尾成凭据，不再给按钮，避免重复确认 */
.ac-plan.is-done { background: var(--ac-wash); box-shadow: none; border-color: var(--ac-line-2); }
.ac-plan.is-done .ac-plan-rows li { background: var(--ac-bg); }
/* 想改一下：卡还活着，只是等下一版，边框取焦点色 */
.ac-plan.is-edit { border-color: rgba(46, 91, 255, .32); box-shadow: 0 0 0 3px var(--ac-accent-soft); }
/* 已取消：收摊，虚线边 + 没有清单 */
.ac-plan.is-gone { background: transparent; border-style: dashed; box-shadow: none; animation: none; }
.ac-plan.is-gone .ac-plan-head .ic { color: var(--ac-ink-4); }
.ac-plan.is-gone .ac-plan-head b { color: var(--ac-ink-3); }

@media (max-width: 760px) {
  .ac-plan-acts { gap: 7px; }
  .ac-plan-acts .btn { flex: 1 1 auto; height: 38px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ac-plan, .ac-task { animation: none; }
}

/* 智能体正文：字号与颜色交给 .ac-txt，不吃 ai.css 那套 --fs-14 / --ink */
.ac-txt .ag-text { font-size: 15px; line-height: 1.75; color: var(--ac-ink); }
.ac-txt .ag-text code, .ac-txt .ag-code { background: var(--ac-field); }
.ac-txt .ag-code { border: 1px solid var(--ac-line-2); }
.ac-txt .ag-wait { color: var(--ac-ink-3); }

/* ---------- 空状态 ---------- */
.ac-empty {
  flex: 1 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 20px 24px;
}
.ac-empty h2 { font-size: 25px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; text-align: center; color: var(--ac-ink); }
.ac-empty .ac-sub { margin-top: 8px; font-size: 13.5px; color: var(--ac-ink-3); text-align: center; }
.ac-sg { margin-top: 26px; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.ac-sg-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 50px;
  padding: 10px 14px; text-align: left;
  border: 1px solid var(--ac-line); border-radius: 16px;
  background: var(--ac-bg); box-shadow: var(--ac-sh-sm);
  font: inherit; font-size: 14.5px; color: var(--ac-ink-2);
  -webkit-tap-highlight-color: transparent;
}
.ac-sg-btn:active { transform: scale(.985); background: var(--ac-wash); }
.ac-sg-btn .ic:first-child { width: 17px; height: 17px; flex: none; color: var(--ac-accent); stroke-width: 1.7; }
.ac-sg-btn .ic:last-child { margin-left: auto; width: 15px; height: 15px; color: var(--ac-ink-4); }

/* ---------- 输入区 ---------- */
.ac-comp { flex: none; padding: 10px 14px 8px; }
.ac-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 7px 7px 9px;
  border: 1px solid var(--ac-line); border-radius: 26px;
  background: var(--ac-bg); box-shadow: var(--ac-sh-sm);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.ac-box.is-focus { border-color: rgba(46, 91, 255, .45); box-shadow: 0 0 0 3px rgba(46, 91, 255, .10), var(--ac-sh-sm); }
.ac-add, .ac-mic {
  flex: none; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; display: grid; place-items: center;
  background: transparent; color: var(--ac-ink-2);
  -webkit-tap-highlight-color: transparent;
}
.ac-add { background: var(--ac-wash); color: var(--ac-ink-3); }
.ac-add .ic, .ac-mic .ic { width: 17px; height: 17px; stroke-width: 1.8; }
.ac-add:active, .ac-mic:active { transform: scale(.92); background: var(--ac-field); }
.ac-mic { touch-action: none; -webkit-user-select: none; user-select: none; position: relative; }
.ac-mic.is-off { color: var(--ac-ink-4); }
/* 语音对话进行中：麦克风点亮，右上角一个小圆点，提示「再点一下」还有效 */
.ac-mic.is-live { color: var(--ac-accent); background: var(--ac-accent-soft, rgba(46, 91, 255, .10)); }
.ac-mic.is-live::after {
  content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--ac-accent);
}
.ac-input {
  flex: 1 1 auto; min-width: 0;
  border: 0; outline: none; background: transparent;
  font: inherit; font-size: 15px; line-height: 1.5;
  padding: 6px 2px 7px; color: var(--ac-ink);
  /* 窄屏放不下整句时收成省略号，别让字被裁成半截 */
  text-overflow: ellipsis;
}
.ac-input::placeholder { color: var(--ac-ink-4); text-overflow: ellipsis; }
.ac-send {
  flex: none; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--ac-field-2); color: var(--ac-ink-4);
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.ac-send .ic { width: 17px; height: 17px; stroke-width: 2; }
.ac-box.is-live .ac-send { background: var(--ac-accent); color: #FFF; box-shadow: 0 2px 6px -1px rgba(46, 91, 255, .45); }
.ac-send:active { transform: scale(.92); }

/* ---------- 手机端：三段定版，对话流自己滚 ----------
   顶栏 / 对话流 / 输入区竖着排满一屏，只有中间那段可以滚：
   消息不会再从输入区底下穿过，输入区也不会被 Dock 顶掉——
   它按 --ac-dock 这段余量正好压在 Dock 上沿。键盘弹起时 Dock 已被键盘盖住，
   这段余量改留给键盘（--m-kb 由 js/mobile.js 维护），输入区随之抬到键盘上方。 */
@media (max-width: 760px) {
  .ac-page.m-ac { display: flex; padding: 0; }
  .view:has(.m-ac) {
    --ac-dock: calc(var(--m-nav-h, 62px) + 12px);
    padding: 0 0 var(--ac-dock);
    overflow: hidden;
  }
  html[data-keyboard] .view:has(.m-ac) { --ac-dock: calc(var(--m-kb, 0px) + 6px); }
  .view:has(.m-ac) > .page { height: 100%; padding: 0; }
  .ac-page.m-ac { height: 100%; min-height: 0; overflow: hidden; }
  .m-ac .ac-stage { min-height: 0; }
  .m-ac .ac-thread,
  .m-ac .ac-empty {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  }
  .m-ac .ac-comp {
    position: static; z-index: auto;
    background: var(--ac-bg); border-top: 1px solid var(--ac-line-2);
  }
  /* 建议卡与输入框用同一条 14px 侧边线，空态别比输入区多缩进 6px */
  .m-ac .ac-empty { padding-inline: 14px; }
}

@media (min-width: 761px) {
  /* 与手机端同一条规矩：卡片定高一屏内自己滚，对话流只在输入区之上滚动 */
  .ac-page { height: max(520px, calc(100vh - 200px)); border: 1px solid var(--ac-line-2); border-radius: 18px; overflow: hidden; box-shadow: var(--ac-sh-sm); }
  .ac-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 24px 0 10px; }
  .ac-empty { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .ac-comp { flex: none; background: var(--ac-bg); border-top: 1px solid var(--ac-line-2); }
  .ac-box { max-width: 660px; margin: 0 auto; width: calc(100% - 48px); }
}

@media (prefers-reduced-motion: reduce) {
  .ac-picker:active, .ac-icobtn:active, .ac-pill:active, .ac-icon:active,
  .ac-sg-btn:active, .ac-add:active, .ac-mic:active, .ac-send:active { transform: none; }
  .ac-box, .ac-send { transition: none; }
}

/* =========================================================
   全屏语音房（连续对话）
   手机：整屏接管；桌面：430px 面板 + 遮罩。
   只画三件事：说过的话、此刻的声纹、三个动作。
   ========================================================= */

body.vr-lock { overflow: hidden; }

.vr {
  position: fixed; inset: 0; z-index: 55;
  display: flex; align-items: stretch; justify-content: center;
  background: var(--ac-bg); color: var(--ac-ink);
  overscroll-behavior: contain;
}
.vr[hidden] { display: none; }

.vr-shell {
  position: relative;
  display: flex; flex-direction: column;
  width: 100%; height: 100%; overflow: hidden;
  padding: calc(env(safe-area-inset-top) + 4px) 0 calc(env(safe-area-inset-bottom) + 6px);
  background: var(--ac-bg);
}
.vr-shell::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 46% at 50% -8%, rgba(78, 106, 134, .10), transparent 62%);
}
html[data-mode="dark"] .vr-shell::before {
  background: radial-gradient(120% 46% at 50% -8%, rgba(155, 177, 255, .10), transparent 62%);
}

/* ---------- 顶栏 ---------- */

.vr-top {
  position: relative; flex: none;
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 64px;
}
.vr-collapse {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--ac-line); border-radius: 50%;
  background: transparent; color: var(--ac-ink-2);
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.vr-collapse .ic { width: 19px; height: 19px; }
.vr-title {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: 13.5px; color: var(--ac-ink-2);
}
.vr-title b { font-weight: 600; color: var(--ac-ink); letter-spacing: .01em; }
.vr-dot {
  flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--vr-accent); box-shadow: 0 0 0 4px var(--vr-glow);
}
.vr-timer {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 12.5px; color: var(--ac-ink-3);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.vr[data-phase="listening"] .vr-dot,
.vr[data-phase="speaking"] .vr-dot { animation: vr-pulse 2.2s ease-out infinite; }
@keyframes vr-pulse {
  0% { box-shadow: 0 0 0 0 var(--vr-glow); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

/* ---------- 说过的话 ---------- */

.vr-log {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 26px 10px;
  scrollbar-width: none;
  mask-image: linear-gradient(180deg, transparent 0, #000 34px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 34px);
}
.vr-log::-webkit-scrollbar { display: none; }
.vr-log-inner {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 22px;
  padding-top: 6px;
}
.vr-log-inner.is-empty {
  margin-top: 0; height: 100%;
  align-items: center; justify-content: center; padding: 0;
}
.vr-empty {
  margin: 0; font-size: 14px; color: var(--ac-ink-3);
  letter-spacing: .01em; text-align: center;
}

.vr-turn { max-width: 100%; }
.vr-who {
  display: block; margin-bottom: 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  color: var(--ac-ink-4);
}
.vr-turn p {
  margin: 0;
  font-size: 14.5px; line-height: 1.64; letter-spacing: .002em;
  color: var(--ac-ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
  transition: font-size .18s ease, color .18s ease;
}
.vr-turn.is-you p { color: var(--ac-ink-3); }
.vr-turn.is-now .vr-who { color: var(--ac-ink-3); }
.vr-turn.is-now p {
  font-size: 23px; line-height: 1.56; letter-spacing: -.012em;
  font-weight: 500; color: var(--ac-ink);
}
.vr-turn.is-streaming p::after {
  content: '';
  display: inline-block; width: 2px; height: 1.02em; margin-left: 3px;
  vertical-align: -.14em; background: var(--vr-accent);
  animation: vr-caret 1.05s steps(1) infinite;
}
@keyframes vr-caret { 50% { opacity: 0; } }

/* ---------- 声纹 ---------- */

.vr-voice {
  flex: none; display: flex; flex-direction: column; align-items: center;
  padding: 12px 26px 0;
}
.vr-hear {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; padding: 4px 0 0;
  border: 0; background: none; color: inherit;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.vr-state {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 18px; font-size: 12.5px; color: var(--ac-ink-2);
  letter-spacing: .01em;
}
.vr-state-dot {
  flex: none; width: 5px; height: 5px; border-radius: 50%;
  background: var(--vr-accent);
}
.vr[data-phase="thinking"] .vr-state-dot,
.vr[data-phase="waiting"] .vr-state-dot { background: var(--ac-ink-3); }

.vr-wave {
  display: flex; align-items: flex-end; justify-content: center; gap: 3px;
  width: 100%; height: 46px; margin-top: 14px;
  border-bottom: 1px solid var(--ac-line);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.vr-wave i {
  flex: none; width: 2px; height: 46px; border-radius: 1px;
  background: var(--vr-wave);
  transform-origin: 50% 100%;
  transform: scaleY(0);
  will-change: transform;
}
.vr[data-phase="thinking"] .vr-wave i,
.vr[data-phase="waiting"] .vr-wave i { background: var(--vr-accent); opacity: .55; }
.vr[data-phase="speaking"] .vr-wave i { background: var(--vr-accent); opacity: .9; }

.vr-sub {
  display: block; margin-top: 12px; min-height: 16px;
  font-size: 11.5px; color: var(--ac-ink-3);
  letter-spacing: .02em; text-align: center;
}

/* ---------- 三个动作 ---------- */

.vr-ctl {
  flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 8px;
  padding: 22px 30px 10px;
}
.vr-round {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 0; border: 0; background: none; color: var(--ac-ink-3);
  font: inherit; font-size: 11px; letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.vr-round-ic {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border: 1px solid var(--ac-line); border-radius: 50%;
  color: var(--ac-ink-2); background: transparent;
  transition: background .15s ease;
}
.vr-round .ic { width: 20px; height: 20px; }
.vr-round:active .vr-round-ic { background: var(--ac-wash); transform: scale(.96); }
.vr-round[aria-pressed="true"] .vr-round-ic { background: var(--ac-wash); color: var(--ac-ink); }
.vr-end {
  justify-self: center;
  display: grid; place-items: center;
  width: 62px; height: 62px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--ac-ink); color: var(--ac-bg);
  box-shadow: 0 10px 22px rgba(16, 19, 25, .20);
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.vr-end i {
  display: block; width: 15px; height: 15px; border-radius: 3px;
  background: currentColor;
}
.vr-end:active { transform: scale(.95); }

/* 键盘焦点要看得见：语音房里的控件没有卡片衬底，默认 outline 最可靠。 */
.vr button:focus-visible {
  outline: 2px solid var(--vr-accent);
  outline-offset: 3px;
}

/* ---------- 桌面：面板而不是整屏 ---------- */

@media (min-width: 761px) {
  .vr {
    align-items: center; padding: 24px;
    background: rgba(12, 15, 21, .46);
    backdrop-filter: blur(10px) saturate(.85);
    -webkit-backdrop-filter: blur(10px) saturate(.85);
  }
  .vr-shell {
    width: 430px; height: min(880px, calc(100vh - 48px));
    padding: 16px 0 14px;
    border: 1px solid var(--ac-line-2); border-radius: 30px;
    box-shadow: 0 40px 90px rgba(6, 10, 18, .40), 0 2px 10px rgba(6, 10, 18, .20);
  }
  .vr-log { padding: 18px 28px 10px; }
  .vr-voice { padding: 12px 30px 0; }
  .vr-ctl { padding: 24px 34px 12px; }
}

@media (min-width: 761px) and (prefers-reduced-motion: no-preference) {
  .vr-shell { animation: vr-in .22s cubic-bezier(.2, .9, .28, 1); }
  @keyframes vr-in {
    from { opacity: 0; transform: translateY(10px) scale(.985); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .vr-turn p { transition: none; }
  .vr-turn.is-streaming p::after { animation: none; }
  .vr[data-phase="listening"] .vr-dot,
  .vr[data-phase="speaking"] .vr-dot { animation: none; }
  .vr-shell { animation: none; }
}
