.bg-replace-input{display:flex;flex-direction:column;gap:0;background:var(--bg-replace-surface, #fff);border:1px solid var(--bg-replace-border, #e5e7eb);border-radius:12px;height:calc(100vh - 80px);max-height:calc(100vh - 80px);overflow:hidden;position:sticky;top:80px;margin-top:0}.bg-replace-section{padding:20px;display:flex;flex-direction:column;gap:12px}.bg-replace-section-header{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--bg-replace-text, #111827)}.bg-replace-section-count{font-weight:400;color:var(--bg-replace-muted, #9ca3af)}.bg-replace-required{font-size:11px;font-weight:500;color:var(--bg-replace-danger, #ef4444);margin-left:2px}.bg-replace-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:8px}.bg-replace-image-thumb{position:relative;aspect-ratio:1;border-radius:8px;overflow:hidden;border:1px solid var(--bg-replace-border, #e5e7eb);background:var(--bg-replace-subtle, #f9fafb)}.bg-replace-image-thumb img{width:100%;height:100%;object-fit:cover;display:block}.bg-replace-image-thumb.over-limit{opacity:.5}.bg-replace-over-limit-badge{position:absolute;bottom:4px;left:4px;right:4px;background:#ef4444d9;color:#fff;font-size:9px;font-weight:600;text-align:center;padding:2px 4px;border-radius:4px;letter-spacing:.02em}.bg-replace-image-remove{position:absolute;top:4px;right:4px;width:22px;height:22px;background:#0000008c;border:none;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#fff;opacity:0;transition:opacity .15s ease;padding:0}.bg-replace-image-thumb:hover .bg-replace-image-remove{opacity:1}.bg-replace-hidden-input{display:none}.bg-replace-dropzone{border:1.5px dashed var(--bg-replace-border, #d1d5db);border-radius:10px;padding:20px 16px;display:flex;flex-direction:column;align-items:center;gap:6px;cursor:pointer;transition:border-color .15s ease,background .15s ease;background:transparent;text-align:center}.bg-replace-dropzone:hover,.bg-replace-dropzone.dragover{border-color:var(--bg-replace-accent, #6366f1);background:var(--bg-replace-accent-subtle, #eef2ff)}.bg-replace-dropzone-icon{color:var(--bg-replace-muted, #9ca3af);margin-bottom:2px}.bg-replace-dropzone:hover .bg-replace-dropzone-icon,.bg-replace-dropzone.dragover .bg-replace-dropzone-icon{color:var(--bg-replace-accent, #6366f1)}.bg-replace-dropzone-label{font-size:13px;font-weight:500;color:var(--bg-replace-text, #374151)}.bg-replace-dropzone-sub{font-size:11px;color:var(--bg-replace-muted, #9ca3af)}.bg-replace-background-preview{position:relative;width:100%;aspect-ratio:16 / 7;border-radius:10px;overflow:hidden;border:1px solid var(--bg-replace-border, #e5e7eb)}.bg-replace-background-preview img{width:100%;height:100%;object-fit:cover;display:block}.bg-replace-background-overlay{position:absolute;inset:0;background:#0000;display:flex;align-items:center;justify-content:center;gap:8px;opacity:0;transition:background .18s ease,opacity .18s ease}.bg-replace-background-preview:hover .bg-replace-background-overlay{background:#0006;opacity:1}.bg-replace-background-replace-btn{display:flex;align-items:center;gap:6px;background:#ffffffe6;border:none;border-radius:6px;padding:6px 12px;font-size:12px;font-weight:600;color:#111827;cursor:pointer;transition:background .12s ease}.bg-replace-background-replace-btn:hover{background:#fff}.bg-replace-background-remove{position:static;opacity:1;width:30px;height:30px;background:#ef4444d9}.bg-replace-background-remove:hover{background:#ef4444}.bg-replace-divider{display:flex;align-items:center;gap:12px;padding:0 20px;margin:-4px 0}.bg-replace-divider-line{flex:1;height:1px;background:var(--bg-replace-border, #e5e7eb)}.bg-replace-divider-icon{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:500;color:var(--bg-replace-muted, #9ca3af);white-space:nowrap}.bg-replace-controls{padding:16px 20px 20px;display:flex;flex-direction:column;gap:10px;border-top:1px solid var(--bg-replace-border, #e5e7eb);margin-top:auto}.bg-replace-generate-btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:11px 20px;background:var(--bg-replace-accent, #6366f1);color:#fff;border:none;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;transition:background .15s ease,opacity .15s ease}.bg-replace-generate-btn:hover:not(:disabled){background:var(--bg-replace-accent-hover, #4f46e5)}.bg-replace-generate-btn:disabled{opacity:.45;cursor:not-allowed}.bg-replace-get-tokens-btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:11px 20px;background:transparent;color:var(--bg-replace-accent, #6366f1);border:1.5px solid var(--bg-replace-accent, #6366f1);border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;transition:background .15s ease}.bg-replace-get-tokens-btn:hover{background:var(--bg-replace-accent-subtle, #eef2ff)}.bg-replace-hint{font-size:12px;color:var(--bg-replace-muted, #9ca3af);text-align:center;margin:0}.bg-replace-spinner{animation:bg-replace-spin .8s linear infinite}@keyframes bg-replace-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.bg-replace-output{border:1px solid var(--bg-replace-out-border, #e5e7eb);border-radius:12px;overflow:hidden;background:var(--bg-replace-out-surface, #fff);min-height:220px;display:flex;flex-direction:column}.bg-replace-output-loading{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:48px 24px;color:var(--bg-replace-out-muted, #9ca3af);font-size:14px}.bg-replace-spinner-ring{width:36px;height:36px;border:2.5px solid var(--bg-replace-out-border, #e5e7eb);border-top-color:var(--bg-replace-out-accent, #6366f1);border-radius:50%;animation:bg-replace-out-spin .75s linear infinite}@keyframes bg-replace-out-spin{to{transform:rotate(360deg)}}.bg-replace-output-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:48px 24px;color:var(--bg-replace-out-muted, #9ca3af);font-size:14px;text-align:center}.bg-replace-output-empty-illustration{color:var(--bg-replace-out-muted, #c4c9d4);opacity:.8}.bg-replace-output-content{display:flex;flex-direction:column;gap:0}.bg-replace-output-section{padding:18px 20px;display:flex;flex-direction:column;gap:12px}.bg-replace-output-section+.bg-replace-output-section{border-top:1px solid var(--bg-replace-out-border, #e5e7eb)}.bg-replace-output-section-header{display:flex;align-items:center;gap:8px;color:var(--bg-replace-out-text, #111827)}.bg-replace-output-section-header h3{font-size:13px;font-weight:600;margin:0}.bg-replace-output-count{font-weight:400;color:var(--bg-replace-out-muted, #9ca3af)}.bg-replace-output-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px}.bg-replace-output-image-item{position:relative;border-radius:8px;overflow:hidden;aspect-ratio:1;background:var(--bg-replace-out-subtle, #f9fafb);border:1px solid var(--bg-replace-out-border, #e5e7eb)}.bg-replace-output-image-item img{width:100%;height:100%;object-fit:cover;display:block}.bg-replace-output-download{position:absolute;bottom:6px;right:6px;width:28px;height:28px;background:#0000008c;border-radius:6px;display:flex;align-items:center;justify-content:center;color:#fff;opacity:0;transition:opacity .15s ease;text-decoration:none}.bg-replace-output-image-item:hover .bg-replace-output-download{opacity:1}.bg-replace-output-sources{border-top:1px solid var(--bg-replace-out-border, #e5e7eb);background:var(--bg-replace-out-subtle, #f9fafb)}.bg-replace-output-sources .bg-replace-output-section+.bg-replace-output-section{border-top:none}.bg-replace-output-source-grid{display:flex;flex-wrap:wrap;gap:6px}.bg-replace-output-source-thumb{width:52px;height:52px;border-radius:6px;overflow:hidden;border:1px solid var(--bg-replace-out-border, #e5e7eb);flex-shrink:0;background:var(--bg-replace-out-surface, #fff)}.bg-replace-output-source-thumb img{width:100%;height:100%;object-fit:cover;display:block}.bg-replace-output-background-preview{width:100%;aspect-ratio:16 / 6;border-radius:8px;overflow:hidden;border:1px solid var(--bg-replace-out-border, #e5e7eb)}.bg-replace-output-background-preview img{width:100%;height:100%;object-fit:cover;display:block}.bg-replace-output-source-divider{display:flex;align-items:center;gap:10px;padding:0 20px}.bg-replace-output-source-divider-line{flex:1;height:1px;background:var(--bg-replace-out-border, #e5e7eb)}.bg-replace-output-source-divider-label{display:flex;align-items:center;gap:5px;font-size:11px;font-weight:500;color:var(--bg-replace-out-muted, #9ca3af);white-space:nowrap}.bg-replace-output-timestamp{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--bg-replace-out-muted, #9ca3af);padding:12px 20px;border-top:1px solid var(--bg-replace-out-border, #e5e7eb)}.bg-replace-output-section-header{gap:8px}.bg-replace-download-all-btn{display:inline-flex;align-items:center;gap:6px;margin-left:auto;padding:5px 11px;font-size:12px;font-weight:500;border-radius:6px;border:1px solid var(--border-color, #e2e8f0);background:var(--surface-color, #fff);color:var(--text-color, #1a202c);cursor:pointer;transition:background .15s,opacity .15s;white-space:nowrap}.bg-replace-download-all-btn:hover:not(:disabled){background:var(--surface-hover, #f7fafc)}.bg-replace-download-all-btn:disabled{opacity:.6;cursor:not-allowed}@keyframes bg-replace-spin{to{transform:rotate(360deg)}}.bg-replace-spin{animation:bg-replace-spin .8s linear infinite}.bgrg-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px}.bgrg-item{position:relative;aspect-ratio:1;border-radius:10px;overflow:hidden;cursor:pointer;border:1px solid var(--bgrg-border, #e5e7eb);background:var(--bgrg-subtle, #f9fafb)}.bgrg-item img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .2s ease}.bgrg-item:hover img{transform:scale(1.04)}.bgrg-item-overlay{position:absolute;inset:0;background:#0000;display:flex;align-items:center;justify-content:center;color:#fff;opacity:0;transition:background .18s ease,opacity .18s ease}.bgrg-item:hover .bgrg-item-overlay{background:#0000004d;opacity:1}.bgrg-item-bg-badge{position:absolute;bottom:6px;right:6px;width:32px;height:32px;border-radius:5px;overflow:hidden;border:1.5px solid rgba(255,255,255,.8);box-shadow:0 1px 4px #0003;opacity:0;transition:opacity .18s ease}.bgrg-item:hover .bgrg-item-bg-badge{opacity:1}.bgrg-item-bg-badge img{width:100%;height:100%;object-fit:cover}.bgrg-backdrop{position:fixed;inset:0;background:#000000b3;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:100;display:flex;align-items:center;justify-content:center;padding:24px}.bgrg-modal{position:relative;background:var(--bgrg-surface, #fff);border-radius:14px;overflow:hidden;display:grid;grid-template-columns:1fr 280px;max-width:900px;width:100%;max-height:90vh;box-shadow:0 24px 64px #00000040}.bgrg-modal-close{position:absolute;top:12px;right:12px;z-index:10;width:30px;height:30px;background:#00000080;border:none;border-radius:50%;color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background .15s ease;padding:0}.bgrg-modal-close:hover{background:#000000bf}.bgrg-modal-viewer{position:relative;background:var(--bgrg-subtle, #f1f5f9);display:flex;align-items:center;justify-content:center;min-height:400px;overflow:hidden}.bgrg-modal-viewer img{width:100%;height:100%;object-fit:contain;display:block;max-height:90vh}.bgrg-modal-nav{position:absolute;top:50%;transform:translateY(-50%);width:34px;height:34px;background:#00000073;border:none;border-radius:50%;color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background .15s ease;padding:0}.bgrg-modal-nav:hover{background:#000000b3}.bgrg-modal-nav-prev{left:12px}.bgrg-modal-nav-next{right:12px}.bgrg-modal-pagination{position:absolute;bottom:12px;left:50%;transform:translate(-50%);font-size:11px;font-weight:600;color:#fff;background:#00000073;padding:3px 10px;border-radius:20px}.bgrg-modal-download{position:absolute;bottom:12px;right:12px;display:flex;align-items:center;gap:5px;font-size:11px;font-weight:600;color:#fff;background:#00000073;padding:5px 10px;border-radius:6px;text-decoration:none;transition:background .15s ease}.bgrg-modal-download:hover{background:#000000b3}.bgrg-modal-meta{display:flex;flex-direction:column;gap:16px;border-left:1px solid var(--bgrg-border, #e5e7eb);overflow-y:auto;padding:20px}.bgrg-modal-title{font-size:14px;font-weight:700;color:var(--bgrg-text, #111827);margin:0}.bgrg-modal-section{display:flex;flex-direction:column;gap:8px}.bgrg-modal-label{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--bgrg-muted, #9ca3af)}.bgrg-modal-background-preview{width:100%;aspect-ratio:16 / 7;border-radius:7px;overflow:hidden;border:1px solid var(--bgrg-border, #e5e7eb)}.bgrg-modal-background-preview img{width:100%;height:100%;object-fit:cover;display:block}.bgrg-modal-thumbs{display:flex;flex-wrap:wrap;gap:5px}.bgrg-modal-thumb{width:44px;height:44px;border-radius:5px;overflow:hidden;border:1px solid var(--bgrg-border, #e5e7eb);flex-shrink:0}.bgrg-modal-thumb img{width:100%;height:100%;object-fit:cover;display:block}.bgrg-modal-timestamp{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--bgrg-muted, #9ca3af)}.bgrg-modal-replace-again-btn{display:flex;align-items:center;justify-content:center;gap:7px;width:100%;padding:10px;background:var(--bgrg-accent, #6366f1);color:#fff;border:none;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;transition:background .15s ease}.bgrg-modal-replace-again-btn:hover{background:var(--bgrg-accent-hover, #4f46e5)}.bgrg-item-count-badge{position:absolute;top:8px;left:8px;display:flex;align-items:center;gap:4px;padding:3px 7px;border-radius:999px;background:#0000008c;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);color:#fff;font-size:11px;font-weight:600;line-height:1;pointer-events:none}.bgrg-modal-thumbstrip{position:absolute;bottom:52px;left:50%;transform:translate(-50%);display:flex;gap:6px;padding:6px 8px;background:#00000073;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);border-radius:10px;max-width:90%;overflow-x:auto}.bgrg-modal-thumbstrip-item{flex-shrink:0;width:44px;height:44px;border-radius:6px;overflow:hidden;border:2px solid transparent;padding:0;cursor:pointer;background:none;opacity:.65;transition:opacity .15s,border-color .15s}.bgrg-modal-thumbstrip-item:hover{opacity:.9}.bgrg-modal-thumbstrip-item.active{border-color:#fff;opacity:1}.bgrg-modal-thumbstrip-item img{width:100%;height:100%;object-fit:cover;display:block}.bgrg-modal-download-all-btn{display:flex;align-items:center;justify-content:center;gap:7px;width:100%;padding:9px 14px;margin-top:auto;margin-bottom:0;border-radius:8px;border:1.5px solid currentColor;background:transparent;color:inherit;font-size:13px;font-weight:500;cursor:pointer;opacity:.8;transition:opacity .15s}.bgrg-modal-download-all-btn:hover:not(:disabled){opacity:1}.bgrg-modal-download-all-btn:disabled{cursor:default;opacity:.5}.bgrg-spin{animation:bgrg-spin .8s linear infinite;transform-origin:center}@keyframes bgrg-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
