/* ═══════════════════════════════════════════
   自定义 <ai> 组件 —— 完全高亮可见性修复
   ═══════════════════════════════════════════ */

/* 根容器：强制亮色文字 */
ai {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13.5px;
  color: #f0f2f5 !important;          /* 基础亮白 */
  background: linear-gradient(180deg, #11151c 0%, #1a202c 100%);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #2d3748;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  line-height: 1.5;
}

/* 强制所有后代继承亮色（除特殊强调外） */
ai * {
  color: inherit !important;          /* 默认继承 #f0f2f5 */
}

/* -------- 保留并增强特殊颜色 -------- */
ai hd {
  color: #66d9ff !important;          /* 更亮的标题蓝 */
  background: rgba(0, 210, 255, 0.05);
  border-bottom: 2px solid #66d9ff;
  padding: 8px 10px;
  font-weight: bold;
  border-radius: 4px 4px 0 0;
  text-shadow: 0 0 8px rgba(102, 217, 255, 0.3);
  font-family: monospace;
}

ai b {
  color: #66d9ff !important;          /* 标签蓝 */
  margin-right: 4px;
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
}

ai details.saika b { color: #ff6699 !important; }  /* 角色粉 */
ai details.shiori b { color: #ffb3c6 !important; } /* 诗织粉 */

ai hl {
  color: #ffdd44 !important;          /* 亮金 */
  background: rgba(255, 204, 0, 0.15);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255, 204, 0, 0.4);
}

ai x {
  display: block;
  background: rgba(255,255,255,0.05);
  padding: 4px 12px;
  font-size: 12px;
  color: #d0d8e0 !important;           /* 亮灰白 */
  font-weight: bold;
  letter-spacing: 1px;
  border-top: 1px solid #2d3748;
}

ai d {
  display: block;
  padding: 6px 12px;
  border-bottom: 1px dashed #2d3748;
  color: #e8edf3 !important;           /* 正文亮白 */
}
ai d:last-of-type { border-bottom: none; }

ai d.hide {
  color: #b0b8c0 !important;           /* 隐蔽文字用中灰，但保持可读 */
  text-shadow: 0 0 4px #000, 0 0 8px rgba(0,0,0,0.6);
  transition: all 0.5s;
  cursor: crosshair;
}
ai d.hide:hover {
  color: #ffffff !important;
  text-shadow: 0 0 5px #66d9ff;
}

ai sec {
  display: block;
  margin: 8px 12px;
  padding: 10px;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,0.8), rgba(0,0,0,0.8) 2px, rgba(20,20,20,0.8) 2px, rgba(20,20,20,0.8) 4px);
  border-left: 3px solid #718096;
  color: #d0d8e0 !important;           /* 亮银灰 */
  font-family: monospace;
  font-size: 12px;
  cursor: help;
  transition: all 0.4s ease;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
ai sec b {
  color: inherit;
  display: block;
  margin-bottom: 4px;
}
ai sec:hover {
  color: #ffffff !important;
  border-left-color: #66d9ff;
  background: #111;
  text-shadow: 0 0 2px #66d9ff;
}

/* 聊天系统 */
ai chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(0,0,0,0.6);
}

ai sys {
  text-align: center;
  font-size: 11px;
  color: #b0c0d0 !important;           /* 亮灰系统消息 */
  padding: 4px 0;
}

ai msg {
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 85%;
  position: relative;
  font-size: 13px;
  color: #f0f2f5 !important;           /* 消息正文白 */
}
ai msg b {
  color: rgba(255,255,255,0.8) !important;
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
}
ai msg[m="m"] {
  align-self: flex-end;
  background: #2b6cb0;
  border: 1px solid #3182ce;
  border-bottom-right-radius: 0;
}
ai msg[m="n"] {
  align-self: flex-start;
  background: #2d3748;
  border: 1px solid #4a5568;
  border-bottom-left-radius: 0;
}
ai msg[m="sys"] {
  align-self: center;
  background: transparent;
  border: 1px dashed #ffdd44;
  color: #ffdd44 !important;
  max-width: 95%;
  text-align: center;
}
ai msg.s { border-color: #ffb3c6; }

/* 网格表格 */
ai g {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 4px;
}
ai r {
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 4px;
  color: #e8edf3 !important;
}
ai r:last-child { border-bottom: none; padding-bottom: 0; }
ai r[h] {
  border-bottom: 1px solid #66d9ff;
  padding-bottom: 6px;
  margin-bottom: 4px;
}
ai r[h] i {
  color: #66d9ff !important;
  font-weight: bold;
  font-size: 12px;
  font-style: normal;
}
ai i {
  flex: 1;
  font-style: normal;
  font-size: 12px;
  color: #d0d8e0 !important;
}
ai i:nth-child(1) { flex: 0 0 65px; color: #b0c0d0 !important; }
ai i:nth-child(2) { flex: 0 0 110px; }

/* 操作按键 */
ai act { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
ai k {
  display: block;
  padding: 10px 12px;
  background: linear-gradient(180deg, #2d3748, #1a202c);
  border: 1px solid #4a5568;
  border-radius: 6px;
  color: #e8edf3 !important;
  box-shadow: 0 3px 0 #000;
  transition: all 0.1s;
  cursor: pointer;
}
ai k:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #000;
  border-color: #66d9ff;
  color: #ffffff !important;
}

/* ---------- 外部状态栏（Token/模型信息）修复 ---------- */
.text-xs.font-mono.text-muted-foreground {
  color: rgba(235, 225, 215, 0.9) !important;  /* 暖白透亮 */
  background: rgba(255, 240, 230, 0.4) !important;
  padding: 2px 8px !important;
  border-radius: 10px !important;
  backdrop-filter: blur(2px) !important;
}

/* 进度条、按钮等其他元素不在此列，但已被继承覆盖 */
ai bar { /* 保持原有样式，不影响文字 */
  display: inline-block;
  width: 80px;
  height: 6px;
  background: #2d3748;
  border-radius: 3px;
  position: relative;
  margin: 0 8px;
  vertical-align: middle;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
ai bar::before {
  content: "";
  position: absolute;
  left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, #66d9ff, #3399ff);
  border-radius: 3px;
}
ai details.saika bar::before { background: linear-gradient(90deg, #ff6699, #ff7733); }
ai details.shiori bar::before { background: linear-gradient(90deg, #ffb3c6, #ff8da1); }
ai bar.w::before { background: linear-gradient(90deg, #ffdd44, #ff5500); }
ai bar[v="1"]::before { width: 10%; } ai bar[v="2"]::before { width: 20%; }
ai bar[v="3"]::before { width: 30%; } ai bar[v="4"]::before { width: 40%; }
ai bar[v="5"]::before { width: 50%; } ai bar[v="6"]::before { width: 60%; }
ai bar[v="7"]::before { width: 70%; } ai bar[v="8"]::before { width: 80%; }
ai bar[v="9"]::before { width: 90%; } ai bar[v="10"]::before{ width: 100%;}