/* ============================================
   小道童「AI 助手」- 全新独立聊天组件样式
   与阅读页 daoPopup 完全隔离，独立命名空间
   配色：青道袍 (#2E7D32) · 米领 (#F5E6D3) · 墨发 (#2C1810) · 淡金纹 (#D4A017)
   ============================================ */

/* ========== 浮动入口按钮 ========== */
.ai-assistant-fab {
    position: fixed !important;
    right: 16px !important;
    bottom: 16px !important;
    z-index: 999999 !important;
    width: 64px !important;
    height: 64px !important;
    padding: 4px !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 12px rgba(139, 90, 60, 0.35));
    will-change: transform;
    transform: translateZ(0);
}
.ai-assistant-fab:active {
    transform: scale(0.92) !important;
}

/* ========== 小道童 Avatar 容器 ========== */
.ai-assistant-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    animation: ai-body-breathe 2.5s ease-in-out infinite;
    transform-origin: center bottom;
}

/* ===== 光晕呼吸 ===== */
.ai-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 62px; height: 62px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,0.12) 0%, transparent 70%);
    animation: ai-glow-pulse 3s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

/* ===== 小腿 ===== */
.ai-leg {
    position: absolute;
    bottom: 12px;
    width: 7px;
    height: 8px;
    background: #FDEBD0;
    border-radius: 2px;
    z-index: 1;
}
.ai-leg-left  { left: 17px; animation: ai-step-l 1.6s ease-in-out infinite; }
.ai-leg-right { right: 17px; animation: ai-step-r 1.6s ease-in-out infinite 0.8s; }

/* ===== 云头鞋 ===== */
.ai-shoe {
    position: absolute;
    bottom: 4px;
    width: 11px;
    height: 7px;
    background: linear-gradient(180deg, #1B5E20 0%, #0D3B10 100%);
    border-radius: 3px 3px 4px 4px;
    z-index: 2;
}
.ai-shoe::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 5px; height: 3px;
    background: #D4A017;
    border-radius: 0 0 2px 2px;
    opacity: 0.7;
}
.ai-shoe-left {
    left: 14px;
    animation: ai-step-l 1.6s ease-in-out infinite;
}
.ai-shoe-left::after { left: 0; }
.ai-shoe-right {
    right: 14px;
    animation: ai-step-r 1.6s ease-in-out infinite 0.8s;
}
.ai-shoe-right::after { right: 0; }

/* ===== 道袍身体 ===== */
.ai-body {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 22px;
    background: linear-gradient(180deg, #2E7D32 0%, #1B5E20 100%);
    border-radius: 6px 6px 10px 10px;
    z-index: 1;
    overflow: visible;
}

/* 道袍领口（交领右衽） */
.ai-collar {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 13px; height: 7px;
    background: #F5E6D3;
    clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
}

/* 胸前淡金太极纹 */
.ai-robe-pattern {
    position: absolute;
    bottom: 3px; left: 50%;
    transform: translateX(-50%);
    width: 9px; height: 9px;
    border: 1.5px solid rgba(212,160,23,0.55);
    border-radius: 50%;
}
.ai-robe-pattern::before {
    content: '道';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5px;
    color: rgba(212,160,23,0.75);
    font-family: 'STKaiti', 'KaiTi', serif;
}

/* ===== 广袖 ===== */
.ai-sleeve {
    position: absolute;
    top: 2px;
    width: 13px;
    height: 19px;
    background: linear-gradient(180deg, #2E7D32 0%, #1B5E20 100%);
    border-radius: 5px 5px 9px 9px;
    z-index: 0;
    transform-origin: top center;
}
.ai-sleeve-left  { left: -9px; animation: ai-sway-l 3s ease-in-out infinite; }
.ai-sleeve-right { right: -9px; animation: ai-sway-r 3s ease-in-out infinite 0.5s; }

/* ===== 头部（挽髻） ===== */
.ai-head {
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 24px;
    background: #FDEBD0;
    border-radius: 50% 50% 45% 45%;
    z-index: 2;
    animation: ai-head-tilt 6s ease-in-out infinite;
    transform-origin: center bottom;
}

/* 双鬟髻 */
.ai-bun {
    position: absolute;
    width: 9px; height: 9px;
    background: #2C1810;
    border-radius: 50%;
    top: -5px;
    z-index: 3;
}
.ai-bun-left  { left: 2px; animation: ai-bun-bounce 3s ease-in-out infinite; }
.ai-bun-right { right: 2px; animation: ai-bun-bounce 3s ease-in-out infinite 0.3s; }

/* 发带 */
.ai-hairband {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 30px; height: 3px;
    background: #C0392B;
    border-radius: 2px;
    z-index: 4;
}
.ai-hairband::before,
.ai-hairband::after {
    content: '';
    position: absolute;
    width: 4px; height: 9px;
    background: #C0392B;
    border-radius: 0 0 3px 3px;
    top: 3px;
    animation: ai-hairband-flow 4s ease-in-out infinite;
}
.ai-hairband::before { left: 2px; transform-origin: top center; }
.ai-hairband::after  { right: 2px; transform-origin: top center; animation-delay: 0.5s; }

/* 眼睛 */
.ai-eyes {
    position: absolute;
    top: 9px; left: 50%;
    transform: translateX(-50%);
    width: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 5;
}
.ai-eye {
    width: 6px; height: 6px;
    background: #2C1810;
    border-radius: 50%;
    position: relative;
    animation: ai-blink 4s ease-in-out infinite;
}
.ai-eye::after {
    content: '';
    position: absolute;
    width: 2px; height: 2px;
    background: #fff;
    border-radius: 50%;
    top: 1px; right: 1px;
}

/* 腮红 */
.ai-blush {
    position: absolute;
    top: 15px;
    width: 6px; height: 3px;
    background: rgba(255,150,150,0.45);
    border-radius: 50%;
    z-index: 5;
}
.ai-blush-left  { left: 1px; }
.ai-blush-right { right: 1px; }

/* 嘴巴 */
.ai-mouth {
    position: absolute;
    top: 18px; left: 50%;
    transform: translateX(-50%);
    width: 6px; height: 3px;
    border-bottom: 2px solid #C0392B;
    border-radius: 0 0 50% 50%;
    z-index: 5;
}

/* ========== 面板内缩略版小道童 ========== */
.ai-panel-avatar {
    width: 36px; height: 36px;
    margin-right: 8px;
    position: relative;
    flex-shrink: 0;
    animation: ai-body-breathe 2.5s ease-in-out infinite;
    transform-origin: center bottom;
}
.ai-panel-avatar .ai-glow { display: none; }
.ai-panel-avatar .ai-leg { width: 5px; height: 5px; bottom: 8px; }
.ai-panel-avatar .ai-leg-left  { left: 10px; animation: ai-step-l 1.6s ease-in-out infinite; }
.ai-panel-avatar .ai-leg-right { right: 10px; animation: ai-step-r 1.6s ease-in-out infinite 0.8s; }
.ai-panel-avatar .ai-shoe { width: 8px; height: 5px; bottom: 3px; }
.ai-panel-avatar .ai-shoe-left  { left: 8px; animation: ai-step-l 1.6s ease-in-out infinite; }
.ai-panel-avatar .ai-shoe-right { right: 8px; animation: ai-step-r 1.6s ease-in-out infinite 0.8s; }
.ai-panel-avatar .ai-shoe::after { width: 4px; height: 2px; }
.ai-panel-avatar .ai-body { width: 22px; height: 14px; top: 14px; }
.ai-panel-avatar .ai-collar { width: 9px; height: 5px; }
.ai-panel-avatar .ai-robe-pattern { width: 6px; height: 6px; border-width: 1px; }
.ai-panel-avatar .ai-robe-pattern::before { font-size: 3px; }
.ai-panel-avatar .ai-sleeve { width: 9px; height: 13px; top: 1px; }
.ai-panel-avatar .ai-sleeve-left  { left: -6px; animation: ai-sway-l 3s ease-in-out infinite; }
.ai-panel-avatar .ai-sleeve-right { right: -6px; animation: ai-sway-r 3s ease-in-out infinite 0.5s; }
.ai-panel-avatar .ai-head { width: 20px; height: 17px; top: 0; }
.ai-panel-avatar .ai-bun { width: 6px; height: 6px; top: -3px; }
.ai-panel-avatar .ai-bun-left  { left: 1px; animation: ai-bun-bounce 3s ease-in-out infinite; }
.ai-panel-avatar .ai-bun-right { right: 1px; animation: ai-bun-bounce 3s ease-in-out infinite 0.3s; }
.ai-panel-avatar .ai-hairband { width: 22px; height: 2px; }
.ai-panel-avatar .ai-hairband::before,
.ai-panel-avatar .ai-hairband::after { width: 3px; height: 6px; }
.ai-panel-avatar .ai-eyes { top: 6px; width: 14px; }
.ai-panel-avatar .ai-eye { width: 4px; height: 4px; }
.ai-panel-avatar .ai-eye::after { width: 1.5px; height: 1.5px; }
.ai-panel-avatar .ai-blush { width: 4px; height: 2px; top: 10px; }
.ai-panel-avatar .ai-mouth { top: 13px; width: 4px; height: 2px; border-width: 1.5px; }

/* ========== 聊天面板 ========== */
.ai-assistant-panel {
    position: fixed !important;
    right: 12px !important;
    bottom: 80px !important;
    width: 280px !important;
    max-width: 280px !important;
    max-height: calc(100vh - 120px) !important;
    height: auto !important;
    background: linear-gradient(180deg, #FDF8F0 0%, #F5EDDF 100%);
    border: 2px solid #C4A882;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(139,90,60,0.3), inset 0 1px 0 rgba(255,255,255,0.5);
    z-index: 999998 !important;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: ai-panel-open 0.3s ease-out;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    transform: translateZ(0);
}
.ai-assistant-panel.open { display: flex !important; }

/* --- 面板头部 --- */
.ai-panel-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(90deg, #8B5A3C, #6B4226);
    color: #F5E6D3;
    border-radius: 14px 14px 0 0;
    position: relative;
    flex-shrink: 0;
}
.ai-panel-title { flex: 1; min-width: 0; }
.ai-panel-title h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-panel-title p { margin: 2px 0 0; font-size: 10px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-panel-close {
    width: 24px; height: 24px;
    background: rgba(255,255,255,0.15);
    border: none; border-radius: 50%;
    color: #F5E6D3; font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.ai-panel-close:active { background: rgba(255,255,255,0.3); }

/* --- 欢迎语 --- */
.ai-welcome {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(196,168,130,0.3);
    flex-shrink: 0;
}
.ai-welcome-bubble {
    background: linear-gradient(135deg, #FFF8E7, #F5E6D3);
    border: 1px solid #D4C4A8;
    border-radius: 4px 14px 14px 14px;
    padding: 10px 12px;
    font-size: 12px; color: #5D4037;
    line-height: 1.6;
    position: relative;
}
.ai-welcome-bubble::before {
    content: '🎋';
    position: absolute;
    top: -6px; left: -6px;
    font-size: 14px;
}

/* --- 快捷按钮 --- */
.ai-quick-actions {
    display: flex; gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(196,168,130,0.3);
    flex-shrink: 0;
}
.ai-action-btn {
    flex: 1; padding: 10px 6px;
    border: 1.5px solid;
    border-radius: 10px;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: 'STKaiti','KaiTi','PingFang SC',sans-serif;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: transparent;
}
.ai-action-btn::before {
    content: '';
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 60%);
    opacity: 0; transition: opacity 0.3s ease;
    pointer-events: none;
}
.ai-action-btn:active::before { opacity: 1; }

.ai-btn-jie-yuan {
    background: linear-gradient(135deg, #FFF8E7, #FFE4B5);
    border-color: #D4A017; color: #8B6914;
}
.ai-btn-jie-yuan:active {
    background: linear-gradient(135deg, #FFE4B5, #FFD700);
    border-color: #B8860B;
    box-shadow: 0 0 16px rgba(255,215,0,0.4);
}
.ai-btn-xiu-xing {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    border-color: #4CAF50; color: #2E7D32;
}
.ai-btn-xiu-xing:active {
    background: linear-gradient(135deg, #C8E6C9, #A5D6A7);
    border-color: #388E3C;
    box-shadow: 0 0 16px rgba(76,175,80,0.4);
}

/* --- 聊天消息区 --- */
.ai-chat-messages {
    flex: 1; overflow-y: auto !important;
    padding: 12px 14px;
    min-height: 150px; max-height: 40vh;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.ai-msg {
    margin-bottom: 10px;
    display: flex;
    animation: ai-msg-fade-in 0.3s ease-out;
}
.ai-msg-bot { justify-content: flex-end; }
.ai-msg-user { justify-content: flex-start; }
.ai-msg-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    margin-left: 6px;
    border: 2px solid #F5E6D3;
}
.ai-msg-user .ai-msg-avatar {
    order: 2; margin-left: 0; margin-right: 6px;
    background: linear-gradient(135deg, #8B5A3C, #6B4226);
}
.ai-msg-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px; line-height: 1.6;
    word-break: break-word;
}
.ai-msg-bot .ai-msg-bubble {
    background: #FFF8E7;
    border: 1px solid #E8D5B7;
    border-radius: 14px 4px 14px 14px;
    color: #111;
}
.ai-msg-user .ai-msg-bubble {
    background: linear-gradient(135deg, #8B5A3C, #6B4226);
    border-radius: 4px 14px 14px 14px;
    color: #fff;
}

/* 打字动画 */
.ai-typing {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 0;
}
.ai-typing span {
    width: 5px; height: 5px;
    background: #8B5A3C;
    border-radius: 50%;
    animation: ai-typing-bounce 1.4s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

/* --- 输入区 --- */
.ai-chat-input-wrap {
    display: flex;
    padding: 8px 10px;
    border-top: 1px solid rgba(196,168,130,0.3);
    background: rgba(253,248,240,0.8);
    gap: 6px;
    flex-shrink: 0;
}
.ai-chat-input {
    flex: 1; padding: 8px 12px;
    border: 1.5px solid #D4C4A8;
    border-radius: 20px;
    background: #FFF8E7;
    font-size: 13px; color: #5D4037;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    -webkit-appearance: none;
}
.ai-chat-input::placeholder { color: #B8A88A; }
.ai-chat-input:focus {
    border-color: #8B5A3C;
    box-shadow: 0 0 0 3px rgba(139,90,60,0.1);
}
.ai-chat-send {
    width: 36px; height: 36px;
    border: none; border-radius: 50%;
    background: linear-gradient(135deg, #8B5A3C, #6B4226);
    color: #F5E6D3; font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.ai-chat-send:active { transform: scale(0.9); }
.ai-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 动画关键帧 ========== */
@keyframes ai-body-breathe {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.03); }
}
@keyframes ai-glow-pulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%,-50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%,-50%) scale(1.15); }
}
@keyframes ai-step-l {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes ai-step-r {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes ai-sway-l {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-8deg); }
}
@keyframes ai-sway-r {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(8deg); }
}
@keyframes ai-head-tilt {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    15% { transform: translateX(-50%) rotate(-6deg); }
    30% { transform: translateX(-50%) rotate(4deg); }
    45% { transform: translateX(-50%) rotate(-2deg); }
    60% { transform: translateX(-50%) rotate(0deg); }
}
@keyframes ai-bun-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}
@keyframes ai-blink {
    0%, 42%, 48%, 100% { transform: scaleY(1); }
    45% { transform: scaleY(0.1); }
}
@keyframes ai-hairband-flow {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(6deg); }
    75% { transform: rotate(-6deg); }
}
@keyframes ai-panel-open {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ai-msg-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes ai-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ========== 滚动条美化 ========== */
.ai-chat-messages::-webkit-scrollbar { width: 3px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: rgba(139,90,60,0.3); border-radius: 3px; }

/* ========== 弹窗样式（古卷风格） ========== */
.ai-modal-overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    background: rgba(0,0,0,0.6) !important;
    z-index: 999999 !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    animation: ai-modal-fade-in 0.25s ease-out;
    -webkit-tap-highlight-color: transparent;
}
.ai-modal-box {
    width: 85vw !important; max-width: 320px !important;
    background: linear-gradient(180deg, #FDF8F0 0%, #F5EDDF 100%);
    border: 2px solid #C4A882;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(139,90,60,0.4), inset 0 1px 0 rgba(255,255,255,0.6);
    padding: 16px;
    text-align: center;
    position: relative;
    animation: ai-modal-scale-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.ai-modal-gujun::before {
    content: '';
    position: absolute; top: 6px; left: 6px; right: 6px; bottom: 6px;
    border: 1px dashed rgba(196,168,130,0.5);
    border-radius: 12px;
    pointer-events: none;
}
.ai-modal-header {
    font-size: 15px; font-weight: 600;
    color: #5D4037;
    margin-bottom: 12px;
    letter-spacing: 1px;
    font-family: 'STKaiti','KaiTi',serif;
}
.ai-modal-tabs {
    display: flex; justify-content: center; gap: 12px;
    margin-bottom: 14px;
}
.ai-modal-tab {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px; font-weight: 500;
    color: #8B5A3C;
    background: rgba(255,248,231,0.8);
    border: 1px solid #D4C4A8;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.ai-modal-tab.active {
    background: linear-gradient(135deg, #8B5A3C, #6B4226);
    color: #F5E6D3;
    border-color: #6B4226;
    box-shadow: 0 2px 8px rgba(139,90,60,0.3);
}
.ai-modal-content {
    position: relative;
    width: 100%; height: 260px;
    margin-bottom: 12px;
    display: flex; align-items: center; justify-content: center;
    background: #FFF8E7;
    border-radius: 8px;
    border: 1px solid #E8D5B7;
    overflow: hidden;
}
.ai-modal-qr {
    width: 80%; max-width: 220px;
    display: none;
    animation: ai-qr-fade-in 0.3s ease-out;
}
.ai-modal-qr.active { display: block; }
.ai-modal-tip {
    font-size: 11px; color: #8B6914;
    margin: 8px 0 14px;
    line-height: 1.5;
}
.ai-modal-copy-wrap {
    display: flex; gap: 6px;
    margin-bottom: 14px;
    padding: 0 4px;
}
.ai-modal-input {
    flex: 1; padding: 8px 10px;
    border: 1.5px solid #D4C4A8;
    border-radius: 8px;
    background: #FFF8E7;
    font-size: 12px; color: #5D4037;
    text-align: center; outline: none;
    font-family: 'Courier New',monospace;
    -webkit-appearance: none;
}
.ai-modal-copy-btn {
    padding: 8px 14px;
    border: none; border-radius: 8px;
    background: linear-gradient(135deg, #8B5A3C, #6B4226);
    color: #F5E6D3; font-size: 12px; font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.ai-modal-copy-btn:active { transform: scale(0.95); }
.ai-modal-close-btn {
    width: 100%; padding: 10px 0;
    border: 1.5px solid #C4A882;
    border-radius: 10px;
    background: transparent;
    color: #8B5A3C; font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'STKaiti','KaiTi',serif;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: transparent;
}
.ai-modal-close-btn:active {
    background: rgba(139,90,60,0.1);
    transform: scale(0.98);
}

/* 弹窗动画 */
@keyframes ai-modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ai-modal-scale-in { from { opacity: 0; transform: scale(0.85) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes ai-qr-fade-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ========== 语音播放按钮 ========== */
.ai-voice-btn {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-left: 6px;
    font-size: 14px;
    cursor: pointer;
    vertical-align: middle;
    transition: transform 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    line-height: 1;
}
.ai-voice-btn:active { transform: scale(1.3); }
.ai-voice-btn.ai-voice-playing {
    animation: ai-voice-pulse 0.8s ease-in-out infinite;
}
@keyframes ai-voice-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* ========== 面板头部语音开关按钮 ========== */
.ai-voice-toggle-btn {
    font-size: 16px !important;
    line-height: 1 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s ease, background 0.2s ease;
}
.ai-voice-toggle-btn:active {
    transform: scale(1.15) !important;
}

/* ========== 重试按钮 ========== */
.ai-retry-btn {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-left: 8px;
    font-size: 12px;
    color: #8B6914;
    cursor: pointer;
    vertical-align: middle;
    transition: transform 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.ai-retry-btn:active {
    transform: scale(1.15);
    color: #D4A017;
}

/* ===== 头顶聊天气泡（通用 - 永久显示） ===== */
.ai-bubble-hint {
    position: absolute;
    top: -42px;
    right: -8px;
    width: 80px;
    padding: 6px 8px;
    background: #fff;
    border: 1.5px solid #C4A882;
    border-radius: 12px 12px 12px 4px;
    font-size: 10px;
    color: #5D4037;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(139,90,60,0.15);
    z-index: 10;
    opacity: 1;
    transition: all 0.3s ease;
    pointer-events: auto;
    font-family: 'STKaiti','KaiTi',sans-serif;
    letter-spacing: 0.5px;
    cursor: pointer;
}
.ai-bubble-hint::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 16px;
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}
.ai-bubble-hint::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 15px;
    width: 0; height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid #C4A882;
    z-index: -1;
}

/* ============================================
   阅读页专属打坐造型（通过 body.ai-meditation-page 控制）
   ============================================ */
body.ai-meditation-page .ai-assistant-fab .ai-leg,
body.ai-meditation-page .ai-assistant-fab .ai-shoe {
    display: none !important;
}

body.ai-meditation-page .ai-crossed-leg {
    position: absolute !important;
    bottom: 4px !important;
    width: 38px !important;
    height: 14px !important;
    z-index: 0 !important;
}
body.ai-meditation-page .ai-crossed-leg::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important; top: 2px !important;
    width: 22px !important; height: 10px !important;
    background: linear-gradient(180deg, #2E7D32 0%, #1B5E20 100%) !important;
    border-radius: 5px 3px 8px 6px !important;
    transform: rotate(-15deg) !important;
}
body.ai-meditation-page .ai-crossed-leg::after {
    content: '' !important;
    position: absolute !important;
    right: 0 !important; top: 2px !important;
    width: 22px !important; height: 10px !important;
    background: linear-gradient(180deg, #2E7D32 0%, #1B5E20 100%) !important;
    border-radius: 3px 5px 6px 8px !important;
    transform: rotate(15deg) !important;
}

body.ai-meditation-page .ai-arm {
    position: absolute !important;
    bottom: 6px !important;
    width: 10px !important; height: 14px !important;
    background: linear-gradient(180deg, #2E7D32 0%, #1B5E20 100%) !important;
    border-radius: 4px 4px 6px 6px !important;
    z-index: 2 !important;
}
body.ai-meditation-page .ai-arm-left  { left: 6px !important; transform: rotate(20deg) !important; }
body.ai-meditation-page .ai-arm-right { right: 6px !important; transform: rotate(-20deg) !important; }

body.ai-meditation-page .ai-hand {
    position: absolute !important;
    bottom: 8px !important;
    width: 8px !important; height: 8px !important;
    background: #FDEBD0 !important;
    border-radius: 50% !important;
    z-index: 3 !important;
}
body.ai-meditation-page .ai-hand-left  { left: 10px !important; }
body.ai-meditation-page .ai-hand-right { right: 10px !important; }

body.ai-meditation-page .ai-assistant-fab.shimmer-effect {
    animation: ai-shimmer 3s ease-in-out infinite !important;
}
@keyframes ai-shimmer {
    0%, 100% { filter: drop-shadow(0 0 3px rgba(255,215,0,0.4)) drop-shadow(0 0 6px rgba(255,215,0,0.2)); }
    25% { filter: drop-shadow(0 0 6px rgba(255,215,0,0.6)) drop-shadow(0 0 12px rgba(255,215,0,0.4)); }
    50% { filter: drop-shadow(0 0 4px rgba(255,215,0,0.5)) drop-shadow(0 0 10px rgba(255,215,0,0.3)); }
    75% { filter: drop-shadow(0 0 8px rgba(255,215,0,0.7)) drop-shadow(0 0 14px rgba(255,215,0,0.5)); }
}

body.ai-meditation-page .ai-assistant-avatar.meditation-mode {
    animation: ai-body-breathe 2.5s ease-in-out infinite, ai-meditation-glow 4s ease-in-out infinite !important;
}
@keyframes ai-meditation-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.2), 0 0 16px rgba(255,215,0,0.1); }
    50% { box-shadow: 0 0 12px rgba(255,215,0,0.4), 0 0 24px rgba(255,215,0,0.2); }
}

body.ai-meditation-page .ai-stone-base {
    position: absolute !important;
    bottom: -12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 48px !important;
    height: 14px !important;
    background: linear-gradient(180deg, #6B7B8D 0%, #4A5568 50%, #3D4A5C 100%) !important;
    border-radius: 4px 4px 6px 6px !important;
    z-index: -1 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
}
body.ai-meditation-page .ai-stone-base::before {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    left: 4px !important;
    right: 4px !important;
    height: 2px !important;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 20%, rgba(255,255,255,0.15) 80%, transparent 100%) !important;
    border-radius: 1px !important;
}
body.ai-meditation-page .ai-stone-base::after {
    content: '首页' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 9px !important;
    color: rgba(245, 230, 211, 0.85) !important;
    font-family: 'STKaiti','KaiTi',serif !important;
    letter-spacing: 1px !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}
body.ai-meditation-page .ai-stone-base:active {
    transform: translateX(-50%) scale(0.95) !important;
}

/* ===== 小道童弹窗全屏 + 字体加粗优化（链路2：非阅读页专用） ===== */
/* 全屏模式 - 弹窗铺满手机全屏 */
.ai-assistant-panel.ai-assistant-fullscreen {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
}
/* 聊天文字加粗 + 字号偏大 */
.ai-msg-bubble {
    font-weight: 700 !important;
    font-size: 15px !important;
}
.ai-chat-input {
    font-weight: 700 !important;
    font-size: 15px !important;
}
.ai-chat-input::placeholder {
    font-weight: 700 !important;
}
.ai-chat-send {
    font-weight: 700 !important;
}
.ai-welcome-bubble {
    font-weight: 700 !important;
    font-size: 14px !important;
}
.ai-panel-title h3,
.ai-panel-title p {
    font-weight: 700 !important;
}
/* ===== 全屏 + 字体优化结束 ===== */
