/* ============ 图片拼接 - 工具特有样式 ============ */
/* 通用样式（容器布局、卡片、按钮、info-box、setting-item 等）由 common.css 统一提供 */

/* 始终预留滚动条空间，避免页面内容左右跳动 */
html {
    scrollbar-gutter: stable;
}

/* ---- 右侧预览卡片 ---- */
.preview-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
}

/* ---- 区块标题 ---- */
.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zoom-btn,
.zoom-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zoom-reset {
    font-size: 12px;
}

.zoom-btn:hover,
.zoom-reset:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #f5f3ff;
}

.zoom-btn:active,
.zoom-reset:active {
    transform: scale(0.94);
}

.zoom-value {
    min-width: 44px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.zoom-sep {
    width: 1px;
    height: 20px;
    background: #e5e7eb;
    margin: 0 2px;
}

.zoom-action {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zoom-action:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #f5f3ff;
}

.zoom-action:active {
    transform: scale(0.94);
}

.zoom-action.hl {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-color: #7c3aed;
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

.zoom-action.hl:hover {
    background: linear-gradient(135deg, #9d6ef8, #8b5cf6);
    border-color: #6d28d9;
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
}

.zoom-action.hl:active {
    transform: scale(0.96);
}

/* 单图微调面板：sticky 固定，通过 JS 锁定画布位置避免滚动跳动 */
.adjust-card {
    position: sticky;
    top: 12px;
    z-index: 20;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    box-sizing: border-box;
}

/* 未选中图片时的占位提示 */
.adjust-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 28px;
    color: #9ca3af;
    text-align: center;
    user-select: none;
}

.adjust-empty .adjust-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.adjust-empty p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

/* 分段按钮（填充方式等） */
.seg-group {
    display: flex;
    gap: 6px;
}

/* 分段按钮 2×2 网格（单图微调填充方式） */
.seg-group.seg-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.seg-btn {
    flex: 1;
    padding: 7px 4px;
    font-size: 12px;
    line-height: 1;
    border: 1px solid #d8b4fe;
    background: #fff;
    color: #7c3aed;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.seg-btn:hover {
    background: #f5f0ff;
}

.seg-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-color: #7c3aed;
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}



/* ---- 上传区 ---- */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 16px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.upload-icon {
    font-size: 26px;
    margin-bottom: 6px;
}

.upload-text {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 11px;
    color: #9ca3af;
}

/* ---- 模板卡片选择器 ---- */
.template-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 2px;
}

.template-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 8px 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: #a78bfa;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.1);
    transform: translateY(-1px);
}

.template-card.active {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: #f5f3ff;
}

.template-preview {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    background: #f9fafb;
    border-radius: 6px;
}

.template-card.active .template-preview {
    background: #ede9fe;
}

.template-label {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

.template-card.active .template-label {
    color: #6d28d9;
    font-weight: 600;
}

.template-hint {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
}

.template-card.active .template-hint {
    color: #a78bfa;
}

/* ---- 模板预览小图标 ---- */
.tp-shape {
    position: relative;
    width: 44px;
    height: 44px;
}

.tp-shape span {
    background: #c4b5fd;
    border-radius: 3px;
    display: block;
    transition: background 0.2s;
}

.template-card.active .tp-shape span {
    background: #8b5cf6;
}

/* 横排（三列 / 左右对半） */
.tp-h {
    display: flex;
    gap: 3px;
    align-items: center;
    justify-content: center;
}

.tp-h span {
    width: 13px;
    height: 34px;
}

/* 竖排（三行 / 上下对半） */
.tp-v {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
}

.tp-v span {
    width: 34px;
    height: 13px;
}

/* 拼长横图：单条横向长条，居中 */
.tp-h1 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-h1 span {
    width: 40px;
    height: 16px;
}

/* 拼长竖图：单条纵向长条，居中 */
.tp-v1 {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-v1 span {
    width: 16px;
    height: 40px;
}

/* 对角斜拼 */
.tp-diag span {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 3px;
}

.tp-diag span:nth-child(1) { top: 0; left: 0; }
.tp-diag span:nth-child(2) { top: 13px; left: 13px; }
.tp-diag span:nth-child(3) { top: 26px; left: 26px; }

/* 宫格 3x3 */
.tp-grid {
    display: grid;
    grid-template-columns: repeat(3, 11px);
    grid-template-rows: repeat(3, 11px);
    gap: 2px;
}

.tp-grid span {
    border-radius: 2px;
}

/* 4x4 宫格 */
.tp-grid16 {
    display: grid;
    grid-template-columns: repeat(4, 9px);
    grid-template-rows: repeat(4, 9px);
    gap: 1px;
}

.tp-grid16 span {
    border-radius: 2px;
}

/* 2x2 宫格 */
.tp-g22 {
    display: grid;
    grid-template-columns: repeat(2, 17px);
    grid-template-rows: repeat(2, 17px);
    gap: 3px;
}

.tp-g22 span {
    border-radius: 2px;
}

/* 圆形环绕 */
.tp-circle span {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.tp-circle span:nth-child(1) { left: 18px; top: 2px; }
.tp-circle span:nth-child(2) { left: 33px; top: 10px; }
.tp-circle span:nth-child(3) { left: 33px; top: 25px; }
.tp-circle span:nth-child(4) { left: 18px; top: 33px; }
.tp-circle span:nth-child(5) { left: 3px; top: 25px; }
.tp-circle span:nth-child(6) { left: 3px; top: 10px; }

/* 左大右二 */
.tp-l1r2 span:nth-child(1) { position: absolute; left: 0; top: 0; width: 26px; height: 44px; border-radius: 3px; }
.tp-l1r2 span:nth-child(2) { position: absolute; left: 29px; top: 0; width: 15px; height: 20px; border-radius: 3px; }
.tp-l1r2 span:nth-child(3) { position: absolute; left: 29px; top: 24px; width: 15px; height: 20px; border-radius: 3px; }

/* 上大下二 */
.tp-t1b2 span:nth-child(1) { position: absolute; left: 0; top: 0; width: 44px; height: 26px; border-radius: 3px; }
.tp-t1b2 span:nth-child(2) { position: absolute; left: 0; top: 29px; width: 20px; height: 15px; border-radius: 3px; }
.tp-t1b2 span:nth-child(3) { position: absolute; left: 24px; top: 29px; width: 20px; height: 15px; border-radius: 3px; }

/* 左大右三 */
.tp-l1r3 span:nth-child(1) { position: absolute; left: 0; top: 0; width: 26px; height: 44px; border-radius: 3px; }
.tp-l1r3 span:nth-child(2) { position: absolute; left: 29px; top: 0; width: 15px; height: 13px; border-radius: 3px; }
.tp-l1r3 span:nth-child(3) { position: absolute; left: 29px; top: 15px; width: 15px; height: 13px; border-radius: 3px; }
.tp-l1r3 span:nth-child(4) { position: absolute; left: 29px; top: 30px; width: 15px; height: 13px; border-radius: 3px; }

/* 上大下三 */
.tp-t1b3 span:nth-child(1) { position: absolute; left: 0; top: 0; width: 44px; height: 26px; border-radius: 3px; }
.tp-t1b3 span:nth-child(2) { position: absolute; left: 0; top: 29px; width: 13px; height: 15px; border-radius: 3px; }
.tp-t1b3 span:nth-child(3) { position: absolute; left: 15px; top: 29px; width: 13px; height: 15px; border-radius: 3px; }
.tp-t1b3 span:nth-child(4) { position: absolute; left: 30px; top: 29px; width: 13px; height: 15px; border-radius: 3px; }

/* 左大右多（一大九小·底部+右列） */
.tp-l1r4 span:nth-child(1) { position: absolute; left: 0; top: 0; width: 35px; height: 35px; border-radius: 3px; }
.tp-l1r4 span:nth-child(2) { position: absolute; left: 0; top: 36px; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(3) { position: absolute; left: 9px; top: 36px; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(4) { position: absolute; left: 18px; top: 36px; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(5) { position: absolute; left: 27px; top: 36px; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(6) { position: absolute; left: 36px; top: 36px; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(7) { position: absolute; left: 36px; top: 0; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(8) { position: absolute; left: 36px; top: 9px; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(9) { position: absolute; left: 36px; top: 18px; width: 8px; height: 8px; border-radius: 3px; }
.tp-l1r4 span:nth-child(10) { position: absolute; left: 36px; top: 27px; width: 8px; height: 8px; border-radius: 3px; }

/* 中心大图（4x4：中心2x2大 + 边框12小） */
.tp-center9 span:nth-child(1) { position: absolute; left: 12px; top: 12px; width: 19px; height: 19px; border-radius: 3px; }
.tp-center9 span:nth-child(2) { position: absolute; left: 2px; top: 2px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(3) { position: absolute; left: 12px; top: 2px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(4) { position: absolute; left: 22px; top: 2px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(5) { position: absolute; left: 32px; top: 2px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(6) { position: absolute; left: 2px; top: 32px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(7) { position: absolute; left: 12px; top: 32px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(8) { position: absolute; left: 22px; top: 32px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(9) { position: absolute; left: 32px; top: 32px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(10) { position: absolute; left: 2px; top: 12px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(11) { position: absolute; left: 2px; top: 22px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(12) { position: absolute; left: 32px; top: 12px; width: 9px; height: 9px; border-radius: 2px; }
.tp-center9 span:nth-child(13) { position: absolute; left: 32px; top: 22px; width: 9px; height: 9px; border-radius: 2px; }

/* 反向对角斜拼 */
.tp-diagr span { width: 13px; height: 13px; border-radius: 3px; }
.tp-diagr span:nth-child(1) { position: absolute; top: 0; left: 26px; }
.tp-diagr span:nth-child(2) { position: absolute; top: 13px; left: 13px; }
.tp-diagr span:nth-child(3) { position: absolute; top: 26px; left: 0; }

/* 双圆重叠 */
.tp-twoc span { border-radius: 50%; }
.tp-twoc span:nth-child(1) { position: absolute; left: 2px; top: 11px; width: 22px; height: 22px; }
.tp-twoc span:nth-child(2) { position: absolute; left: 20px; top: 11px; width: 22px; height: 22px; }

/* 圆在角 */
.tp-ccorner span:nth-child(1) { position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 3px; }
.tp-ccorner span:nth-child(2) { position: absolute; left: 22px; top: 22px; width: 16px; height: 16px; border-radius: 50%; }

/* 拱形排列：图片沿上半圆弧排成拱门 */
.tp-arc { position: relative; width: 44px; height: 40px; }
.tp-arc span { position: absolute; width: 12px; height: 12px; border-radius: 3px; }
.tp-arc span:nth-child(1) { left: 1px; top: 26px; }
.tp-arc span:nth-child(2) { left: 10px; top: 13px; }
.tp-arc span:nth-child(3) { left: 16px; top: 4px; }
.tp-arc span:nth-child(4) { left: 22px; top: 13px; }
.tp-arc span:nth-child(5) { left: 31px; top: 26px; }

/* ---- 下拉选择器（输出格式） ---- */
.format-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.format-select:focus {
    border-color: #8b5cf6;
    background: #fff;
}

/* ---- 滑块 ---- */
.quality-slider {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
}

.range-with-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-value {
    min-width: 42px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: #6d28d9;
}

.setting-note {
    margin-top: 6px;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.4;
}

.output-size-readout {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

/* ---- 背景色处理 ---- */
.bg-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bg-color {
    width: 44px;
    height: 32px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 2px;
    background: #fff;
    cursor: pointer;
}

.bg-color:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    margin-top: 8px;
    cursor: pointer;
}

.color-value {
    font-size: 13px;
    color: #6b7280;
}

.label-hint {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 400;
}

/* ---- 图片列表（参考图片压缩工具的卡片网格） ---- */
.images-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

/* ---- 继续添加占位卡片 ---- */
.add-more-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 44px 20px;
    border: 3px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.add-more-card:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.add-more-icon {
    font-size: 40px;
}

.add-more-text {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

.add-more-hint {
    font-size: 11px;
    color: #9ca3af;
}

/* ---- 上传中提示 ---- */
.uploading-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    color: #6d28d9;
    font-size: 14px;
    font-weight: 500;
}

/* ---- 拼接预览上方的水平图片列表 ---- */
.image-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 2px 10px;
    margin-top: 10px;
}

.strip-item {
    position: relative;
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    background: #f3f4f6;
    cursor: grab;
    transition: border-color 0.2s;
}

.strip-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.strip-item.in-use {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.strip-item.in-use::after {
    content: '✓ 使用中';
    position: absolute;
    left: 50%;
    bottom: 3px;
    transform: translateX(-50%);
    background: #8b5cf6;
    color: #fff;
    font-size: 10px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
}

.strip-item:not(.in-use) {
    opacity: 0.8;
}

.strip-item.drop-target {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.strip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
}

.strip-index {
    position: absolute;
    top: 2px;
    left: 2px;
    z-index: 2;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #8b5cf6;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
}

.strip-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 2;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.strip-item:hover .strip-remove {
    opacity: 1;
}

.strip-remove:hover {
    background: #ef4444;
}


.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd6fe;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- 图片卡片（支持拖拽排序） ---- */
.image-card {
    position: relative;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
    cursor: grab;
}

.image-card:hover {
    border-color: #a78bfa;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.12);
}

.image-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.image-card.drop-target {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.card-index {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #8b5cf6;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 11px;
}

.card-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.card-remove:hover {
    background: #ef4444;
}

.image-preview {
    position: relative;
    background: repeating-conic-gradient(#ccc 0% 25%, transparent 0% 50%) 50% / 16px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    padding: 12px;
}

.preview-img {
    max-width: 100%;
    max-height: 170px;
    border-radius: 6px;
    display: block;
    pointer-events: none;
}

.image-info {
    padding: 12px;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-dim {
    font-size: 12px;
    color: #9ca3af;
}

/* ---- 拼接预览（可拖拽瓦片） ---- */
.canvas-section {
    margin-top: 8px;
}

.preview-stage-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 12px;
    border: 1px dashed #e5e7eb;
    border-radius: 10px;
    background: #fafafa;
    overflow: auto;
}

.preview-stage {
    position: relative;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-stage.is-transparent {
    background: repeating-conic-gradient(#ccc 0% 25%, transparent 0% 50%) 50% / 16px 16px;
}

.preview-tile {
    position: absolute;
    cursor: grab;
    overflow: hidden;
    box-sizing: border-box;
}

.preview-tile.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.preview-tile.drop-target {
    outline: 3px solid #8b5cf6;
    outline-offset: -3px;
    z-index: 3;
}

.preview-tile img {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    user-select: none;
}

.tile-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.preview-tile:hover .tile-remove {
    opacity: 1;
}

.tile-remove:hover {
    background: #ef4444;
}

.preview-empty {
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 13px;
}

.preview-hint {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
}

/* ---- 单图微调 ---- */
.preview-tile.selected {
    outline: 3px solid #8b5cf6;
    outline-offset: -3px;
    z-index: 4;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#e5e7eb 0% 25%, #f3f4f6 0% 50%) 50% / 14px 14px;
    border: 1px dashed #cbd5e1;
    color: #9ca3af;
}

.ph-num {
    font-size: 13px;
    font-weight: 600;
    color: #9ca3af;
}

.tile-canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    user-select: none;
}

.crop-editor {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    touch-action: none;
}

.crop-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: fill;
    user-select: none;
    -webkit-user-drag: none;
}

.crop-box {
    position: absolute;
    border: 1px solid #8b5cf6;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    cursor: move;
    box-sizing: border-box;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #8b5cf6;
    border-radius: 50%;
}

.crop-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.crop-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.crop-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.crop-se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.crop-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: block;
}

.mini-btn {
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.mini-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #f5f3ff;
}

.btn-outline {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.btn-outline:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #f5f3ff;
}

.btn-block {
    width: 100%;
}

.adjust-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.adjust-reset {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 3px 8px;
    line-height: 1;
    transition: all 0.15s;
}

.adjust-reset:hover {
    background: #f5f0ff;
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.adjust-reset:active {
    transform: scale(0.94);
}
