/* ============================
   天枢·古籍界面 — 仙侠UI (修正版)
   容器: <ai>
   ============================ */

/* ---- 基础容器 ---- */
ai {
  display: block;
  font-family: "Noto Serif SC", "Source Han Serif CN", "SimSun", serif;
  font-size: 15px;
  line-height: 1.75;
  color: #2c2416;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E") repeat,
    linear-gradient(180deg, #f8f3ea 0%, #f0e8d8 50%, #ece3d0 100%);
  padding: 0;
  margin: 0;
  position: relative;
  border-left: 3px double #c4b99a;
  border-right: 3px double #c4b99a;
}

/* ---- 线装书缝线装饰 ---- */
ai::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(
    180deg,
    #8b2500 0px,
    #8b2500 12px,
    transparent 12px,
    transparent 20px
  );
  opacity: 0.35;
  pointer-events: none;
}

/* ---- 隐藏ReplyGuide ---- */
ai rg {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
}

/* ======== 场景信息栏 (当前情况) ======== */
/* 用"没有class的details"来靶向，排除t1/t2/t3 */
ai details:not(.t1):not(.t2):not(.t3) {
  background: linear-gradient(135deg, #ede6d6 0%, #e8ddc8 100%);
  border: 1px solid #c4b99a;
  border-radius: 2px;
  margin: 8px 18px 6px;
  padding: 0;
  position: relative;
}

ai details:not(.t1):not(.t2):not(.t3)::before {
  content: "☰ 天机";
  position: absolute;
  top: -1px;
  right: 10px;
  font-size: 10px;
  color: #8b2500;
  opacity: 0.5;
  letter-spacing: 2px;
}

ai details:not(.t1):not(.t2):not(.t3) > summary {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: bold;
  color: #8b2500;
  cursor: pointer;
  list-style: none;
  border-bottom: 1px dashed #c4b99a;
  letter-spacing: 1px;
  user-select: none;
}

ai details:not(.t1):not(.t2):not(.t3) > summary::-webkit-details-marker {
  display: none;
}

ai details:not(.t1):not(.t2):not(.t3) > summary::before {
  content: "▸ ";
  color: #b8860b;
  transition: transform 0.2s;
  display: inline-block;
}

ai details:not(.t1):not(.t2):not(.t3)[open] > summary::before {
  content: "▾ ";
  color: #8b2500;
}

ai details:not(.t1):not(.t2):not(.t3) p,
ai details:not(.t1):not(.t2):not(.t3) strong {
  font-size: 13px;
  line-height: 1.6;
}

ai details:not(.t1):not(.t2):not(.t3) > p,
ai details:not(.t1):not(.t2):not(.t3) > div {
  padding: 4px 12px;
  margin: 0;
}

/* ======== 正文区 ======== */
ai article {
  padding: 12px 20px 16px;
  margin: 0;
  position: relative;
  font-size: 16px;
  line-height: 1.85;
  color: #2c2416;
  text-align: justify;
}

ai article p {
  margin: 0 0 10px;
  text-indent: 2em;
}

ai article p:last-child {
  margin-bottom: 0;
}

/* 朱印装饰 */
ai article::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 14px;
  width: 38px;
  height: 38px;
  opacity: 0.12;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Crect x='4' y='4' width='52' height='52' rx='3' fill='none' stroke='%238b2500' stroke-width='3'/%3E%3Crect x='10' y='10' width='40' height='40' rx='1' fill='none' stroke='%238b2500' stroke-width='1.5'/%3E%3Cline x1='20' y1='18' x2='40' y2='18' stroke='%238b2500' stroke-width='2'/%3E%3Cline x1='20' y1='26' x2='40' y2='26' stroke='%238b2500' stroke-width='2'/%3E%3Cline x1='20' y1='34' x2='40' y2='34' stroke='%238b2500' stroke-width='2'/%3E%3Cline x1='20' y1='42' x2='40' y2='42' stroke='%238b2500' stroke-width='2'/%3E%3C/svg%3E") no-repeat center/contain;
  pointer-events: none;
}

/* 正文中对话用斜体=翡翠色 */
ai article em {
  font-style: normal;
  color: #4a7c6f;
}

/* ======== 水墨晕染顶部装饰 ======== */
ai article::before {
  content: "";
  display: block;
  height: 3px;
  margin: 0 0 10px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #8b2500 15%,
    #b8860b 50%,
    #8b2500 85%,
    transparent 100%
  );
  opacity: 0.25;
  border-radius: 2px;
}

/* ======== 通用 details 翻页标签样式 ======== */
ai details.t1 > summary,
ai details.t2 > summary,
ai details.t3 > summary {
  display: block;
  padding: 7px 14px;
  margin: 0 18px;
  font-size: 14px;
  font-weight: bold;
  color: #f5f0e5;
  cursor: pointer;
  list-style: none;
  user-select: none;
  letter-spacing: 2px;
  position: relative;
  transition: all 0.25s;
}

ai details.t1 > summary::-webkit-details-marker,
ai details.t2 > summary::-webkit-details-marker,
ai details.t3 > summary::-webkit-details-marker {
  display: none;
}

/* ---- 状态栏标签 ---- */
ai details.t1 > summary {
  background: linear-gradient(135deg, #8b2500 0%, #6d1e00 100%);
  border: 1px solid #a83a1e;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-top: 10px;
}

ai details.t1 > summary::after {
  content: " ◂ 展卷";
  font-size: 11px;
  opacity: 0.7;
  font-weight: normal;
}

ai details.t1[open] > summary::after {
  content: " ▾ 收卷";
}

ai details.t1 > summary:hover {
  background: linear-gradient(135deg, #a83a1e 0%, #8b2500 100%);
  box-shadow: 0 2px 8px rgba(139, 37, 0, 0.3);
}

/* ---- 记忆回廊标签 ---- */
ai details.t2 > summary {
  background: linear-gradient(135deg, #4a7c6f 0%, #365e54 100%);
  border: 1px solid #4a7c6f;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-top: 4px;
}

ai details.t2 > summary::after {
  content: " ◂ 展卷";
  font-size: 11px;
  opacity: 0.7;
  font-weight: normal;
}

ai details.t2[open] > summary::after {
  content: " ▾ 收卷";
}

ai details.t2 > summary:hover {
  background: linear-gradient(135deg, #5a9585 0%, #4a7c6f 100%);
  box-shadow: 0 2px 8px rgba(74, 124, 111, 0.3);
}

/* ---- 剧情分支标签 ---- */
ai details.t3 > summary {
  background: linear-gradient(135deg, #b8860b 0%, #8a6508 100%);
  border: 1px solid #b8860b;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-top: 4px;
}

ai details.t3 > summary::after {
  content: " ◂ 展卷";
  font-size: 11px;
  opacity: 0.7;
  font-weight: normal;
}

ai details.t3[open] > summary::after {
  content: " ▾ 收卷";
}

ai details.t3 > summary:hover {
  background: linear-gradient(135deg, #d4a84b 0%, #b8860b 100%);
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.3);
}

/* ======== 翻页容器基础 ======== */
ai details.t1,
ai details.t2,
ai details.t3 {
  margin: 0;
  border: none;
}

ai details.t1[open],
ai details.t2[open],
ai details.t3[open] {
  margin-bottom: 2px;
}

/* ======== 内容面板背景 ======== */
/* 用通配后代选择而非 > :not(summary)，兼容性更好 */
ai details.t1 p,
ai details.t1 ul,
ai details.t1 div,
ai details.t1 hr,
ai details.t1 h2,
ai details.t1 table {
  margin-left: 18px;
  margin-right: 18px;
  padding-left: 10px;
  padding-right: 10px;
}

ai details.t2 p,
ai details.t2 ul,
ai details.t2 div,
ai details.t2 hr,
ai details.t2 h2,
ai details.t2 table {
  margin-left: 18px;
  margin-right: 18px;
  padding-left: 10px;
  padding-right: 10px;
}

ai details.t3 p,
ai details.t3 ul,
ai details.t3 div,
ai details.t3 hr,
ai details.t3 table {
  margin-left: 18px;
  margin-right: 18px;
  padding-left: 10px;
  padding-right: 10px;
}

/* 面板底色 - 通过给details[open]自身加内边距+背景实现 */
ai details.t1[open] {
  background: linear-gradient(180deg, #ede6d6 0%, #f5f0e5 100%);
  border: 1px solid #c4b99a;
  border-top: none;
  margin-left: 18px;
  margin-right: 18px;
  padding: 6px 0;
  border-radius: 0 0 4px 4px;
}

ai details.t2[open] {
  background: linear-gradient(180deg, #e8eeeb 0%, #f5f0e5 100%);
  border: 1px solid #c4b99a;
  border-top: none;
  margin-left: 18px;
  margin-right: 18px;
  padding: 6px 0;
  border-radius: 0 0 4px 4px;
}

ai details.t3[open] {
  background: linear-gradient(180deg, #f0ead6 0%, #f5f0e5 100%);
  border: 1px solid #c4b99a;
  border-top: none;
  margin-left: 18px;
  margin-right: 18px;
  padding: 6px 0;
  border-radius: 0 0 4px 4px;
}

/* open时summary需要覆盖margin */
ai details.t1[open] > summary,
ai details.t2[open] > summary,
ai details.t3[open] > summary {
  margin: 0;
}

/* ======== 状态栏内部样式 ======== */
ai details.t1 strong {
  color: #8b2500;
  font-size: 13px;
}

ai details.t1 ul {
  list-style: none;
  padding-left: 0;
  margin: 2px 18px 8px;
}

ai details.t1 li {
  padding: 2px 0 2px 6px;
  border-left: 2px solid #c4b99a;
  margin: 1px 0;
  font-size: 13px;
  line-height: 1.55;
  transition: border-color 0.2s, background 0.2s;
}

ai details.t1 li:hover {
  border-left-color: #b8860b;
  background: rgba(184, 134, 11, 0.04);
}

ai details.t1 li strong {
  color: #2c2416;
  font-size: 13px;
  min-width: 70px;
  display: inline-block;
}

ai details.t1 hr {
  border: none;
  border-top: 1px dashed #a89878;
  margin: 8px 18px;
}

/* ======== 记忆回廊表格 ======== */
ai details.t2 table {
  width: calc(100% - 36px);
  border-collapse: collapse;
  font-size: 12px;
  margin: 4px 18px;
}

ai details.t2 th {
  background: #8b2500;
  color: #f5f0e5;
  padding: 4px 6px;
  text-align: left;
  font-weight: normal;
  font-size: 11px;
  letter-spacing: 1px;
  border: 1px solid #a83a1e;
}

ai details.t2 td {
  padding: 4px 6px;
  border: 1px solid #c4b99a;
  vertical-align: top;
  line-height: 1.5;
}

ai details.t2 tr:nth-child(even) td {
  background: rgba(74, 124, 111, 0.04);
}

ai details.t2 tr:hover td {
  background: rgba(184, 134, 11, 0.08);
}

ai details.t2 h2,
ai details.t2 strong {
  font-size: 13px;
}

ai details.t2 em {
  font-style: normal;
  font-size: 12px;
  color: #5c5040;
}

/* ======== 剧情分支选项 ======== */
ai details.t3 ul {
  list-style: none;
  padding: 0;
  margin: 4px 18px;
}

ai details.t3 li {
  padding: 6px 8px 6px 14px;
  margin: 3px 0;
  font-size: 14px;
  line-height: 1.5;
  border-left: 3px solid transparent;
  border-radius: 0 3px 3px 0;
  cursor: default;
  transition: all 0.25s;
  position: relative;
}

ai details.t3 li:hover {
  border-left-color: #8b2500;
  background: linear-gradient(90deg, rgba(184, 134, 11, 0.08) 0%, transparent 100%);
  color: #8b2500;
  padding-left: 18px;
}

ai details.t3 li::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #b8860b;
  transform: scaleY(0);
  transition: transform 0.25s;
}

ai details.t3 li:hover::before {
  transform: scaleY(1);
}

/* ======== 底部收尾装饰 ======== */
ai::after {
  content: "";
  display: block;
  height: 6px;
  margin: 6px 18px 8px;
  background:
    linear-gradient(90deg, transparent 0%, #c4b99a 20%, #c4b99a 80%, transparent 100%);
  opacity: 0.4;
  border-radius: 1px;
}

/* ======== h2标题 ======== */
ai h2 {
  font-size: 14px;
  color: #8b2500;
  margin: 8px 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid #c4b99a;
  letter-spacing: 1px;
}

/* ======== 分隔线 ======== */
ai hr {
  border: none;
  border-top: 1px dashed #a89878;
  margin: 6px 0;
}

/* ======== 滚动条 ======== */
ai ::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

ai ::-webkit-scrollbar-track {
  background: #ede6d6;
}

ai ::-webkit-scrollbar-thumb {
  background: #a89878;
  border-radius: 2px;
}

ai ::-webkit-scrollbar-thumb:hover {
  background: #8b2500;
}

/* ======== 表格溢出（移动端） ======== */
ai details.t2 div,
ai details.t2 p {
  overflow-x: auto;
}

/* ======== 空元素隐藏 ======== */
ai details p:empty,
ai details div:empty {
  display: none;
}

/* ======== 响应式 ======== */
@media (max-width: 480px) {
  ai {
    font-size: 14px;
    border-left-width: 2px;
    border-right-width: 2px;
  }
  ai article {
    padding: 8px 14px 12px;
    font-size: 15px;
  }
  ai details.t1 > summary,
  ai details.t2 > summary,
  ai details.t3 > summary {
    margin: 0 10px;
    padding: 6px 10px;
    font-size: 13px;
  }
  ai details.t1[open],
  ai details.t2[open],
  ai details.t3[open] {
    margin-left: 10px;
    margin-right: 10px;
  }
  ai details.t1 ul,
  ai details.t1 hr,
  ai details.t2 table {
    margin-left: 10px;
    margin-right: 10px;
  }
  ai details.t2 table {
    width: calc(100% - 20px);
    font-size: 11px;
  }
  ai details.t2 th,
  ai details.t2 td {
    padding: 3px 4px;
  }
  ai::before {
    left: 5px;
  }
}