* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f3ef;
  --panel: #ffffff;
  --panel2: #f8f7f4;
  --panel3: #efede8;
  --line: #e4e0d8;
  --text: #26221c;
  --muted: #6b6a64;
  --dim: #918c83;
  --accent: #c8372d;
  --accent-soft: #fdeceb;
  --gold: #a4731f;
  --gold-soft: #fbf3e0;
  --ok: #1e8e5e;
  --ok-soft: #e7f6ee;
  --warn: #b0741a;
  --warn-soft: #fdf3df;
}

html, body { min-height: 100%; }

body {
  background: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #ddd8cf; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 布局：左侧菜单 + 主区 ---------------- */
.app { min-height: 100vh; }

.side {
  position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 60;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  background: #faf9f6; border-right: 1px solid var(--line);
  transition: transform .2s ease; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; border-bottom: 1px solid #e6e2da; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font-size: 15px; font-weight: 600; color: #fff;
  background: linear-gradient(160deg, #dc4b41, #8e241f);
  box-shadow: 0 4px 14px rgba(190, 50, 42, .18);
}
.brand-name { font-size: 13.5px; font-weight: 600; letter-spacing: .4px; }
.brand-ver { font-size: 10px; color: #918c83; margin-top: 2px; letter-spacing: .3px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.side-group { font-size: 10px; color: #a09a90; letter-spacing: 1.5px; padding: 14px 10px 6px; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: #5e594f; font-size: 13px; font-family: inherit;
  cursor: pointer; text-align: left; transition: .15s;
}
.side-item i { font-style: normal; font-size: 12px; width: 14px; text-align: center; color: #9a948a; flex: none; }
.side-item:hover { background: #f1efe9; color: #26221c; }
.side-item.on { background: #fbe9e6; border-color: #f1d3ce; color: #26221c; }
.side-item.on i { color: var(--accent); }
.side-badge {
  margin-left: auto; font-size: 10px; font-weight: 400;
  background: #f0eeea; color: #5e594f; border-radius: 20px; padding: 1px 7px;
}

.side-proj {
  margin-top: auto; background: #fbfaf7; border: 1px solid #efede8;
  border-radius: 10px; padding: 11px 12px; cursor: pointer; transition: .15s;
}
.side-proj:hover { border-color: #cfc8bc; }
.sp-label { font-size: 10px; color: #918c83; letter-spacing: 1px; }
.sp-title { font-size: 12.5px; color: #3a352e; margin-top: 4px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sp-meta { font-size: 10.5px; color: #918c83; margin-top: 4px; }
.sp-bar { height: 2px; background: #f0eeea; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.sp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #b52f28, #e26057); }

.side-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: #918c83; padding: 10px 6px 0;
  border-top: 1px solid #e6e2da; margin-top: 10px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #9a948a; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(30, 142, 94, .14); }

.side-mask { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(42, 38, 32, .28); }

.main { margin-left: 232px; min-width: 0; }
.main-top {
  position: sticky; top: 0; z-index: 40; height: 52px; padding: 0 22px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-title { font-size: 13.5px; color: #4a453e; letter-spacing: .4px; }
.top-hint { font-size: 11.5px; color: #9a948a; }
.menu-btn { display: none; font-size: 15px; }

.logo { font-size: 15px; font-weight: 600; letter-spacing: .5px; display: flex; align-items: baseline; gap: 7px; }
.logo span { font-size: 10.5px; color: var(--gold); letter-spacing: 2px; }
.nav-mid { flex: 1; text-align: center; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel2); color: var(--muted); cursor: pointer; font-size: 13px;
  display: grid; place-items: center; transition: .15s; flex: none;
}
.icon-btn:hover { color: var(--text); border-color: #cac4b9; }

/* ---------------- 页面 ---------------- */
.page { display: none; }
.page.on { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.wrap { max-width: 940px; margin: 0 auto; padding: 26px 22px 90px; }
.wrap.wide { max-width: 1260px; }

/* ---------------- 首页 ---------------- */
.hero { padding: 18px 0 22px; }
.hero h1 { font-size: 26px; letter-spacing: .5px; font-weight: 600; line-height: 1.4; }
.hero p { margin-top: 8px; color: var(--muted); font-size: 13px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 14px;
}
.card-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-hd h2 { font-size: 14px; font-weight: 600; letter-spacing: .5px; }
.card-hd .sub { margin-left: auto; font-size: 11.5px; color: var(--dim); }
.sub { font-size: 12px; color: var(--muted); }
.hint { font-size: 11.5px; color: var(--dim); line-height: 1.6; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grow { flex: 1; }

.field { display: block; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 11px; color: var(--dim); margin-top: 6px; line-height: 1.5; }

/* 故事模板：手动改 */
[hidden] { display: none !important; }
.pack-ops { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--gold); font-size: 12px; font-family: inherit; letter-spacing: .3px;
}
.link-btn:hover { text-decoration: underline; }
.cus-box {
  margin-top: 12px; padding: 14px 14px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfaf7;
  display: grid; gap: 10px;
}
#packHint { line-height: 1.65; }
.cus-hd { font-size: 11.5px; color: var(--dim); line-height: 1.6; margin-bottom: 2px; }
.cus-foot { display: flex; align-items: center; gap: 14px; margin-top: 2px; }

/* 字段级 AI 重写 */
.field > span.lb { display: flex; align-items: center; gap: 8px; }
.ai-mini {
  margin-left: auto; flex: none;
  border: 1px solid #e7d5b0; background: #fbf3e0; color: var(--gold);
  border-radius: 5px; padding: 1px 7px; font-size: 10.5px; line-height: 1.7;
  cursor: pointer; font-family: inherit; letter-spacing: .3px; white-space: nowrap;
}
.ai-mini:hover:not(:disabled) { background: #f7ecd6; border-color: #ddc79a; }
.ai-mini:disabled { opacity: .5; cursor: not-allowed; }
.flash { animation: flashField .9s ease; }
@keyframes flashField {
  0% { border-color: var(--gold); background: #f7ecd6; }
  100% { border-color: var(--line); }
}

/* 小说改编 */
.novel-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.novel-top .hint { margin: 0; }
#novelText { min-height: 176px; }
.novel-opts { display: grid; grid-template-columns: 1.5fr .9fr .7fr; gap: 12px; margin-top: 12px; align-items: end; }
.novel-opts .seg { margin-top: 0; }
.novel-result {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7;
  padding: 12px 14px; max-height: 268px; overflow: auto;
}
.nr-h { font-size: 12px; color: var(--gold); letter-spacing: .3px; margin-bottom: 6px; }
.nr-line { font-size: 13px; color: #2b2721; line-height: 1.7; }
.nr-meta { font-size: 11.5px; color: var(--dim); margin-top: 5px; line-height: 1.7; }
.nr-list { margin: 9px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.nr-list li { display: flex; gap: 8px; font-size: 12px; color: var(--muted); line-height: 1.65; }
.nr-list b { flex: none; color: var(--gold); font-weight: 500; font-variant-numeric: tabular-nums; }
.nr-tag { flex: none; font-size: 10.5px; color: #3d6c9e; background: #eaf1fa; border-radius: 4px; padding: 0 6px; height: 17px; line-height: 17px; }
.novel-brief {
  margin-top: 12px; border: 1px dashed var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: var(--muted); line-height: 1.75;
}
.novel-brief b { color: var(--gold); font-weight: 500; }
.novel-brief .ops { margin-top: 8px; display: flex; gap: 14px; }
.novel-brief .ops button { font-size: 11.5px; }

input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 13px; font-family: inherit; outline: none;
  transition: border-color .15s, background .15s;
}
input[type=password] { letter-spacing: 1px; }
input:focus, select:focus, textarea:focus { border-color: #c9bda6; background: #ffffff; }
input::placeholder, textarea::placeholder { color: #a8a29a; }
select { cursor: pointer; appearance: none; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, #918c83 50%), linear-gradient(135deg, #918c83 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 116px; line-height: 1.75; font-size: 13.5px; }

#kickCount.warn { color: var(--warn); }
.err { color: #c4453b; font-size: 12px; margin-top: 7px; min-height: 0; }
.err:empty { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 20px; padding: 4px 12px; font-size: 12px; cursor: pointer; transition: .15s;
  font-family: inherit;
}
.chip:hover { color: var(--text); border-color: #cac4b9; }
.chip.on { background: var(--accent-soft); border-color: #f2c4be; color: #b8392f; }

.hl-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.hl-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line); border-left: 2px solid var(--gold);
  border-radius: 8px; padding: 10px 12px;
}
.hl-idx { font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; padding-top: 2px; }
.hl-body { flex: 1; min-width: 0; }
.hl-text { font-size: 13px; color: #2b2721; line-height: 1.6; word-break: break-word; }
.hl-pos { font-size: 11px; color: var(--dim); margin-top: 4px; }
.hl-ops { display: flex; gap: 4px; flex: none; }
.hl-ops button {
  width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 12px;
}
.hl-ops button:hover { color: var(--text); background: var(--panel3); }

/* 亮点 → AI 应用（写进某集） */
.hl-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.hl-meta .hl-pos { margin-top: 0; }
.hl-apply {
  font-size: 11px; line-height: 1; padding: 5px 9px; border-radius: 999px;
  border: 1px solid #e6cf9c; background: #fdf6e6; color: #8a6216;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.hl-apply:hover { background: #f8ecd2; border-color: #d9b96b; }
.hl-apply:disabled { opacity: .6; cursor: progress; }
.hl-jump {
  font-size: 11px; line-height: 1; padding: 5px 9px; border-radius: 999px;
  border: 1px solid #b9dfcc; background: #f1f9f4; color: #1e8e5e;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.hl-jump:hover { background: #e4f4ea; }
.hl-jump.stale { border-color: #f0c9c4; background: #fdf2f1; color: #b23f36; }
.hl-stale { font-size: 11px; color: #b23f36; }
.hl-tag { background: #fdf6e6; border-color: #e6cf9c; color: #8a6216; }
.hl-note {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  background: #fdf6e6; border: 1px solid #e6cf9c; border-left: 2px solid var(--gold);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 10px;
  font-size: 12px; color: #6b5525;
}
.hl-note b { color: #8a6216; font-weight: 600; }
.hl-note-t { font-weight: 600; color: #2b2721; }
.hl-note-txt { flex: 1; min-width: 220px; color: #6b5526; line-height: 1.55; }
.hl-note-src { font-size: 11px; color: #9a8b66; }
.hl-empty {
  border: 1px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center;
  color: var(--dim); font-size: 12.5px; margin-top: 12px;
}

.actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: .15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #cac4b9; background: var(--panel3); }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #dc4b41, #b52f28); border-color: #e26057;
  color: #fff; font-weight: 600; letter-spacing: .5px;
  box-shadow: 0 6px 20px rgba(190, 50, 42, .16);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #e6564c, #c2362e); }
.btn.big { padding: 12px 30px; font-size: 14px; }
.btn.mini { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn.ghost { background: transparent; }
.btn.danger { color: #b23f36; border-color: #f0c9c4; background: #fdf3f2; }

footer { margin-top: 26px; padding-top: 16px; border-top: 1px dashed var(--line); color: #9a948a; font-size: 11.5px; line-height: 1.8; }

/* ---------------- 加载态 ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 80; display: none;
  background: rgba(250, 248, 244, .82); backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
.overlay.on { display: flex; }
.loading-box { width: 380px; max-width: 90vw; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.loading-box h3 { font-size: 15px; margin-bottom: 4px; }
.loading-box .sub { margin-bottom: 18px; display: block; }
.steps { display: flex; flex-direction: column; gap: 9px; margin-bottom: 18px; }
.step-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--dim); }
.step-row .dot {
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 10px; flex: none; color: var(--dim);
}
.step-row.active { color: var(--text); }
.step-row.active .dot { border-color: var(--accent); color: #fff; background: var(--accent); animation: pulse 1.1s infinite; }
.step-row.done { color: var(--muted); }
.step-row.done .dot { background: var(--ok-soft); border-color: #a9dbc4; color: var(--ok); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.loading-bar { height: 3px; background: var(--panel3); border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.loading-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b52f28, #e26057); transition: width .3s; }

/* ---------------- 分集预览 ---------------- */
.list-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.list-head h1 { font-size: 20px; font-weight: 600; letter-spacing: .3px; }
.list-head p { color: var(--muted); font-size: 12.5px; margin-top: 5px; max-width: 720px; }

.overview { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.ov-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.ov-stat b { display: block; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ov-stat span { font-size: 11.5px; color: var(--muted); }
.ov-note { margin-top: 10px; font-size: 12px; color: var(--muted); }
.ov-note em { font-style: normal; color: var(--warn); }
.score-ring {
  width: 92px; height: 92px; border-radius: 50%; flex: none;
  border: 3px solid var(--ok); background: var(--ok-soft);
  display: grid; place-items: center; text-align: center;
}
.score-ring.mid { border-color: var(--warn); background: var(--warn-soft); }
.score-ring.low { border-color: var(--accent); background: var(--accent-soft); }
.score-ring b { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.score-ring span { font-size: 10px; color: var(--muted); display: block; margin-top: 3px; }

.list-bar { display: flex; align-items: center; gap: 8px; margin: 18px 0 14px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.count { font-size: 11.5px; color: var(--dim); margin-left: 4px; }

.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 12px; }
.ep-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 15px; cursor: pointer; transition: .16s; position: relative; overflow: hidden;
}
.ep-card:hover { border-color: #cac4b9; transform: translateY(-1px); background: #f8f7f4; }
.ep-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: #ddd8cf;
}
.ep-card.ok::before { background: var(--ok); }
.ep-card.todo::before { background: var(--warn); }
.ep-no { font-size: 11px; color: var(--dim); letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.ep-title { font-size: 14.5px; color: #1f1b16; margin: 3px 0 5px; font-weight: 500; }
.ep-brief { font-size: 12px; color: var(--muted); line-height: 1.6; height: 38px; overflow: hidden; }
.ep-foot { display: flex; align-items: center; gap: 7px; margin-top: 10px; }
.tag {
  font-size: 10.5px; padding: 1px 7px; border-radius: 20px; background: var(--panel3);
  color: var(--muted); border: 1px solid var(--line);
}
.status { margin-left: auto; font-size: 11px; padding: 1px 8px; border-radius: 20px; font-variant-numeric: tabular-nums; }
.status.ok { background: var(--ok-soft); color: #1e8e5e; }
.status.todo { background: var(--warn-soft); color: #a26a10; }

/* ---------------- 详情 ---------------- */
.detail-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-title b { font-size: 16px; font-weight: 600; }
.detail-title span { font-size: 11.5px; color: var(--muted); margin-left: 10px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 18px; align-items: start; }

.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.subtab {
  padding: 9px 14px; font-size: 12.5px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--text); }
.subtab.on { color: var(--text); border-bottom-color: var(--accent); }
.subpane { display: none; }
.subpane.on { display: block; }

.edit-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.edit-bar span { font-size: 11.5px; color: var(--dim); }

pre.script {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 24px; font-family: "PingFang SC", "Microsoft YaHei", monospace;
  font-size: 13.5px; line-height: 1.95; white-space: pre-wrap; word-break: break-word;
  color: #2b2721; min-height: 300px;
}
textarea.script-edit {
  min-height: 480px; font-family: "PingFang SC", "Microsoft YaHei", monospace;
  font-size: 13.5px; line-height: 1.95;
}
pre.code {
  background: #f7f5f0; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; font-family: Consolas, "Courier New", monospace;
  font-size: 12px; line-height: 1.7; white-space: pre-wrap; color: #2c7550;
  max-height: 560px; overflow: auto; margin-bottom: 10px;
}

.col-right {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 16px 18px; position: sticky; top: 72px;
}
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.q-head h3 { font-size: 13.5px; font-weight: 600; letter-spacing: .5px; }
.q-score { margin-left: auto; text-align: right; }
.q-score b { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.q-score span { display: block; font-size: 10.5px; margin-top: 2px; }
.q-score span.ok { color: var(--ok); }
.q-score span.todo { color: var(--warn); }

.q-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.q-item {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; cursor: pointer;
}
.q-item.risk { border-color: #5a2b26; background: #fdf2f1; }
.q-row { display: flex; align-items: center; gap: 8px; }
.q-name { font-size: 12.5px; }
.q-badge { font-size: 10px; padding: 0 7px; border-radius: 20px; }
.q-badge.ok { background: var(--ok-soft); color: #1e8e5e; }
.q-badge.todo { background: var(--warn-soft); color: #a26a10; }
.q-num { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; color: #4a453e; }
.q-num.low { color: #c4453b; }
.q-bar { height: 3px; background: #f0eeea; border-radius: 3px; margin-top: 7px; overflow: hidden; }
.q-bar i { display: block; height: 100%; border-radius: 3px; }
.q-bar i.ok { background: var(--ok); }
.q-bar i.mid { background: var(--warn); }
.q-bar i.low { background: var(--accent); }
.q-sug { font-size: 11.5px; color: #6b6a64; line-height: 1.6; margin-top: 7px; display: none; }
.q-item.open .q-sug { display: block; }

/* 分镜表 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11px;
  padding: 9px 10px; background: #f7f6f2; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid #efebe3; color: #4a453e; vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.t { color: #1f1b16; }
#shotsTable table { min-width: 900px; }
#shotsTable td:nth-child(1), #shotsTable td:nth-child(2), #shotsTable td:nth-child(3) { white-space: nowrap; }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(42, 38, 32, .34); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal.on { display: flex; }
.modal-box {
  width: 520px; max-width: 100%; max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px;
  box-shadow: 0 24px 60px rgba(60, 52, 40, .16);
  animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.98) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-box h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.modal-box .sub { display: block; margin-bottom: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 20px; }

.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px;
  cursor: pointer; transition: .15s; text-align: left; color: var(--text); font-family: inherit; font-size: 13px;
}
.opt:hover { border-color: #cac4b9; background: var(--panel3); }
.opt b { display: block; font-weight: 500; }
.opt span { display: block; font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.opt .ico { width: 30px; height: 30px; border-radius: 8px; background: var(--panel3); display: grid; place-items: center; color: var(--gold); flex: none; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted);
  padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.seg button.on { background: var(--accent-soft); border-color: #f2c4be; color: #b8392f; }

.confirm-body { font-size: 13px; color: #4a453e; line-height: 1.75; }
.confirm-body ul { margin: 8px 0 0 18px; color: var(--muted); font-size: 12.5px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: #2f2b25; border: 1px solid #4a453d; color: #f7f6f3;
  padding: 10px 20px; border-radius: 9px; font-size: 12.5px; opacity: 0;
  transition: .22s; pointer-events: none; z-index: 120; max-width: 80vw;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 设置页 / 新增组件 ---------------- */
.hero.small { padding: 6px 0 18px; }
.hero.small h1 { font-size: 21px; }

.btn.gold { background: #fbf3e0; border-color: #e2cf9f; color: #8a5c14; }
.btn.gold:hover:not(:disabled) { background: #f7ecd6; border-color: #ddc79a; }

.state-chip {
  margin-left: auto; font-size: 10.5px; padding: 2px 9px; border-radius: 20px;
  background: #f0eeea; color: #6b6a64; border: 1px solid #ddd8cf;
}
.state-chip.ok { background: var(--ok-soft); color: #1e8e5e; border-color: #b9dfcc; }
.state-chip.bad { background: #fdf2f1; color: #b23f36; border-color: #f0c9c4; }

.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; }
.row-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.test-out { font-size: 11.5px; color: var(--muted); }
.test-out.ok { color: #1e8e5e; }
.test-out.bad { color: #c4453b; }

.switch-row {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12.5px; color: #5e594f; margin-top: 14px; line-height: 1.6; cursor: pointer;
}
.switch-row input { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--accent); flex: none; }

.hint code, .sub code {
  background: #f4f1ea; border: 1px solid #e4e0d8; border-radius: 4px;
  padding: 0 4px; font-size: 11px; color: #2c7550; font-family: Consolas, monospace;
}
input[type=range] { width: 100%; height: 26px; padding: 0; accent-color: var(--accent); background: transparent; border: none; }
.num { font-size: 11.5px; color: var(--gold); font-weight: 400; }

/* 热门主线弹窗 */
.modal-box.wide { width: 780px; }
.hot-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.hot-head .sub { margin-bottom: 0; }
.hot-ops { margin-left: auto; display: flex; gap: 8px; }
.hot-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  max-height: 58vh; overflow: auto; padding-right: 2px;
}
.hot-item {
  display: flex; gap: 10px; padding: 10px 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px;
}
.hot-item:hover { border-color: #cac4b9; }
.hot-n { font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; width: 16px; flex: none; padding-top: 2px; }
.hot-body { flex: 1; min-width: 0; }
.hot-t { font-size: 12.5px; color: #2b2721; line-height: 1.6; word-break: break-word; }
.hot-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.hot-tip { font-size: 10.5px; color: #918c83; margin-top: 5px; line-height: 1.55; }
.hot-use { flex: none; align-self: flex-start; }

/* 参考视频 */
.url-add { display: flex; gap: 8px; margin-top: 10px; }
.url-add input { flex: 1; }
.ref-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ref-item {
  background: var(--panel2); border: 1px solid var(--line); border-left: 2px solid #3f6f9e;
  border-radius: 8px; padding: 10px 12px;
}
.ref-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ref-name { font-size: 12.5px; color: #3a352e; word-break: break-all; }
.ref-status { font-size: 10.5px; padding: 1px 8px; border-radius: 20px; background: #f0eeea; color: #6b6a64; }
.ref-status.ok { background: var(--ok-soft); color: #1e8e5e; }
.ref-status.bad { background: #fdf2f1; color: #b23f36; }
.ref-status.run { background: #e9eff8; color: #3d6c9e; }
.ref-ops { margin-left: auto; display: flex; gap: 4px; }
.ref-ops button {
  width: 24px; height: 24px; border-radius: 5px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 12px;
}
.ref-ops button:hover { color: var(--text); background: var(--panel3); }
.ref-bridges { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ref-b { display: flex; gap: 8px; font-size: 12px; color: #5e594f; line-height: 1.6; }
.ref-b .slot {
  flex: none; height: 18px; font-size: 10.5px; color: var(--gold);
  background: var(--gold-soft); border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}
.ref-paste { margin-top: 9px; display: flex; flex-direction: column; gap: 7px; }
.ref-paste textarea { min-height: 84px; font-size: 12.5px; }
.ref-paste .row { display: flex; gap: 8px; align-items: center; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .side { transform: translateX(-100%); box-shadow: 0 0 44px rgba(60, 52, 40, .18); }
  .side.open { transform: none; }
  .side-mask.on { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .main-top { padding: 0 14px; }
  .hot-list { grid-template-columns: 1fr; max-height: 52vh; }
  .modal-box.wide { width: 100%; }
}
@media (max-width: 960px) {
  .detail-grid { grid-template-columns: 1fr; }
  .col-right { position: static; }
}
@media (max-width: 768px) {
  body { font-size: 13.5px; }
  .wrap { padding: 18px 14px 80px; }
  .hero h1 { font-size: 21px; }
  .grid3, .grid2 { grid-template-columns: 1fr; }
  .actions { flex-direction: column; align-items: stretch; }
  .btn.big { width: 100%; }
  .ep-grid { grid-template-columns: 1fr; }
  .overview { gap: 14px; }
  .ov-stats { gap: 16px; }
  .score-ring { width: 76px; height: 76px; }
  .list-bar { gap: 6px; }
  .btn { padding: 9px 14px; }
  .modal-box { padding: 18px; }
  .hl-ops button { width: 30px; height: 30px; }
  .url-add { flex-direction: column; }
  .url-add .btn { width: 100%; }
  .top-hint { display: none; }
  .card-hd { flex-wrap: wrap; }
  .novel-opts { grid-template-columns: 1fr; }
  .novel-result { max-height: 40vh; }
}

/* 旧缓存提示条：页面与脚本版本不一致时出现 */
.stale-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #fff6e2; color: #6b4a12; border-bottom: 1px solid #efd79f;
  padding: 10px 18px; font-size: 13px; line-height: 1.6; text-align: center;
}
.stale-bar b { color: var(--gold); }

/* ===== 本地资料（给 AI 参考的素材库） ===== */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed #d9d4cb; border-radius: 10px; padding: 18px 14px; cursor: pointer;
  background: #f7f6f2; color: var(--muted); text-align: center; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--gold); background: #fdf6e6; }
.drop b { color: var(--text); font-size: 13px; font-weight: 600; }
.drop span { font-size: 11.5px; color: var(--dim); line-height: 1.6; }

.lib-paste { display: grid; grid-template-columns: 1fr 220px; gap: 8px; margin-top: 10px; align-items: start; }
.lib-paste input { grid-column: 1 / -1; }
.lib-paste textarea { min-height: 74px; font-size: 12.5px; }
.lib-paste .btn { grid-column: 2; width: 100%; justify-content: center; }
@media (max-width: 700px) { .lib-paste { grid-template-columns: 1fr; } .lib-paste .btn { grid-column: auto; } }

.lib-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.lib-item {
  border: 1px solid var(--line); background: var(--panel2); border-radius: 9px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 5px;
}
.lib-item.off { opacity: .55; }
.lib-hd { display: flex; align-items: center; gap: 8px; }
.lib-hd b { font-size: 13px; font-weight: 600; color: var(--text); }
.lib-hd .sub { margin-left: auto; font-size: 11px; color: var(--dim); white-space: nowrap; }
.lib-ex {
  font-size: 11.5px; color: var(--dim); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-ops { display: flex; align-items: center; gap: 14px; }
.lib-ops label { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.lib-ops input { width: 14px; height: 14px; accent-color: var(--accent); }
.lib-empty { font-size: 12px; color: var(--dim); padding: 10px 2px; }
.lib-peek {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8f6f1;
  padding: 12px 14px; font-size: 12px; line-height: 1.8; color: #5e594f; white-space: pre-wrap; max-height: 260px; overflow: auto;
}
.lib-peek b { color: var(--gold); }

/* 梗概字数提示条：不足 / 够用 / 超长 三态 */
.kick-meter { margin-top: 8px; font-size: 11.5px; color: var(--dim); line-height: 1.65; }
.kick-meter.low { color: var(--warn); }
.kick-meter.ok { color: var(--ok); }
.kick-meter.over { color: #c4453b; }

/* 梗概底部：示例一行 + 热门主线靠右 */
.kick-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kick-foot .chips { margin-top: 12px; flex: 1; }
.kick-foot .btn { margin-top: 12px; }
#kick { min-height: 190px; }

/* ---------------- 我的剧本（本地存档） ---------------- */
.saved-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 54vh; overflow: auto; margin: 10px 0 4px;
  padding-right: 2px;
}
.saved-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel2);
  transition: border-color .15s, background .15s;
}
.saved-item:hover { border-color: #d6d0c4; background: var(--panel); }
.si-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.si-main b {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.si-meta { font-size: 11px; color: var(--dim); letter-spacing: .2px; }
.si-ops { display: flex; gap: 6px; flex: 0 0 auto; }
.si-ops button {
  font-size: 12px; padding: 5px 11px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel3);
  color: var(--text); cursor: pointer; font-family: inherit;
  transition: border-color .15s, color .15s;
}
.si-ops button:hover { border-color: var(--accent); color: var(--accent); }
.si-ops .si-del:hover { border-color: #b8483f; color: #b8483f; }
.saved-empty {
  padding: 26px 14px; text-align: center;
  font-size: 12px; color: var(--muted); line-height: 1.9;
}

/* 顶栏「我的剧本」：窗口变窄、侧栏收起时补一个入口 */
.top-saved { display: none; }
@media (max-width: 900px) {
  .top-saved { display: inline-flex; }
}

/* ================= 小说稿（V1.8） ================= */
.seg { display: flex; gap: 6px; margin-top: 9px; }
.seg-btn {
  flex: 1; padding: 8px 10px; font-size: 12.5px; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; color: var(--muted); cursor: pointer;
  font-family: inherit; transition: .15s;
}
.seg-btn:hover { border-color: #cac4b9; color: var(--text); }
.seg-btn.on { background: var(--accent-soft); border-color: #f2c4be; color: #b8392f; font-weight: 600; }

.opt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.opt-chips .chip em { font-style: normal; color: var(--dim); font-size: 10.5px; margin-left: 4px; }

.nv-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.nv-head h1 { font-size: 21px; letter-spacing: .5px; }
.nv-meta { font-size: 12px; color: var(--dim); margin-top: 7px; }
.nv-ops { display: flex; gap: 8px; flex-wrap: wrap; }

.nv-body { display: grid; grid-template-columns: 248px 1fr; gap: 18px; align-items: start; }
.nv-toc {
  position: sticky; top: 16px; max-height: calc(100vh - 130px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
}
.nv-toc-hd { font-size: 10.5px; color: var(--dim); letter-spacing: 1.4px; padding: 6px 8px 8px; }
.nv-toc-vol { font-size: 10.5px; color: var(--gold); letter-spacing: .8px; padding: 10px 8px 4px; }
.nv-toc-item {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border-radius: 7px;
  font-size: 12.5px; color: var(--muted); background: none; border: 0; cursor: pointer;
  line-height: 1.45; font-family: inherit;
}
.nv-toc-item:hover { background: var(--panel2); color: var(--text); }
.nv-toc-item.on { background: var(--accent-soft); color: #b8392f; }
.nv-toc-item b { font-weight: 500; color: var(--dim); margin-right: 6px; font-size: 11px; }

.nv-read {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 34px 44px 24px; min-height: 62vh;
}
.nv-read h2 { font-size: 18px; margin-bottom: 18px; letter-spacing: .5px; }
.nv-read #nvChText {
  font-family: "Songti SC", "Source Han Serif SC", "SimSun", serif;
  font-size: 15.5px; line-height: 2.05; color: #2b2620;
}
.nv-read #nvChText p { margin: 0 0 3px; }
.nv-chfoot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 26px; padding-top: 16px; border-top: 1px dashed var(--line);
}
@media (max-width: 900px) {
  .nv-body { grid-template-columns: 1fr; }
  .nv-toc { position: static; max-height: 220px; }
  .nv-read { padding: 22px 18px; }
}
