css
/* === 末班列车 · 聊天框主题 v2（跨端稳定版） === */

/* 隐藏可能存在的顶部色条（保留你的原规则） */
[class*="bg-[#F1CBCB]"],
[class*="bg-[#c9e9]"] {
  display: none !important;
}

/* ============ 主容器：直接锚定 markdown-body ============ */
/* 这样无论外层 bg-gray-100/90 还是 App 端任何变体类，都能命中 */
.markdown-body {
  background: linear-gradient(145deg, #1a1525 0%, #1e1832 40%, #16132a 100%) !important;
  color: #f0ecf6 !important;
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-size: 14.5px !important;
  line-height: 1.75 !important;
  padding: 14px 14px 16px !important;
  border-radius: 4px !important;
  border: 1px solid #3a2a5a !important;
  box-shadow:
    0 0 0 1px #2a1f45 inset,
    0 0 0 3px #1a1525,
    0 0 0 4px #3a2a5a,
    0 4px 20px rgba(100, 60, 160, 0.25) !important;
  position: relative !important;
  isolation: isolate !important;
  overflow: hidden !important;
  text-shadow: 0 0 1px rgba(0,0,0,0.4) !important;
}

/* 顶部虚线"票根撕边" */
.markdown-body::before {
  content: '' !important;
  position: absolute !important;
  top: 0; left: 0; right: 0;
  height: 4px !important;
  background-image: repeating-linear-gradient(
    90deg,
    #3a2a5a 0 8px,
    #2a1f45 8px 12px,
    #4a3570 12px 14px,
    #2a1f45 14px 18px
  ) !important;
  z-index: 2 !important;
  pointer-events: none !important;
}

/* 右下角列车水印 */
.markdown-body::after {
  content: '' !important;
  position: absolute !important;
  bottom: 8px !important;
  right: 8px !important;
  width: 44px !important;
  height: 20px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 20'%3E%3Crect x='2' y='3' width='32' height='11' rx='2' fill='none' stroke='%236b4f9c' stroke-width='0.7'/%3E%3Crect x='5' y='5' width='6' height='5' rx='1' fill='%236b4f9c' opacity='0.3'/%3E%3Crect x='13' y='5' width='6' height='5' rx='1' fill='%236b4f9c' opacity='0.3'/%3E%3Crect x='21' y='5' width='6' height='5' rx='1' fill='%236b4f9c' opacity='0.3'/%3E%3Ccircle cx='9' cy='16.5' r='2' fill='none' stroke='%236b4f9c' stroke-width='0.7'/%3E%3Ccircle cx='20' cy='16.5' r='2' fill='none' stroke='%236b4f9c' stroke-width='0.7'/%3E%3Ccircle cx='30' cy='16.5' r='2' fill='none' stroke='%236b4f9c' stroke-width='0.7'/%3E%3Cline x1='2' y1='14.5' x2='34' y2='14.5' stroke='%236b4f9c' stroke-width='0.5' opacity='0.5'/%3E%3Crect x='34' y='4' width='4' height='10' rx='1.5' fill='%236b4f9c' opacity='0.3'/%3E%3C/svg%3E") !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  opacity: 0.45 !important;
  z-index: 0 !important;
  pointer-events: none !important;
}

/* ============ 正文文本（关键：排除 inline color 内联样式） ============ */
.markdown-body p,
.markdown-body li,
.markdown-body td,
.markdown-body div {
  color: #f0ecf6 !important;
  position: relative;
  z-index: 1;
}

/* 不覆盖任何 inline color 设置的 span —— 保护你的男女对话颜色 */
.markdown-body span:not([style*="color"]) {
  color: inherit !important;
}

/* 男性角色对话保护（蓝色在深底上偏暗，加亮 + 阴影） */
.markdown-body span[style*="color: blue"],
.markdown-body span[style*="color:blue"] {
  color: #6ea8ff !important;
  text-shadow: 0 0 4px rgba(110, 168, 255, 0.35) !important;
  font-weight: 500 !important;
}

/* 女性角色对话保护（粉色 #FF007F 在深底上可读，加柔光） */
.markdown-body span[style*="#FF007F"],
.markdown-body span[style*="#ff007f"] {
  color: #ff5fa8 !important;
  text-shadow: 0 0 4px rgba(255, 0, 127, 0.4) !important;
  font-weight: 500 !important;
}

/* ============ 强调 / 标题 / 引用 ============ */
.markdown-body strong {
  color: #d4b8ff !important;
  font-weight: 700 !important;
}
.markdown-body em {
  color: #c8b8e0 !important;
}
.markdown-body a {
  color: #a78bfa !important;
  text-decoration: underline dotted !important;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: #e8dcff !important;
  font-weight: 700 !important;
  border-bottom: 1px dashed #4a3570 !important;
  padding-bottom: 4px !important;
}

.markdown-body blockquote {
  border-left: 3px solid #6b4f9c !important;
  background: rgba(74, 53, 112, 0.2) !important;
  color: #d8c8f0 !important;
  padding: 8px 12px !important;
  border-radius: 0 6px 6px 0 !important;
  margin: 8px 0 !important;
}

.markdown-body ul,
.markdown-body ol {
  color: #f0ecf6 !important;
  padding-left: 1.4em !important;
}

.markdown-body hr {
  border: none !important;
  border-top: 1px dashed #4a3570 !important;
  opacity: 0.7 !important;
  margin: 10px 0 !important;
}

/* ============ 行内代码 / 代码块 ============ */
.markdown-body code:not(pre code) {
  background: rgba(74, 53, 112, 0.35) !important;
  color: #e8d4ff !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  border: 1px solid rgba(120, 90, 170, 0.4) !important;
  font-size: 0.92em !important;
}
.markdown-body pre {
  background: #f5f2f9 !important;
  border: 1px solid #d8d0e8 !important;
  border-radius: 8px !important;
  padding: 10px !important;
}
.markdown-body pre code {
  color: #1a1525 !important;
  background: transparent !important;
  border: none !important;
  text-shadow: none !important;
}

/* ============ details ============ */
.markdown-body details {
  border: 1px solid #4a3570 !important;
  border-radius: 6px !important;
  background: rgba(26, 21, 37, 0.5) !important;
  padding: 6px 10px !important;
  margin: 6px 0 !important;
}
.markdown-body details summary {
  color: #d4b8ff !important;
  cursor: pointer !important;
  font-weight: 600 !important;
}

/* ============ 表格 ============ */
.markdown-body table {
  border-collapse: collapse !important;
  width: 100% !important;
}
.markdown-body table th {
  background: rgba(74, 53, 112, 0.35) !important;
  color: #e8dcff !important;
  border: 1px solid #4a3570 !important;
  padding: 6px 8px !important;
}
.markdown-body table td {
  border: 1px solid #3a2a5a !important;
  color: #f0ecf6 !important;
  padding: 6px 8px !important;
}

/* ============ UI 元素 ============ */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary {
  color: #b8a8d8 !important;
  transition: color 0.2s ease !important;
}
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary:hover {
  color: #d4b8ff !important;
}
.MuiTypography-root.MuiTypography-body2.css-6c0gf2 {
  color: #8878a8 !important;
}
.text-orange-500 {
  color: #c8a8ff !important;
}

/* ============ 移动端适配 ============ */
@media (max-width: 480px) {
  .markdown-body {
    font-size: 14px !important;
    line-height: 1.7 !important;
    padding: 12px 12px 14px !important;
  }
  .markdown-body::after {
    width: 36px !important;
    height: 16px !important;
    bottom: 6px !important;
    right: 6px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .markdown-body { transition: none !important; }
}