/* ═══ 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;
}

/* ═══ B平台顶部栏适配说明（自动注入）═══
   A: div.sticky > div.flex.justify-between
      ├── 左侧空区
      ├── #ai-model-selector (居中)
      └── 右侧工具(设置按钮等)
   B: <header.flex.justify-between>
      ├── #nav-left (侧边栏开关)
      ├── #nav-middle (可能为空)
      └── #nav-right (通知/主题/语言)
   B平台模型按钮不在header内，选择器:
   button:has(> .flex-1.truncate.text-left)
   ═══════════════════════════════════════ */
header.flex.justify-between { position: relative; overflow: visible; }

/* =============================================
   雪宣 · 清韵修仙 — 优化版
   主色：宣纸白、松烟墨、茶染金、淡青玉
   ============================================= */

/* ===== 危险区域 ===== */
[class*="bg-[#F1CBCB]"], [class*="bg-[#c9e1e9]"] { display: none !important; }

/* ===== 全局 ===== */
body, #root, .h-screen, .rili-markdown-renderer {
    background: #fefefe !important;
    color: #2c2b28 !important;
}
.rili-markdown-renderer p, .rili-markdown-renderer li, .rili-markdown-renderer div {
    color: #3e3a35 !important;
    font-size: 16px !important;
    line-height: 1.9 !important;
}

/* ===== 代码块 ===== */
.rili-markdown-renderer pre {
    background: #fafaf8 !important;
    border: 1px solid #e8e6e0 !important;
    border-left: 3px solid #b3d4d0 !important;
    border-radius: 12px;
    padding: 1em 1.2em;
}
.rili-markdown-renderer pre code {
    background: transparent !important;
    color: #5a564c !important;
    font-size: 14px;
}
.rili-markdown-renderer :not(pre) > code {
    background: #f3f2ee !important;
    color: #8f8b80 !important;
    padding: 0.15em 0.5em;
    border-radius: 6px;
}

/* ===== details / summary 折叠面板 ===== */
details {
    background: #ffffff !important;
    border: 1px solid #e8e4da !important;
    border-radius: 14px;
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.025);
    transition: all 0.25s ease;
    position: relative;
}
details[open] {
    border-color: #c8b388 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

details summary {
    background: #fcfbf8 !important;
    color: #5a5548 !important;
    padding: 15px 22px 15px 48px;
    display: block;
    position: relative;
    border-bottom: 1px solid #f0ede4 !important;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.08em;
    letter-spacing: 0.04em;
    list-style: none;
    transition: all 0.2s ease;
}
details summary::-webkit-details-marker { display: none; }

/* 菱形标记 ◆ */
details summary::before {
    content: '◆';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #c8b388;
    font-size: 10px;
    transition: all 0.25s ease;
}
details[open] summary::before {
    color: #a08850;
    text-shadow: 0 0 6px rgba(160,136,80,0.25);
}

/* 标题后缀 ✦ */
details summary::after {
    content: ' ✦';
    color: #d4c5a3;
    font-size: 0.8em;
    margin-left: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
details:hover summary::after { opacity: 0.6; }
details[open] summary::after { opacity: 0.8; color: #b8a070; }

details:hover summary {
    background: #faf8f2 !important;
    color: #4a4538 !important;
}
details:hover {
    border-color: #d4c5a3 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

/* 内容区 */
details > pre, details > table {
    margin: 0;
    border-top: 1px solid #f0ede4;
    background: #ffffff;
    border-radius: 0;
}
details pre {
    padding: 18px 24px;
    background: #fefefe !important;
}
details pre code {
    font-size: 15px;
    line-height: 1.85;
    color: #4a4840;
    background: transparent !important;
}

/* ===== 标题 ===== */
.rili-markdown-renderer h1, .rili-markdown-renderer h2, .rili-markdown-renderer h3, .rili-markdown-renderer h4 {
    color: #5a5548 !important;
    border-bottom: 1px solid #ece8dc !important;
    letter-spacing: 0.04em;
    padding-bottom: 6px;
}
.rili-markdown-renderer h1 { font-size: 1.6em !important; }
.rili-markdown-renderer h2 { font-size: 1.3em !important; }
.rili-markdown-renderer h3 { font-size: 1.15em !important; }

/* ===== 引用 ===== */
.rili-markdown-renderer blockquote {
    border-left: 3px solid #c8b388 !important;
    background: #fcfbf8 !important;
    color: #6b6658 !important;
    padding: 10px 18px;
    border-radius: 0 10px 10px 0;
    margin: 14px 0;
    font-style: normal;
}

/* ===== 表格 ===== */
.rili-markdown-renderer table {
    border: 1px solid #e8e4da;
    border-collapse: collapse;
    width: 100%;
}
.rili-markdown-renderer th {
    background: #faf8f2 !important;
    color: #5a5548 !important;
    border: 1px solid #e8e4da;
    padding: 10px 16px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.rili-markdown-renderer td {
    background: #ffffff !important;
    color: #4a4840;
    border: 1px solid #e8e4da;
    padding: 9px 16px;
}
.rili-markdown-renderer tr:hover td { background: #fdfcfa !important; }

/* ===== 强调 ===== */
.rili-markdown-renderer strong { color: #9b8e70 !important; font-weight: 700 !important; }
.rili-markdown-renderer em { color: #b0a890 !important; font-style: normal !important; }
.rili-markdown-renderer ul li::marker, .rili-markdown-renderer ol li::marker { color: #c8b388 !important; }

/* ===== 链接 ===== */
.rili-markdown-renderer a { color: #8fb5b0 !important; text-decoration: none; }
.rili-markdown-renderer a:hover { text-decoration: underline; color: #6ea09a !important; }

/* ===== 分隔线 ===== */
.rili-markdown-renderer hr {
    border: none !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent, #e8e4da, #d4c5a3, #e8e4da, transparent) !important;
    margin: 22px 0;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f8f8f8; }
::-webkit-scrollbar-thumb { background: #ddd8cc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #c2bba8; }

/* ===== 聊天气泡 ===== */
.chat-container .group .relative.inline-block,
.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
    background: #ffffff !important;
    border: 1px solid #e8e4da !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
    border-radius: 16px !important;
}

/* ===== 输入框 ===== */
#ai-chat-input, textarea.rc-textarea {
    background: #ffffff !important;
    color: #3e3a35 !important;
    border: 1px solid #e0dcd0 !important;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 16px;
    caret-color: #c8b388;
    transition: all 0.2s;
}
#ai-chat-input:focus {
    border-color: #c8b388;
    box-shadow: 0 0 0 2px rgba(200,179,136,0.12);
}
#ai-chat-bottom-input {
    background: #fefefe !important;
    border-top: 1px solid #ece8dc !important;
}
#ai-send-button {
    background: #c8b388 !important;
    color: white !important;
    border-radius: 50%;
}
#ai-send-button:hover { background: #b09860 !important; }

/* ===== 加载动画 ===== */
.flex.items-center.justify-center.size-6 > .flex.gap-2 { display: none !important; }
.flex.items-center.justify-center.size-6 {
    position: relative;
    width: 24px;
    height: 20px;
}
.flex.items-center.justify-center.size-6::before,
.flex.items-center.justify-center.size-6::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #c8b388;
    border-radius: 50%;
    animation: lingqi-pulse 1.5s ease-in-out infinite;
}
.flex.items-center.justify-center.size-6::before { left: 0; }
.flex.items-center.justify-center.size-6::after { right: 0; animation-delay: 0.75s; }

@keyframes lingqi-pulse {
    0%, 100% { opacity: 0.3; transform: translateY(-50%) scale(0.6); }
    50% { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* ===== 导航 / 侧边栏 ===== */
header.flex.justify-between {
    background: #ffffff !important;
    border-bottom: 1px solid #ece8dc !important;
    box-shadow: none;
}
.shadow-lg.border-r.border-gray-200 {
    background: #ffffff !important;
    border-right: 1px solid #ece8dc !important;
}
.MuiList-root { background: #ffffff !important; }
.conversation-text { color: #5a5548 !important; }

/* ===== 按钮 ===== */
button.MuiButton-root { color: #5a5548 !important; }
#ai-mod-button2 button.MuiButton-root,
#ai-mod-button2 button.MuiButton-root svg {
    background: #c8b388 !important;
    color: white !important;
}
.MuiButton-containedPrimary {
    background: #c8b388 !important;
    color: white !important;
}
.MuiButton-outlinedPrimary {
    border-color: #c8b388 !important;
    color: #c8b388 !important;
}

/* 面板功能按钮 */
.flex.items-center.gap-2.pb-2 > button:not(.rounded-full):not(.size-7),
.chat-container .group .MuiButtonBase-root {
    background: #faf8f2 !important;
    color: #6b6658 !important;
    border: 1px solid #e8e4da !important;
    border-radius: 8px;
    padding: 6px 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.flex.items-center.gap-2.pb-2 > button:not(.rounded-full):not(.size-7):hover,
.chat-container .group .MuiButtonBase-root:hover {
    background: #f0ede4 !important;
    color: #4a4538 !important;
    border-color: #c8b388 !important;
}

/* ===== 分隔线 ===== */
div.style_divider__mW0YX {
    border-bottom: none;
    background: linear-gradient(90deg, transparent, #e8e4da, #d4c5a3, #e8e4da, transparent);
    height: 1px;
    margin: 18px 0;
}

/* ===== 选中 ===== */
::selection {
    background: #e8e0d0 !important;
    color: #3e3a35 !important;
}
.MuiPaginationItem-root.Mui-selected {
    background: #c8b388 !important;
    color: white !important;
}