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

/* =============================================
   [暖奶油珊瑚] · 风月AI游戏平台美化
   base-hue: N/A  base-sat: N/A  is-dark: N/A  accent-hue: N/A  accent-sat: N/A

   bg-deep: #FFF8F0       (页面主背景)
   bg-default: #FFF8F0    (页面主背景)
   bg-paper: #FFFFFF      (卡片底色)
   bg-raised: #FFF0E6     (次级背景)
   bg-hover: #FFF5EE      (悬停底色)
   text-main: #4A3B32     (主文字 - 咖啡棕)
   text-sub: #8B7355      (次要文字 - 咖啡棕)
   text-muted: #B8A89A    (弱化文字 - 咖啡棕)
   border: rgba(232, 146, 124, 0.2)  (强调色边框)
   accent: #E8927C        (主强调色 - 珊瑚橙)
   accent-dim: rgba(232, 146, 124, 0.25) (强调色光效)
   accent-text: #FFFFFF   (强调色文字 - 假设，主强调色文字多用白色)
   inp-bg: #FFFCFA        (输入框底色)
   inp-txt: #4A3B32       (输入框文字)
   inp-car: #E8927C       (输入框光标)
   det-bg: #FFF0E6        (折叠块背景)
   det-bdr: rgba(232, 146, 124, 0.2)  (折叠块边框)
   det-sum-bg: #FFE8D6    (折叠块摘要背景)
   det-sum: #4A3B32       (折叠块摘要文字)
   det-arr: #E8927C       (折叠块箭头)
   det-div: rgba(232, 146, 124, 0.2)  (折叠块分割线)
   sb-w: 8px              (滚动条宽度)
   sb-c: rgba(232, 146, 124, 0.5)     (滚动条滑块颜色)

   glow: 0 0 14px rgba(232, 146, 124, 0.4)
   glow-soft: 0 0 6px rgba(232, 146, 124, 0.2)

   亮点① blockquote → 深珊瑚色边框，斜体italic
   亮点② 加载动画  → 暖金黄+珊瑚橙光斑流动效果 (伪元素)
   亮点③ .style_divider__mW0YX → 次强调色+柔和阴影装饰线
   ============================================= */

/* ===== 危险区域（必须最优先处理）===== */
/* 1. 隐藏装饰条 */
[class*="bg-[#F1CBCB]"], [class*="bg-[#c9e1e9]"] { display: none !important; }

/* 2. 代码块 */
.rili-markdown-renderer pre { background: #FFF0E6 !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; border-left: 3px solid #E8927C !important; border-radius: 6px; padding: 1em 1.2em; overflow-x: auto; }
.rili-markdown-renderer pre code { background: transparent !important; color: #4A3B32 !important; }
.rili-markdown-renderer :not(pre)>code { background: rgba(232, 146, 124, 0.25) !important; color: #FFF !important; padding: 0.15em 0.45em; border-radius: 4px; }

/* 3. details折叠块 —— 标题行和容器背景分开设置 */
.rili-markdown-renderer details { background: #FFF0E6 !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; border-radius: 8px !important; margin: 8px 0; overflow: hidden; transition: border-color 0.15s; }
.rili-markdown-renderer details[open] { border-color: #E8927C !important; }
.rili-markdown-renderer details summary { background: #FFE8D6 !important; color: #4A3B32 !important; padding: 8px 12px 8px 32px; display: block; position: relative; border-bottom: 1px solid rgba(232, 146, 124, 0.2) !important; cursor: pointer; font-weight: 600; list-style: none; user-select: none; }
.rili-markdown-renderer details summary::before { content: '▶'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #E8927C !important; font-size: 11px; transition: transform 0.2s ease; }
.rili-markdown-renderer details[open] summary::before { transform: translateY(-50%) rotate(90deg); }
.rili-markdown-renderer details summary::-webkit-details-marker { display: none; }

/* 4. 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #FFF8F0 !important; }
::-webkit-scrollbar-thumb { background: rgba(232, 146, 124, 0.5) !important; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #E8927C !important; }

/* 5. 选区 & 占位符 */
::placeholder { color: #B8A89A !important; opacity: 1; }
::selection { background: rgba(232, 146, 124, 0.25) !important; color: #FFF !important; }

/* 6. 页面背景（必须设置，否则深色预设页面仍是白底）*/
body, html, #root, .app-root, .h-screen { background: #FFF8F0 !important; color: #4A3B32 !important; }

/* ⚠️ 输入框强制可见（白底白字必死）*/
#ai-chat-input { background: #FFFCFA !important; color: #4A3B32 !important; caret-color: #E8927C !important; }
textarea.rc-textarea { background: #FFFCFA !important; color: #4A3B32 !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; }

/* ===== 全局 ===== */
body, #root, .h-screen { background: #FFF8F0 !important; color: #4A3B32 !important; }

/* ===== 顶部导航 ===== */
header.flex.justify-between { background: #FFF !important; border-bottom: 1px solid rgba(232, 146, 124, 0.2) !important; }
#nav-middle .group.flex.items-center { color: #4A3B32 !important; }
#nav-middle button:has(> .flex-1.truncate.text-left) .flex-1.truncate.text-left { color: #4A3B32 !important; }
#nav-middle .shrink-0.flex.items-center svg { fill: #4A3B32 !important; }
#nav-right button { background: #FFF0E6 !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; }
#nav-right button:hover { background: #FFF5EE !important; }

/* ===== 开场白区域 ===== */
div.flex.items-center.h-9.bg-white.rounded-md.cursor-pointer.group[class*="border-gray"] { background: #FFFFFF !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; }
div.flex.items-center.h-9.cursor-pointer.group svg[data-icon="SlidersH"],
div.flex.items-center.h-9.cursor-pointer.group svgbutton:has(> .flex-1.truncate.text-left) svg { fill: #4A3B32 !important; }

/* ===== 侧边栏 ===== */
.shadow-lg.border-r.border-gray-200 { border-right: 1px solid rgba(232, 146, 124, 0.2) !important; background: #FFF0E6 !important; }
.MuiList-root { background: transparent !important; }
.conversation-text { color: #4A3B32 !important; }

/* ===== 功能按钮 ===== */
#ai-mod-button2 button.MuiButton-root { background: #FFF0E6 !important; color: #4A3B32 !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; }
#ai-mod-button2 button.MuiButton-root:hover { background: #FFF5EE !important; }
#ai-mod-button2 button.MuiButton-root svg { fill: #4A3B32 !important; }

/* ===== 聊天气泡 ===== */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted { background: #FFFFFF !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; border-radius: 8px !important; color: #4A3B32 !important; box-shadow: rgba(139, 90, 70, 0.1) 0px 4px 8px 0px !important; }
.is-user > .border.border-muted { /* Assume this is user bubble, keep default or adjust */ }
.rili-markdown-renderer { color: #4A3B32 !important; }
.rili-markdown-renderer h1, h2, h3 { color: #D4847C !important; } /* Deep coral for titles */
.rili-markdown-renderer ul, ol, li { color: #4A3B32 !important; }
.rili-markdown-renderer blockquote { background: #FFF0E6 !important; border-left: 4px solid #D4847C !important; color: #4A3B32 !important; padding-left: 16px; margin-left: 0; font-style: italic; } /* 亮点① */
.rili-markdown-renderer table, th, td { border: 1px solid rgba(232, 146, 124, 0.2) !important; color: #4A3B32 !important; }
.rili-markdown-renderer strong, em, a { color: #E8927C !important; } /* Accent for links/emphasis */
.rili-markdown-renderer a:hover { color: #F4A261 !important; text-decoration: underline; }

/* ===== 加载动画 ===== */
/* 隐藏默认加载动画 */
.flex.items-center.justify-center.size-6 > .flex.gap-2 { display: none !important; }
/* 自定义加载动画 */
.flex.items-center.justify-center.size-6 { position: relative; }
.flex.items-center.justify-center.size-6::before,
.flex.items-center.justify-center.size-6::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #F4C563; /* Warm golden yellow */
  animation: glowing 1.4s infinite ease-in-out;
  transform-origin: 50% 50%;
  opacity: 0.7;
}
.flex.items-center.justify-center.size-6::after {
  background: #E8927C; /* Coral orange */
  animation-delay: -0.7s;
}
@keyframes glowing {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.7;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.7;
  }
} /* 亮点② */

/* ===== 底部输入区 ===== */
.bg-gradient-to-t { /* Likely a background element, adjust if needed or let it be */ }
#ai-chat-bottom-input { background: #FFF0E6 !important; }
#ai-chat-input { background: #FFFCFA !important; color: #4A3B32 !important; caret-color: #E8927C !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; border-radius: 8px !important; padding: 10px 15px !important; }
#ai-send-button { background: linear-gradient(to right, #E8927C, #F4A261) !important; color: #FFFFFF !important; border-radius: 8px !important; }

/* ===== 评论区 ===== */
div[class*="w-full"][class*="bg-white"][class*="bottom-0"] { background: #FFF0E6 !important; }
div.text-lg.font-bold { color: #4A3B32 !important; }
p.MuiTypography-body1.text-grey-600 { color: #8B7355 !important; }
span.MuiRating-root .MuiRating-iconFilled svg { color: #F4C563 !important; } /* Warm golden yellow for filled stars */
span.MuiRating-root .MuiRating-iconEmpty svg { color: #B8A89A !important; } /* Muted for empty stars */
/* [Token消耗hover逻辑转换未启用]
.text-orange-500 { color: #E8927C !important; } /* Mapping to primary accent */
*/
div.flex.flex-col.border-gray-200 { border-color: rgba(232, 146, 124, 0.2) !important; }
textarea.rc-textarea { background: #FFFCFA !important; color: #4A3B32 !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; border-radius: 8px !important; padding: 10px 15px !important; }
div.bg-gray-100.text-gray-500 { background: #FFF0E6 !important; color: #8B7355 !important; }
div.cursor-pointer.group.flex.items-center.justify-center { }
div[data-state="closed"] svg[data-icon="Send03"] { fill: #E8927C !important; }
div.style_divider__mW0YX {
  height: 2px !important;
  background: linear-gradient(to right, #F4A261, rgba(244, 162, 97, 0.5)) !important;
  box-shadow: 0 1px 4px rgba(139, 90, 70, 0.08) !important; /* 亮点③ */
  margin: 16px 0 !important;
}
.flex.w-full.items-center.justify-between.gap-2.px-2.css-1dmzxoz { color: #4A3B32 !important; }
button.MuiButton-containedPrimary { background: linear-gradient(to right, #E8927C, #F4A261) !important; color: #FFFFFF !important; }
button.MuiButton-outlinedPrimary { border: 1px solid #E8927C !important; color: #E8927C !important; }
button.MuiButton-outlinedPrimary:hover { background: rgba(232, 146, 124, 0.1) !important; }
div.p-3.overflow-y-auto { background: #FFFFFF !important; }
div.group.ml-0 { }
div.group img.rounded-full { border: 2px solid #E8927C !important; }
div.text-sm.text-grey-600 span.font-bold { color: #4A3B32 !important; }
span.text-[10px] { color: #8B7355 !important; }
div.break-all { color: #4A3B32 !important; }
div.text-xs.text-grey-600 { color: #B8A89A !important; }
button.text-gray-400 { color: #B8A89A !important; }
button.text-gray-400 svg { fill: #B8A89A !important; }
span.cursor-pointer { color: #E8927C !important; }
div.ml-8.border-l { border-left: 1px solid rgba(232, 146, 124, 0.2) !important; }


/* ===== 分页 ===== */
.MuiPaginationItem-root { background: #FFF0E6 !important; color: #4A3B32 !important; border: 1px solid rgba(232, 146, 124, 0.2) !important; margin: 0 4px; }
.MuiPaginationItem-root.Mui-selected { background: #E8927C !important; color: #FFFFFF !important; border-color: #E8927C !important; }
.MuiPaginationItem-root.Mui-disabled { color: #B8A89A !important; border-color: rgba(184, 168, 154, 0.3) !important; }
.MuiPaginationItem-icon { fill: #4A3B32 !important; }
.MuiPaginationItem-root.Mui-selected .MuiPaginationItem-icon { fill: #FFFFFF !important; }
.flex.w-full.items-center.justify-between.gap-2.px-2.css-1uwir8f { } /* Container for pagination */
.MuiInputBase-input { color: #4A3B32 !important; }

/* ===== MUI 全局 ===== */
.MuiButton-root, .MuiButton-contained, .MuiButton-outlined { border-radius: 8px !important; }
.MuiButton-containedPrimary { background: linear-gradient(to right, #E8927C, #F4A261) !important; color: #FFFFFF !important; }
.MuiButton-outlinedPrimary { border: 1px solid #E8927C !important; color: #E8927C !important; }
.MuiIconButton-root { color: #4A3B32 !important; }
.MuiDialog-paper, .MuiDrawer-paper { background: #FFF0E6 !important; color: #4A3B32 !important; border-radius: 12px !important; }
.MuiBackdrop-root { background: rgba(0,0,0,0.3) !important; } /* Dimming backdrop */
.MuiDivider-root { background: rgba(232, 146, 124, 0.2) !important; }
.MuiTypography-root { color: #4A3B32 !important; }
.MuiRating-icon { color: #F4C563 !important; } /* Default for rating icons if not specified */
.MuiOutlinedInput-root { border-radius: 8px !important; }
.MuiOutlinedInput-notchedOutline { border-color: rgba(232, 146, 124, 0.2) !important; }
/* .MuiTouchRipple-root  [removed: MUI ripple] */{ /* Ripple effect, usually keep default or fine-tune if needed */ }
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground { color: #4A3B32 !important; }
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{ color: #E8927C !important; }
/* [Token消耗hover逻辑转换未启用]
.text-orange-500 { color: #E8927C !important; }
*/

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  /* 移动端适配，可根据需要添加具体样式 */
  body { font-size: 14px !important; }
  .rili-markdown-renderer { padding: 10px !important; }
  .rili-markdown-renderer details summary { padding: 6px 10px 6px 28px !important; }
  .rili-markdown-renderer details summary::before { left: 10px !important; font-size: 10px !important; }
  #ai-chat-input { padding: 8px 12px !important; }
}

/* ===== 降速兜底 ===== */
@media (prefers-reduced-motion: reduce) {
  .flex.items-center.justify-center.size-6::before,
  .flex.items-center.justify-center.size-6::after { animation-duration: 4s; }
  /* Add other animations to slow down if necessary */
}