/* ROOT & BODY SETUP */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000; /* Darkened for fullscreen blends */
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- MOBILE MODE LOCK --- */
body.mobile-mode {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    touch-action: none; /* Disables browser gestures */
}

/* --- THE SCREEN (Fixed Internal Resolution to Scale) --- */
#game-container {
    width: 980px;
    height: 400px;
    background-color: #000;
    border: 10px solid #222; 
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
    transform-origin: center center;
    flex-shrink: 0;
}

#game-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Tighter layout during Fullscreen mode */
body.mobile-mode #game-container {
    border: none;
    box-shadow: none;
}

#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

#score-board {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    z-index: 200;
}

.screen {
    background-color: rgba(0, 0, 0, 0.85);
    padding: 30px 50px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,1);
    pointer-events: all;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.screen h1 { margin-top: 0; color: #ffeb3b; text-shadow: 0 0 10px rgba(255, 235, 59, 0.5); }
.screen p { line-height: 1.6; font-size: 18px; }

.screen button {
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: #007bff;
    color: white;
    transition: background-color 0.2s;
    margin-top: 10px;
}
.screen button:hover { background-color: #0069d9; }

#difficulty-selection {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.difficulty-btn {
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    color: white;
    transition: background-color 0.2s, transform 0.1s;
    text-transform: uppercase;
}
.difficulty-btn:hover { transform: scale(1.05); }

.difficulty-btn[data-difficulty="easy"] { background-color: #4CAF50; }
.difficulty-btn[data-difficulty="easy"]:hover { background-color: #45a049; }
.difficulty-btn[data-difficulty="medium"] { background-color: #fca103; }
.difficulty-btn[data-difficulty="medium"]:hover { background-color: #e89202; }
.difficulty-btn[data-difficulty="hard"] { background-color: #f44336; }
.difficulty-btn[data-difficulty="hard"]:hover { background-color: #d32f2f; }

.hidden { display: none !important; }

/* --- TOGGLE BUTTON --- */
#mobile-btn {
    position: fixed;
    top: 15px; 
    left: 15px; /* Changed from right: 15px to left: 15px */
    z-index: 2000;
    background: #333;
    color: white;
    border: 2px solid white;
    font-size: 14px;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
}


body.mobile-mode #mobile-btn { display: none; }

/* --- MOBILE CONTROLS OVERLAY --- */
#mobile-controls {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* Let clicks pass through empty space */
    z-index: 3000;
    display: none; /* Hidden by default */
    justify-content: space-between;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
}

body.mobile-mode #mobile-controls {
    display: flex;
}

/* --- CONTROL BUTTONS --- */
.mobile-control-btn {
    pointer-events: auto; /* Re-enable touches for buttons */
    width: 80px; height: 80px;
    background: rgba(255,255,255,0.15);
    border: 3px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    color: white;
    font-size: 30px;
    display: flex; justify-content: center; align-items: center;
    user-select: none;
    backdrop-filter: blur(4px);
    transition: transform 0.1s, background 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-control-btn:active {
    background: rgba(255,255,255,0.4);
    transform: scale(0.95);
}
