:root {
    --bg-color: #2c3e50;
    --text-color: #ecf0f1;
    --accent-color: #e74c3c;
    --ui-bg: rgba(0, 0, 0, 0.7);
    --font-family: 'Courier New', Courier, monospace;
}

body.light-mode {
    --bg-color: #ecf0f1;
    --text-color: #2c3e50;
    --ui-bg: rgba(255, 255, 255, 0.7);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

#game-container {
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 4px solid var(--text-color);
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    display: block;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-sizing: border-box;
}

.hud {
    display: flex;
    justify-content: space-between;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 0px #000;
}

.menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--ui-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    backdrop-filter: blur(5px);
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 4px 4px 0px var(--accent-color);
    text-transform: uppercase;
    text-align: center;
}

button {
    background: var(--accent-color);
    border: none;
    padding: 15px 30px;
    color: white;
    font-family: var(--font-family);
    font-size: 24px;
    cursor: pointer;
    margin: 10px;
    border-radius: 4px;
    transition: transform 0.1s;
    text-transform: uppercase;
    box-shadow: 0 4px 0 #c0392b;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #c0392b;
}

.settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px;
    font-size: 20px;
    background: #7f8c8d;
    box-shadow: 0 4px 0 #566573;
}
.settings-btn:active {
    box-shadow: 0 0 0 #566573;
}

#error-message {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(231, 76, 60, 0.9);
    padding: 10px 20px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    display: none;
}

/* Touch controls (visible on mobile only ideally, but we show for completeness) */
.touch-controls {
    display: none; /* Enabled via JS if touch detected */
    position: absolute;
    bottom: 20px;
    width: 100%;
    justify-content: space-between;
    padding: 0 40px;
    pointer-events: auto;
}

@media (hover: none) and (pointer: coarse) {
    .touch-controls {
        display: flex;
    }
    .touch-btn {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        border: 2px solid white;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 32px;
        color: white;
        user-select: none;
    }
}
