/* Google Material Design 3 (M3) Style Sheet - Light Theme - Solid Cards */

:root {
    /* Color Palette - Material 3 Light Theme Baseline (Google Style) */
    --md-sys-color-background: #f8f9fa;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-container: #f0f4f9;
    --md-sys-color-primary: #1a73e8; /* Google Blue */
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d3e3fd;
    --md-sys-color-on-primary-container: #041e49;
    --md-sys-color-outline: #c4c7c5;
    --md-sys-color-on-surface: #1f1f1f;
    --md-sys-color-on-surface-variant: #444746;
    
    --font-main: 'Roboto', 'Inter', sans-serif;
    
    --md-elevation-1: 0px 4px 16px rgba(0, 0, 0, 0.08);
}

body.light-theme {
    background-color: #000;
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-main);
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
}

/* Full Screen Webcam & Canvas Setup */
#webcam {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 1;
}

#skeleton-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    transform: scaleX(-1);
    z-index: 2;
    pointer-events: none;
}

/* Shutter Flash Screen Overlay */
#flash-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    background: white;
    transition: opacity 0.15s ease-out;
}

/* Top Header style */
.glass-card {
    background: #ffffff !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    border-radius: 16px !important;
    box-shadow: var(--md-elevation-1) !important;
}

.brand-title {
    font-size: 0.95rem !important;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
}

.brand-subtitle {
    color: var(--md-sys-color-on-surface-variant);
}

/* Status Chip */
#tracking-status-badge {
    background-color: #ffffff !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    color: var(--md-sys-color-primary) !important;
    border-radius: 100px !important;
    font-weight: 600;
    font-size: 0.75rem;
    box-shadow: 0px 2px 6px rgba(0,0,0,0.05);
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green {
    background-color: #0f9d58; /* Material Green */
}

/* Countdown overlay */
#gesture-countdown-screen {
    z-index: 90;
    pointer-events: none;
}
#countdown-number {
    font-size: 10rem;
    font-weight: 900;
    color: var(--md-sys-color-primary);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 100px rgba(255, 255, 255, 0.6);
}

/* RIGHT COLUMN: Vertical challenge icons sidebar layout (centered vertically, responsive to height) */
/* RIGHT COLUMN: Vertical challenge icons sidebar layout (centered vertically, responsive to height) */
#challenge-icons-sidebar {
    position: absolute;
    right: 4.5rem;
    top: 52%; /* Adjusted to center vertically and avoid READY badge overlap */
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Stretches items vertically based on height */
    height: 70vh; /* Fits comfortably within portrait or landscape limits */
    max-height: 680px;
    min-height: 460px;
    align-items: center;
    z-index: 10;
}

.challenge-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    width: auto;
    height: auto;
}

.icon-wrapper {
    position: relative;
    display: inline-block;
}

.hand-icon-img {
    height: 15vh; /* Bold and visible without overflowing vertical height */
    max-height: 140px;
    min-height: 90px;
    width: auto;
    object-fit: contain;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.75; /* highly visible, clean default state */
    filter: none; /* no neon drop shadow */
}

.hand-icon-img.double-icon {
    height: 11vh; /* slightly smaller for double victory side-by-side */
    max-height: 105px;
    min-height: 65px;
}

/* Green Checkmark Badge */
.checkmark-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    z-index: 15;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.checkmark-badge i {
    font-size: 2.8rem; /* proportionate badge checkmark */
    color: #0f9d58; /* Google green */
    background: #ffffff; /* solid white background to cover overlay */
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    display: block;
}

.challenge-icon-item.active {
    color: var(--md-sys-color-primary) !important;
}

.challenge-icon-item.active .hand-icon-img {
    opacity: 1 !important;
}

.challenge-icon-item.active .hand-icon-img:not(.double-icon) {
    transform: scale(1.15);
}
.challenge-icon-item.active .double-icon {
    transform: scale(1.15);
}
/* Retain scaleX(-1) mirror effect for the left hand in double victory active */
.challenge-icon-item.active .double-icon:first-child {
    transform: scaleX(-1) scale(1.15) !important;
}

.challenge-icon-item.completed {
    transform: scale(1.0);
}

.challenge-icon-item.completed .hand-icon-img {
    opacity: 0.35 !important;
    filter: grayscale(100%) !important; /* image turns grey without color */
    transform: scale(1.0);
}
.challenge-icon-item.completed .double-icon:first-child {
    transform: scaleX(-1) scale(1.0) !important;
}

/* Show checkmark badge when completed */
.challenge-icon-item.completed .checkmark-badge {
    opacity: 1;
    transform: scale(1.0);
}

/* BOTTOM LEFT: Detected Gesture Display Container */
#detected-gesture-container {
    position: absolute;
    left: 3rem;
    bottom: 3rem;
    z-index: 10;
}

.detected-gesture-line {
    font-size: 2.5rem; /* 3x larger text */
    color: #00f2fe; /* bright neon blue text */
    text-shadow: 0 0 12px rgba(0, 242, 254, 0.6);
    letter-spacing: 0.5px;
}

.detected-gesture-scanning {
    font-size: 1.6rem;
    color: rgba(0, 242, 254, 0.5);
    text-shadow: 0 0 6px rgba(0, 242, 254, 0.2);
}

/* Modal overlays */
#camera-loading-overlay, #upload-screen, #result-screen {
    z-index: 999;
}

.result-card {
    background: #ffffff !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    width: 100%;
    max-width: 550px;
    border-radius: 24px !important;
    box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.15) !important;
}

.qr-container {
    background-color: #ffffff !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    padding: 12px !important;
    border-radius: 16px !important;
}

.thumb-wrapper {
    background-color: #000;
    border-radius: 12px !important;
}

/* M3 Primary Button (Rounded-pill) */
.btn-primary {
    background-color: var(--md-sys-color-primary) !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
    border-radius: 100px !important;
    box-shadow: 0px 4px 12px rgba(26, 115, 232, 0.2) !important;
    transition: background-color 0.15s, transform 0.1s !important;
}
.btn-primary:hover {
    background-color: #1557b0 !important;
}
.btn-primary:active {
    transform: scale(0.98);
}

/* MOBILE VIEW LAYOUT (Mobile Friendly & Responsive) */
@media (max-width: 991px) {
    #challenge-icons-sidebar {
        right: 1.5rem;
        left: 1.5rem;
        top: auto;
        bottom: 2rem;
        transform: none;
        flex-direction: row;
        justify-content: space-around;
        height: auto;
        min-height: auto;
        max-height: auto;
        gap: 0.5rem;
    }
    
    .hand-icon-img {
        height: 14vh; /* Bold but fits horizontal mobile screen widths */
        max-height: 100px;
        min-height: 65px;
    }
    
    .hand-icon-img.double-icon {
        height: 10vh;
        max-height: 72px;
        min-height: 45px;
    }
    
    .checkmark-badge {
        top: -8px;
        left: -8px;
    }
    
    .checkmark-badge i {
        font-size: 2.0rem; /* bold badge checkmark */
    }
    
    /* Place detected gesture text above the icons */
    #detected-gesture-container {
        left: 1rem;
        right: 1rem;
        bottom: 11.5rem; /* Positioned cleanly above horizontal icons */
        text-align: center;
    }
    
    .detected-gesture-line {
        font-size: 1.15rem !important; /* Smaller font size to prevent wrapping */
        text-shadow: 0 0 8px rgba(0, 242, 254, 0.5);
    }
    
    .detected-gesture-scanning {
        font-size: 1.0rem;
    }
}
