/* ═══════════════════════════════════════════════════════
   东京喰种·大世界 · 内置CSS（rili版）  CSS-v1.2.1（配色对齐版）
   对应：输出格式 v1.2（tg- 命名空间，标准 HTML 标签 + 专属 class）
   主题：对齐《详细介绍页 v3.0》D 新粗野主义简报配色
         亮色：冷灰纸底 #e8ebef + 白卡 + 墨描边 #15171b + 硬阴影 + 四色语义
         暗色：暗底 #16181d 系 + 亮描边 #eef0f4 + 纯黑阴影 + 四色提亮版
   平台规则（rili）：色值全部写死；禁内联 style 依赖；禁 JS；
                    禁 fixed/sticky；关键样式 !important
   ── v1.2.1 变更（相对 v1.2）──
   仅配色对齐 HTML v3.0；结构/修正（字号 1.3em、精确 transition、
   原生 table、无 hover 位移）全部保留。
   ═══════════════════════════════════════════════════════ */

/* 参考色板（对齐 东京喰种-详细介绍-v3.0.html）
   亮色：paper #e8ebef / card #f6f8fa / card2 #ffffff
         ink #15171b / ink2 #454a53 / dim #6d737d / bd #15171b
         green #00a36c(bg #d9f4e6) / yellow #f5b301(bg #fdf0c2)
         purple #7c5cff(bg #e9e4ff) / orange #ff6b35(bg #ffe2d4)
         red #d43f3f / sh 5px 5px 0 #15171b / sh-sm 3px 3px 0 #15171b
   暗色：paper #16181d / card #1e222a / card2 #242933
         ink #eef0f4 / ink2 #a9aeba / dim #7d828e / bd #eef0f4
         green #17c98a(bg #16352a) / yellow #ffc53d(bg #3a3013)
         purple #9d84ff(bg #2a2440) / orange #ff7a45(bg #3d2418)
         red #d43f3f（两模式） / sh #000 / sh-sm #000
   语义映射：场景与角色=绿 / NPC信息=紫 / 记忆与情报=黄 / 剧情分支=橙
*/

/* ── 1. 唯一父类作用域：.tg-game（冷灰纸底 + 网点纹理 + 墨描边） ── */
.tg-game {
  display: block !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin: 0.8em 0 !important;
  padding: 0.9em !important;
  background-color: #e8ebef !important;
  background-image: radial-gradient(circle, rgba(21, 23, 27, 0.14) 1px, transparent 1.6px) !important;
  background-size: 22px 22px !important;
  border: 2px solid #15171b !important;
  border-radius: 12px !important;
  box-shadow: 5px 5px 0 #15171b !important;
  color: #15171b !important;
  font-size: 1.3em !important; /* 基准字号 ≥1.3em 铁律；子级 1em=继承 */
  line-height: 1.6 !important;
  overflow: hidden !important;
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif !important;
}

/* ── 2. 文本兜底及高亮样式（显式声明，禁依赖继承） ── */
.tg-game p, .tg-game span, .tg-game div, .tg-game td {
  color: #15171b !important;
}
.tg-game strong { color: #15171b !important; font-weight: 600 !important; }
.tg-game em { color: #6d737d !important; }

/* ── 3. 顶部信息条 .tg-status-bar（黄底黑字横幅 + 墨描边硬阴影） ── */
.tg-game .tg-status-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.5em 1.2em !important;
  padding: 0.6em 0.9em !important;
  margin-bottom: 0.8em !important;
  background: #f5b301 !important;
  border: 2px solid #15171b !important;
  border-radius: 8px !important;
  box-shadow: 4px 4px 0 #15171b !important;
  font-family: "Consolas", "Courier New", monospace !important;
}
.tg-game .tg-stat {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 8em !important;
  min-width: 7em !important;
  gap: 0.1em !important;
}
.tg-game .tg-label {
  display: block !important;
  font-size: 0.9em !important;
  color: rgba(21, 23, 27, 0.7) !important;
  letter-spacing: 0.08em !important;
}
.tg-game .tg-value {
  display: block !important;
  font-size: 1em !important;
  font-weight: 700 !important;
  color: #15171b !important;
}
/* 时间线（第二个 tg-stat）= 世界书触发标记 → 黑字加粗 + 下划线高亮 */
.tg-game .tg-stat:nth-of-type(2) .tg-label { color: #15171b !important; font-weight: 700 !important; }
.tg-game .tg-stat:nth-of-type(2) .tg-value {
  color: #15171b !important;
  font-weight: 900 !important;
  border-bottom: 2px solid #15171b !important;
  display: inline-block !important;
}

/* ── 4. 专属折叠卡（tg-details + 身份牌，弃 nth-of-type） ── */
.tg-game .tg-details {
  display: block !important;
  font-size: 1em !important;
  margin: 0.6em 0 !important;
  background: #f6f8fa !important;
  border: 2px solid #15171b !important;
  border-radius: 10px !important;
  box-shadow: 3px 3px 0 #15171b !important;
  overflow: hidden !important;
}

.tg-game .tg-details summary {
  display: flex !important;
  align-items: center !important;
  font-size: 1em !important;
  font-weight: 700 !important;
  color: #15171b !important;
  background: #f6f8fa !important;
  padding: 0.7em 0.9em 0.7em 2em !important;
  cursor: pointer !important;
  list-style: none !important;
  position: relative !important;
  border-bottom: 2px solid #15171b !important;
  transition: background-color 0.15s ease !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}
.tg-game .tg-details summary:hover { background: #e8ebef !important; }
.tg-game .tg-details summary::before {
  content: '▶' !important;
  position: absolute !important;
  left: 0.75em !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: #15171b !important;
  font-size: 0.7em !important;
  transition: transform 0.2s ease !important;
  pointer-events: none !important;
}
.tg-game .tg-details[open] summary::before { transform: translateY(-50%) rotate(90deg) !important; }
.tg-game .tg-details summary::-webkit-details-marker { display: none !important; }

/* 4.1 思维链（.tg-mind）：虚线墨边 + 内容偏灰小字号（弱于正文） */
.tg-game .tg-mind {
  border-style: dashed !important;
  background: #f6f8fa !important;
}
.tg-game .tg-mind summary { border-bottom-style: dashed !important; }
.tg-game .tg-mind, .tg-game .tg-mind p {
  color: #454a53 !important;
  font-size: 0.92em !important;
  line-height: 1.7 !important;
}

/* 4.2 场景与角色（.tg-scene）→ 信号绿 */
.tg-game .tg-scene summary { background: #d9f4e6 !important; border-left: 4px solid #00a36c !important; }
/* 4.3 NPC信息（.tg-npc）→ 赫子紫 */
.tg-game .tg-npc summary { background: #e9e4ff !important; border-left: 4px solid #7c5cff !important; }
/* 4.4 记忆与情报（.tg-memory）→ 警戒黄 */
.tg-game .tg-memory summary { background: #fdf0c2 !important; border-left: 4px solid #f5b301 !important; }
/* 4.5 剧情分支（.tg-options，默认 open）→ 警戒橙 */
.tg-game .tg-options { border-color: #ff6b35 !important; }
.tg-game .tg-options summary { background: #ffe2d4 !important; border-left: 4px solid #ff6b35 !important; }

/* ── 5. 折叠区内部排版（场景/NPC/记忆内容区） ── */
.tg-game .tg-details p {
  display: block !important;
  margin: 0.5em 1em !important;
  color: #15171b !important;
  line-height: 1.7 !important;
}
.tg-game .tg-details strong { color: #15171b !important; }
.tg-game .tg-details hr {
  border: none !important;
  height: 1px !important;
  margin: 0.8em 1em !important;
  background: linear-gradient(90deg, rgba(21, 23, 27, 0.05), rgba(21, 23, 27, 0.45), rgba(21, 23, 27, 0.05)) !important;
}

/* ── 6. 正文区（.tg-text）：白纸卡 + 右上「机 密」旋转章（对齐 HTML .pv） ── */
.tg-game .tg-text {
  display: block !important;
  font-size: 1em !important;
  margin: 0.6em 0 !important;
  padding: 0.7em 1em !important;
  background: #ffffff !important;
  border: 2px solid #15171b !important;
  border-radius: 10px !important;
  box-shadow: 4px 4px 0 #15171b !important;
  position: relative !important;
}
.tg-game .tg-text::after {
  content: '机 密' !important;
  position: absolute !important;
  top: 0.6em !important;
  right: 0.8em !important;
  font-family: "Consolas", "Courier New", monospace !important;
  font-size: 0.85em !important;
  font-weight: 700 !important;
  letter-spacing: 2px !important;
  color: #d43f3f !important;
  border: 2px solid #d43f3f !important;
  padding: 0.1em 0.35em !important;
  border-radius: 4px !important;
  transform: rotate(7deg) !important;
  opacity: 0.8 !important;
  pointer-events: none !important;
}
.tg-game .tg-narration {
  display: block !important;
  margin: 0.8em 0 !important;
  color: #15171b !important;
  line-height: 1.85 !important;
  text-indent: 2em !important;
}
.tg-game .tg-speech {
  display: block !important;
  margin: 0.8em 0 !important;
  color: #7c5cff !important;
  font-weight: 500 !important;
  line-height: 1.85 !important;
  padding-left: 0.5em !important;
  border-left: 2px solid #7c5cff !important;
}

/* ── 7. 记忆与情报：表格滚动容器 + 原生 table（报告单：墨表头白字） ── */
.tg-game .tg-table-wrapper {
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  margin: 0.8em 0 !important;
  padding: 0 1em !important;
  box-sizing: border-box !important;
}
.tg-game .tg-table-wrapper p {
  margin: 0.3em 0 0.5em !important;
  padding: 0 !important;
  font-weight: 700 !important;
  color: #15171b !important;
}
.tg-game table {
  display: table !important;
  width: 100% !important;
  border-collapse: collapse !important;
  background: #ffffff !important;
  font-size: 0.95em !important;
}
.tg-game th, .tg-game td {
  border: 1px solid #15171b !important;
  padding: 0.55em 0.7em !important;
  line-height: 1.6 !important;
  text-align: left !important;
  vertical-align: top !important;
  color: #15171b !important;
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
}
.tg-game th {
  background: #15171b !important;
  color: #f6f8fa !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}
.tg-game tr:nth-child(even) td { background: #f6f8fa !important; }

/* ── 8. 剧情分支（.tg-options，默认 open）：选项块大点击区 ── */
.tg-game .tg-options-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.6em !important;
  padding: 0.8em 1em !important;
}
.tg-game .tg-option {
  display: block !important;
  font-size: 1em !important;
  padding: 0.8em 1em !important;
  background: #ffffff !important;
  border: 2px solid #15171b !important;
  border-left: 4px solid #ff6b35 !important;
  border-radius: 8px !important;
  box-shadow: 3px 3px 0 #15171b !important;
  color: #15171b !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  cursor: pointer !important;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease !important; /* 精确属性 */
}
.tg-game .tg-option:hover {
  background: #f6f8fa !important;
  border-left-color: #ff6b35 !important;
  box-shadow: 1px 1px 0 #15171b !important;
}

/* ── 9. 暗色模式（对齐 HTML v3.0 暗色令牌） ── */
@media (prefers-color-scheme: dark) {
  .tg-game {
    background-color: #16181d !important;
    background-image: radial-gradient(circle, rgba(238, 240, 244, 0.06) 1px, transparent 1.6px) !important;
    border-color: #eef0f4 !important;
    box-shadow: 5px 5px 0 #000000 !important;
    color: #eef0f4 !important;
  }
  .tg-game p, .tg-game span, .tg-game div, .tg-game td { color: #eef0f4 !important; }
  .tg-game strong { color: #eef0f4 !important; }
  .tg-game em { color: #7d828e !important; }

  /* 黄横幅保持黄底黑字（对比不依赖明暗），仅换边框/阴影 */
  .tg-game .tg-status-bar {
    background: #ffc53d !important;
    border-color: #eef0f4 !important;
    box-shadow: 4px 4px 0 #000000 !important;
  }
  .tg-game .tg-label { color: rgba(21, 23, 27, 0.7) !important; }
  .tg-game .tg-value { color: #15171b !important; }
  .tg-game .tg-stat:nth-of-type(2) .tg-label { color: #15171b !important; }
  .tg-game .tg-stat:nth-of-type(2) .tg-value { color: #15171b !important; border-bottom-color: #15171b !important; }

  /* 折叠卡 */
  .tg-game .tg-details {
    background: #1e222a !important;
    border-color: #eef0f4 !important;
    box-shadow: 3px 3px 0 #000000 !important;
  }
  .tg-game .tg-details summary {
    background: #1e222a !important;
    color: #eef0f4 !important;
    border-bottom-color: #eef0f4 !important;
  }
  .tg-game .tg-details summary:hover { background: #242933 !important; }
  .tg-game .tg-details summary::before { color: #eef0f4 !important; }

  /* 思维链 */
  .tg-game .tg-mind { border-color: #a9aeba !important; background: #1e222a !important; }
  .tg-game .tg-mind, .tg-game .tg-mind p { color: #a9aeba !important; }

  /* 四色语义块暗色版（深底亮字） */
  .tg-game .tg-scene summary { background: #16352a !important; color: #17c98a !important; border-left-color: #17c98a !important; }
  .tg-game .tg-npc summary { background: #2a2440 !important; color: #9d84ff !important; border-left-color: #9d84ff !important; }
  .tg-game .tg-memory summary { background: #3a3013 !important; color: #ffc53d !important; border-left-color: #ffc53d !important; }
  .tg-game .tg-options { border-color: #ff7a45 !important; }
  .tg-game .tg-options summary { background: #3d2418 !important; color: #ff7a45 !important; border-left-color: #ff7a45 !important; }

  /* 折叠内容区 */
  .tg-game .tg-details p { color: #eef0f4 !important; }
  .tg-game .tg-details strong { color: #eef0f4 !important; }
  .tg-game .tg-details hr { background: linear-gradient(90deg, rgba(238, 240, 244, 0.05), rgba(238, 240, 244, 0.4), rgba(238, 240, 244, 0.05)) !important; }

  /* 正文纸卡 */
  .tg-game .tg-text {
    background: #242933 !important;
    border-color: #eef0f4 !important;
    box-shadow: 4px 4px 0 #000000 !important;
  }
  .tg-game .tg-text::after { color: #d43f3f !important; border-color: #d43f3f !important; opacity: 0.85 !important; }
  .tg-game .tg-narration { color: #eef0f4 !important; }
  .tg-game .tg-speech { color: #9d84ff !important; border-left-color: #9d84ff !important; }

  /* 表格 */
  .tg-game table { background: #242933 !important; }
  .tg-game th, .tg-game td { border-color: #eef0f4 !important; color: #eef0f4 !important; }
  .tg-game th { background: #eef0f4 !important; color: #16181d !important; }
  .tg-game tr:nth-child(even) td { background: #1e222a !important; }
  .tg-game .tg-table-wrapper p { color: #eef0f4 !important; }

  /* 选项 */
  .tg-game .tg-option {
    background: #242933 !important;
    border-color: #eef0f4 !important;
    box-shadow: 3px 3px 0 #000000 !important;
    color: #eef0f4 !important;
  }
  .tg-game .tg-option:hover {
    background: #1e222a !important;
    box-shadow: 1px 1px 0 #000000 !important;
  }
}

/* ── 10. 移动端适配 ── */
@media (max-width: 600px) {
  .tg-game { padding: 0.6em !important; border-radius: 8px !important; }
  .tg-game .tg-status-bar { gap: 0.3em 0.8em !important; padding: 0.5em 0.6em !important; }
  .tg-game .tg-stat { flex: 1 1 40% !important; min-width: 0 !important; }
  .tg-game .tg-details summary { padding: 0.65em 0.7em 0.65em 1.8em !important; }
  .tg-game .tg-table-wrapper { padding: 0 0.6em !important; }
  .tg-game .tg-options-list { padding: 0.6em 0.8em !important; }
  .tg-game .tg-option { padding: 0.7em 0.85em !important; }
}

/* ── 11. 减少动态效果（动画全停，布局不变） ── */
@media (prefers-reduced-motion: reduce) {
  .tg-game * {
    animation: none !important;
    transition: none !important;
  }
}