/* ===== 整体容器（ai标签） ===== */
ai {
  display: block;
  position: relative;
  background: linear-gradient(135deg, #faf8f3 0%, #f5eee0 100%);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 3px rgba(255,255,255,0.5);
  font-size: 13px;
  line-height: 1.8;
  color: #1a1a1a;
  overflow: hidden;
}
ai::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.015) 2px, rgba(0,0,0,0.015) 4px),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.01) 2px, rgba(0,0,0,0.01) 4px);
  pointer-events: none;
  z-index: 0;
}
ai > * {
  position: relative;
  z-index: 1;
}
/* ===== 章回体标题 ===== */
chapter {
  display: block;
  text-align: center;
  padding: 12px 20px;
  margin-bottom: 14px;
  border: 2px solid #d32f2f;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(250,248,243,0.9), rgba(245,238,224,0.9));
  box-shadow: 0 2px 6px rgba(211,47,47,0.2);
  transition: all 0.3s ease;
  position: relative;
}
chapter::after {
  content: '◈';
  position: absolute;
  top: 8px; right: 12px;
  font-size: 14px;
  color: #d4af37;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
chapter:hover {
  transform: translateY(-2px) scale(1.005);
  border-color: #d4af37;
  box-shadow: 0 4px 10px rgba(212,175,55,0.3);
}
chapter span {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.4em;
  color: #1a1a1a;
  font-family: 'KaiTi', 'STKaiti', '楷体', serif;
}
/* ===== 顶部信息栏 ===== */
.header {
  background: linear-gradient(135deg, #1a1a1a 0%, #4a4a4a 100%);
  color: #faf8f3;
  padding: 14px 18px;
  border-radius: 6px 6px 0 0;
  border-bottom: 3px solid #d4af37;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
}
.header::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 8s ease-in-out infinite;
  transform: skewX(-25deg);
}
@keyframes shimmer {
  0%, 100% { left: -100%; }
  50% { left: 150%; }
}
.header b {
  color: #d4af37;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
/* ===== 正文区域 ===== */
.story {
  background: rgba(255,255,255,0.6);
  padding: 16px;
  border-left: 3px solid #4a6fa5;
  border-radius: 4px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  position: relative;
}
.story::before {
  content: '';
  position: absolute;
  left: -3px; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #4a6fa5, #7cb490);
  filter: blur(4px);
}
.story p {
  text-indent: 2em;
  margin-bottom: 12px;
  line-height: 2.0;
}
.story p:last-child {
  margin-bottom: 0;
}
.story .mc {
  color: #d32f2f;
  font-weight: bold;
}
.story .npc {
  color: #7cb490;
  font-weight: bold;
}
/* ===== 折叠区通用样式 ===== */
details {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  background: rgba(255,255,255,0.5);
  margin-bottom: 14px;
  padding: 0;
  transition: all 0.3s ease;
}
details:hover {
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
details[open] {
  background: rgba(255,255,255,0.7);
}
details summary {
  padding: 12px 18px 12px 48px;
  cursor: pointer;
  font-weight: 600;
  color: white;
  border-radius: 6px 6px 0 0;
  transition: all 0.3s ease;
  position: relative;
  list-style: none;
  user-select: none;
}
details summary::-webkit-details-marker {
  display: none;
}
details summary::before {
  content: '▶';
  position: absolute;
  left: 18px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  transition: transform 0.3s ease;
}
details[open] summary::before {
  transform: translateY(-50%) rotate(90deg);
}
details summary:hover {
  padding-left: 52px;
}
.char-section summary {
  background: linear-gradient(135deg, #c17a3a, #d4915f);
}
.npc-section summary {
  background: linear-gradient(135deg, #7cb490, #9dbdb5);
}
.mem-section summary {
  background: linear-gradient(135deg, #8b2e2e, #a83232);
}
.act-section summary {
  background: linear-gradient(135deg, #d4af37, #e0c050);
}
/* ===== 主角信息区 ===== */
.char-info {
  padding: 16px;
  line-height: 1.9;
}
.char-info b {
  display: inline-block;
  min-width: 90px;
  color: #4a6fa5;
  font-weight: 600;
}
/* ===== 能力区块 ===== */
.ability {
  padding: 16px;
}
.ability h {
  display: block;
  padding: 8px 12px 8px 16px;
  margin: 14px 0 10px;
  border-left: 4px solid #d32f2f;
  background: linear-gradient(90deg, rgba(211,47,47,0.08), transparent);
  font-weight: 600;
  font-size: 14px;
  color: #d32f2f;
}
.ability skill {
  display: block;
  padding: 10px 12px 10px 16px;
  margin-bottom: 10px;
  border-left: 3px solid #7cb490;
  background: rgba(124,180,144,0.04);
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
}
.ability skill:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(124,180,144,0.2);
  background: rgba(124,180,144,0.1);
}
.ability skill:hover::before {
  content: '⚡';
  position: absolute;
  left: -16px; top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  animation: pulse 0.6s ease-in-out;
}
@keyframes pulse {
  0%, 100% { opacity: 0; transform: translateY(-50%) scale(0.8); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.2); }
}
.ability special {
  display: block;
  padding: 10px 12px 10px 20px;
  margin-bottom: 10px;
  border-left: 3px solid #d32f2f;
  background: linear-gradient(90deg, rgba(211,47,47,0.08), transparent);
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
}
.ability special::before {
  content: '✦';
  position: absolute;
  left: 6px; top: 50%;
  transform: translateY(-50%);
  color: #d32f2f;
  font-size: 12px;
}
.ability special:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(211,47,47,0.2);
}
/* ===== 物品背包区 ===== */
.inventory {
  padding: 16px;
}
.inventory h {
  display: block;
  padding: 8px 12px 8px 16px;
  margin: 14px 0 10px;
  border-left: 4px solid #c17a3a;
  background: linear-gradient(90deg, rgba(193,122,58,0.08), transparent);
  font-weight: 600;
  font-size: 14px;
  color: #c17a3a;
}
.inventory item {
  display: block;
  padding: 10px 12px 10px 16px;
  margin-bottom: 10px;
  border-left: 3px solid #c17a3a;
  background: rgba(193,122,58,0.04);
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
}
.inventory item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(193,122,58,0.2);
  background: rgba(193,122,58,0.1);
}
.inventory item:hover::before {
  content: '📦';
  position: absolute;
  left: -18px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}
@keyframes fadeIn {
  to { opacity: 1; }
}
/* ===== NPC信息区 ===== */
.npc-info {
  padding: 16px;
  background: linear-gradient(135deg, rgba(124,180,144,0.03), rgba(124,180,144,0.08));
  position: relative;
}
.npc-info::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #7cb490, transparent);
  filter: blur(2px);
}
.npc-info b {
  color: #7cb490;
  font-weight: 600;
  min-width: 90px;
  display: inline-block;
}
.npc-info b:nth-of-type(7) {
  color: #8b2e2e;
}
.line {
  height: 1px;
  margin: 14px 0;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.15), transparent);
}
/* ===== 记忆中枢区 ===== */
.memory {
  padding: 16px;
}
.memory p {
  padding-left: 12px;
  margin-bottom: 10px;
  border-left: 2px solid rgba(139,46,46,0.2);
  transition: all 0.3s ease;
  position: relative;
}
.memory p:hover {
  border-left-color: #8b2e2e;
  background: rgba(139,46,46,0.05);
  padding-left: 16px;
}
.memory p:nth-of-type(1),
.memory p:nth-of-type(2),
.memory p:nth-of-type(3) {
  font-weight: 600;
  color: #8b2e2e;
  border-left-width: 3px;
}
.memory p:nth-of-type(4) {
  margin-top: 10px;
  border-left-color: #4a6fa5;
  border-left-width: 3px;
}
/* ===== 行动推荐区 ===== */
.action {
  padding: 16px;
  background: linear-gradient(135deg, rgba(212,175,55,0.08), rgba(224,192,80,0.12));
  line-height: 2.0;
  position: relative;
}
.action::before {
  content: '🧭 行动指引：';
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #d4af37;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
/* ===== 思维链区域 ===== */
details.think-section {
  border: 2px solid rgba(193,122,58,0.3);
  background: 
    repeating-linear-gradient(90deg, rgba(193,122,58,0.03) 0px, rgba(193,122,58,0.03) 1px, transparent 1px, transparent 38px),
    linear-gradient(135deg, rgba(250,248,243,0.9), rgba(245,238,224,0.9));
  transition: all 0.3s ease;
}
details.think-section:hover {
  border-color: rgba(193,122,58,0.5);
}
details.think-section summary {
  padding-left: 48px;
  background: 
    repeating-linear-gradient(90deg, rgba(0,0,0,0.08) 0px, rgba(0,0,0,0.08) 1px, transparent 1px, transparent 38px),
    linear-gradient(90deg, rgba(193,122,58,0.6) 0%, rgba(212,145,95,0.8) 50%, rgba(193,122,58,0.6) 100%);
  border-left: 4px solid #c17a3a;
  position: relative;
}
details.think-section summary::after {
  content: '📜';
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  transition: all 0.3s ease;
}
details.think-section summary:hover {
  padding-left: 52px;
}
details.think-section summary:hover::after {
  transform: translateY(-50%) scale(1.1);
  filter: brightness(1.2);
}
details.think-section[open] summary::before {
  content: '▼';
}
think {
  display: block;
  padding: 16px 16px 16px 20px;
  margin: 12px;
  background: 
    repeating-linear-gradient(0deg, transparent 0px, transparent 28px, rgba(0,0,0,0.03) 28px, rgba(0,0,0,0.03) 29px),
    linear-gradient(135deg, rgba(74,74,74,0.05), rgba(26,26,26,0.08));
  border-left: 2px solid #c17a3a;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.9;
  color: #4a4a4a;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.08);
}
think::before {
  content: '';
  position: absolute;
  left: -2px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #c17a3a, transparent);
  filter: blur(3px);
}
think strong,
think b {
  color: #d32f2f;
  font-weight: 600;
}
/* ===== 滚动条样式 ===== */
ai::-webkit-scrollbar {
  width: 6px;
}
ai::-webkit-scrollbar-track {
  background: #faf8f3;
  border-radius: 3px;
}
ai::-webkit-scrollbar-thumb {
  background: #4a6fa5;
  border-radius: 3px;
  transition: background 0.3s ease;
}
ai::-webkit-scrollbar-thumb:hover {
  background: #7cb490;
}
/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
  ai {
    font-size: 12px;
    padding: 12px;
  }
  .header {
    padding: 12px 14px;
  }
  .story {
    padding: 14px;
  }
  details summary {
    font-size: 13px;
    padding: 10px 14px 10px 42px;
  }
  details summary:hover {
    padding-left: 46px;
  }
  .char-info b,
  .npc-info b {
    min-width: 70px;
  }
  chapter span {
    font-size: 16px;
    letter-spacing: 0.3em;
  }
  think {
    font-size: 11px;
    padding: 14px 14px 14px 18px;
  }
  details.think-section summary {
    padding-left: 42px;
  }
  details.think-section summary:hover {
    padding-left: 46px;
  }
}