/* ═══ B平台加载动画适配（自动注入）═══ */
.flex.items-center.justify-center.size-6 { opacity: 1 !important; }
.flex.items-center.justify-center.size-6 > .flex.gap-2 { display: none !important; }
.is-assistant.w-fit { width: 100% !important; }
.is-assistant > .border.border-muted:has(.flex.items-center.justify-center.size-6) {
  width: 100% !important; background: transparent !important;
  border: none !important; padding: 0 !important;
}
.is-assistant .space-y-3:has(.flex.items-center.justify-center.size-6) {
  display: flex; justify-content: center; width: 100%;
}

/* ═══ B平台表格修正（自动注入）═══ */
.rili-markdown-renderer table { display:table!important; table-layout:auto!important; width:100%!important; border-collapse:collapse!important; }
.rili-markdown-renderer table caption { display:table-caption!important; caption-side:top!important; text-align:center!important; padding:8px!important; }
.rili-markdown-renderer thead { display:table-header-group!important; }
.rili-markdown-renderer tbody { display:table-row-group!important; }
.rili-markdown-renderer tr { display:table-row!important; }
.rili-markdown-renderer th, .rili-markdown-renderer td { display:table-cell!important; }

/* ═══ B平台按钮组保护（自动注入 — 防止按钮消失）═══
   原理：B平台消息操作按钮结构为：
   .flex.items-center.gap-1.ml-auto (hover显隐包装)
     └── .bg-muted.rounded.flex.p-0.5 (按钮组容器)
           └── button.rounded-full.size-7 (单个按钮)
   以下规则使用高specificity + !important确保按钮
   不被任何转换后/透传的CSS规则意外隐藏
   ═══════════════════════════════════════════════ */
/* 按钮组容器保护 */
.w-full.h-full.flex.group .bg-muted.rounded.flex.p-0\.5,
.is-user .bg-muted.rounded.flex.p-0\.5,
.is-assistant .bg-muted.rounded.flex.p-0\.5 {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  overflow: visible !important;
  position: relative !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  pointer-events: auto !important;
  clip: auto !important;
  clip-path: none !important;
}
/* 单个按钮保护 */
.w-full.h-full.flex.group .bg-muted.rounded.flex.p-0\.5 > button,
.is-user .bg-muted.rounded.flex.p-0\.5 > button,
.is-assistant .bg-muted.rounded.flex.p-0\.5 > button {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: relative !important;
  clip: auto !important;
  clip-path: none !important;
}
/* hover显隐包装层保护 — 仅保留B平台原生的opacity过渡 */
.flex.items-center.gap-1.ml-auto.md\:opacity-0.group-hover\:opacity-100 {
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important;
  overflow: visible !important;
}
/* 操作行保护 */
.flex.w-full.items-center.justify-between.gap-2.px-2 {
  display: flex !important;
  visibility: visible !important;
  overflow: visible !important;
}

/* ========== 阿尔温娜·追风者 专属聊天框美化 ========== */

/* 1. 移除顶部的颜色装饰条（你特别要求的） */
[class*="bg-[#F1CBCB]"], 
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* 2. 统一聊天框背景与基础样式 */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
    border: 1px solid rgba(200, 200, 220, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(50, 50, 80, 0.3) !important;
    border-radius: 18px !important;
    transition: box-shadow 0.3s ease, border-color 0.3s ease !important;
}

/* 3. 针对单独的输入聊天框（你的视角，更沉稳） */
.is-user > .border.border-muted {
    border: 1px solid rgba(100, 150, 255, 0.2) !important; /* 冷色调，象征沉稳 */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(50, 50, 100, 0.2) !important;
}

/* 4. 针对输出聊天框（阿尔温娜的视角，略带回响感） */
.is-assistant > .border.border-muted {
    border: 1px solid rgba(255, 180, 100, 0.2) !important; /* 暖色调，象征她灵魂中的火焰 */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(100, 50, 0, 0.2) !important;
}

/* 5. 【强制可读性】主要文本内容 - 高对比度 */
.rili-markdown-renderer {
    color: #EAEAEA !important;  /* 冷白，极高对比 */
    font-family: 'Inter', 'Segoe UI', 'Roboto', system-ui, -apple-system, sans-serif !important;
    font-weight: 400 !important;
    line-height: 1.7 !important;
    text-shadow: none !important; /* 确保无光晕干扰 */
    background: transparent !important;
    z-index: 1 !important;
}

/* 强调文本的颜色（如对话、重点词） */
.rili-markdown-renderer strong, .rili-markdown-renderer b {
    color: #FFD79C !important;  /* 温暖的琥珀色，象征火和回忆 */
    font-weight: 600 !important;
}

/* 6. 【强制可读性】底部附加元素 */
/* 操作按钮 */
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #B0C4DE !important; /* 浅钢蓝 */
    font-weight: 400 !important;
    transition: color 0.2s ease !important;
}
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #E0E8F0 !important;
}

/* 模型名称文本 */
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground {
    color: #A0AABF !important; /* 更柔和的灰蓝 */
}

/* Token消耗文本 */
/* [Token消耗hover逻辑转换未启用]
.text-orange-500 {
    color: #FFB347 !important; /* 柔和的橙色，保持可读 */
}
*/

/* 7. 自定义舒适字体与间距 */
/* 让代码块、列表等元素在深色背景上也清晰 */
.rili-markdown-renderer pre {
    background-color: #0f0f1a !important;
    border: 1px solid #2a2a3e !important;
    border-radius: 8px !important;
}

.rili-markdown-renderer code {
    color: #f8f8f2 !important;
    background-color: #282a36 !important;
}

.rili-markdown-renderer blockquote {
    border-left: 3px solid #5a6778 !important;
    color: #B0B8C5 !important;
}

/* 8. 鼠标悬停时的微妙“火花”效果（仅在桌面端） */
@media (hover: hover) {
    .is-user > .border.border-muted,
.is-assistant > .border.border-muted:hover {
        box-shadow: 0 8px 40px rgba(80, 100, 200, 0.15), inset 0 0 40px rgba(100, 100, 200, 0.1) !important;
        border-color: rgba(180, 200, 255, 0.3) !important;
    }
}

/* 9. 移动端适配 */
@media (max-width: 480px) {
    .is-user > .border.border-muted,
.is-assistant > .border.border-muted {
        border-radius: 12px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
    }
}

/* 10. 低动效模式处理：保留阴影，移除悬停动画 */
@media (prefers-reduced-motion: reduce) {
    .is-user > .border.border-muted,
.is-assistant > .border.border-muted,
    .is-user > .border.border-muted,
.is-assistant > .border.border-muted:hover {
        transition: none !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
    }
}

/* ========== 动画部分：自定义加载动画（用阿尔温娜的双刀概念） ========== */

/* 隐藏默认加载动画 */
.flex.items-center.justify-center.size-6 > .flex.gap-2 {
    display: none !important;
}

/* 自定义加载动画容器：两把交叉的银色匕首（SMIL动画） */
.flex.items-center.justify-center.size-6 {
    position: relative !important;
    width: 100% !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.flex.items-center.justify-center.size-6::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M25 80 L50 20 L75 80' fill='none' stroke='%23D3D9E0' stroke-width='8' stroke-linecap='round' /%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 50 50' to='360 50 50' dur='1.5s' repeatCount='indefinite' /%3E%3C/svg%3E") center / contain no-repeat;
    animation: spinBlade 1.5s linear infinite;
}

.flex.items-center.justify-center.size-6::after {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M25 20 L50 80 L75 20' fill='none' stroke='%23B0C4DE' stroke-width='8' stroke-linecap='round' /%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 50 50' to='-360 50 50' dur='1.5s' repeatCount='indefinite' /%3E%3C/svg%3E") center / contain no-repeat;
    animation: spinBladeReverse 1.5s linear infinite;
    margin-left: -10px;
}

@keyframes spinBlade {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinBladeReverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}