/* ═══ B平台加载动画适配（自动注入）═══ */
/* 仅作用于消息内的加载容器，防止误杀其他UI */
.is-assistant .flex.items-center.justify-center.size-6,
.is-user .flex.items-center.justify-center.size-6 {
  opacity: 1 !important;
  position: relative;
  overflow: visible !important;
}
/* 隐藏默认的点点动画（如果你不想保留可保留这行，否则删掉即可） */
.is-assistant .flex.items-center.justify-center.size-6 > .flex.gap-2,
.is-user .flex.items-center.justify-center.size-6 > .flex.gap-2 {
  display: none !important;
}
/* 自定义加载动画：双环旋转，符合风月主题 */
.is-assistant .flex.items-center.justify-center.size-6::before,
.is-user .flex.items-center.justify-center.size-6::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid hsla(10, 60%, 40%, 0.2);
  border-top-color: #a03028;
  border-radius: 50%;
  animation: fengyue-spin 1s linear infinite;
  box-sizing: border-box;
}
.is-assistant .flex.items-center.justify-center.size-6::after,
.is-user .flex.items-center.justify-center.size-6::after {
  content: '';
  position: absolute;
  width: 60%;
  height: 60%;
  border: 2px solid hsla(10, 60%, 40%, 0.2);
  border-bottom-color: #c04038;
  border-radius: 50%;
  animation: fengyue-spin 0.8s linear infinite reverse;
  box-sizing: border-box;
}
@keyframes fengyue-spin {
  to { transform: rotate(360deg); }
}

/* 加载时assistant消息容器样式 */
.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平台按钮组保护（自动注入）═══ */
.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;
}
.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平台顶部栏适配说明（仅注释，无隐藏规则）═══ */
header.flex.justify-between { position: relative; overflow: visible; }

/* =============================================
   [风月 · 沉沦低语]
   base-hue: 0     base-sat: 0%    is-dark: 1
   accent-hue: 190  accent-sat: 70%

   bg-deep: hsl(0, 0%, 7%)
   bg-default: hsl(0, 0%, 11%)
   bg-paper: hsl(0, 0%, 10%)
   bg-raised: hsl(0, 0%, 15%)
   bg-hover: hsl(0, 0%, 13%)
   text-main: hsl(35, 22%, 91%)
   text-sub: hsl(35, 15%, 66%)
   text-muted: hsl(30, 13%, 42%)
   border: hsl(0, 0%, 20%)
   accent: hsl(10, 60%, 40%)
   accent-dim: hsl(10, 60%, 18%)
   accent-text: hsl(10, 60%, 80%)

   mother-accent: hsl(345, 50%, 45%)
   mother-accent-glow: hsla(345, 50%, 45%, 0.25)
   main-accent-glow: hsla(10, 60%, 40%, 0.25)

   glow: 0 0 14px hsla(10, 60%, 40%, 0.4)
   glow-soft: 0 0 6px hsla(10, 60%, 40%, 0.2)
   ============================================= */

/* ===== 装饰条隐藏 ===== */
[class*="bg-[#F1CBCB]"], [class*="bg-[#c9e1e9]"] { display: none !important; }

/* ===== 代码块 ===== */
.rili-markdown-renderer pre {
  background: #1c1816 !important;
  border: 1px solid #25201d !important;
  border-left: 3px solid #a03028 !important;
  border-radius: 6px;
  padding: 1em 1.2em;
  overflow-x: auto;
}
.rili-markdown-renderer pre code {
  background: transparent !important;
  color: #e8dcc8 !important;
}
.rili-markdown-renderer :not(pre) > code {
  background: hsla(10, 60%, 40%, 0.25) !important;
  color: #e8dcc8 !important;
  padding: 0.15em 0.45em;
  border-radius: 4px;
}

/* ===== details折叠块 ===== */
.rili-markdown-renderer details {
  background: #1c1816 !important;
  border: 1px solid #25201d !important;
  border-radius: 6px;
  margin: 8px 0;
  overflow: hidden;
  transition: border-color 0.15s;
}
.rili-markdown-renderer details[open] {
  border-color: #a03028 !important;
}
.rili-markdown-renderer details summary {
  background: #a03028 !important;
  color: #e8dcc8 !important;
  padding: 8px 12px 8px 32px;
  display: block;
  position: relative;
  border-bottom: 1px solid #25201d !important;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  user-select: none;
  font-family: 'Bebas Neue', sans-serif;
}
.rili-markdown-renderer details summary::before {
  content: '▶';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #e8dcc8 !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;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #151210 !important; }
::-webkit-scrollbar-thumb { background: #a89980 !important; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a03028 !important; }

/* ===== 选区 & 占位符 ===== */
::placeholder { color: #6b5e52 !important; opacity: 1; }
::selection { background: hsla(10, 60%, 40%, 0.25) !important; color: #e8dcc8 !important; }

/* ===== 页面背景（合并去重）===== */
body, html, #root, .app-root, .h-screen {
  background: #151210 !important;
  color: #e8dcc8 !important;
  font-family: 'Roboto', sans-serif;
}

/* ===== 输入框强制可见 ===== */
#ai-chat-input {
  background: #1a1715 !important;
  color: #e8dcc8 !important;
  caret-color: #a03028 !important;
}
textarea.rc-textarea {
  background: #1a1715 !important;
  color: #e8dcc8 !important;
  border: 1px solid #25201d !important;
}

/* ===== 顶部导航 ===== */
header.flex.justify-between {
  background: #1c1816 !important;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #25201d !important;
}
#nav-middle .group.flex.items-center { color: #a89980 !important; }
#nav-middle .group.flex.items-center:hover { color: #a03028 !important; }
#nav-middle button:has(> .flex-1.truncate.text-left) .flex-1.truncate.text-left {
  color: #e8dcc8 !important;
}
#nav-middle .shrink-0.flex.items-center svg { color: #a89980 !important; }
#nav-right button { color: #a89980 !important; }
#nav-right button:hover { color: #a03028 !important; }

/* ===== 开场白区域 ===== */
div.flex.items-center.h-9.bg-white.rounded-md.cursor-pointer.group[class*="border-gray"] {
  background: #1c1816 !important;
  border: 1px solid #25201d !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 {
  color: #a89980 !important;
}
div.flex.items-center.h-9.cursor-pointer.group:hover svg[data-icon="SlidersH"],
div.flex.items-center.h-9.cursor-pointer.group:hover svgbutton:has(> .flex-1.truncate.text-left) svg {
  color: #a03028 !important;
}

/* ===== 侧边栏 ===== */
.shadow-lg.border-r.border-gray-200 {
  border-right: 1px solid #25201d !important;
  background: #1c1816 !important;
}
.MuiList-root { background: transparent !important; color: #a89980 !important; }
.conversation-text { color: #e8dcc8 !important; }

/* ===== 功能按钮 ===== */
#ai-mod-button2 button.MuiButton-root {
  background: #a03028 !important;
  color: #e8dcc8 !important;
  font-family: 'Bebas Neue', sans-serif;
}
#ai-mod-button2 button.MuiButton-root:hover { background: #c04038 !important; }
#ai-mod-button2 button.MuiButton-root svg { color: #e8dcc8 !important; }

/* ===== 聊天气泡 ===== */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
  background: #1c1816 !important;
  border: 1px solid #25201d !important;
  border-radius: 6px;
}
.is-user > .border.border-muted,
.is-assistant > .border.border-muted:hover {
  box-shadow: 0 0 14px hsla(345, 50%, 45%, 0.4) !important;
}
.rili-markdown-renderer { color: #e8dcc8 !important; }
.rili-markdown-renderer h1, .rili-markdown-renderer h2, .rili-markdown-renderer h3 {
  color: #a03028 !important;
  font-family: 'Bebas Neue', sans-serif;
  margin-top: 1em !important;
  margin-bottom: 0.5em !important;
}
.rili-markdown-renderer ul, .rili-markdown-renderer ol, .rili-markdown-renderer li {
  color: #e8dcc8 !important;
}
.rili-markdown-renderer blockquote {
  background: #1c1816 !important;
  border-left: 4px solid #a03028 !important;
  color: #a89980 !important;
  font-style: italic;
  font-family: 'Lora', serif;
  padding: 10px 15px;
  margin: 10px 0;
}
.rili-markdown-renderer table, .rili-markdown-renderer th, .rili-markdown-renderer td {
  border: 1px solid #25201d !important;
  color: #e8dcc8 !important;
}
.rili-markdown-renderer strong { color: #c04038 !important; }
.rili-markdown-renderer em { font-style: italic; color: #a89980 !important; font-family: 'Lora', serif; }
.rili-markdown-renderer a { color: #a03028 !important; text-decoration: none; }
.rili-markdown-renderer a:hover { color: #c04038 !important; text-decoration: underline; }

/* ===== 底部输入区 ===== */
.bg-gradient-to-t {
  background: linear-gradient(to top, rgba(24, 19, 22, 0.4) 0%, rgba(24, 19, 22, 0) 100%) !important;
}
#ai-chat-bottom-input { background: #1c1816 !important; }
#ai-chat-input {
  background: #1a1715 !important;
  color: #e8dcc8 !important;
  caret-color: #a03028 !important;
  font-family: 'Roboto', sans-serif;
}
#ai-chat-input::placeholder { color: #6b5e52 !important; opacity: 1; }
#ai-chat-input::selection { background: hsla(10, 60%, 40%, 0.25) !important; color: #e8dcc8 !important; }
#ai-send-button { background: #a03028 !important; color: #e8dcc8 !important; }
#ai-send-button:hover { background: #c04038 !important; }

/* ===== 评论区 ===== */
div[class*="w-full"][class*="bg-white"][class*="bottom-0"] { background: #1c1816 !important; }
div.text-lg.font-bold { color: #e8dcc8 !important; font-family: 'Bebas Neue', sans-serif; }
p.MuiTypography-body1.text-grey-600 { color: #a89980 !important; }
span.MuiRating-root .MuiRating-iconEmpty svg { color: #6b5e52 !important; }
span.MuiRating-root .MuiRating-iconFilled svg { color: #a03028 !important; }
div.flex.flex-col.border-gray-200 { border-color: #25201d !important; }
textarea.rc-textarea {
  background: #1a1715 !important;
  color: #e8dcc8 !important;
  border: 1px solid #25201d !important;
  font-family: 'Roboto', sans-serif;
}
div.bg-gray-100.text-gray-500 { background: #1c1816 !important; color: #a89980 !important; }
div[data-state="closed"] svg[data-icon="Send03"] { color: #a89980 !important; }
div[data-state="closed"] svg[data-icon="Send03"]:hover { color: #a03028 !important; }
div.style_divider__mW0YX { background: #7a4a5a !important; height: 2px !important; }
button.MuiButton-containedPrimary {
  background: #a03028 !important;
  color: #e8dcc8 !important;
  font-family: 'Bebas Neue', sans-serif;
}
button.MuiButton-containedPrimary:hover { background: #c04038 !important; }
button.MuiButton-outlinedPrimary { border-color: #a03028 !important; color: #a03028 !important; }
button.MuiButton-outlinedPrimary:hover { background: hsla(10, 60%, 40%, 0.1) !important; }
div.p-3.overflow-y-auto { background: #1c1816 !important; }
div.text-sm.text-grey-600 span.font-bold { color: #e8dcc8 !important; }
span.text-[10px] { color: #a89980 !important; }
div.break-all { color: #e8dcc8 !important; }
div.text-xs.text-grey-600 { color: #a89980 !important; }
button.text-gray-400 { color: #a89980 !important; }
button.text-gray-400 svg { color: #a89980 !important; }
button.text-gray-400:hover { color: #a03028 !important; }
span.cursor-pointer { color: #a89980 !important; }
div.ml-8.border-l { border-left: 1px solid #7a4a5a !important; }

/* ===== 分页 ===== */
.MuiPaginationItem-root {
  background: #1c1816 !important;
  color: #a89980 !important;
  border: 1px solid #25201d !important;
}
.MuiPaginationItem-root.Mui-selected {
  background: #a03028 !important;
  color: #e8dcc8 !important;
  border-color: #a03028 !important;
}
.MuiPaginationItem-root.Mui-disabled { color: #6b5e52 !important; border-color: #25201d !important; }
.MuiPaginationItem-icon { color: #a89980 !important; }
.MuiPaginationItem-icon:hover { color: #a03028 !important; }
.MuiInputBase-input {
  background: #1a1715 !important;
  color: #e8dcc8 !important;
  border: 1px solid #25201d !important;
  font-family: 'Roboto', sans-serif;
}

/* ===== MUI 全局 ===== */
.MuiButton-root, .MuiButton-contained, .MuiButton-outlined {
  font-family: 'Bebas Neue', sans-serif;
}
.MuiButton-root.MuiButton-containedPrimary, .MuiButton-root.MuiButton-containedSecondary {
  color: #e8dcc8 !important;
}
.MuiButton-root.MuiButton-outlinedPrimary, .MuiButton-root.MuiButton-outlinedSecondary {
  color: #a03028 !important;
}
.MuiButton-root.MuiButton-outlinedPrimary:hover, .MuiButton-root.MuiButton-outlinedSecondary:hover {
  background-color: hsla(10, 60%, 40%, 0.1) !important;
}
.MuiIconButton-root { color: #a89980 !important; }
.MuiIconButton-root:hover { color: #a03028 !important; }
.MuiDialog-paper, .MuiDrawer-paper, .MuiBackdrop-root {
  background-color: #1c1816 !important;
  color: #e8dcc8 !important;
}
.MuiDivider-root { border-color: #25201d !important; }
.MuiTypography-root { color: #e8dcc8 !important; }
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground { color: #a89980 !important; }
.MuiRating-icon { color: #a89980 !important; }
.MuiOutlinedInput-root { background: #1a1715 !important; }
.MuiOutlinedInput-notchedOutline { border-color: #25201d !important; }
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7 { color: #a03028 !important; }
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7:hover { color: #c04038 !important; }

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  body, html, #root, .app-root, .h-screen { font-size: 14px; }
}

/* ===== 降速兜底 ===== */
@media (prefers-reduced-motion: reduce) {
  .is-assistant .flex.items-center.justify-center.size-6::before,
  .is-assistant .flex.items-center.justify-center.size-6::after,
  .is-user .flex.items-center.justify-center.size-6::before,
  .is-user .flex.items-center.justify-center.size-6::after {
    animation-duration: 4s;
  }
  .rili-markdown-renderer details { transition: none !important; }
}