* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

label {
    font-weight: 500;
}

input[type="range"] {
    width: 100px;
}

select, button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    font-weight: 500;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#array-container {
    display: flex;
    height: 400px;
    align-items: flex-end;
    gap: 2px;
    padding: 20px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.array-bar {
    background-color: #3498db;
    width: 100%;
    transition: height 0.3s ease, background-color 0.3s ease;
    border-radius: 3px 3px 0 0;
}

.array-bar.comparing {
    background-color: #e74c3c;
}

.array-bar.sorted {
    background-color: #2ecc71;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.box {
    width: 20px;
    height: 20px;
    background-color: #3498db;
    border-radius: 3px;
}

.box.comparing {
    background-color: #e74c3c;
}

.box.sorted {
    background-color: #2ecc71;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group {
        justify-content: space-between;
    }
    
    input[type="range"] {
        flex-grow: 1;
    }
}
