.image-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(15, 23, 42, 0.56);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-editor-panel {
    width: min(92vw, 1100px);
    height: min(88vh, 820px);
    background: #f8fafc;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.36);
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
}

.image-editor-toolbar {
    height: 54px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.image-editor-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-right: auto;
}

.image-editor-tool-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
}

.image-editor-tool-btn.active {
    border-color: #111827;
    box-shadow: inset 0 0 0 1px #111827;
}

.image-editor-tool-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.image-editor-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: block;
}

.image-editor-brush-size {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 4px;
    color: #374151;
    font-size: 12px;
}

.image-editor-brush-size input {
    width: 120px;
}

.image-editor-brush-size output {
    width: 36px;
    text-align: right;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.image-editor-body {
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    overflow: auto;
}

.image-editor-stage {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    background: #111827;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
}

.image-editor-stage canvas {
    display: block;
    max-width: 100%;
    max-height: calc(88vh - 130px);
    cursor: none;
}

.image-editor-cursor {
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border: 2px solid #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.image-editor-cursor.show {
    opacity: 1;
}

.image-editor-cursor.eraser {
    border-style: dashed;
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.22);
}

.image-editor-prompt-popover {
    position: absolute;
    z-index: 4;
    width: 220px;
    padding: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.2);
}

.image-editor-prompt-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.image-editor-prompt-head label {
    display: block;
    font-size: 12px;
    color: #374151;
}

.image-editor-prompt-head button {
    border: 0;
    background: transparent;
    color: #dc2626;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
}

.image-editor-prompt-popover textarea {
    width: 100%;
    height: 64px;
    resize: none;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 6px;
    font-size: 12px;
    outline: none;
}

.image-editor-prompt-popover textarea:focus {
    border-color: #111827;
}

.image-editor-footer {
    min-height: 54px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.image-editor-status {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: #6b7280;
}

.image-editor-btn {
    height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    font-size: 13px;
    cursor: pointer;
}

.image-editor-btn.primary {
    border-color: #111827;
    background: #111827;
    color: #fff;
}

.image-editor-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.left-canvas-card.image-edit-generating:not(.canvas-card-generating) {
    background: #f8f9fa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.left-canvas-card.image-edit-generating:not(.canvas-card-generating)::after {
    content: "生成中";
    color: #6b7280;
    font-size: 14px;
}

.left-canvas-card.image-edit-failed {
    background: #fff7f7;
    border: 2px dashed #fecaca;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    box-sizing: border-box;
}

.image-edit-error-text {
    max-width: 100%;
    color: #dc2626;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    word-break: break-word;
}

.image-edit-retry-btn {
    height: 30px;
    padding: 0 14px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fff;
    color: #b91c1c;
    font-size: 13px;
    cursor: pointer;
}

.image-edit-retry-btn:hover {
    background: #fff0f0;
}

.image-edit-retry-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
