/* Hand Tracking Virtual Cursor */
.hand-cursor {
    position: fixed !important;
    width: 80px !important;
    height: 80px !important;
    pointer-events: none !important;
    z-index: 999999 !important;
    display: none !important;  /* Will be set to block by JS */
    left: 0;
    top: 0;
    transform: translate(-40px, -40px);  /* Center the cursor */
    opacity: 1 !important;
}

.cursor-orb {
    position: absolute;
    width: 40px;  /* Increased from 20px */
    height: 40px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #00ff00);  /* Bright green for visibility */
    border-radius: 50%;
    box-shadow: 
        0 0 30px rgba(0, 255, 0, 1),      /* Bright green glow */
        0 0 60px rgba(0, 255, 0, 0.8),
        inset 0 0 15px rgba(255, 255, 255, 0.8);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: cursorPulse 2s ease-in-out infinite;
    border: 3px solid #ffffff;  /* White border for contrast */
}


@keyframes cursorPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.9;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

.cursor-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.hand-cursor.hovering .cursor-progress {
    opacity: 1;
}

.hand-cursor.clicking .cursor-orb {
    animation: clickPulse 0.3s ease-out;
}

@keyframes clickPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Hover state for elements */
.hand-hover {
    outline: 3px solid rgba(100, 150, 255, 0.6);
    outline-offset: 4px;
    animation: hoverGlow 1s ease-in-out infinite;
}

@keyframes hoverGlow {
    0%, 100% {
        outline-color: rgba(100, 150, 255, 0.6);
    }
    50% {
        outline-color: rgba(100, 200, 255, 0.9);
    }
}

/* Hand Tracking Toggle Button */
#handTrackingToggle {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: none; /* Hidden by default - JavaScript will show if enabled */
    align-items: center;
    justify-content: center;
}

#handTrackingToggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#handTrackingToggle.active {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: activePulse 2s ease-in-out infinite;
}

@keyframes activePulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(56, 239, 125, 0.8);
    }
}

/* Camera Active Indicator */
.camera-indicator {
    position: fixed;
    top: 170px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
    animation: recordingBlink 2s ease-in-out infinite;
}

.camera-indicator.active {
    display: flex;
}

.camera-indicator::before {
    content: '🔴';
    font-size: 16px;
    animation: recordingPulse 1s ease-in-out infinite;
}

@keyframes recordingBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes recordingPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Debug Video PIP */
.hand-tracking-debug-video {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 320px !important;
    height: 240px !important;
    border: 3px solid #00ff00 !important;
    border-radius: 10px !important;
    z-index: 999998 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
    background: #000 !important;
    transform: scaleX(-1); /* Mirror the video to match canvas and user movement */
}

.hand-tracking-debug-canvas {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 320px !important;
    height: 240px !important;
    pointer-events: none !important;
    z-index: 999999 !important;
    z-index: 999999 !important;
}

/* High Performance Mode for Hand Tracking */
/* Disable expensive effects on modals only, preserve cursor */
body.hand-tracking-active .modal,
body.hand-tracking-active .modal-content,
body.hand-tracking-active .lang-button,
body.hand-tracking-active .wheel-status {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    transition: none !important;
}

/* Disable animations on everything EXCEPT cursor */
body.hand-tracking-active .modal *:not(.hand-cursor):not(.cursor-orb):not(.cursor-progress):not(.progress-ring-circle),
body.hand-tracking-active .modal-content *:not(.hand-cursor):not(.cursor-orb):not(.cursor-progress):not(.progress-ring-circle) {
    animation: none !important;
    transition: none !important;
}

/* Force cursor to stay visible */
body.hand-tracking-active .hand-cursor {
    display: block !important;
    opacity: 1 !important;
    z-index: 999999 !important;
}

body.hand-tracking-active .modal {
    background: rgba(0, 0, 0, 0.95) !important;
}

body.hand-tracking-active .modal-content {
    background: #1f2937 !important;
    border: 2px solid #4ECDC4 !important;
}

body.hand-tracking-active .option-button:hover {
    transform: none !important;
    background: #4ECDC4 !important;
    color: white !important;
}

/* Make buttons larger in hand tracking mode for easier clicking */
body.hand-tracking-active .option-button {
    padding: 35px 25px !important;
    font-size: 1.4rem !important;
    margin-bottom: 15px !important;
    min-height: 90px !important;
    font-weight: 600 !important;
}

body.hand-tracking-active .options-grid {
    gap: 20px !important;
}

/* Help Banner - Inline Instructions */
/* Help Banner - Inline Instructions */
/* Help Banner - Inline Instructions - BOTTOM POSITION */
.hand-tracking-help-banner {
    position: fixed;
    bottom: 15%; /* Moved to BOTTOM */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    max-width: 90%;
    width: auto;
    opacity: 1;
    transition: opacity 0.3s ease;
    animation: slideUp 0.4s ease-out;
    background: transparent;
    pointer-events: none; /* Let clicks pass through if needed, except button */
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.help-banner-content {
    background: rgba(30, 30, 40, 0.7); /* More transparent */
    backdrop-filter: blur(8px);
    border-radius: 30px; /* Pillow shape */
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: auto;
}

.help-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.help-text {
    flex: 1;
    color: white;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
}

.help-text strong {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2px;
}

.help-text p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
}

.help-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.help-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .hand-tracking-help-banner {
        top: 60px;
        max-width: 95%;
    }
    
    .help-banner-content {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .help-icon {
        font-size: 28px;
    }
    
    .help-text strong {
        font-size: 14px;
    }
    
    .help-text p {
        font-size: 12px;
    }
    
    .help-close-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .hand-tracking-help-banner {
        top: 50px;
    }
    
    .help-banner-content {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
    
    .help-close-btn {
        position: absolute;
        top: 8px;
        right: 8px;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #handTrackingToggle {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .camera-indicator {
        font-size: 10px;
        padding: 6px 12px;
    }
    
    .hand-tracking-debug-video,
    .hand-tracking-debug-canvas {
        width: 240px !important;
        height: 180px !important;
    }
}
