/* ═══════════════════════════════════════ 修仙纪事·内置CSS·V1.0 ═══════════════════════════════════════ */

/* ═══ 一、思维链折叠区 ═══ */
details.cot {
  background: linear-gradient(135deg, #f5f2ea 0%, #ebe4d3 100%);
  border: 1px solid rgba(90,140,80,0.30);
  border-left: 3px solid #5a8c50;
  border-radius: 8px;
  margin: 12px 0;
  padding: 0;
  box-shadow: 0 2px 8px rgba(140,110,70,0.10);
  overflow: hidden;
}

details.cot summary {
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(90,140,80,0.14), transparent);
  color: #4a6a3a;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  outline: none;
}

details.cot summary:hover {
  background: linear-gradient(90deg, rgba(90,140,80,0.22), transparent);
  color: #2a3a1a;
}

details.cot[open] summary {
  border-bottom: 1px dashed rgba(90,140,80,0.28);
}

details.cot summary::marker,
details.cot summary::-webkit-details-marker {
  color: #5a8c50;
}

details.cot > *:not(summary) {
  padding: 10px 16px;
  color: #4a5a3a;
  font-size: 12.5px;
  line-height: 1.7;
  font-family: 'Consolas', 'Menlo', 'Noto Sans SC', monospace;
  background: rgba(253, 250, 242, 0.5);
}

/* ═══ 二、顶部状态栏(时间/地点/血量/境界) ═══ */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  margin: 12px 0;
  background: linear-gradient(135deg, #f8f5ed 0%, #ede6d5 100%);
  border: 1px solid rgba(90,140,80,0.32);
  border-left: 4px solid #b4964a;
  border-radius: 8px;
  color: #3a4a2a;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(180,150,90,0.15);
  position: relative;
  overflow: hidden;
}

.top-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #5a8c50, #b4964a, transparent);
  animation: topScan 6s linear infinite;
}

@keyframes topScan {
  0% { left: -100%; }
  100% { left: 100%; }
}

.top-bar span {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: rgba(90,140,80,0.10);
  border: 1px solid rgba(90,140,80,0.32);
  border-radius: 20px;
  color: #4a6a3a;
  font-family: 'Georgia', 'Noto Serif SC', serif;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.top-bar span:hover {
  background: rgba(90,140,80,0.18);
  border-color: #5a8c50;
  color: #2a3a1a;
  transform: translateY(-1px);
}

/* ═══ 三、正文气泡 ═══ */
.story-bubble {
  background: linear-gradient(135deg, #fdfaf2 0%, #f8f5ed 100%);
  border: 1px solid rgba(180,150,90,0.28);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 14px 0;
  color: #2a3a1a;
  font-size: 15px;
  line-height: 1.9;
  font-family: 'Georgia', 'Noto Serif SC', 'STSong', serif;
  box-shadow: 0 3px 14px rgba(140,110,70,0.14);
  position: relative;
}

.story-bubble::before {
  content: '❋';
  position: absolute;
  top: -12px;
  left: 20px;
  padding: 0 8px;
  background: #f5f2ea;
  color: #5a8c50;
  font-size: 18px;
  letter-spacing: 2px;
}

.story-bubble::after {
  content: '❋';
  position: absolute;
  bottom: -12px;
  right: 20px;
  padding: 0 8px;
  background: #f5f2ea;
  color: #b4964a;
  font-size: 18px;
  letter-spacing: 2px;
}

.story-bubble p {
  margin: 0 0 12px 0;
  text-align: justify;
  text-indent: 2em;
}

.story-bubble p:last-child {
  margin-bottom: 0;
}

.story-bubble b, .story-bubble strong {
  color: #8c6e46;
  font-weight: 700;
}

.story-bubble em, .story-bubble i {
  color: #5a8c50;
  font-style: normal;
}

/* ═══ 四、通用折叠区(details标签·档案面板) ═══ */
details:not(.cot) {
  background: linear-gradient(135deg, #f8f5ed 0%, #ede6d5 100%);
  border: 1px solid rgba(90,140,80,0.28);
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(140,110,70,0.08);
}

details:not(.cot) summary {
  padding: 11px 16px;
  background: linear-gradient(90deg, rgba(90,140,80,0.14), rgba(180,150,90,0.09));
  color: #4a6a3a;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  outline: none;
  border-bottom: 1px solid rgba(90,140,80,0.10);
}

details:not(.cot) summary:hover {
  background: linear-gradient(90deg, rgba(90,140,80,0.22), rgba(180,150,90,0.16));
  color: #2a3a1a;
}

details:not(.cot)[open] summary {
  border-bottom: 1px dashed rgba(90,140,80,0.30);
}

details:not(.cot) summary::marker,
details:not(.cot) summary::-webkit-details-marker {
  color: #5a8c50;
}

details:not(.cot) summary span {
  font-weight: 400;
  color: #8c8878;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* ═══ 五、滚动容器 ═══ */
.scroll-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding: 12px 14px;
  background: rgba(253, 250, 242, 0.5);
}

.scroll-wrap::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.scroll-wrap::-webkit-scrollbar-track {
  background: rgba(235, 228, 211, 0.5);
  border-radius: 3px;
}

.scroll-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #5a8c50, #b4964a);
  border-radius: 3px;
}

/* ═══ 六、面板表格(状态栏核心) ═══ */
.panel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #2a3a1a;
  font-family: 'Georgia', 'Noto Serif SC', serif;
  background: transparent;
}

.panel-table tr {
  border-bottom: 1px dashed rgba(90,140,80,0.18);
  transition: background 0.15s ease;
}

.panel-table tr:hover {
  background: rgba(90,140,80,0.06);
}

.panel-table tr:last-child {
  border-bottom: none;
}

.panel-table th {
  padding: 8px 12px;
  background: rgba(90,140,80,0.12);
  color: #4a6a3a;
  font-weight: 700;
  font-size: 12.5px;
  text-align: left;
  min-width: 90px;
  letter-spacing: 0.5px;
  border-right: 1px solid rgba(90,140,80,0.14);
}

.panel-table td {
  padding: 8px 12px;
  color: #2a3a1a;
  line-height: 1.7;
  border-right: 1px solid rgba(90,140,80,0.08);
}

.panel-table td:last-child {
  border-right: none;
}

/* 分区标题行(带背景色的th·跨列) */
.panel-table th[colspan] {
  background: linear-gradient(90deg, rgba(90,140,80,0.20), rgba(180,150,90,0.14));
  color: #2a3a1a;
  font-size: 13.5px;
  padding: 10px 14px;
  text-align: center;
  letter-spacing: 2px;
  border: none;
  border-top: 1px solid rgba(90,140,80,0.28);
  border-bottom: 1px solid rgba(90,140,80,0.28);
}

/* 性化字段分区(红色背景) */
.panel-table th[colspan][style*="200,80,60"],
.panel-table th[colspan][style*="rgba(200"] {
  background: linear-gradient(90deg, rgba(180,90,70,0.16), rgba(180,90,70,0.08)) !important;
  color: #a04030 !important;
  border-color: rgba(180,90,70,0.32) !important;
}

/* ═══ 七、女性成员/男性成员/炉鼎档案·嵌套折叠 ═══ */
details details {
  margin: 8px 0;
  border-radius: 6px;
  border: 1px solid rgba(90,140,80,0.24);
  background: linear-gradient(135deg, #fdfaf2 0%, #f5f2ea 100%);
  box-shadow: 0 1px 4px rgba(140,110,70,0.08);
}

details details summary {
  padding: 9px 14px;
  background: linear-gradient(90deg, rgba(180,150,90,0.10), transparent);
  color: #6a5a3a;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(180,150,90,0.15);
}

details details summary:hover {
  background: linear-gradient(90deg, rgba(180,150,90,0.20), transparent);
  color: #4a3a1a;
}

/* ═══ 八、快捷选项面板 ═══ */
.opts-panel {
  background: linear-gradient(135deg, rgba(100,140,180,0.08), rgba(90,140,80,0.05));
  border: 1px solid rgba(100,140,180,0.28);
  border-left: 3px solid #4a6a8c;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  box-shadow: 0 2px 10px rgba(100,140,180,0.10);
}

.opts-panel::before {
  content: '⚡ 快捷选项';
  display: block;
  color: #4a6a8c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(100,140,180,0.28);
}

.opts-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.opts-panel li {
  margin: 0;
  padding: 0;
}

.opts-panel li div[data-action] {
  display: block;
  padding: 8px 14px;
  background: linear-gradient(90deg, #f8f5ed, #f0eadc);
  border: 1px solid rgba(100,140,180,0.24);
  border-left: 3px solid rgba(100,140,180,0.50);
  border-radius: 6px;
  color: #3a4a5a;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
  user-select: none;
}

.opts-panel li div[data-action]:hover {
  background: linear-gradient(90deg, #f0eadc, #e6dfc8);
  border-left-color: #4a6a8c;
  color: #1a2a3a;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(100,140,180,0.20);
}

.opts-panel li div[data-action]:active {
  transform: translateX(2px);
  box-shadow: 0 1px 3px rgba(100,140,180,0.30);
}

/* ═══ 九、思维链内的锚点标签 ═══ */
details.cot p,
details.cot div {
  margin: 4px 0;
  color: #4a5a3a;
}

/* [RegexAnchor: XXX] 样式 */
details.cot :is(p,div):has-text("RegexAnchor"),
details.cot > div {
  color: #7a8a6a;
  font-size: 11.5px;
  font-style: italic;
}

/* ═══ 十、代码块/引用块 ═══ */
details.cot code,
.story-bubble code {
  padding: 2px 6px;
  background: rgba(180,150,90,0.12);
  border: 1px solid rgba(180,150,90,0.28);
  border-radius: 3px;
  color: #8c6e46;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 12px;
  letter-spacing: 0.3px;
}

/* ═══ 十一、契约档案·特殊样式 ═══ */
.panel-table th[colspan][style*="120,80,140"] {
  background: linear-gradient(90deg, rgba(140,80,140,0.16), rgba(140,80,140,0.08)) !important;
  color: #6a3a6a !important;
  border-color: rgba(140,80,140,0.32) !important;
}

/* ═══ 十二、记忆区专属样式 ═══ */
.panel-table td[colspan] {
  padding: 10px 14px;
  background: rgba(245,242,234,0.6);
  color: #3a4a2a;
  font-style: italic;
  border-top: 1px dashed rgba(90,140,80,0.15);
  border-bottom: 1px dashed rgba(90,140,80,0.15);
  line-height: 1.75;
}

/* ═══ 十三、状态图标 ═══ */
.panel-table td:has-text("🟢"),
.panel-table td:has-text("🟡"),
.panel-table td:has-text("🟠"),
.panel-table td:has-text("🔴"),
.panel-table td:has-text("🟤"),
.panel-table td:has-text("⚫"),
.panel-table td:has-text("🟣"),
.panel-table td:has-text("🔵") {
  font-weight: 600;
}

/* ═══ 十四、数值面板(HP/灵力/神识/精血) ═══ */
.panel-table td:has-text("/") {
  font-family: 'Consolas', 'Menlo', monospace;
  color: #5a8c50;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ═══ 十五、六维显示 ═══ */
.panel-table td:has-text("💠"),
.panel-table td:has-text("⚔️"),
.panel-table td:has-text("❤️"),
.panel-table td:has-text("🧠"),
.panel-table td:has-text("🍀"),
.panel-table td:has-text("💫") {
  color: #4a6a3a;
  font-weight: 600;
}

/* ═══ 十六、心声字段·特殊样式 ═══ */
.panel-table tr:has(th:has-text("💭")) td {
  background: rgba(180,150,90,0.09);
  color: #5a4a2a;
  font-style: italic;
  border-left: 2px solid rgba(180,150,90,0.40);
  padding-left: 14px;
}

/* ═══ 十七、契约印记/血脉印记 ═══ */
.panel-table tr:has(th:has-text("印记")) td,
.panel-table tr:has(th:has-text("烙印")) td {
  color: #a04030;
  font-weight: 600;
}

/* ═══ 十八、动画效果 ═══ */
@keyframes gentle-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(140,110,70,0.10); }
  50% { box-shadow: 0 2px 14px rgba(90,140,80,0.20); }
}

.top-bar {
  animation: gentle-glow 4s ease-in-out infinite;
}

/* ═══ 十九、响应式适配 ═══ */
@media (max-width: 768px) {
  .story-bubble {
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.85;
  }
  
  .top-bar {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .top-bar span {
    padding: 3px 10px;
    font-size: 11.5px;
  }
  
  .panel-table {
    font-size: 12px;
  }
  
  .panel-table th {
    padding: 7px 10px;
    font-size: 11.5px;
    min-width: 70px;
  }
  
  .panel-table td {
    padding: 7px 10px;
  }
  
  details.cot summary,
  details:not(.cot) summary {
    font-size: 12.5px;
    padding: 9px 14px;
  }
  
  .scroll-wrap {
    padding: 10px 12px;
  }
  
  .opts-panel {
    padding: 10px 12px;
  }
  
  .opts-panel li div[data-action] {
    font-size: 12.5px;
    padding: 7px 12px;
  }
}

/* ═══ 二十、打印/深色模式适配 ═══ */
@media print {
  details.cot,
  .opts-panel {
    display: none;
  }
  
  .story-bubble {
    background: #ffffff;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* ═══ 二十一、辅助类 ═══ */
.tag-positive {
  color: #4a6a3a;
  font-weight: 600;
}

.tag-negative {
  color: #a04030;
  font-weight: 600;
}

.tag-neutral {
  color: #8c6e46;
  font-weight: 600;
}

.tag-magic {
  color: #6a3a8c;
  font-weight: 600;
  font-style: italic;
}

/* ═══ 二十二、highlight类·特殊高亮 ═══ */
.highlight {
  background: linear-gradient(120deg, transparent 50%, rgba(180,150,90,0.30) 50%);
  padding: 0 3px;
  color: #4a3a1a;
  font-weight: 600;
}

/* ═══ 二十三、Markdown代码块美化 ═══ */

/* 代码块外层容器·多行代码 */
pre {
  margin: 12px 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f5f2ea 0%, #ede6d5 50%, #e6dfc8 100%);
  border: 1px solid rgba(90,140,80,0.35);
  border-left: 4px solid #b4964a;
  border-radius: 8px;
  overflow-x: auto;
  position: relative;
  box-shadow: 0 2px 10px rgba(140,110,70,0.14),
              inset 0 0 20px rgba(180,150,90,0.05);
  font-family: 'Consolas', 'Menlo', 'Noto Sans SC Mono', monospace;
  font-size: 12.5px;
  line-height: 1.75;
  color: #3a4a2a;
}

/* 代码块顶部装饰·古卷竹简感 */
pre::before {
  content: '❋ 卷 ❋';
  position: absolute;
  top: -10px;
  left: 16px;
  padding: 2px 12px;
  background: linear-gradient(90deg, #b4964a, #8c6e46);
  color: #fdfaf2;
  font-size: 11px;
  font-family: 'Georgia', 'Noto Serif SC', serif;
  font-weight: 600;
  letter-spacing: 3px;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(180,150,90,0.35);
}

/* 代码块底部装饰线 */
pre::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #5a8c50, #b4964a, #8c6e46, transparent);
  opacity: 0.5;
}

/* 代码块内的code·继承pre样式 */
pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #2a3a1a;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: 0.3px;
}

/* 行内代码·区别于代码块 */
:not(pre) > code {
  padding: 2px 8px;
  background: linear-gradient(90deg, rgba(180,150,90,0.15), rgba(180,150,90,0.10));
  border: 1px solid rgba(180,150,90,0.30);
  border-radius: 4px;
  color: #8c6e46;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  font-weight: 600;
}

/* 代码块滚动条美化 */
pre::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

pre::-webkit-scrollbar-track {
  background: rgba(180,150,90,0.10);
  border-radius: 3px;
}

pre::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #5a8c50, #b4964a);
  border-radius: 3px;
}

pre::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #4a7040, #a08640);
}

/* ═══ 代码块内的语法高亮(简单实现) ═══ */

/* 标题行·如 ## / ### */
pre code {
  color: #2a3a1a;
}

/* 契约档案专用代码块·紫色调 */
pre:has(code:contains("契约"))::before {
  background: linear-gradient(90deg, #8c4a7c, #6a3a6a);
  content: '🔒 契 ❋';
}

/* 主提示词代码块·翠绿调 */
pre:has(code:contains("初始设定"))::before {
  background: linear-gradient(90deg, #5a8c50, #4a7040);
  content: '📜 传 ❋';
}

/* 世界书条目代码块·古金调(默认) */
pre:has(code:contains("触发关键词"))::before {
  background: linear-gradient(90deg, #b4964a, #8c6e46);
  content: '📖 书 ❋';
}

/* ═══ 二十四、块引用美化 ═══ */
blockquote {
  margin: 12px 0;
  padding: 12px 18px 12px 22px;
  background: linear-gradient(90deg, rgba(90,140,80,0.10), rgba(90,140,80,0.03));
  border-left: 4px solid #5a8c50;
  border-radius: 0 8px 8px 0;
  color: #4a5a3a;
  font-style: italic;
  font-family: 'Georgia', 'Noto Serif SC', serif;
  font-size: 14px;
  line-height: 1.85;
  position: relative;
  box-shadow: 0 2px 6px rgba(90,140,80,0.10);
}

blockquote::before {
  content: '❝';
  position: absolute;
  top: 4px;
  left: 8px;
  color: rgba(90,140,80,0.35);
  font-size: 24px;
  font-family: 'Georgia', serif;
  line-height: 1;
}

blockquote p {
  margin: 0;
  padding-left: 8px;
}

blockquote p + p {
  margin-top: 8px;
}

/* ═══ 二十五、无序列表/有序列表美化 ═══ */
.story-bubble ul,
.story-bubble ol,
pre + ul,
pre + ol {
  margin: 8px 0 12px 24px;
  padding: 0;
}

.story-bubble ul li,
.story-bubble ol li {
  margin-bottom: 5px;
  color: #3a4a2a;
  line-height: 1.75;
}

.story-bubble ul li::marker {
  color: #5a8c50;
  font-weight: 700;
}

.story-bubble ol li::marker {
  color: #b4964a;
  font-weight: 700;
}

/* ═══ 二十六、水平分隔线 ═══ */
hr {
  margin: 16px 0;
  border: none;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(90,140,80,0.25) 20%, 
    rgba(180,150,90,0.35) 50%, 
    rgba(90,140,80,0.25) 80%, 
    transparent 100%
  );
  position: relative;
}

hr::after {
  content: '❋';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 12px;
  background: #f5f2ea;
  color: #b4964a;
  font-size: 14px;
  letter-spacing: 4px;
}

/* ═══ 二十七、Markdown标题层级 ═══ */

/* 一级标题 */
.story-bubble h1,
h1 {
  color: #2a3a1a;
  font-size: 22px;
  font-weight: 900;
  margin: 18px 0 12px 0;
  padding: 8px 0 8px 14px;
  border-left: 5px solid #5a8c50;
  background: linear-gradient(90deg, rgba(90,140,80,0.12), transparent);
  border-radius: 0 6px 6px 0;
  letter-spacing: 2px;
  font-family: 'Georgia', 'Noto Serif SC', serif;
}

/* 二级标题 */
.story-bubble h2,
h2 {
  color: #4a6a3a;
  font-size: 18px;
  font-weight: 700;
  margin: 16px 0 10px 0;
  padding: 6px 0 6px 12px;
  border-left: 4px solid #b4964a;
  background: linear-gradient(90deg, rgba(180,150,90,0.12), transparent);
  border-radius: 0 5px 5px 0;
  letter-spacing: 1.5px;
}

/* 三级标题 */
.story-bubble h3,
h3 {
  color: #6a5a3a;
  font-size: 15px;
  font-weight: 700;
  margin: 12px 0 8px 0;
  padding: 4px 0 4px 10px;
  border-left: 3px solid #8c6e46;
  letter-spacing: 1px;
}

/* 四级标题 */
.story-bubble h4,
h4 {
  color: #5a4a2a;
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 6px 0;
  letter-spacing: 0.5px;
}

h4::before {
  content: '◆ ';
  color: #b4964a;
  margin-right: 2px;
}

/* ═══ 修仙纪事·代码块+Markdown美化补丁·完毕 ═══ */

/* ═══ 修仙纪事·内置CSS·完毕 ═══ */