/* AUDITION TOOL, TEMPORARY: the Sound Lab (game/sound-lab.js). Delete this
   file with it; see docs/architecture.md, "Sound Lab (audition)". */

/* The panel hangs from the bottom of the level's column and takes no room
   in it, so opening it, or anything changing inside it, cannot move or
   resize the board. The page grows downward and scrolls. */
#game-container {
    position: relative;
}

#sound-lab {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    /* Narrower than the page by the corner buttons on each side. */
    width: min(1120px, calc(100vw - 150px));
    /* Above the level-start card's click shield (css/modals.css): the
       band can be auditioned while the card waits. */
    z-index: 110;
    /* Room to scroll the last controls clear of the corner buttons. */
    padding-bottom: 96px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

#game-container.home-map-secondary #sound-lab {
    display: none;
}

.sl-top,
.sl-group {
    background: rgba(12, 16, 30, 0.9);
    border: 1px solid rgba(255, 240, 214, 0.16);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.sl-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px 14px;
    border-color: rgba(242, 196, 109, 0.5);
}

.sl-top h2 {
    font-size: 18px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f2c46d;
}

.sl-top p {
    font-size: 13px;
    color: rgba(255, 247, 234, 0.72);
}

.sl-top-actions {
    display: flex;
    gap: 8px;
}

#sound-lab-now {
    grid-column: 1 / -1;
    min-height: 17px;
    color: #9dc4ab;
    font-weight: 700;
}

/* Columns, not a grid: Drums is three times as long as Tempo, and a grid
   row would leave a hole beside it. */
#sound-lab-groups {
    columns: 3 300px;
    column-gap: 10px;
}

#sound-lab-groups .sl-group {
    break-inside: avoid;
    margin-bottom: 10px;
}

#sound-lab-groups .sl-group:last-child {
    margin-bottom: 0;
}

.sl-group h3 {
    margin-bottom: 8px;
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #f2c46d;
}

.sl-control {
    padding: 7px 0;
    border-top: 1px solid rgba(255, 240, 214, 0.08);
}

.sl-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 247, 234, 0.92);
}

.sl-head output {
    color: #f2c46d;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#sound-lab small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(255, 247, 234, 0.55);
}

/* Tall enough for a thumb. */
#sound-lab input[type='range'] {
    display: block;
    width: 100%;
    height: 30px;
    margin: 2px 0 0;
    accent-color: #f2c46d;
    cursor: pointer;
}

.sl-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

#sound-lab button {
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 240, 214, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 247, 234, 0.92);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

#sound-lab button:hover:not(:disabled) {
    border-color: rgba(255, 226, 177, 0.6);
}

#sound-lab button[aria-pressed='true'] {
    background: #f2c46d;
    border-color: #f2c46d;
    color: #1a1a2e;
}

#sound-lab button:disabled {
    opacity: 0.4;
    cursor: default;
}

#sound-lab-audition {
    min-width: 150px;
    border-color: #9dc4ab;
}

.sl-slots {
    margin-top: 10px;
}

#sound-lab-text {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 240, 214, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: #f6ead2;
    font:
        13px/1.4 ui-monospace,
        Consolas,
        monospace;
    resize: vertical;
    user-select: text;
}

/* The lab's button among the level's chips. Raised over the start card's
   click shield, like the panel, so the lab opens before a level starts. */
#sound-lab-btn {
    position: relative;
    z-index: 110;
}

#hud #sound-lab-btn[aria-pressed='true'] {
    border-color: #f2c46d;
    color: #f2c46d;
}

/* A phone, upright or on its side: the corner buttons are small or in the
   chip row, so the panel takes the width of the page. */
@media (max-width: 700px), (orientation: landscape) and (max-height: 600px) {
    #sound-lab {
        width: calc(100vw - 20px);
    }

    .sl-top {
        grid-template-columns: 1fr;
    }
}

/* A phone on its side has one row for the chips and no height for a
   second: there the button is its icon alone. */
@media (orientation: landscape) and (max-height: 600px) {
    #sound-lab-btn b {
        display: none;
    }

    /* Even as an icon the button is one chip too many beside a long row of
       chord dots: the row wraps and pushes the board and the count down
       off the screen. The level's name gives up its place while the lab
       exists. */
    #hud:has(#targets:not(.hidden)) #level {
        display: none;
    }
}
