/* V6 keeps its base art and life images in one 1672x941 scene. */
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-scene {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: #01030d;
}

body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-backdrop,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-viewport,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-hud-layer {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-toolbar,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-version,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-more,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-timeline,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-preview,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-tree-v4-jobs,
body.fantasy-tree-v6-active
    .fantasy-tree-v6-root
    .fantasy-story-drawer {
    z-index: 30;
}

.fantasy-tree-v6-artboard-placeholder {
    display: none;
}

body.fantasy-tree-v6-active
    .fantasy-tree-v6-artboard {
    position: absolute;
    z-index: 1;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background: #01030d;
    contain: layout paint;
}

.fantasy-tree-v6-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.fantasy-tree-v6-scene-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 1672px;
    height: 941px;
    overflow: hidden;
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: none;
}

.fantasy-tree-v6-base,
.fantasy-tree-v6-connectors,
.fantasy-tree-v6-cards {
    position: absolute;
    inset: 0;
    width: 1672px;
    height: 941px;
    pointer-events: none;
}

.fantasy-tree-v6-base {
    z-index: 1;
    display: block;
    max-width: none;
    object-fit: fill;
    user-select: none;
}

.fantasy-tree-v6-connectors {
    display: none;
}

.fantasy-tree-v6-cards {
    z-index: 3;
}

.fantasy-tree-v6-editor-controls {
    position: absolute;
    z-index: 24;
    top: 18px;
    right: 244px;
    display: grid;
    grid-template-columns: repeat(2, 38px);
    gap: 4px;
    padding: 4px;
    pointer-events: auto;
    border: 1px solid rgba(105, 220, 255, 0.34);
    border-radius: 4px;
    background: rgba(3, 9, 28, 0.88);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.025),
        0 0 16px rgba(0, 222, 255, 0.12);
    backdrop-filter: blur(16px) saturate(1.1);
}

.fantasy-tree-v6-editor-controls button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(105, 220, 255, 0.18);
    border-radius: 4px;
    background: rgba(5, 11, 35, 0.9);
    color: #a9d5e6;
    cursor: pointer;
    transition:
        color 150ms ease,
        border-color 150ms ease,
        background-color 150ms ease,
        transform 120ms ease;
}

.fantasy-tree-v6-editor-controls button:hover,
.fantasy-tree-v6-editor-controls button:focus-visible {
    border-color: rgba(105, 231, 255, 0.62);
    background: rgba(10, 34, 57, 0.96);
    color: #edffff;
}

.fantasy-tree-v6-editor-controls button:focus-visible {
    outline: 2px solid rgba(105, 231, 255, 0.9);
    outline-offset: 2px;
}

.fantasy-tree-v6-editor-controls button:active {
    transform: translateY(1px);
}

.fantasy-tree-v6-editor-controls button[aria-pressed="true"] {
    border-color: rgba(105, 231, 255, 0.72);
    background: rgba(5, 43, 57, 0.94);
    color: #d8ffff;
    box-shadow:
        inset 0 -2px 0 rgba(0, 234, 255, 0.92),
        0 0 12px rgba(0, 226, 255, 0.18);
}

.fantasy-tree-v6-artboard.has-layout-overrides
    [data-fantasy-tree-v6-action="reset"] {
    color: #d8ffff;
}

.fantasy-tree-v6-memory-card {
    position: absolute;
    width: 160px;
    height: auto;
    min-height: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translate(-50%, -50%) rotate(var(--v6-card-rotation, 0deg));
    transform-origin: center;
    border: 1px solid rgba(105, 231, 255, 0.86);
    background:
        linear-gradient(135deg, rgba(2, 24, 48, 0.9), rgba(4, 5, 22, 0.88)),
        rgba(1, 9, 23, 0.92);
    box-shadow:
        0 0 0 1px rgba(218, 252, 255, 0.18) inset,
        0 0 11px rgba(0, 220, 255, 0.32),
        0 0 22px rgba(116, 78, 255, 0.18);
    clip-path: polygon(
        0 7px,
        7px 0,
        100% 0,
        100% calc(100% - 7px),
        calc(100% - 7px) 100%,
        0 100%
    );
}

.fantasy-tree-v6-artboard.is-editing
    .fantasy-tree-v6-memory-card {
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

.fantasy-tree-v6-artboard.is-editing
    .fantasy-tree-v6-memory-card:hover {
    border-color: rgba(211, 253, 255, 0.98);
    box-shadow:
        0 0 0 1px rgba(218, 252, 255, 0.25) inset,
        0 0 15px rgba(0, 229, 255, 0.48),
        0 0 28px rgba(116, 78, 255, 0.2);
}

.fantasy-tree-v6-memory-card.is-dragging {
    z-index: 10;
    cursor: grabbing;
    transition: none;
    box-shadow:
        0 0 0 1px rgba(235, 255, 255, 0.34) inset,
        0 0 18px rgba(0, 239, 255, 0.74),
        0 0 34px rgba(123, 92, 255, 0.3);
}

.fantasy-tree-v6-memory-card::before,
.fantasy-tree-v6-memory-card::after {
    content: "";
    position: absolute;
    z-index: 2;
    pointer-events: none;
}

.fantasy-tree-v6-memory-card::before {
    inset: 3px;
    border: 1px solid rgba(211, 252, 255, 0.24);
    clip-path: polygon(
        0 6px,
        6px 0,
        100% 0,
        100% calc(100% - 6px),
        calc(100% - 6px) 100%,
        0 100%
    );
}

.fantasy-tree-v6-memory-card::after {
    top: 4px;
    right: 7px;
    width: 20%;
    height: 1px;
    background: #f5ffff;
    box-shadow: 0 0 8px rgba(194, 255, 255, 0.9);
}

.fantasy-tree-v6-memory-card img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid rgba(95, 211, 255, 0.44);
    background: #020817;
}

.fantasy-tree-v6-memory-card figcaption {
    position: relative;
    z-index: 3;
    display: block;
    overflow: hidden;
    height: 10px;
    margin-top: 2px;
    color: rgba(218, 252, 255, 0.9);
    font: 600 7px/10px Inter, system-ui, sans-serif;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.fantasy-tree-v6-memory-card.is-current-path {
    border-color: rgba(235, 255, 255, 0.98);
    box-shadow:
        0 0 0 1px rgba(230, 255, 255, 0.3) inset,
        0 0 14px rgba(0, 239, 255, 0.62),
        0 0 28px rgba(0, 164, 255, 0.34);
}

.fantasy-tree-v6-memory-rail {
    position: absolute;
    z-index: 4;
    top: 0;
    left: 12%;
    width: 18%;
    height: 1px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 0 7px rgba(162, 251, 255, 0.88);
}

@media (max-width: 860px) {
    .fantasy-tree-v6-editor-controls {
        top: 8px;
        right: 209px;
        grid-template-columns: repeat(2, 35px);
        gap: 3px;
        padding: 3px;
    }

    .fantasy-tree-v6-editor-controls button {
        width: 35px;
        height: 35px;
    }

    body.fantasy-tree-v6-active
        .fantasy-tree-v6-memory-card {
        box-shadow:
            0 0 0 1px rgba(218, 252, 255, 0.14) inset,
            0 0 7px rgba(0, 220, 255, 0.22),
            0 0 12px rgba(116, 78, 255, 0.1);
    }

}

@media (prefers-reduced-motion: reduce) {
    body.fantasy-tree-v6-active
        .fantasy-tree-v6-scene-canvas {
        will-change: auto;
    }

    body.fantasy-tree-v6-active
        .fantasy-tree-v6-memory-card {
        transition: none;
        animation: none;
    }
}
