* {
    box-sizing: border-box;
    /* Prevent text selection to improve mobile touch experience */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    background-color: #2f3640;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100vh;
    height: 100dvh; /* For mobile dynamic viewport */
    margin: 0;
    padding: 10px;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden; /* Prevent scrolling when using D-Pad */
}

.game-wrapper {
    background-color: #87973c; /* Nokia green */
    width: 100%;
    max-width: 600px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.8);
    border: 5px solid #111;
    border-radius: 10px;
    overflow: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    color: #111;
    font-size: 12px;
    border-bottom: 3px solid #111;
    background-color: rgba(0, 0, 0, 0.05);
}

canvas {
    background-color: transparent;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Keeps aspect ratio while filling space */
    image-rendering: pixelated;
}

.game-over-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #111;
    width: 100%;
    cursor: pointer;
}

.game-over-screen p {
    font-size: 12px;
    line-height: 1.8;
    margin: 10px 0;
    background-color: rgba(135, 151, 60, 0.95);
    padding: 15px;
    border-top: 2px solid #111;
    border-bottom: 2px solid #111;
}

/* D-Pad controls for mobile */
.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 300px;
}

.dpad-middle {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin: 10px 0;
}

.dpad-btn {
    background-color: #bdc3c7;
    border: 4px solid #111;
    border-radius: 15px;
    width: 70px;
    height: 70px;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 4px #7f8c8d;
    transition: background-color 0.1s, box-shadow 0.1s, color 0.1s;
}

.dpad-btn:active {
    background-color: #3498db; /* Blink biru terang */
    box-shadow: 0 0 #2980b9;
    transform: translateY(4px);
    color: white;
}

/* Hide dpad on very tall desktop screens if needed, but it's fine to leave it for clicking */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    .game-wrapper {
        height: 70vh;
        flex: none;
    }
}
