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

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.control-group {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

select,
input,
button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

button {
    background: #4caf50;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background: #45a049;
    transform: translateY(-2px);
}

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

.visualization {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.algorithm-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.algorithm-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.algorithm-name {
    font-size: 1.5rem;
    font-weight: bold;
}

.stats {
    font-size: 0.9rem;
    opacity: 0.8;
}

.visual-container {
    height: 150px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow-x: auto;
}

.bar {
    flex: 1;
    background: #4caf50;
    transition: height 0.3s, background-color 0.3s;
    border-radius: 3px 3px 0 0;
    min-width: 8px;
}

.bar.comparing {
    background: #ff9800;
}

.bar.sorted {
    background: #2196f3;
}

.bar.swapping {
    background: #f44336;
}

.bucket-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bucket-row {
    display: flex;
    gap: 5px;
    align-items: flex-end;
}

.bucket-label {
    width: 50px;
    text-align: center;
    font-size: 0.8rem;
}

.radix-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radix-digit {
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.digit-label {
    width: 30px;
    text-align: center;
    font-size: 0.8rem;
}

.comparison {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.comparison-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-align: center;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.comparison-table th {
    background: rgba(0, 0, 0, 0.2);
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-size: 0.9rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }

    .algorithm-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}