/* --- Global Variables & Reset --- */
:root {
    --accent: #ff007f; /* Default Cyber Pink */
    --bg-dark: #080a0c;
    --panel-bg: rgba(15, 18, 22, 0.8);
    --border-glow: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body { 
    margin: 0; 
    overflow: hidden; 
    background-color: var(--bg-dark); 
    font-family: 'Inter', sans-serif; 
    color: #fff; 
}

/* --- UI Panel (Glassmorphism - Moved to Right) --- */
#ui-panel {
    position: absolute; 
    top: 24px; 
    right: 24px; 
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glow);
    border-radius: 20px; 
    padding: 24px; 
    width: 280px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    z-index: 100;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 24px; 
}

h3 { 
    margin: 0; 
    font-weight: 600; 
    font-size: 1rem; 
    letter-spacing: -0.2px;
}

.badge { 
    font-size: 0.6rem; 
    background: var(--accent); 
    color: #000; 
    padding: 3px 10px; 
    border-radius: 6px; 
    font-weight: 800; 
    text-transform: uppercase;
    transition: background 0.3s ease;
    animation: pulse-glow 2s infinite alternate;
}

/* --- Control Groups --- */
.control-group { margin-bottom: 20px; }

label { 
    display: block; 
    margin-bottom: 10px; 
    font-size: 0.7rem; 
    color: rgba(255,255,255,0.4); 
    text-transform: uppercase; 
    letter-spacing: 1.5px;
    font-weight: 700;
}

button {
    width: 100%;
    background: rgba(255,255,255,0.05); 
    border: 1px solid var(--border-glow); 
    color: #fff;
    padding: 12px; 
    border-radius: 10px; 
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    font-size: 0.85rem;
    font-family: inherit;
    margin-bottom: 8px;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); /* Smoother button feel */
}

button:hover { 
    background: rgba(255,255,255,0.12); 
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

button:active { transform: translateY(0); }

input[type="color"] { 
    -webkit-appearance: none;
    border: none; 
    width: 100%; 
    height: 45px; 
    border-radius: 10px; 
    cursor: pointer; 
    background: rgba(255,255,255,0.05); 
    padding: 4px;
    border: 1px solid var(--border-glow);
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

/* --- Instructions Box --- */
.hint-box { 
    font-size: 0.75rem; 
    color: rgba(255,255,255,0.7); 
    line-height: 1.6; 
    background: rgba(0,0,0,0.4); 
    padding: 16px; 
    border-radius: 14px;
    border-left: 3px solid var(--accent);
}

.hint-box p { margin: 6px 0; }

/* --- Webcam Radar (Top Left) --- */
#webcam-container {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 240px; 
    height: 180px;
    z-index: 50;
    border: 2px solid var(--accent);
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#webcam, #output_canvas { 
    position: absolute; 
    transform: scaleX(-1); /* Mirror effect */
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

/* --- Loading Screen & Spinner --- */
#loading {
    position: fixed; 
    inset: 0;
    background: var(--bg-dark); 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 0, 127, 0.1);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
    from { box-shadow: 0 0 5px var(--accent); }
    to { box-shadow: 0 0 15px var(--accent); }
}

/* Canvas for the 3D Scene */
canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}



@media (max-width: 768px) {
    #ui-panel {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        padding: 15px;
        border-radius: 15px;
    }
    #webcam-container {
        top: 10px;
        left: 10px;
        width: 140px;
        height: 105px;
        border-width: 1px;
    }

    /* Hide instructions on mobile to save space */
    .hint-box {
        display: none;
    }

    header {
        margin-bottom: 10px;
    }

    .control-group {
        margin-bottom: 10px;
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .control-group label {
        display: none; /* Save vertical space */
    }

    button {
        padding: 10px;
        font-size: 0.75rem;
        margin-bottom: 0;
    }
}