/* Tabbed Controls Styles */
#tabbed-controls {
    width: 100%;
    max-width: 1170px;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
    margin-top: -25px;
}

#tab-navigation {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-bottom: -4px;
    margin-left: 12px;
    position: relative;
    z-index: 101;
}

.tab-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 12px 20px;
    background: #071126;
    color: var(--metal-mid);
    border: 6px solid var(--mk-yellow);
    border-bottom: 4px solid var(--mk-yellow);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 rgba(0, 0, 0, 0.5),
        inset 2px 2px 0 rgba(255, 255, 255, 0.1);
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

.tab-btn:hover {
    background: #09152e;
    color: var(--mk-highlight);
}

.tab-btn.active {
    background: var(--mk-blue);
    color: var(--mk-yellow);
    border-bottom: none;
    box-shadow: none;
    z-index: 102;
    margin-bottom: -2px;
    padding-bottom: 16px;
    text-shadow: 2px 2px 0 var(--container-bg-darker);
}

#tab-content {
    width: 100%;
}

.tab-panel {
    display: none !important;
}

.tab-panel.active {
    display: flex !important;
}

/* Chip Controls (Fretboard Tab) */
#chip-controls {
    flex-direction: row;
    gap: 16px;
    padding: 30px;
    background: var(--container-bg-darker);
    border-radius: 0 8px 8px 8px;
    border: 4px solid var(--mk-yellow);
    box-shadow:
        inset -2px -2px 0 var(--mk-orange),
        inset 2px 2px 0 var(--mk-highlight),
        0 6px 16px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 1170px;
    box-sizing: border-box;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    z-index: 100;
    min-height: 320px;
}

/* Jam Station Styles */
#jam-controls {
    flex-direction: row;
    gap: 16px;
    padding: 30px;
    background: var(--container-bg-darker);
    border-radius: 0 8px 8px 8px;
    border: 4px solid var(--mk-yellow);
    box-shadow:
        inset -2px -2px 0 var(--mk-orange),
        inset 2px 2px 0 var(--mk-highlight),
        0 6px 16px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 1170px;
    box-sizing: border-box;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    z-index: 100;
    min-height: 320px;
}

.jam-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* Only add shadows to columns with scrollable content */
.jam-column:has(.jam-root-chips),
.jam-column:has(.jam-preset-chips) {
    position: relative;
    --fade-top-opacity: 0;
    --fade-bottom-opacity: 0;
}

/* Fade to blue at top of jam column scrollable areas - 8-bit striped style */
.jam-column:has(.jam-root-chips)::before,
.jam-column:has(.jam-preset-chips)::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom,
        var(--container-bg-darker) 0%,
        var(--container-bg-darker) 10%,
        rgba(12, 23, 51, 0.9) 10%,
        rgba(12, 23, 51, 0.9) 20%,
        rgba(12, 23, 51, 0.75) 20%,
        rgba(12, 23, 51, 0.75) 30%,
        rgba(12, 23, 51, 0.6) 30%,
        rgba(12, 23, 51, 0.6) 40%,
        rgba(12, 23, 51, 0.45) 40%,
        rgba(12, 23, 51, 0.45) 50%,
        rgba(12, 23, 51, 0.3) 50%,
        rgba(12, 23, 51, 0.3) 60%,
        rgba(12, 23, 51, 0.15) 60%,
        rgba(12, 23, 51, 0.15) 70%,
        transparent 70%);
    pointer-events: none;
    z-index: 10;
    opacity: var(--fade-top-opacity);
    transition: opacity 0.2s ease;
}

/* Fade to blue at bottom of jam column scrollable areas - 8-bit striped style */
.jam-column:has(.jam-root-chips)::after,
.jam-column:has(.jam-preset-chips)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top,
        var(--container-bg-darker) 0%,
        var(--container-bg-darker) 10%,
        rgba(12, 23, 51, 0.9) 10%,
        rgba(12, 23, 51, 0.9) 20%,
        rgba(12, 23, 51, 0.75) 20%,
        rgba(12, 23, 51, 0.75) 30%,
        rgba(12, 23, 51, 0.6) 30%,
        rgba(12, 23, 51, 0.6) 40%,
        rgba(12, 23, 51, 0.45) 40%,
        rgba(12, 23, 51, 0.45) 50%,
        rgba(12, 23, 51, 0.3) 50%,
        rgba(12, 23, 51, 0.3) 60%,
        rgba(12, 23, 51, 0.15) 60%,
        rgba(12, 23, 51, 0.15) 70%,
        transparent 70%);
    pointer-events: none;
    z-index: 10;
    opacity: var(--fade-bottom-opacity);
    transition: opacity 0.2s ease;
}

/* Transport column - narrower */
.jam-column:nth-child(1) {
    flex: 1.5;
    min-width: 110px;
}

/* Backing Track column - wider */
.jam-column:nth-child(2) {
    flex: 2.5;
    min-width: 160px;
}

.jam-col-2 {
    flex: 2;
    min-width: 140px;
}

/* Root column - smallest */
.jam-column:nth-child(3) {
    flex: 1;
    min-width: 90px;
}

.jam-col-4 {
    flex: 4;
    min-width: 240px;
    min-height: 330px;
    border-left: 2px solid #232d4a;
    margin-left: 16px;
    padding-left: 16px;
    align-items: flex-start;
}

.jam-col-4 .jam-column-label {
    text-align: left;
    align-self: flex-start;
}

.jam-col-4 .jam-setting-group {
    align-items: flex-start;
}

.jam-col-4 .tempo-display {
    text-align: left;
}

.jam-col-4 .jam-display-chips {
    justify-content: flex-start;
}

.jam-col-4 .jam-sound-chips {
    justify-content: flex-start;
}

.jam-col-4 .jam-metronome-chips {
    justify-content: flex-start;
}

.jam-col-3 .jam-setting-group:last-child {
    margin-top: auto;
}

.jam-column-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: var(--mk-yellow);
    text-shadow: 2px 2px 0 var(--black);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 8px;
}

.jam-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 16px 20px;
    background: var(--mk-green);
    border: 3px solid var(--black);
    border-radius: 4px;
    color: var(--black);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 var(--wood-dark),
        inset 2px 2px 0 var(--white);
    user-select: none;
    -webkit-user-select: none;
    width: 100%;
    text-align: center;
    min-height: 50px;
}

.jam-btn:hover {
    background: var(--mk-highlight);
}

.jam-btn:active {
    transform: translateY(1px);
    box-shadow:
        inset 2px 2px 0 var(--wood-dark),
        inset -2px -2px 0 var(--white);
}

.jam-status {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: var(--mk-cyan);
    text-shadow: 2px 2px 0 var(--black);
    text-align: center;
    min-height: 20px;
    padding: 4px 8px;
}

.jam-setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.jam-setting-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: var(--metal-mid);
    text-shadow: 1px 1px 0 var(--black);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tempo-display {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: var(--mk-yellow);
    text-shadow: 2px 2px 0 var(--black);
    padding: 4px 8px;
    min-width: 100px;
    text-align: center;
}

.tempo-slider-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.tempo-arrow {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 8px;
    background: var(--metal-mid);
    border: 3px solid var(--black);
    border-radius: 4px;
    color: var(--black);
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 var(--metal-dark),
        inset 2px 2px 0 var(--metal-light);
    user-select: none;
    -webkit-user-select: none;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tempo-arrow:hover {
    background: var(--mk-highlight);
    box-shadow:
        inset -2px -2px 0 var(--mk-yellow),
        inset 2px 2px 0 var(--white);
}

.tempo-arrow:active {
    transform: translateY(1px);
    box-shadow:
        inset 2px 2px 0 var(--metal-dark),
        inset -2px -2px 0 var(--metal-light);
}

.jam-slider {
    flex: 1;
    height: 12px;
    -webkit-appearance: none;
    background: var(--metal-mid);
    outline: none;
    border: 3px solid var(--black);
    border-radius: 4px;
    cursor: pointer;
}

.jam-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--mk-yellow);
    cursor: pointer;
    border: 3px solid var(--black);
    border-radius: 2px;
    box-shadow: inset 2px 2px 0 var(--white),
                inset -2px -2px 0 var(--mk-orange);
}

.jam-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--mk-yellow);
    cursor: pointer;
    border: 3px solid var(--black);
    border-radius: 2px;
    box-shadow: inset 2px 2px 0 var(--white),
                inset -2px -2px 0 var(--mk-orange);
}

.jam-select {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 12px;
    background: var(--metal-mid);
    color: var(--black);
    border: 3px solid var(--black);
    border-radius: 4px;
    box-shadow:
        inset -2px -2px 0 var(--metal-dark),
        inset 2px 2px 0 var(--metal-light);
    outline: none;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
}

.jam-select:hover {
    background: var(--mk-highlight);
}

.jam-select:focus {
    background: var(--mk-yellow);
    box-shadow:
        inset 2px 2px 0 var(--mk-orange),
        inset -2px -2px 0 var(--mk-highlight);
}

.jam-root-chips {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    gap: 4px;
}

/* Scrollbar styling for jam root chips */
.jam-root-chips::-webkit-scrollbar {
    width: 8px;
}

.jam-root-chips::-webkit-scrollbar-track {
    background: var(--container-bg-darker);
    border-radius: 4px;
}

.jam-root-chips::-webkit-scrollbar-thumb {
    background: var(--mk-yellow);
    border-radius: 4px;
    border: 2px solid var(--container-bg-darker);
}

.jam-root-chips::-webkit-scrollbar-thumb:hover {
    background: var(--mk-orange);
}

.jam-root-chip {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 10px 16px;
    background: var(--metal-mid);
    border: 3px solid var(--black);
    border-radius: 4px;
    color: var(--black);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 var(--metal-dark),
        inset 2px 2px 0 var(--metal-light);
    user-select: none;
    -webkit-user-select: none;
    width: 100%;
    text-align: center;
}

.jam-root-chip:hover {
    background: var(--mk-highlight);
    box-shadow:
        inset -2px -2px 0 var(--mk-yellow),
        inset 2px 2px 0 var(--white);
}

.jam-root-chip.selected {
    background: var(--mk-yellow);
    box-shadow:
        inset 2px 2px 0 var(--mk-orange),
        inset -2px -2px 0 var(--mk-highlight);
    transform: translateY(1px);
}

.jam-root-chip.selected:hover {
    background: var(--mk-yellow);
}

.jam-root-chip.accidental {
    background: var(--wood-mid);
    box-shadow:
        inset -2px -2px 0 var(--wood-dark),
        inset 2px 2px 0 var(--wood-light);
}

.jam-root-chip.accidental:hover {
    background: var(--mk-orange);
}

.jam-root-chip.accidental.selected {
    background: var(--mk-yellow);
    box-shadow:
        inset 2px 2px 0 var(--mk-orange),
        inset -2px -2px 0 var(--mk-highlight);
    transform: translateY(1px);
}

/* Jam Preset Chips (Backing Track) */
.jam-preset-chips {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    gap: 4px;
}

.jam-preset-chips::-webkit-scrollbar {
    width: 8px;
}

.jam-preset-chips::-webkit-scrollbar-track {
    background: var(--container-bg-darker);
    border-radius: 4px;
}

.jam-preset-chips::-webkit-scrollbar-thumb {
    background: var(--mk-yellow);
    border-radius: 4px;
    border: 2px solid var(--container-bg-darker);
}

.jam-preset-chips::-webkit-scrollbar-thumb:hover {
    background: var(--mk-orange);
}

.jam-preset-chip {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px 12px;
    background: var(--metal-mid);
    border: 3px solid var(--black);
    border-radius: 4px;
    color: var(--black);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 var(--metal-dark),
        inset 2px 2px 0 var(--metal-light);
    user-select: none;
    -webkit-user-select: none;
    width: 100%;
    text-align: center;
}

.jam-preset-chip:hover {
    background: var(--mk-highlight);
    box-shadow:
        inset -2px -2px 0 var(--mk-yellow),
        inset 2px 2px 0 var(--white);
}

.jam-preset-chip.selected {
    background: var(--mk-yellow);
    box-shadow:
        inset 2px 2px 0 var(--mk-orange),
        inset -2px -2px 0 var(--mk-highlight);
    transform: translateY(1px);
}

.jam-preset-chip.selected:hover {
    background: var(--mk-yellow);
}

/* Jam Sound Chips */
.jam-sound-chips {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-start;
}

.jam-sound-chip {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px 16px;
    background: var(--metal-mid);
    border: 3px solid var(--black);
    border-radius: 4px;
    color: var(--black);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 var(--metal-dark),
        inset 2px 2px 0 var(--metal-light);
    user-select: none;
    -webkit-user-select: none;
    text-align: center;
}

.jam-sound-chip:hover {
    background: var(--mk-highlight);
    box-shadow:
        inset -2px -2px 0 var(--mk-yellow),
        inset 2px 2px 0 var(--white);
}

.jam-sound-chip.selected {
    background: var(--mk-yellow);
    box-shadow:
        inset 2px 2px 0 var(--mk-orange),
        inset -2px -2px 0 var(--mk-highlight);
    transform: translateY(1px);
}

.jam-sound-chip.selected:hover {
    background: var(--mk-yellow);
}

/* Jam Display Chips */
.jam-display-chips {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.jam-display-chip {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px 16px;
    background: var(--metal-mid);
    border: 3px solid var(--black);
    border-radius: 4px;
    color: var(--black);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 var(--metal-dark),
        inset 2px 2px 0 var(--metal-light);
    user-select: none;
    -webkit-user-select: none;
    text-align: center;
    flex: 1;
    min-width: 70px;
}

.jam-display-chip:hover {
    background: var(--mk-highlight);
    box-shadow:
        inset -2px -2px 0 var(--mk-yellow),
        inset 2px 2px 0 var(--white);
}

.jam-display-chip.selected {
    background: var(--mk-yellow);
    box-shadow:
        inset 2px 2px 0 var(--mk-orange),
        inset -2px -2px 0 var(--mk-highlight);
    transform: translateY(1px);
}

.jam-display-chip.selected:hover {
    background: var(--mk-yellow);
}

/* Jam Metronome Chips */
.jam-metronome-chips {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    width: 100%;
}

.jam-metronome-chip {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px 16px;
    background: var(--metal-mid);
    border: 3px solid var(--black);
    border-radius: 4px;
    color: var(--black);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow:
        inset -2px -2px 0 var(--metal-dark),
        inset 2px 2px 0 var(--metal-light);
    user-select: none;
    -webkit-user-select: none;
    text-align: center;
    flex: 0 0 auto;
}

.jam-metronome-chip:hover {
    background: var(--mk-highlight);
    box-shadow:
        inset -2px -2px 0 var(--mk-yellow),
        inset 2px 2px 0 var(--white);
}

.jam-metronome-chip.selected {
    background: var(--mk-yellow);
    box-shadow:
        inset 2px 2px 0 var(--mk-orange),
        inset -2px -2px 0 var(--mk-highlight);
    transform: translateY(1px);
}

.jam-metronome-chip.selected:hover {
    background: var(--mk-yellow);
}

/* Mobile Styles */
@media (max-width: 768px) {
    #tabbed-controls {
        width: calc(100% - 24px);
        max-width: 100%;
    }

    #tab-navigation {
        gap: 4px;
    }

    .tab-btn {
        font-size: 10px;
        padding: 10px 12px;
    }

    #chip-controls {
        padding: 24px;
        width: 100%;
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
        border-radius: 0 8px 8px 8px;
        justify-content: space-between;
    }

    #jam-controls {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 24px;
        width: 100%;
        gap: 16px;
        border-radius: 0 8px 8px 8px;
        justify-content: flex-start;
    }

    .jam-column {
        min-width: 100%;
        width: 100%;
    }

    /* Root and Backing Track in one row on mobile */
    /* Backing Track - 3/4 width */
    .jam-column:nth-child(2) {
        flex: 3;
        min-width: calc(75% - 12px);
        width: calc(75% - 12px);
    }

    /* Root - 1/4 width */
    .jam-column:nth-child(3) {
        flex: 1;
        min-width: calc(25% - 4px);
        width: calc(25% - 4px);
    }

    .jam-col-2,
    .jam-col-4 {
        flex: 1;
        min-width: 100%;
        width: 100%;
        border-left: none;
        padding-left: 0;
    }

    /* Transport, Settings columns stay full width */
    .jam-column:nth-child(1),
    .jam-column:nth-child(4) {
        flex: 1;
        min-width: 100%;
        width: 100%;
    }

    /* Remove desktop left spacing/border from Settings column in mobile */
    .jam-col-4 {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }

    .jam-btn {
        font-size: 10px;
        padding: 14px 20px;
    }

    .jam-column-label {
        font-size: 10px;
    }

    .jam-setting-label {
        font-size: 7px;
    }

    /* Move top shadow up 1px in mobile for backing track and root */
    .jam-column:has(.jam-root-chips)::before,
    .jam-column:has(.jam-preset-chips)::before {
        top: 28px;
    }

    .tempo-display {
        font-size: 9px;
    }

    .jam-select {
        font-size: 8px;
        padding: 10px;
    }

    .jam-status {
        font-size: 8px;
    }

    .jam-root-chips {
        max-height: 225px;
    }

    .jam-root-chip {
        font-size: 7px;
        padding: 12px 10px;
        width: 100%;
    }

    .jam-preset-chips {
        max-height: 225px;
    }

    .jam-preset-chip {
        font-size: 7px;
        padding: 10px 8px;
    }


    .jam-sound-chip {
        font-size: 7px;
        padding: 8px 12px;
    }

    .jam-display-chip {
        font-size: 7px;
        padding: 8px 12px;
    }

    .jam-metronome-chip {
        font-size: 7px;
        padding: 8px 12px;
    }

    .tempo-arrow {
        font-size: 7px;
        padding: 6px;
        min-width: 28px;
        height: 28px;
    }
}