/* ═══ 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，温暖粉调，QQ聊天风格，高对比度 */
ai {
  --bg-card: #fff7f8;
  --bg-chat: #f0ece9;
  --bg-bubble: #ffffff;
  --text-main: #1e1e1e;
  --text-sub: #3d2e2e;
  --text-light: #8e7b7b;
  --accent: #d4607a;
  --accent2: #f2a0b0;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.10);
  display: block;
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 12px 22px;
  font-family: "PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-main);
  background: linear-gradient(165deg, #fef8f5 0%, #fff2f4 40%, #fdf0f2 100%);
  border-radius: 24px;
  box-shadow: 0 4px 30px rgba(200,140,140,0.12);
  position: relative;
  isolation: isolate;
}

/* 装饰光晕 */
ai::before {
  content: "";
  position: absolute;
  top: -50px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(248,164,197,0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
ai::after {
  content: "";
  position: absolute;
  bottom: -30px; left: -30px;
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(164,197,248,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

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

/* ---------- 通用 ---------- */
ai d { display: block; }
ai g { display: grid; }
ai l { display: block; font-weight: 700; font-size: 1.05em; color: var(--accent); margin-bottom: 8px; }
ai h { margin: 0; font-weight: 700; }
ai n { font-weight: 700; }
ai em { font-style: italic; color: var(--text-light); font-size: 0.92em; }
ai x { display: block; }

/* ---------- HUD ---------- */
ai .hud {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  padding: 10px 14px; margin-bottom: 14px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  border: 1px solid rgba(200,170,170,0.25);
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  font-size: 13.5px; color: var(--text-sub);
}
ai .hud t { display: inline-flex; align-items: center; gap: 4px; }
ai .hud t.heat { margin-left: auto; color: var(--accent); font-weight: 600; }
ai .hud t.heat b {
  font-size: 1.2em;
  background: linear-gradient(90deg, #ff5e7a, #f8a4c5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- 主角 ---------- */
ai q.hero {
  padding: 14px 18px; margin-bottom: 14px;
  background: #fffcfb; border-radius: 16px;
  border-left: 4px solid var(--accent2); box-shadow: var(--shadow);
}
ai q.hero g { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--text-sub); margin-bottom: 6px; }
ai q.hero x { font-size: 14px; color: var(--text-sub); margin-top: 2px; }
ai q.hero x.idlist { font-size: 13px; color: var(--text-light); padding: 8px 10px; background: rgba(248,164,197,0.06); border-radius: 8px; }

/* ---------- 角色卡片 ---------- */
ai z.girls { margin-bottom: 14px; }
ai z.girls > g { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 500px) { ai z.girls > g { grid-template-columns: 1fr 1fr; } }
ai z.girls c {
  padding: 10px 12px; background: #fffcfb; border-radius: 12px;
  border-left: 3px solid var(--c, #e0c0c0);
  box-shadow: 0 1px 4px rgba(0,0,0,0.03); transition: box-shadow 0.2s, transform 0.2s;
}
ai z.girls c:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
ai z.girls c n { display: block; font-weight: 700; font-size: 0.95em; color: var(--c, var(--accent)); }
ai z.girls c r { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
ai z.girls c s, ai z.girls c a { display: block; font-size: 13px; color: var(--text-main); line-height: 1.5; }
ai z.girls c k { display: block; font-size: 11.5px; color: var(--text-light); margin-top: 6px; padding-top: 6px; border-top: 1px dotted rgba(200,160,160,0.25); }

/* ---------- 群聊 / QQ 风格 ---------- */
ai u.chat {
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--bg-chat); border-radius: 16px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
ai u.chat > l { color: var(--accent); position: relative; z-index: 1; }
ai u.chat p.room { font-size: 13px; color: var(--text-light); margin-bottom: 12px; padding: 6px 10px; background: rgba(255,255,255,0.6); border-radius: 8px; text-align: center; }
ai u.chat m { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; position: relative; z-index: 1; }
/* 圆形头像 */
ai u.chat m w {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--c, #ccc); display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; line-height: 1; margin-top: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
ai u.chat m b { flex: 1; min-width: 0; }
ai u.chat m b n { display: block; font-size: 12px; color: var(--c, var(--accent)); font-weight: 600; margin-bottom: 2px; padding-left: 4px; }
/* 气泡 */
ai u.chat m b t {
  display: block; font-size: 14.5px; color: var(--text-main);
  background: var(--bg-bubble); padding: 8px 12px; border-radius: 12px; border-top-left-radius: 4px;
  position: relative; line-height: 1.6; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
/* 气泡三角 */
ai u.chat m b t::before {
  content: ""; position: absolute; left: -7px; top: 8px;
  width: 0; height: 0; border: 7px solid transparent; border-right-color: var(--bg-bubble); border-left: 0;
}

/* ---------- 悄悄话 ---------- */
ai v.whisper { padding: 14px 16px; margin-bottom: 14px; background: linear-gradient(135deg, #fdf7f9, #fef5f8); border-radius: 16px; box-shadow: var(--shadow); }
ai v.whisper > g { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 500px) { ai v.whisper > g { grid-template-columns: 1fr 1fr 1fr; } }
ai v.whisper w { padding: 10px 12px; background: #fffdfb; border-radius: 12px; border: 1px solid rgba(200,170,170,0.2); position: relative; }
ai v.whisper w::before { content: "“"; position: absolute; top: -6px; left: 8px; font-size: 26px; color: rgba(248,164,197,0.3); line-height: 1; }
ai v.whisper w h { font-weight: 700; color: var(--accent); margin-bottom: 4px; font-size: 0.95em; }
ai v.whisper w p { margin: 0; color: var(--text-main); line-height: 1.5; font-style: italic; }

/* ---------- 朋友圈 ---------- */
ai y.social { margin-bottom: 14px; }
ai y.social > g { display: grid; gap: 10px; }
ai y.social p { padding: 12px 14px; background: #fff; border-radius: 14px; border: 1px solid rgba(200,170,170,0.12); box-shadow: 0 1px 4px rgba(0,0,0,0.03); }
ai y.social p h { font-weight: 700; font-size: 0.95em; color: var(--accent); margin-bottom: 2px; }
ai y.social p d { font-size: 12px; color: var(--text-light); margin-bottom: 6px; }
ai y.social p q { display: block; font-size: 13.5px; color: var(--text-main); margin-bottom: 6px; padding-left: 8px !important; border-left: 2px solid rgba(248,164,197,0.3); }
ai y.social p r { font-size: 12.5px; color: var(--text-light); padding-left: 4px; margin-top: 4px; border-top: 1px dashed rgba(200,160,160,0.2); padding-top: 6px; }

/* ---------- 小剧场 ---------- */
ai o.theater { margin-bottom: 14px; }
ai o.theater > g { display: grid; gap: 10px; }
ai o.theater j { padding: 12px 14px; background: linear-gradient(135deg, #fff8f0, #fff0f5); border-radius: 14px; border: 1px solid rgba(200,170,170,0.12); box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
ai o.theater j h { font-weight: 700; color: var(--accent); font-size: 0.95em; margin-bottom: 4px; }
ai o.theater j n { font-size: 12px; color: var(--text-light); margin-bottom: 6px; background: rgba(255,255,255,0.5); display: inline-block; padding: 2px 8px; border-radius: 12px; }
ai o.theater j x { font-size: 13.5px; color: var(--text-main); line-height: 1.5; }

/* ---------- 记忆区 ---------- */
ai j.memory { padding: 14px 16px; margin-bottom: 14px; background: #fffcfb; border-radius: 16px; box-shadow: var(--shadow); }
ai j.memory h { font-size: 0.9em; font-weight: 700; color: #8b6b6b; margin: 8px 0 4px; }
ai j.memory f, ai j.memory r { display: grid; grid-template-columns: 0.5fr 1.2fr 0.8fr 1.5fr; gap: 6px; font-size: 13px; padding: 6px 4px; border-bottom: 1px solid rgba(200,170,170,0.15); color: var(--text-main); }
ai j.memory f { color: var(--text-light); font-weight: 600; border-bottom: 2px solid rgba(200,170,170,0.3); }
ai j.memory f b, ai j.memory r i { display: block; font-style: normal; font-weight: inherit; }

/* ---------- 行动推荐 ---------- */
ai k.actions { padding: 14px 16px; background: linear-gradient(135deg, #fef5f8, #fff0f3); border-radius: 16px; box-shadow: var(--shadow); }
ai k.actions > g { display: grid; gap: 6px; }
ai k.actions a { display: block; padding: 10px 14px; background: #fffcfb; border-radius: 12px; border: 1px solid rgba(248,164,197,0.2); color: var(--text-main); font-size: 14px; font-weight: 500; text-decoration: none; transition: all 0.2s; }
ai k.actions a:hover { background: linear-gradient(135deg, rgba(248,164,197,0.08) 0%, rgba(255,255,255,0.9) 100%); border-color: rgba(248,164,197,0.4); color: var(--accent); transform: translateX(3px); box-shadow: 0 2px 8px rgba(200,140,140,0.12); }

/* ---------- 响应式 ---------- */
@media (max-width: 400px) {
  ai { padding: 10px 8px 18px; }
  ai .hud { font-size: 12.5px; gap: 4px 6px; }
  ai j.memory f, ai j.memory r { font-size: 12px; gap: 3px; }
}