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

/* ==============================================
   清·东陵地宫副本 - 聊天框美化方案
   核心目标：绝对可读性 + 沉浸式氛围感
   ============================================== */

/* 1. 隐藏顶部颜色装饰条 (强制执行) */
[class*="bg-[#F1CBCB]"],
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* 2. 美化聊天框主容器 (输入与输出共有) */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
    background: linear-gradient(145deg, #1a1510 0%, #2a2219 100%) !important;
    /* 模拟地宫石壁的深色渐变 */
    border: 1px solid #4a3b2a !important;
    /* 古朴的暗金色边框 */
    border-radius: 8px !important;
    /* 柔和的圆角，如被岁月磨平的棱角 */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 0 4px 12px rgba(0,0,0,0.6) !important;
    /* 内阴影营造纵深感和压抑感 */
    position: relative !important;
    isolation: isolate !important; /* 建立层叠上下文，配合将来可能的动效 */
}

/* 2.1 稍微微调单独的输入聊天框，使其更有“入口”感 */
.is-user > .border.border-muted {
    border-color: #6b5a45 !important;
    /* 输入框边框稍微亮一点，像被炸药炸开的金刚墙入口 */
    box-shadow: inset 0 0 15px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.5), 0 0 8px rgba(107, 90, 69, 0.3) !important;
    /* 加入微弱的金色外发光，暗示“通往深处” */
}

/* 3. 核心：确保主要文本的绝对可读性 (最高优先级) */
.rili-markdown-renderer {
    color: #F2EFE9 !important; /* 极其明亮的灰白色，如墓室中的夜明珠光芒 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !important;
    font-size: 1rem !important;
    line-height: 1.65 !important;
    text-shadow: none !important; /* 绝对禁止使用任何文本阴影，保证字体边缘清晰锐利 */
    font-weight: normal !important;
    background: transparent !important; /* 确保背景是聊天框容器 */
    z-index: 1 !important; /* 确保文字在最上层 */
    position: relative !important;
}

/* 强调文本使用加粗，安全且清晰 */
.rili-markdown-renderer strong,
.rili-markdown-renderer b {
    color: #D4C3A3 !important; /* 使用更亮的古金色来强调，如被擦拭后的金器 */
    font-weight: bold !important;
}

/* 链接的颜色，使用一种像棺灯火光的颜色 */
.rili-markdown-renderer a {
    color: #e6b450 !important;
    text-decoration: underline !important;
}

/* 代码块和行内代码，使用稍微不同的黑石板色调，并确保文字清晰 */
.rili-markdown-renderer code {
    background-color: #1f1a15 !important;
    color: #e0d7c6 !important;
    border-radius: 4px !important;
    padding: 0.2em 0.4em !important;
}

.rili-markdown-renderer pre {
    background-color: #15120e !important;
    border: 1px solid #3d3324 !important;
    border-radius: 6px !important;
}

.rili-markdown-renderer pre code {
    background-color: transparent !important;
}

/* 表格样式，符合墓室氛围 */
.rili-markdown-renderer table {
    border-collapse: collapse !important;
    border: 1px solid #4a3b2a !important;
}
.rili-markdown-renderer th,
.rili-markdown-renderer td {
    border: 1px solid #3d3324 !important;
    padding: 6px 13px !important;
    color: #F2EFE9 !important;
}
.rili-markdown-renderer th {
    background-color: #2a2219 !important;
    color: #D4C3A3 !important;
    font-weight: bold !important;
}
.rili-markdown-renderer tr:nth-child(even) {
    background-color: rgba(74, 59, 42, 0.3) !important;
}

/* 引用块样式，像一块古老的石碑 */
.rili-markdown-renderer blockquote {
    border-left: 4px solid #6b5a45 !important;
    color: #ccc5b8 !important;
    background-color: rgba(0,0,0,0.2) !important;
    padding: 0.5em 1em !important;
}

/* 4. 美化底部附加元素，确保在深色背景上清晰可见 */
/* 4.1 底部操作按钮 (复制, 编辑, 删除等) */
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #C8BFAE !important; /* 柔和的古卷色，与主文本区分但清晰可见 */
    font-weight: normal !important;
}
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #e6b450 !important; /* 悬停时变为金色，如触发了一个机关 */
    background-color: rgba(107, 90, 69, 0.2) !important;
}

/* 4.2 模型名称文本 (例如 gemini2.5pro) */
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground {
    color: #9e9078 !important; /* 更内敛的颜色，像墙上的刻痕 */
    font-style: italic !important;
}

/* 4.3 Token消耗文本 */
/* [Token消耗hover逻辑转换未启用]
.text-orange-500 {
    color: #c49a45 !important; /* 贴近墓室中暗淡的黄金 */
}
*/

/* --- 未来增强预览 (非必须，用户可根据需要添加) --- */
/* 当有加载动画需求时，可参考以下占位代码，并配合SMIL SVG实现稳定动效 */
/*
.style-module__AtdJSq__dot-flashing.style-module__AtdJSq__text {
    display: none !important;
}
.flex.items-center.justify-center.size-6 {
    position: relative !important;
    min-height: 24px !important;
}
.flex.items-center.justify-center.size-6::before,
.flex.items-center.justify-center.size-6::after {
     content: url("data:image/svg+xml,..."); /* 此处放置SMIL动画的SVG data URI */
/*     position: absolute;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
}
*/
/* ==============================================
   清·东陵地宫副本 - 《古墓异志》状态栏CSS
   设计理念：借磷火之光，翻阅血迹斑驳的古籍残卷
   与聊天框深色石壁风格共存，色系统一，层次分明
   ============================================== */

/* 
   策略说明：
   - 配色继承聊天框的暗金/古铜体系，稍作提亮以区分层级
   - 朱砂红用于标题强调，暗金用于正文，骨白用于高亮
   - 装饰手段：伪元素纹理、渐变分割线、hover发光反馈
   - 移动端紧凑单列布局，间距克制
*/

/* --- 古籍主容器 --- */
ai {
  display: block;
  position: relative;
  max-width: 100%;
  margin: 1rem 0;
  padding: 1.2rem 1rem;
  background: linear-gradient(160deg, #1e1913 0%, #252018 100%);
  color: #b8aa8f;
  font-family: 'Noto Serif SC', '楷体', KaiTi, '宋体', SimSun, serif;
  font-size: 13px;
  line-height: 1.6;
  border-radius: 6px;
  border: 1px solid #3d3222;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
  overflow: hidden;
}

/* 古籍纸纹与血迹霉斑 */
ai::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(ellipse at 15% 25%, rgba(139, 80, 40, 0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 70%, rgba(100, 60, 30, 0.1) 0%, transparent 35%),
    radial-gradient(ellipse at 40% 10%, rgba(160, 100, 50, 0.08) 0%, transparent 30%),
    radial-gradient(circle at 60% 55%, rgba(80, 40, 20, 0.15) 2px, transparent 8px),
    radial-gradient(circle at 20% 75%, rgba(80, 40, 20, 0.12) 3px, transparent 10px),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(60, 40, 20, 0.06) 2px, rgba(60, 40, 20, 0.06) 4px);
  pointer-events: none;
  z-index: 0;
  border-radius: 6px;
}

/* 边缘熏烧效果 */
ai::after {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(145deg, rgba(20, 12, 5, 0.5) 0%, transparent 12%, transparent 88%, rgba(20, 12, 5, 0.6) 100%),
    linear-gradient(0deg, rgba(20, 12, 5, 0.4) 0%, transparent 8%, transparent 92%, rgba(20, 12, 5, 0.4) 100%);
  pointer-events: none;
  z-index: 1;
  border-radius: 6px;
}

ai > * {
  position: relative;
  z-index: 2;
}

/* --- 细节折叠区 --- */
details {
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed #3d3222;
}

details:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

/* --- 摘要标题：朱砂笔迹 --- */
summary {
  display: block;
  font-family: 'Ma Shan Zheng', '楷体', KaiTi, cursive;
  font-size: 1.15rem;
  color: #c28b5e;
  letter-spacing: 0.12em;
  cursor: pointer;
  padding: 0.2rem 0;
  margin-bottom: 0.4rem;
  list-style: none;
  transition: color 0.25s ease, text-shadow 0.25s ease;
  text-shadow: 0 0 6px rgba(180, 80, 40, 0.35);
}

summary::before {
  content: '◇';
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.9rem;
  color: #8b5a2b;
  transition: transform 0.3s ease, color 0.25s ease;
}

details[open] > summary::before {
  content: '◆';
  color: #c28b5e;
  transform: rotate(90deg);
}

summary:hover {
  color: #d4a373;
  text-shadow: 0 0 12px rgba(200, 100, 50, 0.5);
}

/* --- 分区标题 --- */
p[c="ts"],
p[c="desc"],
p[c="mem-title"],
p[c="arr-title"],
p[c="map-title"],
p[c="log-title"],
p[c="diary-title"],
p[c="q-title"],
p[c="skill-title"],
p[c="eq-title"],
p[c="bag-title"],
p[c="col-title"],
p[c="com-title"],
p[c="save-title"],
p[c="end-title"],
p[c="ach-title"] {
  font-weight: bold;
  color: #b89a6b;
  border-left: 3px solid #5e3a1c;
  padding-left: 0.6rem;
  margin: 0.6rem 0 0.3rem 0;
  font-family: 'Ma Shan Zheng', '楷体', KaiTi, cursive;
  font-size: 1rem;
  letter-spacing: 0.06em;
}

/* --- 通用文本块 --- */
p, d {
  display: block;
  margin-bottom: 0.15rem;
}

/* --- 网格布局（紧凑排列） --- */
g {
  display: grid;
  margin-bottom: 0.4rem;
}

g[t="attr"] { grid-template-columns: repeat(4, 1fr); gap: 0.3rem 0.5rem; }
g[t="combat"] { grid-template-columns: repeat(3, 1fr); gap: 0.3rem 0.5rem; }
g[t="fs"] { grid-template-columns: repeat(4, 1fr); gap: 0.3rem 0.5rem; }
g[t="res"] { grid-template-columns: 1fr 1fr; gap: 0.3rem 0.5rem; }
g[t="buff"] { grid-template-columns: repeat(3, 1fr); gap: 0.3rem 0.4rem; }
g[t="spec"] { grid-template-columns: repeat(3, 1fr); gap: 0.3rem 0.4rem; }
g[t="arr-stars"] { grid-template-columns: repeat(7, 1fr); gap: 0.2rem 0.3rem; }

g[t="attr"] d,
g[t="combat"] d,
g[t="fs"] d {
  background: rgba(0,0,0,0.25);
  border: 1px solid #3d3222;
  border-radius: 3px;
  padding: 0.15rem 0.3rem;
  font-size: 12px;
  text-align: center;
  color: #c4b49a;
}

g[t="buff"] d[t="b"] {
  color: #a3c4a3;
  border-left: 2px solid #4a6b4a;
  padding-left: 0.4rem;
  font-size: 12px;
}
g[t="buff"] d[t="d"] {
  color: #c4a3a3;
  border-left: 2px solid #6b4a4a;
  padding-left: 0.4rem;
  font-size: 12px;
}
g[t="buff"] d[t="ab"] {
  color: #c4a3c4;
  border-left: 2px solid #5a3a5a;
  padding-left: 0.4rem;
  font-size: 12px;
}

g[t="spec"] d {
  background: rgba(0,0,0,0.2);
  border: 1px solid #3d3222;
  border-radius: 3px;
  padding: 0.15rem 0.3rem;
  font-size: 12px;
  text-align: center;
  color: #b8aa8f;
}

g[t="arr-stars"] d {
  text-align: center;
  font-size: 11px;
  color: #9e9078;
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
  padding: 0.1rem 0.2rem;
}

/* --- 弹性行（主角基本信息） --- */
t[n="base"] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  margin-bottom: 0.4rem;
}

t[n="base"] f {
  font-size: 12px;
  color: #c4b49a;
}

t[n="base"] f[t="name"] {
  font-weight: bold;
  color: #d4a373;
  font-size: 1rem;
}

/* --- 行动推荐列表 --- */
l {
  display: block;
  padding-left: 1.2rem;
}

l li {
  color: #b8aa8f;
  font-size: 12px;
  margin-bottom: 0.15rem;
  list-style-type: '☩';
  padding-left: 0.5rem;
}

l li::marker {
  color: #8b5a2b;
}

/* --- NPC分隔标记 --- */
d[t="npc-sep"] {
  text-align: center;
  color: #5e3a1c;
  font-size: 1.2rem;
  letter-spacing: 0.5em;
  margin: 0.3rem 0;
  opacity: 0.7;
}

/* --- 滚动条（配合深色主题） --- */
ai::-webkit-scrollbar {
  width: 4px;
}

ai::-webkit-scrollbar-track {
  background: #1e1913;
}

ai::-webkit-scrollbar-thumb {
  background: #4a3b2a;
  border-radius: 2px;
}

/* --- 响应式微调 --- */
@media (max-width: 480px) {
  ai {
    padding: 1rem 0.7rem;
    font-size: 12px;
  }

  summary {
    font-size: 1rem;
  }

  g[t="attr"] { grid-template-columns: repeat(2, 1fr); }
  g[t="combat"] { grid-template-columns: repeat(3, 1fr); }
  g[t="spec"] { grid-template-columns: repeat(3, 1fr); }
  g[t="arr-stars"] { grid-template-columns: repeat(4, 1fr); }
}