/* 短剧雷达 —— 深色高级感（Linear/Vercel 风格） */
:root {
  --bg: #0a0e14;
  --bg2: #0d1117;
  --card: #141a23;
  --card-hover: #1a2230;
  --border: #1e2633;
  --border2: #2a3444;
  --text: #e6ebf2;
  --text2: #8b98ab;
  --text3: #5a6678;
  --accent: #4f8cff;
  --accent2: #22d3a7;
  --hot: #ff6b5e;
  --warn: #ffb020;
  --radius: 14px;
  --sidebar-w: 220px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "微软雅黑", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
::selection { background: rgba(79, 140, 255, .3); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
#app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding: 28px 32px 90px; max-width: 1280px; margin: 0 auto; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; border-right: 1px solid var(--border);
  background: var(--bg2); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 28px 20px 24px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; font-size: 20px; line-height: 38px; text-align: center;
  background: linear-gradient(135deg, #4f8cff 0%, #22d3a7 100%); color: #fff; margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(79, 140, 255, .35);
}
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.side-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px;
  color: var(--text2); font-size: 14px; font-weight: 500; transition: all .15s;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: rgba(79, 140, 255, .12); color: var(--accent); }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.side-footer { margin-top: auto; padding: 20px; }
.db-badge {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text3);
  padding: 8px 12px; background: var(--card); border-radius: 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 8px var(--accent2); }

/* ---------- 通用组件 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: .5px; }
.page-desc { font-size: 13px; color: var(--text2); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6b9fff; box-shadow: 0 4px 14px rgba(79, 140, 255, .35); }
.btn-ghost { background: var(--card); color: var(--text2); border: 1px solid var(--border2); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* 统计行 */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--text3); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; color: var(--text3); font-weight: 400; margin-left: 3px; }

/* 筛选工具条 */
.toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 15px; border-radius: 99px; font-size: 13px; color: var(--text2);
  background: var(--card); border: 1px solid var(--border); transition: all .15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: rgba(79, 140, 255, .15); border-color: var(--accent); color: var(--accent); }
.search-box { flex: 1; min-width: 180px; position: relative; }
.search-box input {
  width: 100%; padding: 9px 14px 9px 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 14px; outline: none; transition: border .15s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box::before { content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 16px; }

/* ---------- 剧目列表 ---------- */
.drama-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.drama-card { display: flex; gap: 14px; padding: 14px; transition: all .15s; cursor: pointer; }
.drama-card:hover { background: var(--card-hover); border-color: var(--border2); transform: translateY(-2px); }
.cover {
  width: 78px; height: 104px; border-radius: 8px; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg, #1a2230, #141a23); position: relative;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover[onclick] { cursor: pointer; }
.play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 14, 20, .45); opacity: 0; transition: opacity .15s;
}
.cover:hover .play-overlay, .modal-cover:hover .play-overlay { opacity: 1; }
.play-btn {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(79, 140, 255, .92);
  color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(79, 140, 255, .5); padding-left: 3px;
}
.modal-cover { position: relative; cursor: default; }
.modal-cover[onclick] { cursor: pointer; }
.rank-badge {
  position: absolute; top: 0; left: 0; background: rgba(10, 14, 20, .8); backdrop-filter: blur(4px);
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 0 0 8px 0; color: var(--warn);
}
.drama-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drama-title {
  font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.drama-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-flag { color: var(--hot); font-size: 12px; flex-shrink: 0; }
.drama-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--bg2); color: var(--text2); border: 1px solid var(--border); }
.tag.platform { color: var(--accent2); border-color: rgba(34, 211, 167, .25); }
.drama-desc {
  font-size: 12px; color: var(--text3); margin-top: 7px; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5;
}
.drama-foot { margin-top: auto; padding-top: 9px; display: flex; align-items: center; justify-content: space-between; }
.heat-num { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 4px; }
.heat-num b { color: var(--text); font-size: 14px; }
.heat-num .up { color: var(--accent2); font-size: 11px; }

/* 空状态 */
.empty { text-align: center; padding: 80px 20px; color: var(--text3); }
.empty .icon { font-size: 44px; margin-bottom: 16px; opacity: .5; }
.empty h3 { font-size: 17px; color: var(--text2); font-weight: 600; margin-bottom: 8px; }
.empty p { font-size: 13px; }
.empty .btn { margin-top: 18px; }

/* ---------- 采集进行中 ---------- */
.collecting-overlay {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .82); backdrop-filter: blur(6px);
  z-index: 300; display: flex; align-items: center; justify-content: center;
}
.collecting-box { text-align: center; max-width: 400px; padding: 20px; }
.radar-scan {
  width: 110px; height: 110px; margin: 0 auto 24px; border-radius: 50%; position: relative;
  border: 1px solid var(--border2); background: radial-gradient(circle, rgba(79,140,255,.06), transparent 70%);
}
.radar-scan::before, .radar-scan::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--border);
}
.radar-scan::after { inset: 22px; }
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(79,140,255,.5), transparent 70deg, transparent);
  animation: sweep 1.6s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.collect-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.collect-status { font-size: 14px; color: var(--text2); min-height: 24px; }
.dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- AI 拆解实时过程 ---------- */
.analyze-overlay {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .86); backdrop-filter: blur(6px);
  z-index: 320; display: flex; align-items: center; justify-content: center; padding: 18px;
}
.analyze-box {
  width: min(780px, 100%); max-height: min(92vh, 800px); background: var(--bg2);
  border: 1px solid var(--border2); border-radius: 18px; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.analyze-head {
  padding: 16px 20px 13px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.analyze-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.pulse-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent2);
  box-shadow: 0 0 0 0 rgba(34, 211, 167, .55); animation: pulse 1.4s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(34, 211, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 167, 0); }
}
.analyze-sub { flex: 1; min-width: 0; font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analyze-box .modal-close { position: static; flex-shrink: 0; }
.analyze-meta {
  display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap; flex-shrink: 0;
}
.analyze-meta #azModel { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.az-stat { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }
.az-stat b { color: var(--text2); font-weight: 600; }
.az-stages { display: flex; gap: 4px; align-items: center; padding: 12px 20px 0; flex-wrap: wrap; flex-shrink: 0; }
.az-stage {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text3);
  padding: 4px 11px; border-radius: 99px; border: 1px solid var(--border); background: var(--card);
}
.az-stage .si { width: 12px; height: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.az-stage.done { color: var(--accent2); border-color: rgba(34, 211, 167, .3); }
.az-stage.running { color: var(--accent); border-color: rgba(79, 140, 255, .45); }
.az-stage.running .si::before {
  content: ""; width: 9px; height: 9px; border: 2px solid rgba(79, 140, 255, .25);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
.az-stage-sep { color: var(--text3); font-size: 11px; opacity: .6; }
.az-tabs { display: flex; gap: 4px; padding: 12px 20px 0; flex-shrink: 0; }
.az-tab { padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--text3); border-bottom: 2px solid transparent; transition: color .15s; }
.az-tab:hover { color: var(--text2); }
.az-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.az-panel-wrap { flex: 1; min-height: 0; display: flex; padding: 12px 20px; }
.az-panel {
  display: none; flex: 1; min-height: 180px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; overflow-y: auto;
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.7;
  color: var(--text2); white-space: pre-wrap; word-break: break-all;
}
.az-panel.active { display: block; }
.az-panel.streaming::after { content: "▌"; color: var(--accent); animation: azBlink 1s steps(2) infinite; }
@keyframes azBlink { 50% { opacity: 0; } }
.az-hint { color: var(--text3); font-style: italic; }
.az-keys { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 16px; flex-shrink: 0; }
.az-key { font-size: 11px; padding: 3px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--border); color: var(--text3); transition: all .2s; }
.az-key.done { color: var(--accent2); border-color: rgba(34, 211, 167, .3); }
.az-key.writing { color: var(--accent); border-color: rgba(79, 140, 255, .5); animation: azPulse 1.2s infinite; }
@keyframes azPulse { 50% { opacity: .5; } }
.az-error { padding: 26px 24px; color: var(--hot); font-size: 14px; line-height: 1.8; white-space: pre-wrap; }

/* ---------- 详情弹层 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 200; display: none; }
.modal-root.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(6, 9, 14, .75); backdrop-filter: blur(4px); }
.modal {
  position: absolute; top: 3vh; left: 50%; transform: translateX(-50%);
  width: min(880px, 94vw); max-height: 94vh; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: 18px; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; gap: 16px;
  align-items: flex-start; position: relative; flex-shrink: 0;
}
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 8px;
  color: var(--text3); font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--card); color: var(--text); }
.modal-cover { width: 84px; height: 112px; border-radius: 10px; overflow: hidden; flex-shrink: 0; background: var(--card); }
.modal-cover img { width: 100%; height: 100%; object-fit: cover; }
.modal-title { font-size: 20px; font-weight: 700; padding-right: 40px; }
.modal-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.modal-body { overflow-y: auto; padding: 0 24px 24px; flex: 1 1 auto; min-height: 0; }

/* 详情内 Tab */
.detail-tabs { display: flex; gap: 4px; padding: 14px 24px 0; flex-wrap: wrap; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.dtab { padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text3); border-bottom: 2px solid transparent; transition: all .15s; }
.dtab:hover { color: var(--text2); }
.dtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.dtab-panel { display: none; padding-top: 20px; }
.dtab-panel.active { display: block; }

.sect-title { font-size: 15px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.sect-title::before { content: ""; width: 3px; height: 15px; border-radius: 2px; background: var(--accent); }
.text-block { font-size: 14px; color: var(--text2); line-height: 1.8; white-space: pre-wrap; }

/* 人物卡 */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.char-card { padding: 16px; }
.char-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.char-role { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: rgba(79, 140, 255, .14); color: var(--accent); }
.char-row { font-size: 13px; color: var(--text2); margin-top: 8px; }
.char-row b { color: var(--text); font-weight: 600; margin-right: 6px; }

/* 分镜表 */
.storyboard-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.storyboard-table th {
  text-align: left; padding: 10px 12px; color: var(--text3); font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--border2); position: sticky; top: 0; background: var(--bg2); z-index: 2;
}
.storyboard-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text2); }
.storyboard-table td.ep { color: var(--accent); font-weight: 700; white-space: nowrap; }
.storyboard-table td .dlg { color: var(--text); }
.storyboard-table td .sfx { color: var(--text3); font-size: 12px; }
.ep-divider td { background: var(--bg); color: var(--accent2); font-weight: 700; font-size: 13px; padding: 8px 12px; }

/* 元素标签云 */
.element-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.element-pill {
  padding: 8px 16px; border-radius: 99px; font-size: 13px; background: var(--card);
  border: 1px solid var(--border); color: var(--text2); display: flex; align-items: center; gap: 8px;
}
.element-pill b { color: var(--accent2); font-size: 12px; }
.element-pill.hi { border-color: rgba(255, 107, 94, .4); color: var(--hot); }

/* 复刻提示词 */
.prompt-box { position: relative; }
.prompt-content {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px;
  font-size: 13px; line-height: 1.8; color: var(--text2); white-space: pre-wrap; max-height: 520px; overflow-y: auto;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
.prompt-actions { display: flex; gap: 10px; margin-top: 14px; }

/* 预算 */
.budget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
.budget-item { padding: 14px 16px; }
.budget-item .l { font-size: 12px; color: var(--text3); }
.budget-item .v { font-size: 16px; font-weight: 700; margin-top: 4px; }
.budget-range { font-size: 22px; font-weight: 700; color: var(--accent2); margin: 6px 0; }
.budget-range.ai-budget { color: var(--accent); }

/* ---------- 创作页 ---------- */
.gen-layout { display: flex; gap: 20px; align-items: stretch; height: calc(100vh - 130px); min-height: 480px; }
.gen-chat-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.gen-chat-box {
  flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px;
  scroll-behavior: smooth;
}

/* 欢迎屏 */
.gen-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; text-align: center; gap: 10px; padding: 20px; }
.gen-welcome-icon {
  width: 56px; height: 56px; border-radius: 16px; font-size: 28px; line-height: 56px; text-align: center;
  background: linear-gradient(135deg, rgba(79,140,255,.18), rgba(34,211,167,.18)); border: 1px solid var(--border2);
  margin-bottom: 8px;
}
.gen-welcome-title { font-size: 20px; font-weight: 700; }
.gen-welcome-desc { font-size: 14px; color: var(--text3); max-width: 380px; }
.gen-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; max-width: 460px; }
.gen-suggestion {
  padding: 8px 16px; border-radius: 99px; font-size: 13px; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border); transition: all .15s;
}
.gen-suggestion:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,140,255,.08); }
.gen-hint { margin-top: 20px; font-size: 12px; color: var(--text3); background: var(--bg2); padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); max-width: 420px; }

/* 消息气泡 */
.gen-msg { max-width: 85%; padding: 12px 16px; border-radius: 14px; font-size: 14px; line-height: 1.7; word-break: break-word; }
.gen-msg.user { align-self: flex-end; background: rgba(79, 140, 255, .15); border: 1px solid rgba(79, 140, 255, .25); color: var(--text); }
.gen-msg.agent { align-self: flex-start; background: var(--bg2); border: 1px solid var(--border); color: var(--text2); }
.gen-msg.agent b { color: var(--text); }
.gen-msg.agent code { background: var(--card); padding: 2px 6px; border-radius: 4px; font-size: 13px; color: var(--accent2); font-family: Consolas, monospace; }
.gen-msg-error { border-color: rgba(255, 107, 94, .35) !important; color: var(--hot) !important; }

/* typing indicator */
.gen-typing { display: flex; align-items: center; gap: 8px; color: var(--text2); }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-6px); opacity: 1; } }

/* 脚本预览消息 */
.gen-msg-script { max-width: 100%; }
.gen-script-badge { font-size: 13px; font-weight: 600; color: var(--accent2); margin-bottom: 6px; }
.gen-script-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.gen-script-preview { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.gen-preview-row { display: flex; gap: 10px; padding: 5px 0; align-items: flex-start; }
.gen-preview-row .gen-label { width: 42px; flex-shrink: 0; font-size: 12px; color: var(--text3); padding-top: 2px; }
.gen-preview-row .gen-val { flex: 1; font-size: 13px; color: var(--text2); display: flex; flex-wrap: wrap; gap: 4px; }
.gen-preview-plot { font-size: 13px; color: var(--text3); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); line-height: 1.6; }
.gen-preview-plot ~ .gen-actions, .gen-script-preview ~ .gen-actions { margin-top: 0; }

.char-mini { display: inline-flex; gap: 5px; padding: 4px 10px; background: var(--card); border-radius: 6px; font-size: 12px; border: 1px solid var(--border); }
.char-mini .name { color: var(--accent); font-weight: 600; }

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

/* 输入栏 */
.gen-input-row { display: flex; gap: 10px; }
.gen-input-row textarea {
  flex: 1; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 14px; outline: none; resize: none;
  min-height: 44px; max-height: 120px; transition: border .15s;
}
.gen-input-row textarea:focus { border-color: var(--accent); }
.gen-input-row .btn { align-self: flex-end; height: 44px; }

/* 右侧项目列表 */
.gen-sidebar { width: 220px; flex-shrink: 0; }
.gen-sidebar-card { padding: 14px; height: 100%; display: flex; flex-direction: column; }
.gen-sidebar-head { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.gen-count { font-size: 11px; color: var(--text3); background: var(--bg); padding: 1px 8px; border-radius: 99px; }
.gen-proj-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
.gen-proj-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: all .15s; border: 1px solid transparent; }
.gen-proj-item:hover { background: var(--card-hover); }
.gen-proj-item.active { background: rgba(79, 140, 255, .12); border-color: rgba(79, 140, 255, .3); }
.gen-proj-item .gp-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-proj-item .gp-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.gen-proj-empty { text-align: center; padding: 30px 10px; color: var(--text3); font-size: 13px; }
.gen-proj-empty small { display: block; margin-top: 4px; font-size: 11px; }

/* ---------- 洞察页 ---------- */
.insight-layout { display: flex; gap: 20px; align-items: flex-start; }
.insight-side { width: 168px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 28px; }
.insight-item {
  padding: 11px 16px; border-radius: 10px; font-size: 14px; color: var(--text2); text-align: left;
  border: 1px solid transparent; transition: all .15s;
}
.insight-item:hover { background: var(--card); color: var(--text); }
.insight-item.active { background: var(--card); border-color: var(--border2); color: var(--accent); font-weight: 600; }
.insight-item small { display: block; font-size: 11px; color: var(--text3); margin-top: 1px; }
.bars { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 14px; }
.bar-label { width: 220px; flex-shrink: 0; font-size: 14px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.bar-track { flex: 1; height: 30px; background: var(--card); border-radius: 7px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 7px; display: flex; align-items: center; padding: 0 12px;
  font-size: 12px; color: #fff; font-weight: 600; min-width: 36px;
  background: linear-gradient(90deg, #3a6fd8, #4f8cff);
  transition: width .5s ease;
}
.bar-fill.top1 { background: linear-gradient(90deg, #d8564a, #ff6b5e); }
.bar-fill.top2 { background: linear-gradient(90deg, #d8823a, #ffb020); }
.bar-fill.top3 { background: linear-gradient(90deg, #2ba98a, #22d3a7); }

/* ---------- 设置页 ---------- */
.settings-wrap { max-width: 640px; }
.settings-section { padding: 24px; margin-bottom: 18px; }
.settings-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.settings-section .hint { font-size: 13px; color: var(--text3); margin-bottom: 16px; line-height: 1.7; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 7px; }
.field input[type="text"], .field input[type="password"], .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px; outline: none; transition: border .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 88px; }
.field .status { font-size: 12px; margin-top: 6px; }
.field .status.ok { color: var(--accent2); }
.field .status.err { color: var(--hot); }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch-row .l { font-size: 14px; }
.switch-row .d { font-size: 12px; color: var(--text3); margin-top: 2px; }
.switch { width: 42px; height: 24px; border-radius: 99px; background: var(--border2); position: relative; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }

.lan-info { display: flex; flex-direction: column; gap: 8px; }
.lan-item {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: 13px;
}
.lan-item code { font-family: Consolas, monospace; color: var(--accent2); }
.lan-item .btn { margin-left: 12px; }

/* 手动添加剧目 */
.add-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.add-form .span2 { grid-column: span 2; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  padding: 11px 22px; border-radius: 10px; font-size: 14px; font-weight: 500;
  background: var(--card-hover); border: 1px solid var(--border2); color: var(--text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4); animation: toastIn .25s ease;
  display: flex; align-items: center; gap: 9px; max-width: 86vw;
}
.toast.ok { border-color: rgba(34, 211, 167, .4); }
.toast.ok::before { content: "✓"; color: var(--accent2); font-weight: 700; }
.toast.err { border-color: rgba(255, 107, 94, .4); }
.toast.err::before { content: "✕"; color: var(--hot); font-weight: 700; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- 加载 ---------- */
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 120px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-full { padding: 40px; text-align: center; color: var(--text3); }
.skeleton { position: relative; overflow: hidden; background: var(--card) !important; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .04), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- 移动端 ---------- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 18px 16px 110px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(13, 17, 23, .92); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .tab-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text3); padding: 4px 16px; }
  .tab-item.active { color: var(--accent); }
  .tab-icon { font-size: 19px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 22px; }
  .drama-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 8px; }
  .search-box { min-width: 100%; order: -1; }
  .modal { top: 0; width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
  @supports (height: 100dvh) { .modal { height: 100dvh; max-height: 100dvh; } }
  .modal-head { padding: 16px; }
  .modal-cover { width: 66px; height: 88px; }
  .modal-title { font-size: 17px; padding-right: 36px; }
  .modal-body { padding: 0 16px 16px; }
  .detail-tabs { padding: 10px 16px 0; overflow-x: auto; flex-wrap: nowrap; }
  .dtab { flex-shrink: 0; }
  .insight-layout { flex-direction: column; }
  .insight-side { width: 100%; flex-direction: row; overflow-x: auto; position: static; padding-bottom: 4px; }
  .insight-item { flex-shrink: 0; font-size: 13px; padding: 8px 14px; }
  .insight-item small { display: none; }
  .bar-label { width: 34vw; font-size: 13px; }
  .add-form { grid-template-columns: 1fr; }
  .add-form .span2 { grid-column: span 1; }
  .storyboard-wrap { overflow-x: auto; }
  .storyboard-table { min-width: 640px; }
  .prompt-actions { flex-wrap: wrap; }
  .gen-layout { flex-direction: column; height: auto; min-height: auto; }
  .gen-chat-box { min-height: 300px; max-height: 50vh; }
  .gen-sidebar { width: 100%; }
  .gen-sidebar-card { max-height: 200px; }
  .gen-proj-list { flex-direction: row; overflow-x: auto; }
  .gen-proj-item { flex-shrink: 0; min-width: 140px; }
  .gen-msg { max-width: 95%; }
  .gen-welcome-icon { width: 48px; height: 48px; font-size: 24px; line-height: 48px; }
  .gen-welcome-title { font-size: 18px; }
  .gen-suggestion { font-size: 12px; padding: 7px 14px; }
  .analyze-overlay { padding: 0; align-items: stretch; }
  .analyze-box { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; border: none; }
  @supports (height: 100dvh) { .analyze-box { height: 100dvh; max-height: 100dvh; } }
  .analyze-head, .analyze-meta, .az-stages, .az-tabs, .az-panel-wrap, .az-keys { padding-left: 16px; padding-right: 16px; }
  .az-stages { flex-wrap: nowrap; overflow-x: auto; }
  .az-stage { flex-shrink: 0; }
  .az-stage-sep { display: none; }
  .analyze-meta #azModel { max-width: 100%; }
}

/* ---------- 元素融合生成器 ---------- */
.fuse-card { margin-top: 20px; padding: 20px 22px; }
.fuse-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.fuse-title { font-size: 16px; font-weight: 700; }
.fuse-desc { font-size: 13px; color: var(--text3); margin-top: 4px; max-width: 560px; line-height: 1.6; }
.fuse-style {
  flex-shrink: 0; background: var(--card); color: var(--text); border: 1px solid var(--border2);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; outline: none; cursor: pointer;
}
.fuse-style:focus { border-color: var(--accent); }
.fuse-groups { display: flex; flex-direction: column; gap: 12px; }
.fuse-group { display: flex; gap: 12px; align-items: flex-start; }
.fuse-glabel { width: 46px; flex-shrink: 0; font-size: 12px; color: var(--text3); padding-top: 7px; font-weight: 600; }
.fuse-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fuse-chip {
  padding: 6px 14px; border-radius: 99px; font-size: 12.5px; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border); transition: all .15s; cursor: pointer;
}
.fuse-chip:hover { color: var(--text); border-color: var(--border2); }
.fuse-chip.on { background: rgba(79, 140, 255, .15); border-color: var(--accent); color: var(--accent); }
.fuse-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.fuse-selcount { font-size: 12px; color: var(--text3); }
.fuse-results { margin-top: 6px; }
.fuse-loading { padding: 32px 20px; text-align: center; color: var(--text2); font-size: 14px; }
.fuse-empty { padding: 20px 4px 4px; font-size: 13px; color: var(--text3); }
.fuse-scheme {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-top: 14px;
  background: var(--bg2); transition: border .15s;
}
.fuse-scheme:hover { border-color: var(--border2); }
.fs-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fs-num { font-size: 11px; font-weight: 700; color: var(--accent); background: rgba(79, 140, 255, .12); border-radius: 6px; padding: 2px 8px; letter-spacing: 1px; }
.fs-title { font-size: 15px; font-weight: 700; }
.fs-logline { margin-top: 8px; font-size: 13px; color: var(--accent2); }
.fs-outline { margin-top: 8px; font-size: 13px; color: var(--text2); line-height: 1.8; }
.fs-hook {
  margin-top: 10px; font-size: 13px; color: var(--warn); line-height: 1.7;
  background: rgba(255, 176, 32, .06); border-left: 2px solid var(--warn);
  padding: 8px 12px; border-radius: 0 8px 8px 0;
}
.fs-hook b { font-weight: 700; }
.fs-highlights { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fs-hl { font-size: 11px; color: var(--text2); border: 1px solid var(--border2); border-radius: 20px; padding: 2px 10px; }
.fs-used { font-size: 11.5px; color: var(--text3); margin-top: 10px; line-height: 1.6; }
.fs-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .fuse-card { padding: 16px; }
  .fuse-head { flex-direction: column; gap: 10px; }
  .fuse-style { align-self: flex-start; }
  .fuse-group { flex-direction: column; gap: 6px; }
  .fuse-glabel { width: auto; padding-top: 0; }
  .fs-actions .btn { flex: 1; }
}

/* ---------- 专业版 / 支付 ---------- */
.pro-card { padding: 16px; }
.pro-card-title { font-size: 15px; font-weight: 700; }
.pro-card-desc { font-size: 12px; color: var(--text3); margin-top: 6px; line-height: 1.6; }
.pro-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.pro-list li { font-size: 12.5px; color: var(--text2); }
.pro-list b { color: var(--accent2); font-weight: 700; }
.pro-btn { width: 100%; }
.pro-badge-card { padding: 14px 16px; }
.pro-badge { font-size: 14px; font-weight: 700; color: var(--accent2); }
.pro-expires { font-size: 12px; color: var(--text3); margin-top: 4px; }
.pro-feat { font-size: 12px; color: var(--text2); margin-top: 8px; line-height: 1.6; }

.pay-modal { width: min(520px, 92vw); }
.pay-head { margin-bottom: 4px; }
.pay-sub { font-size: 12.5px; color: var(--text3); margin-top: 4px; line-height: 1.6; }
.pay-plans { display: flex; gap: 14px; margin-top: 16px; }
.pay-plan {
  flex: 1; position: relative; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--bg2); padding: 20px 18px 16px; cursor: pointer; transition: all .15s;
}
.pay-plan:hover { border-color: var(--border2); }
.pay-plan.selected { border-color: var(--accent); background: rgba(79, 140, 255, .06); box-shadow: 0 0 0 3px rgba(79, 140, 255, .08); }
.pp-tag {
  position: absolute; top: -9px; right: 14px; font-size: 10.5px; font-weight: 700;
  color: #fff; background: var(--hot); border-radius: 99px; padding: 2px 9px;
}
.pp-name { font-size: 14px; font-weight: 600; color: var(--text2); }
.pp-price { font-size: 26px; font-weight: 700; margin-top: 6px; font-family: inherit; }
.pp-price span { font-size: 12px; font-weight: 400; color: var(--text3); margin-left: 2px; }
.pp-feats { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.pp-feats div { font-size: 12px; color: var(--text2); }
.pay-btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.pay-status { margin-top: 12px; }
.pay-waiting { display: block; text-align: center; font-size: 13px; color: var(--warn); line-height: 1.8; }
.pay-err { display: block; text-align: center; font-size: 13px; color: var(--hot); }
.pay-note { text-align: center; font-size: 11.5px; color: var(--text3); margin-top: 12px; }

@media (max-width: 720px) {
  .pay-plans { gap: 10px; }
  .pay-plan { padding: 16px 14px 14px; }
  .pp-price { font-size: 22px; }
}

/* ---------- 信息流广告位 ---------- */
.ad-card {
  position: relative; overflow: hidden; min-height: 220px; background: var(--card);
}
.ad-frame { width: 100%; height: 100%; min-height: 220px; border: none; display: block; }
.ad-mark {
  position: absolute; top: 8px; right: 8px; font-size: 10px; color: var(--text3);
  border: 1px solid var(--border2); border-radius: 4px; padding: 1px 6px; background: var(--bg);
}
