* {
    box-sizing: border-box;
    user-select: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #2b2b2b;
    overflow: hidden; /* Prevent scrolling */
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to the game by default */
}

.panel {
    pointer-events: auto; /* Re-enable clicks for UI elements */
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    text-align: center;
}

#login-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
}

#login-container h1 {
    margin-top: 0;
    font-size: 24px;
    color: #333;
}

.divider {
    margin: 20px 0;
    font-size: 12px;
    color: #888;
    position: relative;
}

.divider::before, .divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: #ccc;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}

.color-picker {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

button {
    width: 100%;
    padding: 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover { background-color: #45a049; }

.hidden { display: none !important; }

/* In-Game UI */
#game-ui {
    width: 100%;
    height: 100%;
    position: relative;
    pointer-events: none;
}

#joystick-zone {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    pointer-events: auto; /* Active for joystick */
}

/* Hide joystick on non-touch devices (CSS media query) */
@media (hover: hover) and (pointer: fine) {
    #joystick-zone {
        display: none;
    }
}

#action-buttons {
    position: absolute;
    bottom: 30px;
    right: 30px;
    pointer-events: auto;
}

.game-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    font-weight: bold;
    border: 2px solid #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#mini-map-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    border-radius: 8px;
    pointer-events: auto;
}

#mini-map {
    width: 100%;
    height: 100%;
}
