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

body {
    background: #000;
    font-family: 'Courier New', monospace;
    color: #ffffff;
    overflow: hidden;
}

#canvas {
    display: block;
    background: #000;
    touch-action: none; /* Prevent default touch behaviors */
}

/* Desktop Layout */
.ui-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    border-right: 2px solid #ffffff;
    padding: 20px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(255, 255, 255, 0.3);
}

/* Mobile Layout */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }
    
    #canvas {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 60vh;
        z-index: 1;
    }
    
    .ui-panel {
        position: fixed;
        top: 60vh;
        left: 0;
        width: 100vw;
        height: 40vh;
        border-right: none;
        border-top: 2px solid #ffffff;
        padding: 15px;
        overflow-y: auto;
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(255, 255, 255, 0.3);
    }
}

.ui-panel h1 {
    color: #ffffff;
    font-size: 18px;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 10px #ffffff;
    letter-spacing: 2px;
}

.control-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333333;
}

.control-section h3 {
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mode Switcher */
.mode-switcher {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 20px;
}

.mode-switcher label {
    font-weight: bold;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Terrain Controls */
#terrainControls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #333;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    .ui-panel h1 {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .control-section {
        margin-bottom: 20px;
        padding-bottom: 10px;
    }
    
    .control-section h3 {
        font-size: 12px;
        margin-bottom: 8px;
    }
}

.control-section label {
    display: block;
    margin: 8px 0 4px 0;
    font-size: 12px;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-section input[type="range"] {
    width: 100%;
    margin: 5px 0 10px 0;
    background: #333;
    outline: none;
    border-radius: 15px;
    height: 6px;
    -webkit-appearance: none;
}

.control-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 2px solid #000;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.control-section input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 2px solid #000;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.control-section input[type="color"] {
    width: 100%;
    height: 30px;
    border: none;
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
}

.control-section select {
    width: 100%;
    padding: 8px;
    margin: 5px 0 10px 0;
    background: #333;
    color: #ffffff;
    border: 1px solid #555;
    border-radius: 3px;
    font-family: inherit;
}

.control-section span {
    color: #ffffff;
    font-weight: bold;
    margin-left: 10px;
    font-size: 12px;
}

/* Buttons */
.btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 10px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    width: 100%;
    margin: 5px 0;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.btn-small {
    padding: 6px 10px;
    font-size: 10px;
    width: auto;
    margin: 5px 0;
}

.record-btn {
    background: rgba(255, 0, 0, 0.2);
    border-color: #ff0000;
}

.record-btn:hover {
    background: rgba(255, 0, 0, 0.3);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

/* Checkboxes */
input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.hint {
    font-size: 10px;
    color: #888;
    margin-bottom: 10px;
    font-style: italic;
}

/* Joystick */
.joystick-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.joystick {
    width: 80px;
    height: 80px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    cursor: grab;
}

.joystick:active {
    cursor: grabbing;
}

.joystick-knob {
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: all 0.1s ease;
}

/* Webcam controls */
.webcam-status {
    font-size: 10px;
    color: #00ff00;
    margin: 5px 0;
    min-height: 12px;
}

.webcam-preview {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 5px;
    margin-top: 10px;
    display: none;
    border: 1px solid #333;
}

.webcam-preview.active {
    display: block;
}

.recording-status {
    font-size: 10px;
    color: #ff0000;
    margin: 5px 0;
    min-height: 12px;
}

/* Mobile touch improvements */
@media (max-width: 768px) {
    .btn {
        padding: 12px 15px;
        font-size: 14px;
        margin: 8px 0;
    }
    
    .control-section input[type="range"] {
        height: 8px;
        margin: 8px 0 12px 0;
    }
    
    .control-section input[type="range"]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    
    .control-section input[type="range"]::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }
    
    .control-section label {
        font-size: 14px;
        margin: 10px 0 6px 0;
    }
    
    .control-section span {
        font-size: 14px;
    }
    
    .joystick {
        width: 100px;
        height: 100px;
    }
    
    .joystick-knob {
        width: 25px;
        height: 25px;
    }
}

/* Scrollbar styling for mobile */
@media (max-width: 768px) {
    .ui-panel::-webkit-scrollbar {
        width: 4px;
    }
    
    .ui-panel::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .ui-panel::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
}
