/* ===== 根容器：黄色宣纸横格纸质感 ===== */
ai {
  display: block;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 22px 34px;
  box-sizing: border-box;
  font-family: "SimSun", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: 15px;
  line-height: 32px;
  color: #4b3e2a;                    /* 深棕文字，与宣纸协调 */
  border-radius: 14px;
  /* 黄色宣纸底 + 均匀横格线（32px 一行，与 line-height 对齐） */
  background-color: #f6e9c9;        /* 黄色宣纸底色 */
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0)),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 31px,
      rgba(170,130,80,0.25) 31px,    /* 暖棕横线 */
      rgba(170,130,80,0.25) 32px
    );
  box-shadow: 0 6px 26px rgba(150,120,80,0.18);
  border-top: 3px solid #b8863e;     /* 金棕色顶部描边 */
  position: relative;
  overflow: hidden;
}

/* ===== 隐藏思维链与系统栏 ===== */
ai details.cot { display: none; }
ai sys { display: none; }

/* ===== 顶部信息条：地点·时间·天气 ===== */
ai hd {
  display: block;
  margin: 0 0 22px 0;
  padding: 12px 18px;
  line-height: 26px;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #6b5a3e;                    /* 暖深棕 */
  text-align: center;
  background: linear-gradient(135deg, rgba(220,190,130,0.30), rgba(240,220,180,0.30));
  border-radius: 10px;
  border: 1px solid rgba(170,130,80,0.28);
}
ai hd::before {
  content: "♡ ";
  color: #b8863e;
}
ai hd::after {
  content: " ♡";
  color: #b8863e;
}

/* ===== 正文段落：直接铺在 ai 横格背景上 ===== */
ai p {
  display: block;
  margin: 0 0 6px 0;
  padding: 0 6px;
  line-height: 32px;              /* 与背景横线严格对齐 */
  text-indent: 2em;
  color: #4a3c28;                 /* 正文深棕 */
  background: transparent;        /* 透明以透出 ai 的横线背景 */
  text-align: justify;
}

/* ===== 折叠面板：信笺卡片式 ===== */
ai details {
  display: block;
  margin: 18px 0;
  padding: 0;
  background: rgba(255, 248, 235, 0.92);   /* 暖白半透明，透出宣纸色 */
  border: 1px solid rgba(150,140,190,0.24);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(140,130,160,0.12);
  transition: box-shadow 0.25s ease;
}
ai details[open] {
  box-shadow: 0 5px 20px rgba(140,130,160,0.18);
}

ai summary {
  display: flex;
  align-items: center;
  position: relative;
  padding: 13px 48px 13px 40px;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: #5a4d68;
  list-style: none;
  background: linear-gradient(135deg, rgba(212,206,238,0.42), rgba(240,230,208,0.34));
  transition: background 0.25s ease, padding-left 0.25s ease;
}
ai summary::-webkit-details-marker { display: none; }

/* 左侧圆形印章标记 */
ai summary::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d8c088, #b8985a);
  box-shadow: 0 0 0 3px rgba(201,168,106,0.20);
  transition: transform 0.25s ease, background 0.25s ease;
}

/* 右侧圆形按钮内的箭头 */
ai summary::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  line-height: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 400;
  color: #7a6b90;
  background: rgba(179,157,219,0.18);
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.25s ease;
}
ai details[open] summary::after {
  content: "▾";
  transform: rotate(180deg);
  background: rgba(179,157,219,0.32);
}
ai details[open] summary::before {
  background: radial-gradient(circle at 35% 35%, #c9b0e0, #9a7fbf);
  transform: scale(1.15);
}

ai summary:hover {
  background: linear-gradient(135deg, rgba(212,206,238,0.62), rgba(240,230,208,0.52));
  padding-left: 44px;
}
ai summary:hover::before {
  transform: scale(1.2);
}

/* 展开区域顶部暖金细线过渡 */
ai details[open] summary {
  border-bottom: 1px solid rgba(201,168,106,0.30);
}

/* 面板内容内边距 */
ai details > g,
ai details > d,
ai details > table {
  margin: 10px 14px;
}
ai details details {
  margin: 12px 14px;
  background: rgba(248,244,236,0.92);
  border-radius: 12px;
}
ai details details summary {
  padding: 10px 42px 10px 36px;
  font-size: 13.5px;
}
ai details details summary::before {
  left: 14px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
}

/* ===== 分组 g：按 type 着色 ===== */
ai g {
  display: block;
  margin: 8px 14px;
  padding: 10px 14px;
  border-radius: 9px;
  line-height: 28px;
  background: rgba(252,250,245,0.8);
  border: 1px solid rgba(170,160,190,0.22);
}

/* 身份/映射：淡紫 */
ai g[t="i"],
ai g[t="m"] {
  background: linear-gradient(135deg, rgba(203,197,232,0.28), rgba(230,226,244,0.20));
  border-color: rgba(150,140,200,0.34);
}
/* 身体状态：柔绿 */
ai g[t="b"] {
  background: linear-gradient(135deg, rgba(196,222,205,0.26), rgba(228,240,230,0.18));
  border-color: rgba(120,175,140,0.32);
}
/* 心理：暖杏 */
ai g[t="p"] {
  background: linear-gradient(135deg, rgba(238,222,198,0.30), rgba(245,236,220,0.20));
  border-color: rgba(201,168,106,0.34);
}
/* 角色卡：雾蓝 */
ai g[t="c"] {
  background: linear-gradient(135deg, rgba(198,214,234,0.28), rgba(228,236,246,0.18));
  border-color: rgba(120,150,195,0.32);
}
/* 认知追踪：淡青 */
ai g[t="k"] {
  background: linear-gradient(135deg, rgba(198,228,228,0.26), rgba(228,244,244,0.18));
  border-color: rgba(110,170,170,0.32);
}
/* 关系面板：暧昧玫瑰紫 */
ai g[t="npc-to-player"],
ai g[t="npc-to-npc"] {
  background: linear-gradient(135deg, rgba(228,204,224,0.28), rgba(240,226,236,0.18));
  border-color: rgba(185,143,176,0.36);
}
/* 暴露风险：警示暖调 */
ai g[t="exposure"] {
  background: linear-gradient(135deg, rgba(240,214,204,0.30), rgba(246,230,222,0.18));
  border-color: rgba(205,140,120,0.34);
}

/* 记忆表格分组标题 */
ai g[t^="剧情"],
ai g[t^="长期"],
ai g[t^="短期"] {
  background: rgba(250,247,241,0.9);
  border-color: rgba(150,140,190,0.25);
}
ai g[t^="剧情"]::before { content: "📖 剧情记忆 PLOT"; }
ai g[t^="长期"]::before { content: "🕯 长期记忆 LTM"; }
ai g[t^="短期"]::before { content: "✎ 短期记忆 STM"; }
ai g[t^="剧情"]::before,
ai g[t^="长期"]::before,
ai g[t^="短期"]::before {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #6b5f78;
  letter-spacing: 0.5px;
}

/* ===== 数据行 d ===== */
ai d {
  display: block;
  padding: 3px 0;
  line-height: 27px;
}
ai d + d {
  border-top: 1px dashed rgba(160,150,185,0.28);
}

/* ===== 字段名 f：小标签胶囊 ===== */
ai f {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: #6a5b7a;
  background: rgba(179,157,219,0.20);
  border-radius: 20px;
  letter-spacing: 0.3px;
}

/* ===== 数值 v ===== */
ai v {
  display: inline;
  color: #5a5266;
  font-weight: 500;
}
ai v[lv="h"] { color: #c17b8a; font-weight: 700; }
ai v[lv="m"] { color: #c9a86a; }
ai v[lv="l"] { color: #7fa88d; }

/* ===== 表格：记忆区 ===== */
ai table {
  width: auto;
  border-collapse: collapse;
  margin: 10px 14px;
  font-size: 13px;
  line-height: 22px;
  background: rgba(255,254,251,0.9);
  border-radius: 8px;
  overflow: hidden;
}
ai th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #9a86c4, #b99fbf);
  letter-spacing: 0.5px;
}
ai td {
  padding: 7px 10px;
  color: #4f4858;
  border-bottom: 1px solid rgba(160,150,185,0.20);
  vertical-align: top;
}
ai tr:last-child td { border-bottom: none; }
ai tr:nth-child(even) td { background: rgba(203,197,232,0.10); }
ai tr:hover td { background: rgba(203,197,232,0.20); }

/* ===== 移动端适配 ===== */
@media (max-width: 600px) {
  ai {
    padding: 18px 12px 24px;
    font-size: 14px;
    line-height: 30px;
    background-image:
      linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0)),
      repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 29px,
        rgba(170,130,80,0.25) 29px,
        rgba(170,130,80,0.25) 30px
      );
    border-radius: 10px;
  }
  ai p { line-height: 30px; padding: 0 4px; }
  ai hd { font-size: 13px; padding: 10px 12px; }
  ai summary { padding: 11px 42px 11px 36px; font-size: 13.5px; }
  ai summary::before { left: 14px; }
  ai summary::after { right: 12px; }
  ai g { margin: 8px 8px; padding: 9px 11px; }
  ai table { margin: 10px 8px; font-size: 12px; }
  ai th, ai td { padding: 6px 7px; }
  ai f { font-size: 11.5px; padding: 1px 7px; }
}