/* ======================================================================
 * 图片加水印 · 专用样式
 * 文字水印 / 图片水印 · 九宫格定位 + 整图平铺 · 批量导出 ZIP
 * 前缀：.iw-   （与全站 tool-detail.css 的通用样式配合使用）
 * ====================================================================== */

[hidden] { display: none !important; }

/* ---------- 工作区外壳 ---------- */
.iw-hero {
    margin: 18px 0 26px;
    padding: 22px;
    background: linear-gradient(135deg, #f0f4ff 0%, #f8faff 55%, #f2fbf6 100%);
    border: 1px solid #e3ebf7;
    border-radius: 18px;
}

.iw-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.iw-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.iw-logo {
    width: 46px;
    height: 46px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(64, 108, 190, .16);
}

.iw-title { font-size: 20px; font-weight: 800; color: #1f2b45; letter-spacing: .3px; }
.iw-tagline { font-size: 13px; color: #6b7a96; margin-top: 2px; }

.iw-privacy {
    font-size: 12px;
    color: #2f7d55;
    background: #e8f7ef;
    border: 1px solid #c6ead8;
    border-radius: 999px;
    padding: 6px 12px;
    white-space: nowrap;
}

/* ---------- 上传区 ---------- */
.iw-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 42px 20px;
    background: #fff;
    border: 2px dashed #c9d8ee;
    border-radius: 16px;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .2s;
}

.iw-drop:hover,
.iw-drop.is-drag { border-color: #4b7bec; background: #f5f9ff; }
.iw-drop.is-drag { transform: scale(1.004); }

.iw-drop-icon { font-size: 40px; line-height: 1; }
.iw-drop-title { font-size: 16px; font-weight: 700; color: #22304d; }
.iw-drop-desc { font-size: 13px; color: #7b89a3; line-height: 1.7; max-width: 560px; }

.iw-drop-btn {
    margin-top: 4px;
    padding: 10px 26px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #4b7bec, #3867d6);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(75, 123, 236, .3);
    font-family: inherit;
}

.iw-drop-btn:hover { filter: brightness(1.06); }

/* ---------- 工作区 ---------- */
.iw-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    gap: 18px;
    align-items: start;
}

.iw-stage-card {
    background: #fff;
    border: 1px solid #e6edf7;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 6px 20px rgba(38, 66, 122, .06);
}

.iw-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    min-height: 260px;
    border-radius: 12px;
    background: repeating-conic-gradient(#f4f6fa 0% 25%, #eaeef5 0% 50%) 50% / 18px 18px;
}

.iw-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    box-shadow: 0 6px 18px rgba(28, 48, 92, .18);
    border-radius: 2px;
}

.iw-readout {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    background: #f2f7ff;
    border: 1px solid #dbe7fb;
    font-size: 12.5px;
    color: #40507a;
    word-break: break-all;
}

/* 缩略图条 */
.iw-strip {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e8eef8;
}

.iw-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: #5b6a86;
    margin-bottom: 10px;
}

.iw-strip-head b { color: #2b62d9; font-variant-numeric: tabular-nums; }
.iw-strip-tools { display: flex; gap: 8px; }

.iw-mini-btn {
    border: 1px solid #dfe6f2;
    background: #fbfcfe;
    color: #34445f;
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .16s;
    font-family: inherit;
}

.iw-mini-btn:hover { border-color: #9db8e8; background: #f4f8ff; color: #2b62d9; }

.iw-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.iw-thumb {
    position: relative;
    flex: none;
    width: 84px;
    height: 84px;
    padding: 0;
    border: 2px solid #e2eaf7;
    border-radius: 10px;
    background: #f7f9fd;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .16s, box-shadow .16s;
}

.iw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.iw-thumb:hover { border-color: #9db8e8; }

.iw-thumb.active {
    border-color: #4b7bec;
    box-shadow: 0 0 0 3px rgba(75, 123, 236, .18);
}

.iw-thumb-n {
    position: absolute;
    left: 3px;
    bottom: 3px;
    padding: 0 5px;
    border-radius: 6px;
    background: rgba(15, 23, 42, .7);
    color: #fff;
    font-size: 10.5px;
    font-style: normal;
    line-height: 15px;
}

.iw-thumb-x {
    position: absolute;
    right: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background: rgba(15, 23, 42, .66);
    color: #fff;
    font-size: 13px;
    opacity: 0;
    transition: opacity .16s;
}

.iw-thumb:hover .iw-thumb-x { opacity: 1; }
.iw-thumb-x:hover { background: #e5484d; }

/* ---------- 控制面板 ---------- */
.iw-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
    border: 1px solid #e6edf7;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(38, 66, 122, .06);
}

.iw-group { padding-bottom: 12px; border-bottom: 1px dashed #e8eef8; }
.iw-group:last-of-type { border-bottom: 0; padding-bottom: 0; }

.iw-group-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 800;
    color: #24324f;
    margin-bottom: 10px;
}

.iw-group-title small { font-size: 11.5px; font-weight: 500; color: #98a4bb; }

/* 分段按钮（水印类型） */
.iw-seg {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.iw-seg-btn {
    border: 1px solid #e0e8f4;
    background: #fbfcfe;
    border-radius: 10px;
    padding: 10px 6px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: #3b4a66;
    transition: all .16s;
}

.iw-seg-btn span { display: block; font-size: 11px; font-weight: 500; color: #98a4bb; margin-top: 2px; }
.iw-seg-btn:hover { border-color: #9db8e8; background: #f4f8ff; }
.iw-seg-btn.active {
    border-color: #4b7bec;
    background: #eef4ff;
    color: #2b62d9;
    box-shadow: inset 0 0 0 1px rgba(75, 123, 236, .35);
}

/* 九宫格位置 */
.iw-pos-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.iw-pos-btn {
    height: 34px;
    border: 1px solid #e0e8f4;
    background: #fbfcfe;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all .16s;
    padding: 0;
}

.iw-pos-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 10px;
    margin: -5px 0 0 -7px;
    border-radius: 2px;
    background: #c3d0e6;
    transition: background .16s;
}

.iw-pos-btn[data-iw-pos="tl"]::after { left: 8px; top: 8px; margin: 0; }
.iw-pos-btn[data-iw-pos="tc"]::after { top: 8px; margin: -5px 0 0 -7px; }
.iw-pos-btn[data-iw-pos="tr"]::after { left: auto; right: 8px; top: 8px; margin: 0; }
.iw-pos-btn[data-iw-pos="ml"]::after { left: 8px; margin: -5px 0 0 0; }
.iw-pos-btn[data-iw-pos="mr"]::after { left: auto; right: 8px; margin: -5px 0 0 0; }
.iw-pos-btn[data-iw-pos="bl"]::after { left: 8px; top: auto; bottom: 8px; margin: 0; }
.iw-pos-btn[data-iw-pos="bc"]::after { top: auto; bottom: 8px; margin: 0 0 0 -7px; }
.iw-pos-btn[data-iw-pos="br"]::after { left: auto; right: 8px; top: auto; bottom: 8px; margin: 0; }

.iw-pos-btn:hover { border-color: #9db8e8; background: #f4f8ff; }
.iw-pos-btn.active { border-color: #4b7bec; background: #eef4ff; }
.iw-pos-btn.active::after { background: #4b7bec; }

.iw-pos-tile {
    width: 100%;
    margin-top: 8px;
    padding: 9px 10px;
    border: 1px solid #e0e8f4;
    background: #fbfcfe;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 700;
    color: #3b4a66;
    cursor: pointer;
    transition: all .16s;
    font-family: inherit;
}

.iw-pos-tile:hover { border-color: #9db8e8; background: #f4f8ff; }
.iw-pos-tile.active { border-color: #4b7bec; background: #eef4ff; color: #2b62d9; }

/* 字段 */
.iw-field { display: flex; flex-direction: column; gap: 6px; }
.iw-field > label { font-size: 12.5px; color: #5b6a86; font-weight: 600; }
.iw-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.iw-hint { font-size: 11.5px; color: #98a4bb; line-height: 1.6; }
.iw-mt { margin-top: 10px; }

.iw-slider { display: flex; align-items: center; gap: 10px; }

.iw-slider input[type="range"] {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: #e3ebf7;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.iw-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4b7bec;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(75, 123, 236, .5);
    cursor: pointer;
}

.iw-slider input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4b7bec;
    border: 2px solid #fff;
    cursor: pointer;
}

.iw-slider b { font-size: 12.5px; color: #2b62d9; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.iw-textarea,
.iw-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dfe6f2;
    border-radius: 9px;
    background: #fbfcfe;
    font-size: 13px;
    color: #24324f;
    font-family: inherit;
    box-sizing: border-box;
}

.iw-textarea { resize: vertical; min-height: 58px; line-height: 1.6; }
.iw-textarea:focus, .iw-input:focus { outline: none; border-color: #4b7bec; background: #fff; }

.iw-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dfe6f2;
    border-radius: 9px;
    background: #fbfcfe;
    font-size: 13px;
    color: #24324f;
    font-family: inherit;
    cursor: pointer;
    box-sizing: border-box;
}

.iw-select:focus { outline: none; border-color: #4b7bec; background: #fff; }

/* 颜色 */
.iw-colors { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.iw-color-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 2px solid #dfe6f2;
    border-radius: 50%;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.iw-color-btn:hover { transform: translateY(-1px); }
.iw-color-btn.active { border-color: #4b7bec; box-shadow: 0 0 0 3px rgba(75, 123, 236, .18); }

.iw-color-input {
    width: 40px;
    height: 30px;
    padding: 2px;
    border: 1px solid #dfe6f2;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

/* 文字样式小按钮 */
.iw-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.iw-tool-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #e0e8f4;
    background: #fbfcfe;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    color: #3b4a66;
    cursor: pointer;
    transition: all .16s;
    font-family: inherit;
}

.iw-tool-btn:hover { border-color: #9db8e8; background: #f4f8ff; }
.iw-tool-btn.active { border-color: #4b7bec; background: #eef4ff; color: #2b62d9; }
.iw-tool-btn.em { font-style: italic; }
.iw-tool-btn.b { font-weight: 800; }

.iw-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; font-size: 12.5px; color: #5b6a86; }
.iw-check input { accent-color: #4b7bec; width: 14px; height: 14px; cursor: pointer; }

/* 水印图上传 */
.iw-mark-row { display: flex; align-items: center; gap: 10px; }

.iw-mark-thumb {
    width: 46px;
    height: 46px;
    flex: none;
    border-radius: 9px;
    border: 1px solid #e2eaf7;
    background: repeating-conic-gradient(#f2f5fa 0% 25%, #ffffff 0% 50%) 50% / 10px 10px;
    object-fit: contain;
}

/* 操作按钮 */
.iw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }

.iw-btn {
    flex: 1 1 auto;
    min-width: 96px;
    padding: 10px 14px;
    border: 1px solid #dfe6f2;
    border-radius: 10px;
    background: #fbfcfe;
    color: #34445f;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .16s;
    font-family: inherit;
}

.iw-btn:hover { border-color: #9db8e8; background: #f4f8ff; }

.iw-btn.primary {
    flex: 1 1 100%;
    border: 0;
    background: linear-gradient(135deg, #4b7bec, #3867d6);
    color: #fff;
    box-shadow: 0 6px 16px rgba(75, 123, 236, .3);
}

.iw-btn.primary:hover { filter: brightness(1.06); }
.iw-btn.ghost { background: #fff; color: #5b6a86; }
.iw-btn[disabled] { opacity: .6; cursor: not-allowed; }

.iw-status {
    font-size: 12.5px;
    line-height: 1.7;
    color: #6b7a96;
    padding: 9px 12px;
    border-radius: 10px;
    background: #f7f9fd;
    border: 1px dashed #e2eaf7;
    word-break: break-all;
}

.iw-status.is-ok { color: #2f7d55; background: #eefaf3; border-color: #c8ead9; border-style: solid; }
.iw-status.is-warn { color: #9a6212; background: #fff8ea; border-color: #f3dfb5; border-style: solid; }

/* ---------- 工具简介块 ---------- */
.iw-info-block { margin-bottom: 26px; }

.iw-info-block .detail-icon {
    --icon-bg: linear-gradient(135deg, #38bdf8, #2563eb);
    --icon-shadow: rgba(56, 189, 248, .32);
}

/* 免责说明 */
.iw-disclaim {
    margin: 16px 0 0;
    padding: 12px 16px;
    border-radius: 12px;
    background: #fff8ea;
    border: 1px solid #f3e2b8;
    font-size: 12.5px;
    line-height: 1.8;
    color: #8a6516;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .iw-workspace { grid-template-columns: minmax(0, 1fr); }
    .iw-stage { min-height: 220px; }
}

@media (max-width: 560px) {
    .iw-hero { padding: 16px 14px; }
    .iw-drop { padding: 32px 14px; }
    .iw-row { grid-template-columns: minmax(0, 1fr); }
    .iw-btn { min-width: 0; flex: 1 1 46%; }
    .iw-privacy { white-space: normal; }
    .iw-pos-btn { height: 40px; }
    .iw-thumb { width: 72px; height: 72px; }
}

/* ---------- 深色模式 ---------- */
html[data-theme="dark"] .iw-hero,
body.dark .iw-hero {
    background: linear-gradient(135deg, #182036 0%, #151c2e 60%, #14202c 100%);
    border-color: #26314a;
}

html[data-theme="dark"] .iw-logo,
body.dark .iw-logo { background: #1d263c; box-shadow: none; }

html[data-theme="dark"] .iw-title,
body.dark .iw-title { color: #e8eefc; }

html[data-theme="dark"] .iw-tagline,
body.dark .iw-tagline { color: #8f9dba; }

html[data-theme="dark"] .iw-drop,
body.dark .iw-drop { background: #161e30; border-color: #33405d; }

html[data-theme="dark"] .iw-drop-title,
body.dark .iw-drop-title { color: #dce5f7; }

html[data-theme="dark"] .iw-stage-card,
html[data-theme="dark"] .iw-panel,
body.dark .iw-stage-card,
body.dark .iw-panel { background: #171f31; border-color: #26314a; box-shadow: none; }

html[data-theme="dark"] .iw-group,
body.dark .iw-group { border-bottom-color: #26314a; }
html[data-theme="dark"] .iw-strip,
body.dark .iw-strip { border-top-color: #26314a; }

html[data-theme="dark"] .iw-group-title,
body.dark .iw-group-title { color: #dce5f7; }

html[data-theme="dark"] .iw-seg-btn,
html[data-theme="dark"] .iw-pos-btn,
html[data-theme="dark"] .iw-pos-tile,
html[data-theme="dark"] .iw-tool-btn,
html[data-theme="dark"] .iw-mini-btn,
html[data-theme="dark"] .iw-btn,
html[data-theme="dark"] .iw-select,
html[data-theme="dark"] .iw-textarea,
html[data-theme="dark"] .iw-input,
body.dark .iw-seg-btn,
body.dark .iw-pos-btn,
body.dark .iw-pos-tile,
body.dark .iw-tool-btn,
body.dark .iw-mini-btn,
body.dark .iw-btn,
body.dark .iw-select,
body.dark .iw-textarea,
body.dark .iw-input { background: #1c2437; border-color: #2c3854; color: #c9d5ec; }

html[data-theme="dark"] .iw-seg-btn.active,
html[data-theme="dark"] .iw-pos-btn.active,
html[data-theme="dark"] .iw-pos-tile.active,
html[data-theme="dark"] .iw-tool-btn.active,
body.dark .iw-seg-btn.active,
body.dark .iw-pos-btn.active,
body.dark .iw-pos-tile.active,
body.dark .iw-tool-btn.active { background: #1d2a49; border-color: #4b7bec; }

html[data-theme="dark"] .iw-status,
body.dark .iw-status { background: #161e30; border-color: #2a3550; color: #8f9dba; }

html[data-theme="dark"] .iw-readout,
body.dark .iw-readout { background: #1a2440; border-color: #2a3a5e; color: #b9c8e6; }

html[data-theme="dark"] .iw-disclaim,
body.dark .iw-disclaim { background: #2a2416; border-color: #4a3d1f; color: #d9bd80; }

html[data-theme="dark"] .iw-stage,
body.dark .iw-stage { background: repeating-conic-gradient(#1b2233 0% 25%, #151b29 0% 50%) 50% / 18px 18px; }

html[data-theme="dark"] .iw-thumb,
body.dark .iw-thumb { background: #1b2334; border-color: #2c3854; }

html[data-theme="dark"] .iw-color-input,
body.dark .iw-color-input { background: #1c2437; border-color: #2c3854; }
