/* FaceFusion 换脸选项 + 多张人脸照片（faceswap.html / faceswapvideo.html 共用，配合 js/faceswap-ff-options.js）
 * 自包含：不依赖 app-common.css，颜色变量都带回退值，shanjierenyi（.zib-app 布局）与 aivideo（旧版布局）两站通用。
 * 选择器统一带 #ff-options / #face_image-wrapper 提高优先级，覆盖各页面内联的旧规则。 */
#ff-options.ff-options {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    text-align: left;
    margin: 10px 0;
}
#ff-options.ff-options.ff-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#ff-options .ff-opt-group {
    background: #fff;
    border: 1px solid rgba(255, 209, 220, 0.5);
    border-radius: 12px;
    padding: 10px 12px;
    text-align: left;
}
#ff-options .ff-opt-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--app-text, #333);
    margin-bottom: 8px;
}
#ff-options .ff-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#ff-options .ff-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 12px;
    border-radius: 100px;
    border: 1.5px solid rgba(255, 209, 220, 0.9);
    background: #fff8fa;
    color: var(--app-text, #333);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}
#ff-options .ff-chip input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
#ff-options .ff-chip.is-on {
    border-color: var(--app-primary, #ff6b9d);
    background: linear-gradient(135deg, #ff6b9d 0%, #f43f7a 100%);
    color: #fff;
    box-shadow: 0 3px 10px rgba(255, 107, 157, 0.3);
}
#ff-options .ff-chip small {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 100px;
    background: rgba(255, 107, 157, 0.12);
    color: var(--app-primary-dark, #e0407a);
}
#ff-options .ff-chip.is-on small { background: rgba(255, 255, 255, 0.25); color: #fff; }
#ff-options .ff-opt-desc {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--app-text-light, #666);
}
#ff-options .ff-opt-desc.is-warn { color: #b45309; }

/* 人脸预览框：各页面把它定死 250x250 + overflow:hidden，多张照片 / 两人分组需要随内容增高 */
#face_image-container.ff-face-box {
    height: auto !important;
    min-height: 180px;
    max-height: none !important;
    overflow: visible !important;
    display: inline-flex !important;
    flex-direction: column;
    justify-content: center;
    vertical-align: top;
    cursor: default;
}
#face_image-container.ff-face-box:hover { transform: none; }
/* 旧版页面的 placeholder 是绝对定位居中，会盖在「＋添加照片」上，这里改成正常流排在分组上方 */
#face_image-container.ff-face-box .placeholder-text {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    padding: 12px 12px 0;
    text-align: center;
}
#face_image-container.ff-face-box #face_image-wrapper {
    display: block;
    width: 100%;
    height: auto;
    padding: 10px;
    box-sizing: border-box;
    overflow: visible;
}
#face_image-wrapper .ff-face-groups { display: flex; flex-direction: column; gap: 10px; text-align: left; }
#face_image-wrapper .ff-face-group {
    border: 1.5px dashed rgba(255, 209, 220, 0.9);
    border-radius: 12px;
    padding: 8px 10px 10px;
    background: #fff8fa;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#face_image-wrapper .ff-face-groups.is-two .ff-face-group { cursor: pointer; }
#face_image-wrapper .ff-face-groups.is-two .ff-face-group.is-active {
    border-style: solid;
    border-color: var(--app-primary, #ff6b9d);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.15);
}
#face_image-wrapper .ff-face-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--app-text, #333);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
#face_image-wrapper .ff-face-group-title em {
    font-style: normal;
    font-size: 11px;
    font-weight: 600;
    color: var(--app-text-light, #666);
    background: #fff;
    border: 1px solid rgba(255, 209, 220, 0.8);
    border-radius: 100px;
    padding: 0 7px;
}
#face_image-wrapper .ff-face-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
#face_image-wrapper .ff-face-thumb,
#face_image-wrapper .ff-face-add {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    flex: 0 0 auto;
    margin: 0;
}
#face_image-wrapper .ff-face-thumb { background: #fff; border: 1px solid rgba(255, 209, 220, 0.8); }
/* 覆盖页面里 #face_image-wrapper img 的居中绝对定位预览样式 */
#face_image-wrapper .ff-face-thumb img {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    display: block;
    border-radius: 0;
    margin: 0;
}
/* 移除按钮用 span 而不是 button：主题对 button 有一套通用的大按钮样式（渐变/最小宽度/内边距），优先级很高会把它撑成 180px 宽 */
#face_image-wrapper .ff-face-del {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 15px;
    line-height: 20px;
    text-align: center;
    padding: 0;
    margin: 0;
    cursor: pointer;
    z-index: 2;
    display: block;
    box-sizing: border-box;
}
#face_image-wrapper .ff-face-del:hover { background: #f43f7a; }
#face_image-wrapper .ff-face-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1.5px dashed rgba(255, 107, 157, 0.6);
    background: #fff;
    color: var(--app-primary, #ff6b9d);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: normal;
}
#face_image-wrapper .ff-face-add:hover { background: #fff0f5; border-color: var(--app-primary, #ff6b9d); }
#face_image-wrapper .ff-face-add span { font-size: 22px; line-height: 1; font-weight: 700; }
#face_image-wrapper .ff-face-add small { font-size: 10px; margin-top: 3px; color: var(--app-text-light, #666); }
#face_image-wrapper .ff-face-add input { position: absolute; opacity: 0; width: 0; height: 0; }

@media screen and (max-width: 768px) {
    #ff-options.ff-options, #ff-options.ff-options.ff-cols-2 { grid-template-columns: 1fr; }
}
