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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 50%, #8B4513 100%);
    min-height: 100vh;
    overflow: hidden;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2d1810 0%, #4a2c1f 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader {
    text-align: center;
    color: #fff;
}

.loader h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    color: #f4a460;
}

.loader p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #ddd;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Game Container */
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#webcam {
    display: none; /* Hidden, used for processing */
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.player-label {
    position: absolute;
    top: 10px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.player1-label {
    left: 20px;
    background: rgba(255, 105, 180, 0.8);
}

.player2-label {
    right: 20px;
    background: rgba(65, 105, 225, 0.8);
}

.center-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom,
        rgba(255,255,255,0.8) 0%,
        rgba(255,255,255,0.3) 50%,
        rgba(255,255,255,0.8) 100%);
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

#instructions {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
}

#restart-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 100;
    pointer-events: auto;
}

#restart-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#restart-btn:active {
    transform: translateX(-50%) scale(0.98);
}

/* Error Screen */
#error-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.error-content {
    text-align: center;
    color: white;
    padding: 40px;
    background: #4a2c1f;
    border-radius: 20px;
    max-width: 400px;
}

.error-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #ff6b6b;
}

.error-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #ddd;
}

.error-content button {
    padding: 15px 40px;
    font-size: 1.1rem;
    background: #f4a460;
    color: #2d1810;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, background 0.2s;
}

.error-content button:hover {
    background: #ffc07f;
    transform: scale(1.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .player-label {
        font-size: 0.9rem;
        padding: 8px 12px;
    }

    #instructions {
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .loader h1 {
        font-size: 2rem;
    }
}
