/* ======================================================================
 * 在线图片裁剪 · 专用样式
 * 自由裁剪 / 按比例裁剪 / 圆形裁剪 / 圆角裁剪
 * 前缀：.ic-   （与全站 tool-detail.css 的通用样式配合使用）
 * ====================================================================== */

[hidden] { display: none !important; }

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

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

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

.ic-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);
}

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

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

/* ---------- 上传区 ---------- */
.ic-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;
}

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

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

.ic-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);
}

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

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

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

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

.ic-figure {
    position: relative;
    overflow: hidden;
    line-height: 0;
    box-shadow: 0 6px 18px rgba(28, 48, 92, .18);
    border-radius: 2px;
    user-select: none;
}

.ic-figure img {
    display: block;
    width: 100%;
    height: 100%;
    -webkit-user-drag: none;
}

.ic-stage-tip {
    margin: 10px 2px 0;
    font-size: 12.5px;
    color: #7b89a3;
    line-height: 1.7;
}

/* ---------- 裁剪框 ---------- */
.ic-crop {
    position: absolute;
    left: 0;
    top: 0;
    width: 120px;
    height: 120px;
    box-sizing: border-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, .5);
    cursor: move;
    touch-action: none;
    transition: border-radius .12s linear;
}

.ic-crop.is-dragging { border-color: #6ea8ff; }

.ic-crop::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(75, 123, 236, .55);
    pointer-events: none;
    border-radius: inherit;
}

.ic-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, .55) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, .55) 1px, transparent 1px);
    background-size: 33.3333% 33.3333%;
}

.ic-size {
    position: absolute;
    left: 6px;
    top: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(15, 23, 42, .78);
    color: #fff;
    font-size: 11.5px;
    line-height: 1.6;
    white-space: nowrap;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.ic-crop[data-mode="circle"] .ic-size {
    left: 50%;
    transform: translateX(-50%);
}

/* 手柄 */
.ic-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid #4b7bec;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    touch-action: none;
}

.ic-handle[data-dir="nw"] { left: 0; top: 0; transform: translate(-50%, -50%); cursor: nwse-resize; }
.ic-handle[data-dir="ne"] { right: 0; top: 0; transform: translate(50%, -50%); cursor: nesw-resize; }
.ic-handle[data-dir="sw"] { left: 0; bottom: 0; transform: translate(-50%, 50%); cursor: nesw-resize; }
.ic-handle[data-dir="se"] { right: 0; bottom: 0; transform: translate(50%, 50%); cursor: nwse-resize; }

.ic-handle[data-dir="n"],
.ic-handle[data-dir="s"] {
    left: 50%;
    width: 24px;
    height: 10px;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    cursor: ns-resize;
}

.ic-handle[data-dir="n"] { top: 0; }
.ic-handle[data-dir="s"] { top: auto; bottom: 0; transform: translate(-50%, 50%); }

.ic-handle[data-dir="w"],
.ic-handle[data-dir="e"] {
    top: 50%;
    width: 10px;
    height: 24px;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    cursor: ew-resize;
}

.ic-handle[data-dir="w"] { left: 0; }
.ic-handle[data-dir="e"] { left: auto; right: 0; transform: translate(50%, -50%); }

/* ---------- 控制面板 ---------- */
.ic-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);
}

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

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

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

/* 模式按钮 */
.ic-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.ic-mode {
    border: 1px solid #e0e8f4;
    background: #fbfcfe;
    border-radius: 10px;
    padding: 10px 6px;
    cursor: pointer;
    text-align: center;
    transition: all .16s;
    font-family: inherit;
}

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

/* 比例 */
.ic-ratios { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; }

.ic-ratio {
    border: 1px solid #e0e8f4;
    background: #fbfcfe;
    border-radius: 9px;
    padding: 8px 4px;
    font-size: 12.5px;
    color: #3b4a66;
    cursor: pointer;
    transition: all .16s;
    font-family: inherit;
}

.ic-ratio:hover { border-color: #9db8e8; background: #f4f8ff; }
.ic-ratio.active { border-color: #4b7bec; background: #eef4ff; color: #2b62d9; font-weight: 700; }

.ic-custom-ratio { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

.ic-num {
    width: 66px;
    padding: 8px 10px;
    border: 1px solid #dfe6f2;
    border-radius: 9px;
    background: #fbfcfe;
    font-size: 13.5px;
    color: #24324f;
    text-align: center;
    font-family: inherit;
}

.ic-num:focus { outline: none; border-color: #4b7bec; background: #fff; }
.ic-colon { color: #98a4bb; font-weight: 700; }

.ic-chip {
    border: 1px solid #cddcf3;
    background: #fff;
    color: #2b62d9;
    border-radius: 9px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all .16s;
    font-family: inherit;
}

.ic-chip:hover { background: #eef4ff; border-color: #4b7bec; }

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

.ic-slider { display: flex; align-items: center; gap: 10px; }
.ic-slider input[type="range"] {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: #e3ebf7;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.ic-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;
}
.ic-slider input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #4b7bec;
    border: 2px solid #fff;
    cursor: pointer;
}
.ic-slider b { font-size: 12.5px; color: #2b62d9; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.ic-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;
}

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

/* 背景选择 */
.ic-bgs { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.ic-bg-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid #dfe6f2;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    overflow: visible;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

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

.ic-bg-btn::after {
    content: attr(data-name);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 3px;
    font-size: 10.5px;
    color: #8895ad;
    white-space: nowrap;
    pointer-events: none;
}

.ic-bg-checker {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: repeating-conic-gradient(#e2e8f0 0% 25%, #ffffff 0% 50%) 50% / 10px 10px;
}

.ic-bg-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 26px;
    font-size: 12.5px;
    color: #5b6a86;
}

.ic-bg-custom input[type="color"] {
    width: 36px;
    height: 28px;
    padding: 2px;
    border: 1px solid #dfe6f2;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

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

/* 输出信息条 */
.ic-readout {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    background: #f2f7ff;
    border: 1px solid #dbe7fb;
    font-size: 12.5px;
    color: #40507a;
}

.ic-readout b { color: #2b62d9; font-variant-numeric: tabular-nums; }

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

.ic-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;
}

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

.ic-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);
}

.ic-btn.primary:hover { filter: brightness(1.06); }
.ic-btn.ghost { background: #fff; color: #5b6a86; }

.ic-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;
}

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

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

.ic-info-block .detail-icon {
    --icon-bg: linear-gradient(135deg, #22d3ee, #3b82f6);
    --icon-shadow: rgba(34, 211, 238, .32);
}

/* 免责说明 */
.ic-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) {
    .ic-workspace { grid-template-columns: minmax(0, 1fr); }
    .ic-stage { min-height: 240px; }
}

@media (max-width: 560px) {
    .ic-hero { padding: 16px 14px; }
    .ic-drop { padding: 32px 14px; }
    .ic-row { grid-template-columns: minmax(0, 1fr); }
    .ic-ratios { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ic-btn { min-width: 0; flex: 1 1 46%; }
    .ic-privacy { white-space: normal; }
    .ic-handle { width: 16px; height: 16px; }
    .ic-handle[data-dir="n"],
    .ic-handle[data-dir="s"] { width: 28px; height: 12px; }
    .ic-handle[data-dir="w"],
    .ic-handle[data-dir="e"] { width: 12px; height: 28px; }
}

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

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

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

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

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

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

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

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

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

html[data-theme="dark"] .ic-mode,
html[data-theme="dark"] .ic-ratio,
html[data-theme="dark"] .ic-btn,
html[data-theme="dark"] .ic-num,
html[data-theme="dark"] .ic-select,
html[data-theme="dark"] .ic-chip,
body.dark .ic-mode,
body.dark .ic-ratio,
body.dark .ic-btn,
body.dark .ic-num,
body.dark .ic-select,
body.dark .ic-chip { background: #1c2437; border-color: #2c3854; color: #c9d5ec; }

html[data-theme="dark"] .ic-mode b,
body.dark .ic-mode b { color: #dce5f7; }

html[data-theme="dark"] .ic-mode.active,
html[data-theme="dark"] .ic-ratio.active,
body.dark .ic-mode.active,
body.dark .ic-ratio.active { background: #1d2a49; border-color: #4b7bec; }

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

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

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

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