/* ═══ sc 页面内卡片标题 ═══ */
.pv-card__title { font-family: var(--pv-font-display); font-size: var(--pv-text-lg); font-weight: 600; color: var(--pv-text); margin-bottom: var(--pv-space-4); margin-left: 12px; padding-bottom: var(--pv-space-3); border-bottom: 1px solid var(--pv-border); }

/* ═══ 页面根容器：占满视口（侧边栏布局内） ═══ */
/* 覆盖 .pv-main 的 padding，全屏编辑器需要占满整个内容区 */
.pv-main:has(.sc-page) { padding: 0; }
.sc-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.sc-topbar { flex-shrink: 0; padding: 16px 24px 0; }
.sc-body { flex: 1; display: flex; overflow: hidden; padding: 0 16px 16px; gap: 16px; min-height: 0; }

/* ═══ 左栏：工作流主区 ═══ */
.sc-main { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 12px; }
.sc-main, .sc-main label, .sc-main p, .sc-main span, .sc-main h1, .sc-main h2, .sc-main h3, .sc-main h4 { color: var(--pv-text); }
.sc-main .pv-text-muted, .sc-main .sc-faint { color: var(--pv-text-muted); }

/* 标题 */
.sc-header { text-align: center; margin-bottom: 20px; }
.sc-header h1 { font-family: var(--pv-font-display); font-size: var(--pv-text-2xl); letter-spacing: -0.02em; }
.sc-header p { font-size: var(--pv-text-sm); margin-top: 4px; }
.sc-section-title { font-family: var(--pv-font-display); font-size: var(--pv-text-xl); margin-bottom: var(--pv-space-3); color: var(--pv-text); }

/* 步骤指示器 */
.sc-steps { display: flex; gap: var(--pv-space-2); margin-bottom: var(--pv-space-5); align-items: center; }
.sc-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--pv-surface-raised); color: var(--pv-text-muted); display: flex; align-items: center; justify-content: center; font-family: var(--pv-font-display); font-size: var(--pv-text-xs); font-weight: 700; border: 2px solid var(--pv-glass-border); transition: all var(--pv-ease) 150ms; flex-shrink: 0; }
.sc-dot.active { background: var(--pv-accent); color: #fff; border-color: var(--pv-accent); cursor: default; }
.sc-dot.done { background: var(--pv-success); color: #fff; border-color: var(--pv-success); cursor: pointer; }
.sc-dot.done:hover { transform: scale(1.1); }
.sc-dot:not(.done):not(.active) { cursor: not-allowed; opacity: 0.4; }
.sc-line { flex: 1; height: 2px; background: var(--pv-glass-border); border-radius: 1px; }
.sc-line.done { background: var(--pv-success); }
.sc-step { display: none; }
.sc-step.active { display: block; }

/* 编辑器 */
.sc-editor { background: var(--pv-surface-raised); border: 1px solid var(--pv-glass-border); border-radius: var(--pv-radius-sm); padding: 12px; margin-bottom: var(--pv-space-3); }
.sc-editor h3 { font-family: var(--pv-font-display); font-size: var(--pv-text-base); margin-bottom: var(--pv-space-3); }
.sc-editor h4 { font-family: var(--pv-font-display); font-size: var(--pv-text-sm); margin-bottom: var(--pv-space-2); display: flex; justify-content: space-between; align-items: center; }
.sc-shot { background: var(--pv-glass-bg); border: 1px solid var(--pv-glass-border); border-radius: var(--pv-radius-sm); padding: 12px; margin-bottom: 10px; }
.sc-meta { display: flex; gap: var(--pv-space-3); margin-bottom: 10px; }
.sc-meta label { font-size: var(--pv-text-sm); margin-bottom: 2px; }
.sc-meta input, .sc-meta select { padding: 2px 4px; font-size: var(--pv-text-sm); width: auto; }
.sc-toggle { font-size: var(--pv-text-xs); color: var(--pv-text-muted); cursor: pointer; margin-left: 8px; font-weight: 400; }
.collapsed { display: none; }
.kf-row { background: rgba(0,0,0,0.04); border: 1px solid var(--pv-glass-border); border-radius: 6px; padding: 10px; margin-bottom: 6px; display: flex; gap: 10px; align-items: flex-start; }
.kf-row .kf-info { width: 120px; flex-shrink: 0; }
.kf-row .kf-info span { display: block; font-size: var(--pv-text-xs); color: var(--pv-text-muted); }
.kf-row textarea { flex: 1; min-height: 36px; font-size: var(--pv-text-sm); padding: 8px 10px; }

.sc-kf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--pv-space-3); }
.sc-kf-card { background: var(--pv-surface-raised); border: 1px solid var(--pv-glass-border); border-radius: var(--pv-radius-sm); padding: 12px; text-align: center; }
.sc-kf-card img { width: 100%; height: 130px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.sc-kf-card .kf-label { font-size: var(--pv-text-xs); color: var(--pv-text-muted); margin-bottom: 6px; }
@keyframes sc-progress { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }
.sc-breathing { position: relative; overflow: hidden; }
.sc-breathing::after { content: ''; position: absolute; bottom: 0; left: -40%; height: 3px; width: 40%; background: var(--pv-accent); animation: sc-progress 1.2s ease-in-out infinite; pointer-events: none; }
/* 风格选择卡片 */
.sc-style-grid { display: flex; gap: 8px; flex-wrap: nowrap; margin-bottom: 14px; }
.sc-style-card { flex: 1; text-align: center; padding: 7px 8px; }
.sc-style-card { padding: 7px 14px; border: 1px solid var(--pv-accent); border-radius: 8px; cursor: pointer; font-size: var(--pv-text-sm); transition: all 0.15s; background: var(--pv-accent); color: #fff; }
.sc-style-card:hover,
.sc-style-card.active { background: var(--pv-accent); color: #fff; }
.sc-style-card .sc-style-desc { display: none; }

.sc-pg { height: 6px; background: rgba(0,0,0,0.06); border-radius: 3px; overflow: hidden; margin-top: var(--pv-space-3); }
.sc-pg-fill { height: 100%; background: var(--pv-accent); border-radius: 3px; width: 0%; transition: width 0.3s; }
.sc-pg-text { font-size: var(--pv-text-xs); color: var(--pv-text-muted); margin-top: 6px; }
.sc-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--pv-surface); color: var(--pv-text); padding: 12px 24px; border-radius: var(--pv-radius-sm); border: 1px solid var(--pv-border); font-size: var(--pv-text-sm); z-index: 999; opacity: 0; pointer-events: none; transition: opacity var(--pv-ease) 200ms; box-shadow: var(--pv-shadow-card); }
.sc-toast.show { opacity: 1; }
.sc-warn { padding: 10px 14px; background: rgba(255,145,0,0.1); border: 1px solid rgba(255,145,0,0.3); border-radius: var(--pv-radius-sm); margin-bottom: var(--pv-space-3); font-size: var(--pv-text-xs); color: var(--pv-warning); }
video { width: 100%; max-height: 420px; border-radius: var(--pv-radius-sm); background: #000; }

/* ═══ 右栏：资产管理面板 ═══ */
#asset-panel { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; border-left: 1px solid var(--pv-glass-border); padding-left: 16px; background: var(--pv-surface); border-radius: var(--pv-radius-md); padding: 12px; }
#asset-panel, #asset-panel label, #asset-panel p, #asset-panel span { color: var(--pv-text); }

.ap-tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-shrink: 0; }
.ap-tab { flex: 1; padding: 6px 0; font-size: 12px; border: none; border-radius: 4px; cursor: pointer; background: rgba(0,0,0,0.04); color: var(--pv-text-muted); text-align: center; transition: all 0.15s; }
.ap-tab.active { background: var(--pv-accent); color: #fff; font-weight: 600; }

.ap-body { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }

/* 角色生成区 */
.ap-gen-section { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--pv-glass-border); }
.ap-gen-toggle { font-size: var(--pv-text-xs); font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 4px 0; margin-bottom: 6px; }
.ap-gen-body textarea { width: 100%; font-size: var(--pv-text-xs); border: 1px solid var(--pv-glass-border); border-radius: 4px; padding: 6px 8px; resize: vertical; min-height: 50px; margin-bottom: 6px; }
.ap-gen-body .ap-btn-row { display: flex; gap: 6px; margin-bottom: 6px; }

.ap-char-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ap-char-card { position: relative; background: var(--pv-surface-raised); border: 2px solid var(--pv-glass-border); border-radius: var(--pv-radius-sm); padding: 4px; cursor: pointer; transition: all 0.2s; }
.ap-char-card:hover { border-color: var(--pv-accent); }
.ap-char-card.selected { border-color: var(--pv-accent); box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.15); }
.ap-char-card img { width: 100%; height: 120px; object-fit: cover; border-radius: 4px; background: rgba(0,0,0,0.05); display: block; }
.ap-char-check { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; cursor: pointer; z-index: 2; accent-color: var(--pv-accent); }
.ap-del-btn { position: absolute; bottom: 22px; right: 4px; width: 18px; height: 18px; line-height: 16px; border: none; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; cursor: pointer; z-index: 1; opacity: 0; transition: opacity 0.15s; }
.ap-char-card:hover .ap-del-btn { opacity: 1; }
@media (hover: none) { .ap-del-btn { opacity: 1; } }
.ap-del-btn:hover { background: var(--pv-error); }

/* 资产列表 */
.ap-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-shrink: 0; }
.ap-list-header span { font-size: var(--pv-text-xs); font-weight: 600; }
.ap-empty { color: var(--pv-text-muted); font-size: var(--pv-text-xs); padding: 12px 0; text-align: center; }
.ap-asset-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 4px; cursor: pointer; transition: all 0.15s; margin-bottom: 2px; border: 1px solid transparent; background: transparent; }
.ap-asset-item:hover { background: rgba(0,0,0,0.04); }
.ap-asset-item.selected { border-color: var(--pv-accent); background: var(--pv-accent-bg); }
.ap-asset-item .ap-name { flex: 1; font-size: var(--pv-text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ap-asset-item .ap-actions { display: flex; gap: 2px; flex-shrink: 0; }
.ap-asset-item .ap-actions button { padding: 2px 6px; font-size: var(--pv-text-xs); border: none; border-radius: 3px; cursor: pointer; }
.ap-btn-edit { background: rgba(0,0,0,0.06); color: var(--pv-text); }
.ap-btn-del { background: rgba(255,0,60,0.1); color: var(--pv-error); }

/* 已绑定资产的左侧绿色标识 */
.ap-asset-item.ap-bound { border-left: 3px solid #10b981; background: rgba(34,197,94,0.04); }

/* ═══ 超小内联按钮（对白区/绑定区等紧凑表单使用） ═══ */
.sc-btn--xs {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: auto; padding: 4px 10px; font-size: var(--pv-text-xs); font-weight: 500;
  border: none; border-radius: var(--pv-radius-sm); cursor: pointer; white-space: nowrap;
  line-height: 1.3; user-select: none;
  transition: background 0.15s, opacity 0.15s;
}
.sc-btn--xs--primary { background: var(--pv-accent); color: #fff; }
.sc-btn--xs--primary:hover { background: var(--pv-accent-hover); }
.sc-btn--xs--secondary { background: var(--pv-accent); color: #fff; border: 1px solid var(--pv-accent); }
.sc-btn--xs--secondary:hover { background: var(--pv-accent-hover); }
.sc-btn--xs--danger { background: var(--pv-accent); color: #fff; border: 1px solid var(--pv-accent); }
.sc-btn--xs--danger:hover { background: var(--pv-accent-hover); }
.sc-asset-sel { width: 100%; padding: 5px 8px; font-size: var(--pv-text-sm); border: 1px solid var(--pv-glass-border); border-radius: var(--pv-radius-sm); background: var(--pv-surface); color: var(--pv-text); }

/* 弹窗复用 sc-modal-mask / sc-modal-box */
.sc-modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.sc-modal-box { background: var(--pv-surface); color: var(--pv-text); border-radius: var(--pv-radius-md); padding: 32px 40px; max-width: 480px; text-align: center; box-shadow: var(--pv-shadow-modal); }
.sc-modal-box p { margin: 0 0 24px; font-size: var(--pv-text-lg); color: var(--pv-text); }
.sc-modal-box button { padding: 12px 32px; border-radius: var(--pv-radius-sm); border: none; cursor: pointer; font-size: 1rem; margin: 0 8px; }
.sc-modal-box input, .sc-modal-box textarea { width: 100%; font-size: var(--pv-text-sm); border: 1px solid var(--pv-glass-border); border-radius: 4px; padding: 6px 8px; margin-bottom: 8px; text-align: left; }
/* ═══ Step2 分镜编辑 ═══ */
.s2-act-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.s2-act-tab { padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: var(--pv-text-xs); border: 1px solid var(--pv-glass-border); background: var(--pv-surface); color: var(--pv-text); transition: all 0.15s; white-space: nowrap; }
.s2-act-tab:hover { border-color: var(--pv-accent); }
.s2-act-tab.active { background: var(--pv-accent); color: #fff; border-color: var(--pv-accent); font-weight: 600; }
.s2-act-tab .s2-act-badge { font-size: var(--pv-text-xs); margin-left: 4px; }
.s2-shot-card { background: var(--pv-surface-raised); border: 1px solid var(--pv-glass-border); border-radius: var(--pv-radius-sm); margin-bottom: 12px; overflow: hidden; }
.s2-shot-card.dirty { border-color: #f59e0b; }
.s2-shot-card.synced { border-color: #10b981; }
.s2-shot-header { padding: 8px 12px; display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.03); border-bottom: 1px solid var(--pv-glass-border); cursor: pointer; user-select: none; }
.s2-shot-header .s2-shot-id { font-weight: 600; font-size: var(--pv-text-sm); flex-shrink: 0; }
.s2-shot-header .s2-shot-title { flex: 1; font-size: var(--pv-text-xs); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s2-shot-header .s2-shot-dur { font-size: var(--pv-text-xs); font-weight: 600; color: var(--pv-accent); flex-shrink: 0; }
.s2-shot-header .s2-shot-status { font-size: var(--pv-text-xs); padding: 1px 6px; border-radius: 3px; flex-shrink: 0; }
.s2-shot-header .s2-shot-status.none { color: var(--pv-text-faint); }
.s2-shot-header .s2-shot-status.dirty { color: #f59e0b; background: rgba(245,158,11,0.1); }
.s2-shot-header .s2-shot-status.synced { color: #10b981; background: rgba(16,185,129,0.1); }
.s2-shot-header .s2-fold-icon { font-size:0.7rem;transition:transform 0.15s;flex-shrink:0; }
.s2-shot-card.folded .s2-shot-header .s2-fold-icon { transform: rotate(-90deg); }
.s2-shot-body { padding: 12px; }
.s2-shot-card.folded .s2-shot-body { display: none; }
.s2-shot-body label { font-size: var(--pv-text-xs); color: var(--pv-text-muted); display: block; margin-bottom: 2px; margin-top: 6px; }
.s2-shot-body label:first-child { margin-top: 0; }
.s2-shot-body textarea, .s2-shot-body input { width: 100%; font-size: var(--pv-text-sm); padding: 6px 8px; border: 1px solid var(--pv-glass-border); border-radius: 4px; resize: vertical; min-height: 32px; }
.s2-kf-section { padding: 12px; border-top: 1px dashed var(--pv-glass-border); }
.s2-shot-card.folded .s2-kf-section { display: none; }
.s2-kf-section .s2-kf-label { font-size: var(--pv-text-sm); color: var(--pv-text); font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.s2-kf-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.s2-kf-card .pv-btn { font-size: var(--pv-text-base); color: var(--pv-text); }
.s2-kf-card { background: rgba(0,0,0,0.04); border-radius: 6px; padding: 12px; text-align: center; position: relative; }
.s2-kf-card img { width: 100%; height: 90px; object-fit: cover; border-radius: 4px; background: rgba(0,0,0,0.05); }
.s2-kf-card .s2-kf-name { font-size: var(--pv-text-xs); color: var(--pv-text-muted); margin-top: 3px; margin-bottom: 3px; }
.s2-kf-card button { margin: 1px 2px; }
.s2-kf-add { display: flex; align-items: center; justify-content: center; height: 90px; border: 2px dashed var(--pv-glass-border); border-radius: 6px; cursor: pointer; color: var(--pv-text-faint); font-size: var(--pv-text-xl); transition: all 0.15s; }
.s2-kf-add:hover { border-color: var(--pv-accent); color: var(--pv-accent); }
.s2-kf-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 90px; border-radius: 6px; background: rgba(0,0,0,0.04); color: var(--pv-text-faint); font-size: var(--pv-text-xs); }
.s2-bottom-bar { display: flex; align-items: center; gap: 6px; padding: 12px 0; border-top: 1px solid var(--pv-glass-border); margin-top: 12px; position: sticky; bottom: 0; background: var(--pv-surface); z-index: 5; }

/* 小屏降级 */
@media (max-width: 1100px) {
  #asset-panel { width: 280px; }
}
