/* ═══ 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-color: #FFF8E7 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(121, 85, 72, 0.15) !important;
    border: 1px solid #EEDCBA !important;
    padding: 18px !important;
    isolation: isolate !important;
}

/* 3. 正文：衬线深褐，舒适阅读，增强加粗对比 */
.rili-markdown-renderer {
    color: #3E3529 !important;
    font-family: "Georgia", "Sitka", serif !important;
    line-height: 1.7 !important;
    font-size: 16px !important;
    font-weight: 400 !important;           /* 基础字重降低，让加粗更明显 */
    background: transparent !important;
    z-index: 1 !important;
}

/* 加粗文本强化：更重字重、更深颜色、微增字间距 */
.rili-markdown-renderer strong,
.rili-markdown-renderer b {
    font-weight: 800 !important;
    color: #1F1A11 !important;
    letter-spacing: 0.02em !important;
}

/* 4. 按钮 & 辅助文字 */
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7,
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground {
    color: #8D6E63 !important;
    font-weight: bold !important;
}

/* [Token消耗hover逻辑转换未启用]
.text-orange-500 {
    color: #BF360C !important;
}
*/

/* 5. 加载动画 */
.style-module__AtdJSq__dot-flashing.style-module__AtdJSq__text {
    display: none !important;
}

.flex.items-center.justify-center.size-6 {
    position: relative;
    width: 50px;
    height: 20px;
}

.flex.items-center.justify-center.size-6::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 45 15'%3E%3Cstyle%3E .dot%7Bfill:%238D6E63%7D%3C/style%3E%3Ccircle class='dot' cx='7.5' cy='7.5' r='3.5'%3E%3Canimate attributeName='cy' values='7.5;2.5;7.5;12.5;7.5' dur='1.2s' repeatCount='indefinite'%3E%3C/animate%3E%3C/circle%3E%3Ccircle class='dot' cx='22.5' cy='7.5' r='3.5'%3E%3Canimate attributeName='cy' values='7.5;12.5;7.5;2.5;7.5' dur='1.2s' begin='0.4s' repeatCount='indefinite'%3E%3C/animate%3E%3C/circle%3E%3Ccircle class='dot' cx='37.5' cy='7.5' r='3.5'%3E%3Canimate attributeName='cy' values='7.5;2.5;7.5;12.5;7.5' dur='1.2s' begin='0.8s' repeatCount='indefinite'%3E%3C/animate%3E%3C/circle%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* 6. <details>/<summary> 折叠面板适配 */
details {
    background: #FFF8E7 !important;
    border: 1px solid #EEDCBA !important;
    border-radius: 8px !important;
    margin: 12px 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

summary {
    padding: 14px 18px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #8D6E63 !important;
    background: linear-gradient(180deg, #FDF2DC, #FFF8E7) !important;
    transition: background 0.25s ease, color 0.25s ease !important;
    list-style: none !important;
}

/* summary 内部的加粗也强化 */
summary strong,
summary b {
    font-weight: 800 !important;
    color: #1F1A11 !important;
}

summary::-webkit-details-marker {
    display: none !important;
}

summary:hover {
    background: linear-gradient(180deg, #FAEAD0, #FFF3DF) !important;
    color: #3E3529 !important;
}

summary::before {
    content: "▸" !important;
    display: inline-block !important;
    margin-right: 8px !important;
    font-size: 14px !important;
    color: #8D6E63 !important;
}

details[open] > summary::before {
    content: "▾" !important;
}

details[open] > summary {
    border-bottom: 1px solid #EEDCBA !important;
}

details .rili-markdown-renderer {
    padding: 16px 18px !important;
    font-size: 15px !important;
}