* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #fff;
    overflow-x: hidden;
    touch-action: manipulation;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.video-container {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 300px;
    max-height: 500px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    background: #000;
    flex-shrink: 0;
}

#video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    opacity: 0.3;
}

#outputCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    opacity: 0.6;
}

#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.controls {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    -webkit-appearance: none;
    touch-action: pan-y;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.status {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
}

.status.success {
    background: rgba(76, 175, 80, 0.4);
    color: #81c784;
}

.status.error {
    background: rgba(244, 67, 54, 0.4);
    color: #e57373;
}

.status.warning {
    background: rgba(255, 152, 0, 0.4);
    color: #ffb74d;
}

.gesture-guide {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 10px;
}

.gesture-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    text-align: center;
}

.gesture-icon {
    font-size: 24px;
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .video-container {
        height: 50vh;
        min-height: 250px;
    }
    
    .controls {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 8px;
    }
    
    .control-group label {
        font-size: 11px;
    }
    
    .gesture-guide {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
        padding: 8px;
    }
    
    .gesture-item {
        font-size: 10px;
    }
    
    .gesture-icon {
        font-size: 20px;
    }
    
    .status {
        font-size: 12px;
        padding: 8px;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    body {
        display: flex;
        align-items: center;
    }
    
    .container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .video-container {
        width: 60vw;
        height: 80vh;
        max-height: none;
    }
    
    .controls {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .gesture-guide {
        grid-template-columns: repeat(4, 1fr);
    }
}
