* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.drum-machine {
    background: linear-gradient(145deg, #2a2a3e, #1f1f2e);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid #3a3a4e;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #3a3a4e;
}

.logo {
    font-size: 2.5em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.controls-top {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', monospace;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-play {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
}

.btn-play:hover {
    background: linear-gradient(135deg, #0f8a7d 0%, #32d66f 100%);
}

.btn-play.playing {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

.btn-stop {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
    color: #fff;
}

.btn-clear {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 8px 16px;
    font-size: 14px;
}

/* BPM Section */
.bpm-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bpm-section label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: bold;
}

#bpmValue {
    color: #38ef7d;
    font-size: 20px;
    margin-left: 10px;
}

#bpmSlider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #3a3a4e;
    outline: none;
    -webkit-appearance: none;
}

#bpmSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

#bpmSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
}

/* Block Section */
.block-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.block-section label {
    font-weight: bold;
    font-size: 14px;
}

.block-buttons {
    display: flex;
    gap: 8px;
}

.block-btn {
    padding: 8px 16px;
    border: 2px solid #3a3a4e;
    border-radius: 6px;
    background: #2a2a3e;
    color: #fff;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
}

.block-btn:hover {
    border-color: #667eea;
    background: #3a3a4e;
}

.block-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #8899ff;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.6);
}

.block-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.nav-btn {
    padding: 8px 12px;
    border: 2px solid #3a3a4e;
    border-radius: 6px;
    background: #2a2a3e;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: #667eea;
    background: #3a3a4e;
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#blockIndicator {
    font-size: 14px;
    font-weight: bold;
    color: #38ef7d;
    min-width: 80px;
    text-align: center;
}

/* Pattern Section */
.pattern-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pattern-section label {
    font-weight: bold;
    font-size: 14px;
}

#patternSelect {
    flex: 1;
    padding: 8px 12px;
    background: #2a2a3e;
    border: 2px solid #3a3a4e;
    border-radius: 6px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
}

#patternSelect:focus {
    outline: none;
    border-color: #667eea;
}

/* Sequencer */
.sequencer {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.channel-labels {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
}

.label-header {
    height: 41px;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    color: #667eea;
    padding-left: 12px;
}

.channel-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Match the height of grid rows - will be set by grid auto-sizing */
    min-height:68px;
}

.label-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.instrument-name {
    font-weight: bold;
    font-size: 14px;
    color: #38ef7d;
    line-height: 1;
}

.sound-selector {
    padding: 4px 8px;
    background: #2a2a3e;
    border: 1px solid #3a3a4e;
    border-radius: 4px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
}

.sound-selector:focus {
    outline: none;
    border-color: #667eea;
}

.preview-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 2px solid #3a3a4e;
    border-radius: 6px;
    background: linear-gradient(145deg, #2a2a3e, #1f1f2e);
    color: #38ef7d;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.preview-btn:hover {
    border-color: #38ef7d;
    background: linear-gradient(145deg, #38ef7d, #11998e);
    color: #fff;
    box-shadow: 0 0 10px rgba(56, 239, 125, 0.5);
}

.preview-btn:active {
    transform: scale(0.95);
}

.mute-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 2px solid #3a3a4e;
    border-radius: 6px;
    background: linear-gradient(145deg, #2a2a3e, #1f1f2e);
    color: #38ef7d;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-right: 8px;
}

.mute-btn:hover {
    border-color: #38ef7d;
    background: linear-gradient(145deg, #38ef7d, #11998e);
    color: #fff;
    box-shadow: 0 0 10px rgba(56, 239, 125, 0.5);
}

.mute-btn:active {
    transform: scale(0.95);
}

.mute-btn.muted {
    background: linear-gradient(145deg, #e53e3e, #c53030);
    border-color: #e53e3e;
    color: #fed7d7;
}

.mute-btn.muted:hover {
    background: linear-gradient(145deg, #c53030, #9b2c2c);
    border-color: #fc8181;
    box-shadow: 0 0 10px rgba(229, 62, 62, 0.5);
}

.grid-container {
    flex: 1;
}

.step-indicators {
    display: flex;
    flex-direction: column;
}

.indicator-header {
    height: 32px;
}

.step-numbers {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 2px;
}

.step-numbers span {
    text-align: center;
    font-size: 10px;
    color: #667eea;
    font-weight: bold;
}

.grid {
    display: grid;
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
}

.channel-row {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 2px;
    min-height: 50px;
}

/* Pads */
.pad {
    aspect-ratio: 1;
    border: none;
    border-radius: 6px;
    background: linear-gradient(145deg, #2a2a3e, #1f1f2e);
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    border: 2px solid #3a3a4e;
}

.pad:hover {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.pad.active {
    background: linear-gradient(145deg, #667eea, #764ba2);
    box-shadow: 
        0 0 15px rgba(102, 126, 234, 0.6),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    border-color: #8899ff;
}

.pad.playing {
    background: linear-gradient(145deg, #38ef7d, #11998e);
    box-shadow: 
        0 0 20px rgba(56, 239, 125, 0.8),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    border-color: #38ef7d;
}

.pad.active.playing {
    background: linear-gradient(145deg, #ffd700, #ffa500);
    box-shadow: 
        0 0 25px rgba(255, 215, 0, 0.9),
        inset 0 2px 4px rgba(255, 255, 255, 0.4);
    border-color: #ffd700;
}

/* Beat markers (every 4 steps) */
.pad:nth-child(4n+1) {
    border-left: 3px solid #667eea;
}

/* Info Panel */
.info-panel {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-panel p {
    margin-bottom: 10px;
    color: #667eea;
}

.info-panel ul {
    list-style: none;
    padding-left: 0;
}

.info-panel li {
    padding: 5px 0;
    color: #aaa;
    font-size: 14px;
}

.info-panel li:before {
    content: "▸ ";
    color: #38ef7d;
    font-weight: bold;
    margin-right: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
    .sequencer {
        flex-direction: column;
    }
    
    .channel-labels {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .channel-label {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo {
        font-size: 2em;
    }
    
    .pattern-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .step-numbers span {
        font-size: 8px;
    }
    
    .pad {
        border-radius: 4px;
    }
}

/* Footer Styles */
.footer {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-top: 1px solid #667eea;
    margin-top: 20px;
}

.footer p {
    margin: 0;
    color: #a0aec0;
    font-size: 14px;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #7c3aed;
}
