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

/* --- 结誓·创生 · 主题UI (APP兼容版) --- */
.max-w-\[720px\] {
    --dialogue-bg: #f5efe0;
    --dialogue-border: rgba(197, 155, 92, 0.6);
    --dialogue-shadow: 0 8px 25px rgba(44, 36, 24, 0.25);
    --details-border-color: rgba(197, 155, 92, 0.5);
    --details-header-bg: rgba(179, 57, 57, 0.12);
    --details-header-bg-hover: rgba(179, 57, 57, 0.22);
    --details-header-shadow: 0 4px 10px rgba(197, 155, 92, 0.15);
    --details-header-shadow-hover: 0 6px 15px rgba(197, 155, 92, 0.3);
    --content-bg: #f5efe0;
    --text-color-primary: #2c2418;
    --text-color-secondary: #c59b5c;
    --text-color-title: #b33939;
    --border-radius-main: 8px;
    --border-radius-inner: 6px;
}
.rili-markdown-renderer {
    color: #2c2418 !important;
    background: #f5efe0 !important;
}
.rili-markdown-renderer p {
    font-size: 16px !important;
    line-height: 1.8 !important;
    color: #2c2418 !important;
}
.chat-container .group .relative.inline-block {
    background-color: #f5efe0 !important;
    border: 1px solid rgba(197, 155, 92, 0.55) !important;
    box-shadow: 0 6px 20px rgba(44, 36, 24, 0.2) !important;
    border-radius: 8px !important;
    color: #2c2418 !important;
}
.chat-container .group .relative.inline-block > /* MuiBox-root removed */ {
    display: none !important;
}
.chat-container .group .relative.inline-block * {
    color: #2c2418 !important;
}
.chat-container .group .bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    background: #f5efe0 !important;
    color: #b33939 !important;
    border: 1px solid rgba(197, 155, 92, 0.5) !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(44, 36, 24, 0.1) !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    text-transform: none !important;
    transition: all 0.2s ease !important;
    padding: 4px 12px !important;
    min-width: auto !important;
    line-height: 1.5 !important;
}
.chat-container .group .bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    background: rgba(179, 57, 57, 0.1) !important;
    color: #8b2020 !important;
    border-color: #b33939 !important;
    box-shadow: 0 0 8px rgba(197, 155, 92, 0.3) !important;
}
.rili-markdown-renderer details {
    border: 1px solid rgba(197, 155, 92, 0.45) !important;
    border-radius: 8px !important;
    margin: 16px 0 !important;
    background-color: #f5efe0 !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(44, 36, 24, 0.12) !important;
}
.rili-markdown-renderer details:hover {
    box-shadow: 0 0 18px rgba(197, 155, 92, 0.22) !important;
    border-color: #c59b5c !important;
}
.rili-markdown-renderer summary {
    display: flex !important;
    align-items: center !important;
    padding: 12px 20px !important;
    cursor: pointer !important;
    background: linear-gradient(135deg, rgba(197, 155, 92, 0.2), rgba(197, 155, 92, 0.08)) !important;
    color: #b33939 !important;
    font-weight: 600 !important;
    font-size: 1.1em !important;
    transition: all 0.3s ease !important;
    outline: none !important;
    list-style: none !important;
    position: relative !important;
    border-bottom: 1px solid rgba(197, 155, 92, 0.3) !important;
}
.rili-markdown-renderer summary::-webkit-details-marker {
    display: none !important;
}
.rili-markdown-renderer summary:hover {
    background: linear-gradient(135deg, rgba(197, 155, 92, 0.35), rgba(197, 155, 92, 0.15)) !important;
}
.rili-markdown-renderer summary::before {
    content: '❦' !important;
    display: inline-block !important;
    margin-right: 12px !important;
    font-size: 0.9em !important;
    color: #b33939 !important;
    transition: transform 0.3s ease !important;
}
.rili-markdown-renderer details[open] > summary::before {
    content: '❧' !important;
    color: #b33939 !important;
}
.rili-markdown-renderer details > pre,
.rili-markdown-renderer details > table {
    margin: 0 !important;
    border: none !important;
    border-top: 1px solid rgba(197, 155, 92, 0.25) !important;
    border-radius: 0 !important;
    background-color: #f5efe0 !important;
    overflow-x: auto !important;
}
.rili-markdown-renderer details pre > div:first-child[style*="border-color"] {
    display: none !important;
}
.rili-markdown-renderer details pre {
    padding: 0 !important;
    background: #f5efe0 !important;
}
.rili-markdown-renderer details pre > div[node="[object Object]"] {
    padding: 16px 20px !important;
    background: #f5efe0 !important;
}
.rili-markdown-renderer details pre code {
    font-size: 14px !important;
    line-height: 1.7 !important;
    color: #2c2418 !important;
    background: transparent !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
}
.rili-markdown-renderer details * {
    color: #2c2418 !important;
}
.flex.items-center.gap-2.pb-2 > button:not(.rounded-full):not(.size-7) {
    background: #f5efe0 !important;
    color: #b33939 !important;
    border: 1px solid rgba(197, 155, 92, 0.5) !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 6px rgba(44, 36, 24, 0.1) !important;
    font-weight: 500 !important;
    text-transform: none !important;
    transition: all 0.2s ease !important;
    padding: 6px 14px !important;
}
.flex.items-center.gap-2.pb-2 > button:not(.rounded-full):not(.size-7):hover {
    background: rgba(179, 57, 57, 0.1) !important;
    color: #8b2020 !important;
    border-color: #b33939 !important;
    box-shadow: 0 0 10px rgba(197, 155, 92, 0.3) !important;
}
#ai-chat-input {
    background-color: #f5efe0 !important;
    border: 1px solid rgba(197, 155, 92, 0.5) !important;
    border-radius: 6px !important;
    color: #2c2418 !important;
    box-shadow: inset 0 2px 4px rgba(44, 36, 24, 0.08) !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
}
#ai-chat-input:focus {
    border-color: #b33939 !important;
    box-shadow: inset 0 2px 4px rgba(44, 36, 24, 0.08), 0 0 10px rgba(197, 155, 92, 0.35), 0 0 4px rgba(179, 57, 57, 0.15) !important;
}
#ai-chat-bottom-input {
    background: #f5efe0 !important;
    border-top: 1px solid rgba(197, 155, 92, 0.35) !important;
    padding: 8px !important;
}
@keyframes ai-answer-spinner-rotation {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
div:has(> .flex.items-center.justify-center.size-6 > .flex.gap-2) {
    justify-content: flex-start !important;
    width: auto !important;
    height: auto !important;
}
div:has(> .flex.items-center.justify-center.size-6 > .flex.gap-2)::after {
    content: '结誓推演中，请稍候...' !important;
    font-size: 14px !important;
    color: #b33939 !important;
    margin-left: 10px !important;
}
.flex.items-center.justify-center.size-6 > .flex.gap-2::before,
.flex.items-center.justify-center.size-6 > .flex.gap-2::after {
    content: none !important;
    display: none !important;
}
.flex.items-center.justify-center.size-6 > .flex.gap-2 {
    position: relative !important;
    background: #c59b5c !important;
    width: 16px !important;
    height: 16px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    animation: ai-answer-spinner-rotation 2s linear infinite !important;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%) !important;
}
.rili-markdown-renderer h1,
.rili-markdown-renderer h2,
.rili-markdown-renderer h3,
.rili-markdown-renderer h4,
.rili-markdown-renderer h5,
.rili-markdown-renderer h6 {
    color: #b33939 !important;
}
.rili-markdown-renderer a {
    color: #b33939 !important;
}
.rili-markdown-renderer code {
    color: #2c2418 !important;
    background: rgba(197, 155, 92, 0.15) !important;
    border: 1px solid rgba(197, 155, 92, 0.25) !important;
    border-radius: 4px !important;
    padding: 1px 5px !important;
}
.rili-markdown-renderer blockquote {
    color: #2c2418 !important;
    border-left-color: rgba(197, 155, 92, 0.6) !important;
    background: rgba(197, 155, 92, 0.08) !important;
    border-radius: 0 6px 6px 0 !important;
    padding: 10px 16px !important;
}
.rili-markdown-renderer hr {
    border-color: rgba(197, 155, 92, 0.3) !important;
    background: linear-gradient(90deg, transparent, rgba(197, 155, 92, 0.5), rgba(179, 57, 57, 0.3), rgba(197, 155, 92, 0.5), transparent) !important;
    height: 1px !important;
    border: none !important;
}
.rili-markdown-renderer table {
    border-collapse: collapse !important;
    width: 100% !important;
}
.rili-markdown-renderer table th {
    background: rgba(197, 155, 92, 0.2) !important;
    color: #b33939 !important;
    border: 1px solid rgba(197, 155, 92, 0.35) !important;
    padding: 8px 14px !important;
    font-weight: 600 !important;
}
.rili-markdown-renderer table td {
    background: #f5efe0 !important;
    color: #2c2418 !important;
    border: 1px solid rgba(197, 155, 92, 0.2) !important;
    padding: 7px 14px !important;
}
.rili-markdown-renderer table tr:hover td {
    background: rgba(197, 155, 92, 0.08) !important;
    border-color: rgba(197, 155, 92, 0.35) !important;
}
.rili-markdown-renderer strong {
    color: #b33939 !important;
    font-weight: 700 !important;
}
.rili-markdown-renderer em {
    color: #c59b5c !important;
}
.rili-markdown-renderer ul li::marker,
.rili-markdown-renderer ol li::marker {
    color: #c59b5c !important;
}
.rili-markdown-renderer li {
    color: #2c2418 !important;
    line-height: 1.8 !important;
}