/* ====== 基础样式与字体定义 ====== */
:root {
  --primary-blue: #1e3a5f;
  --secondary-blue: #2a5f91;
  --light-blue: #e6f0fa;
  --border-blue: rgba(40, 100, 160, 0.5);
  --shadow-light: rgba(0, 0, 0, 0.12);
}

* {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif !important;
  box-sizing: border-box !important;
}

/* ====== 回复格式总体容器样式 ====== */
/* 假设回复内容包裹在一个具有特定类的容器内，如果没有，此样式将作为回退 */
.reply-container {
  background: transparent !important;
  color: var(--primary-blue) !important;
  line-height: 1.6 !important;
}

/* ====== 时间/位置代码块样式 ====== */
/* 匹配 ```Python 代码块 */
pre code.language-python,
pre code[class*="python"] {
  background: linear-gradient(180deg, #ffffff 0%, #eef5fa 100%) !important;
  border: 2px solid var(--border-blue) !important;
  border-radius: 10px !important;
  padding: 12px !important;
  display: block !important;
  color: var(--primary-blue) !important;
  font-weight: bold !important;
  font-family: Consolas, "Courier New", monospace !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
  margin: 8px 0 !important;
}

/* ====== DETAILS / SUMMARY 通用样式 (对应所有可折叠区块) ====== */
details {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 2px solid rgba(50, 100, 180, 0.4) !important;
  border-radius: 10px !important;
  margin: 12px 0 !important;
  padding: 5px !important;
  transition: all 0.2s ease !important;
}
details[open] {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(50, 100, 180, 0.6) !important;
}

summary {
  cursor: pointer !important;
  padding: 8px 10px !important;
  font-weight: bold !important;
  color: #1c4a80 !important;
  user-select: none !important;
  border-radius: 6px !important;
  background: rgba(248, 251, 255, 0.8) !important;
}
summary:hover {
  background-color: rgba(100, 155, 215, 0.15) !important;
}
summary::-webkit-details-marker {
  display: none !important;
}
/* 为不同区块的summary添加个性化图标 */
details > summary:first-of-type:before {
  margin-right: 8px !important;
  font-size: 1.1em !important;
}
/* “你的信息” */
details > summary:contains("你的信息")::before {
  content: "👤 " !important;
}
/* “其他角色信息” */
details > summary:contains("其他角色信息")::before {
  content: "👥 " !important;
}
/* “好感度” */
details > summary:contains("好感度")::before {
  content: "❤ " !important;
}
/* “行动建议” */
details > summary:contains("行动建议")::before {
  content: "💡 " !important;
}
/* “记忆区” */
details > summary:contains("记忆区")::before {
  content: "🧠 " !important;
}
/* 内部嵌套角色信息 */
details details > summary::before {
  content: "👤 " !important;
}

/* ====== 详细信息区块内部样式 ====== */
/* 所有details内部的markdown代码块 */
details .language-markdown,
details pre code {
  background: rgba(220, 235, 255, 0.8) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(40, 100, 160, 0.3) !important;
  padding: 10px !important;
  color: #163d63 !important;
  font-family: Consolas, "Courier New", monospace !important;
  font-size: 0.95em !important;
  display: block !important;
  white-space: pre-wrap !important;
  margin: 8px 0 !important;
}
/* 标题（如 #你的信息） */
details .language-markdown h1,
details pre code:first-line {
  color: #1c4a80 !important;
  font-weight: bold !important;
  margin-bottom: 8px !important;
  display: block !important;
}
/* 列表项样式 */
details .language-markdown ul,
details .language-markdown ol {
  border: 1px solid rgba(40, 100, 160, 0.2) !important;
  border-radius: 6px !important;
  padding: 8px 8px 8px 24px !important;
  margin: 6px 0 !important;
  background: rgba(240, 248, 255, 0.5) !important;
}
details .language-markdown li {
  padding: 2px 4px !important;
  margin: 2px 0 !important;
  border-radius: 4px !important;
  transition: background-color 0.3s ease !important;
}
details .language-markdown li:hover {
  background-color: rgba(100, 155, 215, 0.15) !important;
}

/* ====== 好感度区块特殊样式 ====== */
details > summary:contains("好感度") + .language-markdown {
  background: rgba(255, 230, 240, 0.7) !important; /* 粉色系背景 */
  border-color: rgba(200, 80, 120, 0.25) !important;
}

/* ====== 行动建议区块特殊样式 ====== */
details > summary:contains("行动建议") + .language-markdown {
  background: rgba(255, 250, 220, 0.7) !important; /* 淡黄色背景 */
  border-color: rgba(180, 160, 60, 0.25) !important;
}
/* 行动建议选项 */
details > summary:contains("行动建议") + .language-markdown ul {
  border-color: rgba(180, 160, 60, 0.4) !important;
}
details > summary:contains("行动建议") + .language-markdown li:hover {
  background-color: rgba(255, 225, 100, 0.3) !important;
  cursor: pointer !important;
}

/* ====== 记忆区区块特殊样式 ====== */
details > summary:contains("记忆区") + .language-markdown {
  background: rgba(245, 240, 255, 0.7) !important; /* 淡紫色背景 */
  border-color: rgba(120, 80, 180, 0.25) !important;
  max-height: 250px !important;
  overflow-y: auto !important;
}
/* 记忆区滚动条 */
details > summary:contains("记忆区") + .language-markdown::-webkit-scrollbar {
  width: 8px !important;
}
details > summary:contains("记忆区") + .language-markdown::-webkit-scrollbar-track {
  background: rgba(200, 220, 240, 0.5) !important;
  border-radius: 4px !important;
}
details > summary:contains("记忆区") + .language-markdown::-webkit-scrollbar-thumb {
  background-color: #2a5f91 !important;
  border-radius: 4px !important;
}

/* ====== 移动端适配 ====== */
@media (max-width: 480px) {
  details {
    padding: 4px !important;
    margin: 8px 0 !important;
    border-radius: 8px !important;
  }
  summary {
    padding: 6px 8px !important;
    font-size: 0.95em !important;
  }
  details .language-markdown,
  details pre code {
    padding: 8px !important;
    font-size: 0.9em !important;
  }
  details > summary:contains("记忆区") + .language-markdown {
    max-height: 200px !important;
  }
}

/* ====== 保留原CSS中的部分通用美观样式，作为增强 ====== */
/* 优雅的渐变背景（用于可能需要突出显示的区域） */
.highlight-gradient {
  background: linear-gradient(180deg, #f8fbff 0%, #e6f0fa 100%) !important;
  border: 2px solid var(--border-blue) !important;
  border-radius: 12px !important;
  box-shadow: 0 3px 10px var(--shadow-light) !important;
  padding: 12px !important;
}

/* 代码内联样式 */
:not(pre) > code {
  background: rgba(220, 235, 255, 0.8) !important;
  border-radius: 4px !important;
  border: 1px solid rgba(40, 100, 160, 0.3) !important;
  padding: 2px 4px !important;
  color: #163d63 !important;
  font-family: Consolas, "Courier New", monospace !important;
  font-size: 0.9em !important;
}