/* ===== 自定义标签基础 ===== */
chain,
scene,
text,
panel {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* ===== 对话标签 ===== */
lns {
  display: inline;
  color: #8b0000;
  font-weight: 500;
}

lc {
  display: inline;
  color: #1a3a5c;
  font-weight: 500;
}

npc {
  display: inline;
  color: #2d5a27;
  font-weight: 500;
}

/* ===== 思维引擎 - 不可打开 ===== */
chain {
  margin-bottom: 12px;
}

chain details {
  pointer-events: none;
  user-select: none;
  background: linear-gradient(135deg, #eef0f5 0%, #e8e4f0 50%, #eef0f5 100%);
  border: 1px solid rgba(80, 70, 130, 0.25);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

chain details::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(100, 80, 180, 0.06), transparent);
  animation: chainSweep 3s ease-in-out infinite;
}

@keyframes chainSweep {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(50%); }
}

chain details summary {
  pointer-events: none;
  cursor: default;
  list-style: none;
  padding: 10px 16px;
  color: #4a4070;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

chain details summary::-webkit-details-marker {
  display: none;
}

chain details summary::after {
  content: "●";
  font-size: 8px;
  color: #6a5acd;
  animation: chainPulse 1.5s ease-in-out infinite;
  margin-left: auto;
}

@keyframes chainPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

chain details[open] > *:not(summary) {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;font-size: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ===== 场景条 ===== */
scene {
  margin-bottom: 16px;
}

scene p {
  background: linear-gradient(90deg, rgba(139, 0, 0, 0.05) 0%, rgba(139, 0, 0, 0.08) 50%, rgba(139, 0, 0, 0.05) 100%);
  border-left: 3px solid #8b0000;
  border-right: 3px solid #8b0000;
  padding: 10px 16px;
  color: #3a2020;
  font-size: 13px;
  letter-spacing: 1px;
  text-align: center;
  border-radius: 4px;
  margin: 0;
}

/* ===== 正文 ===== */
text {
  margin-bottom: 20px;
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 6px;
}

text p {
  color: #1a1a1a;
  font-size: 15px;
  line-height: 1.9;
  text-indent: 2em;
  margin: 0 0 12px 0;
  text-align: justify;
  word-break: break-word;
}

text p:last-child {
  margin-bottom: 0;
}

/* ===== 状态面板容器 ===== */
panel {
  margin-top: 8px;
}

panel > details {
  background: #f7f5f6;
  border: 1px solid rgba(139, 0, 0, 0.2);
  border-radius: 10px;
  overflow: hidden;
}

panel > details > summary {
  padding: 12px 16px;
  color: #8b0000;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(139, 0, 0, 0.12);
  transition: background0.2s ease;
}

panel > details > summary::-webkit-details-marker {
  display: none;
}

panel > details > summary::after {
  content: "▸";
  margin-left: auto;
  color: #8b0000;
  transition: transform 0.3s ease;
  font-size: 14px;
}

panel > details[open] > summary::after {
  transform: rotate(90deg);
}

panel > details > summary:hover {
  background: rgba(139, 0, 0, 0.05);
}

/* ===== 子面板通用 ===== */
panel details details {
  margin: 6px 10px;
  background: #ffffff;
  border: 1px solid rgba(139, 0, 0, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

panel details details summary {
  padding: 9px 14px;
  color: #3a2030;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  letter-spacing: 1px;
  transition: background 0.2s ease, color 0.2s ease;
}

panel details details summary::-webkit-details-marker {
  display: none;
}

panel details details summary::after {
  content: " ›";
  color: #8b0000;
  transition: transform 0.3s ease;
}

panel details details[open] summary::after {
  content: " ‹";
}

panel details details summary:hover {
  background: rgba(139, 0, 0, 0.04);
  color: #1a1a1a;
}

panel details details p {
  padding: 2px 14px;
  margin: 0;
  color: #2d2d2d;
  font-size: 12.5px;
  line-height: 1.75;
  border-bottom: 1px solid rgba(180, 160, 165, 0.2);
}

panel details details p:last-of-type {
  border-bottom: none;
  padding-bottom: 8px;
}

/* ===== 记忆回廊表格 ===== */
panel details details table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 11.5px;
}

panel details details table th {
  background: #f0e8ea;
  color: #4a2030;
  padding: 7px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(139, 0, 0, 0.2);
}

panel details details table td {
  padding: 6px 8px;
  color: #2d2d2d;
  border-bottom: 1px solid rgba(180, 160, 165, 0.2);
  vertical-align: top;
  line-height: 1.6;
  font-size: 11.5px;
  background: #ffffff;
}

panel details details table tr:nth-child(even) td {
  background: #faf8f9;
}

panel details details table tr:hover td {
  background: #f5f0f1;
}

/* ===== 推荐行动 ===== */
panel > details > p {
  padding: 3px 14px;
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
}

panel > details > p:first-of-type {
  color: #8b0000;
  font-weight: 700;
  font-size: 13.5px;
  padding-top: 10px;
  border-top: 1px solid rgba(139, 0, 0, 0.12);
  margin-top: 6px;
  letter-spacing: 1px;
}

panel > details > p:not(:first-of-type) {
  color: #2d2d2d;
  padding-left: 20px;
  cursor: default;
  transition: color 0.2s ease;
}

panel > details > p:not(:first-of-type):hover {
  color: #1a1a1a;
}

panel > details > p:last-of-type {
  padding-bottom: 12px;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
  text p {
    font-size: 14.5px;
    line-height: 1.85;
  }

  text {
    padding: 6px 8px;
  }

  scene p {
    font-size: 12px;
    padding: 8px 12px;
  }

  panel details details {
    margin: 4px 6px;
  }

  panel details details p {
    font-size: 12px;
    padding: 2px 10px;
  }

  panel details details table {
    font-size: 10.5px;
  }

  panel details details table th,
  panel details details table td {
    padding: 5px 6px;
  }

  chain details summary {
    font-size: 12px;
    padding: 8px 12px;
  }
}