* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #000;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: #fff;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-overlay p {
    margin-top: 20px;
    font-size: 16px;
    padding: 0 20px;
    text-align: center;
}

#error-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.error-message {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.error-message h2 {
    color: #d32f2f;
    margin-bottom: 15px;
}

.error-message p {
    color: #333;
    line-height: 1.6;
}

/* lil-gui customization */
.lil-gui {
    --width: 300px;
    --widget-height: 20px;
    --name-width: 50%;
}

/* Multi-line configuration display */
.lil-gui .controller.string input[disabled] {
    white-space: pre-wrap;
    word-wrap: break-word;
    height: auto;
    min-height: 20px;
    line-height: 1.4;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 11px;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .lil-gui {
        --width: calc(100vw - 20px);
        max-width: 320px;
        --widget-height: 24px;
        --name-width: 45%;
        font-size: 11px;
    }
    
    .lil-gui.root {
        position: fixed !important;
        top: 10px !important;
        right: 10px !important;
        max-height: calc(100vh - 20px) !important;
        overflow-y: auto !important;
        z-index: 1000 !important;
    }
    
    .lil-gui .title {
        font-size: 13px;
        padding: 8px;
    }
    
    .lil-gui .controller {
        margin-bottom: 2px;
    }
    
    .lil-gui input {
        font-size: 11px;
    }
    
    .lil-gui button {
        font-size: 11px;
        padding: 6px 8px;
    }
    
    /* Make color pickers easier to tap */
    .lil-gui input[type="color"] {
        min-height: 28px;
    }
    
    /* Improve slider usability on mobile */
    .lil-gui input[type="range"] {
        min-height: 24px;
    }
    
    #loading-overlay p {
        font-size: 14px;
    }
    
    .error-message {
        padding: 20px;
        font-size: 14px;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .lil-gui.root {
        max-height: calc(100vh - 10px) !important;
        top: 5px !important;
        right: 5px !important;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .lil-gui {
        --width: calc(100vw - 20px);
        max-width: 280px;
        font-size: 10px;
    }
    
    .lil-gui .title {
        font-size: 12px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .lil-gui button {
        min-height: 32px;
    }
    
    .lil-gui .controller {
        min-height: 28px;
    }
}