/*!
 * AI 影视工作台 /tools/ai-film — 三端排版
 * 变量定义在 :root（弹窗 / toast 挂在 .af 之外，必须全局可继承）。
 */
:root {
    --af-bg: #0f1319;
    --af-card: #171d26;
    --af-card-2: #1d2530;
    --af-line: rgba(148, 163, 184, .18);
    --af-line-2: rgba(148, 163, 184, .30);
    --af-fg: #e8edf4;
    --af-sub: #9aa8ba;
    --af-faint: #7d899b;
    --af-accent: #4c9ffe;
    --af-accent-soft: rgba(76, 159, 254, .14);
    --af-gold: #e7b45c;
    --af-ok: #45c98a;
    --af-warn: #e9a23b;
    --af-err: #f07070;
    --af-radius: 14px;
    --af-radius-sm: 9px;
    --af-shadow: 0 6px 18px rgba(0, 0, 0, .24);
    --af-shadow-sm: 0 2px 10px rgba(0, 0, 0, .18);
    --af-zebra: rgba(127, 127, 127, .06);
}
[data-theme="light"] {
    --af-bg: #f5f7fa;
    --af-card: #ffffff;
    --af-card-2: #f2f6fb;
    --af-line: rgba(15, 23, 42, .12);
    --af-line-2: rgba(15, 23, 42, .22);
    --af-fg: #1a2430;
    --af-sub: #5d6b7d;
    --af-faint: #6d7887;
    --af-accent: #1668d6;
    --af-accent-soft: rgba(22, 104, 214, .10);
    --af-gold: #a9700d;
    --af-ok: #13845a;
    --af-warn: #9a6200;
    --af-err: #c73b3b;
    --af-shadow: 0 10px 30px rgba(15, 23, 42, .12);
    --af-shadow-sm: 0 2px 8px rgba(15, 23, 42, .08);
    --af-zebra: rgba(15, 20, 25, .038);
}

/* 站点 body 默认 overflow-y:scroll 会让页内 sticky 全部失效，把滚动权交还 html */
body.page-ai-film-full { overflow: visible; }
body.page-ai-film-full .app,
body.page-ai-film-full .main-content,
body.page-ai-film-full .page-container { max-width: 100%; width: 100%; border-right: 0; min-width: 0; }

.af { box-sizing: border-box; width: 100%; max-width: 100%; margin: 0; padding: 18px 20px 40px; color: var(--af-fg); font-size: 14px; line-height: 1.6; }
.af *, .af-mask * { box-sizing: border-box; }
.af [hidden], .af-mask[hidden], .af-toast[hidden], .af [hidden].af-mask { display: none !important; }
.af h1, .af h2, .af h3, .af p { margin: 0; }
.af h2 { font-size: 15px; font-weight: 650; }
.af h3 { font-size: 13px; font-weight: 600; color: var(--af-sub); }
.af button, .af input, .af select, .af textarea { font-family: inherit; }
.af :focus-visible, .af-mask :focus-visible { outline: 2px solid var(--af-accent); outline-offset: 2px; }

/* ---------------- 通用控件 ---------------- */
.af-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; padding: 6px 13px;
    border: 1px solid var(--af-line-2); border-radius: var(--af-radius-sm); background: var(--af-card-2); color: var(--af-fg);
    font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .12s; }
.af-btn:hover { background: var(--af-accent-soft); border-color: var(--af-accent); }
.af-btn:active { transform: translateY(1px); }
.af-btn:disabled { opacity: .5; cursor: not-allowed; }
.af-btn-pri { background: var(--af-accent); border-color: var(--af-accent); color: #fff; }
.af-btn-pri:hover { background: var(--af-accent); opacity: .9; }
.af-btn-ghost { background: transparent; }
.af-btn-danger { color: var(--af-err); border-color: var(--af-err); background: transparent; }
.af-btn-danger:hover { background: rgba(240, 112, 112, .12); border-color: var(--af-err); }
.af-btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.af-btn-xs { min-height: 24px; padding: 2px 8px; font-size: 11.5px; }
.af-icon-btn { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--af-sub);
    font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.af-icon-btn:hover { background: var(--af-accent-soft); color: var(--af-accent); }
.af-sel, .af-input, .af-num, .af-ta { width: 100%; padding: 7px 10px; border: 1px solid var(--af-line-2); border-radius: var(--af-radius-sm);
    background: var(--af-card); color: var(--af-fg); font-size: 13px; outline: none; }
.af-sel:focus, .af-input:focus, .af-num:focus, .af-ta:focus { border-color: var(--af-accent); box-shadow: 0 0 0 3px var(--af-accent-soft); }
.af-sel { height: 34px; cursor: pointer; }
.af-sel-sm { height: 30px; font-size: 12.5px; width: auto; min-width: 96px; }
.af-num { width: 72px; text-align: center; }
.af-ta { resize: vertical; line-height: 1.7; }
.af-ta-sm { font-size: 13px; }
.af-ta-script { min-height: 230px; }
.af-ta-chat { min-height: 54px; }
.af-range { flex: 1 1 160px; min-width: 100px; accent-color: var(--af-accent); }
.af-hint { font-size: 12px; color: var(--af-faint); }
.af-note { font-size: 12.5px; color: var(--af-sub); line-height: 1.75; margin-top: 10px !important; }
.af-note code { background: var(--af-card-2); padding: 1px 5px; border-radius: 4px; }
.af-spacer { flex: 1 1 auto; }
.af-sep { width: 1px; height: 22px; background: var(--af-line); }
.af-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--af-sub); cursor: pointer; white-space: nowrap; }
.af-chk input { accent-color: var(--af-accent); }
.af-mini-l { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--af-sub); white-space: nowrap; }
.af-field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--af-sub); }
.af-field-inline .af-sel { width: 190px; }
.af-spacer ~ * { flex: 0 0 auto; }
.af-badge { display: inline-flex; padding: 3px 9px; border: 1px solid var(--af-line); border-radius: 999px;
    background: var(--af-card-2); color: var(--af-sub); font-size: 11.5px; white-space: nowrap; }

/* ---------------- Hero / 说明 / 顶栏 ---------------- */
.af-hero { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "ic t acts" "ic badges acts";
    gap: 4px 14px; align-items: center; padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--af-line);
    border-radius: var(--af-radius); background: linear-gradient(120deg, var(--af-accent-soft), transparent 55%), var(--af-card);
    box-shadow: var(--af-shadow-sm); }
.af-hero-ic { grid-area: ic; width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center;
    background: var(--af-accent); color: #fff; }
.af-hero-t { grid-area: t; min-width: 0; }
.af-hero-title { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.af-hero-sub { font-size: 12.5px; color: var(--af-sub); margin-top: 2px !important; max-width: 92ch; }
.af-hero-badges { grid-area: badges; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.af-hero-acts { grid-area: acts; display: flex; gap: 8px; align-self: start; }

.af-help { margin-bottom: 12px; border: 1px solid var(--af-line); border-radius: var(--af-radius); background: var(--af-card); overflow: hidden; }
.af-help-t { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 9px 16px;
    font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.af-help-t::-webkit-details-marker, .af-help-t::marker { display: none; content: ''; }
.af-help-t:hover { background: var(--af-accent-soft); }
.af-help-caret { transition: transform .18s; color: var(--af-sub); }
.af-help[open] .af-help-caret { transform: rotate(180deg); }
.af-help[open] .af-help-t { border-bottom: 1px solid var(--af-line); }
.af-help-body { padding: 12px 16px 15px; font-size: 12.8px; color: var(--af-sub); }
.af-help-body p + p { margin-top: 8px !important; }
.af-help-body strong { color: var(--af-fg); }

.af-topbar { position: sticky; top: 8px; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
    padding: 9px 12px; margin-bottom: 12px; border: 1px solid var(--af-line); border-radius: var(--af-radius);
    background: var(--af-card); box-shadow: var(--af-shadow-sm); }
.af-topbar-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.af-save { margin-left: auto; font-size: 12px; color: var(--af-faint); white-space: nowrap; }

/* ---------------- 主布局 / 页签 ---------------- */
.af-layout { display: grid; grid-template-columns: minmax(0, 1fr) 318px; gap: 14px; align-items: start; }
.af-main { min-width: 0; }
.af-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 12px; border: 1px solid var(--af-line);
    border-radius: var(--af-radius); background: var(--af-card); scrollbar-width: thin; }
.af-tab { flex: 1 0 auto; min-height: 38px; padding: 7px 14px; border: 0; border-radius: var(--af-radius-sm);
    background: transparent; color: var(--af-sub); font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.af-tab:hover { background: var(--af-card-2); color: var(--af-fg); }
.af-tab.is-on { background: var(--af-accent); color: #fff; }

.af-card { padding: 14px 15px 15px; margin-bottom: 12px; border: 1px solid var(--af-line); border-radius: var(--af-radius);
    background: var(--af-card); box-shadow: var(--af-shadow-sm); }
.af-card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 11px; }
.af-card-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.af-card-f { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 11px; }
.af-card-f .af-inline-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }
.af-inline-opts label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--af-sub); }
.af-toolrow { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 11px; }
.af-toolrow .af-input { flex: 1 1 180px; min-width: 120px; max-width: 320px; }
.af-toolrow .af-hint { margin-left: auto; }
.af-seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--af-line); border-radius: var(--af-radius-sm); background: var(--af-card-2); }
.af-seg button { min-height: 27px; padding: 3px 11px; border: 0; border-radius: 6px; background: transparent;
    color: var(--af-sub); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.af-seg button:hover { color: var(--af-fg); }
.af-seg button.is-on { background: var(--af-accent); color: #fff; }
.af-seg-full { width: 100%; margin-bottom: 12px; }
.af-seg-full button { flex: 1 1 0; }
.af-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.af-form-grid > label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--af-sub); min-width: 0; }
.af-form-wide { grid-column: 1 / -1; }
.af-form-grid .af-sel, .af-form-grid .af-input { width: 100%; }

/* ---------------- 剧本分析 ---------------- */
.af-analysis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.af-an-col { min-width: 0; padding: 10px; border: 1px solid var(--af-line); border-radius: var(--af-radius-sm); background: var(--af-card-2); }
.af-an-col h3 { display: flex; justify-content: space-between; margin-bottom: 8px; }
.af-an-col h3 span { color: var(--af-accent); }
.af-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 108px; overflow-y: auto; }
.af-chip { padding: 3px 9px; border: 1px solid var(--af-line-2); border-radius: 999px; background: var(--af-card);
    font-size: 12px; color: var(--af-fg); cursor: pointer; }
.af-chip:hover { border-color: var(--af-accent); color: var(--af-accent); }
.af-chip-empty { font-size: 12px; color: var(--af-faint); }
.af-stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0; padding: 9px 12px;
    border: 1px solid var(--af-line); border-radius: var(--af-radius-sm); background: var(--af-card-2); }
.af-stat-row span { font-size: 12.5px; color: var(--af-sub); }
.af-stat-row b { color: var(--af-fg); font-size: 14px; margin-left: 4px; }
.af-scenes { max-height: 260px; overflow-y: auto; contain: layout style; border: 1px solid var(--af-line); border-radius: var(--af-radius-sm); }
.af-scene { padding: 9px 12px; border-bottom: 1px solid var(--af-line); font-size: 12.5px; }
.af-scene:last-child { border-bottom: 0; }
.af-scene:nth-child(even) { background: var(--af-zebra); }
.af-scene-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--af-fg); font-weight: 600; }
.af-scene-h em { font-style: normal; color: var(--af-gold); font-size: 11.5px; }
.af-scene-h i { font-style: normal; color: var(--af-sub); font-weight: 400; font-size: 11.5px; }
.af-scene-p { color: var(--af-sub); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 资产 ---------------- */
.af-asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 11px; contain: layout style; }
.af-asset { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--af-line);
    border-radius: var(--af-radius-sm); background: var(--af-card-2); cursor: pointer; min-width: 0; }
.af-asset:hover { border-color: var(--af-accent); }
.af-asset-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 7px; background: var(--af-card); }
.af-asset-ph { width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 7px;
    background: linear-gradient(135deg, var(--af-accent-soft), transparent); color: var(--af-faint); font-size: 26px; }
.af-asset-t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.af-asset-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.af-kind { flex: 0 0 auto; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
    background: var(--af-accent-soft); color: var(--af-accent); }
.af-asset-d { font-size: 12px; color: var(--af-sub); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.af-empty { padding: 28px 16px; text-align: center; color: var(--af-faint); font-size: 13px; border: 1px dashed var(--af-line-2); border-radius: var(--af-radius-sm); }

/* ---------------- 分镜 ---------------- */
.af-shot-list { display: flex; flex-direction: column; gap: 8px; contain: layout style; max-height: 70vh; overflow-y: auto; padding-right: 3px; }
.af-shot { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 11px; align-items: center;
    padding: 9px 11px; border: 1px solid var(--af-line); border-radius: var(--af-radius-sm); background: var(--af-card-2); cursor: pointer; }
.af-shot:nth-child(even) { background: var(--af-zebra); }
.af-shot.is-done { border-left: 3px solid var(--af-ok); }
.af-shot:hover { border-color: var(--af-accent); }
.af-shot-thumb { width: 96px; height: 60px; object-fit: cover; border-radius: 6px; background: var(--af-card); }
.af-shot-thumb-ph { width: 96px; height: 60px; display: grid; place-items: center; border-radius: 6px;
    background: var(--af-card-2); border: 1px dashed var(--af-line-2); color: var(--af-faint); font-size: 19px; }
.af-shot-b { min-width: 0; }
.af-shot-h { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 12px; color: var(--af-sub); }
.af-shot-h b { color: var(--af-accent); font-size: 13px; }
.af-shot-h .af-tag { padding: 1px 6px; border: 1px solid var(--af-line); border-radius: 4px; font-size: 11px; }
.af-shot-v { margin-top: 3px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-shot-d { color: var(--af-gold); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-shot-ops { display: flex; gap: 5px; flex: 0 0 auto; }
.af-shot-canvas { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 11px; max-height: 70vh; overflow-y: auto; }
.af-shot-card { border: 1px solid var(--af-line); border-radius: var(--af-radius-sm); overflow: hidden; background: var(--af-card-2); cursor: pointer; }
.af-shot-card img, .af-shot-card .af-shot-thumb-ph { width: 100%; height: 110px; object-fit: cover; }
.af-shot-card-t { padding: 7px 9px; font-size: 12px; }
.af-shot-card-t b { color: var(--af-accent); }
.af-shot-card-t p { color: var(--af-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 提示词工厂 ---------------- */
.af-caps { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--af-line-2); border-radius: var(--af-radius-sm); background: var(--af-card-2); }
.af-caps-t { font-size: 12.5px; font-weight: 600; margin-bottom: 7px; }
.af-caps-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--af-sub); margin-top: 5px; }
.af-caps-row strong { color: var(--af-fg); min-width: 62px; }
.af-caps-row span { padding: 2px 8px; border-radius: 999px; background: var(--af-card); border: 1px solid var(--af-line); }
.af-caps-row span.is-off { opacity: .42; text-decoration: line-through; }
.af-pm-list { max-height: 56vh; overflow-y: auto; contain: layout style; display: flex; flex-direction: column; gap: 9px; }
.af-pm-item { padding: 9px 11px; border: 1px solid var(--af-line); border-radius: var(--af-radius-sm); background: var(--af-card-2); }
.af-pm-item h3 { color: var(--af-fg); margin-bottom: 5px; }
.af-pm-item p { font-size: 12.3px; color: var(--af-sub); word-break: break-word; }
.af-pm-item p + p { margin-top: 4px; }
.af-pm-item .af-neg { color: var(--af-err); }
.af-prompt-box { margin-top: 12px; }
.af-prompt-h { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--af-sub); margin: 7px 0 5px; }

/* ---------------- 预览 ---------------- */
.af-stage { position: relative; width: 100%; display: grid; place-items: center; border-radius: var(--af-radius-sm);
    background: #080a0e; overflow: hidden; min-height: 260px; }
.af-stage canvas { display: block; max-width: 100%; max-height: 62vh; background: #080a0e; }
.af-stage-empty { position: absolute; color: #6b7684; font-size: 13px; pointer-events: none; }
.af-player { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 11px; }
.af-time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--af-sub); white-space: nowrap; }
.af-export-row { gap: 7px; }
.af-timeline { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.af-tl-seg { flex: 0 0 auto; min-width: 42px; height: 42px; border: 1px solid var(--af-line); border-radius: 6px;
    background: var(--af-card-2); color: var(--af-sub); font-size: 11px; cursor: pointer; display: grid; place-items: center; }
.af-tl-seg.is-on { border-color: var(--af-accent); background: var(--af-accent-soft); color: var(--af-accent); }

/* ---------------- 右侧助理 ---------------- */
.af-assist { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 9px; height: min(760px, calc(100dvh - 34px));
    padding: 13px; border: 1px solid var(--af-line); border-radius: var(--af-radius); background: var(--af-card); box-shadow: var(--af-shadow-sm); }
.af-assist-h { display: flex; align-items: center; justify-content: space-between; }
.af-assist-h h2 { font-size: 14.5px; }
.af-assist-close { display: none; }
.af-ai-status { font-size: 11.5px; color: var(--af-sub); padding: 5px 9px; border-radius: 6px; background: var(--af-card-2); border: 1px solid var(--af-line); }
.af-chat { flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 3px; }
.af-msg { padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.65; max-width: 100%; white-space: pre-wrap; word-break: break-word; }
.af-msg-u { align-self: flex-end; background: var(--af-accent); color: #fff; }
.af-msg-a { align-self: flex-start; background: var(--af-card-2); border: 1px solid var(--af-line); color: var(--af-fg); }
.af-msg-s { align-self: center; background: transparent; color: var(--af-faint); font-size: 11.5px; padding: 2px 6px; }
.af-quick { display: flex; flex-wrap: wrap; gap: 5px; }
.af-quick button { padding: 3px 9px; border: 1px solid var(--af-line-2); border-radius: 999px; background: transparent;
    color: var(--af-sub); font-size: 11.5px; cursor: pointer; }
.af-quick button:hover { border-color: var(--af-accent); color: var(--af-accent); }
.af-chat-in { display: flex; flex-direction: column; gap: 6px; }
.af-chat-acts { display: flex; justify-content: flex-end; gap: 6px; }
.af-assist-fab { display: none; position: fixed; right: 16px; bottom: 18px; z-index: 60; padding: 11px 17px;
    border: 0; border-radius: 999px; background: var(--af-accent); color: #fff; font-size: 13px; font-weight: 600;
    box-shadow: var(--af-shadow); cursor: pointer; }

/* ---------------- 状态栏 ---------------- */
.af-status { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 13px; padding: 9px 13px;
    border: 1px solid var(--af-line); border-radius: var(--af-radius); background: var(--af-card); font-size: 12px; color: var(--af-sub); }
.af-status b { color: var(--af-fg); margin-left: 4px; }
.af-status-r { margin-left: auto; color: var(--af-faint); }

/* ---------------- 弹窗 / toast ---------------- */
.af-mask { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(4, 8, 14, .78); }
.af-modal { width: min(520px, 100%); max-height: min(88dvh, 860px); display: flex; flex-direction: column;
    border: 1px solid var(--af-line-2); border-radius: 16px; background: var(--af-card); color: var(--af-fg);
    box-shadow: var(--af-shadow); isolation: isolate; }
.af-modal-wide { width: min(720px, 100%); }
.af-modal-h { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--af-line); }
.af-modal-h h2 { font-size: 15px; }
.af-modal-b { padding: 15px 16px; overflow-y: auto; overscroll-behavior: contain; }
.af-modal-f { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--af-line); }
.af-img-row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 12px; }
.af-img-prev { width: 96px; height: 72px; object-fit: cover; border-radius: 7px; border: 1px solid var(--af-line); }
.af-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 100010;
    max-width: min(90vw, 560px); padding: 10px 18px; border-radius: 999px; background: var(--af-fg); color: var(--af-bg);
    font-size: 13px; font-weight: 600; box-shadow: var(--af-shadow); }
.af-toast.is-err { background: var(--af-err); color: #fff; }
.af-toast.is-ok { background: var(--af-ok); color: #fff; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1400px) {
    .af-layout { grid-template-columns: minmax(0, 1fr) 292px; }
}
@media (max-width: 1100px) {
    .af-hero { grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "ic t" "ic badges" "acts acts"; }
    .af-hero-ic { width: 44px; height: 44px; }
    .af-hero-acts { justify-content: flex-start; margin-top: 8px; }
    .af-layout { grid-template-columns: minmax(0, 1fr); }
    .af-assist { position: fixed; right: 0; top: 0; bottom: 0; width: min(88vw, 360px); height: 100dvh; z-index: 100005;
        border-radius: 16px 0 0 16px; transform: translateX(102%); transition: transform .24s; }
    .af-assist.is-open { transform: translateX(0); }
    .af-assist-close { display: inline-flex; }
    .af-assist-fab { display: block; }
    .af-shot-list, .af-pm-list, .af-shot-canvas { max-height: 60vh; }
}
@media (max-width: 900px) {
    .af { padding: 14px 13px 34px; }
    .af-analysis { grid-template-columns: 1fr; }
    .af-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .af-hero-title { font-size: 19px; }
    .af-hero-badges .af-badge:nth-child(n+3) { display: none; }
    .af-topbar { top: 0; }
    .af-card-f .af-inline-opts { width: 100%; margin-left: 0; }
    .af-toolrow .af-input { max-width: none; }
}
@media (max-width: 767px) {
    .af-hero { padding: 13px; grid-template-columns: 40px minmax(0, 1fr); gap: 3px 10px; }
    .af-hero-ic { width: 40px; height: 40px; }
    .af-hero-sub { font-size: 12px; }
    .af-hero-acts { flex-wrap: wrap; }
    .af-hero-acts .af-btn { flex: 1 1 auto; }
    .af-tabs { gap: 3px; }
    .af-tab { flex: 0 0 auto; min-height: 40px; padding: 8px 12px; }
    .af-topbar { gap: 7px; }
    .af-field-inline { width: 100%; }
    .af-field-inline .af-sel { flex: 1 1 auto; width: auto; }
    .af-topbar-acts { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .af-topbar-acts .af-btn { width: 100%; min-height: 40px; white-space: normal; }
    .af-topbar-acts .af-sep { display: none; }
    .af-save { width: 100%; margin-left: 0; text-align: right; }
    .af-sel, .af-input, .af-num, .af-ta, .af-btn { font-size: 16px; }
    .af-btn { min-height: 42px; padding: 8px 12px; }
    .af-btn-sm, .af-btn-xs { min-height: 38px; font-size: 14px; }
    .af-seg button { min-height: 36px; font-size: 13px; }
    .af-form-grid { grid-template-columns: minmax(0, 1fr); }
    .af-shot { grid-template-columns: 76px minmax(0, 1fr); }
    .af-shot-thumb, .af-shot-thumb-ph { width: 76px; height: 52px; }
    .af-shot-ops { grid-column: 1 / -1; justify-content: flex-end; }
    .af-asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .af-card-f .af-btn, .af-export-row .af-btn { flex: 1 1 calc(50% - 6px); }
    .af-card-f .af-btn-pri { flex-basis: 100%; }
    .af-modal { width: 100%; max-height: 94dvh; border-radius: 16px 16px 0 0; align-self: flex-end; }
    .af-mask { padding: 0; align-items: flex-end; }
    .af-modal-f .af-btn { flex: 1 1 auto; }
    .af-status { gap: 9px 14px; }
    .af-status-r { width: 100%; margin-left: 0; }
    .af-assist-fab { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 420px) {
    .af-hero-badges { display: none; }
    .af-asset-grid { grid-template-columns: minmax(0, 1fr); }
    .af-stat-row { grid-template-columns: minmax(0, 1fr); }
    .af-shot-ops .af-btn { flex: 1 1 auto; }
    .af-player .af-btn { flex: 1 1 20%; }
    .af-range { flex: 1 1 100%; order: 5; }
}
@media (hover: none) {
    .af-btn:active { transform: none; }
    .af-asset:hover, .af-shot:hover { border-color: var(--af-line); }
}
@media (prefers-reduced-motion: reduce) {
    .af *, .af-mask * { transition: none !important; animation: none !important; }
}
@media print {
    /* 只打印当前页签：不再把 4 个隐藏面板全展开，否则会打出几十页无关内容 */
    .af-topbar, .af-tabs, .af-assist, .af-assist-fab, .af-mask, .af-toast, .af-hero-acts, .af-status, .af-card-f { display: none !important; }
}
