body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
}

/* Animated gradient background */
#animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    background: linear-gradient(45deg, 
        #667eea 0%, 
        #764ba2 25%, 
        #f093fb 50%, 
        #4facfe 75%, 
        #667eea 100%);
    background-size: 400% 400%;
    animation: gradientFlow 15s ease infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.6;
    animation: float 20s ease-in-out infinite;
}

.blob:nth-child(1) {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 0, 255, 0.8), transparent);
    top: 10%;
    left: 10%;
}

.blob:nth-child(2) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.6), transparent);
    top: 60%;
    right: 10%;
    animation-delay: -5s;
}

.blob:nth-child(3) {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255, 255, 0, 0.5), transparent);
    bottom: 10%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -50px) scale(1.1); }
    50% { transform: translate(-30px, 30px) scale(0.9); }
    75% { transform: translate(40px, 20px) scale(1.05); }
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Header */
#game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

#game-title {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ffff00, #ff00ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 3s ease infinite;
    margin: 0;
}

@keyframes gradientText {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#header-links {
    display: flex;
    gap: 15px;
}

.header-link {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.header-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Camera container */
#camera-container {
    position: relative;
    width: 85vw;
    max-width: 1400px;
    height: 75vh;
    min-height: 500px;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
    background: rgba(0, 0, 0, 0.3);
}

#video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 1;
}

#hand-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Game area overlay */
#game-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

/* Score board */
#score-board {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    padding: 15px 30px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.score-item {
    text-align: center;
}

.score-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 5px;
}

.score-value {
    color: #00ffff;
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 0 20px #00ffff;
}

/* Gesture display */
#gesture-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 30px;
}

.gesture-box {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 25px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    min-width: 200px;
}

.gesture-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.gesture-icon {
    font-size: 5rem;
    margin: 20px 0;
    animation: pulse 2s ease-in-out infinite;
}

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

@keyframes lockPulse {
    0% { 
        transform: scale(1);
        border-color: rgba(255, 255, 255, 0.3);
    }
    50% { 
        transform: scale(1.15);
        border-color: #00ff00;
        box-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
    }
    100% { 
        transform: scale(1);
        border-color: rgba(255, 255, 255, 0.3);
    }
}

.gesture-name {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Hold progress bar */
.hold-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin-top: 15px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hold-progress.active {
    opacity: 1;
}

.hold-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ffff, #ff00ff, #ffff00);
    background-size: 200% 100%;
    animation: gradientSlide 2s linear infinite;
    border-radius: 10px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

@keyframes gradientSlide {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.hold-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hold-text.active {
    opacity: 1;
    animation: pulse 1s ease-in-out infinite;
}

.vs-text {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

/* Result message */
#result-message {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    padding: 20px 40px;
    border-radius: 20px;
    border: 3px solid;
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#result-message.show {
    opacity: 1;
}

#result-message.win {
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
}

#result-message.lose {
    border-color: #ff0000;
    color: #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

#result-message.draw {
    border-color: #ffff00;
    color: #ffff00;
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.5);
}

/* Countdown overlay */
#countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#countdown-overlay.active {
    display: flex;
}

#countdown-number {
    font-size: 10rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 50px rgba(255, 255, 255, 0.8);
    animation: countdownPulse 1s ease-in-out;
}

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

/* Instructions */
#instructions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    padding: 20px 30px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

#instructions h3 {
    color: white;
    margin: 0 0 15px 0;
    font-size: 1.2rem;
}

.instruction-grid {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.instruction-item {
    text-align: center;
}

.instruction-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.instruction-item p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 0.9rem;
}

/* Start screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    backdrop-filter: blur(20px);
    z-index: 4;
    color: #fff;
    padding: 20px;
}

.title-container {
    text-align: center;
    margin-bottom: 40px;
}

#start-screen h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin: 0 0 15px 0;
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ffff00, #ff00ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 3s ease infinite;
}

.subtitle {
    font-size: 1.5rem;
    margin: 0;
}

.instructions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.instructions-list .instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.instructions-list .icon {
    font-size: 2rem;
}

.instructions-list p {
    margin: 0;
    font-size: 1.1rem;
}

#start-button {
    padding: 18px 50px;
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(255, 0, 255, 0.4);
}

#start-button:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 40px rgba(255, 0, 255, 0.6);
}

/* Loading screen */
#loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 5;
    color: #fff;
}

.loading-content {
    text-align: center;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading h2 {
    font-size: 2.5rem;
    margin: 0 0 15px 0;
}

#loading p {
    font-size: 1.2rem;
    margin: 0;
}

/* Responsive */
@media screen and (max-width: 768px) {
    #game-header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    #game-title {
        font-size: 1.5rem;
    }
    
    #header-links {
        gap: 10px;
    }
    
    .header-link {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    #camera-container {
        width: 95vw;
        height: 65vh;
    }
    
    #gesture-display {
        flex-direction: column;
        gap: 15px;
    }
    
    .gesture-box {
        min-width: 150px;
        padding: 20px;
    }
    
    .gesture-icon {
        font-size: 3.5rem;
    }
    
    .vs-text {
        font-size: 2rem;
    }
    
    #instructions {
        bottom: 10px;
        padding: 15px 20px;
    }
    
    .instruction-grid {
        gap: 15px;
    }
    
    .instruction-icon {
        font-size: 2rem;
    }
}


/* Win particle animation */
@keyframes winParticle {
    0% {
        transform: translateY(0) scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        transform: translateY(-100px) scale(1.5) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-300px) scale(0.5) rotate(720deg);
        opacity: 0;
    }
}
