/* ═══ 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平台按钮组保护（自动注入 — 防止按钮消失）═══
   原理：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;
}

/* ===== 可选：局部作用域（宝可梦配色） ===== */
details.pokemon { --pk-red:#EE1C24; --pk-white:#ffffff; --pk-black:#222; --pk-yellow:#FFD400; --pk-blue:#2A75BB; }

/* ===== 全局安全默认（未加 .pokemon 也能用配色）===== */
details:not(.pokemon){ --pk-red:#EE1C24; --pk-white:#ffffff; --pk-black:#222; --pk-yellow:#FFD400; --pk-blue:#2A75BB; }

/* 容器外观（卡片感） */
details {
  margin: 0.6rem 0;
  border-radius: 14px;
  border: 1px solid color-mix(in oklab, var(--pk-black) 15%, transparent);
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--pk-white) 0%, var(--pk-yellow) 5%) 0%, var(--pk-white) 100%);
  box-shadow:
    0 1px 0 rgba(0,0,0,.05),
    0 6px 18px rgba(0,0,0,.06);
  overflow: hidden;
}

/* summary：保留原生 marker，只做美化 */
details > summary {
  display: list-item;
  list-style: revert;
  cursor: pointer;
  position: relative;

  padding: 0.9rem 2.2rem 0.9rem 1.15rem;
  font-weight: 700;

  /* 宝可梦风背景 */
  background:
    linear-gradient(180deg,
      color-mix(in oklab, var(--pk-red) 18%, var(--pk-white) 82%) 0 46%,
      color-mix(in oklab, var(--pk-black) 22%, transparent) 46% 54%,
      color-mix(in oklab, var(--pk-white) 96%, var(--pk-blue) 4%) 54% 100%);
  background-size: 100% 220%;
  background-position: 50% 80%;

  border-bottom: 1px solid color-mix(in oklab, var(--pk-black) 12%, transparent);
  transition: background-position .35s ease, transform .18s ease,
              box-shadow .25s ease, color .25s ease, border-color .25s ease;
}

details > summary:hover {
  transform: translateY(-1px);
  background-position: 50% 60%;
  box-shadow:
    0 2px 0 rgba(0,0,0,.05),
    0 10px 24px rgba(0,0,0,.08);
}

details > summary:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--pk-blue) 60%, var(--pk-white) 40%);
  outline-offset: 3px;
  border-radius: 12px;
}

details[open] > summary {
  background-position: 50% 45%;
  border-bottom-color: color-mix(in oklab, var(--pk-black) 18%, transparent);
}

/* 展开时的整体外观 */
details[open] {
  border-color: color-mix(in oklab, var(--pk-black) 18%, transparent);
  box-shadow:
    0 1px 0 rgba(0,0,0,.06),
    0 12px 28px rgba(0,0,0,.08);
}
details[open] > *:not(summary) {
  padding: 0.9rem 1.15rem 1.05rem;
}

/* 精灵球装饰 */
details > summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.85rem;
  width: 18px;
  height: 18px;
  transform: translateY(-50%) rotate(0deg);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--pk-white) 0 22%, var(--pk-black) 22% 30%, var(--pk-white) 30% 38%, transparent 39%),
    linear-gradient(180deg, var(--pk-red) 0 50%, var(--pk-white) 50% 100%);
  box-shadow:
    inset 0 0 0 1px color-mix(in oklab, var(--pk-black) 30%, transparent),
    0 1px 0 rgba(0,0,0,.06);
  transition: transform .35s ease;
  pointer-events: none;
}
details > summary:hover::after { transform: translateY(-50%) rotate(12deg) scale(1.06); }
details[open] > summary::after { transform: translateY(-50%) rotate(180deg) scale(1.06); }

/* 黄色辉光 */
details > summary::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(255,212,0,0);
  transition: box-shadow .25s ease;
}
details > summary:hover::before {
  box-shadow:
    0 0 0 2px color-mix(in oklab, var(--pk-yellow) 65%, transparent),
    0 0 22px 0 color-mix(in oklab, var(--pk-yellow) 35%, transparent);
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
  details, details > summary, details > summary::after, details > summary::before {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ===== 阅读体验统一（参考截图）===== */

/* 基础：统一字体与排版 */
:where(h1, p, details, details > summary, details[open] > *:not(summary)) {
  font-family: "Microsoft YaHei", "Arial", sans-serif !important;
  color: #333 !important;
  letter-spacing: 0.5px;
}

/* 段落 */
p {
  font-size: 14px !important;
  line-height: 20px !important;
  margin-top: 20px !important;
  margin-bottom: 16px !important;
}

/* 标题 */
h1 {
  font-size: 1.0em !important;
  line-height: 1.3 !important;
  font-weight: bold !important;
  margin-top: 1.6em !important;
  margin-bottom: 1em !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  padding-left: 15px !important;
  padding-right: 15px !important;
}

/* summary 文字 */
details > summary {
  font-size: 14px !important;
  line-height: 20px !important;
  font-weight: 700;
}

/* 展开后的内容 */
details[open] > *:not(summary) {
  font-size: 14px !important;
  line-height: 20px !important;
}

/* 移动端稍大字体 */
@media (max-width: 480px) {
  p,
  details > summary,
  details[open] > *:not(summary) {
    font-size: 15px !important;
    line-height: 22px !important;
  }
}

/* 隐藏原有的闪烁点 */
.flex.items-center.justify-center.size-6 > .flex.gap-2 {
  display: none !important;
}

/* 容器统一为居中 flex 布局 */
div:has(> .flex.items-center.justify-center.size-6 > .flex.gap-2) {
  width: 100% !important;
  height: auto !important;
  min-height: 20px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

/* 前置：精灵球（纯 CSS） */
div:has(> .flex.items-center.justify-center.size-6 > .flex.gap-2)::before {
  content: '' !important;
  width: 20px !important;
  height: 20px !important;
  margin-right: 8px !important;
  display: inline-block !important;
  border-radius: 50% !important;
  border: 2px solid #111 !important;
  /* 精灵球配色和结构：上红下白 + 中间黑带 + 中心按钮 */
  background:
    radial-gradient(circle at 50% 50%,
      #fff 0 4px,       /* 中心白点 */
      #111 4px 6px,     /* 黑色外环（按钮边） */
      #fff 6px 7px,     /* 按钮白圈 */
      transparent 7px) center/100% 100% no-repeat,
    linear-gradient(#111, #111) center/100% 2px no-repeat, /* 中间黑带 */
    linear-gradient(to bottom, #e63946 0 50%, #fff 50% 100%); /* 上半红下半白 */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -1px 0 rgba(0,0,0,.08);
  animation: poke-spin 2s linear infinite !important;
}

/* 后置：提示文字 */
div:has(> .flex.items-center.justify-center.size-6 > .flex.gap-2)::after {
  content: '正在为你搜索该世界的宝可梦～' !important;
  font-family: "Microsoft YaHei", "Arial", sans-serif !important;
  font-style: italic !important;
  font-size: 14px !important;
  color: rgba(0,0,0,.6) !important;
}

/* 旋转动画 */
@keyframes poke-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}