:root {
    --primary-color: #00f0ff;
    --secondary-color: #ff0055;
    --bg-color: #0b0b15;
    --text-color: #ffffff;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

canvas#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas if needed, but buttons need pointer-events: auto */
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10;
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
    text-align: center;
}

p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    text-align: center;
    max-width: 600px;
    line-height: 1.5;
}

button {
    padding: 1rem 2rem;
    font-size: 1.5rem;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    pointer-events: auto;
}

button:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 20px var(--primary-color);
}

#player-name {
    padding: 1rem;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    margin-bottom: 1.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    outline: none;
    width: 300px;
    font-family: var(--font-family);
    pointer-events: auto;
}

#player-name::placeholder {
    color: rgba(0, 240, 255, 0.5);
}

#player-name:focus {
    box-shadow: 0 0 15px var(--primary-color);
}

#hud {
    position: absolute;
    top: 20px;
    left: 190px;
    /* Start after the camera (160px + gap) */
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
}

.score-board {
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 5px #000;
    /* Add shadow for readability */
}

.health-bar-container {
    width: 200px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: var(--secondary-color);
    transition: width 0.2s ease;
}

.camera-preview {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 160px;
    height: 120px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    z-index: 5;
    background: #000;
    pointer-events: auto;
}

#input-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#output-canvas {
    display: none;
}

#high-scores {
    margin-bottom: 2rem;
    text-align: center;
}

#face-capture-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

#score-list {
    list-style: none;
    margin-top: 1rem;
}

#score-list li {
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .camera-preview {
        width: 120px;
        height: 90px;
        top: 10px;
        left: 10px;
    }

    #hud {
        top: 10px;
        left: 140px;
        /* Start after mobile camera (120px + gap) */
        right: 10px;
        flex-direction: column;
        /* Stack vertically on mobile */
        align-items: flex-start;
        gap: 5px;
    }

    .health-bar-container {
        width: 100%;
        height: 15px;
        /* Slightly thinner on mobile */
    }

    .score-board {
        font-size: 1.2rem;
    }
}