: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; }
.app.has-asset-media { grid-template-rows: auto auto 1fr; }
.asset-media-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.asset-media-bar[hidden] { display: none !important; }
.asset-media-bar .asset-media-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-right: 0.35rem;
}
.asset-media-bar button { font-size: 0.88rem; padding: 0.32rem 1.05rem; }
.ref-video-dl {
  margin: 0.55rem 0 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: grid;
  gap: 0.4rem;
}
.ref-video-dl .ref-video-dl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.ref-video-dl input[type="url"],
.ref-video-dl input[type="text"] { flex: 1 1 16rem; min-width: 12rem; }
.rembg-log {
  margin: 0.35rem 0 0;
  max-height: 16rem;
  overflow: auto;
  font: 0.75rem/1.4 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--muted);
}
.rembg-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.45rem;
  max-height: 22rem;
  overflow: auto;
  margin: 0.25rem 0 0.15rem;
}
.rembg-file-card {
  display: grid;
  gap: 0.25rem;
  border: 1px solid var(--line, rgba(127, 127, 127, 0.35));
  border-radius: 6px;
  padding: 0.3rem;
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.75rem;
  cursor: pointer;
}
.rembg-file-card img,
.rembg-file-card video,
.rembg-file-ph {
  width: 100%;
  height: 6.5rem;
  object-fit: contain;
  background: #111;
  border-radius: 4px;
}
.rembg-file-card span {
  display: flex;
  gap: 0.25rem;
  align-items: flex-start;
  word-break: break-all;
}
.h3-params-title {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.95rem;
}
.h3-params-log {
  max-height: 36rem;
  color: var(--fg, inherit);
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  background: rgba(0, 0, 0, 0.04);
}
.h3-params-json {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}
.h3-params-json summary {
  cursor: pointer;
  color: var(--muted);
}
.h3-review {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem 0.85rem;
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
}
.h3-review h3 {
  margin: 0.7rem 0 0.3rem;
  font-size: 0.95rem;
}
.h3-review h3:first-child {
  margin-top: 0;
}
.h3-assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.65rem;
}
.h3-asset-card {
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}
.h3-asset-card img {
  display: block;
  width: 100%;
  height: 8.5rem;
  object-fit: cover;
  background: #111;
}
.h3-asset-card .cap {
  padding: 0.4rem 0.5rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  word-break: break-all;
}
.h3-asset-card .cap strong {
  display: block;
  color: var(--fg, inherit);
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
}
.h3-asset-card.is-missing img {
  opacity: 0.25;
}
.dc-run-panel {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem 0.9rem;
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}
.dc-run-row {
  margin-top: 0;
}
.dc-pass2-row {
  margin-right: 0.5rem;
  font-size: 0.9rem;
}
.dc-go,
#dc-go {
  min-width: 5.5rem;
  font-weight: 600;
}
.dc-go.is-wait,
#dc-go.is-wait {
  opacity: 0.72;
}
.dc-go.is-busy,
#dc-go.is-busy,
button.is-busy {
  opacity: 1;
  font-weight: 700;
}
.dc-clip-status.is-busy,
.ref-video-status.is-busy {
  color: #f3c14e;
  font-weight: 600;
}
.dc-pass-hint,
#dc-pass-hint {
  margin: 0.35rem 0 0.15rem;
  font-size: 0.8rem;
}
.dc-clip-status {
  margin: 0.35rem 0 0.15rem;
}
.dc-clip-out {
  margin-top: 0.55rem;
}
.dc-settle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.65rem;
  margin-top: 0.35rem;
}
.dc-settle-slot {
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 8px;
  padding: 0.5rem 0.6rem 0.65rem;
  background: rgba(0, 0, 0, 0.18);
}
.dc-settle-slot strong {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}
.dc-settle-slot.is-empty {
  opacity: 0.75;
}
.dc-settle-grid > .is-active-pass .dc-settle-slot {
  border-color: var(--accent, #c4a46c);
}
.dc-settle-slot .h3-out-video,
.dc-settle-slot video {
  width: 100%;
  max-height: 14rem;
  background: #000;
}
.dc-clip-index-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}
.dc-clip-index-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.4rem;
  margin: 0.35rem 0;
  font-size: 0.88rem;
}
.dc-clip-index-list .dc-jump {
  padding: 0.2rem 0.55rem;
}
.dc-busy-badge {
  color: #f3c14e;
  font-weight: 600;
}
.dc-clip.is-generating > summary {
  color: #f3c14e;
}
.dc-clip.is-generating .dc-go.is-busy {
  opacity: 1;
}
.dc-clip {
  margin: 0.75rem 0;
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 8px;
  padding: 0.35rem 0.65rem 0.55rem;
  background: rgba(0, 0, 0, 0.03);
}
.dc-clip > summary {
  cursor: pointer;
  padding: 0.35rem 0;
  list-style: disclosure-closed;
}
.dc-clip[open] > summary {
  list-style: disclosure-open;
  margin-bottom: 0.35rem;
}
.dc-audio-card .dc-audio-pad {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.5rem;
  padding: 0.5rem;
  background: #111;
}
.dc-audio-card audio {
  width: 100%;
  max-width: 11rem;
}
.h3-confirm-row {
  display: block;
  margin: 0.7rem 0 0.15rem;
  font-size: 0.88rem;
}
.h3-need {
  margin: 0.65rem 0 0.35rem;
}
.h3-need-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.h3-need-head label {
  display: block;
  margin: 0;
  flex: 1 1 auto;
}
.h3-need .dc-optimize {
  flex: 0 0 auto;
  white-space: nowrap;
}
.h3-need-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.h3-need .dc-save {
  flex: 0 0 auto;
  white-space: nowrap;
}
.h3-need label {
  display: block;
  margin-bottom: 0.2rem;
}
.h3-need-head + textarea {
  margin-top: 0.35rem;
}
.dc-diag-panel {
  margin: 0.5rem 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 6px;
  font-size: 0.88rem;
}
.dc-diag-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}
.dc-diag-err { color: var(--danger, #c44); }
.dc-diag-warn { color: var(--warn, #c90); }
.dc-diag-ok { margin: 0.25rem 0; }
.dc-bindings-list {
  margin: 0.25rem 0 0.65rem;
  padding-left: 1rem;
  font-size: 0.85rem;
}
.dc-prepare-panel {
  margin: 0.35rem 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  max-height: 12rem;
  overflow: auto;
}
.dc-run-row .dc-prepare {
  flex: 0 0 auto;
}
.h3-dur-card {
  margin: 0.65rem 0 0.2rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border, rgba(127, 127, 127, 0.35));
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.h3-dur-card strong {
  font-size: 0.82rem;
}
#h3-duration,
.dc-seconds {
  width: 4.2rem;
}
.dc-seconds-label {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}
.ref-video-panel .ref-video-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0.55rem 0 0.2rem;
}
.ref-video-panel .ref-video-row select {
  min-width: 16rem;
  max-width: 28rem;
}
.ref-video-panel .ref-video-row input[type="text"] {
  flex: 1 1 10rem;
  min-width: 9rem;
}
.h3-asset-card.is-portrait img {
  height: 12.5rem;
  object-fit: contain;
  background: #000;
}
.h3-need textarea,
.h3-review textarea {
  display: block;
  width: 100%;
  min-height: 6.5rem;
  box-sizing: border-box;
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border, rgba(127, 127, 127, 0.45));
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  font: 0.85rem/1.45 inherit;
  resize: vertical;
}
.h3-need textarea.dc-prompt {
  min-height: 22rem;
}
.ref-video-dl select {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: none;
}
.ref-video-dl #rembg-item {
  flex: 2 1 18rem;
}
.ref-video-dl .muted,
.ref-video-status { font-size: 0.82rem; margin: 0.15rem 0 0; }
.ref-video-status.is-err { color: var(--danger); }
.ref-video-status.is-ok { color: var(--ok); }
.ref-video-warn {
  color: var(--danger);
  background: rgba(196, 120, 106, 0.12);
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
}
.ref-video-card {
  margin: 0.65rem 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.ref-video-card p { margin: 0.15rem 0 0.35rem; }
.svl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.55rem;
}
.svl-toolbar a { font-size: 0.88rem; }
.svl-embed { display: grid; gap: 0.4rem; min-height: 0; }
.svl-frame {
  width: 100%;
  height: calc(100vh - 8.5rem);
  min-height: 28rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}
.asset-thumb-audio,
.asset-thumb-video {
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  color: var(--accent);
  background: var(--panel-2);
  cursor: default;
}
.h3-out-video {
  width: 100%;
  max-width: none;
  background: #111;
  border-radius: 6px;
}
.asset-audio-player,
.asset-video-player {
  width: min(100%, 720px);
  margin: 0.35rem 0 0.75rem;
}
.asset-history-audio {
  width: 100%;
  margin: 0.35rem 0 0.15rem;
}
.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; }
.content-pack-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.content-pack-switch select {
  font: inherit;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border, #444);
  background: var(--panel, #1a1a1a);
  color: inherit;
  max-width: 9rem;
}

.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: 12rem; font-size: 0.82rem; }
.stage-overview-table td:nth-child(3) { min-width: 5rem; }
.stage-overview-table td:nth-child(5) { min-width: 11rem; font-size: 0.76rem; }
.stage-overview-table td:nth-child(7) { white-space: nowrap; }
.stage-overview-brief { color: var(--text); }
.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 td.name-drag {
  cursor: grab;
  user-select: none;
}
.attr-sheet td.name-drag .row-drag-handle {
  display: inline-block;
  width: 0.85rem;
  margin-right: 0.2rem;
  color: var(--muted);
  letter-spacing: -0.12em;
  font-size: 0.72rem;
  opacity: 0.55;
  vertical-align: middle;
}
.attr-sheet tbody tr:hover td.name-drag .row-drag-handle {
  opacity: 1;
  color: var(--accent);
}
.attr-sheet tbody tr.is-dragging td {
  opacity: 0.42;
}
.attr-sheet tbody tr.is-drop-target td {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  background: rgba(196, 164, 108, 0.16);
}
.attr-sheet tbody tr.is-drop-target td.sticky-col,
.attr-sheet tbody tr.is-drop-target td.pin-cell {
  background: rgba(196, 164, 108, 0.22);
}
body.attr-sheet-row-dragging {
  cursor: grabbing !important;
  user-select: none;
}
body.attr-sheet-row-dragging * {
  cursor: grabbing !important;
}
.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 select.cell-select {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 0.72rem;
  padding: 0.22rem 0.2rem;
  box-sizing: border-box;
}
.attr-sheet select.cell-select:focus {
  outline: 1px solid var(--accent);
  background: rgba(196, 164, 108, 0.12);
}
.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); }
.seq-list-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  width: 100%;
}
.seq-char-card {
  align-items: flex-start;
  cursor: pointer;
}
.seq-char-card .asset-meta { gap: 0.2rem; }
.seq-char-card .name .id {
  font-weight: 400;
  margin-left: 0.25rem;
}
.seq-char-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin: 0.15rem 0 0.05rem;
}
.seq-char-tab {
  font-size: 0.68rem;
  padding: 0.12rem 0.38rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
}
.seq-char-tab:hover { border-color: var(--accent); color: var(--text); }
.seq-char-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(196, 164, 108, 0.14);
}
.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);
}
.dialogue-bridge-hook {
  border-left: 3px solid #8ab4f8;
  background: rgba(138, 180, 248, 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);
}
.asset-preview-trio .asset-preview.shot-stance {
  max-height: 36vh;
  max-width: calc(36vh * 2 / 3);
}
@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-preview-trio .asset-preview.shot-stance {
    max-height: 28vh;
    max-width: calc(28vh * 2 / 3);
  }
}

.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 .name.asset-name-editable { cursor: text; }
.list-item.asset-row .asset-meta .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }

h2.asset-title.asset-name-editable {
  cursor: text;
  border-bottom: 1px dashed transparent;
}
h2.asset-title.asset-name-editable:hover {
  border-bottom-color: var(--muted, #888);
}
.asset-rename-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin: 0 0 0.75rem;
}
.asset-rename-input {
  flex: 1 1 12rem;
  min-width: 8rem;
  font: inherit;
  font-size: 1.15rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border, #444);
  border-radius: 4px;
  background: var(--panel, #1a1a1a);
  color: inherit;
}
.asset-rename-save.active,
.asset-rename-save { font-weight: 600; }
.asset-rename-status { font-size: 0.82rem; }
.asset-rename-status.error { color: #e07070; }
.list-item.asset-row .asset-rename-bar {
  margin: 0;
  width: 100%;
}
.list-item.asset-row .asset-rename-input {
  font-size: 0.92rem;
  padding: 0.2rem 0.4rem;
}
.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="hook"] {
  border-color: color-mix(in srgb, #8ab4f8 55%, transparent);
  color: #8ab4f8;
}
.status-pill[data-kind="cut"] {
  border-color: color-mix(in srgb, var(--muted) 55%, transparent);
  color: var(--muted);
}
.status-pill[data-kind="video"] {
  border-color: color-mix(in srgb, #8ab4f8 55%, transparent);
  color: #8ab4f8;
}
.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; }
.bf-frame-hero {
  margin: 0.35rem 0 0.25rem; max-width: 280px;
  background: #0e0c0a; border: 1px solid var(--line); border-radius: 6px;
  padding: 0.35rem;
}
.bf-frame-hero img.asset-preview {
  width: 100%; height: auto; max-height: 320px; object-fit: contain;
  display: block; background: #141210;
}
.bf-frame-hero .muted { margin: 0.25rem 0 0; font-size: 0.75rem; word-break: break-all; }
.h3-out .vfx-player { margin-top: 0.55rem; }
.h3-out .vfx-stage {
  min-height: 260px;
  max-height: 380px;
}

/* 战斗平衡 · 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-head .btn {
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: 4px; padding: 0.25rem 0.65rem; cursor: pointer;
}
.sim-opt-head .btn:hover { background: rgba(196, 164, 108, 0.12); }
.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-controls .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.sim-controls .btn.sim-save:not(:disabled),
.sim-opt-head .btn.sim-save {
  border-color: rgba(61, 154, 106, 0.85);
  color: #6ecf9a;
}
.sim-controls .btn.sim-save:not(:disabled):hover,
.sim-opt-head .btn.sim-save:hover {
  background: rgba(61, 154, 106, 0.12);
}
.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-chests {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  margin: 0.55rem 0 0.65rem;
  background: rgba(196, 164, 108, 0.06);
}
.scene-chests-head h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.scene-chests-count {
  display: inline-flex;
  min-width: 1.4rem;
  justify-content: center;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  font-variant-numeric: tabular-nums;
}
.scene-chests-head .muted {
  display: block;
  font-size: 0.76rem;
  line-height: 1.45;
}
.scene-chests-head input[type="number"] {
  width: 3.2rem;
  font: inherit;
  padding: 0.1rem 0.25rem;
}
.scene-chest-card {
  margin: 0.4rem 0;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.16);
}
.scene-chest-head,
.scene-chest-grid,
.scene-chest-fixed {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  margin-bottom: 0.3rem;
}
.scene-chest-fixed[hidden] {
  display: none !important;
}
.scene-chests label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
}
.scene-chests input[type="text"],
.scene-chests input[type="number"],
.scene-chests select {
  font: inherit;
  padding: 0.12rem 0.3rem;
  min-width: 0;
}
.scene-chest-head input[data-f="label"] { width: 8rem; }
.scene-chest-grid input[data-f="id"] { width: 9rem; }
.scene-chest-grid input[data-f="x"],
.scene-chest-grid input[data-f="y"],
.scene-chest-grid input[data-f="r"] { width: 4.2rem; }
.scene-chest-loot { width: 100%; }
.scene-chest-loot select { flex: 1; min-width: 12rem; }
.scene-chest-fixed select { min-width: 12rem; }
.scene-chest-fixed input[data-f="qty"] { width: 4.5rem; }
.scene-chest-sum,
.scene-chest-hook { font-size: 0.74rem; line-height: 1.4; }
.scene-chest-del {
  margin-left: auto;
  font: inherit;
  cursor: pointer;
}
.scene-chests-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.35rem;
}
.scene-chests-actions button {
  font: inherit;
  cursor: pointer;
  padding: 0.25rem 0.55rem;
}
.scene-chests-actions button.primary {
  border-color: var(--accent);
  color: var(--accent);
}
.scene-chests-empty { font-size: 0.78rem; margin: 0.25rem 0; }
.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;
}
.scene-stage-pick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}
.scene-stage-pick {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 14rem;
  font-size: 0.8rem;
}
.scene-stage-pick select {
  flex: 1;
  min-width: 12rem;
  max-width: 28rem;
  font: inherit;
  padding: 0.2rem 0.35rem;
}
.scene-dlg-mode-tabs {
  width: 100%;
  margin-top: 0.15rem;
}
.scene-digest-tip {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.scene-digest-npc {
  margin: 0 0 0.85rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(196, 164, 108, 0.04);
}
.scene-digest-npc.is-ambient {
  background: rgba(138, 180, 248, 0.05);
  border-color: color-mix(in srgb, #8ab4f8 35%, var(--line));
}
.scene-digest-npc > h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}
.scene-digest-act {
  margin: 0 0 0.55rem;
  padding-left: 0.15rem;
}
.scene-digest-act-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: baseline;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.dlg-compact {
  margin: 0.3rem 0 0.45rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel, rgba(0, 0, 0, 0.12));
}
.dlg-compact header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}
.dlg-compact-flags {
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}
.dlg-compact-lines {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.dlg-compact-line {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
}
.dlg-compact-line .sp {
  color: var(--accent, #c4a46c);
  font-weight: 600;
  text-align: right;
}
.dlg-compact-line .tx {
  min-width: 0;
}
.dlg-compact .linkish,
.scene-digest-act > .linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent, #8ab4f8);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.dlg-compact .linkish:hover,
.scene-digest-act > .linkish:hover {
  text-decoration: underline;
}
.dlg-media-tabs {
  width: 100%;
  margin: 0.2rem 0 0.35rem;
}
.dlg-voice-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.dlg-line-voice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem 0.55rem;
  background: rgba(196, 164, 108, 0.05);
}
.dlg-line-voice > header {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.dlg-line-voice > header .sp {
  color: var(--accent, #c4a46c);
  font-weight: 600;
  text-align: right;
}
.dlg-line-audio {
  width: 100%;
  margin: 0.1rem 0 0.2rem;
}
.dlg-voice-file {
  margin: 0;
  font-size: 0.7rem;
  word-break: break-all;
}
.dlg-voice-placeholder {
  margin: 0;
  padding: 0.45rem 0.5rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 0.76rem;
}
.dlg-video-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.dlg-video-tip {
  margin: 0;
  font-size: 0.78rem;
}
.dlg-line-video {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem 0.6rem;
  background: rgba(196, 164, 108, 0.05);
}
.dlg-line-video.is-empty {
  background: transparent;
  padding: 0.25rem 0.15rem;
}
.dlg-line-video > header {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}
.dlg-line-video > header .sp {
  color: var(--accent, #c4a46c);
  font-weight: 600;
  text-align: right;
}
.dlg-video-unhooked {
  margin: 0;
  font-size: 0.74rem;
  grid-column: 1 / -1;
}
.dlg-video-shots {
  margin: 0 0 0.45rem 1.2rem;
  padding: 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text, #e8dcc8);
}
.dlg-video-shots li { margin: 0.1rem 0; }
.dlg-video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.4rem;
}
@media (max-width: 900px) {
  .dlg-video-grid { grid-template-columns: 1fr; }
}
.dlg-video-still h4,
.dlg-video-clip h4,
.dlg-line-video h4 {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent, #c4a46c);
}
.dlg-video-still img,
.dlg-video-clip video {
  display: block;
  width: 100%;
  max-height: 14rem;
  object-fit: contain;
  background: #0c0b0a;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.dlg-bust-hero {
  margin: 0 0 0.7rem;
}
.dlg-bust-hero img.asset-preview {
  display: block;
  width: 100%;
  max-height: none;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0c0b0a;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.dlg-video-placeholder {
  margin: 0;
  padding: 0.7rem 0.65rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 0.76rem;
}
.dlg-video-panel .prompt-edit {
  margin: 0.45rem 0 0.2rem;
  padding: 0.45rem 0.55rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141210;
}
.dlg-video-panel .prompt-edit h3 { margin: 0 0 0.25rem; font-size: 0.82rem; }
.dlg-video-panel .prompt-edit-path {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin: 0.15rem 0 0.35rem;
  word-break: break-all;
}
.dlg-video-panel .prompt-edit-area {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 7rem;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.74rem;
  line-height: 1.45;
  background: #0c0b0a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  color: #e8dcc8;
  margin: 0 0 0.35rem;
}
.dlg-video-panel .prompt-edit-area:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
.dlg-video-panel .prompt-block {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.74rem;
  line-height: 1.45;
  background: #12100e;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  margin: 0.25rem 0 0.4rem;
  color: #e8dcc8;
}
.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-pane-tabs { margin: 0.2rem 0 0.65rem; }
.qn-pane-tabs .chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(196, 164, 108, 0.12);
}
.qn-brief-help { margin: 0 0 0.5rem; }
.qn-brief-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 8.5rem;
  resize: vertical;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
}
.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;
}
.dlg-text-edit-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  padding: 0.35rem 0.65rem 0.15rem;
}
.dlg-ai-rewrite-toggle {
  margin: 0.2rem 0 0.45rem;
}
.dlg-ai-rewrite {
  display: none;
  margin: 0.35rem 0 0.7rem;
  padding: 0.55rem 0.65rem 0.7rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: rgba(196, 164, 108, 0.08);
}
.dlg-ai-rewrite.is-open {
  display: block;
}
.dlg-ai-rewrite-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.dlg-ai-rewrite-bar { margin-bottom: 0.35rem; }
.dlg-ai-rewrite-panel { display: grid; gap: 0.55rem; }
.dlg-ai-field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.82rem;
}
.dlg-ai-field-label {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}
.dlg-ai-rewrite-panel textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.4;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  resize: vertical;
  min-height: 4.5rem;
}
.dlg-ai-rewrite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.dlg-text-status.dirty { color: var(--accent); }
.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; }
}

/* Scene seamless expand (FrameRonin overlap tiles) */
.asset-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.85rem 0 0.35rem;
}
.asset-preview-head [data-scene-bg-current] {
  flex: 1 0 100%;
  margin: 0.15rem 0 0;
}
.asset-shot-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0 0 0.25rem;
}
.asset-shot-label p { margin: 0; }
.asset-shot-label .map-expand-open-btn,
.asset-preview-head .map-expand-open-btn,
.asset-shot-label .scene-bg-use-btn {
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--accent) 32%, #1a1612);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  padding: 0.28rem 0.75rem;
}
.asset-shot-label .scene-bg-use-btn.scene-bg-active {
  background: color-mix(in srgb, #9a8b78 18%, #1a1612);
  border-color: #9a8b78;
  color: #c9bba8;
  font-weight: 600;
}
.map-expand {
  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
  background: rgba(6, 5, 4, 0.72);
  backdrop-filter: blur(4px);
}
.map-expand[hidden] { display: none !important; }
.map-expand-dialog {
  width: min(96vw, 1580px);
  height: min(90vh, 980px);
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  color: #241f19;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  background:
    linear-gradient(180deg, rgba(244, 238, 229, 0.98), rgba(218, 208, 194, 0.99)),
    repeating-conic-gradient(#d9d0c2 0% 25%, #eee7dc 0% 50%) 50% / 24px 24px;
}
.map-expand-body { position: relative; flex: 1; min-height: 0; display: flex; }
.map-expand-bar {
  display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap;
  min-height: 4.2rem; padding: 0.65rem 1rem;
  border-bottom: 1px solid #9a8b78;
  background: rgba(237, 230, 220, 0.94);
}
.map-expand-title { flex: 1 1 12rem; min-width: 0; }
.map-expand-title strong { display: block; font-size: 1rem; }
.map-expand-hint { font-size: 0.72rem; color: #6b5d4d; }
.map-expand-field {
  display: flex; flex-direction: column; gap: 0.15rem;
  font-size: 0.72rem; font-weight: 700; color: #3d3428;
}
.map-expand-field select, .map-expand-bar-actions button {
  background: #f6f0e6; color: #3d3428; border: 1px solid #9a8b78;
}
.map-expand-four-btn {
  align-self: flex-end;
  background: #2f7d4d; color: #f6f1e8;
  border: 1px solid #23704a; border-radius: 4px;
  padding: 0.38rem 0.8rem;
  font-size: 0.82rem; font-weight: 800;
  cursor: pointer; white-space: nowrap;
}
.map-expand-four-btn:hover { filter: brightness(1.08); }
.map-expand-four-btn:disabled,
.map-expand-four-btn.busy {
  cursor: wait; background: #1f5c3a; border-color: #1f5c3a;
}
.map-expand-paint-entry {
  align-self: flex-end;
  background: #c2410c; color: #f6f1e8;
  border: 1px solid #9a3412; border-radius: 4px;
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem; font-weight: 800;
  cursor: pointer; white-space: nowrap;
}
.map-expand-paint-entry:hover { filter: brightness(1.08); }
.map-expand-paint-entry:disabled { opacity: 0.45; cursor: not-allowed; }
.map-expand-back {
  align-self: flex-end;
  background: #f6f0e6; color: #3d3428;
  border: 1px solid #9a8b78; border-radius: 4px;
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem; font-weight: 800;
  cursor: pointer; white-space: nowrap;
}
.map-expand-back:hover { border-color: #c2410c; color: #c2410c; }
.map-expand-dialog.view-paint .map-expand-expand-only { display: none !important; }
.map-expand-dialog.view-expand .map-expand-paint-only { display: none !important; }
.map-expand-dialog.view-paint .map-expand-bar { border-bottom-color: #c2410c; }
.map-expand-dialog.view-paint #map-expand-plus,
.map-expand-dialog.view-paint #map-expand-eye { display: none !important; }
.map-expand-stitch {
  z-index: 2;
  outline: none;
  background: #111;
  cursor: crosshair;
}
.map-expand-slider { width: 10.5rem; }
.map-expand-slider input { width: 100%; }
.map-expand-bar-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.map-expand-bar-actions button:hover { border-color: #b55233; color: #b55233; }
.map-expand-workspace {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; user-select: none; cursor: default;
  background:
    linear-gradient(180deg, rgba(244, 238, 229, 0.55), rgba(218, 208, 194, 0.72)),
    repeating-conic-gradient(#d9d0c2 0% 25%, #eee7dc 0% 50%) 50% / 24px 24px;
}
.map-expand-stage-shell { position: relative; flex: 0 0 auto; }
.map-expand-stage {
  position: absolute; left: 0; top: 0;
  transform-origin: top left;
}
.map-expand-loading {
  padding: 2rem; text-align: center; font-weight: 700; color: #6b5d4d;
}
.map-expand-hatch {
  position: absolute; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(
    135deg,
    rgba(181, 82, 51, 0.2) 0 3px,
    transparent 3px 9px
  );
  box-shadow: inset 0 0 0 2px rgba(181, 82, 51, 0.55);
}
.map-expand-frame {
  position: absolute; box-sizing: border-box; overflow: hidden; border-radius: 4px; z-index: 1;
}
.map-expand-frame img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; object-fit: fill;
}
.map-expand-stitch-src {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block;
  pointer-events: none;
}
.map-expand-source {
  z-index: 3;
  outline: none;
  background: transparent;
  box-shadow: none;
}
.map-expand-neighbor {
  --tile-accent: #b55233;
  --tile-accent-soft: rgba(181, 82, 51, 0.18);
  --tile-accent-wash: rgba(181, 82, 51, 0.28);
  z-index: 4;
  color: #3d3428;
  background:
    repeating-linear-gradient(
      135deg,
      color-mix(in srgb, var(--tile-accent) 32%, transparent) 0 4px,
      color-mix(in srgb, var(--tile-accent) 10%, transparent) 4px 11px
    );
  outline: 4px solid var(--tile-accent);
  cursor: pointer;
  box-shadow: none;
}
.map-expand-neighbor.uploaded,
.map-expand-neighbor.uploaded:hover,
.map-expand-neighbor.uploaded.selected {
  z-index: 2;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}
.map-expand-neighbor:hover, .map-expand-neighbor.selected, .map-expand-source.selected {
  outline-color: var(--tile-accent, #23704a);
  box-shadow:
    inset 0 0 0 4px rgba(255,255,255,0.55),
    0 0 0 8px color-mix(in srgb, var(--tile-accent, #23704a) 30%, transparent),
    0 12px 32px rgba(35, 28, 20, 0.24);
}
.map-expand-neighbor.uploaded:hover,
.map-expand-neighbor.uploaded.selected {
  outline-color: transparent;
  box-shadow: none;
}
.map-expand-tone-top { --tile-accent: #c2410c; --tile-accent-soft: rgba(194,65,12,0.18); --tile-accent-wash: rgba(194,65,12,0.34); }
.map-expand-tone-right { --tile-accent: #1d70a2; --tile-accent-soft: rgba(29,112,162,0.18); --tile-accent-wash: rgba(29,112,162,0.32); }
.map-expand-tone-bottom { --tile-accent: #6f7d1f; --tile-accent-soft: rgba(111,125,31,0.2); --tile-accent-wash: rgba(111,125,31,0.34); }
.map-expand-tone-left { --tile-accent: #8c3f7a; --tile-accent-soft: rgba(140,63,122,0.19); --tile-accent-wash: rgba(140,63,122,0.33); }
.map-expand-hide-borders .map-expand-frame {
  outline-color: transparent !important;
  box-shadow: none !important;
}
.map-expand-frame.image-hidden img { opacity: 0; }
.map-expand-card {
  position: absolute; left: 50%; top: 50%; z-index: 4;
  transform: translate(-50%, -50%);
  width: 10.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 0.7rem 0.8rem;
  color: #3d3428; font-size: 1rem; font-weight: 800; text-align: center;
  background: rgba(248, 244, 237, 0.92);
  border: 2px solid var(--tile-accent, #23704a);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(35, 28, 20, 0.18);
  pointer-events: none;
}
.map-expand-card .map-expand-card-action { pointer-events: auto; }
.map-expand-card-wide { width: 13.5rem; pointer-events: auto; }
.map-expand-card-title { line-height: 1.2; }
.map-expand-card-action {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.35rem;
  min-width: 7.2rem; min-height: 2rem;
  padding: 0.15rem 0.55rem; border: 0; border-radius: 4px;
  background: #2f7d4d; color: #f6f1e8; font-size: 0.82rem; font-weight: 800;
  cursor: pointer;
}
.map-expand-card small {
  color: #6b5d4d; font-size: 0.68rem; font-weight: 600; line-height: 1.35;
}
.map-expand-card-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
.map-expand-mini {
  background: #f6f0e6; color: #3d3428; border: 1px solid #9a8b78;
  border-radius: 4px; padding: 0.15rem 0.45rem; font-size: 0.75rem; font-weight: 700;
}
.map-expand-mini.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  background: #2f7d4d; color: #f6f1e8; border-color: #2f7d4d;
  min-width: 7.2rem; min-height: 2rem; font-size: 0.88rem; font-weight: 800;
}
.map-expand-mini.primary:hover { border-color: #23704a; color: #fff; }
.map-expand-mini:disabled,
.map-expand-card-action:disabled {
  opacity: 1; cursor: wait;
  background: #1f5c3a; border-color: #1f5c3a; color: #f6f1e8;
}
.map-expand-mini.busy::before,
.map-expand-card-action.busy::before {
  content: "";
  width: 0.72rem; height: 0.72rem; flex: 0 0 auto;
  border: 2px solid rgba(246, 241, 232, 0.35);
  border-top-color: #f6f1e8;
  border-radius: 50%;
  animation: map-expand-spin 0.7s linear infinite;
}
@keyframes map-expand-spin { to { transform: rotate(360deg); } }
.map-expand-frame.generating {
  outline-style: dashed;
  animation: map-expand-pulse 1.2s ease-in-out infinite;
}
@keyframes map-expand-pulse {
  50% { outline-color: color-mix(in srgb, var(--tile-accent, #2f7d4d) 55%, #fff); }
}
.map-expand-mini.danger { color: #9a3b2a; }
.map-expand-feather {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-areas: ". n ." "w vis e" ". s .";
  gap: 0.2rem; align-items: center; justify-items: center;
}
.map-expand-feather-btn {
  min-width: 2.2rem; padding: 0.1rem 0.25rem;
  font-size: 0.65rem; background: #efe8dc; color: #3d3428; border: 1px solid #9a8b78;
}
.map-expand-feather-btn.n { grid-area: n; }
.map-expand-feather-btn.w { grid-area: w; }
.map-expand-feather-btn.e { grid-area: e; }
.map-expand-feather-btn.s { grid-area: s; }
.map-expand-feather-btn.vis { grid-area: vis; }
.map-expand-leftbar {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  z-index: 6; display: flex; flex-direction: column; gap: 0.4rem;
}
.map-expand-leftbar[hidden] { display: none !important; }
.map-expand-leftbar button {
  width: 2.2rem; height: 2.2rem; border-radius: 8px;
  background: rgba(248,244,237,0.95); color: #3d3428; border: 1px solid #9a8b78;
  font-weight: 800;
}
.map-expand-stats {
  position: absolute; left: 0.75rem; bottom: 0.75rem; z-index: 6;
  padding: 0.45rem 0.7rem; border-radius: 6px;
  background: rgba(248,244,237,0.94); border: 1px solid #9a8b78;
  color: #3d3428; font-size: 0.78rem; font-weight: 700;
  max-width: min(28rem, 70vw);
}
.map-expand-fit {
  position: absolute; left: 50%; bottom: 0.75rem; transform: translateX(-50%);
  z-index: 6; padding: 0.45rem 0.95rem; border-radius: 6px;
  background: rgba(248,244,237,0.95); color: #3d3428;
  border: 1px solid #9a8b78; font-weight: 800; font-size: 0.82rem;
}
.map-expand-fit[hidden] { display: none !important; }
.map-expand-fit:hover { border-color: #23704a; color: #23704a; }
.map-expand-frame.painting {
  z-index: 8 !important;
  outline: 3px dashed #c2410c !important;
  cursor: crosshair;
}
.map-expand-mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  image-rendering: pixelated;
}
.map-expand-paint {
  position: absolute;
  left: 50%;
  bottom: 3.15rem;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.65rem;
  max-width: min(46rem, 92%);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: rgba(248, 244, 237, 0.96);
  border: 2px solid #c2410c;
  color: #3d3428;
  font-size: 0.8rem;
  font-weight: 700;
}
.map-expand-paint[hidden] { display: none !important; }
.map-expand-paint-brush {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 9rem;
}
.map-expand-paint-brush input { width: 7rem; }
.map-expand-paint button {
  border: 1px solid #9a8b78;
  background: #fff;
  color: #3d3428;
  border-radius: 6px;
  padding: 0.28rem 0.6rem;
  font-weight: 800;
}
.map-expand-paint-run {
  background: #23704a !important;
  border-color: #23704a !important;
  color: #fff !important;
}
.map-expand-paint-run:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tool-jobs-tray {
  margin: 0.85rem 0 0.4rem;
  padding: 0.55rem 0.6rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.tool-jobs-head {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.tool-jobs-empty {
  margin: 0;
  font-size: 0.78rem;
}
.tool-jobs-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0;
  font-size: 0.78rem;
  line-height: 1.35;
}
.tool-jobs-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.tool-jobs-row.is-running .tool-jobs-dot,
.tool-jobs-row.is-queued .tool-jobs-dot { background: var(--accent); }
.tool-jobs-row.is-done .tool-jobs-dot { background: var(--ok); }
.tool-jobs-row.is-error .tool-jobs-dot { background: var(--danger); }
.tool-jobs-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-jobs-st {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.7rem;
  flex: 0 1 auto;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-jobs-row.is-done .tool-jobs-st { color: var(--ok); }
.tool-jobs-row.is-error .tool-jobs-st { color: var(--danger); }

.font-apply-btn.active,
.font-apply-btn:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.font-apply-status { margin-left: 0.5rem; font-size: 0.78rem; color: var(--muted); }
.font-preview {
  padding: 1rem 0.2rem 1.4rem;
  --preview-font: var(--font);
  --preview-ui: var(--sans);
}
.font-preview-title {
  margin: 0.55rem 0 0.15rem;
  font-family: var(--preview-font);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.font-preview-kicker {
  font-family: var(--preview-ui);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 1.1rem;
}
.font-preview-dlg {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
}
.font-preview-dlg .speaker {
  font-family: var(--preview-font);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.font-preview-dlg .line {
  font-family: var(--preview-font);
  font-size: 1.05rem;
  line-height: 1.7;
}
.font-preview-ui {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.font-preview-ui span {
  font-family: var(--preview-ui);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.9rem;
  font-size: 0.88rem;
}
