body {
    margin: 0;
    padding: 0;
    background-color: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-family: 'Courier New', Courier, monospace;
    color: white;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 600px;
    height: 800px;
    max-width: 100%;
    max-height: 100vh;
    background-color: #000;
    border: 2px solid #444;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

canvas {
    display: block;
    background-color: #111;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas if needed, though we use keyboard */
}

#score-board {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
}

#hp-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 200px;
    height: 20px;
    background-color: #333;
    border: 2px solid #fff;
    border-radius: 10px;
    overflow: hidden;
}

#hp-fill {
    width: 100%;
    height: 100%;
    background-color: #00ff00;
    transition: width 0.2s, background-color 0.2s;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.screen h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ffcc00;
    text-shadow: 4px 4px 0 #000;
}

.screen p {
    font-size: 24px;
    margin-bottom: 10px;
}

button {
    padding: 10px 20px;
    font-size: 20px;
    cursor: pointer;
    background-color: #ffcc00;
    border: none;
    border-radius: 5px;
    color: #000;
    font-weight: bold;
    margin-top: 20px;
}

button:hover {
    background-color: #ffdd44;
}

.difficulty-buttons {
    display: flex;
    gap: 20px;
}

.difficulty-buttons button {
    margin-top: 10px;
    min-width: 100px;
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    pointer-events: none;
    /* Allow clicks to pass through container */
}

.control-btn {
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    /* Re-enable clicks for buttons */
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.control-btn:active {
    background-color: rgba(255, 255, 255, 0.4);
}

@media (min-width: 769px) {
    #mobile-controls {
        display: none;
    }
}