:root {
    --md-sys-color-primary: #1a73e8; /* Google Blue */
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-variant: #f1f3f4;
    --md-sys-color-on-surface: #202124;
    --md-sys-color-on-surface-variant: #5f6368;
    --md-sys-color-outline: #dadce0;
    --md-sys-color-error: #d93025;
    
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: var(--font-family);
    background-color: #000000;
    color: var(--md-sys-color-on-surface);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Webcam view styling */
#webcam {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera stream */
    z-index: 1;
}

/* Main UI viewport overlay */
#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow: hidden;
}

/* Three.js viewport layer */
#three-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Screen flash animation */
#flash-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
}

.flash-active {
    animation: flash-anim 0.4s ease-out forwards;
}

@keyframes flash-anim {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Screens / HUD Layers */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.overlay-screen.active {
    display: flex;
}

/* Material Design Standard Cards */
.material-card {
    background-color: var(--md-sys-color-surface);
    border-radius: 24px !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    max-width: 95%;
    width: 480px;
    animation: scale-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.result-card {
    width: 620px;
}

@keyframes scale-up {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Typography styles */
.brand-title {
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.brand-subtitle {
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-brand {
    position: absolute;
    top: 2rem;
    left: 2rem;
    text-align: left;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--md-sys-color-outline);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Touchless Hover Button styling (Material Design Flat Action) */
#dance-btn-container {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 130px;
    height: 130px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4;
}

.material-btn {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--md-sys-color-outline);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    text-align: center;
    padding: 10px;
}

.material-btn .btn-icon {
    font-size: 2rem;
    margin-bottom: 2px;
}

.material-btn .btn-text {
    font-size: 0.65rem;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

#hover-progress-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

#hover-progress-svg .bg-circle {
    fill: none;
    stroke: rgba(0, 0, 0, 0.05);
    stroke-width: 4px;
}

#hover-progress-svg .fg-circle {
    fill: none;
    stroke: var(--md-sys-color-primary);
    stroke-width: 4px;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.1s linear;
}

.instruction-banner {
    position: absolute;
    bottom: 2.5rem;
    background: #ffffff;
    border: 1px solid var(--md-sys-color-outline);
    padding: 0.75rem 1.75rem;
    border-radius: 50px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* User hand cursor */
#hand-cursor {
    position: absolute;
    width: 28px;
    height: 28px;
    background-color: var(--md-sys-color-primary);
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: none;
    transform: translate(-50%, -50%);
    transition: width 0.1s, height 0.1s, background-color 0.2s;
}

#hand-cursor.hovering {
    width: 22px;
    height: 22px;
    background-color: #24b273; /* Green feedback */
}

/* Countdown Overlay */
#countdown-screen {
    background-color: rgba(0, 0, 0, 0.25);
}

#countdown-number {
    font-size: 11rem;
    font-weight: 900;
    color: var(--md-sys-color-primary);
    text-shadow: 0 4px 20px rgba(26, 115, 232, 0.4);
    animation: count-scale 1s ease-in-out infinite;
}

@keyframes count-scale {
    0% { transform: scale(0.6); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* Active Dance Screen HUD */
.dance-header {
    position: absolute;
    top: 2rem;
    left: 0;
    right: 0;
    z-index: 4;
}

/* Timeline progress bar styling */
.timeline-container {
    position: absolute;
    bottom: 3.5rem;
    left: 8%;
    right: 8%;
    height: 28px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    border: 1px solid var(--md-sys-color-outline);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding: 0 20px !important;
}

.timeline-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
}

#timeline-progress {
    position: absolute;
    height: 100%;
    width: 0%;
    background-color: var(--md-sys-color-primary);
    border-radius: 3px;
}

.timeline-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #90a4ae;
    border: 2px solid white;
    border-radius: 50%;
    top: -4px;
    transform: translateX(-50%);
    z-index: 5;
    transition: all 0.2s ease;
}

.timeline-dot.passed {
    background: var(--md-sys-color-primary);
}

.timeline-dot.captured {
    background: #0f9d58 !important; /* Material Green */
    transform: translateX(-50%) scale(1.3);
    box-shadow: 0 0 8px rgba(15, 157, 88, 0.6);
}

.timeline-dot .dot-label {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    gap: 2px;
}

.timeline-dot.passed .dot-label {
    color: var(--md-sys-color-primary);
}

.pose-guide {
    position: absolute;
    bottom: 7.5rem;
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* Result / Complete Screen Thumbnails */
.qr-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.thumb-wrapper {
    aspect-ratio: 4 / 3;
    background-color: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
}
