/* ===== 梧桐街信函 · 聊天框美化 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Ma+Shan+Zheng&display=swap');
.markdown-body{
  position:relative;
  font-family:'Noto Serif SC','Songti SC',serif !important;
  color:hsl(25,40%,18%) !important;
  background:
    radial-gradient(ellipse at top left,rgba(180,140,80,.08),transparent 55%),
    radial-gradient(ellipse at bottom right,rgba(120,60,20,.08),transparent 55%),
    repeating-linear-gradient(95deg,rgba(120,80,40,.025) 0,rgba(120,80,40,.025) 1px,transparent 1px,transparent 5px),
    linear-gradient(135deg,hsl(38,38%,93%),hsl(36,32%,87%)) !important;
  border:none !important;
  border-radius:8px !important;
  padding:38px 30px 30px !important;
  margin:14px 0 !important;
  box-shadow:
    0 0 0 1px hsl(40,55%,55%),
    0 0 0 4px hsl(38,38%,93%),
    0 0 0 5px hsl(40,55%,55%),
    0 0 0 7px rgba(0,0,0,.04),
    inset 0 0 60px rgba(140,80,30,.08),
    0 8px 32px rgba(40,20,8,.25) !important;
  background-clip:padding-box !important;
  letter-spacing:.02em !important;
  line-height:1.95 !important;
  overflow:visible !important;
}
/* 花纹边框 - 顶部底部 */
.markdown-body::before{
  content:'';
  position:absolute;
  left:14px;right:14px;top:14px;height:14px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 14' preserveAspectRatio='xMidYMid'><g fill='none' stroke='%23a87a3a' stroke-width='1' opacity='.7'><path d='M0 7 Q15 1 30 7 T60 7 T90 7 T120 7 T150 7 T180 7 T210 7 T240 7'/><circle cx='30' cy='7' r='1.2' fill='%23a87a3a'/><circle cx='90' cy='7' r='1.2' fill='%23a87a3a'/><circle cx='150' cy='7' r='1.2' fill='%23a87a3a'/><circle cx='210' cy='7' r='1.2' fill='%23a87a3a'/></g></svg>");
  background-repeat:repeat-x;
  pointer-events:none;
  z-index:2;
}
.markdown-body::after{
  content:'';
  position:absolute;
  left:14px;right:14px;bottom:14px;height:14px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 14' preserveAspectRatio='xMidYMid'><g fill='none' stroke='%23a87a3a' stroke-width='1' opacity='.7'><path d='M0 7 Q15 13 30 7 T60 7 T90 7 T120 7 T150 7 T180 7 T210 7 T240 7'/><circle cx='30' cy='7' r='1.2' fill='%23a87a3a'/><circle cx='90' cy='7' r='1.2' fill='%23a87a3a'/><circle cx='150' cy='7' r='1.2' fill='%23a87a3a'/><circle cx='210' cy='7' r='1.2' fill='%23a87a3a'/></g></svg>");
  background-repeat:repeat-x;
  pointer-events:none;
  z-index:2;
}
/* 四角梧桐叶装饰 */
.markdown-body > :first-child{position:relative}
.markdown-body > :first-child::before{
  content:'';
  position:absolute;
  top:-26px;left:-14px;
  width:54px;height:54px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'><g transform='rotate(-20 30 30)'><path d='M30 6 C18 14 8 32 14 48 C18 56 28 58 30 54 C32 58 42 56 46 48 C52 32 42 14 30 6 Z M30 6 L30 54' fill='%23a86a2a' stroke='%23663812' stroke-width='1' opacity='.78'/></g></svg>");
  background-size:contain;
  background-repeat:no-repeat;
  pointer-events:none;
  z-index:3;
  filter:drop-shadow(0 2px 3px rgba(60,30,8,.25));
}
.markdown-body > :first-child::after{
  content:'';
  position:absolute;
  top:-22px;right:-12px;
  width:46px;height:46px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'><g transform='rotate(35 30 30)'><path d='M30 8 C20 14 12 28 16 42 C20 54 28 56 30 52 C32 56 40 54 44 42 C48 28 40 14 30 8 Z' fill='%23c08438' stroke='%23734018' stroke-width='1' opacity='.7'/></g></svg>");
  background-size:contain;
  background-repeat:no-repeat;
  pointer-events:none;
  z-index:3;
  filter:drop-shadow(0 2px 3px rgba(60,30,8,.25));
}
.markdown-body > :last-child{position:relative}
.markdown-body > :last-child::before{
  content:'';
  position:absolute;
  bottom:-22px;left:-12px;
  width:44px;height:44px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'><g transform='rotate(160 30 30)'><path d='M30 8 C20 14 12 28 16 42 C20 54 28 56 30 52 C32 56 40 54 44 42 C48 28 40 14 30 8 Z' fill='%23b87836' stroke='%236d3a14' stroke-width='1' opacity='.72'/></g></svg>");
  background-size:contain;
  background-repeat:no-repeat;
  pointer-events:none;
  z-index:3;
  filter:drop-shadow(0 2px 3px rgba(60,30,8,.25));
}
.markdown-body > :last-child::after{
  content:'';
  position:absolute;
  bottom:-26px;right:-14px;
  width:54px;height:54px;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'><g transform='rotate(210 30 30)'><path d='M30 6 C18 14 8 32 14 48 C18 56 28 58 30 54 C32 58 42 56 46 48 C52 32 42 14 30 6 Z M30 6 L30 54' fill='%23a86a2a' stroke='%23663812' stroke-width='1' opacity='.78'/></g></svg>");
  background-size:contain;
  background-repeat:no-repeat;
  pointer-events:none;
  z-index:3;
  filter:drop-shadow(0 2px 3px rgba(60,30,8,.25));
}
/* 标题 */
.markdown-body h1,.markdown-body h2,.markdown-body h3{
  font-family:'Ma Shan Zheng','Noto Serif SC',serif !important;
  color:hsl(5,75%,38%) !important;
  letter-spacing:.08em !important;
  border-bottom:1px dashed hsl(40,45%,55%) !important;
  padding-bottom:6px !important;
}
/* 强调 */
.markdown-body strong{color:hsl(5,80%,40%) !important;font-weight:600}
.markdown-body em{color:hsl(25,55%,32%) !important}
/* 引用 */
.markdown-body blockquote{
  border-left:3px solid hsl(5,75%,48%) !important;
  background:linear-gradient(90deg,hsl(38,40%,90%),hsl(38,38%,94%)) !important;
  padding:10px 16px !important;
  margin:12px 0 !important;
  border-radius:0 4px 4px 0 !important;
  color:hsl(25,40%,28%) !important;
  box-shadow:0 1px 4px rgba(60,30,8,.08) !important;
}
/* 列表 */
.markdown-body ul li::marker{color:hsl(5,75%,48%) !important}
.markdown-body ol li::marker{color:hsl(40,55%,42%) !important;font-family:'Ma Shan Zheng',serif !important}
/* 链接 */
.markdown-body a{
  color:hsl(5,70%,42%) !important;
  border-bottom:1px dashed hsl(5,70%,52%) !important;
  text-decoration:none !important;
}
.markdown-body a:hover{color:hsl(5,80%,32%) !important;border-bottom-style:solid !important}
/* 表格 */
.markdown-body table{
  border:1px solid hsl(40,45%,55%) !important;
  background:hsl(38,40%,90%) !important;
  border-radius:4px !important;
  overflow:hidden !important;
  box-shadow:0 2px 8px rgba(60,30,8,.12) !important;
}
.markdown-body th{
  background:linear-gradient(180deg,hsl(38,55%,52%),hsl(35,50%,42%)) !important;
  color:hsl(38,40%,95%) !important;
  font-family:'Ma Shan Zheng',serif !important;
  letter-spacing:.08em !important;
  border-color:hsl(38,45%,38%) !important;
}
.markdown-body td{
  border-color:hsl(40,35%,72%) !important;
  background:hsl(38,38%,93%) !important;
}
.markdown-body tr:nth-child(even) td{background:hsl(38,32%,89%) !important}
/* 分隔线 */
.markdown-body hr{
  border:none !important;
  height:14px !important;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14'><g fill='none' stroke='%23a87a3a' stroke-width='1' opacity='.7'><path d='M0 7 Q25 1 50 7 T100 7 T150 7 T200 7'/><circle cx='100' cy='7' r='1.5' fill='%23c8492a'/></g></svg>") !important;
  background-repeat:no-repeat !important;
  background-position:center !important;
  background-size:80% 100% !important;
  margin:18px 0 !important;
}
/* details 面板 */
.markdown-body details{
  background:linear-gradient(180deg,hsl(38,40%,91%),hsl(36,34%,86%)) !important;
  border:1px solid hsl(40,45%,55%) !important;
  border-radius:5px !important;
  padding:0 !important;
  margin:12px 0 !important;
  box-shadow:0 2px 10px rgba(60,30,8,.1),inset 0 0 0 1px rgba(255,250,235,.6) !important;
  overflow:hidden !important;
}
.markdown-body details > summary{
  cursor:pointer !important;
  padding:10px 16px !important;
  font-family:'Ma Shan Zheng','Noto Serif SC',serif !important;
  font-size:1.05em !important;
  letter-spacing:.08em !important;
  background:linear-gradient(90deg,hsl(38,55%,52%),hsl(40,50%,46%)) !important;
  color:hsl(38,42%,96%) !important;
  border-bottom:1px solid hsl(38,45%,38%) !important;
  list-style:none !important;
  position:relative !important;
  transition:all .3s !important;
}
.markdown-body details > summary::-webkit-details-marker{display:none}
.markdown-body details > summary::before{
  content:'❖ ';
  color:hsl(5,75%,55%) !important;
  margin-right:6px;
}
.markdown-body details[open] > summary{
  background:linear-gradient(90deg,hsl(5,65%,42%),hsl(15,60%,38%)) !important;
}
.markdown-body details > *:not(summary){
  padding:6px 16px !important;
}
/* 代码块 - Scene/User/Status/Hero/Message */
.markdown-body pre{
  background:linear-gradient(180deg,hsl(38,42%,90%),hsl(36,36%,85%)) !important;
  border:1px solid hsl(40,40%,60%) !important;
  border-left:4px solid hsl(5,75%,48%) !important;
  border-radius:4px !important;
  padding:0 !important;
  margin:8px 0 !important;
  box-shadow:inset 0 0 30px rgba(140,80,30,.06),0 1px 4px rgba(60,30,8,.1) !important;
  overflow:hidden !important;
}
.markdown-body pre > div{
  background:transparent !important;
}
.markdown-body pre > div > div.flex.justify-between.h-8{
  background:linear-gradient(90deg,hsl(38,30%,82%),hsl(36,28%,76%)) !important;
  border-color:hsl(40,40%,60%) !important;
}
.markdown-body pre > div > div.flex.justify-between > div.text-\[13px\]{
  color:hsl(25,55%,28%) !important;
  font-family:'Ma Shan Zheng',serif !important;
  letter-spacing:.1em !important;
}
.markdown-body pre svg.lucide-copy,
.markdown-body pre div[data-tooltip-id^="copy-tooltip"] > svg{
  color:hsl(5,75%,42%) !important;
}
.markdown-body pre .group:hover svg.lucide-copy,
.markdown-body pre div[data-tooltip-id^="copy-tooltip"]:hover > svg{
  color:hsl(5,80%,32%) !important;
}
.markdown-body pre > div > div[node]{
  background:linear-gradient(180deg,hsl(38,42%,92%),hsl(36,38%,88%)) !important;
  color:hsl(25,45%,22%) !important;
  font-family:'Noto Serif SC','Consolas',monospace !important;
  line-height:1.85 !important;
}
.markdown-body pre code{font-family:'Noto Serif SC','Consolas',monospace !important}
/* 行内代码 */
.markdown-body :not(pre) > code{
  background:hsl(38,45%,85%) !important;
  color:hsl(5,70%,38%) !important;
  border:1px solid hsl(40,40%,68%) !important;
  border-radius:3px !important;
  padding:1px 6px !important;
  font-size:.9em !important;
}
/* 思维链 - 隐藏在注释中的<cot>不可见，但我们用伪类提示思考中 */
.markdown-body{counter-reset:cot}
/* 当回复正在生成（注释未闭合时），伪元素出现 */
.markdown-body:has(> :first-child:empty)::before,
.markdown-body[data-thinking]::before{
  content:'';
}
/* 思考中提示 - 通过在 markdown-body 顶部插入 */
.markdown-body{counter-increment:cot}
/* 动画关键帧 */
@keyframes hourglassSpin{
  0%{transform:rotate(0deg)}
  50%{transform:rotate(180deg)}
  100%{transform:rotate(360deg)}
}
@keyframes thinkingPulse{
  0%,100%{opacity:.6}
  50%{opacity:1}
}
/* 思考中浮层 - 当存在未闭合的 <!--<cot> 时显示
   利用空回复或正在生成的占位符 */
.markdown-body > p:first-child:only-child:empty::before,
.markdown-body:empty::before{
  content:'⏳ 思考中，落叶簌簌……';
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-family:'Ma Shan Zheng',serif;
  color:hsl(5,75%,42%);
  font-size:1.1em;
  letter-spacing:.15em;
  animation:thinkingPulse 1.5s ease-in-out infinite;
}
/* 通用思考中标识：在每个 markdown-body 顶部如果首子元素是空 p */
.markdown-body > p:first-child:empty{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  padding:14px 20px !important;
  background:linear-gradient(90deg,hsl(38,40%,90%),hsl(38,38%,93%),hsl(38,40%,90%));
  border:1px dashed hsl(40,55%,52%);
  border-radius:6px;
  position:relative;
}
.markdown-body > p:first-child:empty::after{
  content:'⏳';
  position:absolute;
  left:50%;
  transform:translateX(-110px);
  display:inline-block;
  font-size:1.4em;
  animation:hourglassSpin 1.6s ease-in-out infinite;
}
/* 段落字号 */
.markdown-body p{font-size:.96em !important;letter-spacing:.02em !important}
/* 移动端 */
@media (max-width:680px){
  .markdown-body{
    padding:32px 18px 24px !important;
    margin:10px 0 !important;
    border-radius:6px !important;
  }
  .markdown-body::before,.markdown-body::after{left:8px;right:8px}
  .markdown-body > :first-child::before{width:38px;height:38px;top:-18px;left:-8px}
  .markdown-body > :first-child::after{width:32px;height:32px;top:-16px;right:-6px}
  .markdown-body > :last-child::before{width:32px;height:32px;bottom:-16px;left:-6px}
  .markdown-body > :last-child::after{width:38px;height:38px;bottom:-18px;right:-8px}
  .markdown-body details > summary{padding:9px 12px !important;font-size:.98em !important}
  .markdown-body table{font-size:.85em !important}
}