* {
    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%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 1200px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.status-bar {
    background: #f0f0f0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

#status-message {
    font-weight: bold;
    color: #666;
}

#timer-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #764ba2;
}

#queue-info {
    color: #666;
}

.control-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-panel.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.motor-control {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #e0e0e0;
}

.motor-control h2 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.slider::-webkit-slider-thumb:hover {
    background: #764ba2;
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease-in-out;
}

.slider::-moz-range-thumb:hover {
    background: #764ba2;
    transform: scale(1.2);
}

.direction-control {
    display: flex;
    gap: 10px;
}

.dir-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.dir-btn:hover {
    background: #f0f0ff;
}

.dir-btn.active {
    background: #667eea;
    color: white;
}

.emergency-stop {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
}

.brake-btn {
    width: 100%;
    padding: 12px;
    border: 2px solid #dc3545;
    background: white;
    color: #dc3545;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.brake-btn[aria-pressed="true"],
.brake-btn:active {
    background: #dc3545;
    color: white;
}

.brake-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3);
}

.stop-btn {
    padding: 20px 60px;
    font-size: 1.5em;
    font-weight: bold;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(220, 53, 69, 0.3);
}

.stop-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(220, 53, 69, 0.4);
}

.stop-btn:active {
    transform: translateY(0);
}

.waiting-panel {
    display: none;
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 10px;
}

.waiting-panel.active {
    display: block;
}

.waiting-panel h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.waiting-panel p {
    font-size: 1.2em;
    color: #666;
    margin: 10px 0;
}

#queue-position {
    font-size: 3em;
    font-weight: bold;
    color: #764ba2;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .control-panel {
        grid-template-columns: 1fr;
    }
    
    .status-bar {
        flex-direction: column;
        text-align: center;
    }
}
