:root {
  --bg: #141210;
  --panel: #1c1916;
  --panel-2: #24201c;
  --line: #3a342c;
  --text: #e8e0d4;
  --muted: #9a9080;
  --accent: #c4a46c;
  --ok: #7cb89a;
  --danger: #c4786a;
  --support: #8aabcc;
  --font: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; }
button, input, select {
  font: inherit; color: inherit; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.65rem;
}
button { cursor: pointer; }
button:hover, button.active { border-color: var(--accent); color: var(--accent); }
button.active { background: rgba(196, 164, 108, 0.12); }
a { color: var(--accent); }
code { font-size: 0.85em; color: var(--ok); }

.app { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.topbar h1 {
  margin: 0; font-family: var(--font); font-size: 1.15rem; font-weight: 600;
  letter-spacing: 0.04em; color: var(--accent);
}
.topbar .meta { color: var(--muted); font-size: 0.8rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.filters input[type="search"] { min-width: min(360px, 50vw); }
.filters .tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.layout { min-height: 0; display: grid; grid-template-columns: 280px 1fr 1.15fr; }
.col { min-height: 0; overflow: auto; border-right: 1px solid var(--line); padding: 0.75rem; }
.col:last-child { border-right: none; }
.col-title {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.55rem;
}

.list-item {
  width: 100%; text-align: left; margin-bottom: 0.35rem; padding: 0.55rem 0.65rem;
  display: grid; gap: 0.15rem; background: var(--panel);
}
.list-item .id { font-size: 0.7rem; color: var(--muted); }
.list-item .name { font-family: var(--font); font-size: 0.92rem; }
.list-item .sub { font-size: 0.74rem; color: var(--muted); }
.list-item.cat-chapter { border-left: 3px solid #8a7a5a; }
.chip.active-chip {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(196, 164, 108, 0.18);
}
.chapter-chips { max-height: 7.5rem; overflow: auto; }
.chapter-map-note {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}
.novel-panel h3 { margin-top: 0; }
.novel-read-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin: 0.65rem 0 0.35rem; font-family: var(--font);
}
.novel-read-head .linkish {
  font-size: 0.72rem; padding: 0.15rem 0.5rem;
}
.novel-body {
  font-family: var(--font);
  font-size: 0.92rem;
  line-height: 1.7;
  max-height: calc(100vh - 280px);
}
.trigger-box, .reward-box {
  margin: 0.35rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}
.reward-table { display: flex; flex-direction: column; gap: 0.35rem; }
.reward-row {
  padding: 0.35rem 0.45rem;
  border-left: 3px solid var(--ok);
  background: rgba(124, 184, 154, 0.08);
}
.reward-name { font-weight: 650; color: var(--ok); font-size: 0.88rem; }
.reward-meta { font-size: 0.74rem; color: var(--muted); margin-top: 0.15rem; }
.reward-subh {
  margin: 0.55rem 0 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.reward-highlight {
  margin: 0.25rem 0 0.55rem;
  padding: 0.4rem 0.55rem;
  border-left: 3px solid var(--ok);
  background: rgba(124, 184, 154, 0.1);
}
.muted-line { margin: 0.35rem 0 0; font-size: 0.78rem; color: var(--muted); }
.stage-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.35rem; }
.stage-row {
  display: grid; grid-template-columns: 2rem 1fr; gap: 0.55rem; align-items: start;
  text-align: left; width: 100%; padding: 0.55rem 0.65rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
}
.stage-row:hover { border-color: var(--accent); }
.stage-idx {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; border-radius: 999px;
  background: rgba(196, 164, 108, 0.18); color: var(--accent);
  font-size: 0.75rem; font-weight: 700;
}
.stage-body { display: grid; gap: 0.15rem; }
.stage-body .sub { font-size: 0.74rem; color: var(--muted); line-height: 1.4; }
.stage-overview-table { font-size: 0.8rem; margin-top: 0.45rem; }
.stage-overview-table th { white-space: nowrap; }
.stage-overview-table td { line-height: 1.45; }
.stage-overview-table td:nth-child(1) { min-width: 8.5rem; white-space: nowrap; }
.stage-overview-table td:nth-child(2) { min-width: 5rem; }
.stage-overview-table td:nth-child(4) { min-width: 11rem; font-size: 0.76rem; }
.stage-overview-table td:nth-child(6) { white-space: nowrap; }
.boss-battle-block {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(196, 164, 108, 0.35);
  border-radius: 6px;
  background: rgba(196, 164, 108, 0.06);
}
.boss-battle-block h3 { margin: 0 0 0.45rem; font-size: 1rem; }
.boss-battle-block h4 { margin: 0.65rem 0 0.3rem; font-size: 0.88rem; color: var(--muted); }
.boss-battle-block .battle-loot-box { margin-top: 0.25rem; }
.battle-loot-box .reward-row { border-left-color: var(--accent); }
.boss-wave-table { font-size: 0.78rem; margin-top: 0.25rem; }
.boss-wave-table td { vertical-align: top; }
.boss-unit-chip {
  display: inline-block;
  margin: 0.12rem 0.2rem 0.12rem 0;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.76rem;
  line-height: 1.35;
}
.boss-unit-chip.kind-boss { background: rgba(180, 70, 60, 0.22); }
.boss-unit-chip.kind-monster { background: rgba(90, 120, 70, 0.28); }
.boss-unit-chip.kind-enemy,
.boss-unit-chip.kind-grunt,
.boss-unit-chip.kind-elite { background: rgba(140, 90, 60, 0.22); }
.boss-unit-chip.kind-ally { background: rgba(70, 110, 150, 0.25); }
.battle-scene-cast {
  margin: 0.75rem 0 1rem;
}
.battle-scene-cast-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.45rem 0 0.75rem;
}
.battle-scene-cast-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 11rem;
  max-width: 18rem;
  flex: 1 1 12rem;
  padding: 0.4rem 0.55rem;
  margin: 0;
  border: 1px solid rgba(196, 164, 108, 0.28);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.16);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.battle-scene-cast-card:hover {
  border-color: rgba(196, 164, 108, 0.55);
  background: rgba(196, 164, 108, 0.08);
}
.battle-scene-cast-card.kind-boss {
  border-color: rgba(180, 70, 60, 0.45);
}
.battle-scene-cast-card.kind-ally {
  border-color: rgba(70, 110, 150, 0.45);
}
.battle-scene-cast-thumb {
  width: 3.1rem;
  height: 3.1rem;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.25);
}
.battle-scene-cast-thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px dashed rgba(196, 164, 108, 0.35);
}
.battle-scene-cast-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.3;
}
.battle-scene-cast-meta strong {
  font-size: 0.9rem;
}
.wave-over-cap td { color: #c45c4a; }
.stage-overview-row { cursor: pointer; }
.stage-overview-row:hover td {
  background: rgba(196, 164, 108, 0.08);
}
.stage-overview-row:focus {
  outline: none;
}
.stage-overview-row:focus td {
  background: rgba(196, 164, 108, 0.12);
}
.list-item.cat-quest-main, .list-item.cat-node { border-left: 3px solid var(--accent); }
.list-item.cat-quest-side, .list-item.cat-gate { border-left: 3px solid var(--ok); }
.list-item.cat-quest-sub { border-left: 3px solid #a09070; }
.list-item.cat-npc { border-left: 3px solid var(--support); }
.list-item.cat-game-dialogue { border-left: 3px solid #b8946a; }
.list-item.cat-game-skill, .list-item.cat-game-item { border-left: 3px solid #6a9e8a; }
.list-item.cat-base, .list-item.cat-quest-base { border-left: 3px solid #7a8aaa; }
.list-item.hit { outline: 1px solid rgba(196, 164, 108, 0.45); }

.section {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.85rem 1rem; margin-bottom: 0.75rem;
}
.section h2 {
  margin: 0 0 0.55rem; font-family: var(--font); font-size: 1.25rem; color: var(--accent);
}
.section h3 { margin: 0.9rem 0 0.4rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.bg-block {
  font-size: 0.86rem; line-height: 1.55; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 0.65rem 0.75rem; margin: 0.35rem 0 0.5rem;
}
.bg-block.dialogue-bg { margin: 0; border-radius: 0; border-left-width: 3px; font-size: 0.8rem; color: var(--muted); }
.bg-block.dialogue-bg strong { color: var(--accent); margin-right: 0.35rem; }
.bg-block.dialogue-bg div + div { margin-top: 0.25rem; }
.kv { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.25rem 0.6rem; font-size: 0.86rem; }
.kv .k { color: var(--muted); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin-top: 0.4rem;
}
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border, #333);
  padding: 0.35rem 0.45rem;
  text-align: left;
  vertical-align: top;
}
.data-table th { color: var(--muted); font-weight: 600; }
.data-table tr[data-eid]:hover td { background: rgba(255, 255, 255, 0.04); }

/* Excel-like 全员属性表 */
.layout.sheet-mode {
  grid-template-columns: 1fr;
}
.layout.sheet-mode .col:first-child,
.layout.sheet-mode .col:last-child {
  display: none;
}
.layout.sheet-mode .col:nth-child(2) {
  border-right: none;
  padding: 0.5rem 0.75rem 1rem;
}
.attr-sheet-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  margin-bottom: 0.35rem; position: sticky; top: 0; z-index: 3;
  background: var(--bg); padding: 0.35rem 0;
}
.attr-sheet-toolbar.attr-sheet-typebar {
  top: 2.4rem;
  margin-bottom: 0.55rem;
  padding-top: 0;
  border-top: 1px solid transparent;
}
.attr-sheet-toolbar .status { color: var(--muted); font-size: 0.8rem; margin-left: 0.25rem; }
.attr-sheet-toolbar .status.dirty { color: var(--accent); }
.attr-sheet-typebar .status:first-child {
  margin-left: 0;
  margin-right: 0.15rem;
  min-width: 2rem;
}
.attr-sheet-wrap {
  overflow: auto;
  max-height: calc(100vh - 140px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.attr-sheet {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
}
.attr-sheet th,
.attr-sheet td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.2rem 0.3rem;
  white-space: nowrap;
  background: var(--panel);
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  box-sizing: border-box;
  min-width: 0; /* 允许拖到极窄 */
}
.attr-sheet thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  user-select: none;
  outline: none;
  padding: 0.15rem 0.2rem;
}
.attr-sheet thead th:focus {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.attr-sheet thead th .th-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  padding-right: 0.15rem;
}
.attr-sheet thead th .th-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.attr-sheet thead th .col-collapse-btn {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.attr-sheet thead th .col-collapse-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(196, 164, 108, 0.15);
}
/* 折叠：整列（表头+全部数据）从布局消失 */
.attr-sheet col.col-collapsed,
.attr-sheet thead th.col-collapsed,
.attr-sheet tbody td.col-collapsed {
  display: none !important;
}
.attr-sheet-collapsed-bar {
  flex-wrap: wrap;
  gap: 0.25rem;
}
.attr-sheet-collapsed-bar .status {
  margin-right: 0.15rem;
}
.attr-sheet th.sticky-col,
.attr-sheet td.sticky-col {
  position: sticky; left: 0; z-index: 1;
  background: var(--panel-2);
  text-align: left;
  min-width: 0;
}
.attr-sheet thead th.sticky-col { z-index: 4; }
/* 行尾「固定」列 */
.attr-sheet th[data-col="pinned"],
.attr-sheet td.pin-cell {
  text-align: center;
  padding: 0.2rem 0.35rem;
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--panel-2);
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.25);
}
.attr-sheet thead th[data-col="pinned"] {
  z-index: 5;
  color: var(--accent);
}
.attr-sheet .pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.6rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(196, 164, 108, 0.18);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.attr-sheet .pin-btn:hover {
  background: rgba(196, 164, 108, 0.35);
}
.attr-sheet .pin-btn.is-on {
  border-color: var(--accent);
  color: var(--bg);
  background: var(--accent);
}
.attr-sheet tbody tr.is-pinned td {
  box-shadow: inset 2px 0 0 var(--accent);
}
.attr-sheet tbody tr.is-pinned td.sticky-col,
.attr-sheet tbody tr.is-pinned td.pin-cell {
  background: rgba(196, 164, 108, 0.14);
}
.attr-sheet tbody tr:hover td.pin-cell {
  background: rgba(196, 164, 108, 0.28);
}
.attr-sheet td.num { text-align: right; padding: 0; }
.attr-sheet td.realm-cell {
  text-align: left;
  padding: 0.28rem 0.45rem;
  font-size: 0.72rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attr-sheet td.trait-cell {
  text-align: center;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}
.attr-sheet td.stat-focus,
.attr-sheet td.stat-focus input.cell {
  background: rgba(196, 164, 108, 0.2);
  color: var(--accent);
  font-weight: 600;
}
.attr-sheet tbody tr:hover td.stat-focus,
.attr-sheet tbody tr:hover td.stat-focus input.cell {
  background: rgba(196, 164, 108, 0.32);
}
.unit-stat-table th.stat-focus,
.unit-stat-table td.stat-focus {
  background: rgba(196, 164, 108, 0.22);
  color: var(--accent);
  font-weight: 600;
}
.trait-mark { color: var(--accent); font-weight: 600; }
.chip.trait-chip {
  border-color: rgba(196, 164, 108, 0.55);
  color: var(--accent);
}
.attr-sheet td[data-col="level"] input.cell {
  text-align: center;
  padding: 0.28rem 0.15rem;
}
.attr-sheet input.cell {
  width: 100%; min-width: 0; border: none; background: transparent;
  text-align: right; padding: 0.28rem 0.35rem; border-radius: 0;
  box-sizing: border-box;
}
.attr-sheet input.cell.cell-text {
  text-align: left;
  font-size: 0.72rem;
}
.attr-sheet input.cell:focus {
  outline: 1px solid var(--accent);
  background: rgba(196, 164, 108, 0.12);
}
.attr-sheet tbody tr:hover td {
  background: rgba(196, 164, 108, 0.22);
  box-shadow: inset 0 0 0 1px rgba(196, 164, 108, 0.35);
}
.attr-sheet tbody tr:hover td.sticky-col {
  background: rgba(196, 164, 108, 0.32);
  box-shadow: inset 0 0 0 1px rgba(196, 164, 108, 0.5);
}
.attr-sheet tbody tr:hover input.cell {
  background: rgba(196, 164, 108, 0.12);
}
.attr-sheet .meta-cell { color: var(--muted); font-size: 0.72rem; }
.attr-sheet .est-hint { color: var(--muted); font-size: 0.68rem; }
.attr-sheet .col-resizer {
  position: absolute;
  top: 0; right: -3px;
  width: 7px; height: 100%;
  cursor: col-resize;
  z-index: 5;
  user-select: none;
  touch-action: none;
}
.attr-sheet .col-resizer:hover,
.attr-sheet .col-resizer.active {
  background: rgba(196, 164, 108, 0.45);
}
body.attr-sheet-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.attr-sheet-resizing * { cursor: col-resize !important; }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip {
  font-size: 0.72rem; padding: 0.15rem 0.45rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.flag { color: var(--ok); }
.chip.npc-chip { color: var(--support); }
.chip.battle { color: var(--danger); }
.chip.cut { color: #c9a0d8; }
.chip.video { color: #d4b06a; }
.chip.growth { color: #7cb89a; }
.chip.fail { color: var(--danger); }
.list-item.cat-meta-cut { border-left: 3px solid #c9a0d8; }
.list-item.cat-meta-video { border-left: 3px solid #d4b06a; }
.list-item.cat-meta-growth { border-left: 3px solid var(--ok); }
.list-item.cat-meta-fail { border-left: 3px solid var(--danger); }
.list-item.cat-meta-battle { border-left: 3px solid #c4786a; }
.list-item.cat-meta-doc { border-left: 3px solid #8aabcc; }
.meta-subtabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.55rem; }
.meta-subtabs button { font-size: 0.72rem; padding: 0.2rem 0.45rem; }
.meta-subtabs button.active { border-color: var(--accent); color: var(--accent); background: rgba(196, 164, 108, 0.12); }
.list-group-title {
  margin: 0.65rem 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.list-group-title:first-of-type { margin-top: 0.2rem; }
.list-item.cat-npc-ambient { border-left: 3px solid #9aa0a6; }
.body-dlg-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.15rem 0 0.45rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.55rem;
}
.body-dlg-tabs button { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
.body-dlg-panel { min-height: 4rem; }
.dialogue-battle-trigger {
  border-left: 3px solid var(--danger);
  background: rgba(196, 120, 106, 0.1);
}
.prio-s { color: #e8c070; font-weight: 600; }
.prio-a { color: var(--accent); }
.prio-b { color: var(--muted); }

.doc-body {
  white-space: pre-wrap; word-break: break-word; font-size: 0.86rem; line-height: 1.55;
  max-height: calc(100vh - 220px); overflow: auto; color: var(--text);
  font-family: var(--sans);
}
.doc-body .mark {
  background: rgba(196, 164, 108, 0.35); color: var(--text); border-radius: 2px;
}
.kw-hint {
  color: #e24b3c;
  font-weight: 700;
}
.cine-cue-table { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.35rem 0 0.6rem; }
.cine-cue-row {
  display: grid; grid-template-columns: 5.2rem 1fr; gap: 0.45rem 0.65rem;
  padding: 0.45rem 0.55rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel-2); font-size: 0.8rem;
}
.cine-when {
  color: var(--accent); font-weight: 650; font-size: 0.72rem; line-height: 1.3;
}
.cine-plays { margin: 0.2rem 0; }
.cine-plays code {
  color: #e24b3c; font-weight: 650; margin-right: 0.25rem;
}
.cine-note { color: var(--muted); font-size: 0.74rem; line-height: 1.4; }
.seedance-script .shot-list { margin: 0.2rem 0 0.6rem 1.1rem; padding: 0; font-size: 0.82rem; line-height: 1.45; }
.seedance-script .novel-quote {
  margin: 0.2rem 0 0.7rem;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.seedance-script .prompt-block {
  white-space: pre-wrap; word-break: break-word;
  font-size: 0.78rem; line-height: 1.45;
  background: #12100e; border: 1px solid var(--line); border-radius: 6px;
  padding: 0.65rem 0.75rem; margin: 0.35rem 0 0.6rem; color: #e8dcc8;
}
.seedance-script .prompt-block.muted { color: var(--muted); font-size: 0.72rem; }
.seedance-script .prompt-en {
  margin: 0.35rem 0 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.seedance-script .prompt-en summary { cursor: pointer; color: var(--accent); }
.seedance-script .prompt-en[open] summary { margin-bottom: 0.35rem; }
.seedance-script .prompt-edit {
  margin: 0.55rem 0 1rem;
  padding: 0.55rem 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141210;
}
.seedance-script .prompt-edit h3 { margin: 0 0 0.25rem; font-size: 0.92rem; }
.seedance-script .prompt-edit-path {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0.15rem 0 0.4rem;
  word-break: break-all;
}
.seedance-script .prompt-edit-area {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 10rem;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.45;
  background: #0c0b0a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  color: #e8dcc8;
  margin: 0 0 0.45rem;
}
.seedance-script .prompt-edit-area:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
.seedance-script .prompt-edit-status { font-size: 0.74rem; margin-left: 0.25rem; }
.asset-panel .prompt-block {
  white-space: pre-wrap; word-break: break-word;
  font-size: 0.78rem; line-height: 1.45;
  background: #12100e; border: 1px solid var(--line); border-radius: 6px;
  padding: 0.65rem 0.75rem; margin: 0.35rem 0 0.6rem; color: #e8dcc8;
}
.asset-panel .prompt-block.muted { color: var(--muted); font-size: 0.72rem; }
.asset-panel .prompt-edit {
  margin: 0.55rem 0 1rem;
  padding: 0.55rem 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141210;
}
.asset-panel .prompt-edit h3 { margin: 0 0 0.25rem; font-size: 0.92rem; }
.asset-panel .prompt-edit-path {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0.15rem 0 0.4rem;
  word-break: break-all;
}
.asset-panel .prompt-edit-area {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 10rem;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.45;
  background: #0c0b0a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  color: #e8dcc8;
  margin: 0 0 0.45rem;
}
.asset-panel .prompt-edit-area:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
.asset-panel .prompt-edit-status { font-size: 0.74rem; margin-left: 0.25rem; }
.chip.primary {
  background: color-mix(in srgb, var(--accent) 28%, #1a1612);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  color: #f3e6d0;
}
.asset-preview {
  display: block; max-width: 100%; max-height: 42vh; width: auto; height: auto;
  object-fit: contain; border: 1px solid var(--line); border-radius: 8px;
  /* Checkerboard so RGBA cutouts are distinguishable from solid black stage */
  background-color: #1a1814;
  background-image:
    linear-gradient(45deg, #2a2620 25%, transparent 25%),
    linear-gradient(-45deg, #2a2620 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2620 75%),
    linear-gradient(-45deg, transparent 75%, #2a2620 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  margin: 0.35rem 0 0.65rem;
  cursor: zoom-in;
}
.asset-preview.portrait { max-height: 52vh; }
.asset-preview.walk { max-height: 38vh; max-width: min(100%, 56rem); width: 100%; }

/* Character: 头像1:1 / 半身3:4 / 全身9:16 横排一排 */
.asset-preview-trio {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: flex-end;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}
.asset-preview-trio > .asset-shot {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.asset-preview-trio .asset-preview {
  margin: 0;
  max-height: 32vh;
  width: auto;
  max-width: none;
}
.asset-preview-trio .asset-preview.shot-1x1 {
  max-height: 32vh;
  max-width: 32vh;
}
.asset-preview-trio .asset-preview.shot-3x4 {
  max-height: 32vh;
  max-width: calc(32vh * 3 / 4);
}
.asset-preview-trio .asset-preview.shot-9x16 {
  max-height: 32vh;
  max-width: calc(32vh * 9 / 16);
}
@media (max-width: 720px) {
  .asset-preview-trio { gap: 0.5rem; }
  .asset-preview-trio .asset-preview,
  .asset-preview-trio .asset-preview.shot-1x1 {
    max-height: 26vh;
    max-width: 26vh;
  }
  .asset-preview-trio .asset-preview.shot-3x4 {
    max-height: 26vh;
    max-width: calc(26vh * 3 / 4);
  }
  .asset-preview-trio .asset-preview.shot-9x16 {
    max-height: 26vh;
    max-width: calc(26vh * 9 / 16);
  }
}

.asset-path-nav {
  display: flex; flex-direction: column; gap: 0.45rem;
  margin: 0.25rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: #12100e;
}
.asset-path-row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  gap: 0.35rem 0.55rem;
  align-items: center;
}
@media (max-width: 720px) {
  .asset-path-row {
    grid-template-columns: 1fr;
  }
}
.asset-path-label {
  font-size: 0.72rem; color: var(--muted); white-space: nowrap;
}
.asset-path-code {
  display: block; font-size: 0.74rem; line-height: 1.35;
  color: #e8dcc8; word-break: break-all;
  background: transparent; padding: 0;
}
.asset-path-nav a.chip {
  text-decoration: none; color: inherit;
  display: inline-flex; align-items: center;
}
.asset-preview:hover, .asset-thumb:hover { outline: 1px solid var(--accent); }

.asset-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.asset-history-card {
  border: 1px solid var(--line, #3a3228);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--card, #241f19) 88%, transparent);
}
.asset-history-card.is-current {
  border-color: color-mix(in srgb, var(--accent, #c4a35a) 55%, var(--line));
  background: color-mix(in srgb, var(--accent, #c4a35a) 10%, var(--card, #241f19));
}
.asset-history-badge.status-active_art {
  background: color-mix(in srgb, var(--accent, #c4a35a) 22%, transparent);
}
.asset-history-thumbs.asset-preview-trio {
  margin-top: 0.45rem;
}
.asset-history-thumbs.asset-preview-trio .asset-history-preview {
  max-height: 22vh;
}
.asset-history-thumbs.asset-preview-trio .shot-1x1 {
  max-height: 22vh;
  max-width: 22vh;
}
.asset-history-thumbs.asset-preview-trio .shot-3x4 {
  max-height: 22vh;
  max-width: calc(22vh * 3 / 4);
}
.asset-history-thumbs.asset-preview-trio .shot-9x16 {
  max-height: 22vh;
  max-width: calc(22vh * 9 / 16);
}
.asset-history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  margin-bottom: 0.35rem;
}
.asset-history-badge {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--accent, #c4a35a);
  color: var(--accent, #c4a35a);
}
.prop-quest-badge,
.prop-cat-badge {
  display: inline-block;
  margin-left: 0.28rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  border: 1px solid #c45a4a;
  color: #e8a090;
  background: color-mix(in srgb, #c45a4a 18%, transparent);
  vertical-align: middle;
  white-space: nowrap;
}
.prop-cat-badge.prop-cat-weapon {
  border-color: #8a9eb8;
  color: #c5d4e8;
  background: color-mix(in srgb, #6a84a8 20%, transparent);
}
.prop-cat-badge.prop-cat-pill {
  border-color: #7a9e6a;
  color: #c5e0b8;
  background: color-mix(in srgb, #5a8a4a 18%, transparent);
}
.prop-cat-badge.prop-cat-quest {
  border-color: #c45a4a;
  color: #e8a090;
  background: color-mix(in srgb, #c45a4a 18%, transparent);
}
.prop-cat-badge.prop-cat-artifact {
  border-color: #c4a35a;
  color: #e8d4a0;
  background: color-mix(in srgb, #c4a35a 20%, transparent);
}
.list-item .prop-quest-badge,
.list-item .prop-cat-badge {
  margin-left: 0.2rem;
  font-size: 0.62rem;
  padding: 0 0.28rem;
}
.prop-cat-tabs {
  margin-top: 0.15rem;
  border-top: 1px dashed color-mix(in srgb, var(--line, #3a3228) 70%, transparent);
  padding-top: 0.25rem;
}
.asset-history-badge.status-active_art {
  background: color-mix(in srgb, var(--accent, #c4a35a) 22%, transparent);
}
.asset-history-badge.status-script_current {
  border-color: #6a9e6a;
  color: #8fbf8f;
}
.asset-history-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.35rem 0 0.45rem;
}
.asset-history-preview {
  max-height: 28vh;
  max-width: min(100%, 22rem);
}

.faction-map-stage {
  position: relative;
  width: 100%;
  max-width: 42rem;
  aspect-ratio: 2304 / 1536;
  margin: 0.35rem 0 0.85rem;
  border: 1px solid var(--line, #3a3228);
  border-radius: 6px;
  overflow: hidden;
  background: #1a1612;
}
.faction-map-stage.no-bg {
  background:
    linear-gradient(180deg, #2a241c, #14110e);
}
.faction-map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.88;
}
.faction-zone {
  position: absolute;
  border: 1px dashed color-mix(in srgb, var(--accent, #c4a35a) 65%, transparent);
  background: color-mix(in srgb, var(--accent, #c4a35a) 10%, transparent);
  pointer-events: none;
  border-radius: 4px;
}
.faction-zone-label {
  position: absolute;
  left: 0.2rem;
  top: 0.15rem;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--accent, #c4a35a);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
}
.faction-pin {
  position: absolute;
  transform: translate(-50%, -80%);
  border: none;
  background: transparent;
  padding: 0;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  z-index: 2;
}
.faction-pin:hover { border: none; color: inherit; }
.faction-pin-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #c9a44a 60%, #6a4a12);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 6px rgba(224, 197, 106, 0.55);
}
.faction-pin-name {
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  color: #f2e6c8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.faction-pin-list {
  margin: 0.2rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.45;
}
.asset-thumb {
  width: 2.4rem; height: 2.4rem; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--line); flex-shrink: 0; background: #0c0b0a;
  cursor: zoom-in;
}
.asset-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(6, 5, 4, 0.92); backdrop-filter: blur(4px);
  padding: 1.5rem; cursor: zoom-out;
}
.asset-lightbox[hidden] { display: none !important; }
.asset-lightbox-bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.65rem 1rem; color: #e8dcc8; font-size: 0.85rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
  cursor: default;
}
.asset-lightbox-bar .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-lightbox-bar .actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.asset-lightbox-bar button {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--accent);
  border-radius: 6px; padding: 0.25rem 0.65rem; cursor: pointer; font-size: 0.78rem;
}
.asset-lightbox-bar button:hover { border-color: var(--accent); }
.asset-lightbox img {
  max-width: min(96vw, 1600px); max-height: 88vh;
  object-fit: contain; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,0.55);
  cursor: default; background: #0c0b0a;
}
.asset-lightbox-hint {
  margin-top: 0.55rem; color: var(--muted); font-size: 0.72rem; cursor: default;
}
.list-item.asset-row {
  display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.45rem; align-items: center;
  position: relative;
}
/* Only slight indent for nested children — same card UI as flat list */
.list-item.asset-row.asset-tree-indent {
  padding-left: calc(0.2rem + var(--asset-depth, 0) * 0.7rem);
}
.list-item.asset-row .asset-meta { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.list-item.asset-row .asset-meta-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.35rem;
  min-height: 1rem;
}
.list-item.asset-row .asset-meta-top .id { flex: 0 1 auto; min-width: 0; }
.list-item.asset-row .asset-tag-corner {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.18rem;
  flex: 1 1 auto; max-width: 68%;
}
.list-item.asset-row .asset-tag {
  font-size: 0.62rem; line-height: 1.2; padding: 0.08rem 0.28rem;
  border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap; color: var(--muted); background: var(--panel-2);
}
.list-item.asset-row .asset-tag-realm {
  color: #7cb89a; border-color: rgba(124, 184, 154, 0.45);
}
.list-item.asset-row .asset-tag-combat {
  color: var(--danger); border-color: rgba(196, 120, 106, 0.5);
}
.list-item.asset-row .asset-tag-party {
  color: var(--ok); border-color: rgba(124, 184, 154, 0.4);
}
.list-item.asset-row .asset-tag-role {
  color: var(--support); border-color: rgba(140, 160, 200, 0.45);
}
.list-item.asset-row .asset-meta .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item.asset-row .asset-meta .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.unit-tag-chips { margin: 0.25rem 0 0; }
.unit-tag-chips .chip { cursor: default; }
.unit-stats-panel {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.unit-stats-panel h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.unit-stats-panel h4 {
  margin: 0.55rem 0 0.25rem; font-size: 0.8rem; color: var(--muted); font-weight: 600;
}
.unit-stage-chips { margin: 0 0 0.45rem; }
.unit-stat-table { width: 100%; font-size: 0.78rem; margin: 0 0 0.35rem; }
.unit-stat-table th, .unit-stat-table td {
  padding: 0.28rem 0.35rem; text-align: center; border: 1px solid var(--line);
}
.unit-stat-table th { color: var(--muted); font-weight: 500; background: var(--panel-2); }
.unit-stats-inline .kv { margin-bottom: 0.35rem; }
.nest-tree-text {
  margin: 0.35rem 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
  color: var(--text);
}
.bg-block .kw-hint { color: #f06050; }
.line .mark { background: rgba(196, 164, 108, 0.35); border-radius: 2px; }
.dialogue-card {
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  margin-bottom: 0.65rem; overflow: hidden;
}
.dialogue-card header {
  display: flex; justify-content: space-between; gap: 0.5rem;
  padding: 0.55rem 0.75rem; background: var(--panel-2); border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
.line { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.5rem; margin-bottom: 0.4rem; }
.line .speaker { color: var(--accent); font-size: 0.78rem; text-align: right; }
.effects { padding: 0.45rem 0.75rem; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); }
.trigger-gates {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
  font-size: 0.78rem;
}
.trigger-gates-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}
.trigger-gates-row {
  padding: 0.35rem 0;
  border-top: 1px dashed color-mix(in srgb, var(--line) 80%, transparent);
}
.trigger-gates-row:first-of-type { border-top: none; }
.trigger-gates-hint {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
}
.flag-need {
  color: #e8c070;
  background: rgba(232, 192, 112, 0.12);
  padding: 0 0.25rem;
  border-radius: 3px;
}
.flag-hide {
  color: #c4786a;
  background: rgba(196, 120, 106, 0.12);
  padding: 0 0.25rem;
  border-radius: 3px;
}
.flag-set {
  color: #7eb87a;
  background: rgba(126, 184, 122, 0.12);
  padding: 0 0.25rem;
  border-radius: 3px;
}
.warn-miss { color: var(--danger); }
.status-pill[data-hook="quest"] { border-color: #e8c070; color: #e8c070; }
.status-pill[data-hook="idle"] { border-color: var(--support); color: var(--support); }
.status-pill[data-hook="auto"] { border-color: #8ab4f8; color: #8ab4f8; }
.status-pill[data-hook="chest"] { border-color: #c4a46c; color: #c4a46c; }
.status-pill[data-hook="ambient"] { border-color: #9aa0a6; color: #9aa0a6; }
.dlg-trigger-overview .trigger-gates {
  border: none;
  background: transparent;
  padding: 0;
}
.dlg-trigger-overview .k a {
  color: var(--accent);
  text-decoration: none;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}
.dlg-trigger-overview .k a:hover { text-decoration: underline; }
.empty { color: var(--muted); padding: 1.5rem 0.5rem; text-align: center; }
.error-banner {
  background: rgba(196, 120, 106, 0.15); border: 1px solid var(--danger);
  color: var(--danger); padding: 0.65rem 0.85rem; border-radius: 6px; margin-bottom: 0.75rem;
}
.status-pill[data-kind="idle"] {
  border-color: color-mix(in srgb, var(--support) 55%, transparent);
  color: var(--support);
}
.status-pill[data-kind="cut"] {
  border-color: color-mix(in srgb, var(--muted) 55%, transparent);
  color: var(--muted);
}
.status-pill {
  display: inline-block; font-size: 0.7rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.45rem; margin-left: 0.35rem;
}
.flag-rail { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.4rem; }
.flag-rail .chip.on-path { opacity: 1; border-color: var(--ok); }

/* VFX sequence player */
.vfx-player { margin: 0.5rem 0 1rem; }
.vfx-stage {
  display: flex; align-items: center; justify-content: center;
  min-height: 280px; max-height: 420px;
  border: 1px solid var(--line); border-radius: 8px;
  background:
    linear-gradient(45deg, #2a2620 25%, transparent 25%),
    linear-gradient(-45deg, #2a2620 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2620 75%),
    linear-gradient(-45deg, transparent 75%, #2a2620 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #1a1714;
  margin-bottom: 0.55rem;
}
.vfx-stage img {
  max-width: min(100%, 480px); max-height: 400px;
  object-fit: contain; image-rendering: auto;
}
.vfx-controls {
  display: flex; flex-wrap: wrap; gap: 0.55rem 0.85rem;
  align-items: center; margin-bottom: 0.45rem; font-size: 0.82rem;
}
.vfx-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 6px; padding: 0.25rem 0.65rem; cursor: pointer; font-size: 0.8rem;
}
.vfx-btn:hover { border-color: var(--accent); color: var(--accent); }
.vfx-btn.on { border-color: var(--accent); color: var(--accent); background: rgba(196, 164, 108, 0.12); }
.vfx-label { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); }
.vfx-label input[type="range"] { width: 7rem; }
.vfx-frame { color: var(--muted); font-variant-numeric: tabular-nums; }
.vfx-variants { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.45rem; }
.vfx-strip {
  display: flex; flex-wrap: nowrap; gap: 0.3rem; overflow-x: auto;
  padding: 0.35rem 0 0.15rem; border-top: 1px solid var(--line);
}
.vfx-strip-item {
  flex: 0 0 auto; width: 52px; height: 52px; padding: 0; border: 1px solid var(--line);
  border-radius: 4px; background: #141210; cursor: pointer; overflow: hidden;
}
.vfx-strip-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vfx-strip-item img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* 战斗平衡 · Monte Carlo */
.sim-panel { max-width: 1100px; }
.sim-preset-hint { margin: 0 0 0.65rem; font-size: 0.8rem; }
.sim-steps {
  margin: 0 0 0.75rem; padding: 0.55rem 0.75rem 0.55rem 1.5rem;
  border: 1px solid var(--line); border-radius: 5px;
  background: rgba(255,255,255,0.03); font-size: 0.82rem; line-height: 1.55;
}
.sim-steps li { margin: 0.15rem 0; }
.sim-steps b { font-weight: 650; }
.sim-tier-legend { margin: 0 0 0.65rem; font-size: 0.78rem; }
.sim-tier-legend b { font-variant-numeric: tabular-nums; }
.sim-controls-primary { margin-bottom: 0.35rem; }
.sim-controls-common { margin-bottom: 0.35rem; }
.sim-advanced {
  margin: 0 0 0.65rem; padding: 0.35rem 0.55rem;
  border: 1px dashed var(--line); border-radius: 5px; font-size: 0.82rem;
}
.sim-advanced > summary {
  cursor: pointer; color: var(--muted); user-select: none; padding: 0.15rem 0;
}
.sim-advanced[open] > summary { margin-bottom: 0.35rem; }
.sim-verdict {
  margin: 0.45rem 0 0.65rem; padding: 0.65rem 0.75rem;
  border-radius: 6px; border: 1px solid var(--line);
}
.sim-verdict.ok {
  border-color: rgba(61, 154, 106, 0.55);
  background: rgba(61, 154, 106, 0.12);
}
.sim-verdict.warn {
  border-color: rgba(201, 162, 39, 0.55);
  background: rgba(201, 162, 39, 0.12);
}
.sim-verdict.bad {
  border-color: rgba(196, 92, 92, 0.55);
  background: rgba(196, 92, 92, 0.12);
}
.sim-verdict.neutral { background: rgba(255,255,255,0.03); }
.sim-verdict-title {
  font-size: 1.15rem; font-weight: 700; letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}
.sim-verdict-sub { margin: 0; font-size: 0.82rem; line-height: 1.45; opacity: 0.9; }
.sim-timeline-help { margin: 0 0 0.3rem; font-size: 0.75rem; line-height: 1.4; }
.sim-qual, .sim-samples-wrap { margin-top: 0.45rem; font-size: 0.8rem; }
.sim-match-wrap { margin-bottom: 1rem; }
.sim-match {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem;
  align-items: start;
}
@media (max-width: 900px) {
  .sim-match { grid-template-columns: 1fr; }
}
.sim-match-col {
  border: 1px solid var(--line); border-radius: 6px; padding: 0.65rem 0.75rem;
  background: rgba(255,255,255,0.02);
}
.sim-match-col h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.sim-match-col > .muted { margin: 0 0 0.55rem; font-size: 0.78rem; }
.sim-wave { margin-bottom: 0.65rem; }
.sim-wave h4 { margin: 0.4rem 0 0.35rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.sim-unit-card {
  border: 1px solid var(--line); border-radius: 5px; padding: 0.5rem 0.55rem;
  margin-bottom: 0.45rem; background: rgba(0,0,0,0.15);
}
.sim-unit-head { display: flex; flex-wrap: wrap; gap: 0.35rem 0.65rem; align-items: baseline; margin-bottom: 0.35rem; }
.sim-unit-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 0.25rem; margin-bottom: 0.3rem;
}
.sim-unit-stats div {
  display: flex; flex-direction: column; padding: 0.2rem 0.25rem;
  background: rgba(255,255,255,0.03); border-radius: 3px;
}
.sim-unit-stats b { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.sim-unit-stats span { font-size: 0.65rem; color: var(--muted); }
.sim-unit-meta { font-size: 0.72rem; margin-bottom: 0.3rem; }
.sim-skill-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.sim-skill-table th, .sim-skill-table td {
  border-top: 1px solid var(--line); padding: 0.15rem 0.25rem; text-align: left;
}
.sim-skill-table th { color: var(--muted); font-weight: 600; }
.sim-opt {
  margin-top: 0.65rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--line); border-radius: 5px;
  background: rgba(61, 154, 106, 0.06);
}
.sim-opt-head {
  display: flex; flex-wrap: wrap; gap: 0.45rem 0.75rem;
  align-items: center; margin-bottom: 0.35rem;
}
.sim-opt-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem; margin-top: 0.35rem;
}
.sim-opt-table th, .sim-opt-table td {
  border-top: 1px solid var(--line); padding: 0.2rem 0.3rem; text-align: left;
  font-variant-numeric: tabular-nums;
}
.sim-opt-table th { color: var(--muted); font-weight: 600; }
.sim-opt-note { margin: 0.35rem 0 0; font-size: 0.72rem; }
.sim-opt-summary { border-color: rgba(61, 154, 106, 0.45); }
.sim-showcase {
  margin: 0.75rem 0 0.5rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--line); border-radius: 5px;
  background: rgba(0,0,0,0.12);
}
.sim-showcase-head {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem;
  align-items: baseline; margin-bottom: 0.35rem;
}
.sim-timeline-legend {
  display: flex; flex-wrap: wrap; gap: 0.65rem; font-size: 0.72rem;
  margin-bottom: 0.25rem;
}
.sim-timeline-legend .lg-deal { color: #3d9a6a; }
.sim-timeline-legend .lg-take { color: #c45c5c; }
.sim-timeline-legend .lg-php { color: #7eb8ff; }
.sim-timeline-legend .lg-ehp { color: #e0b85c; }
.sim-timeline-svg { display: block; color: inherit; margin: 0.15rem 0; }
.sim-hit-log { margin-top: 0.35rem; font-size: 0.78rem; }
.sim-hits {
  max-height: 180px; overflow: auto; margin-top: 0.35rem;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.sim-hit {
  padding: 0.12rem 0.3rem; border-radius: 3px;
  font-variant-numeric: tabular-nums; line-height: 1.35;
}
.sim-hit .t { opacity: 0.55; margin-right: 0.35rem; font-size: 0.7rem; }
.sim-hit.deal { background: rgba(61, 154, 106, 0.12); }
.sim-hit.take { background: rgba(196, 92, 92, 0.12); }
.sim-hit.heal { background: rgba(126, 184, 255, 0.12); }
.sim-hit.miss { opacity: 0.7; }
.sim-hit b { font-weight: 650; }
.sim-controls {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center;
  margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line);
}
.sim-controls label {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.85rem; color: var(--muted);
}
.sim-controls select, .sim-controls input[type="number"] {
  background: var(--panel, #1a1814); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px; padding: 0.2rem 0.35rem;
}
.sim-controls .btn {
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: 4px; padding: 0.25rem 0.65rem; cursor: pointer;
}
.sim-controls .btn:hover { background: rgba(196, 164, 108, 0.12); }
.sim-controls .btn.ghost { border-color: var(--line); color: var(--muted); }
.sim-results { display: flex; flex-direction: column; gap: 1rem; }
.sim-card {
  border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem 1rem;
}
.sim-card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.sim-metrics {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.4rem; margin-bottom: 0.65rem;
}
.sim-metrics div {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 0.35rem 0.4rem; background: rgba(255,255,255,0.03); border-radius: 4px;
}
.sim-metrics b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.sim-metrics span { font-size: 0.72rem; color: var(--muted); }
.sim-charts { display: flex; gap: 1rem; align-items: flex-end; margin-bottom: 0.5rem; flex-wrap: wrap; }
.sim-hist { color: var(--accent); }
.sim-targets { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0; }
.sim-target {
  font-size: 0.75rem; padding: 0.15rem 0.4rem; border-radius: 3px;
  border: 1px solid var(--line);
}
.sim-target.ok { border-color: #3d9a6a; color: #3d9a6a; }
.sim-target.bad { border-color: #c45c5c; color: #c45c5c; }
.sim-suggest { margin: 0.35rem 0 0.5rem; padding-left: 1.1rem; font-size: 0.85rem; }
.sim-suggest li { margin: 0.2rem 0; }
.sim-delta { font-size: 0.85rem; color: var(--accent); margin-bottom: 0.4rem; }
.sim-sample { margin-top: 0.35rem; font-size: 0.8rem; }
.sim-sample pre {
  white-space: pre-wrap; max-height: 160px; overflow: auto;
  background: rgba(0,0,0,0.25); padding: 0.4rem; border-radius: 4px;
}

/* 场景 · 在场 NPC / 场景链跳转 */
.list-item.cat-scene { border-left: 3px solid #8ab4f8; }
.scene-jump-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.scene-jump-link:hover strong { color: var(--accent); text-decoration: underline; }
.scene-chain-row { min-width: 0; }
.scene-cast-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  margin: 0.45rem 0;
  background: rgba(0, 0, 0, 0.12);
}
.scene-cast-head {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin-bottom: 0.35rem;
}
.scene-cast-thumb {
  width: 44px;
  height: 56px;
  object-fit: contain;
  object-position: bottom center;
  border-radius: 4px;
  background: #1c1814;
  flex: 0 0 auto;
}
.scene-cast-title { min-width: 0; flex: 1; }
.scene-cast-title .chips { margin-top: 0.25rem; }
.scene-cast-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  margin: 0.2rem 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.scene-cast-action:hover { border-color: rgba(196, 164, 108, 0.35); }
.scene-cast-action.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.scene-cast-action .name { font-size: 0.9rem; }
.scene-cast-action .sub { font-size: 0.74rem; color: var(--muted); }
.scene-review {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.65rem;
  background: rgba(138, 180, 248, 0.06);
}
.scene-review h3 { margin: 0 0 0.35rem; font-size: 0.92rem; }
.scene-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.35rem 0 0.55rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid color-mix(in srgb, #8ab4f8 40%, var(--line));
  border-radius: 8px;
  background: rgba(138, 180, 248, 0.07);
}
.scene-stage-info {
  flex: 1 1 100%;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 0.15rem;
}
.asset-quest-stage-chips { margin: 0.25rem 0 0.45rem; }
.asset-quest-stages {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.25rem 0 0.55rem;
}
.asset-quest-stage-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: rgba(138, 180, 248, 0.05);
}
.asset-quest-stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
}
.asset-quest-stage-head .linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent, #8ab4f8);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.asset-quest-stage-head .linkish:hover { text-decoration: underline; }
.asset-quest-stage-hits {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
}
.asset-quest-stage-hits .chip {
  font-size: 0.7rem;
  padding: 0.05rem 0.35rem;
  vertical-align: middle;
}
.scene-cast-action.is-other-stage {
  opacity: 0.72;
  border-style: dashed;
}

/* —— 主线叙事编辑台 —— */
.qn-toolbar { margin-bottom: 0.55rem; flex-wrap: wrap; }
.qn-stage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  margin: 0.35rem 0 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}
.qn-stage-bar-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-right: 0.2rem;
}
.qn-stage-btn {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qn-stage-btn:hover { border-color: var(--accent); }
.qn-stage-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(196, 164, 108, 0.12);
}
.qn-form {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.qn-field {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.4rem;
  align-items: start;
  font-size: 0.82rem;
}
.qn-field-label {
  color: var(--muted);
  padding-top: 0.35rem;
  font-size: 0.76rem;
}
.qn-field input,
.qn-field textarea,
.qn-scene-table input,
.qn-hook-grid input,
.qn-line-row input,
.qn-line-row textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
}
.qn-field textarea { resize: vertical; min-height: 2.5rem; }
.qn-scene-table { width: 100%; margin: 0.35rem 0; }
.qn-scene-table th { font-size: 0.72rem; }
.qn-scene-table td { padding: 0.2rem; }
.qn-scene-table input { min-width: 3.5rem; }
.qn-hooks { display: grid; gap: 0.55rem; margin: 0.35rem 0 0.75rem; }
.qn-hook-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}
.qn-hook-head { margin-bottom: 0.4rem; font-size: 0.82rem; }
.qn-hook-grid {
  display: grid;
  gap: 0.35rem;
}
.qn-hook-grid .qn-field { grid-template-columns: 7rem 1fr; }
.qn-dlg-list { margin-bottom: 0.55rem; }
.qn-dlg-list .chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(196, 164, 108, 0.12);
}
.qn-dlg-edit .qn-form { padding: 0.5rem 0.65rem 0; }
.qn-lines { padding: 0.35rem 0.65rem; display: grid; gap: 0.35rem; }
.qn-line-row {
  display: grid;
  grid-template-columns: 6rem 1fr 1.6rem;
  gap: 0.3rem;
  align-items: start;
}
.qn-readonly {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .col { border-right: none; border-bottom: 1px solid var(--line); max-height: 42vh; }
  .qn-field { grid-template-columns: 1fr; }
  .qn-field-label { padding-top: 0; }
  .qn-line-row { grid-template-columns: 1fr; }
}
