/* R智能 AI 助手 widget 样式 — 使用站点 CSS 变量，自动适配深浅主题 */
#ai-fab{position:fixed;right:20px;bottom:20px;z-index:9998;width:56px;height:56px;border-radius:50%;border:none;cursor:pointer;
background:linear-gradient(135deg,var(--grad1,#ec4899),var(--grad2,#8b5cf6),var(--grad3,#3b82f6));
color:#fff;font-size:26px;display:flex;align-items:center;justify-content:center;
box-shadow:0 8px 24px rgba(139,92,246,.4);transition:transform .2s}
#ai-fab:hover{transform:scale(1.08)}
#ai-panel{position:fixed;right:20px;top:70px;z-index:9999;width:380px;max-width:calc(100vw - 40px);height:520px;max-height:calc(100vh - 120px);
background:var(--card,#fff);border:1px solid var(--border,#e8e8ef);border-radius:18px;display:none;flex-direction:column;overflow:hidden;
box-shadow:0 16px 48px rgba(0,0,0,.18)}
#ai-panel.open{display:flex}
#ai-head{padding:.9rem 1.1rem;background:linear-gradient(135deg,var(--grad1,#ec4899),var(--grad2,#8b5cf6),var(--grad3,#3b82f6));color:#fff;
display:flex;align-items:center;justify-content:space-between}
#ai-head b{font-size:1rem}
#ai-head small{display:block;font-size:.75rem;opacity:.85;font-weight:400}
#ai-close{background:rgba(255,255,255,.2);border:none;color:#fff;width:30px;height:30px;border-radius:50%;cursor:pointer;font-size:16px}
#ai-msgs{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.7rem}
.ai-msg{max-width:85%;padding:.6rem .9rem;border-radius:14px;font-size:.9rem;line-height:1.6;word-break:break-word}
.ai-msg.user{align-self:flex-end;background:linear-gradient(135deg,var(--grad2,#8b5cf6),var(--grad3,#3b82f6));color:#fff;border-bottom-right-radius:4px}
.ai-msg.bot{align-self:flex-start;background:var(--bg,#f5f5f7);color:var(--text,#1a1a2e);border-bottom-left-radius:4px}
.ai-msg.bot .src{margin-top:.5rem;padding-top:.5rem;border-top:1px dashed var(--border,#ddd);font-size:.78rem}
.ai-msg.bot .src a{color:var(--grad3,#3b82f6);text-decoration:none;display:block;padding:.15rem 0}
.ai-typing{align-self:flex-start;color:var(--text2,#888);font-size:.85rem}
.ai-typing i{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--text2,#888);margin-right:4px;animation:blink 1s infinite}
.ai-typing i:nth-child(2){animation-delay:.2s}.ai-typing i:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,100%{opacity:.3}50%{opacity:1}}
#ai-inputbar{display:flex;gap:.5rem;padding:.8rem;border-top:1px solid var(--border,#e8e8ef)}
#ai-input{flex:1;border:1px solid var(--border,#e8e8ef);border-radius:20px;padding:.55rem .9rem;font-size:.9rem;background:var(--bg,#f5f5f7);color:var(--text,#1a1a2e);outline:none}
#ai-send{border:none;border-radius:20px;padding:.55rem 1.1rem;cursor:pointer;font-size:.9rem;font-weight:700;color:#fff;
background:linear-gradient(135deg,var(--grad2,#8b5cf6),var(--grad3,#3b82f6))}
#ai-send:disabled{opacity:.5;cursor:default}
@media(max-width:480px){
#ai-panel{right:10px;bottom:78px;width:calc(100vw - 20px)}
#ai-fab{right:14px;bottom:14px}
}
