.chiptune-panel {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.chiptune-layout {
    display: flex;
    flex-direction: column;
}

@media (min-width: 900px) {
    .chiptune-layout {
        flex-direction: row;
        min-height: 650px;
    }
}

.chiptune-sidebar {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--glass-border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 900px) {
    .chiptune-sidebar {
        width: 320px;
        flex-shrink: 0;
    }
}

.chiptune-main {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    overflow-x: auto;
    min-height: 400px;
}

.control-group h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.waveform-selector {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    justify-content: space-between;
}

.btn-wave {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
}

.btn-wave:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-wave.active {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.5);
    color: #facc15;
}

.slider-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.slider-row label {
    font-size: 0.9rem;
    color: var(--text-main);
}

.slider-row input[type="range"] {
    width: 100%;
    accent-color: #eab308;
}

.val-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.chiptune-actions {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.btn-play {
    background: #eab308;
    color: #1a1a1a;
    border: none;
}
.btn-play:hover {
    background: #facc15;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(234, 179, 8, 0.3);
}

/* Sequencer Grid */
.sequencer-container {
    position: relative;
    display: flex;
    height: 100%;
}

.sequencer-grid {
    display: grid;
    /* JS will set grid-template-columns and grid-template-rows */
    gap: 2px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 2px;
    position: relative;
}

.grid-cell {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}
.grid-cell:hover {
    background: rgba(255, 255, 255, 0.1);
}
.grid-cell.active {
    background: #eab308;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
}
.grid-cell.playing {
    background: rgba(254, 240, 138, 0.3);
}
.grid-cell.active.playing {
    background: #ffffff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
}

/* Dynamic Zebra striping applied via JS */
.grid-cell.beat-alt {
    background: rgba(255, 255, 255, 0.05);
}
.grid-cell.active.beat-alt {
    background: #eab308;
}

.note-label {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.65rem;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
}
