/* 简光OA 2.0 · AI 语音助手:右下角光球、字幕与对话面板 */
.ai-dock { position: fixed; z-index: 85; right: 18px; bottom: 28px; width: 84px; height: 84px; }
.ai-orb { all: unset; position: absolute; inset: 0; border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(circle at 50% 45%, rgba(15, 22, 31, .97), rgba(5, 8, 12, .98) 70%); border: 1px solid var(--line2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55); transition: box-shadow .25s, border-color .25s, transform .15s; }
.ai-orb canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; pointer-events: none; }
.ai-orb:hover { transform: scale(1.04); }
.ai-orb:active { transform: scale(.97); }
.ai-orb:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.ai-orb-l { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font: 11px var(--mono); letter-spacing: .12em; color: var(--hud);
  white-space: nowrap; pointer-events: none; text-shadow: 0 1px 8px rgba(0, 0, 0, .8); }
.ai-dock.awake .ai-orb { border-color: rgba(94, 234, 212, .6); box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 0 28px rgba(94, 234, 212, .35); }
.ai-dock:is([data-phase="think"], [data-phase="asr"]) .ai-orb { border-color: rgba(129, 140, 248, .6); box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 0 28px rgba(129, 140, 248, .4); }
.ai-dock:is([data-phase="think"], [data-phase="asr"]) .ai-orb-l { color: var(--indigo); }

.ai-cap { all: unset; box-sizing: border-box; position: absolute; right: 96px; bottom: 40px; width: max-content; max-width: min(360px, calc(100vw - 130px));
  padding: 9px 14px; border-radius: 14px 14px 4px 14px; border: 1px solid var(--line2); background: rgba(12, 17, 23, .95); color: var(--text);
  font-size: 14px; line-height: 1.55; cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: popIn .16s ease-out;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
:is(.ai-cap, .ai-tb, .ai-chip, button.ai-card):focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- 对话面板 ---------- */
.ai-panel { position: absolute; right: 0; bottom: 104px; width: 384px; max-width: calc(100vw - 28px); max-height: min(560px, calc(100vh - 200px)); max-height: min(560px, calc(100dvh - 200px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: var(--panel2); border: 1px solid var(--line2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 34px rgba(94, 234, 212, .07); animation: popIn .18s ease-out; transform-origin: bottom right; }
.ai-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: none; padding: 9px 8px 9px 14px; border-bottom: 1px solid var(--line); }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--mute); }
.ai-dock.awake .ai-dot { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.ai-dock:is([data-phase="think"], [data-phase="asr"]) .ai-dot { background: var(--indigo); box-shadow: 0 0 8px var(--indigo); animation: aiBlink 1s ease-in-out infinite; }
.ai-name { font-size: 15px; font-weight: 600; white-space: nowrap; flex: none; }
.ai-state { flex: 0 1 auto; min-width: 0; font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-head .sp { flex: 1; }
.ai-tb { all: unset; box-sizing: border-box; flex: none; height: 26px; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; cursor: pointer;
  font-size: 12px; line-height: 24px; color: var(--dim); white-space: nowrap; }
.ai-tb[hidden] { display: none; }
.ai-tb:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.ai-tb[aria-pressed="true"] { color: var(--cyan); border-color: rgba(94, 234, 212, .4); background: rgba(94, 234, 212, .08); }
.ai-x { width: 26px; padding: 0; text-align: center; font-size: 13px; }
.ai-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.ai-log:empty { display: none; }

.ai-msg { max-width: 88%; font-size: 14.5px; line-height: 1.62; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-end; padding: 7px 12px; border-radius: 14px 14px 4px 14px; border: 1px solid rgba(94, 234, 212, .28); background: rgba(94, 234, 212, .12); white-space: pre-wrap; }
.ai-msg.ai { align-self: stretch; max-width: 100%; padding-left: 11px; border-left: 2px solid rgba(94, 234, 212, .35); }
.ai-msg.ai.cut { border-left-color: var(--line); }
.ai-msg.cut .ai-txt { color: var(--dim); }
.ai-txt { white-space: pre-wrap; }
.ai-txt:empty { display: none; }
.ai-msg.live .ai-txt:empty { display: block; }
.ai-msg.live .ai-txt::after { content: ''; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; border-radius: 1px;
  background: var(--cyan); animation: aiBlink 1s steps(2, start) infinite; }
.ai-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ai-tools span { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font: 11.5px var(--mono);
  color: var(--indigo); border: 1px solid rgba(129, 140, 248, .35); background: rgba(129, 140, 248, .08); }
.ai-tools span::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.ai-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ai-cards-t { font: 11.5px var(--mono); letter-spacing: .12em; color: var(--hud); }
.ai-card { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); }
button.ai-card { cursor: pointer; transition: border-color .12s, background .12s; }
button.ai-card:hover { border-color: rgba(94, 234, 212, .5); background: rgba(94, 234, 212, .07); }
.ai-card b { font-size: 14px; font-weight: 500; color: var(--text); }
:is(.ai-card-s, .ai-card-d) { font-size: 12.5px; line-height: 1.5; color: var(--dim); }
.ai-card-d { color: var(--text2); }

.ai-confirm { margin-top: 8px; padding: 11px 12px; border-radius: 10px; border: 1px solid rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .06); }
.ai-confirm-t { display: block; margin-bottom: 6px; font-size: 14.5px; color: var(--amber); }
.ai-confirm dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13.5px; }
.ai-confirm dt { color: var(--dim); white-space: nowrap; }
.ai-confirm dd { margin: 0; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-confirm-a { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ai-confirm-h { font-size: 12.5px; color: var(--dim); }
.ai-confirm:is([data-state="ok"], [data-state="cancel"], [data-state="expired"], [data-state="fail"]) .btn { display: none; }
.ai-confirm[data-state="busy"] .ai-confirm-h { color: var(--cyan); }
.ai-confirm[data-state="ok"] { border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .06); }
.ai-confirm[data-state="ok"] .ai-confirm-h { color: var(--green); }
.ai-confirm:is([data-state="cancel"], [data-state="expired"]) { opacity: .72; border-color: var(--line); background: none; }
.ai-confirm[data-state="fail"] { border-color: rgba(248, 113, 113, .45); background: rgba(248, 113, 113, .05); }
.ai-confirm[data-state="fail"] .ai-confirm-h { color: var(--red); }
.ai-note { align-self: center; max-width: 100%; padding: 6px 12px; border-radius: 8px; border: 1px dashed var(--line); background: rgba(255, 255, 255, .03);
  color: var(--dim); font-size: 13px; line-height: 1.55; text-align: center; overflow-wrap: anywhere; }
.ai-note.err { color: var(--red); border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .05); }
.ai-msg .ai-note { margin-top: 6px; text-align: left; }

.ai-sugg { display: flex; flex-wrap: wrap; gap: 8px; flex: none; padding: 14px; }
.ai-chip { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; flex: none; height: 32px; padding: 0 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line2); background: rgba(94, 234, 212, .05); color: var(--text2); font-size: 13.5px; white-space: nowrap; transition: border-color .12s, background .12s, color .12s; }
.ai-chip:hover { border-color: rgba(94, 234, 212, .6); background: rgba(94, 234, 212, .12); color: #fff; }
.ai-entry { flex: none; padding: 0 14px 12px; }
.ai-entry[hidden] { display: none; }
.ai-start { width: 100%; }
.ai-entry p { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--dim); }
.ai-input { display: flex; gap: 8px; flex: none; padding: 10px 12px 8px; border-top: 1px solid var(--line); }
.ai-input .inp { flex: 1; min-width: 0; height: 36px; padding: 0 14px; border-radius: 999px; }
.ai-input .btn { height: 36px; border-radius: 999px; }
.ai-privacy { flex: none; padding: 0 14px 10px; font-size: 11.5px; line-height: 1.5; color: var(--mute); }
@keyframes aiBlink { 50% { opacity: .25; } }

/* ---------- 窄屏:面板变底部抽屉 ---------- */
@media (max-width: 640px) {
  .ai-dock { right: 12px; bottom: 24px; width: 64px; height: 64px; }
  .ai-orb-l { bottom: -17px; font-size: 10px; }
  .ai-more { right: 72px; bottom: 2px; }
  .ai-cap { right: 74px; bottom: 34px; max-width: calc(100vw - 100px); font-size: 13.5px; }
  .ai-panel { position: fixed; left: 8px; right: 8px; bottom: 104px; width: auto; max-width: none;
    max-height: calc(100vh - 176px); max-height: calc(100dvh - 176px); border-radius: 16px; transform-origin: bottom center; }
  .ai-head { padding-left: 12px; }
  .ai-tb { padding: 0 6px; }
  .ai-msg { max-width: 92%; }
}

/* ---------- 白天模式:光球保持深色以保证光效对比 ---------- */
:root[data-experience="app"][data-theme="light"] .ai-orb { border-color: rgba(15, 118, 110, .45); box-shadow: 0 10px 26px rgba(40, 60, 86, .3); }
:root[data-experience="app"][data-theme="light"] :is(.ai-more, .ai-cap) { background: rgba(255, 255, 255, .96); color: var(--text); box-shadow: 0 10px 30px rgba(40, 60, 86, .16); }
:root[data-experience="app"][data-theme="light"] .ai-more { color: var(--dim); }
:root[data-experience="app"][data-theme="light"] .ai-panel { box-shadow: 0 24px 60px rgba(40, 60, 86, .22); }
:root[data-experience="app"][data-theme="light"] body:not([data-page="home"]) .ai-orb-l { text-shadow: none; }
:root[data-experience="app"][data-theme="light"] body[data-page="home"] .ai-orb-l { color: rgba(125, 243, 226, .72); }
:root[data-experience="app"][data-theme="light"] body[data-page="home"] .ai-dock:is([data-phase="think"], [data-phase="asr"]) .ai-orb-l { color: #818cf8; }
:root[data-experience="app"][data-theme="light"] .ai-msg.me { background: rgba(14, 118, 110, .09); border-color: rgba(14, 118, 110, .3); }
:root[data-experience="app"][data-theme="light"] :is(.ai-card, .ai-note) { background: #f6f9fc; }
:root[data-experience="app"][data-theme="light"] :is(.ai-chip, .ai-tb[aria-pressed="true"]) { background: rgba(14, 118, 110, .06); }
:root[data-experience="app"][data-theme="light"] :is(.ai-more:hover, .ai-chip:hover, button.ai-card:hover, .ai-tb:hover) { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .ai-panel, .ai-cap { animation: none; }
  .ai-orb { transition: none; }
  .ai-orb:hover, .ai-orb:active { transform: none; }
  .ai-msg.live .ai-txt::after, .ai-dock .ai-dot { animation: none; }
}
