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

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

canvas { display: block; }

/* In-Game UI */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#score-board {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 0 #000;
}

#instruction-panel {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 30px;
    border-radius: 20px;
    border: 2px solid #4CAF50;
}

#lesson-name { font-size: 14px; text-transform: uppercase; color: #aaa; }
#instruction-text { font-size: 24px; font-weight: bold; color: #4CAF50; }
#minimap-hint { position: absolute; bottom: 20px; right: 20px; color: rgba(255,255,255,0.4); }

/* Menu Overlay */
#menu-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-box {
    background: #222;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #3498db;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.4);
    min-width: 300px;
}

.menu-box h1 { color: white; margin-bottom: 20px; }
.menu-box label { display: block; color: #aaa; margin-bottom: 10px; text-align: left; }
.menu-box select {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    font-size: 16px;
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 5px;
}

#btn-start {
    width: 100%;
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    color: white;
    background: #3498db;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

#btn-start:hover { background: #2980b9; }

#nickname-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 16px;
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 5px;
    text-align: center;
}

/* Mobile Touch Controls */
#touch-layer {
    display: none; /* Hidden by default on desktop */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Above canvas (0), below UI (10) and Menu (20) */
    pointer-events: none; /* Let clicks pass through generally */
}

.touch-zone {
    position: absolute;
    bottom: 0;
    height: 50%; /* Occupy bottom half of screen */
    width: 50%;
    pointer-events: auto; /* Capture touches here */
    /* background: rgba(255, 0, 0, 0.2);  <-- Uncomment to debug (see the red zones) */
    -webkit-tap-highlight-color: transparent; /* No blue flash on tap */
}

#touch-left {
    left: 0;
}

#touch-right {
    right: 0;
}

/* Only show touch layer if we detect mobile class */
body.is-mobile #touch-layer {
    display: block;
}