.falling-items-scene {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 100px;
    pointer-events: none;
    background-color: transparent;
    /* Ensure items above the container are clipped */
    clip-path: inset(0 0 0 0);
}

.falling-items-element {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    margin: 0;
    pointer-events: auto;
    user-select: none;
    opacity: 1;
    z-index: 1;
    will-change: transform;
    transform-origin: center center;
    /* Prevent default drag behavior */
    -webkit-user-drag: none;
    /* Enhanced performance optimizations */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* Prevent dragging of all content inside falling items */
.falling-items-element * {
    pointer-events: none !important;
    -webkit-user-drag: none !important;
    user-select: none !important;
}

/* Only apply opacity 0 in frontend */
.bricks-is-frontend .falling-items-element {
    opacity: 0;
    /* Ensure items start above the container boundary */
    transition: opacity 0.35s ease-in-out;
}

/* Add physics interaction styles */
.falling-items-scene:hover .falling-items-element {
    cursor: grab;
}

.falling-items-scene:active .falling-items-element {
    cursor: grabbing;
}

/* Enhanced touch device support */
@media (hover: none) and (pointer: coarse) {
    .falling-items-scene .falling-items-element {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Add transition for builder mode */
.brx-body:not(.bricks-is-frontend) .falling-items-element {
    transition: transform 0.3s ease;
}

/* Additional styles for nestable elements */
.falling-items-scene .brxe-div.falling-items-element {
    position: absolute;
}

/* Wireframe canvas styling */
.falling-items-wireframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    background-color: transparent;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .falling-items-scene {
        min-height: 250px;
    }
}

@media (max-width: 767px) {
    .falling-items-scene {
        min-height: 200px;
    }
}

/* Improved builder preview */
.brx-body:not(.bricks-is-frontend) .falling-items-scene {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 20px;
    border: 1px dashed rgba(0, 0, 0, 0.1);
}

.brx-body:not(.bricks-is-frontend) .falling-items-element {
    position: relative !important;
    margin: 10px !important;
    left: auto !important;
    top: auto !important;
}

/* Show wireframe only in frontend */
.brx-body:not(.bricks-is-frontend) .falling-items-wireframe {
    display: none;
}

/* Improve accessibility */
@media (prefers-reduced-motion: reduce) {
    .falling-items-element {
        transition: none !important;
    }
}