body {
    background-color: #000;
    color: white;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* Prevent scrolling */
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

h1 {
    display: none;
    /* Hide title to save space */
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

canvas {
    background-color: #5c94fc;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* Maintain aspect ratio */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Touch Controls Overlay */
#controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    height: 0;
    /* Don't block clicks in the middle */
    z-index: 10;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    pointer-events: none;
    /* Let clicks pass through empty space */
}

/* Only show controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    #controls {
        display: flex;
    }
}

#dpad,
#actions {
    pointer-events: auto;
    /* Re-enable clicks on buttons */
}

button {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 28px;
    font-weight: bold;
    margin: 5px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    backdrop-filter: blur(2px);
}

button:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

/* D-Pad Layout (Bottom Right) - Now includes Jump */
#dpad {
    display: grid;
    grid-template-columns: 70px 70px 70px;
    grid-template-rows: 70px 70px;
    gap: 5px;
    align-self: flex-end;
    margin-bottom: 20px;
}

#btn-jump {
    grid-column: 2;
    grid-row: 1;
    background: rgba(50, 255, 50, 0.3);
    border-color: #55ff55;
}

#btn-left {
    grid-column: 1;
    grid-row: 2;
}

#btn-down {
    grid-column: 2;
    grid-row: 2;
}

#btn-right {
    grid-column: 3;
    grid-row: 2;
}

/* Action Buttons Layout (Bottom Left) - Only Attack */
#actions {
    display: flex;
    align-self: flex-end;
    margin-bottom: 20px;
}

#btn-attack {
    background: rgba(255, 50, 50, 0.3);
    border-color: #ff5555;
    width: 90px;
    height: 90px;
    /* Make attack button larger */
    font-size: 32px;
}

/* Volume Slider - Hide on mobile or position top right */
div[style*="text-align: center"] {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 15px;
}