body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1a1a1a;
    font-family: 'Roboto Flex', sans-serif;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow-y: auto;
    display: flex; /* Use flex for centering child with margin: auto */
    flex-direction: column; /* Stack title and grid collection vertically */
    padding: 0;
    box-sizing: border-box;
}

#grid-collection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    justify-items: center;
    align-content: start;
    gap: 20px;
    width: 100%; /* Or auto with max-width */
    margin: auto; /* Centers safely in flex container */
    max-width: 1600px; /* Optional constraint */
    padding: 40px;
    box-sizing: border-box;
}

.grid-instance {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.grid-wrapper {
    width: 200px; /* Fixed size for gallery */
    height: 200px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

.motion-label {
    margin-top: 15px;
    font-size: 1.0rem;
    color: #fff;
    font-family: 'Roboto Flex', sans-serif;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.page-title {
    width: 100%;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
    font-size: 0.8rem;
    color: #888;
    font-family: 'Roboto Flex', sans-serif;
    font-weight: 300;
    text-transform: lowercase;
    letter-spacing: 0.2em;
}

.grid-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    /* Width will be set by JS in % */
    width: 0;
    flex-grow: 0;
}

.char-block {
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
    background-color: #fff;
    color: #000;
    /* In Col-based: Width is 100% of col, Height is set by JS */
    width: 100%; 
    height: 0; 
    flex-grow: 0;
    margin: 0; 
    border: 1px solid #000;
    will-change: width, height, font-size, font-variation-settings;
}

.char-content {
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    display: inline-block; /* Allow natural width behavior for measurement */
    transform-origin: center center;
}

/* Ensure Tweakpane sits above the overlay */
.tp-dfwv {
    z-index: 9999 !important;
}
