:root{--bg:#0f0f14;--text:#f2f3f5;--muted:#aab0bd;--border:#262838;--accent:#6c8cff}
*{box-sizing:border-box}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wrap {
    width: 100%;
    max-width: 1000px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 auto;
    flex: 1;
}

.hud {
    display: flex;
    justify-content: flex-start;
    z-index: 20;
}

.back {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(12, 13, 18, 0.8);
    color: var(--text);
    text-decoration: none;
    backdrop-filter: blur(4px);
    font-size: 14px;
}
.back:hover {
    border-color: #3a3e58;
}

.container {
    position: relative;
    width: 100%;
    /* Aspect ratio 4:3 for camera usually, but 16:9 is more cinematic. Let's use auto or specific ratio */
    aspect-ratio: 4/3; 
    background: #10121a;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin: 0 auto;
    max-width: 800px; /* Limit max width so it doesn't get too huge */
}

/* Video Layer: Mirrored */
#camera-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: 0;
    transform: translate(-50%, -50%) scaleX(-1);
    object-fit: cover;
}

/* Game Canvas */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.score-board {
    padding: 20px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    font-size: 24px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

.loading-badge {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #4cd137;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    display: none;
}

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

.btn {
    background: linear-gradient(135deg, #00d2d3, #2e86de);
    border: none;
    padding: 15px 40px;
    color: white;
    font-size: 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.1s;
    margin-top: 20px;
    font-weight: bold;
}

.btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

.btn:active {
    transform: scale(0.95);
}

h1 {
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00d2d3;
    font-size: 32px;
    text-align: center;
}

p {
    color: #eee;
    text-align: center;
    max-width: 80%;
    line-height: 1.6;
}

.instruction-icon {
    font-size: 40px;
    margin: 10px;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

#camera-error {
    color: #ff6b6b;
    display: none;
    background: rgba(0,0,0,0.8);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-top: 20px;
}

#loading {
    display: none; /* Hide global loading as we use start screen loading */
}

/* Footer */
.site-footer {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    margin-top: auto;
}
