/* ════════════════════════════════════════════════════════════
   CP.AI 语音播报 · 视觉层（设计依据：docs/ai-voice-survey.md）
   --------------------------------------------------------------
   · 只覆盖「语音层」：面板头开关 / 首次解锁引导
   · 说话状态由 js/ai-voice.js 在 body 上挂 .cpai-speaking，
     这里让既有 2D 皮肤嘴巴、灯、音柱动起来，不动皮肤源码
   · 沿用 Neo-brutalism token：粗描边 + 硬偏移阴影 + 橙/蓝
   ════════════════════════════════════════════════════════════ */

/* ── 喇叭图标 ─────────────────────────────── */
.ai-voice-ico { width: 17px; height: 17px; display: block; flex: 0 0 auto; }
.ai-voice-slash { display: none; }
.is-off .ai-voice-slash { display: block; }

/* ── 1) 面板头开关（深色头部里的浅色描边按钮） ── */
.ai-voice-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; flex: 0 0 auto;
  font-family: var(--font-mono); cursor: pointer;
  background: transparent; color: var(--card);
  border: 2px solid var(--card);
  transition: background .12s ease, color .12s ease, transform .12s ease;
}
.ai-voice-toggle .ai-voice-ico { width: 15px; height: 15px; }
.ai-voice-toggle:hover { background: var(--orange); border-color: var(--orange); color: var(--card); transform: translate(-1px, -1px); }
.ai-voice-toggle:active { transform: translate(1px, 1px); }
.ai-voice-toggle.is-off { opacity: .62; }
.ai-voice-toggle:disabled { opacity: .35; cursor: not-allowed; }

/* ── 2) 右下角常驻开关已移除（2026-11-18）：悬浮按钮挡在 3D 角色旁边太吵，
     语音开关只保留下方面板头的那个；需要时再打开面板即可 ── */

/* ── 3) 首次解锁引导（自动播放被拦时才出现） ── */
.ai-voice-cta {
  position: fixed; right: 18px; bottom: 306px; z-index: 98;
  width: 234px; padding: 10px 11px;
  background: var(--card); border: var(--border);
  box-shadow: var(--shadow-lg);
  animation: aiVoiceCtaIn .3s cubic-bezier(.2, .9, .3, 1.1) both;
}
@keyframes aiVoiceCtaIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
.ai-voice-cta-txt {
  margin: 0 0 9px; font-size: 12px; font-weight: 700;
  line-height: 1.5; color: var(--ink);
}
.ai-voice-cta-txt::before {
  content: 'AI 语音'; display: inline-block; margin-right: 5px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em;
  color: var(--card); background: var(--blue); padding: 2px 4px 3px;
}
.ai-voice-cta-acts { display: flex; gap: 6px; }
.ai-voice-cta-yes, .ai-voice-cta-no {
  font-family: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer;
  border: 2px solid var(--ink); padding: 5px 9px;
  transition: transform .12s ease, background .12s ease, color .12s ease;
}
.ai-voice-cta-yes { background: var(--orange); color: var(--card); box-shadow: 2px 2px 0 var(--ink); }
.ai-voice-cta-no { background: var(--card); color: var(--ink-soft); }
.ai-voice-cta-yes:hover { transform: translate(-1px, -1px); }
.ai-voice-cta-no:hover { background: var(--paper); color: var(--ink); }
.ai-voice-cta-yes:active, .ai-voice-cta-no:active { transform: translate(1px, 1px); }

/* 面板 10s 自动展开后，引导改挂进对话区，避免被面板盖住 */
.ai-voice-inline-cta {
  align-self: flex-start; max-width: 88%;
  padding: 9px 11px;
  background: var(--card); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  animation: aiVoiceCtaIn .28s cubic-bezier(.2, .9, .3, 1.1) both;
}
.ai-voice-inline-cta .ai-voice-cta-txt { margin-bottom: 8px; }
.ai-voice-inline-cta .ai-voice-cta-txt::before { content: 'AI 语音'; }

/* ── 4) 说话状态：角色口型 / 灯 / 音柱 / 轻微律动 ── */
body.cpai-speaking .ai-stage-actor { animation: aiVoiceBob .52s ease-in-out infinite alternate; }
@keyframes aiVoiceBob {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-2px) scale(1.008); }
}
body.cpai-speaking .ai-skin-host .sk-talk-mouth,
body.cpai-speaking .ai-skin-host .sk-l2d-mouth {
  animation: aiVoiceMouth .22s ease-in-out infinite alternate;
  transform-origin: center;
}
@keyframes aiVoiceMouth {
  from { transform: scaleY(.32) scaleX(1); }
  to { transform: scaleY(1.18) scaleX(.92); }
}
body.cpai-speaking .ai-skin-host .sk-wave-bar { animation-duration: .38s; }
body.cpai-speaking .ai-skin-host .sk-cpbot-lamp { animation: aiVoiceLamp .3s linear infinite; }
@keyframes aiVoiceLamp { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
body.cpai-speaking .ai-skin-host .sk-gen-img { animation: aiVoiceBob .5s ease-in-out infinite alternate; }

/* ── 5) 小屏 / 打印 / 减少动画 ── */
@media (max-width: 620px) {
  .ai-voice-cta { right: 12px; bottom: 226px; width: 206px; }
}
@media print {
  .ai-voice-toggle, .ai-voice-cta, .ai-voice-inline-cta { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.cpai-speaking .ai-stage-actor,
  body.cpai-speaking .ai-skin-host .sk-talk-mouth,
  body.cpai-speaking .ai-skin-host .sk-l2d-mouth,
  body.cpai-speaking .ai-skin-host .sk-cpbot-lamp,
  body.cpai-speaking .ai-skin-host .sk-gen-img,
  .ai-voice-cta, .ai-voice-inline-cta { animation: none; }
}
