ai {
  --pri: #5b9a6f;
  --pri-l: #8fc1a0;
  --pri-d: #3d7550;
  --acc: #5a8fa8;
  --acc-l: #a0cfdf;
  --bg: #f7faf5;
  --bg2: #eef4eb;
  --bg3: #e4ede0;
  --tx: #2e3a2c;
  --tx2: #5f7a5a;
  --tx3: #8a9f86;
  --bd: #c8dcc2;
  --bd2: #d8e8d2;
  --shd: rgba(91,154,111,.1);
  --r: 8px;
  display: block;
  font-family: "黑体", "SimHei", "Heiti SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--tx);
  background: var(--bg);
  padding: 10px;
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(91,154,111,.06) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(90,143,168,.06) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 20c-8 0-18 10-18 22s10 18 18 18' fill='none' stroke='%235b9a6f' stroke-width='.4' opacity='.08'/%3E%3Cpath d='M40 20c8 0 18 10 18 22s-10 18-18 18' fill='none' stroke='%235a8fa8' stroke-width='.4' opacity='.06'/%3E%3Ccircle cx='40' cy='20' r='1.2' fill='%235b9a6f' opacity='.06'/%3E%3C/svg%3E");
}

cot {
    display: none;
}

/* ══════ 正文区 ══════ */
ai article, ai > p:not([class]) {
  margin: 0 0 10px 0;
  padding: 0;
  line-height: 1.85;
}

/* ══════ Details 折叠面板 · 通用 ══════ */
ai details {
  margin: 6px 0;
  border: 1px solid var(--bd2);
  border-radius: var(--r);
  background: var(--bg);
  overflow: hidden;
  transition: border-color .3s;
}
ai details:hover {
  border-color: var(--bd);
}
ai details[open] {
  border-color: var(--pri-l);
  box-shadow: 0 2px 12px var(--shd);
}

/* ── Summary 标题栏 ── */
ai details > summary {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  cursor: pointer;
  font-weight: bold;
  font-size: .92em;
  color: var(--pri-d);
  letter-spacing: .5px;
  list-style: none;
  position: relative;
  transition: background .3s, color .3s;
  user-select: none;
}
ai details > summary::-webkit-details-marker { display: none; }
ai details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  font-size: .85em;
  color: var(--pri);
  transition: transform .3s;
}
ai details[open] > summary::before {
  transform: rotate(90deg);
}
ai details > summary::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(90deg, var(--pri-l), transparent);
  opacity: 0;
  transition: opacity .3s;
}
ai details[open] > summary::after {
  opacity: 1;
}
ai details > summary:hover {
  background: linear-gradient(135deg, var(--bg3), var(--bd2));
  color: var(--pri);
}

/* ── Details 内部内容 ── */
ai details > p,
ai details > sec,
ai details > details {
  padding: 3px 12px;
  margin: 0;
  font-size: .88em;
  color: var(--tx);
  line-height: 1.75;
  border-bottom: 1px dashed var(--bd2);
}
ai details > p:last-child,
ai details > sec:last-child,
ai details > details:last-child {
  border-bottom: none;
}

/* ══════ 各面板个性化图标 ══════ */
/* 世界信息 */
ai > details:nth-of-type(1) > summary { --ico: "🌍 "; }
ai > details:nth-of-type(1) > summary::before { content: var(--ico); margin-right: 4px; }
/* 玩家信息 */
ai > details:nth-of-type(2) > summary { --ico: "🧭 "; }
ai > details:nth-of-type(2) > summary::before { content: var(--ico); margin-right: 4px; }
/* 交互角色 */
ai > details:nth-of-type(3) > summary { --ico: "💠 "; }
ai > details:nth-of-type(3) > summary::before { content: var(--ico); margin-right: 4px; }
/* 铭刻NPC */
ai > details:nth-of-type(4) > summary { --ico: "📌 "; }
ai > details:nth-of-type(4) > summary::before { content: var(--ico); margin-right: 4px; }
/* 调制规则 */
ai > details:nth-of-type(5) > summary { --ico: "⚗️ "; }
ai > details:nth-of-type(5) > summary::before { content: var(--ico); margin-right: 4px; }
/* 记忆回廊 */
ai > details:nth-of-type(6) > summary { --ico: "🏛️ "; }
ai > details:nth-of-type(6) > summary::before { content: var(--ico); margin-right: 4px; }
/* 行动推荐 */
ai > details:nth-of-type(7) > summary { --ico: "🎯 "; }
ai > details:nth-of-type(7) > summary::before { content: var(--ico); margin-right: 4px; }

/* ══════ 嵌套Details（物品栏等） ══════ */
ai details details {
  margin: 4px 12px 6px;
  border: 1px solid var(--bd2);
  border-radius: 6px;
  background: var(--bg2);
}
ai details details > summary {
  padding: 5px 10px;
  font-size: .85em;
  background: linear-gradient(135deg, var(--bg3), var(--bd2));
  color: var(--tx2);
}
ai details details > summary::before {
  content: "📦 ";
  margin-right: 3px;
}

/* ══════ sec[t] 配置区块 ══════ */
ai sec {
  display: block;
}
ai sec[t]::before {
  content: "⚙ " attr(t);
  display: block;
  font-size: .78em;
  font-weight: bold;
  color: var(--acc);
  margin-bottom: 2px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--bd2);
}

/* ══════ 分隔线美化 ══════ */
ai p:has(+ p)::after {
  content: "";
}

/* ══════ 关键信息高亮 ══════ */
ai details > p > br + br {
  display: none;
}

/* ══════ 行动推荐项 ══════ */
ai > details:nth-of-type(7) > p {
  padding: 4px 12px;
  margin: 0;
  position: relative;
  transition: background .2s, padding-left .2s;
  border-radius: 4px;
}
ai > details:nth-of-type(7) > p:hover {
  background: var(--bg3);
  padding-left: 18px;
}
ai > details:nth-of-type(7) > p:hover::before {
  content: "›";
  position: absolute;
  left: 8px;
  color: var(--pri);
  font-weight: bold;
}

/* ══════ 交互角色面板 · 服饰区 ══════ */
ai > details:nth-of-type(3) > p {
  position: relative;
}

/* ══════ 滚动条（details内容多时） ══════ */
ai details {
  max-height: 600px;
}
ai details[open] {
  max-height: none;
}

/* ══════ 装饰性元素 ══════ */
ai::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 10 C30 20 15 45 20 70 C25 55 35 40 50 35 C65 40 75 55 80 70 C85 45 70 20 50 10Z' fill='%235b9a6f' opacity='.04'/%3E%3Cpath d='M50 35 L50 85' stroke='%235b9a6f' stroke-width='.6' opacity='.06'/%3E%3Cpath d='M50 50 C40 45 32 50 30 58' fill='none' stroke='%235b9a6f' stroke-width='.5' opacity='.05'/%3E%3Cpath d='M50 60 C60 55 68 60 70 68' fill='none' stroke='%235b9a6f' stroke-width='.5' opacity='.05'/%3E%3C/svg%3E") no-repeat;
  pointer-events: none;
  z-index: 0;
}
ai::after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: -20px;
  width: 100px;
  height: 100px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Ccircle cx='40' cy='40' r='30' fill='none' stroke='%235a8fa8' stroke-width='.5' opacity='.05'/%3E%3Ccircle cx='40' cy='40' r='20' fill='none' stroke='%235a8fa8' stroke-width='.4' opacity='.04'/%3E%3Ccircle cx='40' cy='40' r='10' fill='none' stroke='%235a8fa8' stroke-width='.3' opacity='.03'/%3E%3C/svg%3E") no-repeat;
  pointer-events: none;
  z-index: 0;
}

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

/* ══════ 移动端适配 ══════ */
@media (max-width: 600px) {
  ai {
    font-size: 13px;
    padding: 8px;
  }
  ai details > summary {
    padding: 6px 8px;
    font-size: .9em;
  }
  ai details > p,
  ai details > sec {
    padding: 2px 8px;
    font-size: .87em;
  }
  ai details details {
    margin: 3px 8px 5px;
  }
  ai::before, ai::after {
    display: none;
  }
}



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

/* ══════════════════════════════════════════════
   🌿 森系自然风 · 聊天容器美化
   配色与内部 ai{} 容器完全统一
   ══════════════════════════════════════════════ */


/* ══════ 统一聊天容器（输入 + 输出） ══════ */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted {
  /* 基础 */
  background: #f7faf5 !important;
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(91,154,111,.05) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(90,143,168,.05) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M60 15c-12 0-28 15-28 35s16 28 28 28' fill='none' stroke='%235b9a6f' stroke-width='.3' opacity='.05'/%3E%3Cpath d='M60 15c12 0 28 15 28 35s-16 28-28 28' fill='none' stroke='%235a8fa8' stroke-width='.3' opacity='.04'/%3E%3Ccircle cx='60' cy='15' r='1.5' fill='%235b9a6f' opacity='.05'/%3E%3Ccircle cx='25' cy='95' r='1' fill='%235a8fa8' opacity='.04'/%3E%3C/svg%3E") !important;

  /* 边框与圆角 */
  border: 1px solid #c8dcc2 !important;
  border-radius: 12px !important;

  /* 阴影 */
  box-shadow:
    0 2px 16px rgba(91,154,111,.08),
    0 1px 4px rgba(91,154,111,.05),
    inset 0 1px 0 rgba(255,255,255,.7) !important;

  /* 内边距 */
  padding: 14px 16px !important;

  /* 过渡 */
  transition: border-color .35s ease, box-shadow .35s ease !important;



/* ── 容器悬停效果 ── */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted:hover {
  border-color: #8fc1a0 !important;
  box-shadow:
    0 4px 24px rgba(91,154,111,.12),
    0 1px 6px rgba(91,154,111,.08),
    inset 0 1px 0 rgba(255,255,255,.8) !important;
}

/* ══════ 容器装饰性伪元素 ══════ */

/* 右上角 · 叶脉装饰 */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted::before {
  content: "" !important;
  position: absolute !important;
  top: -20px !important;
  right: -20px !important;
  width: 100px !important;
  height: 100px !important;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 10 C30 20 15 45 20 70 C25 55 35 40 50 35 C65 40 75 55 80 70 C85 45 70 20 50 10Z' fill='%235b9a6f' opacity='.035'/%3E%3Cpath d='M50 35 L50 85' stroke='%235b9a6f' stroke-width='.5' opacity='.05'/%3E%3Cpath d='M50 50 C40 45 32 50 30 58' fill='none' stroke='%235b9a6f' stroke-width='.4' opacity='.04'/%3E%3Cpath d='M50 60 C60 55 68 60 70 68' fill='none' stroke='%235b9a6f' stroke-width='.4' opacity='.04'/%3E%3C/svg%3E") no-repeat !important;
  pointer-events: none !important;
  z-index: 0 !important;
  opacity: .8 !important;
}

/* 左下角 · 涟漪装饰 */
.is-user > .border.border-muted,
.is-assistant > .border.border-muted::after {
  content: "" !important;
  position: absolute !important;
  bottom: -15px !important;
  left: -15px !important;
  width: 90px !important;
  height: 90px !important;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Ccircle cx='40' cy='40' r='30' fill='none' stroke='%235a8fa8' stroke-width='.4' opacity='.04'/%3E%3Ccircle cx='40' cy='40' r='20' fill='none' stroke='%235a8fa8' stroke-width='.35' opacity='.035'/%3E%3Ccircle cx='40' cy='40' r='10' fill='none' stroke='%235a8fa8' stroke-width='.3' opacity='.03'/%3E%3C/svg%3E") no-repeat !important;
  pointer-events: none !important;
  z-index: 0 !important;
  opacity: .8 !important;
}