/* static/css/storytap.css — Storytap 漫咔：AI 漫剧创作 Agent（独立于无限画布的对话式创作流程） */
#view-storytap { display: none; height: 100%; min-height: 0; }
/* 宽度与工作台一致：跟随 --content-max（1320px）居中显示 */
#view-storytap.active { display: flex; flex-direction: column; width: 100%; max-width: var(--content-max, 1320px); margin: 0 auto; flex: 1; min-height: 0; animation: fadeIn .35s ease both; }
.stp-app { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: relative; }

/* ── 顶栏 ── */
.stp-topbar { display: flex; align-items: center; gap: 18px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel, rgba(255,255,255,0.02)); flex-shrink: 0; position: relative; z-index: 60; }
.stp-brand { display: flex; align-items: center; gap: 10px; }
.stp-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff; background: linear-gradient(135deg, #4ade80, #22d3ee); box-shadow: 0 6px 18px rgba(74,222,128,0.35); }
.stp-brand-name { font-size: 15px; font-weight: 800; color: var(--text); line-height: 1.2; }
.stp-brand-name em { font-style: normal; color: #4ade80; }
.stp-brand-sub { font-size: 10.5px; color: var(--text-muted); }
/* 顶栏：第一行步骤条，分隔线，第二行左=剧名/集数 右=打开漫咔 Agent */
.stp-topbar-col { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 16px 12px; }
.stp-topbar-col .stp-steps { margin: 0 auto; }
.stp-top-row2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
.stp-top-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* 顶栏剧名/集数：UI 组件（cr-custom-select） */
.stp-top-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.stp-top-field .cr-custom-select { min-width: 178px; }
.stp-top-field .cr-cs-trigger { background: rgba(0,0,0,0.22); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; padding: 5px 10px; color: var(--text); height: auto; }
.stp-top-field .cr-cs-trigger:hover { border-color: rgba(74,222,128,0.5); }
.stp-top-field .cr-cs-dropdown { z-index: 500; }
html[data-theme="light"] .stp-top-field .cr-cs-trigger { background: rgba(15,23,42,0.04); }
.stp-open-agent { font-size: 12px; padding: 5px 14px; }
.stp-steps { display: flex; align-items: center; gap: 8px; margin: 0 auto; }
.stp-step { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font-size: 13px; cursor: pointer; transition: all .18s ease; }
.stp-step-idx { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.08); color: var(--text-dim); }
.stp-step:hover { border-color: rgba(74,222,128,0.5); color: var(--text); }
.stp-step.active { background: linear-gradient(135deg, rgba(74,222,128,0.18), rgba(34,211,238,0.14)); border-color: rgba(74,222,128,0.55); color: #4ade80; }
.stp-step.active .stp-step-idx { background: linear-gradient(135deg, #4ade80, #22d3ee); color: #fff; }
.stp-step.done { color: var(--text); }
.stp-step.done .stp-step-idx { background: rgba(74,222,128,0.18); color: #4ade80; border: 1px solid rgba(74,222,128,0.4); }
.stp-step-arrow { width: 14px; height: 2px; background: var(--border); border-radius: 2px; display: inline-block; }
.stp-top-right { display: flex; align-items: center; gap: 10px; }
.stp-balance { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(74,222,128,0.08); border: 1px solid rgba(74,222,128,0.25); font-size: 12px; color: var(--text); }
.stp-balance b { color: #4ade80; font-weight: 700; }
.stp-balance button { border: none; background: linear-gradient(135deg, #4ade80, #22d3ee); color: #fff; font-size: 11px; padding: 4px 10px; border-radius: 8px; cursor: pointer; }
.stp-team { font-size: 11px; font-weight: 700; color: var(--text-dim); letter-spacing: .04em; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; }

/* ── 主体布局：左侧大纲 + 中间内容（对话框在统一 right-panel，可 Resizable） ── */
.stp-body { flex: 1; min-height: 0; display: flex; }
.stp-outline { width: 250px; min-width: 210px; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--panel, rgba(0,0,0,0.08)); }
.stp-main { flex: 1; min-width: 0; overflow: auto; }

/* ── 统一 right-panel 内漫咔对话组件微调 ── */
#rightBody .stp-chat-quick button { font-size: 11px; padding: 4px 10px; border-radius: 14px; border: 1px solid rgba(74,222,128,0.3); background: rgba(74,222,128,0.06); color: #4ade80; cursor: pointer; }
#rightBody .stp-chat-quick button:hover { background: rgba(74,222,128,0.14); }
#rightBody .ai-composer-model-select { background: rgba(0,0,0,0.22); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; max-width: 160px; outline: none; }
#rightBody .stp-composer-bottom { flex-wrap: wrap; row-gap: 6px; }
#rightBody .stp-composer-left { flex-wrap: wrap; row-gap: 6px; }
#rightBody .stp-cs-wrap { display: inline-flex; }
#rightBody .stp-cs-wrap .cr-custom-select { min-width: 118px; }
#rightBody .stp-cs-wrap .cr-cs-trigger { background: rgba(0,0,0,0.22); border: 1px solid var(--border); border-radius: 999px; font-size: 11.5px; padding: 4px 10px; color: var(--text); height: auto; }
#rightBody .stp-cs-wrap .cr-cs-dropdown { z-index: 60; }
html[data-theme="light"] #rightBody .stp-cs-wrap .cr-cs-trigger { background: rgba(15,23,42,0.04); }
#rightBody .stp-composer-left .ai-composer-model-select { max-width: 120px; }
#rightBody .stp-composer-mini { font-size: 11px; color: var(--text-dim); border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap; line-height: 1.4; }
#rightBody .stp-composer-mini:hover { color: var(--text); border-color: rgba(74,222,128,0.5); }
html[data-theme="light"] #rightBody .ai-composer-model-select { background: rgba(15,23,42,0.04); }
#rightBody .cr-agent-msg-avatar { flex-shrink: 0; }
#rightBody .cr-agent-msg-bubble .aia-chat-plan-head { margin-bottom: 8px; }
#rightBody .cr-agent-msg-bubble .aia-chat-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
#rightBody .cr-agent-msg-bubble .aia-chat-actions .aia-btn { font-size: 12px; }
.stp-avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #4ade80, #22d3ee); color: #fff; font-weight: 800; font-size: 13px; }
.stp-chat-sid { font-size: 10px; color: var(--text-muted); font-family: ui-monospace, Menlo, Consolas, monospace; opacity: .7; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stp-chat-head-actions { display: flex; gap: 6px; }
.stp-chat-head-actions button { font-size: 11px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; }
.stp-chat-head-actions button:hover { color: var(--text); border-color: rgba(74,222,128,0.5); }
.stp-chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.stp-welcome { text-align: center; padding: 24px 10px; }
.stp-welcome-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4ade80, #22d3ee); box-shadow: 0 12px 30px rgba(74,222,128,0.3); }
.stp-welcome-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.stp-welcome-desc { font-size: 12px; line-height: 1.7; color: var(--text-muted); }
.stp-msg { display: flex; gap: 8px; }
.stp-msg.user { flex-direction: row-reverse; }
.stp-msg-avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.stp-msg.user .stp-msg-avatar { background: rgba(74,222,128,0.15); color: #4ade80; }
.stp-msg.bot .stp-msg-avatar { background: linear-gradient(135deg, #4ade80, #22d3ee); color: #fff; }
.stp-msg-bubble { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.stp-msg.user .stp-msg-bubble { background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.25); color: var(--text); }
.stp-msg.bot .stp-msg-bubble { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text); }
.stp-msg-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.stp-msg-actions button { font-size: 11px; padding: 3px 10px; border-radius: 7px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; }
.stp-msg-actions button.stp-btn-primary { background: linear-gradient(135deg, #4ade80, #22d3ee); border: none; color: #fff; font-weight: 600; }
.stp-msg-actions button.stp-btn-ghost:hover { color: var(--text); }
.stp-typing { display: inline-flex; gap: 4px; align-items: center; }
.stp-typing i { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; animation: stpBlink 1.2s infinite; }
.stp-typing i:nth-child(2) { animation-delay: .2s; }
.stp-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes stpBlink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }
.stp-chat-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 4px; }
.stp-chat-quick button { font-size: 11px; padding: 4px 10px; border-radius: 14px; border: 1px solid rgba(74,222,128,0.3); background: rgba(74,222,128,0.06); color: #4ade80; cursor: pointer; }
.stp-chat-quick button:hover { background: rgba(74,222,128,0.14); }
.stp-chat-input { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.stp-chat-input textarea { width: 100%; resize: none; background: rgba(0,0,0,0.22); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 13px; line-height: 1.5; padding: 10px 12px; outline: none; min-height: 52px; font-family: inherit; }
.stp-chat-input textarea:focus { border-color: rgba(74,222,128,0.55); }
.stp-chat-input-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.stp-input-hint { font-size: 10.5px; color: var(--text-muted); }
.stp-chat-input-bar button { border: none; background: linear-gradient(135deg, #4ade80, #22d3ee); color: #fff; font-weight: 700; font-size: 13px; padding: 7px 20px; border-radius: 10px; cursor: pointer; }
.stp-chat-input-bar button:disabled { opacity: .5; cursor: not-allowed; }

/* ── 中间内容区通用 ── */
.stp-main-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.stp-main-title { font-size: 15px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; }
.stp-main-title small { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.stp-main-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stp-btn { font-size: 12px; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; }
.stp-btn:hover { color: var(--text); border-color: rgba(74,222,128,0.5); }
.stp-btn.primary { background: linear-gradient(135deg, #4ade80, #22d3ee); border: none; color: #fff; font-weight: 700; }
.stp-btn.success { background: linear-gradient(135deg, #22c55e, #16a34a); border: none; color: #fff; font-weight: 700; }
.stp-btn.warn { background: linear-gradient(135deg, #22d3ee, #0891b2); border: none; color: #fff; font-weight: 700; }
.stp-btn:disabled { opacity: .45; cursor: not-allowed; }
.stp-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.stp-seg button { border: none; background: transparent; color: var(--text-dim); font-size: 12px; padding: 5px 12px; cursor: pointer; }
.stp-seg button.on { background: rgba(74,222,128,0.14); color: #4ade80; }
.stp-main-body { padding: 16px 18px; }

/* ── 剧本 ── */
.stp-script-tip { font-size: 12px; color: var(--text-muted); padding: 0 18px 12px; }
.stp-script-head { border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(135deg, rgba(74,222,128,0.10), rgba(34,211,238,0.05)); padding: 14px 16px; margin-bottom: 14px; }
.stp-script-title { font-size: 16px; font-weight: 800; color: var(--text); }
.stp-script-stats { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.stp-scene { border: 1px solid var(--border); border-radius: 12px; background: var(--panel, rgba(0,0,0,0.1)); margin-bottom: 14px; overflow: hidden; }
.stp-scene-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: rgba(74,222,128,0.08); border-bottom: 1px solid var(--border); }
.stp-scene-title { font-size: 13px; font-weight: 700; color: #4ade80; }
.stp-scene-meta { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.stp-scene-body { padding: 12px 14px; font-size: 13px; line-height: 1.8; color: var(--text); }
.stp-scene-body .stp-action { color: var(--text-muted); font-style: italic; }
.stp-scene-body .stp-line b { color: #7dd3fc; font-weight: 600; }

/* ── 设定 ── */
.stp-cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.stp-cast-card { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--panel, rgba(0,0,0,0.1)); display: flex; flex-direction: column; }
.stp-cast-thumb { aspect-ratio: 4/3; background: linear-gradient(135deg, rgba(74,222,128,0.12), rgba(34,211,238,0.06)); display: grid; place-items: center; color: rgba(255,255,255,0.35); position: relative; }
.stp-cast-thumb svg { width: 40px; height: 40px; opacity: .8; }
.stp-cast-tag { position: absolute; top: 10px; left: 10px; font-size: 10px; padding: 3px 8px; border-radius: 8px; background: rgba(0,0,0,0.55); color: #4ade80; font-weight: 700; }
.stp-cast-info { padding: 12px 14px; }
.stp-cast-name { font-size: 14px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 6px; }
.stp-cast-name svg { width: 13px; height: 13px; color: var(--text-muted); cursor: pointer; }
.stp-cast-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-top: 6px; }
.stp-cast-foot { padding: 10px 14px; border-top: 1px solid var(--border); }
.stp-cast-add { border: 1px dashed var(--border); border-radius: 14px; display: grid; place-items: center; min-height: 220px; color: var(--text-muted); cursor: pointer; background: transparent; font-size: 13px; gap: 8px; }
.stp-cast-add:hover { color: #4ade80; border-color: rgba(74,222,128,0.5); }

/* ── 分镜 ── */
.stp-sb-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stp-sb-shots { display: flex; flex-direction: column; gap: 12px; }
.stp-shot { border: 1px solid var(--border); border-radius: 12px; background: var(--panel, rgba(0,0,0,0.1)); display: flex; gap: 0; overflow: hidden; }
.stp-shot-left { flex: 1; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.stp-shot-no { font-size: 12px; font-weight: 700; color: #4ade80; }
.stp-shot-prompt { font-size: 12px; color: var(--text-dim); line-height: 1.7; }
.stp-shot-prompt b { color: #7dd3fc; }
.stp-shot-res { width: 220px; min-width: 180px; border-left: 1px solid var(--border); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.stp-shot-tabs { display: flex; gap: 4px; }
.stp-shot-tabs button { font-size: 10.5px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; }
.stp-shot-tabs button.on { background: rgba(74,222,128,0.14); color: #4ade80; border-color: rgba(74,222,128,0.4); }
.stp-shot-ph { aspect-ratio: 16/9; border-radius: 8px; border: 1px dashed var(--border); display: grid; place-items: center; color: var(--text-muted); font-size: 11px; }
.stp-shot-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.stp-shot-ops button { font-size: 10.5px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; }
.stp-shot-dur { font-size: 10.5px; color: var(--text-muted); text-align: right; }

/* ── 短片 ── */
.stp-film-wrap { display: flex; gap: 16px; }
.stp-film-left { width: 46%; min-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.stp-film-field { border: 1px solid var(--border); border-radius: 12px; background: var(--panel, rgba(0,0,0,0.1)); padding: 12px 14px; }
.stp-film-field-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.stp-film-field textarea { width: 100%; resize: vertical; background: rgba(0,0,0,0.22); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 12.5px; line-height: 1.6; padding: 10px 12px; outline: none; min-height: 120px; font-family: inherit; }
.stp-film-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stp-film-chip { font-size: 11px; padding: 4px 10px; border-radius: 12px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); }
.stp-film-chip.hl { border-color: rgba(74,222,128,0.5); color: #4ade80; background: rgba(74,222,128,0.08); }
.stp-film-gen { display: flex; align-items: center; gap: 10px; }
.stp-film-gen select { background: rgba(0,0,0,0.22); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 12px; outline: none; }
.stp-film-gen button { border: none; background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; font-weight: 700; font-size: 12.5px; padding: 8px 16px; border-radius: 10px; cursor: pointer; margin-left: auto; }
.stp-film-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stp-film-preview { flex: 1; min-height: 260px; border: 1px solid var(--border); border-radius: 12px; display: grid; place-items: center; color: var(--text-muted); font-size: 12.5px; background: var(--panel, rgba(0,0,0,0.15)); }
.stp-film-timeline { border: 1px solid var(--border); border-radius: 12px; background: var(--panel, rgba(0,0,0,0.1)); padding: 12px 14px; }
.stp-tl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stp-tl-progress { font-size: 11.5px; color: var(--text-dim); }
.stp-tl-progress b { color: #4ade80; }
.stp-tl-ops { display: flex; gap: 8px; }
.stp-tl-shots { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.stp-tl-shot { min-width: 108px; border: 1px solid var(--border); border-radius: 10px; padding: 8px; text-align: center; cursor: pointer; background: transparent; color: var(--text-dim); font-size: 11px; }
.stp-tl-shot.on { border-color: rgba(74,222,128,0.6); color: #4ade80; background: rgba(74,222,128,0.08); }
.stp-tl-shot .stp-tl-thumb { height: 54px; border-radius: 7px; background: rgba(255,255,255,0.05); display: grid; place-items: center; margin-bottom: 6px; font-size: 18px; }
.stp-tl-shot b { display: block; font-size: 11px; }
.stp-tl-shot span { font-size: 10px; opacity: .75; }

/* ── 右侧大纲 ── */
.stp-outline-head { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 800; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.stp-outline-stats { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.stp-outline-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.stp-ol-item { padding: 8px 10px; border-radius: 9px; border: 1px solid transparent; font-size: 12.5px; color: var(--text-dim); cursor: pointer; line-height: 1.4; }
.stp-ol-item:hover { background: rgba(255,255,255,0.05); }
.stp-ol-item.on { border-color: rgba(74,222,128,0.5); color: #4ade80; background: rgba(74,222,128,0.08); }
.stp-ol-item .stp-ol-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* ── 浅色主题 ── */
html[data-theme="light"] .stp-app { background: #fff; border-color: rgba(15,23,42,0.1); }
html[data-theme="light"] .stp-chat { background: rgba(15,23,42,0.02); }
html[data-theme="light"] .stp-outline { background: rgba(15,23,42,0.02); }
html[data-theme="light"] .stp-chat-input textarea,
html[data-theme="light"] .stp-film-field textarea,
html[data-theme="light"] .stp-film-gen select { background: rgba(15,23,42,0.04); }
html[data-theme="light"] .stp-msg.bot .stp-msg-bubble { background: rgba(15,23,42,0.04); }
html[data-theme="light"] .stp-scene, html[data-theme="light"] .stp-shot, html[data-theme="light"] .stp-cast-card,
html[data-theme="light"] .stp-film-field, html[data-theme="light"] .stp-film-timeline, html[data-theme="light"] .stp-tl-shot { background: rgba(15,23,42,0.03); }
html[data-theme="light"] .stp-cast-thumb { background: linear-gradient(135deg, rgba(74,222,128,0.16), rgba(34,211,238,0.08)); }
html[data-theme="light"] .stp-scene-body .stp-line b { color: #0284c7; }
html[data-theme="light"] .stp-shot-prompt b { color: #0284c7; }
html[data-theme="light"] .stp-ol-item:hover { background: rgba(15,23,42,0.05); }

/* 响应式 */
@media (max-width: 1280px) {
  .stp-outline { width: 220px; }
}
@media (max-width: 1080px) {
  .stp-outline { display: none; }
}
@media (max-width: 860px) {
  .stp-chat { width: 280px; }
  .stp-steps { display: none; }
}


/* 漫咔右侧面板：平台/模型下拉向上展开（与 FF 智能体一致） */
#stpAgentPanel .cr-cs-dropdown { top: auto; bottom: calc(100% + 4px); transform-origin: bottom center; }

/* ── Storytap 首页：上传剧本 / AI 生剧本 + 项目列表 ── */
.stp-topbar[hidden], .stp-outline[hidden] { display: none !important; }
.stp-top-row1 { display: flex; align-items: center; }
.stp-back-home { font-size: 12px; padding: 5px 12px; }
.stp-home { max-width: 1080px; margin: 0 auto; padding: 28px 24px; }
.stp-home-hero { text-align: center; margin-bottom: 28px; }
.stp-home-logo { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4ade80, #22d3ee); box-shadow: 0 14px 34px rgba(74,222,128,.3); }
.stp-home-hero h1 { font-size: 26px; font-weight: 800; color: var(--text); margin: 0; }
.stp-home-hero h1 em { font-style: normal; color: #4ade80; }
.stp-home-hero p { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.stp-home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stp-home-action { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px; border-radius: 16px; border: 1px solid var(--border); background: var(--panel, rgba(0,0,0,.1)); color: var(--text); cursor: pointer; text-align: left; transition: all .18s ease; }
.stp-home-action:hover { border-color: rgba(74,222,128,.5); transform: translateY(-2px); }
.stp-home-action-icon { font-size: 26px; }
.stp-home-action b { font-size: 16px; }
.stp-home-action small { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.stp-home-projects-head { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.stp-home-count { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.stp-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.stp-home-card { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--panel, rgba(0,0,0,.1)); display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: all .18s ease; }
.stp-home-card:hover { border-color: rgba(74,222,128,.5); transform: translateY(-2px); }
.stp-home-card-name { font-size: 15px; font-weight: 700; color: var(--text); }
.stp-home-card-meta { font-size: 11.5px; color: var(--text-muted); }
.stp-home-card .aia-btn { align-self: flex-start; }
.stp-home-new { align-items: center; justify-content: center; text-align: center; color: var(--text-muted); border-style: dashed; }
.stp-home-empty { border: 1px dashed var(--border); border-radius: 14px; padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px; }
html[data-theme="light"] .stp-home-action, html[data-theme="light"] .stp-home-card { background: rgba(15,23,42,.03); }

/* ── Storytap 首页 · 高级质感（磨砂玻璃 + 渐变 + 悬浮光影） ── */
.stp-home { position: relative; max-width: 1160px; margin: 0 auto; padding: 36px 28px 48px; overflow: hidden; }
.stp-home-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; pointer-events: none; z-index: 0; }
.stp-home-glow-a { width: 420px; height: 420px; top: -140px; left: -100px; background: radial-gradient(circle, var(--ambient-glow-a, rgba(74,222,128,.35)), transparent 65%); }
.stp-home-glow-b { width: 460px; height: 460px; top: -80px; right: -120px; background: radial-gradient(circle, var(--ambient-glow-b, rgba(34,211,238,.28)), transparent 65%); }
.stp-home > * { position: relative; z-index: 1; }

.stp-home-hero { text-align: center; margin-bottom: 30px; }
.stp-home-logo {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 22px;
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #4ade80, #22d3ee);
  box-shadow: 0 18px 44px rgba(74,222,128,.35), 0 0 0 1px rgba(255,255,255,.12) inset, 0 0 24px rgba(34,211,238,.25);
}
.stp-home-hero h1 { font-size: 34px; font-weight: 800; letter-spacing: .02em; color: var(--text); margin: 0; }
.stp-home-hero h1 em { font-style: normal; background: linear-gradient(135deg, #4ade80, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stp-home-hero p { font-size: 13px; color: var(--text-muted); margin-top: 10px; letter-spacing: .06em; }

.stp-home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 34px; }
.stp-home-action {
  display: flex; align-items: center; gap: 16px; padding: 24px 22px; border-radius: 22px; cursor: pointer; text-align: left;
  color: var(--text); border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 22px 50px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.10);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.stp-home-action:hover { transform: translateY(-5px); box-shadow: 0 30px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(74,222,128,.35) inset; border-color: rgba(74,222,128,.45); }
.stp-ha-upload { background: linear-gradient(135deg, rgba(59,130,246,.30), rgba(34,211,238,.12)), linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.03)); }
.stp-ha-ai { background: linear-gradient(135deg, rgba(168,85,247,.30), rgba(236,72,153,.14)), linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.03)); }
.stp-ha-icon {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; flex-shrink: 0;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 24px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.15);
}
.stp-ha-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stp-ha-body b { font-size: 17px; font-weight: 800; }
.stp-ha-body small { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.stp-ha-arrow { margin-left: auto; font-size: 20px; color: rgba(255,255,255,.4); transition: transform .22s ease, color .22s ease; }
.stp-home-action:hover .stp-ha-arrow { transform: translateX(4px); color: #4ade80; }

.stp-home-projects-head { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.stp-home-count { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; background: rgba(255,255,255,.04); }
.stp-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.stp-home-card {
  border: 1px solid rgba(255,255,255,.12); border-radius: 20px; padding: 0; overflow: hidden; cursor: pointer;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 44px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: 0;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.stp-home-card:hover { transform: translateY(-5px); border-color: rgba(74,222,128,.45); box-shadow: 0 26px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(74,222,128,.25) inset; }
.stp-home-cover { height: 104px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(74,222,128,.22), rgba(34,211,238,.16)); position: relative; }
.stp-home-cover::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.18), transparent 55%); }
.stp-home-cover-char { font-size: 40px; font-weight: 800; color: rgba(255,255,255,.9); text-shadow: 0 6px 20px rgba(0,0,0,.35); }
.stp-home-card-info { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 6px; }
.stp-home-card-info b { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stp-home-card-info span { font-size: 11.5px; color: var(--text-muted); }
.stp-home-card .aia-btn { margin: 10px 16px 16px; align-self: flex-start; }
.stp-home-new { align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); border-style: dashed; background: transparent; backdrop-filter: none; }
.stp-home-new:hover { color: #4ade80; }
.stp-home-new-plus { font-size: 26px; font-weight: 300; }
.stp-home-empty { border: 1px dashed var(--border); border-radius: 20px; padding: 48px; text-align: center; color: var(--text-muted); font-size: 13px; background: rgba(255,255,255,.03); }

html[data-theme="light"] .stp-home-action,
html[data-theme="light"] .stp-home-card { background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(255,255,255,.75)); border-color: rgba(15,23,42,.10); box-shadow: 0 18px 44px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.8); }
html[data-theme="light"] .stp-ha-upload { background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(34,211,238,.08)), linear-gradient(160deg, rgba(255,255,255,.95), rgba(255,255,255,.85)); }
html[data-theme="light"] .stp-ha-ai { background: linear-gradient(135deg, rgba(168,85,247,.12), rgba(236,72,153,.08)), linear-gradient(160deg, rgba(255,255,255,.95), rgba(255,255,255,.85)); }
html[data-theme="light"] .stp-ha-arrow { color: rgba(15,23,42,.35); }
html[data-theme="light"] .stp-home-glow-a { opacity: .3; }
html[data-theme="light"] .stp-home-glow-b { opacity: .25; }
html[data-theme="light"] .stp-home-cover { background: linear-gradient(135deg, rgba(74,222,128,.18), rgba(34,211,238,.14)); }

/* ── Storytap 首页 v2：全屏背景 + 选项卡（AI生剧本/上传剧本） ── */
.stp-home { position: relative; min-height: calc(100vh - 64px); display: flex; flex-direction: column; align-items: center; padding: 20px 28px 44px; overflow: visible; }
.stp-home-glow { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; }
/* 覆盖 .stp-home > * 的 relative：光晕固定全屏、脱离文档流，不占位 */
.stp-home > .stp-home-glow { position: fixed !important; }
.stp-home-glow-a { width: 520px; height: 520px; top: -160px; left: -120px; background: radial-gradient(circle, var(--ambient-glow-a, rgba(74,222,128,.34)), transparent 65%); }
.stp-home-glow-b { width: 560px; height: 560px; top: -120px; right: -140px; background: radial-gradient(circle, rgba(34,211,238,.28), transparent 65%); }
.stp-home > * { position: relative; z-index: 1; }

.stp-home-hero { text-align: center; margin: 6px 0 22px; }
.stp-home-logo { width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 18px; display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4ade80, #22d3ee); box-shadow: 0 14px 36px rgba(74,222,128,.35), inset 0 0 0 1px rgba(255,255,255,.15), 0 0 20px rgba(34,211,238,.22); }
.stp-home-hero h1 { font-size: 26px; font-weight: 800; color: var(--text); margin: 0; }
.stp-home-hero h1 em { font-style: normal; background: linear-gradient(135deg, #4ade80, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stp-home-hero p { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; letter-spacing: .05em; }

/* 创作卡片（选项卡容器） */
.stp-create-card { width: min(840px, 100%); border-radius: 24px; padding: 10px; background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02)); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 24px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.10); }
.stp-tabs { display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: rgba(0,0,0,.25); }
.stp-tab { flex: 1; border: none; background: transparent; color: var(--text-dim); font-size: 14px; font-weight: 700; padding: 10px 0; border-radius: 12px; cursor: pointer; transition: all .2s ease; }
.stp-tab:hover { color: var(--text); }
.stp-tab.active { background: linear-gradient(135deg, rgba(74,222,128,.9), rgba(34,211,238,.85)); color: #fff; box-shadow: 0 8px 22px rgba(74,222,128,.35); }
.stp-tab-panel { display: none; padding: 18px 16px 16px; }
.stp-tab-panel.active { display: block; }
.stp-panel-ai textarea { width: 100%; resize: vertical; min-height: 132px; background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 14px; color: var(--text); font-size: 13.5px; line-height: 1.7; padding: 14px 16px; outline: none; font-family: inherit; }
.stp-panel-ai textarea:focus { border-color: rgba(74,222,128,.55); box-shadow: 0 0 0 3px rgba(74,222,128,.12); }
.stp-panel-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.stp-text { flex: 1; min-width: 0; background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 13px; padding: 10px 14px; outline: none; }
.stp-text:focus { border-color: rgba(74,222,128,.55); }
.stp-panel-foot .aia-btn { font-size: 13px; padding: 10px 22px; white-space: nowrap; }
.stp-dropzone { border: 2px dashed rgba(255,255,255,.22); border-radius: 18px; padding: 44px 20px; text-align: center; cursor: pointer; transition: all .2s ease; background: rgba(255,255,255,.03); }
.stp-dropzone:hover, .stp-dropzone.stp-dz-over { border-color: rgba(74,222,128,.6); background: rgba(74,222,128,.06); }
.stp-dz-icon { font-size: 40px; }
.stp-dz-title { font-size: 15px; font-weight: 700; color: var(--text); margin-top: 10px; }
.stp-dz-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.stp-upload-name { flex: 1; font-size: 12.5px; color: #4ade80; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 项目列表（沿用 v1 卡片质感） */
.stp-home-projects { width: min(1160px, 100%); margin-top: 30px; }
.stp-home-projects-head { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.stp-home-count { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; background: rgba(255,255,255,.04); }
.stp-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.stp-home-card { border: 1px solid rgba(255,255,255,.12); border-radius: 20px; overflow: hidden; cursor: pointer; background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 18px 44px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.08); display: flex; flex-direction: column; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.stp-home-card:hover { transform: translateY(-5px); border-color: rgba(74,222,128,.45); box-shadow: 0 26px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(74,222,128,.25) inset; }
.stp-home-cover { height: 104px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(74,222,128,.22), rgba(34,211,238,.16)); position: relative; }
.stp-home-cover::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.18), transparent 55%); }
.stp-home-cover-char { font-size: 40px; font-weight: 800; color: rgba(255,255,255,.9); text-shadow: 0 6px 20px rgba(0,0,0,.35); }
.stp-home-card-info { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 6px; }
.stp-home-card-info b { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stp-home-card-info span { font-size: 11.5px; color: var(--text-muted); }
.stp-home-card .aia-btn { margin: 10px 16px 16px; align-self: flex-start; }
.stp-home-new { align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); border-style: dashed; background: transparent; backdrop-filter: none; }
.stp-home-new:hover { color: #4ade80; }
.stp-home-new-plus { font-size: 26px; font-weight: 300; }
.stp-home-empty { border: 1px dashed var(--border); border-radius: 20px; padding: 48px; text-align: center; color: var(--text-muted); font-size: 13px; background: rgba(255,255,255,.03); }

html[data-theme="light"] .stp-create-card { background: #fff; border-color: rgba(15,23,42,.10); box-shadow: 0 20px 50px rgba(15,23,42,.10); }
html[data-theme="light"] .stp-tabs { background: rgba(15,23,42,.06); }
html[data-theme="light"] .stp-panel-ai textarea, html[data-theme="light"] .stp-text { background: rgba(15,23,42,.04); }
html[data-theme="light"] .stp-dropzone { border-color: rgba(15,23,42,.25); background: rgba(15,23,42,.02); }
html[data-theme="light"] .stp-home-card { background: linear-gradient(160deg, rgba(255,255,255,.95), rgba(255,255,255,.8)); border-color: rgba(15,23,42,.10); box-shadow: 0 18px 44px rgba(15,23,42,.10); }
html[data-theme="light"] .stp-home-glow-a { opacity: .3; }
html[data-theme="light"] .stp-home-glow-b { opacity: .25; }

/* 项目卡片 ⋯ 菜单 */
.stp-home-card { position: relative; }
.stp-card-menu { position: absolute; top: 10px; right: 12px; width: 26px; height: 26px; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(0,0,0,.35); color: rgba(255,255,255,.8); font-size: 16px; line-height: 1; cursor: pointer; z-index: 2; display: grid; place-items: center; }
.stp-card-menu:hover { background: rgba(0,0,0,.55); color: #fff; }
.stp-card-menu-pop { position: fixed; z-index: 99999; min-width: 120px; background: #1c1c1e; border: 1px solid var(--border); border-radius: 10px; padding: 5px; box-shadow: 0 14px 40px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 2px; }
.stp-card-menu-item { border: none; background: transparent; color: var(--text); font-size: 12.5px; text-align: left; padding: 8px 12px; border-radius: 7px; cursor: pointer; }
.stp-card-menu-item:hover { background: rgba(255,255,255,.08); }
.stp-card-menu-item.danger { color: #f87171; }
.stp-card-menu-item.danger:hover { background: rgba(248,113,113,.12); }
html[data-theme="light"] .stp-card-menu-pop { background: #fff; border-color: rgba(15,23,42,.10); }

/* 重命名/新建剧输入弹窗 */
.stp-rename-input { width: 100%; box-sizing: border-box; margin-top: 12px; background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 13.5px; padding: 10px 14px; outline: none; }
.stp-rename-input:focus { border-color: rgba(74,222,128,.55); }
html[data-theme="light"] .stp-rename-input { background: rgba(15,23,42,.04); }

/* 剧本正文编辑模式 */
.stp-scene-edit { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.stp-edit-head { display: flex; gap: 8px; align-items: center; }
.stp-edit-meta { display: flex; gap: 8px; }
.stp-edit-line { display: flex; gap: 8px; align-items: center; }
.stp-scene-edit input, .stp-scene-edit textarea, .stp-scene-edit select {
  background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 12.5px; padding: 7px 10px; outline: none; font-family: inherit;
}
.stp-scene-edit input:focus, .stp-scene-edit textarea:focus { border-color: rgba(74,222,128,.55); }
.stp-edit-head .stp-edit-name { flex: 1; font-weight: 700; font-size: 13.5px !important; }
.stp-edit-meta input { flex: 1; }
.stp-edit-type { width: 64px; flex-shrink: 0; }
.stp-edit-who { width: 116px; flex-shrink: 0; }
.stp-edit-text { flex: 1; resize: vertical; min-height: 34px; }
.stp-edit-del, .stp-edit-del-scene { border: none; background: rgba(248,113,113,.12); color: #f87171; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 12px; flex-shrink: 0; }
.stp-edit-del:hover, .stp-edit-del-scene:hover { background: rgba(248,113,113,.22); }
.stp-edit-add-line { align-self: flex-start; border: 1px dashed var(--border); background: transparent; color: var(--text-dim); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 12px; }
.stp-edit-add-line:hover { color: #4ade80; border-color: rgba(74,222,128,.5); }
html[data-theme="light"] .stp-scene-edit input, html[data-theme="light"] .stp-scene-edit textarea, html[data-theme="light"] .stp-scene-edit select { background: rgba(15,23,42,.04); }

/* Skill 选择器 */
.stp-skill-wrap .cr-custom-select { min-width: 132px; }
.stp-skill-wrap .cr-cs-trigger { background: linear-gradient(135deg, rgba(74,222,128,.16), rgba(34,211,238,.12)); border-color: rgba(74,222,128,.4); font-weight: 600; }
.stp-skill-wrap .cr-cs-dropdown { z-index: 80; }

/* 剧本正文 v2：专业剧本编辑器排版 */
.stp-scene { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); margin-bottom: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.stp-scene-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(74,222,128,.08); border-left: 3px solid #4ade80; }
.stp-scene-badge { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: #4ade80; border: 1px solid rgba(74,222,128,.4); border-radius: 6px; padding: 2px 7px; background: rgba(74,222,128,.1); flex-shrink: 0; }
.stp-scene-title { font-size: 15px; font-weight: 800; color: var(--text); }
.stp-scene-meta { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 16px 0; }
.stp-scene-chip { font-size: 11px; color: var(--text-dim); background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }
.stp-scene-casts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 16px 0; }
.stp-scene-casts-label { font-size: 11px; color: var(--text-muted); }
.stp-scene-cast { font-size: 11px; color: #7dd3fc; background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.25); border-radius: 999px; padding: 3px 10px; }
.stp-scene-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.stp-scene-action { display: flex; gap: 8px; color: var(--text-muted); font-style: italic; font-size: 12.5px; line-height: 1.6; padding-left: 8px; border-left: 2px solid rgba(255,255,255,.12); }
.stp-scene-action-tag { font-style: normal; font-size: 10px; font-weight: 700; color: #fbbf24; border: 1px solid rgba(251,191,36,.35); border-radius: 5px; padding: 1px 6px; flex-shrink: 0; height: fit-content; margin-top: 2px; }
.stp-scene-dialog { display: flex; gap: 10px; font-size: 13px; line-height: 1.7; }
.stp-scene-who { min-width: 72px; color: #4ade80; font-weight: 700; text-align: right; flex-shrink: 0; }
.stp-scene-speech { color: var(--text); }
html[data-theme="light"] .stp-scene { background: linear-gradient(180deg, #fff, rgba(15,23,42,.02)); box-shadow: 0 10px 30px rgba(15,23,42,.08); }
html[data-theme="light"] .stp-scene-who { color: #15803d; }
html[data-theme="light"] .stp-scene-cast { color: #0e7490; }

/* 剧本正文：大输入框 */
.stp-script-textarea { width: 100%; min-height: 58vh; background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 14px; color: var(--text); font-size: 13.5px; line-height: 1.8; padding: 16px 18px; outline: none; font-family: inherit; resize: vertical; white-space: pre-wrap; box-sizing: border-box; }
.stp-script-textarea:focus { border-color: rgba(74,222,128,.55); box-shadow: 0 0 0 3px rgba(74,222,128,.10); }
.stp-script-foot { font-size: 11px; color: var(--text-muted); margin-top: 10px; line-height: 1.6; }
html[data-theme="light"] .stp-script-textarea { background: rgba(15,23,42,.04); }

/* 分场大纲 · 选项卡 + 基础设定（整体背景色） */
.stp-outline-tabs { display: flex; gap: 4px; margin: 8px 10px; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.28); border: 1px solid var(--border); }
.stp-outline-tabs button { flex: 1; border: none; background: transparent; color: var(--text-dim); font-size: 12px; font-weight: 600; padding: 7px 0; border-radius: 9px; cursor: pointer; transition: all .18s ease; }
.stp-outline-tabs button:hover { color: var(--text); }
.stp-outline-tabs button.on { background: linear-gradient(135deg, rgba(74,222,128,.9), rgba(34,211,238,.85)); color: #fff; box-shadow: 0 4px 12px rgba(74,222,128,.3); }
html[data-theme="light"] .stp-outline-tabs { background: rgba(15,23,42,.06); }
.stp-base-section { padding: 10px 12px; }
.stp-base-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.stp-base-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stp-base-chip { font-size: 11px; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(74,222,128,.35); color: #4ade80; background: rgba(74,222,128,.08); }
.stp-base-chip.loc { color: #7dd3fc; border-color: rgba(34,211,238,.3); background: rgba(34,211,238,.07); }
.stp-base-empty { font-size: 11px; color: var(--text-muted); }
.stp-base-story { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.stp-base-story:last-child { border-bottom: none; }
.stp-base-no { width: 18px; height: 18px; border-radius: 50%; background: rgba(74,222,128,.15); color: #4ade80; font-size: 11px; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; }
.stp-base-story b { font-size: 12px; color: var(--text); }
html[data-theme="light"] .stp-base-chip { color: #15803d; border-color: rgba(22,163,74,.35); }
html[data-theme="light"] .stp-base-chip.loc { color: #0e7490; border-color: rgba(14,116,144,.3); }

/* 基础设定：可编辑列表 */
.stp-base-section { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.stp-base-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.03); cursor: pointer; }
.stp-base-row:hover { border-color: rgba(74,222,128,.4); background: rgba(74,222,128,.05); }
.stp-base-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg,#4ade80,#22d3ee); color: #fff; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; font-size: 13px; }
.stp-base-avatar.loc { background: linear-gradient(135deg,#22d3ee,#0891b2); }
.stp-base-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stp-base-row-main b { font-size: 12.5px; color: var(--text); }
.stp-base-row-main span { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stp-base-edit { border: 1px solid var(--border); background: transparent; color: var(--text-dim); font-size: 11px; padding: 3px 10px; border-radius: 7px; cursor: pointer; flex-shrink: 0; }
.stp-base-edit:hover { color: #4ade80; border-color: rgba(74,222,128,.5); }
.stp-base-add { border: 1px dashed var(--border); background: transparent; color: var(--text-dim); font-size: 11.5px; padding: 7px; border-radius: 9px; cursor: pointer; }
.stp-base-add:hover { color: #4ade80; border-color: rgba(74,222,128,.5); }
.stp-edit-dlg { width: min(480px, 92vw); }
.stp-edit-dlg-body { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; max-height: 60vh; overflow: auto; }
.stp-edit-dlg-field { display: flex; flex-direction: column; gap: 5px; }
.stp-edit-dlg-field span { font-size: 12px; color: var(--text-dim); }
.stp-edit-dlg-field input, .stp-edit-dlg-field textarea { background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-size: 13px; padding: 8px 12px; outline: none; font-family: inherit; box-sizing: border-box; width: 100%; }
.stp-edit-dlg-field textarea { resize: vertical; }
.stp-edit-dlg-field input:focus, .stp-edit-dlg-field textarea:focus { border-color: rgba(74,222,128,.55); }
html[data-theme="light"] .stp-base-row { background: rgba(15,23,42,.03); }
html[data-theme="light"] .stp-edit-dlg-field input, html[data-theme="light"] .stp-edit-dlg-field textarea { background: rgba(15,23,42,.04); }

/* 思考中 / 思考过程 */
.stp-typing-label { font-size: 12px; color: var(--text-muted); margin-right: 8px; }
.stp-thinking { margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; background: rgba(0,0,0,.2); }
.stp-thinking summary { cursor: pointer; font-size: 11.5px; color: var(--text-dim); padding: 6px 10px; user-select: none; }
.stp-thinking-body { font-size: 11.5px; color: var(--text-muted); padding: 8px 10px; border-top: 1px solid var(--border); line-height: 1.6; max-height: 180px; overflow: auto; }
html[data-theme="light"] .stp-thinking { background: rgba(15,23,42,.04); }

/* 剧本正文：去边框底纹、顶到底、按钮在下方 */
.stp-script-body { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; box-sizing: border-box; }
.stp-script-textarea { flex: 1; min-height: 0; width: 100%; box-sizing: border-box; background: transparent !important; border: none !important; box-shadow: none !important; resize: none; color: var(--text); font-size: 13.5px; line-height: 1.8; padding: 4px 2px; outline: none; font-family: inherit; white-space: pre-wrap; }
.stp-script-textarea:focus { border: none !important; box-shadow: none !important; }
.stp-script-actions { display: flex; gap: 10px; padding: 10px 18px 16px; margin-top: 0; border-top: 1px solid var(--border); box-sizing: border-box; }
html[data-theme="light"] .stp-script-textarea { background: transparent !important; }

/* 剧本页固定布局：顶部/底部固定，中间文本框独立滚动 */
.stp-main.stp-main-script .stp-main-body.stp-script-body { padding: 0; } /* 输入框铺满红框区域（去掉外层内边距） */
.stp-main.stp-main-script .stp-script-textarea { padding: 18px 22px; border-radius: 0; }
.stp-main.stp-main-script { display: flex; flex-direction: column; overflow: hidden; }
.stp-main.stp-main-script .stp-main-head { flex-shrink: 0; position: static; }
.stp-main.stp-main-script .stp-script-body { flex: 1; min-height: 0; height: auto; overflow: hidden; }
.stp-main.stp-main-script .stp-script-textarea { flex: 1; min-height: 0; overflow-y: auto; }
.stp-main.stp-main-script .stp-script-actions,
.stp-main.stp-main-script .stp-script-foot { flex-shrink: 0; }


/* 工作区整页背景光效：固定全屏（覆盖整个视口 = body 背景），首页不受影响 */
.stp-app.stp-work-mode::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(680px 460px at 10% 0%, rgba(74,222,128,.22), transparent 62%),
    radial-gradient(780px 560px at 90% 0%, rgba(34,211,238,.18), transparent 62%),
    radial-gradient(820px 600px at 12% 100%, rgba(168,85,247,.14), transparent 62%),
    radial-gradient(700px 500px at 90% 100%, rgba(74,222,128,.14), transparent 62%),
    radial-gradient(520px 360px at 50% 45%, rgba(34,211,238,.06), transparent 70%);
}
.stp-app.stp-work-mode > * { position: relative; z-index: 1; }
/* 顶栏（剧名/集数下拉）必须最顶层：盖过 .stp-body(z 1) 与正文标题栏 */
.stp-app.stp-work-mode .stp-topbar { position: relative; z-index: 60; }

html[data-theme="light"] .stp-app.stp-work-mode::before { opacity: .55; }

/* 光效缓慢流动 */
.stp-app.stp-work-mode::before { animation: stpGlowDrift 22s ease-in-out infinite alternate; }
.stp-home-glow-a, .stp-home-glow-b { animation: stpGlowDrift 18s ease-in-out infinite alternate; }
.stp-home-glow-b { animation-delay: -9s; animation-duration: 26s; }
@keyframes stpGlowDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-24px, -16px, 0) scale(1.08); }
}

/* agent 提示词输入框：半透明背景 */
#stpInput {
  background: rgba(255,255,255,.06) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 12px !important;
  padding: 8px 12px !important;
  box-sizing: border-box;
}
#stpInput:focus { border-color: rgba(74,222,128,.5) !important; }
html[data-theme="light"] #stpInput { background: rgba(15,23,42,.05) !important; border-color: rgba(15,23,42,.12) !important; }

/* 剧本页头部：标题行与左侧结构导航底边对齐；阅读设置 */
.stp-main.stp-main-script .stp-main-head { padding: 10px 18px; line-height: 22px; }
.stp-main.stp-main-script .stp-main-title { line-height: 22px; }
.stp-outline-head { padding: 10px 14px; line-height: 22px; }
.stp-script-settings-btn { width: 28px; height: 22px; box-sizing: border-box; border: 1px solid var(--border); background: rgba(255,255,255,.05); color: var(--text-dim); border-radius: 7px; cursor: pointer; display: inline-grid; place-items: center; padding: 0; }
.stp-script-settings-btn:hover { color: #4ade80; border-color: rgba(74,222,128,.5); }
.stp-script-settings-pop { position: fixed; z-index: 99999; width: 264px; background: #1c1c1e; border: 1px solid var(--border); border-radius: 12px; padding: 12px; box-shadow: 0 16px 44px rgba(0,0,0,.5); display: none; flex-direction: column; gap: 10px; }
.stp-script-settings-pop.open { display: flex; }
.stp-ss-title { font-size: 13px; font-weight: 700; color: var(--text); }
.stp-ss-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.stp-ss-preset { font-size: 11px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; }
.stp-ss-preset.on { background: rgba(74,222,128,.16); color: #4ade80; border-color: rgba(74,222,128,.5); }
.stp-ss-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.stp-ss-row input[type="range"] { flex: 1; }
.stp-ss-row input[type="color"] { width: 44px; height: 26px; border: 1px solid var(--border); border-radius: 6px; background: transparent; cursor: pointer; padding: 0; }
.stp-ss-reset { align-self: flex-start; font-size: 11px; padding: 5px 12px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); border-radius: 8px; cursor: pointer; }
.stp-ss-reset:hover { color: #4ade80; }
html[data-theme="light"] .stp-script-settings-pop { background: #fff; border-color: rgba(15,23,42,.12); }

/* 基础设定 · 故事梗概 */

/* 基础设定：AI 按钮（图标）+ 详情视图 */
.stp-base-ai { width: 26px; height: 26px; padding: 0; border-radius: 8px; border: 1px solid rgba(74,222,128,.4); background: rgba(74,222,128,.1); color: #4ade80; cursor: pointer; margin-left: auto; display: inline-grid; place-items: center; font-size: 14px; line-height: 1; }
.stp-base-ai:hover { background: rgba(74,222,128,.2); }
.stp-base-detail-body { padding: 20px 24px; }
.stp-base-detail-text { font-size: 14px; line-height: 1.9; color: var(--text); white-space: pre-wrap; max-width: 820px; }

/* 浅色主题：绿色加深（提升对比度） */
html[data-theme="light"] .stp-base-ai { background: #15803d; border-color: #15803d; color: #fff; }
html[data-theme="light"] .stp-base-ai:hover { background: #166534; }
html[data-theme="light"] .stp-outline-tabs button.on { background: #15803d; color: #fff; box-shadow: 0 4px 12px rgba(21,128,61,.3); }
html[data-theme="light"] .stp-ss-preset.on { background: #dcfce7; color: #15803d; border-color: #16a34a; }
html[data-theme="light"] .stp-ol-item.on { border-color: #15803d; color: #15803d; background: rgba(21,128,61,.08); }
html[data-theme="light"] .stp-scene-badge { color: #15803d; border-color: rgba(21,128,61,.55); background: rgba(21,128,61,.08); }
html[data-theme="light"] .stp-step.active { background: rgba(21,128,61,.12); border-color: #15803d; color: #15803d; }
html[data-theme="light"] .stp-step.active .stp-step-idx { background: #15803d; color: #fff; }
html[data-theme="light"] .stp-tabs button.on { background: #15803d; color: #fff; box-shadow: 0 4px 12px rgba(21,128,61,.3); }
html[data-theme="light"] .stp-base-row:hover { border-color: rgba(21,128,61,.55); background: rgba(21,128,61,.06); }
html[data-theme="light"] .stp-edit-add-line:hover { color: #15803d; border-color: #15803d; }
html[data-theme="light"] .stp-script-settings-btn:hover { color: #15803d; border-color: #15803d; }

/* 关灯/聚焦模式：四周暗带变暗模糊（不全黑），正文区域完全不接触遮罩 → 保持清晰 */
#stpLightsOverlay { position: fixed; inset: 0; z-index: 9000; pointer-events: none; display: none; }
#stpLightsOverlay .stp-ls { position: fixed; background: rgba(0,0,0,.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: opacity .35s ease; }
.stp-main.stp-main-script .stp-main-head, .stp-main.stp-main-script .stp-script-body { position: relative; z-index: 9001; }
#stpLightsBtn.on { background: rgba(74,222,128,.2); color: #4ade80; border-color: rgba(74,222,128,.6); }

/* ── 系统提示词（漫咔 Agent）── */
.stp-sys-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 8px;
  background: rgba(255,255,255,.04); color: var(--text-dim);
  font-size: 13px; cursor: pointer; transition: all .18s ease; line-height: 1;
}
.stp-sys-btn:hover { border-color: rgba(74,222,128,.5); color: var(--text); background: rgba(74,222,128,.08); }
.stp-sys-btn.has { border-color: rgba(74,222,128,.55); color: #4ade80; background: rgba(74,222,128,.12); box-shadow: 0 0 0 1px rgba(74,222,128,.25) inset; }
html[data-theme="light"] .stp-sys-btn { background: rgba(15,23,42,.04); }
html[data-theme="light"] .stp-sys-btn.has { background: rgba(21,128,61,.10); color: #15803d; border-color: #16a34a; }

.stp-sys-pop {
  position: fixed; z-index: 9500; width: 360px; max-width: calc(100vw - 24px);
  background: rgba(28,28,30,.96); border: 1px solid var(--modal-border, rgba(255,255,255,.12));
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.5);
  padding: 14px; display: none; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.stp-sys-pop.open { display: block; }
.stp-sys-pop-title { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.stp-sys-pop textarea {
  width: 100%; box-sizing: border-box; min-height: 120px; resize: vertical;
  background: rgba(0,0,0,.3); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 12.5px; line-height: 1.7; padding: 10px 12px; outline: none; font-family: inherit;
}
.stp-sys-pop textarea:focus { border-color: rgba(74,222,128,.55); box-shadow: 0 0 0 3px rgba(74,222,128,.10); }
.stp-sys-pop-hint { font-size: 11px; color: var(--text-muted); margin: 8px 2px 12px; line-height: 1.6; }
.stp-sys-pop-actions { display: flex; justify-content: flex-end; gap: 8px; }
html[data-theme="light"] .stp-sys-pop { background: #fff; border-color: rgba(15,23,42,.12); }
html[data-theme="light"] .stp-sys-pop textarea { background: rgba(15,23,42,.04); }

/* ── 剧本格式统一渲染：场次高亮加粗 / 动作标灰 / 人物台词分层 ── */
.stp-fmt-body {
  margin-top: 8px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255,255,255,.03); max-height: 300px; overflow: auto;
  font-size: 12.5px; line-height: 1.75;
}
.stp-fmt-title { color: #4ade80; font-weight: 800; font-size: 13.5px; margin-bottom: 6px; }
.stp-fmt-scene { color: #4ade80; font-weight: 700; font-size: 13px; margin: 8px 0 2px; }
.stp-fmt-meta { color: var(--text-muted); font-size: 12px; margin: 1px 0; }
.stp-fmt-action { color: #8b949e; font-style: italic; font-size: 12px; margin: 2px 0; }
.stp-fmt-line { color: var(--text); }
.stp-fmt-who { color: #4ade80; font-weight: 600; }
.stp-fmt-colon { color: var(--text-muted); margin: 0 4px 0 2px; }
.stp-fmt-text { color: var(--text); }
.stp-fmt-gap { height: 6px; }
html[data-theme="light"] .stp-fmt-body { background: rgba(15,23,42,.03); }
html[data-theme="light"] .stp-fmt-title, html[data-theme="light"] .stp-fmt-scene, html[data-theme="light"] .stp-fmt-who { color: #15803d; }
html[data-theme="light"] .stp-fmt-action { color: #6b7280; }
