/* ═══ 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:1现实模拟器】专属UI美化 CSS
   特性：深浅色自适应 / 字体颜色大小无损 / 响应式
========================================= */

/* --- 1. 状态栏 (<details>) 美化 --- */
details {
    /* 使用半透明灰度背景，在黑底和白底上均能呈现微弱的色差凸显，不影响原有字体颜色 */
    background-color: rgba(128, 128, 128, 0.06); 
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-left: 4px solid rgba(128, 128, 128, 0.5); /* 档案袋质感左边框 */
    border-radius: 6px;
    padding: 0.8em 1.2em;
    margin: 1.2em 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

details[open] {
    background-color: rgba(128, 128, 128, 0.09);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.2em 0;
    outline: none;
    user-select: none;
    transition: margin 0.3s ease;
}

details[open] summary {
    /* 展开后增加下划线分割线 */
    border-bottom: 1px dashed rgba(128, 128, 128, 0.3);
    padding-bottom: 0.8em;
    margin-bottom: 0.8em;
}

/* --- 2. 聊天框/引用块 (Blockquote) 美化 --- */
blockquote {
    background-color: rgba(128, 128, 128, 0.05);
    border-left: 4px solid rgba(128, 128, 128, 0.4);
    padding: 0.8em 1.2em;
    margin: 1em 0;
    border-radius: 0 6px 6px 0;
}

/* --- 3. Markdown 表格特殊美化 (核心要求) --- */
table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    border-radius: 6px;
    /* 核心：确保手机端和电脑端自适应，内容过多时出现横向滚动条而非挤压变形 */
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; 
    background-color: rgba(128, 128, 128, 0.02);
}

/* 隐藏表格的默认外边框，用内部单元格边框代替，更显现代感 */
table::-webkit-scrollbar {
    height: 6px;
}
table::-webkit-scrollbar-thumb {
    background-color: rgba(128, 128, 128, 0.3);
    border-radius: 3px;
}

th, td {
    padding: 12px 16px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    /* 字体颜色继承父级，不作修改 */
}

th {
    /* 表头稍微加深一点透明度 */
    background-color: rgba(128, 128, 128, 0.12);
    font-weight: bold;
    text-align: left;
    white-space: nowrap; /* 表头尽量不换行 */
}

/* 斑马线效果，同样使用半透明，完美兼容黑白主题 */
tr:nth-child(even) {
    background-color: rgba(128, 128, 128, 0.04);
}

/* 鼠标悬停高亮当前行 */
tr:hover {
    background-color: rgba(128, 128, 128, 0.12);
    transition: background-color 0.2s ease;
}