/* ================================================
   虚拟试穿 — 全站样式
   ================================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.08);
    --radius: 20px;
    --radius-sm: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background: #f8fafc;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
}

/* ================================================================
    背景光晕层 — 有机椭圆漂浮
    ================================================================ */

/* 三组不同的椭圆漂浮轨迹，避免机械感 */
@keyframes driftA {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(40px, -25px) scale(1.06); }
    50%  { transform: translate(70px, 18px) scale(1.13); }
    75%  { transform: translate(15px, 35px) scale(1.04); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes driftB {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(-55px, -20px) scale(1.09); }
    50%  { transform: translate(-25px, 30px) scale(1.16); }
    75%  { transform: translate(20px, -38px) scale(1.05); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes driftC {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(-30px, 45px) scale(1.10); }
    50%  { transform: translate(35px, -10px) scale(1.07); }
    75%  { transform: translate(-40px, -25px) scale(1.12); }
    100% { transform: translate(0, 0) scale(1); }
}

.glow-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.glow {
    position: absolute;
    border-radius: 50%;
}

.glow-1 {
    width: 500px; height: 500px;
    background: #7B61FF;
    top: -15%; left: -10%;
    opacity: 0.16; filter: blur(140px);
    animation: driftA 18s ease-in-out infinite;
}
.glow-2 {
    width: 560px; height: 560px;
    background: #36D399;
    bottom: -12%; right: -10%;
    opacity: 0.28; filter: blur(150px);
    animation: driftB 22s ease-in-out infinite;
    animation-delay: -4s;
}
.glow-3 {
    width: 400px; height: 400px;
    background: #36D399;
    top: -8%; right: 20%;
    opacity: 0.20; filter: blur(120px);
    animation: driftC 20s ease-in-out infinite;
    animation-delay: -7s;
}
.glow-4 {
    width: 460px; height: 460px;
    background: #22A7F0;
    top: 60%; left: -8%;
    opacity: 0.28; filter: blur(130px);
    animation: driftA 24s ease-in-out infinite;
    animation-delay: -10s;
}
.glow-5 {
    width: 480px; height: 480px;
    background: #7B61FF;
    top: -20%; right: -8%;
    opacity: 0.22; filter: blur(140px);
    animation: driftB 19s ease-in-out infinite;
    animation-delay: -13s;
}
.glow-6 {
    width: 400px; height: 400px;
    background: #7B61FF;
    top: 52%; left: 26%;
    opacity: 0.12; filter: blur(130px);
    animation: driftC 21s ease-in-out infinite;
    animation-delay: -6s;
}

/* 确保内容始终在光晕上层 */
.header,
.showcase,
.main,
.modal-overlay,
.loading-overlay,
.lightbox-overlay,
.toast {
    position: relative;
    z-index: 1;
}

/* ================================================================
   首页展示区
   ================================================================ */
.showcase {
    padding: 60px 40px 40px;
}
.showcase-hero {
    display: flex; align-items: center; gap: 60px;
    max-width: 1420px; margin: 0 auto 0;
    padding: 0 16px;
}
.showcase-text { flex: 0.82; min-width: 0; }
.showcase-text h1 {
    font-size: 84px; font-weight: 600; color: #1e293b;
    line-height: 1.05; margin-bottom: 20px;
}
.showcase-subtitle { font-size: 30px; color: var(--text); margin-bottom: 32px; line-height: 1.4; }
.showcase-tags { display: flex; gap: 16px; margin-bottom: 40px; flex-wrap: wrap; }
.showcase-tags span {
    font-size: 18px; color: var(--text-muted);
    background: rgba(255,255,255,0.6); padding: 6px 16px;
    border-radius: 22px; white-space: nowrap;
}
.showcase-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.btn-demo-link {
    color: #94a3b8; text-decoration: none; font-size: 17px;
    transition: color .2s; cursor: pointer;
}
.btn-demo-link:hover { color: var(--primary); }
.btn-cta {
    padding: 16px 42px; border: none; border-radius: 24px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff; font-size: 26px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, .35);
    transition: all .2s;
}
.btn-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(99, 102, 241, .5); }
.btn-cta-outline {
    background: transparent; color: var(--primary);
    border: 1.5px solid var(--primary);
    box-shadow: none;
}
.btn-cta-outline:hover { background: var(--primary-light); box-shadow: none; }
.showcase-note { font-size: 13px; color: #94a3b8; }
.showcase-demo {
    flex: 1.18; min-width: 0;
    position: relative;
    overflow: visible;   /* 允许碎片飞出边界 */
}
#showcaseFx {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    /* width/height/top/left 由 JS 动态计算 */
}
.showcase-demo img {
    width: 100%; display: block;
    transition: opacity 0.6s ease;
    opacity: 1;
    transform: scale(1.2);
}
.showcase-demo img.fade-out { opacity: 0; }

/* 轮播导航点 */
.showcase-dots {
    display: flex; justify-content: center; gap: 10px;
    margin-top: 40px;
    position: relative; z-index: 1;
}
.showcase-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    border: none; cursor: pointer;
    transition: background 0.25s, transform 0.25s;
    padding: 0;
}
.showcase-dot.active { background: var(--primary); transform: scale(1.3); }
.showcase-dot:hover { background: #94a3b8; }

.showcase-features {
    display: flex; justify-content: space-between;
    max-width: 1420px; margin: 40px auto 0; padding: 0 16px;
}
.showcase-card {
    position: relative;
    width: 432px; height: 216px;
    /* 1. 关键点：把 background 换成 background-color，避免覆盖背景图 */
    background-color: rgba(255,255,255,0.60);
    /* 2. 背景图叠加（把 opacity 改成了 0.15，把 baseFrequency 改成了 1.2） */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E");

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 26px;
    box-shadow: 0 12px 32px rgba(55, 70, 105, 0.08);
    transition: transform .2s, box-shadow .2s, background .2s; cursor: pointer;
    flex-shrink: 0;
}
.showcase-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: rgba(255,255,255,0.8);
}
.showcase-card-imgbox {
    position: absolute;
    top: 24px; right: 24px;
    width: 172px; height: 172px;
    border-radius: 14px; overflow: hidden;
    background: transparent;
}
.showcase-card-imgbox img {
    width: 100%; height: 100%; object-fit: cover;
}
.showcase-card-text {
    position: absolute;
    top: 28px; left: 28px; right: 220px;
    bottom: 28px;
    display: flex; flex-direction: column; justify-content: center;
}
.showcase-card-text h3 { font-size: 26px; font-weight: 700; margin-bottom: 18px; color: var(--text); }
.showcase-card-text p { font-size: 17px; color: var(--text-muted); margin: 0; line-height: 1.4; }

@media (max-width: 768px) {
    .showcase { padding: 24px 16px 20px; }
    .showcase-hero { flex-direction: column; gap: 24px; margin-bottom: 24px; }
    .showcase-text h1 { font-size: 40px; text-align: center; }
    .showcase-subtitle { font-size: 18px; text-align: center; }
    .btn-cta { font-size: 16px; padding: 12px 28px; }
    .showcase-tags span { font-size: 13px; }
    .showcase-actions { align-items: center; }
    .showcase-features { flex-direction: column; gap: 12px; padding: 0 12px; }
    .showcase-card { height: auto; min-height: 160px; display: flex; align-items: center; gap: 12px; padding: 16px; }
    .showcase-card-imgbox { position: relative; top: auto; right: auto; width: 120px; height: 120px; flex-shrink: 0; }
    .showcase-card-text { position: relative; top: auto; left: auto; right: auto; bottom: auto; }
    .showcase-card-text h3 { font-size: 18px; }
    .showcase-card-text p { font-size: 13px; }
}

/* ========== Header ========== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    height: 68px;
    /* 1. 降低透明度到 0.75，保证文字清晰。*/
    background-color: rgba(255, 255, 255, 0.75); 
    /* 2. 将模糊半径稍微加大到 16px，强化边缘羽化感 */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    /* 3. 取消原本干巴巴的 var(--border)，改成透明白色的“玻璃高光边” */
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    /* 4. 增加极其柔和的阴影，让顶栏悬浮在页面内容之上 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04); 
    /* 5. 叠加高级磨砂颗粒（透明度调整为0.08，因为横向太长，太浓会显脏） */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
}
.logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
}
.nav {
    display: flex;
    gap: 6px;
    /* 把原本的 #f1f5f9 换成带蓝调的半透明白色 */
    background-color: rgba(235, 242, 255, 0.75); 
    /* 加上模糊，制造毛玻璃感 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 5px;
}
.nav-link {
    padding: 8px 22px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 18px;
    transition: all .15s;
}
.nav-link.active {
    background: var(--card);
    color: var(--primary);
    box-shadow: var(--shadow);
}
.nav-link:hover:not(.active) { color: var(--text); }

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.btn-bookmark {
    text-decoration: none; color: var(--text-muted);
    font-size: 13px; padding: 4px 12px;
    border-radius: 8px; transition: all .15s;
}
.btn-bookmark:hover { background: #f1f5f9; color: var(--primary); }

/* 收藏提示气泡 */
.bookmark-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    color: #f1f5f9;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    animation: bookmarkTipIn .25s ease;
}
@keyframes bookmarkTipIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.bookmark-tip-icon { font-size: 14px; }
.bookmark-tip-text { }
.bookmark-tip kbd {
    display: inline-block;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 12px;
    margin: 0 2px;
}
.bookmark-tip-close {
    background: none; border: none;
    color: #94a3b8; font-size: 14px;
    cursor: pointer; padding: 0 0 0 4px;
    line-height: 1;
}
.bookmark-tip-close:hover { color: #fff; }

.status-dot { display: none; }
.status-text { display: none; }

/* ========== Hero ========== */
.hero {
    text-align: center;
    padding: 48px 20px 32px;
}
.hero h1 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}
.hero p {
    font-size: 17px;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

/* ========== Tab Panels ========== */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.main { background: transparent; }

/* ========== Upload Row ========== */
.upload-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 0 32px;
    max-width: 1420px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.upload-row.single { max-width: 500px; }

/* 呼吸灯关键帧动画 */
@keyframes breathe {
    0% {
        transform: scale(1);
        box-shadow: 0 12px 32px rgba(55, 70, 105, 0.08);
        background-color: rgba(255, 255, 255, 0.60);
        border-color: rgba(99, 102, 241, 0.15);
    }
    50% {
        transform: scale(1.015);
        box-shadow: 0 18px 48px rgba(55, 70, 105, 0.18);
        background-color: rgba(255, 255, 255, 0.75);
        border-color: rgba(99, 102, 241, 0.35);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 12px 32px rgba(55, 70, 105, 0.08);
        background-color: rgba(255, 255, 255, 0.60);
        border-color: rgba(99, 102, 241, 0.15);
    }
}

.upload-card {
    flex: 1;
    min-width: 280px;
    max-width: 380px;
    aspect-ratio: 3/4;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 2px dashed rgba(99, 102, 241, 0.15);
    border-radius: 26px;
    background-color: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: breathe 4s ease-in-out infinite;
    transition: all .2s;
}
.upload-card:hover {
    animation: none;
    transform: scale(1.03);
    background-color: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(99, 102, 241, 0.5);
    box-shadow: 0 20px 56px rgba(55, 70, 105, 0.15);
}
.upload-card.has-image {
    border-style: solid;
    border-color: var(--border);
    animation: none;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
}
.upload-area.dragover { background: var(--primary-light); }

.upload-icon { font-size: 52px; margin-bottom: 12px; }
.upload-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
}
.upload-hint {
    font-size: 16px;
    color: var(--text-muted);
    text-align: center;
}

/* Preview image inside card */
.preview-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}
.upload-card.has-image .upload-area { display: none; }
.upload-card.has-image .preview-img { display: block; }

.btn-clear {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.upload-card.has-image .btn-clear { display: flex; }

.plus-divider {
    font-size: 32px;
    font-weight: 300;
    color: var(--text-muted);
    user-select: none;
}

/* ========== Generate Button ========== */
/* 按钮脉冲光晕关键帧 */
@keyframes pulse-shadow {
    0%   { box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35); }
    50%  { box-shadow: 0 8px 36px rgba(99, 102, 241, 0.60); }
    100% { box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35); }
}

.btn-generate {
    display: block;
    margin: 32px auto;
    padding: 14px 48px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 20px rgba(99,102,241,.35);
    animation: pulse-shadow 2.5s ease-in-out infinite;
}
.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99,102,241,.45);
}
.btn-generate:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    animation: none;
}

.feature-note, .tryon-note {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-top: -16px;
}
.tryon-note {
    background: #fef3c7;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    max-width: 560px;
    margin: -8px auto 0;
    line-height: 1.8;
}
.tryon-note code {
    background: #fde68a;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}
.tryon-note a { color: var(--primary); font-weight: 600; }

/* ========== API Key Input ========== */
.api-key-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}
.api-key-input {
    width: 280px;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.api-key-input:focus { border-color: var(--primary); }
.api-key-input.saved { border-color: #22c55e; background: #f0fdf4; }

.btn-save-key {
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}
.btn-save-key:hover { background: var(--primary-dark); }
.btn-save-key.saved { background: #22c55e; }

.api-key-msg {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
}
.api-key-msg.success { color: #16a34a; }
.api-key-msg.error { color: #ef4444; }

/* ========== Result Section ========== */
.result-section {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}
.result-section h3 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 20px;
}
.result-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.result-images {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.result-images > div {
    flex: 1;
    min-width: 180px;
    max-width: 260px;
    text-align: center;
}
.result-images span {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.result-images img {
    width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

/* Compare row (for bg removal) */
.compare-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}
.compare-item {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}
.compare-label {
    display: block;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.compare-img-wrapper {
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.compare-img-wrapper img {
    width: 100%;
    display: block;
}
.checker-bg {
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.btn-download {
    display: block;
    width: fit-content;
    margin: 20px auto 0;
    padding: 10px 32px;
    background: #22c55e;
    color: #fff;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 15px;
    transition: all .15s;
}
.btn-download:hover { background: #16a34a; transform: translateY(-1px); }

/* ========== Loading Overlay ========== */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.loading-overlay.show { display: flex; }
.loading-box {
    background: var(--card);
    padding: 40px 60px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.loading-box p {
    margin-top: 16px;
    font-size: 16px;
    color: var(--text-muted);
}
.progress-sub {
    font-size: 13px !important;
    color: #94a3b8 !important;
    margin-top: 6px !important;
}
.spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: #fff;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    transition: transform .3s ease;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #ef4444; }

/* ========== Watermark Editor ========== */
.watermark-editor {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 20px;
}
.wm-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}
.wm-tool-btn {
    padding: 8px 18px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
}
.wm-tool-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* 撤销/重置操作按钮 — 视觉区别于工具选择按钮 */
#btnBgUndo, #btnBgReset,
#btnWmUndo, #btnWmReset {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: var(--text-muted);
}
#btnBgUndo:hover, #btnBgReset:hover,
#btnWmUndo:hover, #btnWmReset:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text);
}
/* 去掉浏览器默认焦点环（防止撤销按钮看起来像被选中） */
.wm-tool-btn:focus { outline: none; }

.btn-auto-detect {
    padding: 8px 20px;
    background: #f0f9ff;
    color: #0284c7;
    border: 2px solid #0284c7;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
    margin: 0 6px;
}
.btn-auto-detect:hover { background: #e0f2fe; }

.btn-edit-mode {
    display: block;
    margin: 16px auto 0;
    padding: 8px 20px;
    background: #f0f9ff;
    color: #0284c7;
    border: 2px solid #0284c7;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
}
.btn-edit-mode:hover { background: #e0f2fe; }

.wm-brush-size {
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.wm-brush-size input[type="range"] {
    width: 80px;
    accent-color: var(--primary);
}
.wm-canvas-wrap {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}
.wm-canvas-wrap canvas {
    max-width: 100%;
    cursor: crosshair;
    display: block;
    background: #888888;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .header { padding: 0 16px; }
    .logo-text { display: none; }
    .hero h1 { font-size: 26px; }
    .upload-row { padding: 0 16px; gap: 12px; }
    .plus-divider { font-size: 24px; }
    .btn-generate { padding: 12px 32px; font-size: 16px; }
    .nav-link { padding: 6px 14px; font-size: 14px; }
    .api-key-row { flex-direction: column; align-items: center; }
    .api-key-input { width: 100%; max-width: 280px; }
}

/* ================================================================
   Header 用户区
   ================================================================ */
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user { display: flex; align-items: center; gap: 8px; }
.btn-login {
    padding: 7px 18px; border-radius: 10px; border: 1.5px solid var(--primary);
    background: transparent; color: var(--primary); cursor: pointer;
    font-size: 14px; font-weight: 600; transition: all .2s;
}
.btn-login:hover { background: var(--primary); color: #fff; }
.user-badge {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 4px 12px; border-radius: 10px; background: #f1f5f9;
    font-size: 14px; position: relative; user-select: none;
}
.user-badge .credits { color: var(--primary); font-weight: 700; }
.user-dropdown {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
    background: #fff; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.15);
    min-width: 140px; overflow: hidden; z-index: 200;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
    display: block; padding: 10px 16px; font-size: 14px; color: var(--text);
    text-decoration: none; cursor: pointer; transition: background .15s;
}
.user-dropdown a:hover { background: #f1f5f9; }
.user-dropdown .logout { color: #ef4444; }
.nav-admin { color: var(--accent) !important; font-weight: 600; }

/* ================================================================
   弹窗
   ================================================================ */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff; border-radius: 20px; padding: 32px; width: 90%;
    max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
    position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-sm { max-width: 380px; }
.modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 28px; color: #94a3b8;
    cursor: pointer; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-tabs {
    display: flex; gap: 0; margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
}
.modal-tab {
    flex: 1; padding: 10px; border: none; background: none; cursor: pointer;
    font-size: 16px; font-weight: 600; color: #94a3b8; transition: all .2s;
}
.modal-tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); margin-bottom: -2px; }
.modal-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-group input {
    padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 12px;
    font-size: 15px; outline: none; transition: border .2s;
}
.form-group input:focus { border-color: var(--primary); }
.btn-submit {
    padding: 12px; border: none; border-radius: 12px;
    background: var(--primary); color: #fff; font-size: 16px;
    font-weight: 600; cursor: pointer; transition: background .2s;
}
.btn-submit:hover { background: var(--primary-dark); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.form-footer { text-align: center; font-size: 13px; margin: 0; }
.form-footer a { color: var(--primary); text-decoration: none; }
.form-error { color: #ef4444; font-size: 13px; text-align: center; margin: 0; }
.form-success { color: #10b981; font-size: 13px; text-align: center; margin: 0; }

/* ================================================================
   充值
   ================================================================ */
.recharge-ratio { text-align: center; font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.rc-amounts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rc-amount {
    padding: 14px; border: 2px solid #e2e8f0; border-radius: 14px;
    text-align: center; cursor: pointer; font-weight: 600; transition: all .2s;
}
.rc-amount:hover { border-color: var(--primary); }
.rc-amount.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.rc-amount .yuan { font-size: 22px; }
.rc-amount .credits-get { font-size: 12px; color: var(--text-muted); }
.rc-method {
    flex: 1; padding: 10px; text-align: center; border: 2px solid #e2e8f0;
    border-radius: 12px; cursor: pointer; font-size: 15px; transition: all .2s;
}
.rc-method.active { border-color: var(--primary); background: var(--primary-light); }
.rc-method input { display: none; }
.rc-qr-wrap { text-align: center; margin: 16px 0; }
.rc-qr-wrap img { width: 200px; height: 200px; border-radius: 12px; border: 1px solid #e2e8f0; }
.rc-info { text-align: center; font-size: 16px; margin: 8px 0; }
.rc-tip { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.8; }
.recharge-body .btn-submit { width: 100%; }

/* ================================================================
   管理后台
   ================================================================ */
.admin-tabs {
    display: flex; gap: 4px; background: #f1f5f9; border-radius: 14px;
    padding: 4px; margin: 0 32px 20px; max-width: 600px;
}
.admin-tab {
    flex: 1; padding: 10px 16px; border: none; background: none;
    border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 600;
    color: var(--text-muted); transition: all .2s; white-space: nowrap;
}
.admin-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.admin-content { padding: 0 32px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 10px 12px; color: var(--text-muted); font-size: 13px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 12px; border-bottom: 1px solid #f1f5f9; }
.admin-table .badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-verified { background: #d1fae5; color: #059669; }
.badge-rejected { background: #fee2e2; color: #dc2626; }
.btn-verify, .btn-reject {
    padding: 5px 14px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 13px; font-weight: 600; transition: all .2s;
}
.btn-verify { background: #d1fae5; color: #059669; }
.btn-verify:hover { background: #059669; color: #fff; }
.btn-reject { background: #fee2e2; color: #dc2626; margin-left: 6px; }
.btn-reject:hover { background: #dc2626; color: #fff; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; }
.stat-card {
    background: #fff; border-radius: 16px; padding: 20px; box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .stat-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stats-cards .stat-card:last-child .stat-num { color: var(--accent); }
.btn-upload-qr {
    padding: 10px 20px; border: 1.5px dashed #cbd5e1; border-radius: 10px;
    background: #f8fafc; cursor: pointer; font-size: 14px; color: var(--text-muted);
    transition: all .2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-upload-qr:hover { border-color: var(--primary); color: var(--primary); }
.qr-preview { width: 150px; height: 150px; border-radius: 12px; border: 1px solid #e2e8f0; margin: 12px 0; object-fit: contain; }

@media (max-width: 768px) {
    .admin-tabs { margin: 0 16px 16px; overflow-x: auto; }
    .admin-content { padding: 0 16px; }
    .admin-table { font-size: 12px; }
    .admin-table th, .admin-table td { padding: 8px 6px; }
    .stats-cards { grid-template-columns: 1fr 1fr; }
    .header-right { gap: 8px; }
    .tier-cards { grid-template-columns: 1fr; }
}

/* ================================================================
   模式选择弹窗
   ================================================================ */
.tier-box { max-width: 480px; }
.tier-subtitle { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.tier-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tier-card {
    border: 2px solid #e2e8f0; border-radius: 16px; padding: 20px 16px;
    text-align: center; cursor: pointer; transition: all .2s;
}
.tier-card:hover { border-color: #cbd5e1; }
.tier-card.active { border-color: var(--primary); background: var(--primary-light); }
.tier-card .tier-icon { font-size: 32px; margin-bottom: 8px; }
.tier-card .tier-name { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.tier-card .tier-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.tier-card .tier-price { font-size: 15px; font-weight: 700; color: var(--primary); }
.tier-free.active { border-color: #10b981; background: #ecfdf5; }
.tier-free .tier-price { color: #10b981; }
.tier-pro.active { border-color: var(--primary); background: var(--primary-light); }
.tier-credit-info, .tier-login-hint {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 10px; background: #f8fafc; border-radius: 10px;
    margin-bottom: 16px; font-size: 14px;
}
.tier-credit-info a, .tier-login-hint a { color: var(--primary); font-weight: 600; text-decoration: none; }
.tier-login-hint { color: var(--text-muted); }
.tier-box .btn-submit { width: 100%; margin-top: 4px; }

/* ================================================================
   图片放大弹窗
   ================================================================ */
.lightbox-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85);
    z-index: 2000; cursor: pointer; align-items: center; justify-content: center;
}
.lightbox-overlay.show { display: flex; }
.lightbox-overlay img {
    max-width: 95vw; max-height: 95vh; object-fit: contain;
    border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.compare-img-wrapper img { cursor: pointer; transition: opacity .15s; }
.compare-img-wrapper img:hover { opacity: .85; }

/* ================================================================
   页脚
   ================================================================ */
.site-footer {
    text-align: center;
    padding: 40px 20px 28px;
    font-size: 14px;
    color: #94a3b8;
    position: relative;
    z-index: 1;
}
