/* ============== 基础 ============== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    background: #f3f4f6;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.5;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== 顶部 ============== */
.topbar {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #2dd4bf 100%);
    padding: 14px 24px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.kami-row {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 1180px;
    margin: 0 auto;
}
.kami-row .label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    background: rgba(255,255,255,0.18);
    padding: 4px 12px;
    border-radius: 4px;
}
.kami-input {
    flex: 1;
    max-width: 460px;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    background: rgba(255,255,255,0.95);
    color: #111827;
    font-size: 14px;
    letter-spacing: 1px;
}
.kami-input::placeholder { color: #9ca3af; letter-spacing: 0.5px; }
.kami-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.4); }
.kami-row .btn {
    padding: 8px 18px;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all .2s;
}
.kami-row .btn:hover { background: rgba(255,255,255,0.32); }
.kami-row .btn.buy {
    background: #fff;
    color: #0d9488;
    border-color: #fff;
}
.kami-row .btn.buy:hover {
    background: #f0fdfa;
    color: #0f766e;
}
.kami-row .btn.bbs {
    background: #fff;
    color: #f59e0b;
    border-color: #fff;
    text-decoration: none;
    font-size: 13px;
}
.kami-row .btn.bbs:hover {
    background: #fffbeb;
    color: #d97706;
}
.brand-logo {
    height: 32px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
}
.h1-logo {
    height: 40px;
    vertical-align: middle;
    margin-right: 6px;
    border-radius: 6px;
}
.kami-status {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    margin-left: 4px;
    min-width: 120px;
}

/* ============== 主容器 ============== */
.main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px;
}
.card {
    background: #fff;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin-bottom: 16px;
}

/* ============== 标题区 ============== */
.title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    padding: 16px 22px;
    border-radius: 10px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.title-bar h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 1px;
}
.title-bar .actions { display: flex; gap: 10px; }
.title-bar .actions button {
    padding: 7px 16px;
    border: 1px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all .2s;
}
.title-bar .actions button:hover { background: rgba(255,255,255,0.3); }

/* ============== 模型选择 ============== */
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 0 0 10px;
    padding: 0;
    line-height: 1.5;
    display: block;
    overflow: visible;
}
.section-title .sub {
    font-size: 12px;
    color: #6b7280;
    font-weight: 400;
    margin-left: 4px;
}
.model-list { display: flex; flex-direction: column; gap: 8px; }
.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
    padding: 4px 0;
}
.radio-item input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #0d9488;
    cursor: pointer;
}
.radio-item .price {
    margin-left: auto;
    font-size: 12px;
    color: #6b7280;
}
.radio-item.active { color: #0d9488; font-weight: 600; }
.radio-item.disabled { opacity: 0.4; pointer-events: none; }

.size-list {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}
.size-list .label { font-size: 13px; color: #374151; font-weight: 600; }

/* ============== 剩余点数 ============== */
.points-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: linear-gradient(90deg, #ecfeff, #f0fdfa);
    border: 1px solid #99f6e4;
    border-radius: 8px;
    margin-top: 16px;
    color: #0d9488;
    font-weight: 700;
    font-size: 15px;
}
.points-box .icon { font-size: 18px; }
.points-box.loading { color: #6b7280; }

/* ============== 预设配置 ============== */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px 14px;
}
.preset-grid .radio-item {
    padding: 6px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.preset-grid .radio-item:hover { background: #f0fdfa; }
.preset-grid .radio-item.active { background: #ccfbf1; color: #0f766e; }

/* ============== 警告文字 ============== */
.warn-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0 10px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-weight: 700;
    font-size: 13px;
}
.warn-bar .right { color: #b91c1c; }

/* ============== 描述补充 ============== */
.desc-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #374151;
    font-weight: 600;
}
.desc-row .label { font-weight: 700; }
.desc-row .check {
    display: flex; align-items: center; gap: 4px;
    cursor: pointer;
}
.desc-row .check input { accent-color: #0d9488; }
.desc-row .hint {
    color: #6b7280;
    font-weight: 400;
    font-size: 12px;
}

.prompt-area {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}
.prompt-textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}
.prompt-textarea:focus { outline: none; border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(20,184,166,0.15); }
.prompt-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 110px;
}
.prompt-side button {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #374151;
    transition: all .2s;
}
.prompt-side button:hover {
    background: #f0fdfa;
    border-color: #14b8a6;
    color: #0d9488;
}

/* ============== 底部按钮 ============== */
.bottom-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 18px;
}
.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    letter-spacing: 1px;
    transition: all .2s;
    box-shadow: 0 4px 12px rgba(20,184,166,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(20,184,166,0.35); }
.btn-primary:disabled { background: #9ca3af; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-secondary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245,158,11,0.25);
}
.btn-secondary:hover { box-shadow: 0 6px 16px rgba(245,158,11,0.35); }

/* ============== 上传区 ============== */
.upload-area {
    border: 2px solid #d1d5db;
    border-radius: 10px;
    padding: 22px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    cursor: pointer;
    transition: all .25s;
    margin-bottom: 14px;
    display: block;
}
.upload-area:hover { border-color: #14b8a6; background: linear-gradient(135deg, #f0fdfa, #e6f7f5); box-shadow: 0 2px 10px rgba(20,184,166,0.12); }
.upload-area .icon { font-size: 36px; color: #14b8a6; margin-bottom: 6px; }
.upload-area .text { color: #6b7280; font-size: 13px; }
.upload-area .text strong { color: #14b8a6; }

/* 完全隐藏 file input（防止 Chrome 渲染默认按钮） */
.file-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
}

.preview {
    display: none;
    margin-bottom: 14px;
    text-align: center;
    position: relative;
}
.preview.show { display: block; }
.preview img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.preview .remove {
    position: absolute;
    top: 4px;
    right: calc(50% - 110px);
    background: #ef4444;
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

/* ============== 结果区 ============== */
.result {
    display: none;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}
.result.show { display: block; }
.result h3 {
    font-size: 14px;
    color: #374151;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.result .imgs { display: flex; gap: 12px; flex-wrap: wrap; }
.result .imgs .col { flex: 1; min-width: 220px; }
.result .imgs .col p { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.result .imgs img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #f3f4f6;
}
/* 菜单生成配置表单 */
.menu-form-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.menu-form-row.menu-form-full {
    grid-template-columns: 110px 1fr;
}
.menu-form-row.menu-form-full label { align-self: flex-start; padding-top: 8px; }
.menu-form-row label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.menu-form-row label .hint {
    font-weight: 400;
    color: #9ca3af;
    font-size: 12px;
    margin-left: 4px;
}
.menu-form-row select,
.menu-form-row textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
}
.menu-form-row select:focus,
.menu-form-row textarea:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20,184,166,0.15);
}
.menu-form-row textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
    font-family: "Consolas", "Monaco", monospace;
}

/* 手写稿上传区 */
.handwrite-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.handwrite-upload {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 13px;
    color: #6b7280;
    background: #fafafa;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.handwrite-upload:hover { border-color: #14b8a6; background: #f0fdfa; color: #0d9488; }
.handwrite-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 6px;
    font-size: 12px;
    color: #0f766e;
}
.handwrite-preview img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}
.handwrite-preview .handwrite-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.handwrite-remove {
    background: #ef4444;
    color: #fff;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    flex-shrink: 0;
}
.ocr-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    transition: all .2s;
    white-space: nowrap;
}
.ocr-btn:hover { opacity: .9; transform: translateY(-1px); }
.ocr-btn:disabled { background: #9ca3af; cursor: not-allowed; transform: none; }
.ocr-status {
    width: 100%;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}
.ocr-status.loading { color: #6366f1; }
.ocr-status.error { color: #ef4444; }
.ocr-status.success { color: #10b981; }

/* 一键效果上传区 */
.oneclick-upload {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.oc-upload-btn {
    position: relative;
    padding: 10px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #6b7280;
    background: #fafafa;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-align: center;
    justify-content: center;
    min-height: 22px;
    max-width: 200px;
}
.oc-upload-label {
    /* 让 label 表现得像 div 而不带默认样式 */
    cursor: pointer;
    user-select: none;
}
.oc-upload-btn:hover { border-color: #14b8a6; background: #f0fdfa; color: #0d9488; }

/* file input 叠加在按钮上，点击按钮=点击文件选择器 */
.oc-file-input {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 2;
}
.oc-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 6px;
    font-size: 12px;
    color: #0f766e;
}
.oc-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}
.oc-preview .oc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.oc-remove {
    background: #ef4444; color: #fff; border: none;
    width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
    font-size: 11px; line-height: 1; flex-shrink: 0;
}

/* 点击定位贴图 */
.oc-pos-wrap { width: 100%; }
.oc-pos-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    cursor: crosshair;
    margin-bottom: 6px;
}
.oc-pos-bg {
    display: block;
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}
.oc-pos-marker {
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.oc-marker-dot {
    width: 24px; height: 24px;
    border: 3px solid #ef4444;
    background: rgba(239,68,68,0.15);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 2px 8px rgba(0,0,0,0.3);
}
.oc-pos-marker span {
    font-size: 11px; font-weight: 700; color: #ef4444;
    background: rgba(255,255,255,0.9); padding: 1px 6px; border-radius: 3px;
    white-space: nowrap;
}
.oc-pos-hint {
    font-size: 12px; color: #9ca3af; padding: 4px 0;
}
.oc-reset-pos {
    padding: 4px 12px; border: 1px solid #d1d5db; border-radius: 5px;
    font-size: 12px; cursor: pointer; background: #fff; color: #374151;
}
.oc-reset-pos:hover { background: #f0fdfa; border-color: #14b8a6; color: #0d9488; }

/* 拖拽舞台 */
.oc-stage-wrap { width: 100%; }
.oc-stage {
    position: relative; display: inline-block; width: 100%;
    background: #f3f4f6; border: 2px solid #d1d5db; border-radius: 8px;
    overflow: hidden; user-select: none; min-height: 160px;
}
.oc-stage-scene { display: block; width: 100%; max-height: 360px; object-fit: contain; pointer-events: none; }
.oc-stage-overlay {
    position: absolute; cursor: move;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
    transform-origin: center center;
    opacity: 0.7;
    z-index: 2;
}
.oc-stage-overlay img { display: block; width: 100%; height: auto; pointer-events: none; }
.oc-handle {
    position: absolute; width: 22px; height: 22px;
    background: #fff; border: 2px solid #14b8a6;
    border-radius: 4px; display: flex; align-items: center;
    justify-content: center; font-size: 12px; color: #0d9488;
    cursor: pointer; z-index: 3; user-select: none;
}
.oc-handle-rot { top: -12px; left: 50%; transform: translateX(-50%); cursor: grab; }
.oc-handle-resize { right: -12px; bottom: -12px; cursor: nwse-resize; font-size: 14px; }
.oc-stage-tools {
    display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px;
}
.oc-stage-tools label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #374151; font-weight: 600;
}
.oc-stage-tools input[type=range] { width: 100px; }
.oc-stage-tools span { font-size: 11px; color: #6b7280; min-width: 36px; }
.oc-stage-status {
    display: flex; align-items: center; flex-wrap: wrap;
    font-size: 11px; color: #6b7280; margin-top: 6px; padding: 4px 0;
}

/* 参考图上传区（菜单配置弹窗内） */
.ref-upload-area {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: #fafafa;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ref-upload-area:hover { border-color: #14b8a6; background: #f0fdfa; }
.ref-upload-placeholder {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 13px;
}
.ref-upload-placeholder .icon { font-size: 22px; }
.ref-upload-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    position: relative;
}
.ref-upload-preview img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
.ref-remove {
    background: #ef4444;
    color: #fff;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
}
.ref-upload-preview .ref-name {
    font-size: 12px;
    color: #374151;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 预设的「配置」小按钮 */
.preset-config-btn {
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 11px;
    background: #14b8a6;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    display: none;
}
.preset-config-btn.show { display: inline-block; }
.preset-config-btn:hover { background: #0d9488; }

.result .imgs .dl {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(20,184,166,0.3);
}
.result .imgs .dl:hover { background: linear-gradient(135deg, #0d9488, #0f766e); box-shadow: 0 4px 14px rgba(20,184,166,0.4); transform: translateY(-1px); text-decoration: none; }

/* ============== 状态消息 ============== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 22px;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    animation: slideDown .25s ease;
}
.toast.success { background: #10b981; }
.toast.error   { background: #ef4444; }

/* ============ 打字改图标记画布 ============ */
.type-edit-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    min-height: 480px;
}
.type-edit-canvas-wrap {
    background: #f9fafb;
    padding: 16px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}
.type-edit-instructions {
    font-size: 12px;
    color: #4b5563;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.type-edit-canvas {
    flex: 1;
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    min-height: 360px;
    cursor: crosshair;
}
.type-edit-image {
    max-width: 100%;
    max-height: 460px;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}
.type-edit-empty {
    color: #94a3b8;
    font-size: 14px;
}
.type-edit-svg {
    position: absolute;
    left: 0; top: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}
.type-edit-canvas-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.btn-secondary {
    padding: 7px 12px;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.btn-secondary:hover { background: #f0fdfa; border-color: #14b8a6; }

.type-edit-config {
    padding: 18px 20px;
    background: #fff;
    overflow-y: auto;
    max-height: 600px;
}
.type-edit-config h3 {
    font-size: 15px;
    color: #0d9488;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}
.te-mark-form { display: flex; flex-direction: column; gap: 14px; }
.te-mark-row {
    border-left: 3px solid #ddd;
    padding: 8px 10px 8px 12px;
    border-radius: 4px;
    background: #fafafa;
}
.te-mark-row.has-mark { border-left-color: #ef4444; background: #fef2f2; }
.te-mark-label {
    font-size: 12px;
    font-weight: 700;
    color: #ef4444;
    margin-bottom: 4px;
}
.te-mark-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 6px;
    box-sizing: border-box;
}
.te-mark-input:focus { outline: none; border-color: #14b8a6; }
.te-mark-type {
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: #6b7280;
}
.te-mark-type input { accent-color: #ef4444; }
.te-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 16px 0 10px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
}
.te-resolution {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: #374151;
    margin-bottom: 18px;
}
.te-resolution input { accent-color: #14b8a6; }
.te-run-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.te-run-btn:hover { box-shadow: 0 4px 12px rgba(59,130,246,0.4); transform: translateY(-1px); }

/* ============ 编辑文字 配置 ============ */
.et-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    min-height: 520px;
}
.et-canvas-wrap {
    background: #f9fafb;
    padding: 16px;
    border-right: 1px solid #e5e7eb;
}
.et-instructions {
    font-size: 12px;
    color: #4b5563;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.et-canvas {
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.et-panel {
    padding: 14px 16px;
    overflow-y: auto;
    max-height: 580px;
}
.et-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.et-panel-header > span { font-weight: 700; color: #374151; margin-right: 6px; }
.et-panel-header label { display: inline-flex; align-items: center; gap: 3px; color: #4b5563; }
.et-panel-header input[type=radio] { accent-color: #14b8a6; }
.et-status {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 12px;
}
.et-status.loading { color: #6366f1; background: #eef2ff; }
.et-status.success { color: #10b981; background: #d1fae5; }
.et-status.error { color: #ef4444; background: #fee2e2; }
.et-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.et-item {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all .2s;
}
.et-item:hover { border-color: #14b8a6; background: #f0fdfa; }
.et-item.active { border-color: #ef4444; background: #fef2f2; }
.et-item-orig {
    font-size: 12px;
    color: #374151;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    border-radius: 4px;
    max-height: 64px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 6px;
}
.et-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}
.et-item-row label { white-space: nowrap; color: #dc2626; font-weight: 600; }
.et-item-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 12px;
}
.et-item-input:focus { outline: none; border-color: #14b8a6; }
.et-warning {
    font-size: 11px;
    color: #b91c1c;
    background: #fef2f2;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #fca5a5;
}
.toast.info    { background: #3b82f6; }
@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============== Modal ============== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 10px;
    width: 90%;
    max-width: 720px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 { font-size: 16px; }
.modal-header .close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 28px; height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}
.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.modal-footer button {
    padding: 7px 18px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.modal-footer button.primary {
    background: #14b8a6;
    color: #fff;
    border-color: #14b8a6;
}

/* 历史记录条目 */
.history-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    gap: 12px;
    background: #fafafa;
}
.history-item .info { flex: 1; font-size: 12px; color: #4b5563; }
.history-item .info .row { margin-bottom: 4px; }
.history-item .info .row .k { color: #6b7280; display: inline-block; width: 60px; }
.history-item img {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* 进度（底部区域 - 醒目版） */
.progress {
    display: none;
    position: relative;
    width: 100%;
    height: 400px;
    margin-top: 16px;
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(34,197,94,0.2);
}
.progress.show {
    display: flex;
    align-items: center;
    justify-content: center;
}
.progress-bar {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #86efac, #22c55e);
    transition: width 0.5s ease;
    z-index: 0;
    opacity: 0.2;
}
.progress-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}
.spinner {
    width: 44px; height: 44px;
    border: 4px solid #bbf7d0;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    flex-shrink: 0;
}
#progressText {
    font-size: 24px;
    font-weight: 800;
    color: #15803d;
    letter-spacing: 2px;
    text-align: center;
}
.progress-time {
    font-size: 18px;
    font-weight: 700;
    color: #166534;
    font-variant-numeric: tabular-nums;
    background: #dcfce7;
    padding: 8px 24px;
    border-radius: 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 响应式 */
@media (max-width: 720px) {
    .preset-grid { grid-template-columns: repeat(2, 1fr); }
    .bottom-bar { grid-template-columns: 1fr; }
    .prompt-area { grid-template-columns: 1fr; }
    .prompt-side { flex-direction: row; min-width: 0; }
    .prompt-side button { flex: 1; }
    .title-bar { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ============ 修改尺寸 配置 ============ */
.rs-form { display: flex; flex-direction: column; gap: 18px; }
.rs-row { display: flex; flex-direction: column; gap: 6px; }
.rs-row label { font-size: 13px; font-weight: 600; color: #374151; }
.rs-row label .hint { font-weight: 400; color: #9ca3af; font-size: 12px; }
.rs-input {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; width: 100%; box-sizing: border-box;
}
.rs-input:focus { outline: none; border-color: #14b8a6; }
.rs-strategy { display: flex; flex-direction: column; gap: 6px; }
.rs-radio { font-size: 12px; color: #4b5563; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.rs-radio input { accent-color: #14b8a6; }

/* ============ 海报生成 配置 ============ */
.ps-form { display: flex; flex-direction: column; gap: 16px; }
.ps-row { display: flex; flex-direction: column; gap: 6px; }
.ps-row label { font-size: 13px; font-weight: 700; color: #374151; }
.ps-row label .hint { font-weight: 400; color: #9ca3af; font-size: 12px; }
.ps-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ps-input {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; width: 100%; box-sizing: border-box;
}
.ps-input:focus { outline: none; border-color: #6366f1; }
.ps-row-full .ps-input { width: 100%; }

/* ============ 多图融合 配置 ============ */
.mm-thumbs {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.mm-slot {
    position: relative;
    aspect-ratio: 1 / 1.4;
    border: 2px dashed #cbd5e1;
    border-radius: 6px;
    background: #fafafa;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mm-slot.has-image { border-color: #14b8a6; }
.mm-slot .mm-add {
    color: #94a3b8; font-size: 24px; cursor: pointer;
}
.mm-slot.has-image .mm-add { display: none; }
.mm-slot img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; background:#fff; }
.mm-slot .mm-label {
    position: absolute;
    top: 4px; left: 4px;
    background: rgba(255,255,255,0.9);
    color: #ef4444;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    z-index: 2;
}
.mm-slot .mm-close {
    position: absolute;
    top: 4px; right: 4px;
    width: 20px; height: 20px;
    background: #ef4444; color: #fff;
    border: none; border-radius: 50%;
    cursor: pointer;
    font-size: 12px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity .2s;
}
.mm-slot:hover .mm-close { opacity: 1; }
.mm-model { margin: 14px 0; }
.mm-section { font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 6px; }
.mm-model-list { display: flex; flex-direction: column; gap: 4px; }
.mm-radio { font-size: 12px; color: #4b5563; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.mm-radio input { accent-color: #14b8a6; }
.mm-row { margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.mm-row label { font-size: 13px; font-weight: 700; color: #374151; }
.mm-actions { display: flex; gap: 8px; margin: 16px 0 10px; }
.mm-generate {
    flex: 2; padding: 12px; background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff; border: none; border-radius: 8px; font-weight: 700; cursor: pointer;
}
.mm-clear {
    flex: 1; padding: 12px; background: #fff; color: #374151;
    border: 1px solid #d1d5db; border-radius: 8px; cursor: pointer;
}
.mm-note {
    font-size: 11px;
    color: #dc2626;
    background: #fef2f2;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #fca5a5;
    line-height: 1.6;
}

/* ============ 人像精修 ============ */
.pr-modal { padding: 0 !important; }
.pr-header { text-align: center; padding: 16px 20px; border-bottom: 1px solid #f0f0f0; position: relative; background: #faf5ff; }
.pr-modal h2 { color: #7c3aed; font-size: 22px; }
.pr-title { background: linear-gradient(90deg, #7c3aed, #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pr-subtitle { font-size: 12px; color: #6b7280; margin-top: 4px; }
.pr-header .close { position: absolute; right: 16px; top: 14px; }
.pr-body { display: grid; grid-template-columns: 1fr 360px; min-height: 480px; padding: 0; }
.pr-config { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.pr-preview { background: #f8fafc; padding: 24px; display: flex; align-items: center; justify-content: center; border-left: 1px dashed #e5e7eb; }
.pr-img-frame { width: 100%; max-width: 300px; aspect-ratio: 3/4; background: #fff; border: 2px dashed #cbd5e1; border-radius: 8px; overflow: hidden; position: relative; }
.pr-img-frame img { width: 100%; height: 100%; object-fit: cover; }
.pr-img-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 13px; }

.pr-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pr-options-2 { grid-template-columns: 1fr 1fr; }
.pr-options-3 { grid-template-columns: 1fr 1fr 1fr; }
.pr-suboptions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; max-height: 340px; overflow-y: auto; padding: 10px 4px; border-top: 1px dashed #e5e7eb; border-bottom: 1px dashed #e5e7eb; }
.pr-sub { display: flex; flex-direction: column; gap: 4px; }
.pr-sub label { font-size: 12px; color: #6b7280; font-weight: 600; }
.pr-sub select { padding: 5px 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 12px; background: #fff; }
.pr-sub select:focus { outline: none; border-color: #7c3aed; }

/* ============ 对比滑块 ============ */
.cmp-slider { width: 100%; }
.cmp-frame {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    min-height: 400px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    user-select: none;
}
.cmp-frame img {
    display: block;
    pointer-events: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.cmp-base {
    position: absolute;
    top: 0; left: 0;
    z-index: 1;
}
.cmp-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    object-fit: contain;
    object-position: left top;
    background: #fff;
}
.cmp-handle {
    position: absolute;
    top: 0; left: 50%;
    width: 10px;
    height: 100%;
    z-index: 3;
    cursor: ew-resize;
    transform: translateX(-5px);
}
.cmp-handle::before {
    content: '';
    position: absolute;
    top: 0; left: 4px;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 0 6px rgba(0,0,0,0.35);
}
.cmp-handle::after {
    content: '◀▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #6366f1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    color: #6366f1;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
    line-height: 38px;
    text-align: center;
}
.cmp-label {
    position: absolute;
    top: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 4;
    pointer-events: none;
    background: rgba(0,0,0,0.55);
    color: #fff;
    transition: all .3s;
}
.cmp-lbl-left  { left: 12px; }
.cmp-lbl-right { right: 12px; }
.cmp-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.cmp-btn {
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-block;
}
.cmp-btn-primary {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
}
.cmp-btn-primary:hover { box-shadow: 0 4px 12px rgba(124,58,237,0.4); }
.cmp-btn-secondary {
    background: #fff;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* ============ 排版打印 ============ */
.print-result {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
}
.print-result h4 {
    margin: 0 0 14px 0;
    font-size: 16px;
    color: #374151;
    font-weight: 700;
}
.print-canvas-wrap {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.print-canvas-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
    background: #fff;
}
.print-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    justify-content: center;
}
.pr-print-type {
    margin-left: 8px;
    padding: 3px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    vertical-align: middle;
}
.pr-label-inline {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    gap: 4px;
}
.pr-label-inline input[type=checkbox] { width: 16px; height: 16px; }

/* ============ 精准抠图 配置 ============ */
.pc-header { text-align: center; padding: 18px 20px; border-bottom: 1px solid #f0f0f0; background: linear-gradient(135deg, #eff6ff, #f5f3ff); }
.pc-header h2 { color: #1f2937; font-size: 22px; }
.pc-icon { font-size: 26px; }
.pc-body { padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; }
.pc-desc { background: #fafafa; border-left: 3px solid #3b82f6; padding: 12px 14px; border-radius: 4px; font-size: 13px; color: #4b5563; line-height: 1.6; }
.pc-step { display: inline-block; width: 18px; height: 18px; background: #3b82f6; color: #fff; border-radius: 50%; text-align: center; line-height: 18px; margin-right: 6px; font-size: 11px; font-weight: 700; }
.pc-tags { display: flex; gap: 8px; }
.pc-tag { padding: 4px 14px; border-radius: 16px; font-size: 12px; font-weight: 600; }
.pc-tag-blue  { background: #dbeafe; color: #1d4ed8; }
.pc-tag-green { background: #d1fae5; color: #065f46; }
.pc-section { display: flex; flex-direction: column; gap: 6px; }
.pc-section label { font-size: 13px; font-weight: 600; color: #374151; }
.pc-input { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.pc-input:focus { outline: none; border-color: #3b82f6; }
.pc-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.pc-btn { padding: 10px 22px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; }
.pc-btn-cancel { background: #f3f4f6; color: #4b5563; }
.pc-btn-primary { background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff; }
.pr-radio { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; font-size: 13px; color: #374151; }
.pr-radio:hover { border-color: #a855f7; }
.pr-radio input { accent-color: #7c3aed; }
.pr-radio input:checked + span { color: #7c3aed; font-weight: 600; }

.pr-field { display: flex; flex-direction: column; gap: 6px; }
.pr-field label { font-size: 13px; font-weight: 600; color: #374151; }
.pr-input { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.pr-input:focus { outline: none; border-color: #7c3aed; }

.pr-generate {
    margin-top: auto;
    padding: 14px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.pr-generate:hover { box-shadow: 0 4px 12px rgba(124,58,237,0.4); transform: translateY(-1px); }
.pr-cancel {
    padding: 12px;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.pr-status { font-size: 12px; color: #16a34a; text-align: center; }
