* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

.header {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 0;
    text-align: center;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.header p {
    font-size: 1rem;
    opacity: 0.8;
}

.controls {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    display: flex;
    gap: 25px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.control-group label {
    font-size: 14px;
    font-weight: 600;
    color: #e8e8e8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-container {
    position: relative;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    /* -webkit-appearance: none; */
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff6b6b;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ff5252;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff6b6b;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

select {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

select:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

select option {
    background: #2c3e50;
    color: white;
}

.button-group {
    display: flex;
    gap: 12px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

#start-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

#start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

#reset-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

#reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

button:disabled {
    background: rgba(150, 150, 150, 0.5) !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.canvas-container {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    min-height: calc(100vh - 200px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
}

.value-display {
    font-size: 12px;
    color: #bbb;
    text-align: center;
    margin-top: 4px;
}

.info-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 200px;
    z-index: 1000;
}

.info-panel h3 {
    margin-bottom: 10px;
    color: #4ecdc4;
    font-size: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 14px;
}

.status {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status.ready {
    background: rgba(78, 205, 196, 0.2);
    color: #4ecdc4;
    border: 1px solid #4ecdc4;
}

.status.sorting {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid #ffc107;
}

.status.completed {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border: 1px solid #28a745;
}

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

    .control-group {
        width: 100%;
        max-width: 300px;
    }

    .button-group {
        width: 100%;
        justify-content: center;
    }

    .header h1 {
        font-size: 2rem;
    }

    .info-panel {
        position: relative;
        top: auto;
        right: auto;
        margin: 20px;
        width: calc(100% - 40px);
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
