/* ═══════════════════════════════════════════════
   LANTING —— 澜庭 · 暖琥珀暗色主题 v1
   变量作用域修复：:root → ai（适配平台 .custom-styles 前缀）
   ═══════════════════════════════════════════════ */

/* ── 变量挂在 ai 上，随平台前缀一起生效 ── */
ai {
  /* 强制暗色背景层 —— 不跟随平台 */
  --bg-deep: #0e0a0c;
  --bg-card: #1b1116;
  --bg-card-alt: #221620;
  --bg-hover: #2c1c24;
  --bg-surface: #150d11;

  /* 折叠栏专用 */
  --bg-fold: #0a0608;
  --bg-fold-summary: #0d080a;

  /* 边框 —— 高对比，白天也可见 */
  --border-soft: rgba(217, 180, 120, 0.25);
  --border-glow: rgba(230, 200, 140, 0.40);
  --border-strong: rgba(220, 175, 110, 0.55);
  --border-fold: rgba(80, 200, 255, 0.65);
  --border-fold-alt: rgba(217, 160, 91, 0.65);
  --border-fold-inner: rgba(80, 200, 255, 0.40);

  /* 文字 —— 全面提亮，确保白天模式可读 */
  --text-main: #fff5e8;
  --text-bright: #ffffff;
  --text-dim: #e0d5c8;
  --text-muted: #a8a098;
  --text-faint: #787068;

  /* 功能色 —— 高饱和荧光，白天也醒目 */
  --accent-lavender: #d9a05b;
  --accent-rose: #ff80a8;
  --accent-gold: #ffd870;
  --accent-mint: #60f0b8;
  --accent-sky: #70d0ff;
  --accent-sky-dim: #58b0e0;
  --accent-peach: #e8b880;

  /* 折叠栏荧光色 */
  --accent-fluo-lavender: #e8b070;
  --accent-fluo-rose: #ff80b0;
  --accent-fluo-mint: #60ffb8;
  --accent-fluo-gold: #ffe080;

  /* 阴影 —— 加深确保白天有层次 */
  --shadow-soft: 0 2px 20px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(217, 160, 91, 0.12);
  --shadow-fluo: 0 0 16px rgba(80, 200, 255, 0.30);

  /* 圆角 */
  --radius: 10px;
  --radius-sm: 6px;

  /* ── 容器本体样式 ── */
  display: block;
  max-width: 780px;
  margin: 1.5em auto;
  padding: 0;
  font-family: "Noto Serif SC", "Source Han Serif CN", "Georgia", serif;
  font-size: 15.5px;
  line-height: 1.82;
  color: var(--text-main) !important;
  background: var(--bg-deep) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* ══════════════════════════════════════
   安全网 —— ai 内所有元素默认透明背景
   ══════════════════════════════════════ */
ai * {
  background-color: transparent !important;
}

/* ══════════════════════════════════════
   顶部标题条
   ══════════════════════════════════════ */
hd {
  display: block;
  text-align: center;
  font-family: "Courier New", "Fira Code", monospace;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-lavender) !important;
  padding: 14px 20px;
  margin-bottom: 0;
  background: linear-gradient(135deg, rgba(217, 160, 91, 0.14) 0%, rgba(255, 110, 150, 0.08) 100%) !important;
  border: 1.5px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  text-shadow: 0 0 12px rgba(200, 168, 240, 0.35);
}

/* ══════════════════════════════════════
   世界状态栏（首个折叠块）
   ══════════════════════════════════════ */
ai > details:first-of-type {
  background: var(--bg-fold) !important;
  border: 2px solid var(--border-fold);
  border-top: none;
  border-bottom: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
}

ai > details:first-of-type > summary {
  font-family: "Courier New", monospace;
  font-size: 12.5px;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--accent-sky) !important;
  padding: 11px 20px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-fold-summary) !important;
  border-bottom: 1px solid var(--border-fold-inner);
  list-style: none;
  text-shadow: 0 0 12px rgba(80, 200, 255, 0.40);
  transition: all 0.2s ease;
}

ai > details:first-of-type > summary::-webkit-details-marker { display: none; }

ai > details:first-of-type > summary:hover {
  background: rgba(80, 200, 255, 0.10) !important;
  text-shadow: 0 0 16px rgba(80, 200, 255, 0.55);
}

ai > details:first-of-type[open] > summary {
  border-bottom: 1.5px solid var(--border-fold);
  background: rgba(80, 200, 255, 0.08) !important;
}

/* 世界状态栏内容 */
ai > details:first-of-type > d {
  display: block;
  font-family: "Courier New", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-dim) !important;
  padding: 2px 24px;
}

ai > details:first-of-type > d:first-of-type { padding-top: 10px; }
ai > details:first-of-type > d:last-of-type { padding-bottom: 12px; }

/* ══════════════════════════════════════
   正文区 —— 强制暗底
   ══════════════════════════════════════ */
article {
  display: block;
  background: linear-gradient(180deg, var(--bg-card) 0%, #0e0b14 100%) !important;
  border-left: 1.5px solid var(--border-glow);
  border-right: 1.5px solid var(--border-glow);
  padding: 30px 32px 26px;
  margin: 0;
  position: relative;
}

article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border-glow) 50%, transparent 100%);
}

article > p {
  display: block;
  margin: 0 0 1em 0;
  text-indent: 2em;
  color: var(--text-bright) !important;
  font-size: 16px;
  line-height: 1.88;
  letter-spacing: 0.3px;
}

article > p:last-child { margin-bottom: 0; }

/* 对白 */
article > q {
  display: block;
  margin: 0.7em 0 0.7em 1em;
  padding: 10px 18px;
  text-indent: 0;
  font-style: normal;
  color: var(--accent-peach) !important;
  font-size: 15.5px;
  line-height: 1.82;
  border-left: 2.5px solid rgba(232, 184, 128, 0.55);
  background: rgba(232, 184, 128, 0.06) !important;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  quotes: none;
  text-shadow: 0 0 6px rgba(232, 184, 128, 0.12);
}

article > q::before,
article > q::after { content: none; }

/* ══════════════════════════════════════
   折叠块（通用）
   ══════════════════════════════════════ */
ai > details {
  background: var(--bg-fold) !important;
  border: 2px solid var(--border-fold-alt);
  border-top: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
}

ai > details:last-of-type {
  border-radius: 0 0 var(--radius) var(--radius);
  border-bottom: 2px solid var(--border-fold-alt);
}

ai > details > summary {
  font-family: "Courier New", monospace;
  font-size: 12.5px;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--accent-fluo-lavender) !important;
  padding: 11px 20px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-fold-summary) !important;
  border-bottom: 1px solid rgba(180, 140, 255, 0.30);
  transition: all 0.2s ease;
  list-style: none;
  text-shadow: 0 0 12px rgba(180, 140, 255, 0.35);
}

ai > details > summary::-webkit-details-marker { display: none; }

ai > details > summary:hover {
  background: rgba(180, 140, 255, 0.10) !important;
  text-shadow: 0 0 16px rgba(180, 140, 255, 0.50);
}

ai > details[open] > summary {
  border-bottom: 1.5px solid var(--border-fold-alt);
  background: rgba(180, 140, 255, 0.06) !important;
}

/* ══════════════════════════════════════
   折叠块内部
   ══════════════════════════════════════ */
ai > details p[t] {
  display: block;
  margin: 0;
  padding: 14px 20px 10px;
  background: var(--bg-fold) !important;
  border-bottom: 1px solid var(--border-soft);
}

ai > details p[t]:last-child { border-bottom: none; }

ai > details p[t]::before {
  content: attr(t);
  display: block;
  font-family: "Courier New", monospace;
  font-size: 11.5px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(200, 168, 240, 0.20);
}

/* 标签色 —— 高饱和确保白天可见 */
ai > details p[t="主角"]::before {
  color: var(--accent-sky);
  text-shadow: 0 0 8px rgba(80, 200, 255, 0.35);
}

ai > details p[t^="技师·"]::before {
  color: var(--accent-fluo-rose);
  text-shadow: 0 0 8px rgba(255, 128, 176, 0.35);
}

ai > details p[t="在场NPC"]::before,
ai > details p[t="不在场NPC ×最多2"]::before {
  color: var(--accent-fluo-mint);
  text-shadow: 0 0 8px rgba(80, 255, 184, 0.30);
}

ai > details p[t*="不在场"]::before {
  color: var(--text-muted);
}

/* 数据行 */
ai > details d {
  display: block;
  font-family: "Courier New", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-dim) !important;
  padding: 2px 4px;
}

ai > details d[n] {
  font-size: 11.5px;
  color: var(--text-muted) !important;
  font-style: italic;
  opacity: 0.92;
}

/* 心声 */
ai > details d[c="s"] {
  color: var(--accent-fluo-gold) !important;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dotted rgba(255, 224, 128, 0.25);
  font-style: italic;
  text-shadow: 0 0 6px rgba(255, 224, 128, 0.18);
}

ai > details d[c="d"] {
  color: var(--accent-fluo-rose) !important;
  font-style: italic;
  text-shadow: 0 0 6px rgba(255, 128, 176, 0.18);
}

/* ══════════════════════════════════════
   记忆区 / 伏笔台账 —— 表格紧凑化
   ══════════════════════════════════════ */
ai > details table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Courier New", "Fira Code", monospace;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-dim) !important;
  margin: 0;
}

ai > details table th {
  font-size: 9.5px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-fluo-lavender) !important;
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-fold-summary) !important;
  border-bottom: 1px solid var(--border-fold-inner);
  white-space: nowrap;
}

ai > details table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim) !important;
  vertical-align: top;
}

ai > details table tr:last-child td {
  border-bottom: none;
}

/* No. 列压窄 */
ai > details table th:first-child,
ai > details table td:first-child {
  width: 2.4em;
  color: var(--text-muted) !important;
  text-align: center;
}

/* ══════════════════════════════════════
   非折叠区标签 & 数据行
   ══════════════════════════════════════ */
p[t] {
  display: block;
  margin: 0;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border-soft);
}

p[t]:last-child { border-bottom: none; }

p[t]::before {
  content: attr(t);
  display: block;
  font-family: "Courier New", monospace;
  font-size: 11.5px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(200, 168, 240, 0.14);
}

p[t="主角"]::before { color: var(--accent-sky); text-shadow: 0 0 4px rgba(80, 200, 255, 0.15); }
p[t^="技师·"]::before { color: var(--accent-rose); text-shadow: 0 0 4px rgba(255, 128, 168, 0.15); }
p[t="在场NPC"]::before,
ai > details p[t="不在场NPC ×最多2"]::before { color: var(--accent-mint); text-shadow: 0 0 4px rgba(80, 240, 184, 0.15); }
p[t*="不在场"]::before { color: var(--text-muted); }

d {
  display: block;
  font-family: "Courier New", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-dim) !important;
  padding: 2px 4px;
}

d[n] {
  font-size: 11.5px;
  color: var(--text-muted) !important;
  font-style: italic;
  opacity: 0.88;
}

d[c="s"] {
  color: var(--accent-gold) !important;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dotted rgba(255, 216, 112, 0.20);
  font-style: italic;
  text-shadow: 0 0 4px rgba(255, 216, 112, 0.10);
}

d[c="d"] {
  color: var(--accent-rose) !important;
  font-style: italic;
  text-shadow: 0 0 4px rgba(255, 128, 168, 0.10);
}

/* ══════════════════════════════════════
   行动选项 —— 强制暗底高对比
   ══════════════════════════════════════ */
p[t="行动"] {
  display: block;
  margin: 0;
  padding: 18px 20px 20px;
  background: linear-gradient(135deg, rgba(217, 160, 91, 0.14) 0%, rgba(255, 110, 150, 0.08) 50%, rgba(255, 224, 128, 0.05) 100%) !important;
  border: 1.5px solid var(--border-strong);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  position: relative;
}

p[t="行动"]::before {
  content: attr(t);
  display: block;
  font-family: "Courier New", monospace;
  font-size: 11.5px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(255, 216, 112, 0.25);
  text-shadow: 0 0 8px rgba(255, 216, 112, 0.30);
}

p[t="行动"] d {
  color: var(--text-main) !important;
  font-size: 13.5px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

p[t="行动"] d:hover {
  background: rgba(217, 160, 91, 0.14) !important;
  color: var(--text-bright) !important;
}