/* extracted from public/tools/imagereplace.html — DO NOT EDIT */
* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
            background: var(--color-bg);
            min-height: 100vh;
            color: #333;
            visibility: visible;
        }

        /* 导航栏 */
        /* navbar 和 nav-container 的核心样式已移至 style-shared.css */
 .v2-legacy-mount .navbar {
            z-index: 100;
        } .v2-legacy-mount .logo {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--color-fg);
            text-decoration: none;
            letter-spacing: -0.025em;
        } .v2-legacy-mount .nav-links {
            display: flex;
            gap: 2rem;
            list-style: none;
        } .v2-legacy-mount .nav-links a {
            color: var(--color-fg-muted);
            text-decoration: none;
            font-weight: 500;
            font-size: 0.95rem;
            transition: all 0.2s ease;
            padding: 0.5rem 1rem;
            border-radius: 12px;
            position: relative;
        } .v2-legacy-mount .nav-links a:hover,
 .v2-legacy-mount .nav-links a.active {
            color: var(--color-fg);
            background: rgba(15, 23, 42, 0.1);
        }

        /* 语言切换器样式 */
        .language-switcher {
            display: flex;
            align-items: center;
            margin-left: 1rem;
        }

        .lang-toggle {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .lang-label {
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--color-fg-muted);
            cursor: pointer;
            transition: all 0.2s ease;
            user-select: none;
        }

        .lang-label.active {
            color: var(--color-fg);
            font-weight: 600;
        }

        .toggle-switch {
            position: relative;
            width: 44px;
            height: 24px;
            background: var(--color-border);
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .toggle-switch.active {
            background: var(--color-fg);
        }

        .toggle-slider {
            position: absolute;
            top: 2px;
            left: 2px;
            width: 20px;
            height: 20px;
            background: var(--color-surface);
            border-radius: 50%;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .toggle-switch.active .toggle-slider {
            transform: translateX(20px);
        }

        /* 主容器 */
        .main-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem;
            display: grid;
            grid-template-columns: 1fr;
            gap: 2rem;
            min-height: calc(100vh - 100px);
        }

        /* 工具栏 */
        .toolbar {
            background: var(--color-surface);
            border-radius: 20px;
            padding: 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(15, 23, 42, 0.1);
        }

        .toolbar-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--color-fg);
        }

        .toolbar-actions {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
        }

        /* 按钮样式 */
 .v2-legacy-mount .btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem 1.5rem;
            background: linear-gradient(135deg, var(--color-fg) 0%, var(--color-fg) 100%);
            color: var(--color-surface);
            text-decoration: none;
            border: none;
            font-weight: 600;
            font-size: 1rem;
            transition: all 0.3s ease;
            cursor: pointer;
            border-radius: 12px;
        } .v2-legacy-mount .btn:hover {
            background: linear-gradient(135deg, var(--color-fg) 0%, var(--color-fg-muted) 100%);
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(15, 23, 42, 0.3);
        } .v2-legacy-mount .btn-primary {
            background: var(--color-primary);
        } .v2-legacy-mount .btn-primary:hover {
            background: linear-gradient(135deg, var(--color-fg) 0%, var(--color-fg-muted) 100%);
        } .v2-legacy-mount .btn-secondary {
            background: var(--color-surface);
            color: var(--color-fg);
            border: 1px solid rgba(15, 23, 42, 0.2);
        } .v2-legacy-mount .btn-secondary:hover {
            background: var(--color-bg);
            color: var(--color-fg);
            border-color: var(--color-fg);
        } .v2-legacy-mount .btn:disabled {
            background: #d1d5db;
            color: var(--color-fg-muted);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        /* 工作区域 */
        .workspace {
            display: grid;
            grid-template-columns: 40% 60%;
            gap: 2rem;
            min-height: 600px;
        }

        /* 预览区域 */
        .preview-panel {
            background: var(--color-surface);
            border-radius: 20px;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            border: 1px solid rgba(15, 23, 42, 0.1);
        }

        .preview-header {
            background: var(--color-fg);
            color: var(--color-surface);
            padding: 1rem;
            font-weight: 700;
            border-radius: 20px 20px 0 0;
        }

        .preview-content {
            flex: 1;
            padding: 2rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .lottie-preview {
            width: 100%;
            max-width: 300px;
            height: 300px;
            border-radius: 16px;
            background: var(--color-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 1rem;
            border: 1px solid rgba(15, 23, 42, 0.1);
        }

        .preview-controls {
            display: flex;
            gap: 0.5rem;
            margin-top: 1rem;
        }

        .control-btn {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: var(--color-surface);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            transition: all 0.3s ease;
            border: 1px solid rgba(15, 23, 42, 0.2);
        }

        .control-btn:hover {
            background: var(--color-bg);
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(15, 23, 42, 0.2);
        }

        /* 图片管理区域 */
        .image-panel {
            background: var(--color-surface);
            border-radius: 20px;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            border: 1px solid rgba(15, 23, 42, 0.1);
        }

        .image-header {
            background: var(--color-fg);
            color: var(--color-surface);
            padding: 1rem;
            font-weight: 700;
            border-radius: 20px 20px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .image-search {
            padding: 0.5rem;
            border-radius: 8px;
            background: var(--color-surface);
            color: var(--color-fg);
            width: 200px;
            font-size: 0.9rem;
            border: none;
        }

        .image-content {
            flex: 1;
            padding: 1rem;
            overflow-y: auto;
        }

        /* 上传区域 */
        .upload-area {
            border: 2px dashed #d1d5db;
            padding: 3rem 2rem;
            text-align: center;
            background: var(--color-bg);
            transition: all 0.3s ease;
            cursor: pointer;
            margin-bottom: 2rem;
            border-radius: 16px;
        }

        .upload-area:hover {
            border-color: var(--color-fg);
            background: var(--color-surface);
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
        }

        .upload-area.dragover {
            border-color: var(--color-fg);
            background: var(--color-surface);
            transform: scale(1.02);
        }

        .upload-icon {
            font-size: 3rem;
            margin-bottom: 1rem;
            display: block;
            color: var(--color-fg-muted);
        }

        .upload-text {
            font-size: 1.2rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--color-fg);
        }

        .upload-hint {
            font-size: 0.9rem;
            color: var(--color-fg-muted);
            margin-bottom: 1rem;
        }

        /* 图片画廊 */
        .image-gallery {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 1rem;
        }

        .image-item {
            border-radius: 12px;
            background: var(--color-surface);
            overflow: hidden;
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            border: 1px solid rgba(15, 23, 42, 0.1);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }

        .image-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
        }

        .image-item.selected {
            border-color: var(--color-fg);
            box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.2);
        }

        .image-preview {
            width: 100%;
            height: 120px;
            object-fit: cover;
            display: block;
        }

        .image-info {
            padding: 0.5rem;
            font-size: 0.8rem;
            background: var(--color-bg);
            border-top: 1px solid rgba(15, 23, 42, 0.1);
        }

        .image-name {
            font-weight: 600;
            margin-bottom: 0.2rem;
            word-break: break-all;
            color: var(--color-fg);
        }

        .image-size {
            color: var(--color-fg-muted);
            font-size: 0.7rem;
        }

        .image-actions {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            display: flex;
            gap: 0.2rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .image-item:hover .image-actions {
            opacity: 1;
        }

        .action-btn {
            width: 24px;
            height: 24px;
            background: rgba(15, 23, 42, 0.9);
            color: var(--color-surface);
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            transition: all 0.3s ease;
            border-radius: 6px;
        }

        .action-btn:hover {
            background: var(--color-fg);
            transform: scale(1.1);
        }

        /* 加载状态 */
 .v2-legacy-mount .loading {
            display: none;
            text-align: center;
            padding: 2rem;
            font-size: 1.1rem;
            color: var(--color-fg-muted);
        }

        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid var(--color-bg);
            border-top: 4px solid var(--color-fg);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 1rem;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 空状态 */
        .empty-state {
            text-align: center;
            padding: 3rem 2rem;
            color: var(--color-fg-muted);
        }

        .empty-icon {
            font-size: 4rem;
            margin-bottom: 1rem;
            display: block;
        }

        /* AI重绘相关样式 */
        .ai-section {
            background: linear-gradient(135deg, var(--color-fg) 0%, var(--color-fg) 100%);
            color: var(--color-surface);
            padding: 1rem;
            margin-bottom: 1rem;
            border-radius: 16px;
            box-shadow: 0 8px 30px rgba(15, 23, 42, 0.3);
        }

        .ai-section h3 {
            margin-bottom: 1rem;
            font-size: 1.2rem;
        }

        .ai-controls {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
            align-items: center;
        }

        .ai-usage {
            background: rgba(255,255,255,0.2);
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.9rem;
            font-weight: 600;
        }

        .style-selector {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }

        .style-btn {
            padding: 0.5rem 1rem;
            background: var(--color-surface);
            color: var(--color-fg);
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            border: none;
        }

        .style-btn:hover, .style-btn.active {
            background: #fef3c7;
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }

        .ai-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.8);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .ai-modal-content {
            background: var(--color-surface);
            border-radius: 20px;
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
            width: 90%;
            max-width: 600px;
            max-height: 80vh;
            overflow-y: auto;
            border: 1px solid rgba(15, 23, 42, 0.2);
        }

        .ai-modal-header {
            background: var(--color-fg);
            color: var(--color-surface);
            padding: 1rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-radius: 20px 20px 0 0;
        }

        .ai-modal-body {
            padding: 2rem;
        }

        .ai-preview-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2rem;
            margin-bottom: 2rem;
        }

        .ai-preview-box {
            text-align: center;
        }

        .ai-preview-box h4 {
            margin-bottom: 1rem;
            font-size: 1.1rem;
        }

        .ai-preview-img {
            width: 100%;
            max-width: 200px;
            height: 200px;
            object-fit: cover;
            border: 3px solid #333;
            margin-bottom: 1rem;
        }

        .ai-processing {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 200px;
            color: var(--color-fg-muted);
        }

        .ai-settings {
            margin-bottom: 2rem;
        }

        .ai-setting-group {
            margin-bottom: 1.5rem;
        }

        .ai-setting-group label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 600;
            color: var(--color-fg);
        }

        .ai-slider {
            width: 100%;
            height: 8px;
            background: var(--color-border);
            border: 2px solid #d1d5db;
            outline: none;
            -webkit-appearance: none;
            border-radius: 4px;
        }

        .ai-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 20px;
            height: 20px;
            background: var(--color-fg);
            border: 2px solid #d1d5db;
            cursor: pointer;
            border-radius: 50%;
        }

        .ai-prompt-input {
            width: 100%;
            padding: 1rem;
            border: 2px solid var(--color-border);
            font-size: 1rem;
            resize: vertical;
            min-height: 80px;
            border-radius: 8px;
            color: var(--color-fg);
        }

        .ai-actions {
            display: flex;
            gap: 1rem;
            justify-content: flex-end;
        }

        .ai-progress {
            background: var(--color-bg);
            border: 2px solid var(--color-border);
            padding: 1rem;
            margin-bottom: 1rem;
            display: none;
            border-radius: 12px;
        }

        .ai-progress-bar {
            width: 100%;
            height: 20px;
            background: var(--color-border);
            border: 2px solid #d1d5db;
            overflow: hidden;
            border-radius: 4px;
        }

        .ai-progress-fill {
            height: 100%;
            background: #fef3c7;
            transition: width 0.3s ease;
            width: 0%;
            border-radius: 4px;
        }

        .ai-batch-controls {
            background: rgba(255,255,255,0.1);
            padding: 1rem;
            margin-top: 1rem;
            border: 2px solid rgba(255,255,255,0.3);
            border-radius: 12px;
        }

        .checkbox-group {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }

        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            background: rgba(255,255,255,0.2);
            padding: 0.5rem;
            border-radius: 8px;
        }

        .checkbox-item input[type="checkbox"] {
            transform: scale(1.2);
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .workspace {
                grid-template-columns: 1fr;
                gap: 1rem;
            }

            .main-container {
                padding: 1rem;
            }

            .toolbar {
                flex-direction: column;
                align-items: stretch;
                text-align: center;
            }

            .toolbar-actions {
                justify-content: center;
            } .v2-legacy-mount .nav-links {
                display: none;
            }

            .image-gallery {
                grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
                gap: 0.5rem;
            }

            .image-preview {
                height: 100px;
            }

            .ai-preview-container {
                grid-template-columns: 1fr;
                gap: 1rem;
            }

            .ai-controls {
                flex-direction: column;
                align-items: stretch;
            }

            .style-selector {
                justify-content: center;
            }
        }

        /* ===== V1.3.0 新增样式 ===== */

        /* 画廊统计栏 */
        .gallery-stats {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.6rem 1rem;
            background: var(--color-bg);
            border-bottom: 1px solid rgba(15, 23, 42, 0.08);
            font-size: 0.82rem;
            color: var(--color-fg-muted);
            border-radius: 0;
        }
        .gallery-stats .stat-replaced {
            color: #16a34a;
            font-weight: 600;
        }

        /* 图片状态徽章 */
        .img-badge {
            position: absolute;
            top: 0.35rem;
            left: 0.35rem;
            font-size: 0.65rem;
            font-weight: 700;
            padding: 2px 6px;
            border-radius: 20px;
            line-height: 1.4;
            pointer-events: none;
            z-index: 2;
        }
        .img-badge.replaced {
            background: #16a34a;
            color: var(--color-surface);
        }
        .img-badge.adjusted {
            background: #2563eb;
            color: var(--color-surface);
            top: 1.6rem;
        }

        /* 恢复原图按钮（图片卡片内，hover 显示） */
        .btn-reset-img {
            width: auto;
            padding: 2px 7px;
            font-size: 0.7rem;
            background: rgba(239,68,68,0.9);
            color: var(--color-surface);
            border: none;
            border-radius: 6px;
            cursor: pointer;
            var(--color-surface)-space: nowrap;
        }
        .btn-reset-img:hover { background: #dc2626; }

        /* 微调按钮 */
        .btn-adjust-img {
            width: auto;
            padding: 2px 7px;
            font-size: 0.7rem;
            background: rgba(37,99,235,0.9);
            color: var(--color-surface);
            border: none;
            border-radius: 6px;
            cursor: pointer;
            var(--color-surface)-space: nowrap;
        }
        .btn-adjust-img:hover { background: #1d4ed8; }

        /* 适配模式选择弹窗 */
        .fit-modal-overlay {
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.6);
            display: flex; align-items: center; justify-content: center;
            z-index: 2000;
        }
        .fit-modal {
            background: var(--color-surface);
            border-radius: 20px;
            padding: 2rem;
            width: 460px;
            max-width: 95vw;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        }
        .fit-modal h3 {
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 0.4rem;
            color: var(--color-fg);
        }
        .fit-modal .size-hint {
            font-size: 0.82rem;
            color: var(--color-fg-muted);
            margin-bottom: 1.2rem;
        }
        .fit-options {
            display: grid;
            grid-template-columns: repeat(3,1fr);
            gap: 0.75rem;
            margin-bottom: 1.5rem;
        }
        .fit-option {
            border: 2px solid var(--color-border);
            border-radius: 12px;
            padding: 0.8rem 0.5rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
        }
        .fit-option:hover, .fit-option.active {
            border-color: var(--color-fg);
            background: var(--color-bg);
        }
        .fit-option .fit-icon { font-size: 1.8rem; display: block; margin-bottom: 0.4rem; }
        .fit-option .fit-name { font-size: 0.82rem; font-weight: 700; color: var(--color-fg); }
        .fit-option .fit-desc { font-size: 0.7rem; color: var(--color-fg-muted); margin-top: 0.2rem; }
        .fit-preview-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }
        .fit-preview-box { text-align: center; }
        .fit-preview-box p { font-size: 0.75rem; color: var(--color-fg-muted); margin-bottom: 0.4rem; }
        .fit-preview-canvas {
            width: 100%;
            max-width: 160px;
            height: 120px;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            object-fit: contain;
            background: repeating-conic-gradient(var(--color-border) 0% 25%, var(--color-surface) 0% 50%) 0 0/16px 16px;
        }
        .fit-modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

        /* 微调面板弹窗 */
        .adjust-modal-overlay {
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.6);
            display: flex; align-items: center; justify-content: center;
            z-index: 2000;
        }
        .adjust-modal {
            background: var(--color-surface);
            border-radius: 20px;
            padding: 2rem;
            width: 500px;
            max-width: 95vw;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        }
        .adjust-modal h3 {
            font-size: 1.1rem; font-weight: 700;
            margin-bottom: 1.5rem; color: var(--color-fg);
        }
        .adjust-row {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1.2rem;
        }
        .adjust-row label {
            width: 80px; font-size: 0.85rem;
            font-weight: 600; color: var(--color-fg);
            flex-shrink: 0;
        }
        .adjust-row input[type=range] {
            flex: 1;
            height: 6px; background: var(--color-border);
            border: none; outline: none;
            -webkit-appearance: none; border-radius: 3px; cursor: pointer;
        }
        .adjust-row input[type=range]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 18px; height: 18px;
            background: var(--color-fg); border-radius: 50%; cursor: pointer;
        }
        .adjust-row input[type=number] {
            width: 64px; padding: 4px 6px;
            border: 1px solid #d1d5db; border-radius: 6px;
            font-size: 0.85rem; text-align: center;
        }
        .adjust-reset { font-size: 0.78rem; color: var(--color-fg-muted); cursor: pointer; text-decoration: underline; }
        .adjust-modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

        /* 导出下拉 */
        .export-dropdown-wrap {
            position: relative;
            display: inline-flex;
        }
        .export-dropdown-menu {
            display: none;
            position: absolute;
            bottom: calc(100% + 6px);
            right: 0;
            background: var(--color-surface);
            border: 1px solid rgba(15, 23, 42, 0.15);
            border-radius: 12px;
            box-shadow: 0 8px 30px rgba(0,0,0,0.15);
            min-width: 220px;
            z-index: 500;
            overflow: hidden;
        }
        .export-dropdown-menu.open { display: block; }
        .export-menu-item {
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
            padding: 0.85rem 1rem;
            cursor: pointer;
            transition: background 0.15s;
            border-bottom: 1px solid var(--color-bg);
        }
        .export-menu-item:last-child { border-bottom: none; }
        .export-menu-item:hover { background: var(--color-bg); }
        .export-menu-item .emi-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
        .export-menu-item .emi-label { font-size: 0.88rem; font-weight: 700; color: var(--color-fg); }
        .export-menu-item .emi-desc { font-size: 0.75rem; color: var(--color-fg-muted); margin-top: 1px; }
        .export-size-hint {
            font-size: 0.75rem;
            color: var(--color-fg-muted);
            padding: 0.4rem 1rem;
            background: var(--color-bg);
            border-top: 1px solid var(--color-bg);
            text-align: right;
        }