:root {
  --ink: #e8f7f2;
  --text: #e2efe9;
  --muted: #9bb5ac;
  --line: rgba(180, 230, 210, 0.14);
  --line-strong: rgba(180, 230, 210, 0.28);
  --paper: #0a1210;
  --paper-2: rgba(16, 36, 32, 0.92);
  --surface: rgba(10, 22, 20, 0.72);
  --surface-solid: rgba(12, 28, 25, 0.92);
  --primary: #1ec9b6;
  --primary-bright: #3ee0cc;
  --primary-hover: #14a898;
  --primary-soft: rgba(30, 201, 182, 0.16);
  --accent: #f0a020;
  --accent-deep: #ffb347;
  --accent-soft: rgba(240, 160, 32, 0.18);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 80, 80, 0.16);
  --ok: #3ddc84;
  --ok-soft: rgba(61, 220, 132, 0.16);
  --gold: #f5c542;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 18px 48px rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --font-display: "Fraunces", "Noto Serif SC", "Songti SC", serif;
  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: #050608;
  overflow-x: hidden;
}

body::before,
body::after {
  display: none;
}

.bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #050608;
}

#bg-tech-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: saturate(1.05) contrast(1.12) brightness(0.78);
  transition: none;
  z-index: 0;
}
.bg-video.is-active {
  z-index: 1;
}

.bg-dim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse 75% 60% at 50% 30%, rgba(0, 0, 0, 0.18), transparent 65%),
    linear-gradient(180deg, rgba(5, 6, 8, 0.28) 0%, rgba(5, 6, 8, 0.58) 100%);
}

/* 旧光晕元素在科技背景下隐藏 */
.bg-glow,
.bg-aurora,
.bg-ring {
  display: none;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(28px, -22px) scale(1.06); }
}

.app {
  position: relative;
  z-index: 1;
  /* 再加宽约 4cm（≈150px） */
  max-width: min(1920px, 99.5vw);
  margin: 0 auto;
  padding: 18px 6px 48px;
}

.header {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 36px);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  background: linear-gradient(115deg, #ffffff 10%, var(--primary-bright) 48%, var(--accent) 100%);
  background-size: 160% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brandShine 8s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(30, 201, 182, 0.35));
}
@keyframes brandShine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.header .subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.nav-tabs a {
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(8, 20, 18, 0.55);
  border: 1px solid var(--line);
  transition: background 0.18s ease, transform 0.18s ease;
}
.nav-tabs a:hover { background: rgba(20, 40, 36, 0.85); transform: translateY(-1px); }
.nav-tabs a.active {
  background: linear-gradient(160deg, #1ab5a6 0%, var(--primary) 55%, #086059 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(11, 122, 112, 0.28);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.user-chip .btn {
  padding: 6px 12px;
  font-size: 13px;
}

/* —— Cards（白底软阴影，对齐收入看板截图风格；页面背景保持深色） —— */
.card {
  position: relative;
  z-index: 1;
  /* 卡片内浅色主题：白底 + 靛蓝点缀 */
  --ink: #1e293b;
  --text: #334155;
  --muted: #94a3b8;
  --line: rgba(99, 102, 241, 0.1);
  --line-strong: rgba(99, 102, 241, 0.18);
  --paper: #f8fafc;
  --paper-2: rgba(99, 102, 241, 0.04);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --primary: #6366f1;
  --primary-bright: #818cf8;
  --primary-hover: #4f46e5;
  --primary-soft: rgba(99, 102, 241, 0.1);
  --accent: #f59e0b;
  --accent-deep: #d97706;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.1);
  --shadow: 0 4px 24px rgba(99, 102, 241, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-lift: 0 12px 32px rgba(99, 102, 241, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 22px 24px;
  margin-bottom: 18px;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: visible;
}

/* 筛选卡抬高层级，避免书名联想被下方合计/表格卡片盖住 */
.app > .card:first-of-type {
  z-index: 30;
}

.card h2 {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head-row h2 { margin: 0; }
.card-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

table.data-table th.check-col,
table.data-table td.check-col {
  width: 36px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
  vertical-align: middle;
}
table.data-table .row-check,
table.data-table .check-all {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
  vertical-align: middle;
}
#btn-batch-download:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* —— Filter bar —— */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 148px;
  position: relative;
}
.filter-field.grow {
  flex: 1 1 240px;
  min-width: 220px;
  position: relative;
  z-index: 2;
}

.filter-field label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
}

.filter-field input,
.filter-field select {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-field input:focus,
.filter-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.genre-hot-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.genre-hot-row select {
  flex: 1 1 auto;
  min-width: 0;
}
.hot-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.hot-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.hot-check:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  color: var(--primary-hover);
  background: var(--primary-soft);
}

.filter-field.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  max-height: 260px;
  overflow-y: auto;
  z-index: 40;
}
.autocomplete-list .ac-item {
  padding: 12px 16px;
  font-size: 17px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.autocomplete-list .ac-item:last-child { border-bottom: none; }
.autocomplete-list .ac-item:hover { background: var(--paper-2); }
.autocomplete-list .ac-item .ac-en { color: var(--muted); font-size: 14.5px; }

.filter-actions {
  display: flex;
  gap: 8px;
}

/* —— Buttons —— */
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.95);
  color: #64748b;
  border: 1.5px solid rgba(99, 102, 241, 0.15);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.btn-secondary:hover:not(:disabled) { background: rgba(99, 102, 241, 0.06); color: var(--primary); transform: translateY(-1px); }
.btn-danger {
  background: #fff;
  color: #b91c1c;
  border: 1.5px solid rgba(185, 28, 28, 0.28);
  box-shadow: 0 1px 4px rgba(185, 28, 28, 0.06);
}
.btn-danger:hover:not(:disabled) {
  background: #fef2f2;
  color: #991b1b;
  transform: translateY(-1px);
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); }

/* —— Summary —— */
.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.summary-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 18px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f7ff 100%);
  border: 1px solid rgba(99, 102, 241, 0.14);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.06);
  position: relative;
  overflow: hidden;
  min-width: 168px;
}
.summary-total::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 14px 14px 0 0;
}
.summary-total .label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.summary-total .value { font-family: var(--font-serif); font-size: 28px; font-weight: 800; color: #4f46e5; letter-spacing: -0.03em; }

.platform-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid rgba(99, 102, 241, 0.16);
  box-shadow: none;
  min-height: 44px;
}
.platform-chip:nth-child(2n) {
  background: #ecfeff;
  border-color: rgba(14, 116, 144, 0.16);
}
.platform-chip:nth-child(2n) .name { color: #0e7490; }
.platform-chip .name { font-size: 13px; font-weight: 700; color: #4338ca; }
.platform-chip .amount { font-size: 16px; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; }

/* 书籍信息：与其它卡片同为白底，表格独立成一块可横滑的数据台 */
.card-books {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: 20px 20px 16px;
}
.card-books .card-head-row {
  margin-bottom: 12px;
}
.card-books .table-wrap {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  max-height: min(72vh, 860px);
  overflow: auto;
}
.card-books .table-wrap::-webkit-scrollbar { height: 10px; width: 10px; }
.card-books .table-wrap::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.32);
  border-radius: 999px;
}
.card-books .table-wrap::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.05); }
.card-books table.data-table {
  width: max-content;
  min-width: 100%;
  background: #fff;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.card-books table.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.card-books table.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.card-books table.data-table tbody tr:hover { background: #eef2ff; }
.card-books table.data-table .tag-select,
.card-books table.data-table .tag-input {
  background: #fff;
}

/* —— Table —— */
.table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
}
table.data-table { width: 100%; border-collapse: collapse; font-size: 15px; background: #fff; }
table.data-table.compact { font-size: 13px; }
table.data-table th, table.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  white-space: nowrap;
  vertical-align: middle;
}
table.data-table.compact th,
table.data-table.compact td {
  padding: 8px 10px;
  line-height: 1.35;
  min-height: 48px;
  height: auto;
}
table.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: none;
  position: sticky;
  top: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
table.data-table.compact th {
  font-size: 12px;
  letter-spacing: 0.02em;
  height: 40px;
}
table.data-table td.wrap { white-space: nowrap; max-width: 260px; }
table.data-table.compact td.wrap { max-width: 260px; }
table.data-table td.cn-cell,
table.data-table th.cn-col {
  white-space: normal;
  min-width: 240px;
  width: 260px;
  max-width: 280px;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-weight: 650;
  color: #0f172a;
  vertical-align: top;
}
table.data-table td.en-cell,
table.data-table th.en-col {
  white-space: normal;
  min-width: 240px;
  width: 280px;
  max-width: 320px;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
  vertical-align: top;
}
table.data-table td.en-cell .en-text,
table.data-table td.en-cell .en-link {
  display: inline;
  max-width: none;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.books-table .check-col {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 42px;
  min-width: 42px;
  background: inherit;
}
.books-table thead .check-col { z-index: 5; background: #f8fafc; }
.books-table tbody .check-col { background: #fff; }
.books-table tbody tr:nth-child(even) .check-col { background: #fafbfc; }
.books-table tbody tr:hover .check-col { background: #eef2ff; }
.books-table th.cn-col,
.books-table td.cn-cell {
  position: sticky;
  left: 42px;
  z-index: 4;
  background: inherit;
  box-shadow: 8px 0 12px -10px rgba(15, 23, 42, 0.18);
}
.books-table thead th.cn-col { z-index: 5; background: #f8fafc; }
.books-table tbody td.cn-cell { background: #fff; }
.books-table tbody tr:nth-child(even) td.cn-cell { background: #fafbfc; }
.books-table tbody tr:hover td.cn-cell { background: #eef2ff; }
table.data-table td.income-cell {
  white-space: nowrap;
  min-width: 108px;
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  color: #0f766e;
  font-weight: 650;
}
table.data-table td.income-cell.is-empty {
  color: #94a3b8;
  font-weight: 500;
}
table.data-table tbody tr:hover { background: #eef2ff; }
table.data-table td.amount { font-weight: 800; color: #6366f1; text-align: right; }
table.data-table th.center,
table.data-table td.center {
  text-align: center;
  width: 1%;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}
a.en-link {
  color: #4f46e5;
  text-decoration: none;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 600;
}
a.en-link:hover { color: #3730a3; text-decoration: underline; }
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.status-pill.is-empty {
  background: #f1f5f9;
  color: #94a3b8;
}
.status-pill.is-yes,
a.status-pill.is-yes {
  background: #d1fae5;
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.28);
}
a.status-pill.is-yes:hover { background: #a7f3d0; color: #065f46; }
.holder-chip,
.genre-chip {
  display: inline-block;
  max-width: 8em;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 650;
}
.genre-chip {
  background: #ecfeff;
  color: #0e7490;
  max-width: 10em;
}
.num-cell { font-variant-numeric: tabular-nums; color: #334155; }

table.data-table .tag-select,
table.data-table .tag-input {
  width: 100%;
  min-width: 72px;
  max-width: 100px;
  height: 32px;
  font-size: 13px;
  padding: 4px 26px 4px 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background-color: #fff;
  color: #0f172a;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.2 1.5L6 6.3l4.8-4.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 7px;
}
table.data-table .tag-input {
  min-width: 120px;
  max-width: 156px;
  padding-right: 8px;
  background-image: none;
}
table.data-table .tag-input::placeholder { color: #cbd5e1; }
table.data-table .tag-select:focus,
table.data-table .tag-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
table.data-table tr.tag-saving .tag-select,
table.data-table tr.tag-saving .tag-input { opacity: 0.6; }
table.data-table tr.tag-saved .tag-select,
table.data-table tr.tag-saved .tag-input {
  border-color: var(--ok);
  background-color: var(--ok-soft);
}
.btn-tag-save {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-tag-save:hover:not(:disabled) { filter: brightness(1.05); }
.btn-tag-save:disabled { opacity: 0.65; cursor: default; }
.story-cell {
  min-width: 132px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.story-text {
  font-size: 12.5px;
  line-height: 1.3;
  white-space: nowrap;
  color: #64748b;
}
.muted-tip { display: inline-block; font-size: 12.5px; color: var(--muted); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.badge-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.25);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.empty-state, .loading-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* —— Upload page —— */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) { .upload-grid { grid-template-columns: 1fr; } }

.upload-box {
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  padding: 26px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.upload-box.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-box p { margin: 6px 0; color: var(--muted); font-size: 12.5px; }
.upload-box .upload-title { font-weight: 700; color: var(--text); font-size: 14.5px; margin-bottom: 4px; }

.upload-progress {
  margin-top: 14px;
  text-align: left;
}
.upload-progress .progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.12);
}
.upload-progress .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.25s ease;
}
.upload-progress .progress-text {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #6366f1;
}

.modal-mask {
  position: fixed;
  inset: 0;
  /* 必须高于 .tv-result-mask(90)，否则对照层打开时「选 API」弹窗会被盖住，看起来像没反应 */
  z-index: 140;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #0f172a;
}
.modal-mask.hidden { display: none; }
.modal-panel {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(15, 23, 42, 0.06);
  color: #0f172a;
  --text: #0f172a;
  --muted: #334155;
  --ink: #0f172a;
}
.modal-panel h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-family: "Noto Serif SC", "Fraunces", serif;
  color: #0f172a;
}
.modal-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.55;
}
.model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  margin-bottom: 12px;
}
.model-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  color: #0f172a;
  background: #fff;
}
.model-option:hover { border-color: rgba(99, 102, 241, 0.45); background: rgba(99, 102, 241, 0.04); }
.model-option.is-selected { border-color: #6366f1; background: rgba(99, 102, 241, 0.08); }
.model-option input { margin-top: 3px; }
.model-option .model-name { font-weight: 700; font-size: 13.5px; color: #0f172a; }
.model-option .model-meta { font-size: 12px; color: #334155; margin-top: 2px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.modal-panel .btn-ghost {
  color: #0f172a;
}
.modal-panel .btn-ghost:hover {
  color: #312e81;
}
.modal-panel .upload-progress .progress-text {
  color: #312e81;
}

/* 翻译对照：留在看板原页的全屏层，不跳转 */
.tv-result-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 10px;
  color: #0f172a;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}
.tv-result-mask.hidden { display: none; }
.tv-result-panel {
  width: min(1480px, 98vw);
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #111827;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}
/* Standalone /translate-view page: fixed chrome, only article scrolls */
body.tv-standalone-page {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}
body.tv-standalone-page .tv-result-mask {
  position: relative;
  inset: auto;
  z-index: 1;
  height: 100vh;
  padding: 0;
  background: #ffffff;
  display: flex;
}
body.tv-standalone-page .tv-result-mask.hidden {
  display: flex;
}
body.tv-standalone-page .tv-result-panel {
  width: 100%;
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.tv-standalone-page .tv-result-header,
body.tv-standalone-page .tv-chapter-bar,
body.tv-standalone-page .tv-zh-quality-box,
body.tv-standalone-page .tv-mapping-box,
body.tv-standalone-page .tv-verify-box,
body.tv-standalone-page .tv-inline-progress {
  flex: 0 0 auto;
}
body.tv-standalone-page .tv-result-content {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: #ffffff;
  overflow: auto;
}
#tv-result-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.55;
}
#tv-result-meta .tv-meta-base {
  display: block;
}
#tv-result-meta .tv-token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}
body.tv-standalone-page .tv-token-pill,
#tv-result-meta .tv-token-pill {
  display: inline-block;
  margin-left: 0;
  margin-top: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  font-size: 13px;
}
body.tv-standalone-page .tv-token-pill-translate,
#tv-result-meta .tv-token-pill-translate {
  background: #e0f2fe;
  color: #075985;
}
body.tv-standalone-page .tv-token-pill-apply,
#tv-result-meta .tv-token-pill-apply {
  background: #f3e8ff;
  color: #6b21a8;
}
body.tv-standalone-page .tv-token-pill-verify,
#tv-result-meta .tv-token-pill-verify {
  background: #ecfdf5;
  color: #047857;
}
body.tv-standalone-page .tv-token-pill-back,
#tv-result-meta .tv-token-pill-back {
  background: #fff7ed;
  color: #c2410c;
}
body.tv-standalone-page .tv-token-pill-total,
#tv-result-meta .tv-token-pill-total {
  background: #0f172a;
  color: #f8fafc;
}
body.tv-standalone-page .tv-token-pill-cost,
#tv-result-meta .tv-token-pill-cost {
  margin-left: auto;
  background: #14532d;
  color: #ecfccb;
}
.tv-novel-compare .tv-zh-before-hit,
.tv-novel-compare .tv-zh-after-hit {
  border-radius: 3px;
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.tv-result-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.tv-result-header h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #111827;
  letter-spacing: 0.01em;
}
.tv-kicker {
  margin: 0 0 4px;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #334155;
  font-weight: 600;
}
.tv-meta {
  margin: 6px 0 0;
  font-size: 15px;
  color: #1f2937;
}
.tv-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tv-chapter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 16px;
  background: #eef2ff;
  border-bottom: 1px solid #c7d2fe;
}
.tv-chapter-bar-bottom {
  border-bottom: none;
  border-top: 1px solid #c7d2fe;
  margin-top: auto;
}
.tv-chapter-indicator {
  min-width: 140px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #1e1b4b;
}
.tv-chapter-bar .btn {
  min-width: 96px;
}
.tv-result-content {
  flex: 1;
  overflow: auto;
  padding: 18px 18px 28px;
  background: #fff;
  margin: 0 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.tv-book + .tv-book {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #e5e7eb;
}
.tv-book-title {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 700;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #111827;
}
.tv-chapter { margin-top: 8px; }
.tv-chapter-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #1e1b4b;
}
.tv-pair-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-bottom: 8px;
}
.tv-pair-table th,
.tv-pair-table td {
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  vertical-align: top;
  width: 50%;
  word-break: break-word;
}
.tv-pair-table th {
  background: #f8fafc;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  text-align: left;
}
.tv-pair-table td.en {
  font-family: "Segoe UI", "Georgia", "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.85;
  color: #111827;
}
.tv-pair-table td.zh {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 18px;
  line-height: 1.9;
  color: #000;
  background: #fcfcff;
  font-weight: 500;
}
.tv-error { color: #b91c1c; padding: 20px 8px; }
.tv-fail-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
  font-size: 13.5px;
  line-height: 1.55;
}
.tv-inline-progress {
  margin: 0 12px;
  padding: 8px 4px 4px;
}
.tv-mapping-box {
  margin: 0 12px 8px;
  padding: 10px 12px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  max-height: 140px;
  overflow: auto;
  font-size: 12.5px;
  color: #0f172a;
}
.tv-mapping-box.hidden { display: none; }
.tv-mapping-box h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #9a3412;
}
.tv-mapping-box .map-row { margin: 2px 0; }
.tv-mapping-box .map-to {
  color: #c2410c;
  font-weight: 700;
}
.tv-zh-body {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 18px;
  line-height: 1.95;
  color: #111827;
  white-space: pre-wrap;
  font-weight: 500;
}
.tv-zh-changed {
  color: #c2410c;
  font-weight: 700;
  background: rgba(194, 65, 12, 0.08);
}
.tv-zh-before-hit {
  background: #bfdbfe;
  color: #1e3a8a;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.tv-zh-after-hit {
  background: #fdba74;
  color: #7c2d12;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.tv-legend {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}
.tv-legend-before {
  background: #bfdbfe;
  color: #1e3a8a;
}
.tv-legend-after {
  background: #fdba74;
  color: #7c2d12;
}
.tv-verify-box {
  margin: 0 12px 8px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  max-height: 280px;
  overflow: auto;
  color: #111827;
  font-size: 16px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.65;
}
.tv-verify-box.hidden { display: none; }
.tv-verify-box.pass { border-color: #86efac; background: #f0fdf4; }
.tv-verify-box.warn { border-color: #fcd34d; background: #fffbeb; }
.tv-verify-box.fail { border-color: #fca5a5; background: #fef2f2; }
.tv-verify-box h4 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}
.tv-verify-box .verify-fix-bar {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.tv-verify-box .verify-fix-hint {
  margin: 0;
  color: #9a3412;
  font-size: 15px;
  font-weight: 600;
}
.tv-verify-box .verify-summary { margin: 0 0 8px; line-height: 1.5; }
.tv-verify-box .verify-issue {
  margin: 4px 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  line-height: 1.45;
}
.tv-verify-box .lvl-error { color: #b91c1c; font-weight: 700; }
.tv-verify-box .lvl-warn { color: #b45309; font-weight: 700; }

.result-panel {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
}
.result-panel .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.result-panel .stat {
  background: var(--paper-2);
  border-radius: 10px;
  padding: 8px 10px;
}
.result-panel .stat .num { font-size: 18px; font-weight: 700; color: var(--ink); }
.result-panel .stat .lbl { font-size: 11px; color: var(--muted); }
.result-panel .error-list { max-height: 160px; overflow-y: auto; margin-top: 8px; }
.result-panel .error-list div { color: var(--danger); font-size: 12px; padding: 2px 0; }

.hidden { display: none !important; }

.map-workspace-mask {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 10px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}
.map-workspace-mask.hidden { display: none; }
.map-workspace-panel {
  width: min(1480px, 98vw);
  background: #fff;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  color: #111827;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}
/* Standalone /mapping-view page */
body.mw-standalone-page {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}
body.mw-standalone-page .tv-result-mask {
  display: none !important;
}
body.mw-standalone-page .map-workspace-mask {
  position: relative;
  inset: auto;
  z-index: 1;
  height: 100vh;
  padding: 0;
  background: #ffffff;
}
body.mw-standalone-page .map-workspace-mask.hidden {
  display: flex;
}
body.mw-standalone-page .map-workspace-panel {
  width: 100%;
  max-width: none;
  height: 100vh;
  border-radius: 0;
  box-shadow: none;
}
body.mw-standalone-page .tv-token-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  font-size: 14px;
}
body.mw-standalone-page .tv-token-pill-apply {
  background: #f3e8ff;
  color: #6b21a8;
}
body.mw-standalone-page .tv-token-pill-verify {
  background: #ecfdf5;
  color: #047857;
}
.map-workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.map-workspace-header h2 {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 700;
  color: #111827;
}
.map-workspace-body {
  padding: 14px 20px 20px;
  overflow: auto;
  flex: 1;
}
.map-workspace-hint {
  margin: 0 0 12px;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 500;
}
.map-workspace-hint.needs-fix {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 10px 12px;
}
.map-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: auto;
  max-height: calc(100vh - 240px);
}
.map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
  color: #111827;
}
.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 .mw-from { color: #111827; font-weight: 500; }
.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", "PingFang SC", sans-serif;
  font-weight: 500;
  line-height: 1.45;
}
.map-table .mw-to-input:focus {
  outline: 2px solid #6366f1;
  border-color: #6366f1;
}
.map-table .mw-type {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  font-size: 12px;
  color: #334155;
}
.map-workspace-panel .btn,
.tv-result-panel .btn {
  font-size: 15px;
  padding: 9px 14px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-weight: 600;
}
.map-workspace-panel .progress-text,
.tv-result-panel .progress-text {
  font-size: 15px;
  font-weight: 600;
  color: #1e1b4b;
}
.btn-mw-pulse {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
  animation: mwPulse 1.2s ease-in-out 2;
}
@keyframes mwPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.map-workspace-tools {
  margin: 0 0 12px;
  display: flex;
  gap: 10px;
}
.map-table .mw-actions {
  text-align: center;
  vertical-align: middle;
  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;
}
.map-table .mw-from-input,
.map-table .mw-name-input,
.map-table .mw-type-select {
  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", "PingFang SC", sans-serif;
  font-weight: 500;
}
.map-table .mw-name-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}
.map-table .mw-to-input,
.map-table .mw-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  color: #111827;
  background: #fff;
  font-size: 16px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-weight: 500;
  line-height: 1.45;
}
.map-table .mw-name-input:focus {
  outline: 2px solid #6366f1;
  border-color: #6366f1;
}
.map-table .mw-type-select {
  min-width: 112px;
  font-size: 15px;
}
.map-table-multi {
  min-width: 1100px;
}
.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-name-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-table .mw-name-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.map-table .mw-name-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.2;
}
.map-table .mw-name-stack-single .mw-name-input.hidden {
  display: none;
}
.tv-zh-quality-box {
  margin: 0 12px 8px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #111827;
  font-size: 16px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.65;
  max-height: 260px;
  overflow: auto;
}
.tv-zh-quality-box.hidden { display: none; }
.tv-zh-quality-box.pass {
  border-color: #86efac;
  background: #f0fdf4;
}
.tv-zh-quality-box h4 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}
.tv-zh-quality-box.fail h4 { color: #b91c1c; }
.tv-zh-quality-box.pass h4 { color: #166534; }
.tv-zh-quality-box .q-sample {
  margin: 4px 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.8);
}
.tv-zh-quality-box .q-word {
  color: #b91c1c;
  font-weight: 700;
}
.tv-pair-table.tv-chapter-solid {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0 10px;
}
.tv-pair-table.tv-chapter-solid td.en,
.tv-pair-table.tv-chapter-solid td.zh {
  white-space: pre-wrap;
  vertical-align: top;
  line-height: 1.7;
}
/* Bilingual novel view: plain text, no grid/boxes, tighter spacing */
.tv-novel-compare {
  width: 100%;
  padding: 0 4px 16px;
  background: #ffffff;
}
.tv-novel-colhead {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 0 0 8px;
  padding: 0;
  border: none;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
}
.tv-novel-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 0 0 0.45em;
  align-items: start;
  border: none;
  background: transparent;
}
.tv-novel-pair.is-blank {
  margin: 0 0 0.25em;
  min-height: 0.35em;
}
.tv-novel-pair p {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  outline: none;
}
.tv-novel-pair p.en {
  font-family: Georgia, "Times New Roman", "Literata", serif;
  font-size: 16px;
  line-height: 1.55;
  color: #111827;
  white-space: pre-wrap;
  word-break: break-word;
}
.tv-novel-pair p.zh {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #111827;
  white-space: pre-wrap;
  word-break: break-word;
}
.ctx-menu {
  position: fixed;
  z-index: 200;
  min-width: 140px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
  padding: 6px;
  color: #0f172a;
}
.ctx-menu.hidden { display: none; }
.ctx-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #0f172a;
  cursor: pointer;
}
.ctx-menu-item:hover {
  background: #eef2ff;
  color: #3730a3;
}
#global-replace-modal {
  z-index: 210;
}
#global-replace-modal .modal-panel {
  color: #0f172a;
}
#global-replace-modal h3 {
  color: #0f172a;
  font-size: 20px;
}
.modal-panel-wide {
  width: min(1200px, 98vw);
  max-height: 94vh;
  overflow: auto;
  padding: 32px 36px 24px;
}
#translate-modal .modal-panel-wide h3 {
  font-size: 28px;
  margin-bottom: 12px;
}
#translate-modal .modal-desc {
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 18px;
}
#translate-modal .model-list {
  max-height: 220px;
  gap: 12px;
  margin-bottom: 18px;
}
#translate-modal .model-option {
  padding: 16px 18px;
  gap: 14px;
}
#translate-modal .model-option input {
  width: 20px;
  height: 20px;
  margin-top: 4px;
}
#translate-modal .model-option .model-name {
  font-size: 18px;
}
#translate-modal .model-option .model-meta {
  font-size: 15px;
  margin-top: 4px;
}
.prompt-field {
  margin: 0 0 18px;
}
.prompt-field.hidden { display: none; }
.prompt-field label {
  display: block;
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.prompt-field textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 280px;
  resize: vertical;
  padding: 16px 18px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 17px;
  line-height: 1.75;
  color: #0f172a;
  background: #fff;
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
.prompt-field textarea:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.prompt-hint {
  margin: 10px 0 0;
  font-size: 15px;
  color: #475569;
  line-height: 1.55;
}
.modal-sticky-top {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #fff;
  padding: 2px 0 14px;
  margin: 0 0 16px;
  border-bottom: 1px solid #e2e8f0;
}
.modal-sticky-top .modal-actions {
  margin-top: 0;
  gap: 14px;
}
.modal-sticky-top .upload-progress {
  margin: 0 0 12px;
}
.modal-sticky-top .upload-progress.hidden {
  display: none;
}
#translate-modal .modal-actions .btn {
  min-height: 48px;
  padding: 12px 24px;
  font-size: 16px;
}
#global-replace-modal .modal-sticky-top {
  margin-bottom: 14px;
}
/* Inline progress bars sit above headers on result / mapping pages */
#tv-rewrite-progress.tv-inline-progress,
#mw-progress.tv-inline-progress {
  margin: 0;
  padding: 10px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
#tv-rewrite-progress.tv-inline-progress.hidden,
#mw-progress.tv-inline-progress.hidden {
  display: none;
}
/* 生成对照表：提示词更长，单独加大 */
#rewrite-prompt-wrap label {
  font-size: 19px;
}
#rewrite-prompt-wrap textarea {
  min-height: min(48vh, 420px);
  font-size: 17px;
  line-height: 1.8;
  padding: 18px 20px;
}
#rewrite-prompt-wrap .prompt-hint {
  font-size: 15px;
}
#apply-prompt-wrap label {
  font-size: 19px;
}
#apply-prompt-wrap textarea {
  min-height: min(48vh, 420px);
  font-size: 17px;
  line-height: 1.8;
  padding: 18px 20px;
}
#verify-prompt-wrap label {
  font-size: 19px;
}
#verify-prompt-wrap textarea {
  min-height: min(48vh, 420px);
  font-size: 17px;
  line-height: 1.8;
  padding: 18px 20px;
}
.tv-pair-table.tv-zh-compare {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}
.tv-pair-table.tv-zh-compare col.before,
.tv-pair-table.tv-zh-compare th:first-child,
.tv-pair-table.tv-zh-compare td.before {
  width: 50%;
}
.tv-pair-table.tv-zh-compare col.after,
.tv-pair-table.tv-zh-compare th:last-child,
.tv-pair-table.tv-zh-compare td.after {
  width: 50%;
}
.tv-pair-table.tv-zh-compare tbody tr.zh-align-row td {
  vertical-align: top;
  /* row height follows the taller side so left/right stay aligned */
  height: 100%;
}
.tv-pair-table.tv-zh-compare td.zh {
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.85;
  font-size: 17px;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 14px;
}
.tv-pair-table.tv-zh-compare tr.is-blank td.zh {
  padding-top: 6px;
  padding-bottom: 6px;
  border-bottom-color: transparent;
  min-height: 0.6em;
}
.tv-pair-table.tv-zh-compare td.zh.before {
  color: #334155;
  background: #f8fafc;
}
.tv-pair-table.tv-zh-compare td.zh.after {
  color: #0f172a;
  background: #fff;
}
.tv-pair-table.tv-zh-compare th {
  font-size: 15px;
}
#back-en-prompt-wrap label {
  font-size: 19px;
}
#back-en-prompt-wrap textarea {
  min-height: min(42vh, 360px);
  font-size: 17px;
  line-height: 1.75;
  padding: 18px 20px;
}
.back-en-genre-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}
.back-en-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;
}
.back-en-genre-option:hover {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.04);
}
.back-en-genre-option.is-selected {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}
.back-en-genre-option input {
  margin-top: 3px;
}
.back-en-genre-option .genre-name {
  display: block;
  font-weight: 700;
  color: #0f172a;
  font-size: 16px;
}
.back-en-genre-option .genre-meta {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}
@media (max-width: 720px) {
  .back-en-genre-list {
    grid-template-columns: 1fr;
  }
}