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

/* ===== 樱夜通讯 · 状态栏主题CSS v2（修复文字重叠） ===== */
/* 基于 <ai> 容器隔离，无全局污染，移动端优先 */

ai {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 14px 20px;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7; /* 加大行距 */
  color: #e0e0e0;
  background: #0f0f1a;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  border-radius: 0;
  word-break: break-word; /* 防止长文本溢出 */
}

/* ----- 折叠面板（details/summary）----- */
ai details {
  display: block;
  margin-bottom: 12px; /* 加大间距 */
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,158,158,0.15);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.3s ease, background 0.2s ease;
}
ai details:hover {
  background: rgba(255,255,255,0.055);
  box-shadow: 0 0 18px rgba(255,158,158,0.1);
  border-color: rgba(255,158,158,0.3);
}
ai details[open] {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,158,158,0.4);
}

ai summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px; /* 加大内边距 */
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffd180;
  cursor: pointer;
  user-select: none;
  background: rgba(255,158,158,0.04);
  border-left: 4px solid #ff9e9e;
  list-style: none;
  transition: background 0.2s ease, color 0.2s ease;
}
ai summary::-webkit-details-marker {
  display: none;
}
ai summary::before {
  content: "▶";
  display: inline-block;
  font-size: 10px;
  color: #ff9e9e;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
ai details[open] > summary::before {
  transform: rotate(90deg);
}
ai summary:hover {
  background: rgba(255,158,158,0.1);
  color: #ffe0b2;
}

/* 面板内容区 - 加大内边距 */
ai details > :not(summary) {
  padding: 14px 18px 18px; /* 加大内边距 */
}

/* ----- 字段行（核心修复：block显示）----- */
ai d {
  display: block; /* 关键修复：让每个字段独立成行 */
  color: #e0e0e0;
  font-size: 14.5px;
  line-height: 1.8; /* 加大行距 */
  margin-bottom: 6px; /* 字段间距 */
  word-break: break-word;
}
ai d:last-of-type {
  margin-bottom: 0;
}

ai f {
  display: inline;
  font-weight: 700;
  font-size: 14px;
  color: #ffb3b3;
  margin-right: 4px;
  white-space: nowrap;
}
ai f::after {
  content: "：";
}

/* 段落包裹（多行信息块） */
ai p {
  display: block;
  margin: 10px 0; /* 加大段落间距 */
  line-height: 1.7;
  word-break: break-word;
}
ai p[t="npc"] {
  margin: 10px 0;
  padding: 10px 0 10px 14px;
  border-left: 2px dashed rgba(255,158,158,0.2);
}

/* NPC名称高亮 */
ai n {
  display: inline;
  font-weight: 700;
  font-size: 16px;
  color: #ffd180;
  margin-right: 6px;
  letter-spacing: 0.02em;
}

/* 数值/年龄标识 */
ai v {
  display: inline;
  font-size: 13.5px;
  color: #a0a0b0;
  margin-left: 4px;
}
ai v[g] {
  color: #ffd180;
  font-weight: 600;
  font-size: 14px;
}

/* 趋势备注 */
ai em {
  display: block;
  font-style: normal;
  font-size: 13px;
  color: #9e9eb0;
  margin-top: 4px;
  padding-left: 6px;
}

/* ----- 列表系统 ----- */
ai l {
  display: block;
  margin: 8px 0 10px 0;
  padding-left: 4px;
  list-style: none;
}
ai l[t="ol"] {
  counter-reset: ol-rank;
}
ai l[t="ol"] > i {
  display: list-item;
  list-style: none;
  counter-increment: ol-rank;
}
ai l[t="ol"] > i::before {
  content: counter(ol-rank) ". ";
  font-weight: 700;
  color: #ff9e9e;
}

ai i {
  display: list-item;
  list-style: disc;
  margin-left: 1.6em;
  padding: 6px 0; /* 加大列表项间距 */
  font-size: 14px;
  line-height: 1.7;
  color: #d5d5e0;
}
ai i t {
  font-weight: 700;
  color: #ffb3b3;
  margin-right: 4px;
}
ai i em {
  display: inline;
  font-size: 13px;
  color: #9e9eb0;
}

/* ----- 分隔线 ----- */
ai hr {
  display: block;
  height: 1px;
  margin: 16px 0;
  border: none;
  background: linear-gradient(90deg, transparent, rgba(255,158,158,0.35), transparent);
}

/* ----- 对话/引用气泡 ----- */
ai q {
  display: block;
  margin: 8px 0 8px 12px;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: #dcdce4;
  background: rgba(255,255,255,0.035);
  border-left: 4px solid #ff9e9e;
  border-radius: 0 6px 6px 0;
  word-break: break-word;
}
ai q[t="chat"] {
  border-left-color: #ffab40;
  background: rgba(255,171,64,0.06);
}
ai q[t="forum"] {
  border-left-color: #80cbc4;
  background: rgba(128,203,196,0.06);
}
ai q b {
  font-weight: 700;
  color: #ffe0b2;
  margin-right: 4px;
}

ai d[t="chat"],
ai d[t="forum"] {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  padding: 6px 12px;
  background: rgba(255,158,158,0.06);
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  color: #ffb74d;
}
ai d[t="forum"] {
  background: rgba(128,203,196,0.06);
  color: #80cbc4;
}

/* ----- 表格系统（日程/记忆）----- */
ai g {
  display: table;
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}
ai r {
  display: table-row;
}
ai c {
  display: table-cell;
  padding: 8px 10px; /* 加大表格内边距 */
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: top;
}
ai c[h] {
  font-weight: 700;
  font-size: 13px;
  color: #ffd180;
  background: rgba(255,158,158,0.08);
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,158,158,0.2);
}

/* 手机端表格允许滑动 */
ai details[t="5"] > :not(summary),
ai details[t="9"] > :not(summary) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ----- 事件卡片（小剧场/随机事件）----- */
ai d[s="theatre"],
ai d[s="event"] {
  display: block;
  margin: 8px 0 14px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.025);
  border-radius: 8px;
  border: 1px solid rgba(255,158,158,0.1);
  font-size: 14px;
  line-height: 1.7;
  color: #d5d5e0;
}
ai d[s="event"] {
  border-left: 4px solid #ff9e9e;
}
ai d[s="theatre"] t,
ai d[s="event"] t {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: #ffb74d;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

/* ----- 好感度进度条（纯CSS装饰）----- */
ai i v[g] {
  position: relative;
}
ai i v[g]::after {
  content: "";
  display: inline-block;
  width: 40px;
  height: 4px;
  margin-left: 8px;
  vertical-align: middle;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  background-image: linear-gradient(90deg, #ff9e9e 60%, #ffd180 100%);
}

/* ----- 特殊数字∞的微光动画 ----- */
@keyframes softGlow {
  0%, 100% { text-shadow: 0 0 4px rgba(255,158,158,0.4); }
  50% { text-shadow: 0 0 10px rgba(255,158,158,0.8), 0 0 16px rgba(255,210,128,0.5); }
}
ai i v[g]:nth-of-type(3),
ai i v[g]:nth-of-type(8) {
  animation: softGlow 2.5s ease-in-out infinite;
}

/* ----- 响应式微调（窄屏优化）----- */
@media (max-width: 480px) {
  ai {
    padding: 6px 8px 16px;
    font-size: 14px;
  }
  ai summary {
    padding: 10px 14px;
    font-size: 15px;
  }
  ai details > :not(summary) {
    padding: 10px 14px 14px;
  }
  ai d {
    font-size: 14px;
  }
  ai i {
    margin-left: 1.2em;
    font-size: 13.5px;
  }
}