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

/* ==============================================
   子玥主题：Dr. Savepoint & LunarYue
   设计理念：冷感实验室 x 像素JRPG x 弟弟是存档点
   最高准则：绝对清晰可读的文字
   修正版本 v2.1 – 彻底解决白底白字问题
   ============================================== */

/* --- 移除顶部默认颜色条 --- */
.bg-\\[\\#F1CBCB\\],
.bg-\\[\\#c9e1e9\\] {
    display: none !important;
}

/* --- 1. 统一聊天框：深色实验室玻璃质感 --- */
.bg-gray-100\\/90.relative.inline-block {
    background: linear-gradient(135deg, rgba(20, 30, 40, 0.92) 0%, rgba(15, 25, 35, 0.96) 100%) !important;
    border: 1px solid rgba(100, 180, 220, 0.25) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    isolation: isolate;
    position: relative;
    overflow: hidden;
}

/* --- 背景动效：DNA双螺旋 & 像素存档点 (SVG SMIL动画) --- */
.bg-gray-100\\/90.relative.inline-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='600' viewBox='0 0 300 600'%3E%3Cdefs%3E%3Cstyle%3E .pixel %7B fill: %234A90E2; opacity: 0.3; %7D .line %7B stroke: %23D8A0E0; stroke-width: 1; opacity: 0.15; fill: none; %7D %3C/style%3E%3C/defs%3E%3Cpath class='line' d='M50 0 Q100 75 50 150 T50 300 T50 450 T50 600'%3E%3Canimate attributeName='d' values='M50 0 Q100 75 50 150 T50 300 T50 450 T50 600;M50 0 Q0 75 50 150 T50 300 T50 450 T50 600;M50 0 Q100 75 50 150 T50 300 T50 450 T50 600' dur='8s' repeatCount='indefinite'/%3E%3C/path%3E%3Cpath class='line' d='M250 0 Q200 75 250 150 T250 300 T250 450 T250 600'%3E%3Canimate attributeName='d' values='M250 0 Q200 75 250 150 T250 300 T250 450 T250 600;M250 0 Q300 75 250 150 T250 300 T250 450 T250 600;M250 0 Q200 75 250 150 T250 300 T250 450 T250 600' dur='8s' repeatCount='indefinite'/%3E%3C/path%3E%3Cline class='line' x1='50' y1='30' x2='250' y2='30'%3E%3Canimate attributeName='opacity' values='0.15;0.5;0.15' dur='3s' repeatCount='indefinite'/%3E%3C/line%3E%3Cline class='line' x1='75' y1='120' x2='225' y2='120'%3E%3Canimate attributeName='opacity' values='0.15;0.5;0.15' dur='3.5s' repeatCount='indefinite'/%3E%3C/line%3E%3Cline class='line' x1='50' y1='200' x2='250' y2='200'%3E%3Canimate attributeName='opacity' values='0.15;0.5;0.15' dur='4s' repeatCount='indefinite'/%3E%3C/line%3E%3Cline class='line' x1='80' y1='350' x2='230' y2='350'%3E%3Canimate attributeName='opacity' values='0.15;0.5;0.15' dur='4.5s' repeatCount='indefinite'/%3E%3C/line%3E%3Cline class='line' x1='55' y1='480' x2='245' y2='480'%3E%3Canimate attributeName='opacity' values='0.15;0.5;0.15' dur='3.8s' repeatCount='indefinite'/%3E%3C/line%3E%3Crect class='pixel' x='145' y='15' width='10' height='10' rx='1'%3E%3Canimate attributeName='opacity' values='0;0.8;0' dur='2s' repeatCount='indefinite' begin='0s'/%3E%3C/rect%3E%3Crect class='pixel' x='135' y='35' width='10' height='10' rx='1'%3E%3Canimate attributeName='opacity' values='0;0.8;0' dur='2s' repeatCount='indefinite' begin='0.3s'/%3E%3C/rect%3E%3Crect class='pixel' x='155' y='35' width='10' height='10' rx='1'%3E%3Canimate attributeName='opacity' values='0;0.8;0' dur='2s' repeatCount='indefinite' begin='0.6s'/%3E%3C/rect%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 300px 600px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

/* --- 2. 文本内容区：绝对清晰的高对比度亮色文字 + 深色背景 --- */
.rili-markdown-renderer {
    color: #FFFFFF !important;            /* 纯白，最大对比度 */
    background: #12161E !important;       /* 深色背景，彻底杜绝白底白字 */
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 0.95rem !important;
    line-height: 1.65 !important;
    position: relative;
    z-index: 1;
    border-radius: 8px !important;        /* 与气泡统一圆角 */
    padding: 6px 0 !important;            /* 保留一些内部空间 */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
    font-weight: 400 !important;
    letter-spacing: 0.01em !important;
}

.rili-markdown-renderer h1, .rili-markdown-renderer h2, .rili-markdown-renderer h3 {
    color: #B0E0FF !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 4px rgba(70, 130, 200, 0.3) !important;
}

.rili-markdown-renderer strong, .rili-markdown-renderer b {
    color: #E8C8FF !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 3px rgba(200, 100, 255, 0.2) !important;
}

.rili-markdown-renderer a {
    color: #7BE0FF !important;
    text-decoration: underline !important;
    text-shadow: 0 0 6px rgba(80, 200, 255, 0.3) !important;
}

/* --- 代码块(CODE BLOCKS)深度美化：实验室终端风格 --- */
.rili-markdown-renderer pre {
    border: 1px solid rgba(100, 180, 220, 0.15) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background-color: transparent !important;
    margin: 8px 0 !important;
}

.rili-markdown-renderer pre > div > div.flex.justify-between.h-8 {
    background: linear-gradient(135deg, #1A1F2B 0%, #131821 100%) !important;
    border-bottom: 1px solid rgba(100, 180, 220, 0.2) !important;
    padding: 6px 12px !important;
}

.rili-markdown-renderer pre > div > div.flex.justify-between > div.text-\\[13px\\] {
    color: #A0C4FF !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px !important;
    text-shadow: 0 0 6px rgba(100, 140, 255, 0.4) !important;
}

.rili-markdown-renderer pre div[data-tooltip-id^="copy-tooltip"] > svg {
    color: #7B8DA4 !important;
    transition: color 0.2s ease, transform 0.2s ease !important;
}

.rili-markdown-renderer pre div[data-tooltip-id^="copy-tooltip"]:hover > svg {
    color: #A0D6FF !important;
    transform: scale(1.1) !important;
}

/* 代码内容区（覆盖内联样式） */
.rili-markdown-renderer pre > div > div[node] {
    background: #12161E !important;
    color: #E0E8F4 !important;
    padding: 12px 16px !important;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace !important;
}

.rili-markdown-renderer pre code[class^="language-"] {
    color: #E0E8F4 !important;
    text-shadow: none !important;
}

.rili-markdown-renderer pre code[class^="language-"] > span {
    color: inherit !important;
}

.rili-markdown-renderer pre > code[node] {
    background: #12161E !important;
    color: #E0E8F4 !important;
    padding: 16px !important;
    border-radius: 10px !important;
    display: block !important;
    border: 1px solid rgba(100, 180, 220, 0.15) !important;
}

/* --- 3. 单独输入框（用户气泡）：温暖琥珀色系--- */
.bg-gray-100\\/90.relative.inline-block:not(.is-assistant .bg-gray-100\\/90) {
    background: linear-gradient(135deg, #2A2432 0%, #1E2330 100%) !important;
    border-color: rgba(220, 170, 80, 0.4) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 200, 100, 0.1) !important;
}

/* --- 4. 底部操作按钮 --- */
.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #B0C7DE !important;
    font-weight: bold !important;
    transition: all 0.2s ease !important;
}

.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #FFFFFF !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
}

/* --- 5. 模型名称与Token消耗文字 --- */
.flex.items-center.gap-2.text-xs.font-mono.text-muted-foreground {
    color: #98A9B9 !important;
    font-weight: 400 !important;
}

/* [Token消耗hover逻辑转换未启用]
.text-orange-500 {
    color: #FFA726 !important;
    font-weight: bold !important;
    background-color: rgba(0,0,0,0.3) !important;
    padding: 2px 6px !important;
    border-radius: 4px !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;
    width: 40px !important;
    height: 40px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex.items-center.justify-center.size-6::before {
    content: '';
    display: block;
    width: 36px;
    height: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cdefs%3E%3Cstyle%3E .pix %7B fill: %23E0B0FF; opacity: 0.9; %7D %3C/style%3E%3C/defs%3E%3Cg%3E%3CanimateTransform attributeName='transform' type='rotate' values='0 18 18;360 18 18' dur='2s' repeatCount='indefinite'/%3E%3Crect class='pix' x='12' y='2' width='8' height='4' rx='1'/%3E%3Crect class='pix' x='8' y='6' width='4' height='4' rx='1'/%3E%3Crect class='pix' x='12' y='6' width='4' height='4' rx='1' fill='%234A90E2'/%3E%3Crect class='pix' x='12' y='10' width='8' height='4' rx='1'/%3E%3Crect class='pix' x='20' y='14' width='4' height='4' rx='1'/%3E%3Crect class='pix' x='8' y='18' width='4' height='4' rx='1'/%3E%3Crect class='pix' x='12' y='18' width='8' height='4' rx='1'/%3E%3Crect class='pix' x='12' y='22' width='8' height='4' rx='1'/%3E%3Crect class='pix' x='20' y='26' width='4' height='4' rx='1'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.85;
}

/* --- 移动端适配 --- */
@media (max-width: 480px) {
    .flex.items-center.justify-center.size-6 {
        width: 32px !important;
        height: 32px !important;
    }
    .flex.items-center.justify-center.size-6::before {
        width: 28px;
        height: 28px;
    }
    .bg-gray-100\\/90.relative.inline-block::before {
        background-size: 200px 400px;
    }
}

/* --- 低动效适配 --- */
@media (prefers-reduced-motion: reduce) {
    .flex.items-center.justify-center.size-6::before {
        filter: brightness(0.8);
    }
}

/* 姐弟系·现代日常世界观 UI 设计策略 */
ai {
    display: block;
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 12px;
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: #faf8f5;
    color: #3a3845;
    line-height: 1.55;
    box-sizing: border-box;
}

details {
    margin-bottom: 14px;
    background: #ffffff;
    border: 1px solid #e8e0d5;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    transition: all 0.25s ease;
    position: relative;
}

details[open] {
    box-shadow: 0 4px 12px rgba(185, 160, 140, 0.08);
    border-color: #dccfc0;
}

details:hover {
    border-color: #d6b8a0;
}

summary {
    font-size: 1.1rem;
    font-weight: 600;
    color: #5a4a5c;
    cursor: pointer;
    padding: 2px 0;
    list-style: none;
    outline: none;
    position: relative;
    padding-left: 24px;
}

summary::-webkit-details-marker { display: none; }

summary::before {
    content: "▶";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    color: #c8a0a0;
}

details[open] > summary::before {
    transform: translateY(-50%) rotate(90deg);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px 16px;
    margin-top: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8a7e7e;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.value {
    font-size: 0.95rem;
    color: #3a3845;
    border-bottom: 1px dashed #e2d6d6;
    padding-bottom: 3px;
}

.char-body {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prop-line, .prop-list, .prop-block {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 12px;
}

.prop-name {
    font-weight: 600;
    color: #7a5a6a;
    min-width: 80px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.prop-val {
    flex: 1;
    min-width: 200px;
    font-size: 0.9rem;
    color: #403d4a;
}

.prop-val span {
    display: block;
    margin-bottom: 4px;
}

.prop-val span.indent {
    padding-left: 16px;
}

.prop-val i {
    color: #a08a90;
}

details.yue {
    background: #fdf9fc;
    border-color: #eddfe8;
}

details.yue summary {
    color: #7b4b5e;
}

.panel-body {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #6e5c64;
    border-left: 3px solid #d4b0c0;
    padding-left: 10px;
    margin-bottom: 4px;
}

.msg-item {
    font-size: 0.88rem;
    padding-left: 8px;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 400px;
}

th {
    background: #f3ecec;
    color: #5a4a5c;
    padding: 8px 6px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dcc5c5;
}

td {
    padding: 8px 6px;
    border-bottom: 1px solid #ede4e4;
    color: #403d4a;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-item {
    padding: 10px 14px;
    background: #f9f4f0;
    border-radius: 12px;
    border: 1px solid #ede0d5;
    font-size: 0.92rem;
    transition: background 0.2s;
}

.action-item:hover {
    background: #f2e6de;
}

.metric-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 6px;
}

.metric {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    padding: 8px 12px;
    background: #faf6f4;
    border-radius: 10px;
    border-left: 4px solid #d4b0b0;
}

.metric-label {
    font-weight: 700;
    font-size: 0.82rem;
    color: #6e4c5e;
    min-width: 90px;
}

.metric-val {
    font-size: 0.88rem;
    color: #3a3845;
}

.placeholder {
    display: none;
}

@media (max-width: 480px) {
    ai { padding: 10px 6px; }
    details { padding: 10px 12px; }
    .prop-line, .prop-list { flex-direction: column; }
    .prop-name { min-width: auto; }
}