/* Cards around the game: level start, mixer, Dev Lab. */

/* The level-start card. It hangs under the board (#board-slot wraps the
   canvas), so it cannot cover the fretboard at any window size. */
#overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    z-index: 100;
}

/* While the card waits, a click anywhere but Climb does nothing. No
   ancestor may be transformed, or this stops covering the page. */
#overlay::before {
    content: '';
    position: fixed;
    inset: 0;
}

#overlay-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px 22px;
    background: rgba(26, 26, 46, 0.95);
    padding: 12px 14px 12px 22px;
    border-radius: 12px;
    /* Narrower than the page by the corner buttons on each side. */
    max-width: min(100%, calc(100vw - 148px));
    text-align: left;
}

#overlay-content h2 {
    font-size: 22px;
    color: #4fc3f7;
}

#overlay-content p {
    font-size: 15px;
    margin-top: 2px;
    color: #aaa;
}

#overlay-content p:empty {
    display: none;
}

.field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0;
}

.field-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 700;
    letter-spacing: 0.2px;
}

.field select,
.field input[type='number'] {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    outline: none;
}

.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.92);
}

#start-btn {
    flex: none;
    background: #4fc3f7;
    border: none;
    color: #1a1a2e;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
}

#start-btn:hover {
    background: #81d4fa;
}

/* A window too short for the card under the board gets one slim line
   (fitStartCard in game/shell.js adds the class). */
#overlay.slim {
    margin-top: 4px;
}

#overlay.slim #overlay-content {
    flex-direction: row;
    gap: 12px;
    padding: 4px 4px 4px 14px;
    text-align: left;
}

#overlay.slim #overlay-text {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 10px;
}

#overlay.slim h2 {
    font-size: 15px;
}

#overlay.slim p {
    font-size: 13px;
    margin-top: 0;
}

#overlay.slim #start-btn {
    padding: 5px 16px;
    font-size: 15px;
}

/* Mixer modal (opened from Settings on the mountain) */
#mixer-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
}

#mixer-content {
    width: min(420px, calc(100vw - 40px));
    background: rgba(16, 20, 36, 0.96);
    border: 1px solid rgba(242, 196, 109, 0.35);
    border-radius: 18px;
    padding: 20px 22px 14px;
    text-align: left;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
}

#mixer-content h2 {
    color: #f2c46d;
    margin-bottom: 14px;
    font-size: 22px;
    letter-spacing: 0.04em;
}

/* Practice Lab modal */
#lab-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
}

#lab-content {
    width: min(860px, calc(100vw - 40px));
    max-height: min(680px, calc(100vh - 40px));
    overflow: auto;
    background: rgba(26, 26, 46, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 18px 18px 14px;
    text-align: left;
}

#lab-content h2 {
    color: #4fc3f7;
    margin-bottom: 10px;
    font-size: 26px;
}

.lab-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin: 12px 0 14px;
}

.span-2 {
    grid-column: 1 / -1;
}

.string-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.18);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.88);
}

.prog-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.prog-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prog-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.prog-slot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
    align-items: center;
}

.prog-slot.disabled {
    opacity: 0.45;
}

.prog-row .sep {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    font-weight: 700;
}

/* Make the lab's kit selector usable without blowing up the row. */
#lab-drum-kit {
    min-width: 180px;
}

.mini {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 13px;
    font-weight: 700;
}

.mixer-grid {
    flex: 1;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 12px;
}

.mixer-row {
    color: rgba(255, 255, 255, 0.86);
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 125px;
}

.mixer-grid input[type='range'] {
    width: 100%;
}

/* Drum stems sit indented under the Drums bus. */
.mixer-row--stem {
    padding-left: 18px;
    opacity: 0.85;
    font-size: 12px;
}

.lab-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.lab-actions button {
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 900;
    border: none;
    background: #4fc3f7;
    color: #1a1a2e;
}

.lab-actions button.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.92);
}

.lab-note {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Play your own chords (opened from the mountain). Tall enough to scroll
   inside itself rather than run off a small screen. */
#own-chords-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
}

#own-chords-content {
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    background: rgba(16, 20, 36, 0.96);
    border: 1px solid rgba(242, 196, 109, 0.35);
    border-radius: 18px;
    padding: 18px 20px 14px;
    text-align: left;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
}

#own-chords-content h2 {
    color: #f2c46d;
    margin-bottom: 10px;
    font-size: 22px;
    letter-spacing: 0.04em;
}

#own-chords-content label,
#own-chords-total,
#own-chords-note {
    color: rgba(255, 255, 255, 0.86);
    font-size: 13px;
    font-weight: 700;
}

#own-chords-note {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
}

#own-chords-text,
#own-chords-link {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.92);
    /* Chords sit over their words only in a fixed-width face. 16px keeps
       an iPhone from zooming the page when the box is tapped. */
    font:
        16px/1.35 ui-monospace,
        Menlo,
        Consolas,
        monospace;
}

#own-chords-text {
    resize: vertical;
    min-height: 72px;
}

#own-chords-link {
    font-size: 13px;
}

.own-chords-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

#own-chords-read-btn {
    flex: none;
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    background: #f2c46d;
    color: #1a1a2e;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
}

/* One-tap progressions and the string-set picker: small buttons, still a
   thumb high. */
/* Three rows show and the rest scroll inside the strip: the list is longer
   than the panel has room for, and Play must stay on screen. */
#own-chords-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-height: 114px;
    overflow-y: auto;
}

#own-chords-quick button,
#own-chords-strings button {
    min-height: 34px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

#own-chords-strings {
    gap: 6px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 13px;
    font-weight: 700;
}

#own-chords-strings button {
    flex: 1;
    padding: 4px 2px;
}

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

#own-chords-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    /* A long song scrolls here, so Play stays in reach. */
    max-height: 168px;
    overflow-y: auto;
}

.own-chip {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid rgba(242, 196, 109, 0.55);
    border-radius: 10px;
    background: rgba(242, 196, 109, 0.12);
    color: #fff5e3;
    font-size: 15px;
}

.own-chip__main {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 7px;
    min-height: 40px;
    padding: 6px 4px 6px 10px;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.own-chip__bars {
    min-width: 22px;
    padding: 1px 5px;
    border-radius: 6px;
    background: #f2c46d;
    color: #1a1a2e;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
}

.own-chip small {
    flex-basis: 100%;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    text-align: left;
}

.own-chip__drop {
    width: 30px;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0 9px 9px 0;
    background: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 17px;
    cursor: pointer;
}

/* Not a chord the game knows: shown so the player sees it was left out. */
.own-chip--unknown {
    flex-wrap: wrap;
    align-items: center;
    gap: 0 7px;
    padding-left: 10px;
    border-style: dashed;
    border-color: #ef9a9a;
    background: rgba(239, 83, 80, 0.12);
}

.own-chip--unknown b {
    text-decoration: line-through;
    color: #ef9a9a;
}

.own-chip--unknown small {
    flex-basis: auto;
}

#own-chords-total {
    margin-top: 10px;
    font-weight: 400;
}

#own-chords-bpm {
    flex: 1;
    min-width: 0;
}

#own-chords-bpm-value {
    min-width: 58px;
    text-align: right;
}

#own-chords-problem {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(239, 83, 80, 0.16);
    color: #ffcdd2;
    font-size: 13px;
}

#own-chords-content .lab-actions {
    margin-top: 12px;
}

@media (max-width: 720px) {
    #overlay-content {
        flex-direction: column;
        padding: 12px 16px;
        text-align: center;
    }
    .lab-grid {
        grid-template-columns: 1fr;
    }

    .prog-grid {
        grid-template-columns: 1fr;
    }
}

/* A phone on its side is about 375px tall: the mixer closes up its
   spacing to stay whole on screen, and scrolls if it still cannot. */
@media (max-height: 440px) {
    #mixer-content {
        padding: 8px 22px;
        max-height: calc(100vh - 8px);
        overflow-y: auto;
    }

    #mixer-content h2 {
        margin-bottom: 4px;
        font-size: 18px;
    }

    .mixer-grid {
        gap: 3px 12px;
    }

    #mixer-content .lab-note {
        margin-top: 4px;
    }

    #mixer-content .lab-actions {
        margin-top: 0;
    }

    #mixer-content .lab-actions button {
        padding: 6px 16px;
    }

    /* The own-chords panel turns sideways with the phone: the text box on
       the left, what was read on the right, so both show without a scroll. */
    #own-chords-content {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 8px);
        padding: 8px 16px;
    }

    #own-chords-content h2 {
        margin-bottom: 2px;
        font-size: 17px;
    }

    .own-chords-columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 16px;
    }

    /* Short enough that the two rows of one-tap progressions under it
       still leave Play on screen at 375px of height. */
    #own-chords-text {
        height: 104px;
        min-height: 0;
    }

    #own-chords-quick {
        margin-top: 6px;
        max-height: 74px;
    }

    #own-chords-chips {
        margin-top: 4px;
        max-height: 128px;
    }

    #own-chords-content .lab-actions {
        margin-top: 6px;
    }

    #own-chords-content .lab-actions button {
        padding: 6px 16px;
    }
}
