.image-edit-canvas-open {
    overflow: hidden !important;
}

.image-edit-canvas-modal {
    position: fixed;
    inset: 0;
    z-index: 100120;
    background: rgba(15, 23, 42, 0.24);
    backdrop-filter: blur(8px) saturate(1.02);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
}

.image-edit-canvas-modal.is-active {
    opacity: 1;
    pointer-events: auto;
}

.image-edit-canvas-shell {
    width: 100%;
    height: 100%;
    padding: 14px;
}

.image-edit-canvas-stage-wrap,
.image-edit-canvas-stage {
    position: relative;
    width: 100%;
    height: 100%;
}

.image-edit-canvas-stage {
    overflow: hidden;
    border-radius: 30px;
    background: #ffffff;
    box-shadow:
        inset 0 0 0 1px rgba(226,232,240,.96),
        0 18px 56px rgba(15,23,42,.12);
}

.image-edit-canvas-stage canvas {
    position: absolute;
    inset: 0;
}

.image-edit-canvas-ambient {
    display: none;
}

.image-edit-canvas-ambient-a {
    display: none;
}

.image-edit-canvas-ambient-b {
    display: none;
}

.image-edit-canvas-floating-head {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 9;
    pointer-events: none;
}

.image-edit-canvas-hint {
    position: absolute;
    left: 50%;
    top: 16px;
    z-index: 8;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.95);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.96),
        0 8px 18px rgba(15,23,42,.06);
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
    white-space: nowrap;
}

.image-edit-canvas-hint i {
    color: #6366f1;
    font-size: 12px;
}

.image-edit-canvas-hint.is-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
}

.image-edit-canvas-close,
.image-edit-canvas-nav,
.image-edit-canvas-zoombar,
.image-edit-canvas-toolbar,
.image-edit-chatdock,
.image-edit-chatbox {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.image-edit-canvas-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,.74);
    box-shadow: 0 12px 40px rgba(15,23,42,.10);
    color: #0f172a;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
    pointer-events: auto;
}

.image-edit-canvas-close:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,.94);
}

.image-edit-canvas-nav {
    position: absolute;
    left: 18px;
    bottom: 18px;
    top: auto;
    z-index: 8;
    width: auto;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.96);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.94),
        0 10px 24px rgba(15,23,42,.08);
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.image-edit-canvas-nav-title {
    display: none;
}

.image-edit-canvas-nav-list {
    display: none;
}

.image-edit-canvas-nav-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.image-edit-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 6px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,.8), rgba(255,255,255,.58));
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease, border-color .18s ease;
    border: 1px solid rgba(255,255,255,.28);
}

.image-edit-nav-item:hover,
.image-edit-nav-item.is-active {
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.86));
    border-color: rgba(99,102,241,.16);
    box-shadow: 0 12px 28px rgba(15,23,42,.10);
    transform: translateY(-1px);
}

.image-edit-nav-item-no {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: .08em;
}

.image-edit-nav-item-thumb {
    width: 46px;
    height: 58px;
    border-radius: 14px;
    overflow: hidden;
    background: #e5e7eb;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.66);
}

.image-edit-nav-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-edit-canvas-zoombar,
.image-edit-canvas-toolbar {
    display: none;
}

.image-edit-canvas-zoomlabel {
    min-width: 60px;
    text-align: center;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
}

.image-edit-nav-zoom-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
}

.image-edit-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: rgba(15,23,42,.05);
    color: #0f172a;
    font-size: 12px;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

.image-edit-toolbar-btn:hover {
    transform: translateY(-1px);
    background: rgba(109,98,255,.12);
    color: #4f46e5;
    box-shadow: inset 0 0 0 1px rgba(109,98,255,.08);
}

.image-edit-chatdock {
    display: none;
}

.image-edit-chatbox {
    position: absolute;
    left: 50%;
    bottom: 22px;
    top: auto;
    z-index: 11;
    width: 430px;
    min-width: 360px;
    max-width: min(500px, calc(100% - 180px));
    padding: 12px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(130, 151, 255, 0.12), transparent 32%),
        radial-gradient(circle at bottom left, rgba(255, 191, 132, 0.12), transparent 30%),
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,255,.94));
    border: 1px solid rgba(230, 236, 248, 0.92);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.94),
        0 10px 26px rgba(15,23,42,.08),
        0 2px 8px rgba(109,98,255,.04);
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 10px, 0) scale(.985);
    transition: opacity .22s ease, transform .22s ease, box-shadow .22s ease;
}

.image-edit-chatbox.is-active {
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
}

.image-edit-chatbox[data-position="image-below"]::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -7px;
    width: 14px;
    height: 14px;
    border-radius: 4px 0 0 0;
    background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,255,.94));
    border-top: 1px solid rgba(230, 236, 248, 0.92);
    border-left: 1px solid rgba(230, 236, 248, 0.92);
    box-shadow: -2px -2px 8px rgba(15,23,42,.03);
    transform: translateX(-50%) rotate(45deg);
}

.image-edit-chatbox-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.image-edit-chatbox-head-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.image-edit-chatbox-thumb {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    overflow: hidden;
    background: #e5e7eb;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.84), 0 4px 10px rgba(15,23,42,.04);
}

.image-edit-chatbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-edit-chatbox-meta strong {
    display: block;
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.image-edit-chatbox-meta span {
    display: block;
    margin-top: 2px;
    color: #8a98b5;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.35;
}

.image-edit-modebar {
    display: none;
}

.image-edit-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(241,245,249,.92), rgba(233,239,247,.92));
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12), 0 3px 10px rgba(15,23,42,.03);
}

.image-edit-mode-switch-head {
    margin-left: auto;
    flex-shrink: 0;
}

.image-edit-mode-chip,
.image-edit-mode-clear {
    border: none;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s ease;
}

.image-edit-mode-chip {
    min-height: 30px;
    padding: 0 12px;
    background: transparent;
    color: #475569;
    font-size: 10px;
    font-weight: 700;
}

.image-edit-mode-chip.is-active {
    background: rgba(255,255,255,.96);
    color: #0f172a;
    box-shadow: 0 3px 8px rgba(15,23,42,.04), inset 0 1px 0 rgba(255,255,255,.96);
}

.image-edit-mode-clear {
    min-height: 28px;
    padding: 0 10px;
    color: #2563eb;
    background: rgba(37,99,235,.08);
    box-shadow: inset 0 0 0 1px rgba(37,99,235,.12);
    opacity: 0;
    pointer-events: none;
    display: none;
    font-size: 10px;
}

.image-edit-mode-clear.is-visible {
    opacity: 1;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.image-edit-chatbox textarea {
    width: 100%;
    min-height: 76px;
    max-height: 112px;
    padding: 12px 14px;
    border: none;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(248,250,255,.98), rgba(244,247,252,.98));
    box-shadow:
        inset 0 0 0 1px rgba(179, 187, 255, 0.22);
    color: #0f172a;
    font-size: 12px;
    line-height: 1.55;
    font-weight: 500;
    resize: none;
    outline: none;
}

.image-edit-chatbox textarea:focus {
    box-shadow:
        inset 0 0 0 1.5px rgba(109,98,255,.34),
        0 0 0 3px rgba(109,98,255,.06);
}

.image-edit-chatbox-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.image-edit-chatbox-status {
    min-height: 14px;
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    max-width: 180px;
}

.image-edit-chatbox-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.image-edit-credit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 6px;
    color: #7b91c5;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .01em;
    white-space: nowrap;
    user-select: none;
}

.image-edit-btn-secondary,
.image-edit-btn-primary {
    border: none;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.image-edit-btn-secondary {
    background: linear-gradient(180deg, rgba(241,245,249,.96), rgba(236,241,247,.96));
    color: #334155;
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.12);
}

.image-edit-btn-primary {
    background: linear-gradient(135deg, #111827 0%, #2f3b57 100%);
    color: #fff;
    box-shadow: 0 8px 16px rgba(17,24,39,.12);
}

.image-edit-btn-primary:hover,
.image-edit-btn-secondary:hover,
.image-edit-mode-clear:hover {
    transform: translateY(-1px);
}

.image-edit-btn-primary:disabled,
.image-edit-btn-secondary:disabled {
    opacity: .6;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .image-edit-canvas-shell {
        padding: 10px;
    }

    .image-edit-canvas-stage {
        border-radius: 24px;
    }

    .image-edit-canvas-nav {
        display: none;
    }

    .image-edit-canvas-floating-head {
        top: 12px;
        right: 12px;
    }

    .image-edit-canvas-hint {
        top: 12px;
        max-width: calc(100% - 84px);
        white-space: normal;
        text-align: center;
        line-height: 1.45;
        padding: 8px 12px;
    }


    .image-edit-chatdock {
        display: none;
    }

    .image-edit-chatbox {
        width: calc(100% - 24px) !important;
        min-width: 0;
        left: 50%;
        bottom: 12px;
        top: auto !important;
        transform: translate3d(-50%, 8px, 0) scale(.985);
    }

    .image-edit-chatbox.is-active {
        transform: translate3d(-50%, 0, 0) scale(1);
    }

    .image-edit-chatbox-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .image-edit-chatbox-head {
        flex-direction: column;
        align-items: stretch;
    }

    .image-edit-chatbox-head-main,
    .image-edit-mode-switch {
        width: 100%;
    }

    .image-edit-mode-switch {
        justify-content: space-between;
    }

    .image-edit-mode-chip {
        flex: 1;
    }

    .image-edit-chatbox-buttons {
        width: 100%;
    }

    .image-edit-btn-secondary,
    .image-edit-btn-primary {
        flex: 1;
    }
}
