.multiplex-editor {
    width: 50vw;
    height: calc(50vw * 9 / 16);
    /*use calc for width to make 16:9*/
    background-color: #f0f0f0;
    overflow: hidden;

    /*to make it dashed grid lines*/
    background-image:
      repeating-linear-gradient(rgba(100, 100, 100, 0.2) 0 1px, transparent 1px 100%),
      repeating-linear-gradient(90deg, rgba(100, 100, 100, 0.2) 0 1px, transparent 1px 100%);    

}

.box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #333;
    /*background-color: rgba(200, 200, 200, 1);*/
    background-color: rgba(100, 100, 100, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    /* make the innerText take 80% of the size of the div */
    font-size: calc(80vmin / 10);
    font-weight: bold;
    font-family: sans-serif;
    color: rgba(0, 0, 0, 0.8);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;

    cursor: move;
    clip-path: inset(0 0 0 0);
    animation: selected 1s infinite;

    /* Add a transition to animate the box size */
    transition: width 0.1s, height 0.1s, background-color 0.2s, color 0.2s;

    /* Disable text selection */
    user-select: none;
}

.box.selected {
    border-color: green;
    background-color: rgba(200, 235, 200, 1);
    color: rgba(0, 100, 0, 1);

    stroke: rgba(0, 255, 0, 0.5);
    stroke-width: 2px;
}

.multiplex-editor {
    /* ... (previous CSS code remains the same) */
    position: relative; /* Add position relative to support snap-to-fit */

}

/* Add a guide for snapping */
.guide {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px dashed #999;
    pointer-events: none;
}

/* Additional CSS to highlight snapped boxes */
.snapped {
    border-color: green;
}

