* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
}

.simulation-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.canvas-container {
    position: relative;
    background: #333;  /* Match scene background color */
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    width: 100%;
    aspect-ratio: 4 / 3;  /* Maintain 800x600 aspect ratio */
}

#simCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#simCanvas:active {
    cursor: grabbing;
}

.status-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
}

.status-dot.connected {
    background: #4CAF50;
    box-shadow: 0 0 8px #4CAF50;
}

.status-dot.running {
    background: #2196F3;
    box-shadow: 0 0 8px #2196F3;
    animation: pulse 1.5s infinite;
}

.status-dot.stopped {
    background: #FF9800;
}

.status-dot.error {
    background: #f44336;
}

.status-dot.disconnected {
    background: #666;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.camera-hint {
    text-align: center;
    margin-top: 10px;
    color: #666;
    font-size: 0.85em;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.info-panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.joint-panel, .control-panel {
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.joint-panel h3, .control-panel h3 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.metric label {
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.metric span {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
    text-align: right;
    min-width: 70px;
}

.slider-metric {
    background: #f5f5f5;
}

.slider-metric .slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.slider-metric .slider-container input[type="range"] {
    width: 150px;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.slider-metric .slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-metric .slider-container input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-metric .slider-container span {
    min-width: 60px;
    color: #667eea;
}

.info-box {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.info-box h3 {
    margin-bottom: 10px;
    color: #667eea;
}

.info-box p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #666;
    font-size: 0.9em;
}

.simulation-values {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.simulation-values h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.1em;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.metrics-grid .metric {
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    font-size: 0.9em;
}

.manual-controls {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.manual-controls h3 {
    margin-bottom: 10px;
    color: #667eea;
}

.control-hint {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.slider-group {
    margin-bottom: 15px;
}

.slider-group label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-container span {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
    text-align: right;
    font-size: 0.9em;
}

/* Torque Control Pad */
.torque-pad-container {
    position: relative;
    margin: 15px auto;
    width: 280px;
    height: 280px;
}

#torquePad {
    display: block;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: crosshair;
    background: #1a1a2e;
}

#torquePad:hover {
    border-color: #764ba2;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

.torque-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.torque-labels span {
    position: absolute;
    font-size: 0.85em;
    font-weight: bold;
    color: #667eea;
}

.label-top {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.label-bottom {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.label-left {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.label-right {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

/* Quick Actions */
.quick-actions {
    margin-top: 15px;
}

.quick-actions h4 {
    margin-bottom: 10px;
    color: #555;
    font-size: 0.95em;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-action {
    padding: 10px 12px;
    border: none;
    border-radius: 5px;
    background: #667eea;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.btn-action:active {
    transform: translateY(0);
}

.hint {
    margin-top: 15px;
    text-align: center;
    font-size: 0.9em;
    color: #667eea;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

