/* ═══ 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(135deg, #FFF0F5 0%, #FFF8DC 100%) !important; /* 淡紫粉到米黄 */
    border: 2px solid #FFD1DC !important; /* 樱花粉边框 */
    border-radius: 20px 20px 20px 4px !important;
    box-shadow: 0 4px 12px rgba(255, 182, 193, 0.25) !important;
    position: relative !important;
    isolation: isolate !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

/* 3. 输入框单独样式 (天蓝色与米白渐变，区分对话) */
.is-user > .border.border-muted {
    background: linear-gradient(135deg, #F0F8FF 0%, #FFF8DC 100%) !important; /* 爱丽丝蓝到米黄 */
    border-color: #B0E0E6 !important; /* 粉蓝色边框 */
    border-radius: 20px 20px 4px 20px !important;
}

/* 4. 聊天框背景动效 (内嵌SVG：闪烁的小星星与光晕，不影响阅读) */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><circle cx="15" cy="20" r="1.5" fill="%23FFB6C1"><animate attributeName="opacity" values="0.2;0.8;0.2" dur="3s" repeatCount="indefinite" /></circle><circle cx="85" cy="70" r="2" fill="%23FFD700"><animate attributeName="opacity" values="0.1;0.6;0.1" dur="4s" repeatCount="indefinite" /></circle><circle cx="50" cy="50" r="40" fill="%23FFFFFF" opacity="0.3" filter="blur(10px)" /></svg>') !important;
    z-index: 0 !important;
    pointer-events: none !important;
}

/* 5. 【最高优先级】主要文本内容样式 (深棕色护眼，高对比度，绝对清晰) */
.rili-markdown-renderer {
    color: #4A3A3A !important; /* 柔和且高对比度的深棕色 */
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif !important;
    font-weight: bold !important; /* 加粗提升可读性 */
    line-height: 1.7 !important;
    background: transparent !important;
    z-index: 1 !important;
    position: relative !important;
    text-shadow: none !important; /* 严禁使用发光阴影以防字迹模糊 */
}

/* 6. 底部附加元素 (按钮、模型名称、Token等) */
.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: #B57B7B !important; /* 豆沙粉棕色，既能看清又与正文区分 */
    font-weight: bold !important;
    z-index: 1 !important;
    position: relative !important;
    transition: color 0.2s ease !important;
}
*/

.bg-muted.rounded.flex.p-0\.5 > button.rounded-full.size-7{
    color: #FF8C00 !important; /* 悬停时变为元气的橘色 */
}

/* 7. 加载动画重构 (隐藏默认，替换为跳动的小太阳) */
.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 {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 24px !important;
    height: 24px !important;
    /* SMIL动画：跳动并旋转的太阳 */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><animateTransform attributeName="transform" type="translate" values="0,0; 0,-4; 0,0" dur="0.6s" repeatCount="indefinite" calcMode="spline" keySplines="0.25 0.1 0.25 1; 0.25 0.1 0.25 1" /><circle cx="12" cy="12" r="5" fill="%23FFD700" /><path d="M12 3 L12 5 M12 19 L12 21 M3 12 L5 12 M19 12 L21 12 M5.6 5.6 L7 7 M17 17 L18.4 18.4 M5.6 18.4 L7 17 M17 7 L18.4 5.6" stroke="%23FFA500" stroke-width="2" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur="4s" repeatCount="indefinite" /></path></g></svg>') !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
}

/* 8. 移动端与低动效适配 */
@media (max-width: 480px) {
    .is-user > .border.border-muted,
.is-assistant > .border.border-muted {
        border-radius: 16px 16px 16px 4px !important;
    }
    .is-user > .border.border-muted {
        border-radius: 16px 16px 4px 16px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .is-user > .border.border-muted,
.is-assistant > .border.border-muted::before {
        opacity: 0.5 !important;
    }
    .flex.items-center.justify-center.size-6::before {
        /* 降低动效幅度 */
        background-image: 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="5" fill="%23FFD700" /><path d="M12 3 L12 5 M12 19 L12 21 M3 12 L5 12 M19 12 L21 12 M5.6 5.6 L7 7 M17 17 L18.4 18.4 M5.6 18.4 L7 17 M17 7 L18.4 5.6" stroke="%23FFA500" stroke-width="2" stroke-linecap="round" /></svg>') !important;
    }
}
/*
  ========================================
  [陌晴] 状态面板美化 — 樱花恋语主题
  与"元气小太阳聊天框CSS"共存设计
  所有选择器基于 ai 容器，零全局污染
  ========================================
*/

/* ═══ 0. 容器变量 ═══ */
ai {
  --pk1: #FFF0F5;
  --pk2: #FFD1DC;
  --pk3: #FFB6C1;
  --yw1: #FFF8DC;
  --tx: #4A3A3A;
  --tx2: #B57B7B;
  --tx3: #D4878F;
  --card: rgba(255,255,255,0.72);
  --card2: rgba(255,240,245,0.5);
  --r: 12px;
  --gap: 8px;
  font-family: "PingFang SC","Microsoft YaHei",sans-serif;
  display: block;
  color: var(--tx);
  font-size: 14px;
  line-height: 1.65;
}

/* ═══ 1. 正文区 ═══ */
ai article {
  padding: 0 2px;
  margin-bottom: 6px;
}

/* ═══ 2. 状态面板通用 (details.st) ═══ */
ai details.st {
  background:
    linear-gradient(160deg, var(--pk1) 0%, var(--yw1) 55%, var(--pk1) 100%);
  border: 1.5px solid var(--pk2);
  border-radius: var(--r);
  margin-top: 6px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(255,182,193,0.18);
  transition: box-shadow .3s ease;
  /* 飘落樱花瓣装饰背景 */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" preserveAspectRatio="none"><ellipse cx="170" cy="30" rx="6" ry="3" fill="%23FFD1DC" opacity="0.35" transform="rotate(-30 170 30)"><animateTransform attributeName="transform" type="translate" values="0,0;-15,40;-30,80" dur="8s" repeatCount="indefinite" /><animate attributeName="opacity" values="0.35;0.15;0" dur="8s" repeatCount="indefinite" /></ellipse><ellipse cx="60" cy="10" rx="4" ry="2" fill="%23FADADD" opacity="0.3" transform="rotate(20 60 10)"><animateTransform attributeName="transform" type="translate" values="0,0;10,50;5,100" dur="11s" repeatCount="indefinite" /><animate attributeName="opacity" values="0.3;0.12;0" dur="11s" repeatCount="indefinite" /></ellipse><ellipse cx="120" cy="60" rx="5" ry="2.5" fill="%23FFE4E1" opacity="0.25" transform="rotate(-15 120 60)"><animateTransform attributeName="transform" type="translate" values="0,0;-8,35;-20,70" dur="9.5s" repeatCount="indefinite" /><animate attributeName="opacity" values="0.25;0.1;0" dur="9.5s" repeatCount="indefinite" /></ellipse></svg>');
  background-size: cover;
  background-repeat: no-repeat;
}
ai details.st:hover {
  box-shadow: 0 4px 18px rgba(255,182,193,0.32);
}

/* ═══ 3. Summary 标题栏 ═══ */
/* 修复：将 &gt; 改为 > */
ai details.st > summary {
  padding: 10px 14px;
  font-weight: bold;
  font-size: 15px;
  color: var(--tx);
  background: rgba(255,255,255,0.55);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .25s ease;
  border-bottom: 1px solid transparent;
  position: relative;
}
ai details.st > summary::-webkit-details-marker { display: none; }
ai details.st > summary::after {
  content: '▸';
  margin-left: auto;
  font-size: 12px;
  color: var(--tx2);
  transition: transform .3s ease;
}
ai details.st[open] > summary::after {
  transform: rotate(90deg);
}
ai details.st[open] > summary {
  border-bottom-color: var(--pk2);
  background: rgba(255,255,255,0.7);
}
ai details.st > summary:hover {
  background: rgba(255,255,255,0.85);
}

/* ═══ 4. 信息卡片 p[t] ═══ */
ai details.st p[t] {
  background: var(--card);
  border-radius: 8px;
  padding: 10px 12px;
  margin: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  border: 1px solid rgba(255,209,220,0.3);
  transition: border-color .25s ease, transform .2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
ai details.st p[t]:hover {
  border-color: var(--pk2);
  transform: translateY(-1px);
}

/* 卡片标题角标 */
ai details.st p[t]::before {
  content: attr(t);
  position: absolute;
  top: 0; right: 0;
  background: linear-gradient(135deg, var(--pk3), var(--pk2));
  color: #fff;
  padding: 2px 10px 2px 12px;
  font-size: 10px;
  font-weight: bold;
  border-radius: 0 8px 0 10px;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ═══ 5. 数据行 d / f / v ═══ */
ai p[t] d {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1.6;
  padding: 1px 0;
}
ai p[t] f {
  font-weight: bold;
  color: var(--tx3);
  flex-shrink: 0;
  min-width: 2.5em;
  font-size: 13px;
}
ai p[t] v {
  color: var(--tx);
  flex: 1;
  word-break: break-word;
}
ai p[t] i {
  color: var(--tx2);
  font-style: italic;
  font-size: 13px;
}
ai p[t] b {
  color: var(--tx);
}

/* ═══ 6. 好感度/信赖度条 bar ═══ */
ai bar {
  display: block;
  width: 100%;
  height: 18px;
  background: rgba(0,0,0,0.06);
  border-radius: 9px;
  position: relative;
  overflow: hidden;
  font-size: 11px;
  line-height: 18px;
  color: #fff;
  text-align: center;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
ai bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: calc(var(--val) * 1%);
  border-radius: 9px;
  background: linear-gradient(90deg, #FADADD 0%, var(--pk3) 50%, #FF91A4 100%);
  animation: barGrow 1s cubic-bezier(.22,.61,.36,1) forwards;
}
/* 条上的光泽扫过效果 */
ai bar::after {
  content: '';
  position: absolute;
  top: 0; left: -50%;
  width: 30%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  border-radius: 9px;
  animation: barShine 3s ease-in-out 1.2s infinite;
}
@keyframes barGrow {
  from { width: 0; }
  to { width: calc(var(--val) * 1%); }
}
@keyframes barShine {
  0%,100% { left: -50%; opacity: 0; }
  50% { left: 120%; opacity: 1; }
}

/* ═══ 7. NPC专属色彩 ═══ */
/* 陌晴 - 蜜桃粉 */
ai p[c="mq"] {
  background: linear-gradient(135deg, rgba(255,218,221,0.35), var(--card));
  border-left: 3px solid var(--pk3);
}
ai p[c="mq"]::before {
  background: linear-gradient(135deg, #FF91A4, #FFB6C1);
}
/* 子柒 - 冷淡蓝紫 */
ai p[c="zq"] {
  background: linear-gradient(135deg, rgba(200,210,240,0.3), var(--card));
  border-left: 3px solid #A8B8D8;
}
ai p[c="zq"]::before {
  background: linear-gradient(135deg, #8E9CC0, #A8B8D8);
}

/* ═══ 8. 分隔线 ═══ */
ai details.st hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--pk2), transparent);
  margin: 4px var(--gap);
}

/* ═══ 9. 秘密日记特殊样式 ═══ */
ai p[c="dy"] {
  background:
    repeating-linear-gradient(
      transparent 0px,
      transparent 27px,
      rgba(255,210,220,0.25) 27px,
      rgba(255,210,220,0.25) 28px
    ),
    linear-gradient(135deg, #FFFDF7, #FFF5F0) !important;
  font-family: 'KaiTi','STKaiti','SimSun',serif;
  border: 1px dashed var(--pk2) !important;
  border-left: 3px solid var(--pk2) !important;
  position: relative;
}
/* 装饰：胶带 */
ai p[c="dy"]::after {
  content: '';
  position: absolute;
  top: -4px; left: 20px;
  width: 40px; height: 14px;
  background: rgba(255,218,185,0.7);
  border-radius: 2px;
  transform: rotate(-3deg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
ai p[c="dy"] d.txt {
  display: block;
  padding: 4px 0;
  line-height: 1.85;
}
ai p[c="dy"] d.txt i {
  font-family: 'KaiTi','STKaiti','SimSun',serif;
  color: #7B5B5B;
  font-size: 13.5px;
}

/* ═══ 10. 行动选项 ═══ */
ai d[c="a"] {
  display: block;
  background: rgba(255,255,255,0.8);
  border: 1.5px solid rgba(255,209,220,0.5);
  border-radius: 20px;
  padding: 8px 14px;
  margin: 3px 0;
  font-weight: bold;
  font-size: 13.5px;
  color: var(--tx);
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
}
ai d[c="a"]::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,182,193,0.15), transparent);
  transition: left .4s ease;
}
ai d[c="a"]:hover {
  background: linear-gradient(135deg, var(--pk2), var(--pk3));
  color: #fff;
  border-color: var(--pk3);
  transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(255,182,193,0.4);
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
ai d[c="a"]:hover::before {
  left: 100%;
}

/* ═══ 11. 面板展开动画 ═══ */
ai details.st[open] p[t] {
  animation: cardIn .4s ease both;
}
ai details.st[open] p[t]:nth-child(2) { animation-delay: .06s; }
ai details.st[open] p[t]:nth-child(3) { animation-delay: .12s; }
ai details.st[open] p[t]:nth-child(4) { animation-delay: .18s; }
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══ 12. 移动端适配 ═══ */
@media (max-width: 480px) {
  ai details.st {
    border-radius: 10px;
    margin-top: 4px;
  }
  ai details.st p[t] {
    margin: 5px;
    padding: 8px 10px;
  }
  ai details.st > summary {
    padding: 8px 12px;
    font-size: 14px;
  }
  ai d[c="a"] {
    padding: 7px 12px;
    font-size: 13px;
  }
}

/* ═══ 13. 低动效模式 ═══ */
@media (prefers-reduced-motion: reduce) {
  ai details.st[open] p[t] { animation: none; }
  ai bar::before { animation: none; width: calc(var(--val) * 1%); }
  ai bar::after { animation: none; display: none; }
  ai d[c="a"]::before { transition: none; }
}