/* =========================================================
   在线图片去背景 - 样式
   文件：/bg/bg_20261009.css
   ========================================================= */

:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff6ff;
    --text: #0f172a;
    --text-sub: #475569;
    --text-muted: #94a3b8;
    --line: #e2e8f0;
    --bg-page: #f8fafc;
    --danger: #dc2626;
    --ok: #16a34a;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg-page);
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
p { margin: 0; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--brand-soft); color: var(--brand); flex: none;
}
.brand-title { font-size: 16px; font-weight: 700; }
.brand-subtitle { font-size: 12px; color: var(--text-muted); }
.nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav a { color: var(--text-sub); }
.nav a:hover { color: var(--brand); text-decoration: none; }

/* ---------------- 区块 ---------------- */
.section { padding: 28px 0; }
.section-head { margin-bottom: 18px; text-align: center; }
.section-tag {
    display: inline-block; margin-bottom: 6px; padding: 2px 10px;
    font-size: 12px; color: var(--brand); background: var(--brand-soft); border-radius: 999px;
}
.section-title { font-size: 22px; margin-bottom: 6px; }
.section-copy { color: var(--text-sub); font-size: 14px; max-width: 780px; margin: 0 auto; }

.hero { text-align: center; padding: 10px 0 22px; }
.hero-title { font-size: 24px; margin-bottom: 10px; }
.hero-desc { color: var(--text-sub); font-size: 15px; max-width: 820px; margin: 0 auto 10px; }
.hero-free { font-size: 13px; color: var(--text-muted); }
.hero-free strong { color: var(--brand); }

/* ---------------- 工具区 ---------------- */
.tool-shell {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px;
}

.drop-zone {
    border: 2px dashed #cbd5e1; border-radius: var(--radius);
    background: #fbfdff; padding: 32px 16px; text-align: center;
    cursor: pointer; transition: border-color .18s, background .18s;
}
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.drop-zone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone.is-busy { pointer-events: none; opacity: .6; }
.drop-icon { color: var(--brand); display: flex; justify-content: center; margin-bottom: 10px; }
.drop-icon svg { width: 40px; height: 40px; }
.drop-main { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.drop-sub { font-size: 13px; color: var(--text-muted); }

.list-wrap { margin-top: 16px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.list-head h3 { font-size: 15px; }
.list-head h3 span { color: var(--brand); }
.link-btn {
    border: 0; background: none; padding: 0; font-size: 13px;
    color: var(--text-muted); cursor: pointer; font-family: inherit;
}
.link-btn:hover { color: var(--brand); text-decoration: underline; }

.list-grid {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.list-item {
    position: relative; border: 1px solid var(--line); border-radius: 10px;
    overflow: hidden; background: #fff;
}
.list-item .thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg-page); }
.list-item .item-name {
    padding: 4px 6px; font-size: 11px; color: var(--text-sub);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item .item-badge {
    position: absolute; top: 4px; left: 4px; padding: 1px 6px;
    font-size: 11px; border-radius: 999px; background: rgba(15, 23, 42, .72); color: #fff;
}
.list-item .item-badge.doing { background: var(--brand); }
.list-item .item-badge.done { background: var(--ok); }
.list-item .item-badge.fail { background: var(--danger); }
.list-item .item-del {
    position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
    border: 0; border-radius: 50%; line-height: 1; font-size: 14px; cursor: pointer;
    background: rgba(15, 23, 42, .6); color: #fff;
}
/* 失败原因：最多显示 2 行（原来是 nowrap + 单行省略号，导致只看到半句话） */
.list-item .item-msg {
    padding: 0 6px 6px; font-size: 11px; line-height: 1.45; color: var(--danger);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-all;
}

/* ---------------- 处理方式：去背景 / 换背景 ---------------- */
.mode-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
    margin-top: 16px; padding: 12px 14px;
    background: #fbfdff; border: 1px solid var(--line); border-radius: 10px;
}
.mode-bar.is-locked { opacity: .55; pointer-events: none; }
.mode-group, .color-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.color-group[hidden] { display: none; }
.mode-label { font-size: 13px; font-weight: 600; color: var(--text-sub); }
.mode-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--text); cursor: pointer; }
.mode-opt input { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--brand); }

.color-swatch, .color-custom {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px 5px 8px; font-size: 13px; font-family: inherit;
    color: var(--text-sub); background: #fff;
    border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.color-swatch::before {
    content: ''; width: 16px; height: 16px; border-radius: 50%;
    background: var(--swatch, #fff); border: 1px solid rgba(15, 23, 42, .12);
}
.color-swatch:hover, .color-custom:hover { border-color: var(--brand); color: var(--brand); }
.color-swatch.active, .color-custom.active {
    border-color: var(--brand); color: var(--brand);
    background: var(--brand-soft); font-weight: 600;
}
.color-custom input[type="color"] {
    width: 20px; height: 20px; padding: 0; border: 0; background: none; cursor: pointer;
}

.action-bar { display: flex; gap: 10px; margin-top: 16px; }
.btn-primary, .btn-ghost {
    flex: 1; padding: 12px 16px; border-radius: 10px; font-size: 15px;
    font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: .18s;
}
.btn-primary { background: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-primary:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text-sub); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.progress-wrap { margin-top: 14px; }
.progress-track { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #60a5fa, var(--brand)); transition: width .25s; }
.progress-text { margin-top: 8px; font-size: 13px; color: var(--text-sub); text-align: center; }

.flash { margin-top: 12px; font-size: 13px; text-align: center; min-height: 20px; }
.flash.ok { color: var(--ok); }
.flash.bad { color: var(--danger); }
.flash.loading { color: var(--brand); }

/* ---------------- 结果区 ---------------- */
.results {
    margin-top: 20px; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.results-head h2 { font-size: 18px; margin-bottom: 4px; }
.results-note { font-size: 13px; color: var(--text-muted); }
.results-summary { margin-top: 8px; font-size: 13px; color: var(--text-sub); }
.results-grid {
    margin-top: 14px; display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.bg-card {
    margin: 0; border: 1px solid var(--line); border-radius: 10px;
    overflow: hidden; background: #fff; display: flex; flex-direction: column;
}
.bg-canvas {
    /* 棋盘格：直观表示背景是透明的 */
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%),
        linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
    padding: 8px;
}
/* 换背景结果：纯色底不透明，去掉棋盘格避免边缘出现格子 */
.bg-canvas--solid { background-image: none; background-color: #f6f8fb; }
.bg-canvas img { width: 100%; height: 200px; object-fit: contain; }
.bg-card-body { padding: 8px 10px 10px; }
.bg-card-name {
    display: block; font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bg-card-meta { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.bg-card-tip { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.btn-download {
    display: block; margin-top: 8px; padding: 9px 12px; text-align: center;
    background: var(--brand); color: #fff; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.btn-download:hover { background: var(--brand-dark); text-decoration: none; }

/* ---------------- 效果演示：可拖动竖线对比 ---------------- */
.compare-wrap { display: flex; justify-content: center; }

.compare {
    --pos: 50%;
    position: relative;
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y; /* 手机上竖向手势交给页面滚动，横向手势由滑块接管 */
    /* 棋盘格：表示去背景结果是透明背景 */
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%),
        linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}
.compare:focus-within { box-shadow: 0 0 0 3px rgba(37, 99, 235, .3), var(--shadow); }

.compare-layer img {
    display: block; width: 100%; height: 100%;
    object-fit: cover; pointer-events: none; -webkit-user-drag: none;
}

/* 底层：结果图（在正常流中，负责撑开容器高度） */
.compare-after { position: relative; z-index: 1; }
.compare-after img { height: auto; }

/* 上层：原图，只保留分隔线左边部分 */
.compare-before { position: absolute; inset: 0; z-index: 1; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }

/* 分隔线与拖动手柄 */
.compare-line {
    position: absolute; top: 0; bottom: 0;
    left: var(--pos); width: 2px; margin-left: -1px;
    background: #fff; box-shadow: 0 0 8px rgba(15, 23, 42, .4);
    pointer-events: none; z-index: 2;
}
.compare-handle {
    position: absolute; top: 50%; left: 50%;
    width: 38px; height: 38px; margin: -19px 0 0 -19px;
    background: #fff; border-radius: 50%;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .3);
}
.compare-handle::before,
.compare-handle::after { content: ''; position: absolute; top: 50%; margin-top: -5px; border-style: solid; }
.compare-handle::before { left: 9px; border-width: 5px 6px 5px 0; border-color: transparent var(--brand) transparent transparent; }
.compare-handle::after { right: 9px; border-width: 5px 0 5px 6px; border-color: transparent transparent transparent var(--brand); }

.compare-tag {
    position: absolute; top: 10px; z-index: 2;
    padding: 3px 10px; font-size: 12px; line-height: 1.5;
    color: #fff; background: rgba(15, 23, 42, .62); border-radius: 999px;
    pointer-events: none;
}
.compare-tag-left { left: 10px; }
.compare-tag-right { right: 10px; }

/* 透明的 range 滑块，铺满整个对比区，负责接收鼠标/触摸/键盘操作 */
.compare-range {
    position: absolute; inset: 0; z-index: 3;
    width: 100%; height: 100%; margin: 0; padding: 0;
    opacity: 0; cursor: ew-resize; background: transparent;
    -webkit-appearance: none; appearance: none;
    touch-action: pan-y;
}
.compare-range::-webkit-slider-runnable-track { height: 100%; background: transparent; border: 0; }
.compare-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 64px; height: 100%; background: transparent; border: 0; cursor: ew-resize;
}
.compare-range::-moz-range-track { height: 100%; background: transparent; border: 0; }
.compare-range::-moz-range-thumb { width: 64px; height: 100%; background: transparent; border: 0; cursor: ew-resize; }

.compare-tip { margin-top: 12px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* ---------------- 内容区 ---------------- */
.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.info-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow);
}
.info-index { display: block; font-size: 13px; font-weight: 700; color: var(--brand); margin-bottom: 4px; }
.info-card h3 { font-size: 16px; margin-bottom: 6px; }
.info-card p { font-size: 14px; color: var(--text-sub); }

.faq-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px; margin: 0; box-shadow: var(--shadow); }
.faq-list dt { font-weight: 600; margin-top: 14px; font-size: 15px; }
.faq-list dt:first-child { margin-top: 8px; }
.faq-list dd { margin: 6px 0 14px; font-size: 14px; color: var(--text-sub); }

.usecase-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 16px 34px; margin: 0; box-shadow: var(--shadow); }
.usecase-list li { font-size: 14px; color: var(--text-sub); margin-bottom: 8px; }
.usecase-list li:last-child { margin-bottom: 0; }
.usecase-list strong { color: var(--text); }

.more-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.more-links a {
    padding: 7px 14px; background: #fff; border: 1px solid var(--line);
    border-radius: 999px; font-size: 14px; color: var(--text-sub);
}
.more-links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------------- 页脚 ---------------- */
.footer { padding: 26px 0 34px; text-align: center; border-top: 1px solid var(--line); margin-top: 10px; background: #fff; }
.footer-copy { font-size: 13px; color: var(--text-muted); }
.footer-contact { margin-top: 8px; font-size: 13px; }

/* ---------------- H5 ---------------- */
@media (max-width: 640px) {
    body { font-size: 14px; }
    .wrap { padding: 0 12px; }
    .topbar-inner { height: 56px; }
    .brand-subtitle { display: none; }
    .brand-title { font-size: 15px; }
    .nav { gap: 10px; font-size: 13px; }
    .section { padding: 20px 0; }
    .hero { padding: 4px 0 16px; }
    .hero-title { font-size: 20px; }
    .hero-desc { font-size: 14px; }
    .section-title { font-size: 19px; }
    .tool-shell { padding: 12px; }
    .drop-zone { padding: 24px 12px; }
    .drop-icon svg { width: 34px; height: 34px; }
    .drop-main { font-size: 15px; }
    .action-bar { flex-direction: column-reverse; }
    .list-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
    .results-grid { grid-template-columns: 1fr; }
    .bg-canvas img { height: 240px; }
    .compare { max-width: 100%; }
    .compare-handle { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
    .compare-handle::before { left: 8px; }
    .compare-handle::after { right: 8px; }
    .compare-tag { top: 8px; font-size: 11px; padding: 2px 8px; }
    .compare-tag-left { left: 8px; }
    .compare-tag-right { right: 8px; }
    .mode-bar { gap: 10px 14px; padding: 10px 12px; }
    .mode-group, .color-group { gap: 8px; }
    .mode-opt { font-size: 13px; }
    .color-swatch, .color-custom { padding: 4px 10px 4px 6px; font-size: 12px; }
    .color-swatch::before { width: 14px; height: 14px; }
    .info-card { padding: 14px; }
}
