.builder-container label {
    font-family: 'Roboto', sans-serif;
}


/* Make labels white in night mode */
.night .builder-container label {
    color: #ffffff;
}

.builder-content p {
    margin: 0;
    opacity: 0.8;
}

/** Builder mode visibility toggles */
/* Hide builder UI by default */
.builder-container {
    position: relative;
    display: none;
    z-index: 10;
}

/* When body has class 'builder', show builder UI and hide editor */
.builder .builder-container {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.builder .editor-container {
    display: none;
}

/* Minimal styling for builder UI */
.builder-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.5em 0.75em;
    align-items: center;
}
.builder-container .name-label{
    grid-column: 1 / -1;
}
.builder-container input[type="text"].name{
    font-size: 1.5em;
    width: 100%;
    grid-column: 1 / -1;
    border: none;
    text-align: center;
}
.night .builder-container input[type="text"].name {
    background: rgba(255, 255, 255, 0.06);
}

/* Make controls look orderly when wrapping */
.builder-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    white-space: nowrap;
}

.builder-toolbar input[type="text"] {
    /*min-width: 8em;*/
    width: 6em;
    flex: 0 0 auto;
}

.builder-toolbar input[type="number"] {
    width: 3em;
}

.builder-toolbar select.dropdown {
    min-width: 10em;
}

.builder-toolbar .builder-btn {
    justify-self: start;
}

.builder-btn {
    padding: 0.4em 0.6em;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.builder-btn[disabled] {
    opacity: 0.6;
}

.builder-content {
    padding: 0.75em;
    border: 1px dashed rgba(255, 255, 255, 0.25);
    border-radius: 6px;
}

.builder .displays {
    display: none;
}

.builder .controls {
    display: none;
}


.builder .site-logo {
    display: none;
}

.builder .instructions {
    display: none;
}
.builder-toolbar .gradient-controls,
.builder-toolbar .obstacle-style-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em 0.75em;
    padding: 0.75em;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
}

/* Make the (larger) gradient group span full width of the grid for better layout */
.builder-toolbar .gradient-controls {
    grid-column: 1 / -1;
    min-width: 15em;
    max-width: 30em;
    width: 100%;
    box-sizing: border-box;
    /* Center within the toolbar grid when narrower than full width */
    justify-self: center;
}

/* Improve contrast in night mode */
.night .builder-toolbar .gradient-controls,
.night .builder-toolbar .obstacle-style-controls {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
}

/* Section headers inside grouped controls */
.builder-toolbar .group-header {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
    font-weight: 600;
    margin: -0.25em -0.25em 0.25em -0.25em;
    padding: 0.25em 0.25em 0.35em 0.25em;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    color: inherit;
}

.night .builder-toolbar .group-header {
    border-bottom-color: rgba(255,255,255,0.22);
}


/* Gradient section layout refinements */
.builder-toolbar .gradient-controls .full-line {
    flex-basis: 100%;
}

.builder-toolbar .gradient-controls .color-row {
    display: flex;
    gap: 0.5em 0.75em;
    flex-wrap: wrap;
    flex-basis: 100%;
}

.builder-toolbar .gradient-controls .color-row label {
    display: inline-flex;
    align-items: center;
    gap: .35em;
}

/* Place sliders on their own lines and align starts consistently */
.builder-toolbar .gradient-controls .slider-line {
    flex-basis: 100%;
    display: grid;
    grid-template-columns: 8em 1fr;
    align-items: center;
}

.builder-toolbar .gradient-controls .slider-line input[type="range"] {
    width: 100%;
}


@media (max-width: 600px) {
    /* On very narrow screens, avoid overflow and left-offset for the gradient box */
    .builder-toolbar .gradient-controls {
        min-width: 0;        /* allow it to shrink with the viewport */
        max-width: 100%;     /* never exceed the container width */
        justify-self: stretch; /* align to the left/edge rather than centering an overflowing box */
        width: 100%;
    }
}
