.prog {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  overflow: hidden;
  min-width: 120px;
}
.prog i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  border-radius: 999px;
}
.prog span {
  display: none;
}

.prog-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.genre-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.genre-pills label, .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12.5px;
  cursor: pointer;
}
.chip-pri { background: #eef2ff; color: #4338ca; border-color: transparent; font-weight: 700; }
.chip-sec { background: #f1f5f9; color: #475569; }

.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2, 8, 6, 0.62);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  color: #1e293b;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.modal h3 { margin: 0 0 16px; font-family: var(--font-serif); }
.form-grid { display: grid; gap: 12px; }
.form-grid label { font-size: 13px; font-weight: 600; color: #334155; display: block; margin-bottom: 6px; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(99,102,241,.18); font-family: inherit;
}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.project-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(99,102,241,.1);
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
  transition: transform .18s ease, box-shadow .18s ease;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(15,23,42,.12); }
.project-card h3 { margin: 0 0 8px; color: #0f172a; font-size: 18px; }
.meta { color: #64748b; font-size: 12.5px; line-height: 1.7; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 16px; }
.tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}
.tabs button.active {
  background: #6366f1;
  color: #fff;
  border-color: transparent;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.table-lite { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-lite th, .table-lite td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid rgba(15,23,42,.06); vertical-align: top;
}
.table-lite th { color: #64748b; font-weight: 600; }

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.compare pre {
  white-space: pre-wrap;
  background: #fff;
  color: #0f172a;
  border-radius: 12px;
  padding: 16px;
  min-height: 420px;
  max-height: 70vh;
  overflow: auto;
  font-size: 18px;
  line-height: 1.8;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  border: 1.5px solid #475569;
}
.compare textarea {
  width: 100%;
  min-height: 420px;
  max-height: 70vh;
  border-radius: 12px;
  padding: 16px;
  font-size: 18px;
  line-height: 1.8;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: #0f172a;
  background: #fff;
  border: 1.5px solid #475569;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

.sev-P0 { color: #b91c1c; font-weight: 800; }
.sev-P1 { color: #c2410c; font-weight: 700; }
.sev-P2 { color: #a16207; }
.sev-P3 { color: #475569; }

.status-dot { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #e2e8f0; }

.hidden { display: none !important; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px;
}

@media (max-width: 900px) {
  .compare { grid-template-columns: 1fr; }
}

.table-scroll { overflow-x: auto; }

.job-panel {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1.5px solid #4f46e5;
  border-radius: 12px;
  background: #eef2ff;
}
.job-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.job-panel-head strong {
  font-size: 16px;
  color: #1e1b4b;
}
.job-panel-head span {
  color: #4338ca;
  font-weight: 700;
  font-size: 16px;
}
.job-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.job-bar-row .prog {
  flex: 1;
  height: 12px;
  background: #c7d2fe;
}
.job-pct {
  font-weight: 800;
  color: #312e81;
  min-width: 48px;
}
.job-log {
  margin: 0;
  padding: 8px 8px 8px 28px;
  max-height: 180px;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  color: #1e293b;
  font-size: 16px;
  line-height: 1.6;
}
body.subpage .job-panel.is-live {
  padding: 18px 20px 20px;
}
body.subpage .job-panel.is-live .job-panel-head strong {
  font-size: 20px;
}
body.subpage .job-panel.is-live [data-job-msg] {
  font-size: 18px;
  font-weight: 700;
  color: #1e1b4b;
}
body.subpage .job-panel.is-live .job-log {
  max-height: min(52vh, 520px);
  font-size: 16px;
  line-height: 1.7;
  padding: 12px 12px 12px 32px;
}
.job-log li { margin: 4px 0; }
.job-log b { color: #4f46e5; margin-right: 6px; }
.job-hint {
  margin: 10px 0 0;
  color: #334155;
  font-size: 16px;
  line-height: 1.55;
}
.flow-app .header .subtitle {
  font-size: 18px;
}
.flow-app .nav-tabs a {
  font-size: 17px;
  padding: 10px 18px;
}
.flow-msg {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px;
  line-height: 1.65;
}
html.flow-html,
.flow-body {
  height: 100%;
  overflow: hidden;
}
.flow-app {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
  box-sizing: border-box;
}
.flow-app .header {
  flex-shrink: 0;
  margin-bottom: 12px;
}
.flow-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0;
}
.flow-top {
  flex-shrink: 0;
}
.flow-ai {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}
.step-ai-label {
  font-weight: 700;
  color: #0f172a;
  font-size: 16px;
}
.step-ai {
  height: 40px;
  min-width: 180px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid #475569;
  font-size: 16px;
  background: #fff;
  box-sizing: border-box;
}
.flow-ai #btn-clear-west {
  margin-left: auto;
  flex-shrink: 0;
  height: 42px;
  padding: 0 18px;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.flow-ai label {
  font-weight: 700;
  color: #0f172a;
  font-size: 17px;
  line-height: 42px;
}
.flow-ai select {
  height: 42px;
  min-width: 220px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid #475569;
  font-size: 17px;
  line-height: 40px;
  background: #fff;
  box-sizing: border-box;
}
.flow-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
}
.flow-rules label {
  font-weight: 700;
  color: #0f172a;
  font-size: 18px;
}
.flow-rules textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid #475569;
  font-size: 18px;
  font-family: inherit;
  line-height: 1.55;
  resize: vertical;
  box-sizing: border-box;
}
.btn-danger {
  background: #fff;
  color: #b91c1c;
  border: 1.5px solid #b91c1c;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  color: #fff;
}
.flow-list {
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.flow-step {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px 16px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.flow-step header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.flow-step-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.flow-step-meta .flow-run-state {
  flex: 0 1 auto;
}
.flow-step h3 {
  margin: 0;
  font-size: 22px;
  color: #0f172a;
}
.flow-no { color: #64748b; font-weight: 700; font-size: 16px; }
.flow-run-state {
  font-size: 16px;
  font-weight: 700;
  text-align: right;
  flex: 1;
  line-height: 1.4;
}
.flow-run-state.is-idle { color: #94a3b8; }
.flow-run-state.is-run { color: #d97706; }
.flow-run-state.is-done { color: #15803d; }
.flow-step > p {
  margin: 0 0 10px;
  color: #334155;
  font-size: 17px;
  line-height: 1.55;
}
.flow-actions,
.flow-write {
  margin-top: auto;
  flex-shrink: 0;
}
.flow-step .btn {
  height: 40px;
  padding: 0 16px;
  font-size: 16px;
  line-height: 40px;
  border-radius: 8px;
  box-sizing: border-box;
  transform: none !important;
}
.flow-preview {
  margin: 12px 0 0;
  max-height: 220px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.flow-step-archive {
  background: #f8fafc;
}
.archive-wrap {
  margin-top: 12px;
  max-height: none;
  overflow: visible;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  padding: 16px 18px 20px;
}
.archive-wrap:has(.map-doc) {
  border: none;
  padding: 0;
  background: transparent;
}
.archive-empty {
  padding: 28px 18px;
  text-align: center;
  color: #334155;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.6;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
}
.archive-empty p { margin: 8px 0 0; color: #64748b; }
.archive-doc h4 {
  margin: 0 0 14px;
  font-size: 20px;
  color: #0f172a;
}
.apply-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 14px;
}
.apply-title-row h4 {
  margin: 0;
  flex: 0 1 auto;
}
.apply-title-row .west-rerun {
  margin: 0;
  flex: 0 0 auto;
  justify-content: flex-end;
}
.archive-doc section { margin: 0 0 18px; }
.archive-doc h5 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #1e3a8a;
}
.archive-doc p, .archive-doc li {
  font-size: 15px;
  line-height: 1.65;
  color: #0f172a;
}
.story-core-doc h4 {
  margin: 28px 0 14px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}
.story-core-doc h4:first-child {
  margin-top: 0;
}
.story-core-plot {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.85;
  color: #1e293b;
}
.bible-background {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.85;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
}
.story-core-trope {
  margin: 0 0 18px;
}
.story-core-trope-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.6;
}
.story-core-trope-how {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.75;
  color: #334155;
}
.story-core-hook {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.archive-doc ul, .archive-doc ol { margin: 0; padding-left: 1.2em; }
.archive-beats p { margin: 0 0 10px; }
.archive-beats .beat-gap { height: 8px; }
.archive-card {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}
.archive-tree {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #f1f5f9;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.55;
  color: #0f172a;
  white-space: pre;
  font-family: Consolas, "Sarasa Mono SC", "Noto Sans SC", monospace;
}
.archive-days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.archive-day {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.day-label { font-weight: 800; color: #1e3a8a; margin-bottom: 4px; }
.day-scene { color: #334155; }
.day-arrow { color: #94a3b8; margin: 4px 0; font-size: 16px; }
.day-event { font-weight: 700; color: #0f172a; }
.archive-world { list-style: none; padding: 0; }
.archive-world li { margin: 6px 0; padding: 6px 0; border-bottom: 1px solid #e2e8f0; }
.archive-nodes { list-style: none; padding: 0; }
.archive-nodes li { margin: 8px 0; }
.archive-nodes span { display: block; color: #64748b; font-weight: 400; margin-top: 2px; }
.flow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
  align-items: center;
}
.west-rerun {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
}
.west-rerun-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.west-edit-row {
  display: flex;
  gap: 8px;
}
.west-edit-row .btn {
  flex: 1;
  min-width: 0;
}
.west-edit-row .btn.is-on {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}
.west-rerun[hidden] {
  display: none;
}
.artifact-edit-label {
  display: block;
  font-weight: 700;
  margin: 16px 0 8px;
  color: #0f172a;
  font-size: 18px;
}
.artifact-editor {
  width: 100%;
  min-height: 62vh;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.8;
  letter-spacing: 0.02em;
  color: #0f172a;
  background: #fff;
  padding: 16px 18px;
  border: 1.5px solid #475569;
  border-radius: 12px;
  box-sizing: border-box;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  text-rendering: geometricPrecision;
  resize: vertical;
}
.map-doc {
  color: #111827;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
.map-hint, .map-meta {
  margin: 0 0 10px;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 500;
}
.map-tools {
  margin: 0 0 12px;
  display: flex;
  gap: 10px;
}
.map-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: auto;
  max-height: calc(100vh - 280px);
  background: #fff;
}
.map-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 17px;
  color: #111827;
}
.map-table-multi {
  min-width: 1100px;
}
.map-table th,
.map-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}
.map-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  font-weight: 700;
  z-index: 1;
  font-size: 16px;
}
.map-table th.mw-gap,
.map-table td.mw-gap {
  width: 14px;
  min-width: 14px;
  max-width: 18px;
  padding: 0;
  border-bottom: none;
  background: #ffff00 !important;
}
.map-table th.mw-op-col {
  width: 52px;
}
.map-table td.mw-empty {
  background: #fff;
}
.map-table .mw-type-select,
.map-table .mw-from-input,
.map-table .mw-to-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  color: #111827;
  background: #fff;
  font-size: 17px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: auto;
}
.map-table .mw-type-select {
  min-width: 112px;
  font-size: 15px;
}
.map-table .mw-to-input:focus,
.map-table .mw-from-input:focus,
.map-table .mw-type-select:focus {
  outline: 2px solid #6366f1;
  border-color: #6366f1;
}
.map-table .mw-actions {
  text-align: center;
  white-space: nowrap;
}
.map-table .btn-mw-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.map-table .btn-mw-del:hover {
  background: #fecdd3;
  border-color: #f87171;
}
.flow-write {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.flow-write select {
  min-width: 240px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #475569;
  font-size: 15px;
}

.apply-colhead i.is-before { color: #1d4ed8; }
.apply-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 12px 0;
}
.apply-nav-meta {
  min-width: 72px;
  text-align: center;
  font-weight: 700;
  color: #0f172a;
}
.apply-compare {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.apply-compare-head {
  padding: 12px 16px 8px;
  border-bottom: 1px solid #e2e8f0;
}
.apply-compare-head h5 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #0f172a;
}
.apply-colhead {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}
.apply-colhead i {
  font-style: normal;
  font-weight: 600;
  color: #c2410c;
}
.apply-compare-body {
  max-height: min(70vh, 720px);
  overflow: auto;
  padding: 12px 16px 18px;
  background: #fff;
}
.apply-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 0;
  padding: 4px 0;
  align-items: stretch;
  border-bottom: 1px solid #f1f5f9;
}
.apply-pair.is-blank {
  padding: 2px 0;
  border-bottom: 0;
}
.apply-pair p {
  margin: 0;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 16px;
  line-height: 1.7;
  color: #0f172a;
  height: 100%;
  box-sizing: border-box;
}
.apply-pair-block {
  align-items: stretch;
  border-bottom: 0;
  padding: 4px 0 0;
}
.apply-word-before {
  background: #bfdbfe;
  color: #1e3a8a;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}
.apply-word-after {
  background: #fdba74;
  color: #7c2d12;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}
.apply-pair p.after.is-editing {
  cursor: text;
  background: #fffbeb;
  outline: 1.5px solid #f59e0b;
  min-height: 1.7em;
}
.apply-colhead .is-hint {
  color: #64748b;
  font-weight: 500;
}
#apply-replace-modal {
  z-index: 210;
}
#apply-replace-modal.hidden {
  display: none;
}
.apply-replace-panel {
  width: min(420px, 100%);
}
.apply-replace-panel label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}
.apply-replace-panel input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 16px;
  font-family: inherit;
  color: #0f172a;
  margin-bottom: 14px;
}

/* 提示词 / 结果 / 对照等次画面：字大、不发糊 */
body.subpage {
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}
body.subpage .card {
  animation: none;
  transform: none;
}
body.subpage .brand {
  font-size: 30px;
}
body.subpage .subtitle,
body.subpage .flow-msg,
body.subpage .meta {
  font-size: 17px;
  line-height: 1.65;
  color: #334155;
}
body.subpage .btn {
  font-size: 16px;
}
body.subpage .archive-doc p,
body.subpage .archive-doc li,
body.subpage .archive-card {
  font-size: 17px;
  line-height: 1.75;
}

.delta-table textarea {
  width: 100%;
  min-height: 88px;
  padding: 8px 10px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.5;
  font-family: inherit;
  color: #111827;
  box-sizing: border-box;
  resize: vertical;
}
.delta-table .delta-check {
  white-space: nowrap;
  font-size: 16px;
  font-weight: 700;
}
.delta-table .delta-no input {
  width: 72px;
  padding: 8px 10px;
  font-size: 16px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
}
.delta-table td {
  vertical-align: top;
}

.rel-struct {
  margin: 12px 0 22px;
  padding: 18px 16px 14px;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 48%);
  border: 1px solid #fdba74;
  border-radius: 16px;
}
.rel-struct h5 {
  margin: 0 0 14px;
  font-size: 16px;
  color: #9a3412;
}
.rel-struct-hub {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}
.rel-struct-ring {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.rel-node {
  min-width: 132px;
  max-width: 200px;
  padding: 10px 12px;
  text-align: center;
  background: #fff;
  border: 2px solid #6366f1;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
.rel-node-hub {
  min-width: 180px;
  border-color: #c2410c;
  background: #fff7ed;
}
.rel-node .en {
  display: block;
  font-weight: 800;
  color: #0f172a;
}
.rel-node .orig {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: #64748b;
}
.rel-node .role {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #c2410c;
}
.rel-edges {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.rel-edges li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
}
.rel-from,
.rel-to {
  font-weight: 700;
  color: #1e3a8a;
}
.rel-arrow {
  font-weight: 700;
  color: #c2410c;
}
.artifact-actions .btn.is-on {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}
.forge-edit-hint {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 13px;
}
.forge-para {
  white-space: pre-wrap;
  line-height: 1.85;
}
.forge-sent {
  cursor: text;
}
.forge-sent.is-editing {
  outline: none;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #c7d2fe;
  padding: 0 2px;
}
.forge-sent.is-editing:focus,
.forge-title-text.is-editing:focus {
  background: #eef2ff;
}
.doc-edit.is-editing {
  outline: none;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #c7d2fe;
  padding: 0 2px;
  display: inline;
  white-space: pre-wrap;
}
.doc-edit.is-editing:focus {
  background: #eef2ff;
}
.day-event .doc-edit.is-editing,
p .doc-edit.is-editing {
  display: inline;
}
.map-table .doc-edit {
  display: inline-block;
  min-width: 4em;
  min-height: 1.2em;
}
.map-table .doc-edit.is-editing {
  display: block;
  width: 100%;
  min-height: 1.6em;
}
.forge-audit {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.forge-audit h5 {
  margin: 12px 0 8px;
}
.forge-audit h5:first-child { margin-top: 0; }
.pending-heading {
  color: #1d4ed8;
}
.pending-heading.is-done {
  color: #166534;
}
.pending-done-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 8px;
  color: #166534;
  font-weight: 700;
}
.pending-result-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.5;
}
.pending-result-banner.is-ok {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}
.pending-result-banner.is-fail {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}
#job-msg.is-ok {
  color: #166534;
  font-weight: 700;
}
#job-msg.is-fail {
  color: #991b1b;
  font-weight: 700;
}
.pending-hint {
  color: #64748b;
  font-size: 13px;
  margin: 0 0 12px;
}
#pending-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pending-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}
.pending-card.is-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.pending-title {
  font-weight: 650;
  margin: 0 0 6px;
  color: #1e3a8a;
}
.pending-why {
  margin: 0 0 10px;
  color: #475569;
  font-size: 14px;
  line-height: 1.55;
}
.pending-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pending-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.pending-opt:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
}
.pending-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.pending-tick {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 2px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
}
.pending-opt input:checked + .pending-tick {
  border-color: #2563eb;
  background: #2563eb;
}
.pending-opt input:checked + .pending-tick::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  margin: 1px 0 0 5px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.pending-opt-text {
  flex: 1;
  line-height: 1.5;
  color: #0f172a;
}
.pending-batch {
  margin-top: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pending-batch[hidden] {
  display: none !important;
}
.pending-confirm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pending-confirm[hidden] {
  display: none !important;
}
.pending-ai-label {
  font-size: 13px;
  font-weight: 650;
  color: #475569;
}
.pending-ai {
  min-width: 160px;
  height: 36px;
}
.pending-chosen {
  color: #166534;
  margin: 8px 0 0;
  font-weight: 650;
}
.review-heading {
  color: #0f766e;
}
.human-review {
  margin-top: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #99f6e4;
  border-radius: 10px;
}
.human-review-note {
  width: 100%;
  min-height: 96px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid #475569;
  border-radius: 10px;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}
.human-review-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.human-review-log {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}
.human-review-log b {
  color: #0f766e;
}
.ai-score-block {
  margin: 0 0 28px;
  padding: 0 0 8px;
}
.ai-score-block + .ai-rescore-bar,
.ai-rescore-bar + .ai-score-block {
  border-top: 1px solid #e2e8f0;
  padding-top: 18px;
}
.ai-rescore-bar {
  margin: 0 0 24px;
}
.ai-score-prompt {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.65;
  color: #1e293b;
}
.ai-score-num {
  font-size: 28px;
  font-weight: 800;
  color: #6d28d9;
  margin: 4px 0 10px;
}
.ai-score-comment {
  color: #334155;
  margin: 0 0 12px;
}
.ai-score-list {
  margin: 6px 0 14px;
  padding-left: 22px;
  line-height: 1.65;
  color: #1e293b;
}
.ai-score-body {
  margin-top: 8px;
}
.ai-score-chapter {
  margin-bottom: 22px;
}
.scheme-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.scheme-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.scheme-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.scheme-card:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
}
.scheme-card input:checked + .pending-tick {
  border-color: #2563eb;
  background: #2563eb;
}
.scheme-card input:checked + .pending-tick::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  margin: 1px 0 0 5px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.scheme-body {
  flex: 1;
  min-width: 0;
}
.scheme-field {
  margin: 0 0 6px;
  color: #475569;
  font-size: 14px;
  line-height: 1.55;
}
.scheme-actions {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.scheme-chosen {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.bible-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}
.bible-tab {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font: inherit;
  color: #334155;
}
.bible-tab.is-on {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 650;
}
.bible-tab.is-chosen {
  box-shadow: 0 0 0 2px #bbf7d0;
}
.bible-tabs .bible-use-btn {
  margin-left: 4px;
  align-self: center;
}
.bible-regen {
  margin-top: 28px;
  padding: 16px 16px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}
.bible-regen h5 {
  margin: 0 0 8px;
}
.bible-regen-prompt {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 96px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}
.bible-dir-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 8px;
}
.bible-dir-btns .btn {
  width: 100%;
  justify-content: center;
}
.en-tr-panel {
  width: min(860px, 96vw);
  max-height: 92vh;
}
.en-tr-label {
  display: block;
  margin: 4px 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.en-tr-genre-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.en-tr-genre-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
}
.en-tr-genre-option:hover {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.04);
}
.en-tr-genre-option.is-selected {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}
.en-tr-genre-option input {
  margin-top: 3px;
}
.en-tr-genre-option .genre-name {
  display: block;
  font-weight: 700;
  color: #0f172a;
  font-size: 16px;
}
.en-tr-genre-option .genre-meta {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}
#en-tr-system-prompt {
  width: 100%;
  box-sizing: border-box;
  min-height: 220px;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}
.en-tr-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}
@media (max-width: 720px) {
  .en-tr-genre-list {
    grid-template-columns: 1fr;
  }
}
#ctx-replace-menu {
  position: fixed;
  z-index: 4000;
  min-width: 168px;
  display: block;
}
#ctx-replace-menu.hidden {
  display: none;
}

.draft-ch-select {
  min-width: 180px;
  max-width: 42vw;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid #475569;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}
.draft-compare-meta {
  margin: 4px 0 12px;
  color: #475569;
  font-weight: 600;
}
.draft-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 62vh;
}
.draft-compare-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1.5px solid #475569;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.draft-compare-pane.is-new {
  border-color: #4f46e5;
}
.draft-compare-head {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 15px;
  color: #334155;
  background: #f8fafc;
}
.draft-compare-pane.is-new .draft-compare-head {
  background: #eef2ff;
  color: #312e81;
}
.draft-compare-body {
  flex: 1;
  min-height: 52vh;
  max-height: min(72vh, 820px);
  overflow: auto;
  padding: 14px 16px 20px;
}
.chapter-md-h {
  font-weight: 700;
  font-size: 16px;
  color: #0f172a;
  margin: 0 0 0.8em;
  text-indent: 0;
}
.draft-compare-body .chapter-md-h {
  padding: 0 0 4px;
}
.draft-compare-body .forge-para {
  text-indent: 2em;
  margin: 0 0 1em;
  line-height: 1.85;
  font-size: 16px;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
}
@media (max-width: 900px) {
  .draft-compare-grid { grid-template-columns: 1fr; }
  .draft-compare-body { max-height: 48vh; min-height: 36vh; }
}

.en-compare-page {
  padding: 0;
  background: #fff;
}
.en-compare-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 16px;
  background: #eef2ff;
  border-bottom: 1px solid #c7d2fe;
}
.en-compare-bar-bottom {
  border-bottom: none;
  border-top: 1px solid #c7d2fe;
  margin-top: 18px;
}
.en-compare-indicator {
  min-width: 140px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #1e1b4b;
}
.en-compare-bar .btn {
  min-width: 96px;
}
.en-compare-chapter {
  padding: 18px 8px 8px;
}
.en-compare-book {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}
.en-compare-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: #1e1b4b;
}
.en-compare-colhead {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
}
.en-compare-body {
  width: 100%;
}
.en-compare-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 0 0 0.45em;
  align-items: start;
  border: none;
  background: transparent;
}
.en-compare-pair.is-blank {
  margin: 0 0 0.25em;
  min-height: 0.35em;
}
.en-compare-pair .zh,
.en-compare-pair .en {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #111827;
}
.en-compare-pair .zh {
  font-size: 16px;
  line-height: 1.6;
}
.en-compare-pair .en {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.55;
}
@media (max-width: 900px) {
  .en-compare-colhead,
  .en-compare-pair { grid-template-columns: 1fr; gap: 8px; }
}

.archive-wrap:has(.en-novel-page) {
  border: none;
  padding: 4px 0 8px;
  background: transparent;
}
.en-novel-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 4px 8px 48px;
  background: transparent;
}
.en-novel-chapter {
  margin: 0 0 36px;
}
.en-novel-chapter h3 {
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}
.en-novel-body {
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 18px;
  line-height: 1.85;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}
