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

body {
  background: #f0f2f5;
  padding: 20px;
}

.container {
  display: flex;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.sidebar {
  background: white;
  border-radius: 10px;
  padding: 20px;
  width: 250px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.algorithm-selector,
.array-controls,
.sort-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-weight: 600;
  color: #333;
}

select, input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

button {
  background: #4a6bff;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

button:hover {
  background: #3a5bef;
}

button:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

.visualization-container {
  flex-grow: 1;
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stage {
  position: relative;
  height: 300px;
  background: #f8f9fa;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.bar {
  position: absolute;
  width: 20px;
  background: #4a6bff;
  border-radius: 3px 3px 0 0;
  transition: all 0.3s ease;
  bottom: 0;
}

.bar.comparing {
  background: #ffcc00;
  z-index: 2;
}

.bar.swapping {
  background: #ff4d4d;
  z-index: 3;
}

.bar.merge-highlight {
  background: #ffcc00;
  z-index: 2;
}

.bar.merge-overwrite {
  background: #ff4d4d;
  z-index: 2;
}

@keyframes upAndDownScale {
  0% { transform: scaleY(1); }
  50% { transform: scaleY(1.1); }
  100% { transform: scaleY(1); }
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
  }
}