:root {
    --bg-color: #333;
    --game-bg: #000;
    --text-color: #eee;
    --accent-color: #f44336;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    flex: 1;
}

.game-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    touch-action: none;
}

canvas {
    background-color: var(--game-bg);
    border: 4px solid #999;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    max-width: 100%;
    max-height: 70vh;
    image-rendering: pixelated; /* Retro look */
}

.hud {
    width: 100%;
    max-width: 512px; /* Match standard canvas width */
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 10px;
    box-sizing: border-box;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

.btn {
    background: #555;
    color: #fff;
    border: 2px solid #777;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
}

.btn:active {
    background: #777;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    text-align: center;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 48px;
    color: var(--accent-color);
    text-shadow: 4px 4px 0 #8b0000;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

/* Mobile Controls */
.controls {
    display: none; /* Hidden on desktop by default, shown via media query */
    width: 100%;
    max-width: 500px;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-top: 10px;
}

@media (hover: none) and (pointer: coarse) {
    .controls {
        display: flex;
    }
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 5px;
}

.dpad-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    user-select: none;
    color: white;
}

.dpad-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.action-btn {
    width: 80px;
    height: 80px;
    background: rgba(244, 67, 54, 0.3);
    border: 2px solid rgba(244, 67, 54, 0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    user-select: none;
    color: white;
}

.action-btn:active {
    background: rgba(244, 67, 54, 0.6);
}

.site-footer {
    margin-top: auto;
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: #aaa;
    text-align: center;
    padding: 10px;
    font-size: 12px;
}
