* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: linear-gradient(180deg, #f6f4fd 0%, #eef1f8 100%);
    color: #333;
    min-height: 100vh;
}

header {
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 108, 240, .35);
    flex-shrink: 0;
}

header h1 {
    font-size: 20px;
    color: #2d2a4a;
}

header p {
    font-size: 12px;
    color: #8a87a8;
    margin-top: 2px;
}

.container {
    display: flex;
    gap: 18px;
    padding: 0 24px 24px;
    max-width: 1440px;
    margin: 0 auto;
}

.panel {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(90, 80, 160, .08);
    padding: 18px;
}

.controls {
    width: 370px;
    flex-shrink: 0;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.controls::-webkit-scrollbar {
    width: 6px;
}

.controls::-webkit-scrollbar-thumb {
    background: #d8d4ee;
    border-radius: 3px;
}

.preview {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.step {
    border: 1px solid #eceaf6;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fbfbfe;
}

.step-title {
    font-size: 14px;
    font-weight: bold;
    color: #4c4569;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-title .num {
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

/* 上传拖拽区 */
.dropzone {
    border: 2px dashed #c9c3ea;
    border-radius: 12px;
    padding: 26px 12px;
    text-align: center;
    cursor: pointer;
    background: #f8f7fd;
    transition: all .2s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #8b7cf6;
    background: #f1eefe;
}

.dropzone .dz-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.dropzone .dz-main {
    font-size: 14px;
    color: #4c4569;
    font-weight: bold;
}

.dropzone .dz-sub {
    font-size: 11px;
    color: #9b97b5;
    margin-top: 5px;
}

/* 规格卡片 */
.spec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 2px;
}

.spec-grid::-webkit-scrollbar {
    width: 5px;
}

.spec-grid::-webkit-scrollbar-thumb {
    background: #d8d4ee;
    border-radius: 3px;
}

.spec-card {
    border: 1.5px solid #e4e1f3;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    background: #fff;
    transition: all .15s;
}

.spec-card:hover {
    border-color: #b3a9ec;
}

.spec-card.active {
    border-color: #7c6cf0;
    background: #f1eefe;
    box-shadow: 0 0 0 2px rgba(124, 108, 240, .15);
}

.spec-card .spec-name {
    font-size: 13px;
    font-weight: bold;
    color: #3a3555;
    display: flex;
    align-items: center;
    gap: 5px;
}

.spec-card .spec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #d8d4ee;
    border: 1px solid #c9c3ea;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
    transition: all .15s;
}

.spec-card.active .spec-dot {
    background: #7c6cf0;
    border-color: #7c6cf0;
    box-shadow: 0 0 0 2px rgba(124, 108, 240, .28);
}

.spec-card .spec-size {
    font-size: 10px;
    color: #9b97b5;
    margin-top: 3px;
}

.spec-card .spec-desc {
    font-size: 10px;
    color: #7c76a0;
    margin-top: 2px;
}

select,
input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #ddd9ee;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}

#exportFormat {
    flex: 1 1 auto;
    width: auto;
    min-width: 92px;
}

select:focus,
input:focus {
    outline: none;
    border-color: #7c6cf0;
}

.row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.row label {
    font-size: 13px;
    white-space: nowrap;
    min-width: 56px;
}

.mm-info {
    font-size: 12px;
    color: #8a87a8;
    margin-top: 8px;
    background: #f3f1fb;
    border-radius: 8px;
    padding: 7px 10px;
}

/* 底色 */
.swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.swatch {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.swatch.active {
    border-color: #7c6cf0;
    box-shadow: 0 0 0 3px rgba(124, 108, 240, .2);
}

.swatch span {
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #8a87a8;
    white-space: nowrap;
}

.swatch-wrap {
    margin-bottom: 24px;
}

.hex-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.hex-row input[type="color"] {
    width: 44px;
    height: 34px;
    padding: 2px;
    border: 1px solid #ddd9ee;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

.hex-row input[type="text"] {
    font-family: Consolas, monospace;
}

button {
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    transition: opacity .15s;
}

button:hover {
    opacity: .9;
}

button:disabled {
    background: #c5c1d8;
    cursor: not-allowed;
}

button.secondary {
    background: #fff;
    color: #7c6cf0;
    border: 1.5px solid #b3a9ec;
}

button.secondary:hover {
    background: #f6f4fe;
    opacity: 1;
}

button.green {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.slider-row label {
    font-size: 12px;
    min-width: 56px;
    color: #4c4569;
}

.slider-row input[type="range"] {
    flex: 1;
    accent-color: #7c6cf0;
}

.slider-row .val {
    font-size: 12px;
    min-width: 40px;
    text-align: right;
    color: #8a87a8;
}

.status {
    font-size: 12px;
    color: #6f6b8c;
    background: #f3f1fb;
    border-radius: 8px;
    padding: 9px 10px;
    margin-top: 10px;
    min-height: 34px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.status.err {
    color: #dc2626;
    background: #fef2f2;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.tab {
    padding: 9px 22px;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    border: 1.5px solid #e4e1f3;
    width: auto;
    color: #4c4569;
}

.tab.active {
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    color: #fff;
    border-color: transparent;
    font-weight: bold;
}

.tab-body {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(90, 80, 160, .08);
    padding: 22px;
    flex: 1;
    display: none;
    flex-direction: column;
    align-items: center;
}

.tab-body.active {
    display: flex;
}

.canvas-holder {
    background: repeating-conic-gradient(#eceaf6 0% 25%, #fff 0% 50%) 0 0/20px 20px;
    border: 1px solid #e4e1f3;
    border-radius: 12px;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
}

canvas {
    max-width: 100%;
    max-height: calc(100vh - 300px);
    height: auto;
    border-radius: 10px;
}

.print-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 14px;
    width: 100%;
}

.print-controls .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.print-controls .field label {
    font-size: 12px;
    color: #8a87a8;
}

.print-controls select {
    width: auto;
    min-width: 110px;
}

.print-controls button {
    width: auto;
}

.print-info {
    font-size: 13px;
    color: #4c4569;
    margin-bottom: 12px;
    width: 100%;
    background: #f8f7fd;
    border-radius: 8px;
    padding: 8px 12px;
}

.hint {
    font-size: 12px;
    color: #9b97b5;
    margin-top: 8px;
    line-height: 1.5;
}

/* 极速换底色 */
.quick-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.quick-btn {
    flex: 1;
    padding: 10px 6px;
    border-radius: 10px;
    border: 2px solid #e4e1f3;
    background: #fff;
    color: #4c4569;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.quick-btn:hover {
    border-color: #b3a9ec;
    background: #f6f4fe;
    opacity: 1;
}

.quick-btn:disabled {
    border-color: #e4e1f3;
    color: #b3a9ec;
    cursor: not-allowed;
    opacity: .7;
}

/* 修复前后对比 */
.seg-row {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.seg-btn {
    background: #fff;
    color: #4c4569;
    border: 1.5px solid #e4e1f3;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}

.seg-btn:hover {
    border-color: #b3a9ec;
}

.seg-btn.active {
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    color: #fff;
    border-color: transparent;
    font-weight: bold;
}

.ba-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
    touch-action: none;
    box-shadow: 0 2px 16px rgba(90, 80, 160, .12);
}

.ba-wrap canvas {
    display: block;
    border-radius: 10px;
    max-width: 100%;
}

.ba-before,
.ba-after {
    position: absolute;
    inset: 0;
}

.ba-after {
    clip-path: inset(0 0 0 50%);
}

.ba-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, .45);
    transform: translateX(-50%);
    cursor: ew-resize;
    z-index: 3;
}

.ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: ew-resize;
    z-index: 4;
    box-shadow: 0 2px 8px rgba(124, 108, 240, .5);
}

.ba-tag {
    position: absolute;
    top: 8px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    z-index: 2;
}

.ba-tag.left {
    left: 8px;
}

.ba-tag.right {
    right: 8px;
}

/* 美化开关 */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: #4c4569;
}

.toggle-row input[type="checkbox"] {
    accent-color: #7c6cf0;
    width: 16px;
    height: 16px;
}

/* 批量导出 */
.batch-pick {
    margin-bottom: 8px;
}

.batch-pick .lbl {
    font-size: 12px;
    color: #8a87a8;
    margin: 8px 0 6px;
}

.batch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    border: 1.5px solid #e4e1f3;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    color: #4c4569;
    transition: all .15s;
}

.chip:hover {
    border-color: #b3a9ec;
}

.chip.active {
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    color: #fff;
    border-color: transparent;
    font-weight: bold;
}

.batch-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.batch-preview .bp {
    background: #f8f7fd;
    border-radius: 8px;
    padding: 4px;
    text-align: center;
}

.batch-preview canvas {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

.batch-preview .bp-label {
    font-size: 10px;
    color: #8a87a8;
    margin-top: 3px;
    line-height: 1.3;
    word-break: break-all;
}

.batch-sum {
    font-size: 12px;
    color: #6f6b8c;
    background: #f3f1fb;
    border-radius: 8px;
    padding: 7px 10px;
    margin-top: 8px;
    line-height: 1.5;
}

/* 页脚品牌 */
footer {
    text-align: center;
    padding: 22px 16px 34px;
    color: #8a87a8;
    font-size: 12px;
    line-height: 1.9;
}

footer .brand {
    font-size: 16px;
    font-weight: bold;
    color: #4c4569;
}

footer .brand span {
    background: linear-gradient(135deg, #8b7cf6, #6a5ae0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

footer .desc {
    margin-top: 4px;
}

footer .contact {
    margin-top: 6px;
}

footer .contact strong {
    color: #7c6cf0;
}

footer .tag {
    display: inline-block;
    margin-top: 12px;
    background: #f1eefe;
    color: #7c6cf0;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 12px;
}

.hidden {
    display: none !important;
}

/* 吸顶生成条：滚动时始终可触达 */
.ai-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin: -18px -18px 14px -18px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid #eceaf6;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 2px 10px rgba(90, 80, 160, 0.08);
}

.ai-sticky-bar.visible {
    display: flex;
}

.ai-sticky-bar button {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
    flex-shrink: 0;
}

.ai-sticky-status {
    flex: 1;
    font-size: 12px;
    color: #6f6b8c;
    line-height: 1.4;
}