/* ═══ 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(160deg, #fcf5ee, #faf0ea, #f5e3d4) !important;
    border: 1px solid rgba(201,169,110,0.4) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(106,27,42,0.12) !important;
    padding: 16px !important;
    transition: all 0.3s ease !important;
    isolation: isolate !important;
}
/* 3. 聊天框内容文本可读性优化 */
.rili-markdown-renderer {
    color: #2c1a1a !important;
    font-weight: 500 !important;
    line-height: 1.6 !important;
    background: transparent !important;
    z-index: 1 !important;
}
/* 4. 底部附加元素（按钮/模型名/Token）配色 */
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7,
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground,
/* [Token消耗hover逻辑转换未启用]
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7,
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground,
.text-orange-500 {
    color: #6a1b2a !important;
    opacity: 0.8 !important;
}
*/
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #c9a96e !important;
    opacity: 1 !important;
}
/* 5. 加载动画实现 (SMIL + CSS 增强) */
.style-module__AtdJSq__dot-flashing.style-module__AtdJSq__text {
    display: none !important;
}
.flex.items-center.justify-center.size-6 {
    position: relative !important;
    min-height: 24px !important;
}
.flex.items-center.justify-center.size-6::before {
    content: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="6" fill="%23c9a96e"><animate attributeName="opacity" values="1;0.3;1" dur="1s" repeatCount="indefinite"/></circle></svg>') !important;
    display: block !important;
    margin: 0 auto !important;
}
/* 6. details / summary 折叠块 */
.rili-markdown-renderer details {
    background: rgba(106,27,42,0.04) !important;
    border: 1px solid rgba(201,169,110,0.4) !important;
    border-radius: 12px !important;
    margin: 0.8em 0 !important;
    overflow: hidden !important;
}
.rili-markdown-renderer details:hover {
    box-shadow: 0 2px 16px rgba(106,27,42,0.08) !important;
}
.rili-markdown-renderer summary {
    color: #6a1b2a !important;
    font-weight: 600 !important;
    font-size: 0.95em !important;
    padding: 12px 16px !important;
    cursor: pointer !important;
    user-select: none !important;
    border-radius: 12px !important;
    transition: background 0.2s !important;
    list-style: none !important;
}
.rili-markdown-renderer summary::-webkit-details-marker {
    display: none !important;
}
.rili-markdown-renderer summary::before {
    content: '▸ ' !important;
    display: inline-block !important;
    transition: transform 0.2s !important;
    margin-right: 6px !important;
    color: #c9a96e !important;
    font-size: 0.85em !important;
}
.rili-markdown-renderer summary:hover {
    background: rgba(184,76,92,0.06) !important;
}
.rili-markdown-renderer details[open] > summary::before {
    transform: rotate(90deg) !important;
}
.rili-markdown-renderer details[open] > summary {
    border-radius: 12px 12px 0 0 !important;
    border-bottom: 1px solid rgba(201,169,110,0.2) !important;
    background: rgba(184,76,92,0.04) !important;
}
.rili-markdown-renderer details > *:not(summary) {
    padding: 10px 16px !important;
}
/* 响应式调整 */
@media(max-width:480px) {
    .is-user > .border.border-muted,
.is-assistant > .border.border-muted {
        padding: 12px !important;
        border-radius: 8px !important;
    }
    .rili-markdown-renderer summary {
        padding: 8px 12px !important;
    }
    .rili-markdown-renderer details > *:not(summary) {
        padding: 8px 12px !important;
    }
}
@media(prefers-reduced-motion:reduce) {
    .flex.items-center.justify-center.size-6::before {
        animation: none !important;
        opacity: 1 !important;
    }
}