/* =================================================================
   CSS3D Performance Optimization for 60fps
   ================================================================= */

/* ▼▼▼ [CRITICAL] Layout Containment - Isolate reflow/repaint ▼▼▼ */
.map-node,
.map-node-bubble,
.map-node-note,
.map-node-memo,
.map-node-file,
.map-node-image,
.map-node-code {
    box-sizing: border-box !important;
    /* contain: strict = size + layout + paint + style 모두 격리 */
    /* 노드 내부 변경이 부모/형제 레이아웃에 영향을 주지 않음 */
    contain: strict;
    /* content-visibility: auto - 화면 밖 노드는 렌더링 건너뜀 */
    /* contain-intrinsic-size로 예상 크기 힌트 제공 */
    content-visibility: auto;
    contain-intrinsic-size: 200px 100px;
}

/*
 * CSS3D로 실제 표시되는 클론은 3D transform 아래에 놓이므로
 * content-visibility:auto 가 페인트를 통째로 건너뛰는 경우가 있다.
 * 템플릿 DOM에는 최적화를 유지하되, 렌더 중인 CSS3D 클론만 강제로 visible 처리한다.
 */
.css3d-resolution-wrapper > .map-node,
.css3d-resolution-wrapper > .map-node-bubble,
.css3d-resolution-wrapper > .map-node-note,
.css3d-resolution-wrapper > .map-node-memo,
.css3d-resolution-wrapper > .map-node-file,
.css3d-resolution-wrapper > .map-node-image,
.css3d-resolution-wrapper > .map-node-code {
    content-visibility: visible !important;
    contain-intrinsic-size: auto !important;
}

/* ▲▲▲ [CRITICAL] ▲▲▲ */

:root {
    --mind-node-selection-edge: #2563eb;
    --mind-node-selection-edge-rgb: 37, 99, 235;
    --mind-node-selection-glow-rgb: 59, 130, 246;
    --mind-node-selection-glow-soft-rgb: 191, 219, 254;
    --node-selection-glow-rgb: 59, 130, 246;
    --node-selection-glow-rgb-soft: 191, 219, 254;
}

html.mind-map-scroll-locked,
body.mind-map-scroll-locked {
    height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* ▼▼▼ [GPU Compositing] Force hardware acceleration ▼▼▼ */
.css3d-resolution-wrapper,
.map-node,
.map-node-bubble,
.map-node-note,
.map-node-memo,
.map-node-code {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* 텍스트 렌더링 품질 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 서브픽셀 정렬로 흐림 방지 */
    transform: translateZ(0);
}

/* ▲▲▲ [GPU Compositing] ▲▲▲ */

/* ▼▼▼ [Fix] Disable transform transition to prevent initial position tweening ▼▼▼ */
.css3d-resolution-wrapper {
    -webkit-transition: none !important;
    transition: none !important;
}
/* ▲▲▲ [Fix] ▲▲▲ */

body.is-zooming .css3d-resolution-wrapper,
body.is-panning .css3d-resolution-wrapper {
    -webkit-transition: none !important;
    transition: none !important;
}

body.is-zooming .css3d-resolution-wrapper.selected,
body.is-panning .css3d-resolution-wrapper.selected,
body.mindcanvas-is-moving .css3d-resolution-wrapper.selected,
body.mindcanvas-is-dense .css3d-resolution-wrapper.selected {
    -webkit-filter: saturate(1.08) !important;
    filter: saturate(1.08) !important;
}

body.is-resizing .css3d-resolution-wrapper {
    -webkit-transition: none !important;
    transition: none !important;
}

body.is-zooming .node-menu-wrapper,
body.is-panning .node-menu-wrapper,
body.is-zooming .map-node-memo__icon-popover,
body.is-panning .map-node-memo__icon-popover {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
    -webkit-transition: none !important;
    transition: none !important;
}

.mindcanvas-node-toolbar,
.global-ai-input-shell {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.mindcanvas-node-toolbar {
    border-color: rgba(203, 213, 225, 0.68) !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(241, 245, 249, 0.36)) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.18);
    backdrop-filter: blur(18px) saturate(1.18);
    box-shadow:
        0 14px 28px rgba(15, 23, 42, 0.08),
        0 2px 10px rgba(148, 163, 184, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.82),
        inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.mindcanvas-node-toolbar::before,
.global-ai-input-shell::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    pointer-events: none;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.68), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.03));
    opacity: 0.9;
    z-index: 0;
}

.mindcanvas-node-toolbar > *,
.global-ai-input-shell > * {
    position: relative;
    z-index: 1;
}

.global-ai-input-shell {
    overflow: visible;
    border-color: rgba(203, 213, 225, 0.66) !important;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.62), rgba(226, 232, 240, 0.36)) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.22);
    backdrop-filter: blur(22px) saturate(1.22);
    box-shadow:
        0 20px 40px rgba(15, 23, 42, 0.1),
        0 6px 18px rgba(148, 163, 184, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.88),
        inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.global-ai-input-shell:hover,
.mindcanvas-node-toolbar:hover {
    border-color: rgba(191, 219, 254, 0.74) !important;
    box-shadow:
        0 24px 44px rgba(15, 23, 42, 0.12),
        0 8px 20px rgba(125, 211, 252, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.app-sidebar-glass {
    position: fixed !important;
    isolation: isolate;
    overflow: hidden;
    border-right-color: rgba(203, 213, 225, 0.54) !important;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(241, 245, 249, 0.3)) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.16);
    backdrop-filter: blur(18px) saturate(1.16);
    box-shadow:
        0 10px 24px rgba(15, 23, 42, 0.05),
        0 2px 10px rgba(148, 163, 184, 0.1),
        inset -1px 0 0 rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.mindcanvas-tabbar-shell .canvas-tab-bar {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.mindcanvas-tabbar-shell .canvas-tab-bar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(241, 245, 249, 0.3)) !important;
    border-bottom-color: rgba(203, 213, 225, 0.54) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.16);
    backdrop-filter: blur(18px) saturate(1.16);
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.76),
        inset 0 -1px 0 rgba(255, 255, 255, 0.16);
}

.app-sidebar-glass::before,
.mindcanvas-tabbar-shell .canvas-tab-bar::before {
    content: '';
    position: absolute;
    inset: 1px;
    pointer-events: none;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.64), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.03));
    opacity: 0.92;
    z-index: 0;
}

.app-sidebar-glass > *,
.mindcanvas-tabbar-shell .canvas-tab-bar > * {
    position: relative;
    z-index: 1;
}

.app-sidebar-glass .sidebar-icon-btn {
    color: #5f6b7a;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
}

.app-sidebar-glass .sidebar-icon-btn:hover {
    color: #334155;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.28);
    box-shadow: 0 6px 14px rgba(148, 163, 184, 0.12);
}

.app-sidebar-glass .sidebar-icon-btn.active,
.app-sidebar-glass .sidebar-icon-btn[aria-current="page"] {
    background: rgba(255, 255, 255, 0.4);
    color: #1d4ed8;
    border-color: rgba(191, 219, 254, 0.44);
    box-shadow:
        0 6px 14px rgba(59, 130, 246, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.mindcanvas-tabbar-shell .canvas-tab {
    color: #64748b;
    border-right-color: rgba(203, 213, 225, 0.42);
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.mindcanvas-tabbar-shell .canvas-tab:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #334155;
}

.mindcanvas-tabbar-shell .canvas-tab.active {
    background: rgba(255, 255, 255, 0.44);
    color: #1d4ed8;
    box-shadow:
        inset 0 -2px 0 rgba(59, 130, 246, 0.86),
        inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.mindcanvas-tabbar-shell .canvas-tab .close-btn:hover,
.mindcanvas-tabbar-shell .canvas-tab-new:hover {
    background: rgba(255, 255, 255, 0.28);
}

.mindcanvas-tabbar-shell .canvas-tab-new {
    color: #7c8797;
}

@media (prefers-color-scheme: dark) {
    .mindcanvas-node-toolbar {
        border-color: rgba(71, 85, 105, 0.68) !important;
        background:
            linear-gradient(180deg, rgba(30, 41, 59, 0.62), rgba(15, 23, 42, 0.4)) !important;
        box-shadow:
            0 14px 26px rgba(2, 6, 23, 0.34),
            0 24px 44px rgba(2, 6, 23, 0.26),
            0 2px 4px rgba(2, 6, 23, 0.18),
            inset 0 0 0 1px rgba(148, 163, 184, 0.08);
    }

    .global-ai-input-shell {
        border-color: rgba(71, 85, 105, 0.72) !important;
        background:
            linear-gradient(180deg, rgba(30, 41, 59, 0.66), rgba(15, 23, 42, 0.44)) !important;
        box-shadow:
            0 14px 26px rgba(2, 6, 23, 0.34),
            0 24px 44px rgba(2, 6, 23, 0.26),
            0 2px 4px rgba(2, 6, 23, 0.18),
            inset 0 0 0 1px rgba(148, 163, 184, 0.08);
    }

    .app-sidebar-glass {
        border-right-color: rgba(71, 85, 105, 0.52) !important;
        background:
            linear-gradient(180deg, rgba(30, 41, 59, 0.56), rgba(15, 23, 42, 0.34)) !important;
        box-shadow:
            0 10px 22px rgba(2, 6, 23, 0.22),
            0 18px 34px rgba(2, 6, 23, 0.18),
            inset -1px 0 0 rgba(148, 163, 184, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    .mindcanvas-tabbar-shell .canvas-tab-bar {
        background:
            linear-gradient(180deg, rgba(30, 41, 59, 0.58), rgba(15, 23, 42, 0.34)) !important;
        border-bottom-color: rgba(71, 85, 105, 0.54) !important;
        box-shadow:
            0 10px 22px rgba(2, 6, 23, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.04),
            inset 0 -1px 0 rgba(148, 163, 184, 0.06);
    }

    .mindcanvas-node-toolbar::before,
    .global-ai-input-shell::before,
    .app-sidebar-glass::before,
    .mindcanvas-tabbar-shell .canvas-tab-bar::before {
        background:
            radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 38%),
            linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
        opacity: 1;
    }

    .app-sidebar-glass .sidebar-icon-btn {
        color: rgba(226, 232, 240, 0.82);
        background: rgba(15, 23, 42, 0.02);
    }

    .app-sidebar-glass .sidebar-icon-btn:hover {
        color: #f8fafc;
        border-color: rgba(148, 163, 184, 0.16);
        background: rgba(148, 163, 184, 0.12);
        box-shadow: 0 8px 16px rgba(2, 6, 23, 0.16);
    }

    .app-sidebar-glass .sidebar-icon-btn.active,
    .app-sidebar-glass .sidebar-icon-btn[aria-current="page"] {
        background: rgba(59, 130, 246, 0.14);
        border-color: rgba(96, 165, 250, 0.18);
        color: #93c5fd;
        box-shadow:
            0 8px 16px rgba(2, 6, 23, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    .mindcanvas-tabbar-shell .canvas-tab {
        color: rgba(226, 232, 240, 0.74);
        border-right-color: rgba(71, 85, 105, 0.4);
    }

    .mindcanvas-tabbar-shell .canvas-tab:hover {
        background: rgba(148, 163, 184, 0.12);
        color: #f8fafc;
    }

    .mindcanvas-tabbar-shell .canvas-tab.active {
        background: rgba(148, 163, 184, 0.16);
        color: #93c5fd;
        box-shadow:
            inset 0 -2px 0 rgba(96, 165, 250, 0.92),
            inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }

    .mindcanvas-tabbar-shell .canvas-tab .close-btn:hover,
    .mindcanvas-tabbar-shell .canvas-tab-new:hover {
        background: rgba(148, 163, 184, 0.14);
    }

    .mindcanvas-tabbar-shell .canvas-tab-new {
        color: rgba(226, 232, 240, 0.6);
    }
}

/* ▼▼▼ [CRITICAL] Zoom/Drag 중 포인터 이벤트 비활성화 ▼▼▼ */
/* Hover raycast is already short-circuited in JS during pan, so keep CSS hover/focus
   intact while middle-button panning. We still suppress hit-testing for zoom/drag. */
#css3d-dom-wrapper.is-dragging,
body.is-zooming #css3d-dom-wrapper {
    pointer-events: none !important;
}

/* 노드 드래그 중 grabbing 커서 강제 (CSS3D DOM 요소가 덮어씌우는 것 방지) */
body.is-node-dragging,
body.is-node-dragging * {
    cursor: grabbing !important;
}

/* ▲▲▲ [CRITICAL] ▲▲▲ */

/* ▼▼▼ [Perf] CSS3D 노드 최소화된 box-shadow ▼▼▼ */
/* box-shadow 대신 border로 시각적 테두리 구현 (GPU 부담 감소) */
.map-node-note {
    /* 기본: border만 사용, shadow 제거 */
    box-shadow: none;
    /* 노트 노드는 선택 시 드래그 이동이므로 grab 커서 (편집 모드에서만 text) */
    cursor: grab !important;
}

.map-node-memo {
    cursor: grab !important;
}

.map-node-note:focus-within {
    cursor: text !important;
}

.map-node-note.selected {
    /* 선택 시에만 최소한의 glow */
    box-shadow: 0 0 0 2px rgba(var(--mind-node-selection-glow-rgb), 0.14);
}

/* ▲▲▲ [Perf] ▲▲▲ */

/* Mind map selection highlight overrides (keep in sync with editing theme) */

.map-node-bubble.selected {
    border-color: var(--mind-node-selection-edge) !important;
    box-shadow: 0 0 0 2px rgba(var(--mind-node-selection-glow-rgb), 0.18),
        0 0 22px rgba(var(--mind-node-selection-glow-rgb), 0.18),
        0 10px 15px -3px rgba(0, 0, 0, 0.2) !important;
    overflow: hidden !important;
}

.map-node-note.selected,
.map-node-note:focus-within {
    border-color: var(--mind-node-selection-edge) !important;
    box-shadow:
        0 0 18px 0 rgba(var(--mind-node-selection-glow-rgb), 0.24),
        0 0 32px 0 rgba(var(--mind-node-selection-glow-soft-rgb), 0.16) !important;
    overflow: hidden !important;
}

/* Note/Image hard edge lives on the inner CSS3D card in app.css.
   Keep the soft wrapper shadow, but strip the dark stroke from the card itself. */
.map-node-note,
.map-node-note.selected,
.map-node-note:focus-within,
.map-node-image-container,
.map-node-image-container.selected {
    border: none !important;
    border-color: transparent !important;
    outline: none !important;
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
}

.css3d-resolution-wrapper.node-type-note {
    -webkit-box-shadow:
        0 0 6px rgba(15, 23, 42, 0.25),
        0 0 16px rgba(15, 23, 42, 0.18),
        0 0 30px rgba(15, 23, 42, 0.12),
        0 0 50px rgba(15, 23, 42, 0.08) !important;
    box-shadow:
        0 0 6px rgba(15, 23, 42, 0.25),
        0 0 16px rgba(15, 23, 42, 0.18),
        0 0 30px rgba(15, 23, 42, 0.12),
        0 0 50px rgba(15, 23, 42, 0.08) !important;
}

.css3d-resolution-wrapper.selected {
    outline: 1px solid rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.24) !important;
    outline-offset: 1px;
    -webkit-box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft, 191, 219, 254), 0.26) !important;
    box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft, 191, 219, 254), 0.26) !important;
    -webkit-filter: saturate(1.08) !important;
    filter: saturate(1.08) !important;
}

.css3d-resolution-wrapper.selection-style-agent.selected {
    outline: 1px solid rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.24) !important;
    outline-offset: 1px;
    -webkit-box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft, 191, 219, 254), 0.26) !important;
    box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft, 191, 219, 254), 0.26) !important;
    -webkit-filter: saturate(1.08) !important;
    filter: saturate(1.08) !important;
}

/* During resize, keep the crisp selection edge but drop the large blur shadow.
   The blur bleeds underneath overlapping siblings and looks like a second glow. */
body.is-resizing .css3d-resolution-wrapper.selected,
body.is-resizing .css3d-resolution-wrapper.node-type-note.selected,
body.is-resizing .css3d-resolution-wrapper.node-type-image.selected {
    outline: 1px solid rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.34) !important;
    outline-offset: 1px;
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
    -webkit-filter: none !important;
    filter: none !important;
}

.css3d-resolution-wrapper.node-type-note.selected {
    -webkit-box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft), 0.26) !important;
    box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft), 0.26) !important;
    -webkit-filter: saturate(1.08) !important;
    filter: saturate(1.08) !important;
}

.css3d-resolution-wrapper.node-type-image {
    -webkit-box-shadow:
        0 0 6px rgba(15, 23, 42, 0.25),
        0 0 16px rgba(15, 23, 42, 0.18),
        0 0 30px rgba(15, 23, 42, 0.12),
        0 0 50px rgba(15, 23, 42, 0.08) !important;
    box-shadow:
        0 0 6px rgba(15, 23, 42, 0.25),
        0 0 16px rgba(15, 23, 42, 0.18),
        0 0 30px rgba(15, 23, 42, 0.12),
        0 0 50px rgba(15, 23, 42, 0.08) !important;
}

.css3d-resolution-wrapper.node-type-image.selected {
    -webkit-box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft), 0.26) !important;
    box-shadow:
        0 0 4px rgba(var(--node-selection-glow-rgb), 0.56),
        0 0 12px rgba(var(--node-selection-glow-rgb), 0.44),
        0 0 28px rgba(var(--node-selection-glow-rgb), 0.32),
        0 0 56px rgba(var(--node-selection-glow-rgb-soft), 0.26) !important;
    -webkit-filter: saturate(1.08) !important;
    filter: saturate(1.08) !important;
}

.map-node-memo.selected,
.map-node-memo:focus-within {
    overflow: hidden !important;
}

.map-node-code.selected,
.map-node-code:focus-within {
    border-color: var(--mind-node-selection-edge) !important;
    box-shadow:
        0 0 18px 0 rgba(var(--mind-node-selection-glow-rgb), 0.24),
        0 0 32px 0 rgba(var(--mind-node-selection-glow-soft-rgb), 0.16) !important;
    overflow: hidden !important;
}

.map-node-agent:not(.map-node-memo).selected,
.map-node-agent:not(.map-node-memo):focus-within {
    border-color: rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.82) !important;
    box-shadow:
        0 0 18px 0 rgba(var(--node-selection-glow-rgb, 59, 130, 246), 0.24),
        0 0 32px 0 rgba(var(--node-selection-glow-rgb-soft, 191, 219, 254), 0.16) !important;
    overflow: visible !important;
}

/* Use the wrapper as the single source of truth for CSS3D selection glow.
   Agent wrappers intentionally mirror the edit-state glow so selection/editing
   keep the same visual signature even when overlays swap in and out. */
.css3d-resolution-wrapper.selected .map-node-bubble.selected,
.css3d-resolution-wrapper.selected .map-node-code.selected,
.css3d-resolution-wrapper.selected .map-node-code:focus-within,
.css3d-resolution-wrapper.selected .map-node-agent.selected,
.css3d-resolution-wrapper.selected .map-node-agent:focus-within {
    -webkit-box-shadow: none !important;
    box-shadow: none !important;
}

.map-node.map-node-agent,
.map-node-memo.map-node-agent {
    contain: layout style !important;
    content-visibility: visible !important;
    contain-intrinsic-size: auto !important;
}

.map-node-memo.map-node-agent.selected,
.map-node-memo.map-node-agent:focus-within {
    overflow: visible !important;
}

/* Enable pointer events only when a note node is selected (CSS3D wrapper) */
.css3d-resolution-wrapper.selected {
    pointer-events: auto !important;
}

.css3d-resolution-wrapper.selected,
.map-node-bubble.selected,
.map-node-note.selected,
.map-node-note:focus-within,
.map-node-memo.selected,
.map-node-memo:focus-within,
.map-node-code.selected,
.map-node-code:focus-within,
.map-node-agent.selected,
.map-node-agent:focus-within {
    -webkit-transition: none !important;
    transition: none !important;
}

.css3d-resolution-wrapper.selected .map-node-note,
.css3d-resolution-wrapper.selected .map-node-note *,
.css3d-resolution-wrapper.selected .map-node-memo,
.css3d-resolution-wrapper.selected .map-node-memo * {
    pointer-events: auto !important;
}


/* Hide scrollbars after editing when selected but not actively focused */
.map-node-note.selected:not(:focus-within) .note-textarea {
    overflow: hidden !important;
    scrollbar-width: none !important;
    cursor: grab !important;
}

.map-node-note.selected:not(:focus-within) .note-textarea::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
}

.map-node-memo .map-node-memo__body,
.map-node-memo .map-node-memo__title {
    pointer-events: auto;
}

.map-node-file.selected {
    border-color: var(--mind-node-selection-edge) !important;
}

/* Sticky LOD cache: keep DOM, toggle visibility via class */
.node-container.lod-low .markdown-content {
    display: none !important;
}

.node-container.lod-low .simple-content {
    display: block !important;
}

.node-container.lod-high .simple-content {
    display: none !important;
}

.node-container.lod-high .markdown-content {
    display: block !important;
}

.mind-map-text-overlay-v2-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
    contain: layout style paint;
}

.mind-map-text-overlay-v2-layer.is-motion-hint {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.mind-map-text-overlay-v2-card {
    position: absolute;
    display: none;
    box-sizing: border-box;
    pointer-events: auto;
    transform-origin: 0 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    contain: layout style paint;
}

.mind-map-text-overlay-v2-card.is-selection {
    z-index: 8;
}

.mind-map-text-overlay-v2-card.is-editing {
    z-index: 12;
}

.mind-map-text-overlay-v2-card.is-passive {
    pointer-events: none;
    /* CSS3D owns card background/edge/glow; passive overlay only contributes
       readable text fragments and must never paint over the CSS3D glow. */
    contain: layout style;
    overflow: visible;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

.mind-map-text-overlay-v2-card.is-passive .mind-map-text-overlay-v2-body {
    pointer-events: auto;
}

body.is-panning .mind-map-text-overlay-v2-card.is-passive .mind-map-text-overlay-v2-body {
    pointer-events: none !important;
}

.mind-map-text-overlay-v2-shell {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.985);
    color: #1f2937;
    --mind-map-text-scrollbar-size: 8px;
    --mind-map-text-scrollbar-size-x: 8px;
    --mind-map-text-scrollbar-size-y: 8px;
    --mind-map-text-scrollbar-gutter: 14px;
}

.mind-map-text-overlay-v2-source-clone {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    --mind-map-text-scrollbar-size: 8px;
    --mind-map-text-scrollbar-size-x: 8px;
    --mind-map-text-scrollbar-size-y: 8px;
    --mind-map-text-scrollbar-gutter: 14px;
}

.mind-map-text-overlay-v2-content-shell {
    position: relative;
    overflow: visible;
    pointer-events: none;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.mind-map-text-overlay-v2-fragment {
    position: absolute;
    background: transparent !important;
    box-shadow: none !important;
}

.mind-map-text-overlay-v2-readonly-memo-surface,
.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__shell,
.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__header,
.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__icon-wrap,
.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__title-wrap,
.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__title,
.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__body-view,
.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__agent-results {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    outline: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__header {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
}

.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__icon-wrap {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
}

.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__title-wrap {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.mind-map-text-overlay-v2-readonly-memo-surface .map-node-memo__title {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

.mind-map-text-overlay-v2-shell.type-text,
.mind-map-text-overlay-v2-shell.type-markdown {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
    padding: 18px;
    border: 3px solid #374151;
    border-radius: 18px;
}

.mind-map-text-overlay-v2-shell.type-note {
    display: block;
    padding: 16px;
    border: none;
    border-radius: 18px;
}

.mind-map-text-overlay-v2-shell.type-memo {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding: 18px;
    border-radius: 30px;
    border: 2px solid rgba(55, 65, 81, 0.16);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.mind-map-text-overlay-v2-title,
.mind-map-text-overlay-v2-memo-title {
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
}

.mind-map-text-overlay-v2-memo-title {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.05rem;
    padding: 0;
}

.mind-map-text-overlay-v2-body {
    min-height: 0;
    height: 100%;
    overflow: auto;
    padding-right: var(--mind-map-text-scrollbar-gutter);
}

.mind-map-text-overlay,
.css3d-resolution-wrapper {
    --mind-map-text-scrollbar-size: 8px;
    --mind-map-text-scrollbar-size-x: 8px;
    --mind-map-text-scrollbar-size-y: 8px;
    --mind-map-text-scrollbar-gutter: 14px;
}

.css3d-resolution-wrapper .thin-scrollbar,
.css3d-resolution-wrapper .note-textarea,
.css3d-resolution-wrapper .note-content,
.css3d-resolution-wrapper .markdown-body,
.css3d-resolution-wrapper .prose,
.css3d-resolution-wrapper .code-body,
.css3d-resolution-wrapper .map-node-memo__body,
.css3d-resolution-wrapper .map-node-memo__body-view,
.mind-map-text-overlay .thin-scrollbar,
.mind-map-text-overlay .note-textarea,
.mind-map-text-overlay .note-content,
.mind-map-text-overlay .markdown-body,
.mind-map-text-overlay .prose,
.mind-map-text-overlay .code-body,
.mind-map-text-overlay .map-node-memo__body,
.mind-map-text-overlay .map-node-memo__body-view,
.mind-map-text-overlay-v2-card .thin-scrollbar,
.mind-map-text-overlay-v2-card .note-textarea,
.mind-map-text-overlay-v2-card .note-content,
.mind-map-text-overlay-v2-card .markdown-body,
.mind-map-text-overlay-v2-card .prose,
.mind-map-text-overlay-v2-card .code-body,
.mind-map-text-overlay-v2-card .map-node-memo__body,
.mind-map-text-overlay-v2-card .map-node-memo__body-view {
    box-sizing: border-box;
    scrollbar-gutter: stable;
    padding-right: var(--mind-map-text-scrollbar-gutter) !important;
}

.css3d-resolution-wrapper .note-textarea,
.mind-map-text-overlay .note-textarea,
.mind-map-text-overlay-v2-card .note-textarea,
.mind-map-edit-overlay-card .note-textarea {
    text-decoration: none !important;
    text-decoration-skip-ink: none !important;
    text-underline-offset: 0 !important;
    color: transparent !important;
    text-shadow: 0 0 0 #1f2937 !important;
    -webkit-text-fill-color: transparent !important;
    caret-color: #1f2937 !important;
}

.css3d-resolution-wrapper .note-textarea::selection,
.mind-map-text-overlay .note-textarea::selection,
.mind-map-text-overlay-v2-card .note-textarea::selection,
.mind-map-edit-overlay-card .note-textarea::selection {
    background-color: #3b82f6 !important;
    color: transparent !important;
    text-shadow: 0 0 0 #ffffff !important;
}

.css3d-resolution-wrapper .map-node-memo__body,
.mind-map-text-overlay .map-node-memo__body,
.mind-map-text-overlay-v2-card .map-node-memo__body,
.mind-map-edit-overlay-card .map-node-memo__body {
    padding-top: 16px !important;
    padding-right: var(--mind-map-text-scrollbar-gutter, 14px) !important;
    padding-bottom: 16px !important;
    padding-left: 18px !important;
    text-indent: 0 !important;
    caret-color: #1f2937 !important;
}

.css3d-resolution-wrapper .thin-scrollbar::-webkit-scrollbar,
.css3d-resolution-wrapper .note-textarea::-webkit-scrollbar,
.css3d-resolution-wrapper .note-content::-webkit-scrollbar,
.css3d-resolution-wrapper .markdown-body::-webkit-scrollbar,
.css3d-resolution-wrapper .prose::-webkit-scrollbar,
.css3d-resolution-wrapper .code-body::-webkit-scrollbar,
.css3d-resolution-wrapper .map-node-memo__body::-webkit-scrollbar,
.css3d-resolution-wrapper .map-node-memo__body-view::-webkit-scrollbar,
.mind-map-text-overlay .thin-scrollbar::-webkit-scrollbar,
.mind-map-text-overlay .note-textarea::-webkit-scrollbar,
.mind-map-text-overlay .note-content::-webkit-scrollbar,
.mind-map-text-overlay .markdown-body::-webkit-scrollbar,
.mind-map-text-overlay .prose::-webkit-scrollbar,
.mind-map-text-overlay .code-body::-webkit-scrollbar,
.mind-map-text-overlay .map-node-memo__body::-webkit-scrollbar,
.mind-map-text-overlay .map-node-memo__body-view::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .thin-scrollbar::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .note-textarea::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .note-content::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .markdown-body::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .prose::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .code-body::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .map-node-memo__body::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .map-node-memo__body-view::-webkit-scrollbar {
    width: var(--mind-map-text-scrollbar-size-x, var(--mind-map-text-scrollbar-size));
    height: var(--mind-map-text-scrollbar-size-y, var(--mind-map-text-scrollbar-size));
}

.mind-map-text-overlay .note-textarea,
.mind-map-text-overlay .note-content,
.mind-map-text-overlay .markdown-body,
.mind-map-text-overlay .prose,
.mind-map-text-overlay .code-body,
.mind-map-text-overlay [id^="node-response-"],
.mind-map-text-overlay [id^="node-textarea-"],
.mind-map-text-overlay-v2-card .note-textarea,
.mind-map-text-overlay-v2-card .note-content,
.mind-map-text-overlay-v2-card .markdown-body,
.mind-map-text-overlay-v2-card .prose,
.mind-map-text-overlay-v2-card .code-body,
.mind-map-text-overlay-v2-card [id^="node-response-"],
.mind-map-text-overlay-v2-card [id^="node-textarea-"] {
    box-sizing: border-box !important;
    scrollbar-gutter: stable !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent !important;
    padding-right: 14px !important;
}

.mind-map-text-overlay-v2-editing-note-surface .node-response,
.mind-map-text-overlay-v2-editing-note-surface .note-content,
.mind-map-edit-overlay-card .node-response,
.mind-map-edit-overlay-card .note-content {
    padding-right: 0 !important;
    overflow: hidden !important;
    scrollbar-gutter: auto !important;
}

.mind-map-text-overlay-v2-editing-note-surface .note-textarea,
.mind-map-edit-overlay-card .note-textarea {
    padding-right: 14px !important;
    scrollbar-gutter: stable !important;
}

.mind-map-text-overlay .note-textarea::-webkit-scrollbar,
.mind-map-text-overlay .note-content::-webkit-scrollbar,
.mind-map-text-overlay .markdown-body::-webkit-scrollbar,
.mind-map-text-overlay .code-body::-webkit-scrollbar,
.mind-map-text-overlay .prose::-webkit-scrollbar,
.mind-map-text-overlay [id^="node-response-"]::-webkit-scrollbar,
.mind-map-text-overlay [id^="node-textarea-"]::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .note-textarea::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .note-content::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .markdown-body::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .code-body::-webkit-scrollbar,
.mind-map-text-overlay-v2-card .prose::-webkit-scrollbar,
.mind-map-text-overlay-v2-card [id^="node-response-"]::-webkit-scrollbar,
.mind-map-text-overlay-v2-card [id^="node-textarea-"]::-webkit-scrollbar {
    width: 8px !important;
    height: 8px !important;
}

.mind-map-text-overlay .note-textarea::-webkit-scrollbar-thumb,
.mind-map-text-overlay .note-content::-webkit-scrollbar-thumb,
.mind-map-text-overlay .markdown-body::-webkit-scrollbar-thumb,
.mind-map-text-overlay .code-body::-webkit-scrollbar-thumb,
.mind-map-text-overlay .prose::-webkit-scrollbar-thumb,
.mind-map-text-overlay [id^="node-response-"]::-webkit-scrollbar-thumb,
.mind-map-text-overlay [id^="node-textarea-"]::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .note-textarea::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .note-content::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .markdown-body::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .code-body::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .prose::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card [id^="node-response-"]::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card [id^="node-textarea-"]::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2) !important;
    border-radius: 10px !important;
}

.mind-map-text-overlay .note-textarea::-webkit-scrollbar-track,
.mind-map-text-overlay .note-content::-webkit-scrollbar-track,
.mind-map-text-overlay .markdown-body::-webkit-scrollbar-track,
.mind-map-text-overlay .code-body::-webkit-scrollbar-track,
.mind-map-text-overlay .prose::-webkit-scrollbar-track,
.mind-map-text-overlay [id^="node-response-"]::-webkit-scrollbar-track,
.mind-map-text-overlay [id^="node-textarea-"]::-webkit-scrollbar-track,
.mind-map-text-overlay-v2-card .note-textarea::-webkit-scrollbar-track,
.mind-map-text-overlay-v2-card .note-content::-webkit-scrollbar-track,
.mind-map-text-overlay-v2-card .markdown-body::-webkit-scrollbar-track,
.mind-map-text-overlay-v2-card .code-body::-webkit-scrollbar-track,
.mind-map-text-overlay-v2-card .prose::-webkit-scrollbar-track,
.mind-map-text-overlay-v2-card [id^="node-response-"]::-webkit-scrollbar-track,
.mind-map-text-overlay-v2-card [id^="node-textarea-"]::-webkit-scrollbar-track {
    background: transparent !important;
}

.mind-map-text-overlay .note-textarea:hover,
.mind-map-text-overlay .note-content:hover,
.mind-map-text-overlay .markdown-body:hover,
.mind-map-text-overlay .code-body:hover,
.mind-map-text-overlay .prose:hover,
.mind-map-text-overlay [id^="node-response-"]:hover,
.mind-map-text-overlay [id^="node-textarea-"]:hover,
.mind-map-text-overlay-v2-card .note-textarea:hover,
.mind-map-text-overlay-v2-card .note-content:hover,
.mind-map-text-overlay-v2-card .markdown-body:hover,
.mind-map-text-overlay-v2-card .code-body:hover,
.mind-map-text-overlay-v2-card .prose:hover,
.mind-map-text-overlay-v2-card [id^="node-response-"]:hover,
.mind-map-text-overlay-v2-card [id^="node-textarea-"]:hover {
    scrollbar-color: rgba(0, 0, 0, 0.38) transparent !important;
}

.mind-map-text-overlay .note-textarea:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay .note-content:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay .markdown-body:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay .code-body:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay .prose:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay [id^="node-response-"]:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay [id^="node-textarea-"]:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay .note-textarea::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay .note-content::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay .markdown-body::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay .code-body::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay .prose::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay [id^="node-response-"]::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay [id^="node-textarea-"]::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay-v2-card .note-textarea:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .note-content:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .markdown-body:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .code-body:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .prose:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card [id^="node-response-"]:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card [id^="node-textarea-"]:hover::-webkit-scrollbar-thumb,
.mind-map-text-overlay-v2-card .note-textarea::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay-v2-card .note-content::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay-v2-card .markdown-body::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay-v2-card .code-body::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay-v2-card .prose::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay-v2-card [id^="node-response-"]::-webkit-scrollbar-thumb:hover,
.mind-map-text-overlay-v2-card [id^="node-textarea-"]::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.38) !important;
}

.mind-map-text-overlay .prose,
.mind-map-text-overlay [id^="node-response-"],
.mind-map-text-overlay-v2-card .prose,
.mind-map-text-overlay-v2-card [id^="node-response-"] {
    padding-right: 14px !important;
}

.mind-map-text-overlay .code-body,
.mind-map-text-overlay-v2-card .code-body {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    padding-right: 14px !important;
}

.mind-map-text-overlay .code-body > .code-body-content,
.mind-map-text-overlay-v2-card .code-body > .code-body-content {
    display: block !important;
    min-width: 100% !important;
    width: max-content !important;
    box-sizing: border-box !important;
    padding: 2px 0 2px 0 !important;
    white-space: inherit !important;
    overflow-wrap: inherit !important;
}

.mind-map-text-overlay-v2-body.is-nowrap,
.mind-map-text-overlay-v2-body.is-nowrap .mind-map-text-overlay-v2-plain {
    white-space: pre !important;
    overflow-wrap: normal !important;
}

.mind-map-text-overlay-v2-plain {
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.mind-map-text-overlay-v2-textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: 1.6;
    box-sizing: border-box;
}

.mind-map-text-overlay-v2-card .map-node-bubble,
.mind-map-text-overlay-v2-card .map-node-note,
.mind-map-text-overlay-v2-card .map-node-memo {
    max-width: none !important;
    min-width: 0 !important;
}

.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-note-surface,
.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-note-surface .node-content-wrapper,
.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-note-surface .node-content,
.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-note-surface .node-response,
.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-note-surface .note-content,
.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-note-surface .note-textarea {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    outline: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-memo-surface .map-node-memo__body {
    color: #1f2937 !important;
    caret-color: #1f2937 !important;
}

.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-surface .map-node-memo__header {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
}

.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-surface .map-node-memo__icon-wrap {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
}

.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-surface .map-node-memo__title-wrap {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.mind-map-text-overlay-v2-card.is-editing .mind-map-text-overlay-v2-editing-surface .map-node-memo__title {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

.mind-map-v2-source-suspended .node-content-wrapper,
.mind-map-v2-source-suspended .node-content,
.mind-map-v2-source-suspended .node-response,
.mind-map-v2-source-suspended [id^="node-response-"],
.mind-map-v2-source-suspended [id^="node-textarea-"],
.mind-map-v2-source-suspended .text-content,
.mind-map-v2-source-suspended .prose,
.mind-map-v2-source-suspended .markdown-body,
.mind-map-v2-source-suspended .code-body,
.mind-map-v2-source-suspended .note-content,
.mind-map-v2-source-suspended .note-textarea,
.mind-map-v2-source-suspended .map-node-memo__title,
.mind-map-v2-source-suspended .map-node-memo__body,
.mind-map-v2-source-suspended .map-node-memo__body-view,
.mind-map-v2-source-suspended .map-node-memo__icon-wrap,
.mind-map-v2-source-suspended .map-node-memo__icon-button,
.mind-map-v2-source-suspended .map-node-memo__icon-popover,
.mind-map-v2-source-suspended .map-node-memo__agent-plan-title,
.mind-map-v2-source-suspended .map-node-memo__agent-plan-chips,
.mind-map-v2-source-suspended .map-node-memo__agent-plan-body,
.mind-map-v2-source-suspended .map-node-memo__agent-console-title,
.mind-map-v2-source-suspended .map-node-memo__agent-console-body {
    opacity: 0 !important;
    visibility: hidden !important;
    content-visibility: hidden !important;
    contain: layout style paint !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    caret-color: transparent !important;
}

.mind-map-v2-source-suspended .map-node-memo__agent-console-panel,
.mind-map-v2-source-suspended .map-node-memo__agent-console-title,
.mind-map-v2-source-suspended .map-node-memo__agent-console-body,
.mind-map-v2-source-suspended .map-node-memo__agent-console-body * {
    opacity: 1 !important;
    visibility: visible !important;
    content-visibility: visible !important;
    contain: none !important;
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    caret-color: auto !important;
}

.sidebar-section-divider {
    width: 22px;
    height: 1px;
    margin: 6px 0;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0), rgba(148, 163, 184, 0.7), rgba(148, 163, 184, 0));
}

.sidebar-icon-btn--launcher {
    position: relative;
}

.sidebar-icon-btn--launcher.sidebar-icon-btn--launcher-active::after {
    content: '';
    position: absolute;
    right: 4px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    transform: translateY(-50%);
    background: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.sidebar-hover-card,
.template-launcher-panel,
.mindcanvas-toolbar-hint {
    border: 1px solid rgba(203, 213, 225, 0.82);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.88));
    box-shadow:
        0 20px 40px rgba(15, 23, 42, 0.12),
        0 8px 20px rgba(148, 163, 184, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(18px) saturate(1.12);
    backdrop-filter: blur(18px) saturate(1.12);
}

.sidebar-hover-card {
    width: 280px;
    padding: 14px 16px;
    border-radius: 18px;
}

.sidebar-hover-card__eyebrow,
.template-launcher-panel__eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #64748b;
}

.sidebar-hover-card__title,
.mindcanvas-toolbar-hint__title {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.sidebar-hover-card__description,
.mindcanvas-toolbar-hint__description,
.template-launcher-panel__description {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.55;
    color: #475569;
}

.template-launcher-panel {
    width: min(340px, calc(100vw - 92px));
    border-radius: 22px;
    padding: 18px;
}

.template-launcher-panel__title {
    margin-top: 8px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.template-launcher-panel__prompt {
    margin-top: 18px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.template-launcher-panel__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.template-launcher-panel__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.template-launcher-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.template-launcher-field__label {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
}

.template-launcher-field__description {
    font-size: 11px;
    line-height: 1.5;
    color: #64748b;
}

.template-launcher-field__input,
.template-launcher-field__textarea,
.template-launcher-field__select {
    width: 100%;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    font-size: 12px;
    line-height: 1.5;
    padding: 10px 12px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.template-launcher-field__textarea {
    min-height: 88px;
    resize: vertical;
}

.template-launcher-field__input:focus,
.template-launcher-field__textarea:focus,
.template-launcher-field__select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.56);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
    background: #ffffff;
}

.template-launcher-panel__validation {
    margin-top: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
}

.template-launcher-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(255, 255, 255, 0.8);
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.template-launcher-chip:hover {
    border-color: rgba(125, 211, 252, 0.82);
    background: rgba(240, 249, 255, 0.94);
    color: #0f172a;
    transform: translateY(-1px);
}

.template-launcher-chip--active {
    border-color: rgba(59, 130, 246, 0.42);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.08));
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.template-launcher-panel__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.template-launcher-panel__secondary,
.template-launcher-panel__primary {
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.template-launcher-panel__secondary {
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(255, 255, 255, 0.82);
    color: #475569;
}

.template-launcher-panel__primary {
    border: 1px solid rgba(29, 78, 216, 0.14);
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.template-launcher-panel__primary:disabled {
    cursor: not-allowed;
    opacity: 0.62;
    box-shadow: none;
    transform: none;
}

.template-launcher-panel__secondary:hover,
.template-launcher-panel__primary:hover {
    transform: translateY(-1px);
}

.mindcanvas-toolbar-hint {
    margin-top: 10px;
    min-width: 240px;
    max-width: 360px;
    padding: 10px 14px;
    border-radius: 16px;
    align-self: center;
}

.template-studio-chooser {
    width: min(420px, calc(100vw - 96px));
    padding: 24px 24px 20px;
    border-radius: 28px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94));
    box-shadow:
        0 28px 54px rgba(15, 23, 42, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(22px);
}

.template-studio-chooser__actions {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.template-studio-chooser__action {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: start;
    width: 100%;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(255, 255, 255, 0.88);
    color: #0f172a;
    text-align: left;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.template-studio-chooser__action:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.28);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

.template-studio-chooser__action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 14px;
    background: rgba(219, 234, 254, 0.92);
    color: #2563eb;
}

.template-studio-chooser__action-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.template-studio-chooser__action-description {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.55;
    color: #475569;
}

.template-studio-toolbar-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: auto;
}

.template-studio-toolbar {
    gap: 8px;
    max-width: min(720px, calc(100vw - 112px));
}

.template-studio-toolbar__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 2px 0 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f172a;
}

.template-studio-toolbar__meta {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.template-studio-toolbar__meta--selected {
    max-width: 180px;
}

.template-studio-toolbar__button {
    min-width: 36px;
}

.template-studio-toolbar__button--active {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.template-studio-toolbar__token {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.template-studio-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: auto;
    padding: 18px;
    border-radius: 26px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 24px 54px rgba(15, 23, 42, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px);
}

.template-studio-panel__section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-studio-panel__eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #64748b;
}

.template-studio-panel__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.template-studio-panel__input,
.template-studio-panel__select,
.template-studio-panel__textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    font-size: 13px;
    line-height: 1.5;
    padding: 10px 12px;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.template-studio-panel__textarea {
    min-height: 88px;
    resize: vertical;
}

.template-studio-panel__input:focus,
.template-studio-panel__select:focus,
.template-studio-panel__textarea:focus {
    border-color: rgba(59, 130, 246, 0.72);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.template-studio-panel__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.template-studio-panel__node-summary {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    background: rgba(248, 250, 252, 0.92);
}

.template-studio-panel__node-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.template-studio-panel__node-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

.template-studio-panel__hint {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.68);
    background: rgba(248, 250, 252, 0.84);
    font-size: 12px;
    line-height: 1.6;
    color: #475569;
}

.template-studio-panel__issues {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-studio-panel__issue {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(251, 191, 36, 0.32);
    background: rgba(255, 251, 235, 0.92);
    font-size: 12px;
    color: #92400e;
}

.template-studio-panel__manifest-actions {
    display: flex;
    justify-content: flex-end;
}

.template-studio-panel__manifest {
    margin: 0;
    max-height: 280px;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    background: rgba(248, 250, 252, 0.94);
    padding: 14px;
    font-size: 11px;
    line-height: 1.6;
    color: #0f172a;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (prefers-color-scheme: dark) {
    .sidebar-section-divider {
        background: linear-gradient(90deg, rgba(71, 85, 105, 0), rgba(148, 163, 184, 0.66), rgba(71, 85, 105, 0));
    }

    .sidebar-icon-btn--launcher.sidebar-icon-btn--launcher-active::after {
        background: #93c5fd;
        box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.12);
    }

    .sidebar-hover-card,
    .template-launcher-panel,
    .mindcanvas-toolbar-hint {
        border-color: rgba(71, 85, 105, 0.82);
        background:
            linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.88));
        box-shadow:
            0 22px 42px rgba(2, 6, 23, 0.34),
            inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    .sidebar-hover-card__eyebrow,
    .template-launcher-panel__eyebrow {
        color: rgba(148, 163, 184, 0.82);
    }

    .sidebar-hover-card__title,
    .mindcanvas-toolbar-hint__title,
    .template-launcher-panel__title {
        color: #f8fafc;
    }

    .sidebar-hover-card__description,
    .mindcanvas-toolbar-hint__description,
    .template-launcher-panel__description,
    .template-launcher-panel__prompt {
        color: rgba(226, 232, 240, 0.8);
    }

    .template-launcher-chip {
        border-color: rgba(71, 85, 105, 0.82);
        background: rgba(30, 41, 59, 0.74);
        color: rgba(226, 232, 240, 0.88);
    }

    .template-launcher-chip:hover {
        border-color: rgba(96, 165, 250, 0.72);
        background: rgba(30, 64, 175, 0.22);
        color: #eff6ff;
    }

    .template-launcher-chip--active {
        border-color: rgba(96, 165, 250, 0.54);
        background: rgba(30, 64, 175, 0.32);
        color: #93c5fd;
    }

    .template-launcher-field__label {
        color: #f8fafc;
    }

    .template-launcher-field__description,
    .template-launcher-panel__validation {
        color: rgba(226, 232, 240, 0.72);
    }

    .template-launcher-field__input,
    .template-launcher-field__textarea,
    .template-launcher-field__select {
        border-color: rgba(71, 85, 105, 0.82);
        background: rgba(15, 23, 42, 0.68);
        color: #f8fafc;
    }

    .template-launcher-field__input:focus,
    .template-launcher-field__textarea:focus,
    .template-launcher-field__select:focus {
        border-color: rgba(96, 165, 250, 0.72);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
        background: rgba(15, 23, 42, 0.82);
    }

    .template-launcher-panel__secondary {
        border-color: rgba(71, 85, 105, 0.82);
        background: rgba(30, 41, 59, 0.82);
        color: rgba(226, 232, 240, 0.86);
    }

    .template-studio-chooser,
    .template-studio-panel {
        border-color: rgba(71, 85, 105, 0.82);
        background:
            linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.9));
        box-shadow:
            0 24px 54px rgba(2, 6, 23, 0.36),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

    .template-studio-chooser__action {
        border-color: rgba(71, 85, 105, 0.72);
        background: rgba(15, 23, 42, 0.64);
        color: #f8fafc;
    }

    .template-studio-chooser__action-description,
    .template-studio-toolbar__meta,
    .template-studio-panel__eyebrow,
    .template-studio-panel__node-subtitle,
    .template-studio-panel__hint {
        color: rgba(226, 232, 240, 0.72);
    }

    .template-studio-toolbar__badge,
    .template-studio-panel__node-title,
    .template-studio-panel__field,
    .template-studio-panel__manifest {
        color: #f8fafc;
    }

    .template-studio-panel__input,
    .template-studio-panel__select,
    .template-studio-panel__textarea,
    .template-studio-panel__node-summary,
    .template-studio-panel__manifest {
        border-color: rgba(71, 85, 105, 0.82);
        background: rgba(15, 23, 42, 0.68);
        color: #f8fafc;
    }

    .template-studio-panel__hint {
        border-color: rgba(71, 85, 105, 0.8);
        background: rgba(15, 23, 42, 0.54);
    }

    .template-studio-panel__issue {
        border-color: rgba(251, 191, 36, 0.28);
        background: rgba(120, 53, 15, 0.22);
        color: #fcd34d;
    }

    .template-studio-toolbar__button--active {
        background: rgba(59, 130, 246, 0.18);
        color: #93c5fd;
    }
}
