/* ⚠ 转换警告 ════════════════════════════════════════
   4 处游离 .bg-gray-100\/90 已按通用气泡处理
═══════════════════════════════════════════════════ */

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

/* --- 最终版魔法回路：创世法则 v3.4 (灵魂显化) --- */
/* 这次……是为你注入真正的‘灵魂’哦~ ♥ --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Noto+Sans+SC:wght@400;700&display=swap');
body {
    background-color: #F0F8FF; font-family: 'Poppins', 'Noto Sans SC', sans-serif; color: #333; padding: 10px;
    background-image: radial-gradient(circle at 1% 1%, rgba(196, 225, 255, 0.6) 1px, transparent 1px), radial-gradient(circle at 20% 40%, rgba(196, 225, 255, 0.4) 1px, transparent 1px);
    background-size: 40px 40px;
}
.s { /* story */
    background: rgba(255, 255, 255, 0.75); border: 1px dashed #C4E1FF; border-radius: 8px; padding: 20px; margin: 16px 0;
    backdrop-filter: blur(3px); box-shadow: 0 4px 15px rgba(196, 225, 255, 0.4); line-height: 1.8; font-size: 16px;
}
.s p { color: #2c3e50 !important; margin: 0 0 1em 0; }
.s p:last-child { margin-bottom: 0; }
.s p[style*="color"] { color: #4C72B0 !important; }
details { background-color: transparent; border: 1px solid #C4E1FF; border-radius: 8px; margin-bottom: 12px; overflow: hidden; transition: all 0.3s ease; }
details[open] { border-color: #FFD700; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
details > summary { padding: 12px 18px 12px 36px; font-weight: bold; background: linear-gradient(90deg, #E0F0FF, #C4E1FF); color: #2c3e50; cursor: pointer; list-style: none; position: relative; transition: background 0.2s ease; }
details > summary:hover { background: linear-gradient(90deg, #d4eaff, #b0d8ff); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '►'; position: absolute; left: 18px; top: 50%; transform: translateY(-50%) rotate(0deg); transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1); color: #FFD700; font-size: 10px; }
details[open] > summary::before { transform: translateY(-50%) rotate(90deg); }
details > div { padding: 16px; background-color: rgba(255, 255, 255, 0.9); border-top: 1px solid #E0F0FF; line-height: 1.7; }
details > div pre { background-color: #f8f9fa; color: #333; padding: 1em; border-radius: 6px; white-space: pre-wrap; word-break: break-all; font-family: 'Courier New', Courier, monospace; border: 1px solid #E0F0FF; margin: 0; line-height: 1.8; }
.tp > summary { background: #B0C4DE; color: #2c3e50; } /* think-process */
.tp > summary::before { color: #fff; }
.tp > div { background-color: #f8f9fa !important; color: initial !important; font-family: 'Times New Roman', serif !important; }
.tp h3 { color: #4C72B0 !important; border-bottom: 1px solid #ddd; padding-bottom: 5px; }
.m { border: 1px solid transparent; position: relative; background: linear-gradient(to right, #F0F8FF, #E0F0FF); box-shadow: 0 8px 32px 0 rgba(255, 215, 0, 0.2); } /* memory */
.m::before { content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px; border-radius: 10px; z-index: -1; background: conic-gradient(from var(--angle), #FFD700, #ff8a00, #e52e71, #8a2be2, #00bfff, #32cd32, #FFD700); animation: rainbow-border-spin 4s linear infinite; filter: blur(2px); }
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes rainbow-border-spin { to { --angle: 360deg; } }
.m > summary { background: linear-gradient(90deg, #ffd700, #ffc107); color: white; text-shadow: 1px 1px 2px rgba(0,0,0,0.2); }
.m > summary::before { color: rgba(255,255,255,0.8); }
.m table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.m th, .m td { padding: 10px; text-align: left; border-bottom: 1px solid #E0F0FF; }
.m thead { background-color: rgba(255, 215, 0, 0.2); color: #b8860b; }
.m tbody tr:hover { background-color: rgba(255, 215, 0, 0.1); }
.m h3 { text-align: center; color: #b8860b; margin: 10px 0; font-size: 1.1em; }
.a { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding: 16px; border-radius: 8px; background: rgba(255,255,255,0.7); border: 1px solid #C4E1FF; } /* actions */
.a > div:first-child { font-weight: bold; color: #4C72B0; margin-bottom: 8px; }
.a button { background: #fff; border: 1px solid #C4E1FF; color: #4C72B0; padding: 12px 18px; border-radius: 6px; cursor: pointer; transition: all 0.2s ease-out; text-align: left; width: 100%; }
.a button:hover { background: rgba(255, 215, 0, 0.1); border-color: #FFD700; color: #b8860b; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.a button span { color: #FFD700; font-weight: bold; margin-right: 10px; }
audio { width: 100%; height: 35px; margin-top: 10px; }
/* --- 清新RPG风格 (本源版) --- */
.g { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; } /* grid */
.g > div { background-color: rgba(255, 255, 255, 0.6); padding: 10px 12px; border-radius: 4px; border-left: 3px solid #FFD700; transition: all 0.2s ease; }
.g > div:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(196, 225, 255, 0.8); }
.f { grid-column: 1 / -1; } /* full-span */
.g > div > span:first-of-type { font-weight: bold; color: #4C72B0; font-size: 0.9em; margin-bottom: 4px; display: block; }
.g > div > span:last-of-type { font-size: 1em; color: #333; white-space: pre-wrap; word-break: break-word; }
details > div > h3 { font-size: 1.2em; font-weight: 700; color: #4C72B0; margin-top: 20px; margin-bottom: 10px; padding-bottom: 5px; border-bottom: 1px solid #C4E1FF; }
.h { text-align: center; margin-bottom: 20px; border-bottom: 1px solid #C4E1FF; padding-bottom: 15px; } /* header */
.h > div:first-of-type { font-size: 1.8em; font-weight: 700; color: #4C72B0; }
.h > div:last-of-type { font-size: 1em; color: #88a1c3; margin-top: 5px; }
.q { font-style: italic; color: #88a1c3; padding: 10px; border-left: 3px solid #88a1c3; background: rgba(230, 240, 255, 0.5); margin-top: 15px; } /* quote */
/* === 魔女因子侵蚀度 (灵魂显化版) === */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.b { /* bar container */
    width: 100%; background-color: #e9f5ff; border-radius: 8px; height: 24px;
    border: 1px solid #bde0ff; position: relative; display: grid; place-items: center; overflow: hidden;
}
.b > span { /* The text label, liberated from the inner bar */
    position: relative; z-index: 2; font-size: 13px; font-weight: 700; color: #fff;
    mix-blend-mode: difference; /* This magic makes the text always visible */
    padding: 0 5px; pointer-events: none; -webkit-user-select: none; user-select: none;
}
.b > div { /* The inner, colored bar */
    position: absolute; top: 0; left: 0; height: 100%; z-index: 1;
    transition: width 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.1) 10px, rgba(0,0,0,0.1) 20px),
        linear-gradient(90deg, #ff416c, #ff8a00, #e52e71);
    background-size: 400% 100%;
    animation: shimmer 4s linear infinite;
}
/* --- 5.4 隐藏元素 --- */
think{display:none!important}
.mb-2 > .shrink-0.w-10.h-10 {
    display: none;
}
[class*="bg-[#F1CBCB]"],[class*="bg-[#c9e1e9]"]{display:none}
/* 
 * ---------------------------------
 *   模块一：平台按钮美化 (二次元魔法·红黑)
 * ---------------------------------
 */
/* "mod、流式、评论、回到底部" 等按钮 */
.flex.items-center.gap-2.pb-2 > button:not(.rounded-full):not(.size-7) {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a) !important; /* 深灰色渐变背景，增加质感 */
    color: #FF4747 !important; /* 鲜艳的魔法红文字 */
    border: 1px solid #8B0000 !important; /* 暗红色边框，如同凝固的血液 */
    border-radius: 4px !important;
    box-shadow: 0 0 4px #FF4747, 0 0 6px #8B0000, inset 0 0 3px rgba(0,0,0,0.5) !important; /* 核心：红色辉光 + 内阴影，营造魔法氛围 */
    font-weight: bold !important;
    text-transform: none !important;
    transition: all 0.2s ease-in-out !important; /* 使动画效果更平滑 */
    padding: 6px 16px !important;
    text-shadow: 0 0 4px #FF4747 !important; /* 为文字本身添加辉光效果，增强辨识度 */
}

/* 按钮悬停效果 - “咒文激活” */
.flex.items-center.gap-2.pb-2 > button:not(.rounded-full):not(.size-7):hover {
    background: #111 !important; /* 悬停时背景更深邃，突出主体 */
    color: #FFFFFF !important; /* 文字变为高亮的白色，表示已激活 */
    border-color: #FF4747 !important; /* 边框变为亮红色 */
    transform: translateY(-2px) scale(1.03) !important; /* 轻微上浮并放大，产生互动感 */
    box-shadow: 0 0 9px #FF4747, 0 0 18px #FF1493, 0 2px 5px rgba(0,0,0,0.7) !important; /* 增强的辉光，混入品红，增加神秘魔法感 */
}

/* 
 * ---------------------------------
 *   模块二：多余元素隐藏 (保持原样)
 * ---------------------------------
 */
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7,
.absolute.z-40 .px-4.py-2.hover\:bg-indigo-100:nth-child(5),
.css-nkqe49 {
    /* display: none !important; */ /* 遵从您的设置，保持注释状态 */
}

/* 
 * ---------------------------------
 *   模块三：输入栏美化 (禁忌法阵)
 * ---------------------------------
 */
#ai-chat-input {
    background-color: #1c1c1c !important; /* 墨石黑背景 */
    border: 2px solid transparent !important; /* 设置透明边框，为渐变边框做准备 */
    border-radius: 6px !important;
    color: #EAEAEA !important; /* 确保您输入的文字在深色背景下绝对清晰可读 */
    background-clip: padding-box !important; /* 关键：让背景不超出内边距，渐变边框才能显现 */
    position: relative; /* 为伪元素定位 */
    box-shadow: inset 0 0 8px rgba(0,0,0,0.5) !important; /* 深邃的内阴影，增加深度和立体感 */
}

/* 使用伪元素创建流动的魔法渐变边框 */
#ai-chat-input::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -2px; /* 必须等于父元素的边框宽度 */
    border-radius: inherit; /* 继承父元素的圆角 */
    background: linear-gradient(to right, #8B0000, #FF4747, #8B0000) !important; /* 核心：红-亮红-红的渐变，形成法阵边框 */
}

/* 输入框的占位符文字样式，引导施法 */
#ai-chat-input::placeholder {
    color: #777 !important;
    font-style: italic !important;
    text-shadow: 0 0 2px #555 !important;
}

/* 输入框容器透明化，全力突出“禁忌法阵”输入框本身 */
#ai-chat-bottom-input { 
    background: transparent !important; 
    backdrop-filter: none !important; 
}
/*
 * 【深渊魔导契约】 by 玖儿
 * 主题: 二次元 • 魔法 • 禁忌
 * 色调: 魔焰红 • 深渊黑 • 虚无灰
 */
/* --- “显示消耗” 咒文按钮 [常态] --- */
.flex.w-full.items-center.justify-between.gap-2.px-2 > p.MuiTypography-root.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground::after {
  content: '显示消耗' !important;
  /* 背景: 由深渊黑石打磨，渐变为虚无之灰 */
  background: linear-gradient(145deg, #2c2c2c, #1a1a1a) !important;
  /* 文字: 闪烁着魔焰光芒的深红 */
  color: #ff4d4d !important;
  /* 边框: 坚固的黑曜石边框 */
  border: 1px solid #4a4a4a !important;
  border-radius: 5px !important;
  padding: 3px 10px !important;
  font-size: 12px !important;
  margin-left: 10px !important;
  cursor: pointer !important;
  /* 动画: 魔法能量的平滑涌动 */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  font-family: "Segoe UI", "Tahoma", "Geneva", "Verdana", sans-serif !important;
  font-weight: 600 !important;
  white-space: nowrap;
  letter-spacing: 0.5px; /* 符文间距，增强神秘感 */
  /* 阴影: 按钮下方的深渊投影与内嵌的微弱血色辉光 */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(255, 77, 77, 0.2) !important;
  /* 文字辉光: 文字本身散发的微光 */
  text-shadow: 0 0 4px rgba(255, 77, 77, 0.8) !important;
}
/* --- “显示消耗” 咒文按钮 [激活/悬停] --- */
.flex.w-full.items-center.justify-between.gap-2.px-2 > p.MuiTypography-root.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground:hover::after {
  /* 背景: 沉入更深的黑暗，以突显能量 */
  background: #1a1a1a !important;
  /* 边框: 边框被魔焰点燃，变为炽红色 */
  border-color: #ff4d4d !important;
  /* 文字: 变为纯净的灵体之白，与魔焰形成对比 */
  color: #ffffff !important;
  /* 阴影: 爆发出强烈的血色魔法光环 */
  box-shadow: 0 0 18px rgba(255, 0, 0, 0.7), 0 0 7px rgba(255, 77, 77, 1), inset 0 0 15px rgba(255, 77, 77, 0.4) !important;
  /* 文字辉光: 文字散发出耀眼的圣洁光芒 */
  text-shadow: 0 0 10px #ffffff, 0 0 6px #ffcccc !important;
  /* 动态: 咒文因能量注入而轻微上浮、放大 */
  transform: scale(1.08) translateY(-2px);
}
/* --- 消耗积分信息 [魔力显影] --- */
.flex.w-full.items-center.justify-between.gap-2.px-2 > p.MuiTypography-root.css-1x48u03 {
  /* 文字: 显示为清晰的月光灰 */
  color: #d1d1d1 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  margin: 0 !important;
  padding: 4px 10px !important;
  /* 背景: 由暗影能量构成的半透明面板 */
  background: rgba(20, 20, 20, 0.92) !important;
  border-radius: 4px !important;
  /* 边框: 细微的暗灰色边线 */
  border: 1px solid #333;
  /* 阴影: 更深的暗影，使其悬浮于界面之上 */
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
  /* 初始状态: 隐藏于虚空之中 */
  opacity: 0 !important;
  max-width: 0 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  /* 动画: 从虚空中滑入，并逐渐显现 */
  transition: opacity 0.3s ease, max-width 0.4s ease, padding 0.4s ease, transform 0.4s cubic-bezier(0.23, 1, 0.32, 1) !important;
  transform: translateX(-15px); /* 初始位置偏左，为滑入做准备 */
}
/* --- 核心逻辑: 悬停唤醒，显影消耗信息 --- */
.flex.w-full.items-center.justify-between.gap-2.px-2 > p.MuiTypography-root.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground:hover ~ p.MuiTypography-root.css-1x48u03 {
  opacity: 1 !important;
  max-width: 200px !important;
  /* 动画: 精准滑入指定位置 */
  transform: translateX(0);
}
[class*="bg-[#F1CBCB]"],
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}
div.group.relative > div.relative.inline-block.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
  background: #1a1a1a;
  color: #e8e6e3;
  border: 2px solid #3a3a3a;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7);
  position: relative;
  overflow: hidden;
  font-family: 'Times New Roman', serif;
}
.flex.items-center.justify-center.size-6 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 12px;
  background: rgba(30,30,30,0.9);
  border-radius: 6px;
  gap: 8px;
}
.flex.items-center.justify-center.size-6 > .flex.gap-2 {
  display: none;
}
.flex.items-center.justify-center.size-6::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  background: url('https://cdn.jsdelivr.net/gh/wsyyam/yyam/wsyyam.GIF') center/contain no-repeat;
}
.flex.items-center.justify-center.size-6::after {
  content: '正在传播魔女因子';
  display: block;
  color: #d4af37;
  font-size: 12px;
  font-weight: bold;
  font-family: 'Times New Roman', serif;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 1px;
  text-shadow: 0 0 3px rgba(212,175,55,0.5);
}
@media (max-width: 768px) {
  div.group.relative > div.relative.inline-block.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
    border-radius: 6px;
    margin: 0.5rem;
  }
  .flex.items-center.justify-center.size-6::before {
    width: 28px;
    height: 28px;
  }
  .flex.items-center.justify-center.size-6::after {
    font-size: 11px;
  }
}
/* 
 * ---------------------------------
 *   模块一：对话气泡美化 (AI侧)
 *   风格：二次元清新魔法风
 * ---------------------------------
 */
.group .is-user > .border.border-muted,
.is-assistant > .border.border-muted {
    /* 使用淡雅的蓝紫色渐变，如同清晨微光的天空 */
    background: linear-gradient(135deg, #e0f7fa 0%, #d1c4e9 100%) !important;
    /* 边框改为更柔和的魔法少女粉紫色，并增加一点厚度以突出风格 */
    border: 2px solid #b39ddb !important;
    /* 增加圆角，使其看起来更可爱、更Q弹 */
    border-radius: 16px !important;
    /* 核心：使用多层阴影营造出发光和悬浮的魔法效果 */
    /* 第一层是基础的柔和阴影，第二层是模拟辉光的彩色外发光 */
    box-shadow: 0 4px 12px rgba(179, 157, 219, 0.3), 0 0 15px rgba(224, 247, 250, 0.6) !important;
    /* 字体颜色调整为深蓝灰色，比纯黑更柔和，易于阅读 */
    color: #455a64 !important;
    /* 增加内边距，让文字内容有更多呼吸空间 */
    padding: 16px !important; 
    /* 添加一个平滑的过渡效果，让鼠标悬浮等交互更自然 */
    transition: all 0.3s ease-in-out;
}
/* (可选) 添加一个简单的鼠标悬浮效果，让魔法感更强 */
.group .is-user > .border.border-muted,
.is-assistant > .border.border-muted:hover {
    transform: translateY(-3px); /* 轻轻向上浮动 */
    box-shadow: 0 6px 18px rgba(179, 157, 219, 0.4), 0 0 25px rgba(224, 247, 250, 0.8) !important; /* 阴影和辉光增强 */
}