:root {
    --primary-color: #fca5a5;
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --accent: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    overflow: hidden;
    /* Prevent scrolling */
    width: 100vw;
    height: 100vh;
    cursor: default !important;
    /* Force cursor visibility unless overridden by JS */
}

body.hide-cursor {
    cursor: none !important;
}

/* Base Canvas - where the game is rendered */
#output_canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    /* Above Modal (50) to show hand drawing */
    pointer-events: none;
    /* Crucial: Let clicks pass through the canvas to the button */
}

/* 3D Hand Skeleton Canvas */
#three_canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 90;
    /* Overlap Modals (50) but under crosshair (100) */
    pointer-events: none;
    /* Let clicks pass to 2D canvas underneath */
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
    /* Let clicks pass through to canvas if needed */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
}

#score-container {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 30px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    align-self: flex-start;
}

#status-badge {
    position: absolute;
    top: 2rem;
    right: 2rem;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#status-badge.warning {
    background-color: #f59e0b;
    /* Amber */
    color: #fff;
}

#status-badge.ready {
    background-color: #10b981;
    /* Emerald */
    color: #fff;
}

/* Modal Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    /* Dark transparent background */
    backdrop-filter: blur(12px);
    /* Glassmorphism Blur */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    /* Topmost layer */
}

/* Hidden state for Modals */
.modal-overlay[style*="display: none"] {
    display: none !important;
}

.modal-content {
    background: rgba(30, 41, 59, 0.7);
    padding: 3rem 4rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 600px;
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.modal-content p {
    font-size: 1.5rem;
    color: #cbd5e1;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Action Button inside Modal */
.action-btn {
    display: inline-block;
    /* Allows text-align center on parent to work correctly */
    margin: 0 auto;
    padding: 1.2rem 3rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--accent), #b91c1c);
    /* Red gradient */
    border: none;
    border-radius: 50px;
    cursor: pointer !important;
    pointer-events: auto;
    /* Ensure clickable */
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.action-btn:hover,
.action-btn.hovered {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 35px rgba(239, 68, 68, 0.6);
    background: linear-gradient(135deg, #f87171, var(--accent));
}

/* Crosshair for Pinch interaction */
#crosshair {
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none !important;
    /* Critical to allow clicks to pass through */
    z-index: 100;
    /* Set very high to always render over Modals (z-index: 50) */
    transition: width 0.1s, height 0.1s, background-color 0.1s;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* When pinching */
#crosshair.pinched {
    width: 20px;
    height: 20px;
    background-color: var(--accent);
    border-color: white;
    box-shadow: 0 0 15px var(--accent);
}