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

/* ═══ B平台顶部栏适配说明（自动注入）═══
   A: div.sticky > div.flex.justify-between
      ├── 左侧空区
      ├── #ai-model-selector (居中)
      └── 右侧工具(设置按钮等)
   B: <header.flex.justify-between>
      ├── #nav-left (侧边栏开关)
      ├── #nav-middle (可能为空)
      └── #nav-right (通知/主题/语言)
   B平台模型按钮不在header内，选择器:
   button:has(> .flex-1.truncate.text-left)
   ═══════════════════════════════════════ */
header.flex.justify-between { position: relative; overflow: visible; }

/* =========================================
   地球Online：白中透蓝·天空之镜 完整主题
   ========================================= */

/* -----------------------------------------
   1. 全局毛玻璃拟态风 - 状态栏容器
   ----------------------------------------- */
details {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(135, 206, 235, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    padding: 12px 16px;
    margin-bottom: 14px;
    color: #2c3e50;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 鼠标悬浮时微微浮起 */
details:hover {
    box-shadow: 0 12px 40px 0 rgba(100, 149, 237, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
}

/* -----------------------------------------
   2. 标题栏 (Summary) 美化
   ----------------------------------------- */
summary {
    font-size: 1.1em;
    font-weight: 800;
    color: #1f618d;
    cursor: pointer;
    outline: none;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(135, 206, 235, 0.4);
    list-style: none;
    text-shadow: 0px 1px 2px rgba(255, 255, 255, 0.8);
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* 隐藏默认小三角（跨浏览器兼容） */
summary::-webkit-details-marker {
    display: none;
}
summary::marker {
    color: #63b3ed;
}

/* 自定义展开/收起图标 */
summary::before {
    content: "🔹 ";
    color: #5dade2;
    transition: 0.3s;
}
details[open] summary::before {
    content: "💠 ";
}

/* -----------------------------------------
   3. 内部文字排版
   ----------------------------------------- */
details p, details ul, details li {
    font-size: 0.95em;
    line-height: 1.7;
    color: #34495e;
}

details strong {
    color: #3182ce;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* -----------------------------------------
   4. 表格美化（记忆区专用）
   ----------------------------------------- */
details table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 3px 3px 6px rgba(186, 201, 220, 0.3), 
                inset -3px -3px 6px rgba(255, 255, 255, 0.7);
}
details th {
    background-color: rgba(49, 130, 206, 0.1);
    color: #2b6cb0;
    padding: 8px;
    font-size: 0.9em;
}
details td {
    padding: 8px;
    border-top: 1px solid rgba(186, 201, 220, 0.2);
    font-size: 0.85em;
}

/* =========================================
   5. 正文排版注入样式 (AI生成的span标签)
   ========================================= */

/* 对话气泡感样式 */
span.dia {
    display: inline-block;
    color: #1a365d;
    font-weight: bold;
    font-size: 1.05em;
    background: linear-gradient(135deg, rgba(235, 244, 255, 0.6) 0%, rgba(255, 255, 255, 0.2) 100%);
    border-left: 4px solid #4299e1;
    padding: 6px 10px;
    margin: 6px 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 2px 5px rgba(186, 201, 220, 0.2);
}

/* 关键信息高亮样式 */
span.hl {
    color: #2b6cb0;
    font-weight: 900;
    font-size: 1.05em;
    background-color: rgba(49, 130, 206, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: inset 1px 1px 3px rgba(255, 255, 255, 0.8), 
                inset -1px -1px 3px rgba(186, 201, 220, 0.3);
    border-bottom: 2px solid #63b3ed;
}

/* =========================================
   6. 聊天界面深度美化（平台UI覆盖）
   ========================================= */

/* 隐藏官方顶部颜色条 */
[class*="bg-[#F1CBCB]"], 
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* 聊天气泡主容器 */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 248, 255, 0.8) 100%) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    border-radius: 24px !important;
    box-shadow: 0 12px 36px rgba(135, 206, 235, 0.15), 
                inset 0 0 0 1px rgba(255, 255, 255, 0.6) !important;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

.is-user > .border.border-muted,
.is-assistant > .border.border-muted:hover {
    box-shadow: 0 16px 40px rgba(100, 149, 237, 0.2), 
                inset 0 0 0 1px rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px) !important;
}

/* 主文本容器 */
.rili-markdown-renderer {
    color: #2c3e50 !important;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
    letter-spacing: 0.3px !important;
}

/* 底部操作按钮统一样式 */
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7,
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground,
/* [Token消耗hover逻辑转换未启用]
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7,
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground,
.text-orange-500 {
    color: #7f8c8d !important;
    font-weight: 500 !important;
    transition: color 0.3s !important;
}
*/
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #3498db !important;
}

/* 动态加载动画 - 呼吸蓝球 */
.flex.items-center.justify-center.size-6 > .flex.gap-2 { display: none !important; }
.flex.items-center.justify-center.size-6 { position: relative !important; }
.flex.items-center.justify-center.size-6::before {
    content: "" !important;
    position: absolute !important;
    width: 24px !important; 
    height: 24px !important;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6" fill="%2387CEEB"><animate attributeName="r" values="5;7;5" dur="1.5s" repeatCount="indefinite"/><animate attributeName="opacity" values="0.4;1;0.4" dur="1.5s" repeatCount="indefinite"/></circle></svg>') center/contain no-repeat !important;
}

/* =========================================
   7. 顶部导航栏 & 开场白
   ========================================= */
header.flex.justify-between {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid rgba(135, 206, 235, 0.3) !important;
    box-shadow: 0 4px 24px rgba(135, 206, 235, 0.08) !important;
}

/* 开场白选择器按钮 */
div.flex.items-center.h-9.bg-white.rounded-md.cursor-pointer.group[class*="border-gray"] {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(135, 206, 235, 0.5) !important;
    border-radius: 20px !important;
    box-shadow: 0 2px 10px rgba(135, 206, 235, 0.1) !important;
    color: #2980b9 !important;
    transition: all 0.3s !important;
}
div.flex.items-center.h-9.bg-white.rounded-md.cursor-pointer.group[class*="border-gray"]:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 4px 15px rgba(135, 206, 235, 0.2) !important;
}

/* =========================================
   8. 底部输入区域
   ========================================= */
#ai-chat-bottom-input {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(15px) !important;
    border-top: 1px solid rgba(135, 206, 235, 0.3) !important;
    border-radius: 28px 28px 0 0 !important;
    padding-top: 12px !important;
    box-shadow: 0 -8px 30px rgba(135, 206, 235, 0.1) !important;
}

#ai-chat-input {
    background: rgba(240, 248, 255, 0.7) !important;
    border: 1px solid rgba(135, 206, 235, 0.6) !important;
    border-radius: 20px !important;
    color: #2c3e50 !important;
    font-size: 1.05em !important;
    box-shadow: inset 0 2px 8px rgba(135, 206, 235, 0.15) !important;
    transition: all 0.3s !important;
}
#ai-chat-input:focus {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #5dade2 !important;
    box-shadow: inset 0 2px 8px rgba(135, 206, 235, 0.1), 0 0 0 3px rgba(93, 173, 226, 0.2) !important;
}
#ai-chat-input::placeholder { color: #95a5a6 !important; }
#ai-chat-input::selection { background: #87CEEB !important; color: #fff !important; }

/* =========================================
   9. 评论区视觉适配
   ========================================= */
div[class*="w-full"][class*="bg-white"][class*="bottom-0"] {
    background: rgba(250, 252, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border-top: 1px solid rgba(135, 206, 235, 0.3) !important;
}

textarea.rc-textarea {
    background: rgba(240, 248, 255, 0.6) !important;
    border: 1px solid rgba(135, 206, 235, 0.4) !important;
    border-radius: 12px !important;
    color: #2c3e50 !important;
}
textarea.rc-textarea:focus {
    border-color: #5dade2 !important;
    background: #fff !important;
}

button.text-gray-400:hover, span.cursor-pointer:hover {
    color: #3498db !important;
}