/* === 核心变量与容器 === */
mu {
  --bg-paper: linear-gradient(135deg, #faf8f3 0%, #f4f1ea 100%);
  --accent-deep: #8b7355;
  --accent-light: #a89178;
  --text-dark: #2c2c2c;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a8a;
  --danger-red: #c73e3a;
  --affection-pink: #d4869c;
  --trust-blue: #6b8e9d;
  --sanity-purple: #8e6b9d;
  --border-tan: rgba(139, 115, 85, 0.25);
  --shadow-book: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(139, 115, 85, 0.15);
  
  display: block;
  max-width: 820px;
  margin: 0 auto;
  padding: 4px;
  color: var(--text-dark);
  line-height: 1.65;
  font-size: 15px;
}

/* === 正文区 === */
mu article {
  background: var(--bg-paper);
  border: 1px solid var(--border-tan);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 14px 0;
  box-shadow: var(--shadow-book);
  position: relative;
  overflow: hidden;
}

mu article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(139, 115, 85, 0.03) 28px,
      rgba(139, 115, 85, 0.03) 29px
    );
  pointer-events: none;
}

mu article p {
  margin: 12px 0;
  text-indent: 2em;
  color: var(--text-dark);
  line-height: 1.8;
}

mu article p:first-child {
  margin-top: 0;
}

mu article p:last-child {
  margin-bottom: 0;
}

/* === details 基础样式 === */
mu details {
  background: var(--bg-paper);
  border: 1px solid var(--border-tan);
  border-radius: 8px;
  margin: 12px 0;
  padding: 14px 16px;
  box-shadow: var(--shadow-book);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

mu details::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent-deep) 0%, transparent 100%);
  opacity: 0.4;
  transition: opacity 0.3s;
}

mu details[open] {
  border-color: var(--accent-deep);
  box-shadow: var(--shadow-hover);
}

mu details[open]::before {
  opacity: 0.75;
}

/* === summary 标题 === */
mu summary {
  font-weight: 600;
  color: var(--accent-deep);
  cursor: pointer;
  padding: 6px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
  user-select: none;
  font-size: 16px;
}

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

mu summary::before {
  content: '▸';
  font-size: 14px;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  display: inline-block;
}

mu details[open] summary::before {
  transform: rotate(90deg);
}

mu summary:hover {
  color: #6b5943;
}

/* === 当前情况面板 (class="a") === */
mu details.a::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 65px;
  height: 65px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%238b7355" stroke-width="1" opacity="0.1"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>') no-repeat center/contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

mu details.a[open]::after {
  opacity: 1;
}

mu details.a p {
  padding: 4px 0 4px 24px;
  margin: 3px 0;
  position: relative;
  color: var(--text-dark);
  font-size: 14px;
}

mu details.a p::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 2px;
  background: var(--accent-light);
  opacity: 0.6;
}

/* === 你的状态面板 (class="b") === */
mu details.b::after {
  content: '🌸';
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  opacity: 0.15;
  pointer-events: none;
}

/* === 穆屿川状态面板 (class="c") === */
mu details.c::after {
  content: '🎭';
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  opacity: 0.15;
  pointer-events: none;
}

mu details.c summary {
  color: var(--sanity-purple);
}

mu details.c::before {
  background: linear-gradient(180deg, var(--sanity-purple) 0%, transparent 100%);
}

/* === 关系数据面板 (class="d") === */
mu details.d::after {
  content: '';
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 50px;
  height: 50px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23d4869c" stroke-width="1.5" opacity="0.12"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>') no-repeat center/contain;
  pointer-events: none;
}

/* === 环境与物品面板 (class="e") === */
mu details.e b {
  color: var(--accent-deep);
  font-weight: 600;
  display: block;
  margin: 12px 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-tan);
}

/* === 记忆区面板 (class="f") === */
mu details.f summary::after {
  content: '📖';
  margin-left: auto;
  opacity: 0.4;
}

/* === 剧情信息面板 (class="g") === */
mu details.g::after {
  content: '🎬';
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  opacity: 0.12;
  pointer-events: none;
}

/* === 行动建议面板 (class="h") === */
mu details.h li {
  padding: 10px 14px;
  margin: 8px 0;
  background: linear-gradient(135deg, rgba(139, 115, 85, 0.05), rgba(139, 115, 85, 0.08));
  border-left: 3px solid var(--accent-deep);
  border-radius: 0 6px 6px 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-dark);
  list-style: none;
}

mu details.h li:hover {
  background: linear-gradient(135deg, rgba(139, 115, 85, 0.12), rgba(139, 115, 85, 0.16));
  border-left-width: 5px;
  transform: translateX(6px);
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.15);
}

mu details.h li strong {
  color: var(--accent-deep);
}

/* 风险提示与机遇提示 */
mu details.h p:has(strong):nth-last-of-type(2) {
  background: linear-gradient(135deg, rgba(199, 62, 58, 0.08), rgba(199, 62, 58, 0.12));
  border-left: 4px solid var(--danger-red);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin: 10px 0;
}

mu details.h p:has(strong):last-of-type {
  background: linear-gradient(135deg, rgba(212, 134, 156, 0.08), rgba(212, 134, 156, 0.12));
  border-left: 4px solid var(--affection-pink);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin: 10px 0;
}

/* === 通用文本样式 === */
mu strong {
  color: var(--accent-deep);
  font-weight: 600;
}

mu p {
  color: var(--text-dark);
  margin: 8px 0;
  line-height: 1.7;
}

mu li {
  margin: 6px 0;
  padding-left: 4px;
  color: var(--text-dark);
}

mu li::marker {
  color: var(--accent-light);
}

mu h2, mu h3, mu h4 {
  color: var(--accent-deep);
  margin: 14px 0 8px 0;
  font-weight: 600;
}

mu i, mu em {
  color: var(--text-secondary);
  font-style: italic;
}

/* === 表格样式 === */
mu table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  background: rgba(250, 248, 243, 0.6);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-tan);
}

mu th {
  background: linear-gradient(135deg, rgba(139, 115, 85, 0.15), rgba(139, 115, 85, 0.1));
  color: var(--accent-deep);
  padding: 9px 7px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-tan);
  font-size: 13px;
}

mu td {
  padding: 7px 7px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.08);
  color: var(--text-dark);
  vertical-align: top;
}

mu tr:nth-child(even) {
  background: rgba(139, 115, 85, 0.03);
}

mu tr:hover {
  background: rgba(139, 115, 85, 0.08);
  transition: background 0.2s;
}

/* 长期记忆表格特殊样式 */
mu details.f table:first-of-type {
  border: 2px solid rgba(212, 134, 156, 0.3);
}

mu details.f table:first-of-type th {
  background: linear-gradient(135deg, rgba(212, 134, 156, 0.18), rgba(212, 134, 156, 0.12));
  color: var(--affection-pink);
}

/* 短期记忆表格特殊样式 */
mu details.f table:nth-of-type(2) {
  border: 2px solid rgba(107, 142, 157, 0.3);
}

mu details.f table:nth-of-type(2) th {
  background: linear-gradient(135deg, rgba(107, 142, 157, 0.18), rgba(107, 142, 157, 0.12));
  color: var(--trust-blue);
}

/* 成长记录表格特殊样式 */
mu details.f table:nth-of-type(3) {
  border: 2px solid rgba(142, 107, 157, 0.3);
}

mu details.f table:nth-of-type(3) th {
  background: linear-gradient(135deg, rgba(142, 107, 157, 0.18), rgba(142, 107, 157, 0.12));
  color: var(--sanity-purple);
}

/* === 关系进展标记样式化 === */
mu details.g li {
  padding: 5px 8px;
  margin: 4px 0;
  border-radius: 4px;
  transition: background 0.2s;
  list-style: none;
}

mu details.g li:hover {
  background: rgba(139, 115, 85, 0.06);
}

/* === 数值高亮 (利用emoji作为锚点) === */
mu li:has(strong)::marker {
  color: transparent;
}

mu p:has(strong):not(:has(b)) {
  padding-left: 8px;
  border-left: 2px solid transparent;
  transition: border-color 0.3s;
}

mu details.b p:nth-of-type(11) strong:first-of-type,
mu details.c p:nth-of-type(11) strong:first-of-type {
  color: var(--affection-pink);
}

mu details.b p:nth-of-type(12) strong:first-of-type,
mu details.c p:nth-of-type(12) strong:first-of-type {
  color: var(--trust-blue);
}

mu details.c p:nth-of-type(9) strong:last-of-type {
  color: var(--danger-red);
  font-weight: 700;
}

/* === 内心想法装饰线 === */
mu p:has(strong):last-of-type::after {
  content: '';
  display: block;
  margin-top: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light) 20%, var(--accent-light) 80%, transparent);
  opacity: 0.3;
}

/* === 移动端适配 === */
@media (max-width: 768px) {
  mu {
    padding: 0 6px;
    font-size: 14px;
  }
  
  mu details {
    margin: 10px 0;
    padding: 12px 14px;
    border-radius: 6px;
  }
  
  mu article {
    padding: 14px 16px;
    margin: 12px 0;
  }
  
  mu summary {
    font-size: 15px;
  }
  
  mu table {
    font-size: 12px;
  }
  
  mu th, mu td {
    padding: 6px 4px;
  }
  
  mu details::before {
    width: 3px;
  }
  
  mu details.h li {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  mu {
    font-size: 13px;
  }
  
  mu details {
    margin: 8px 0;
    padding: 10px 12px;
  }
  
  mu article {
    padding: 12px 14px;
  }
  
  mu article p {
    text-indent: 1.5em;
  }
  
  mu summary {
    font-size: 14px;
  }
  
  mu table {
    font-size: 11px;
  }
  
  mu details.a::after,
  mu details.b::after,
  mu details.c::after,
  mu details.d::after,
  mu details.g::after {
    display: none;
  }
  
  mu details.h li:hover {
    transform: translateX(3px);
  }
}

/* === 打印优化 === */
@media print {
  mu details {
    border: 1px solid #999;
    box-shadow: none;
    page-break-inside: avoid;
  }
  
  mu details[open] summary::before {
    content: '';
  }
  
  mu article::before {
    display: none;
  }
}