* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
    width: 100vw;
    /* height: 100vh; <-- This was causing issues, so it's removed. */
    background-color: #000;
    font-family: 'Bangers', cursive;
    overflow: hidden; /* Prevents scrollbars */
}

/* UPDATED: The container's height will now be set by JavaScript */
#game-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* This is the key for positioning controls */
}

#canvas1 {
  border: 5px solid black;
  background: #4d79bc;
  /* Make canvas responsive */
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 2 / 1; /* Keep the 1000x500 aspect ratio */
}

#layer1, #layer2, #layer3, #layer4, #player, #angler1, #angler2, #lucky, #projectile, #gears, #hiveWhale, #drone, #smokeExplosion, #fireExplosion { 
  display: none;
}

/* --- STYLES FOR MOBILE CONTROLS --- */
/* This logic is now correct because #game-container is full screen */
#controls {
    display: none; /* Hidden on desktop */
    position: absolute; /* Positioned relative to #game-container */
    bottom: 15px; /* Adjusted position */
    left: 0;
    width: 100%;
    justify-content: space-between;
    align-items: flex-end; /* Align buttons to the bottom edge */
    padding: 0 25px;
    pointer-events: none; /* Let clicks pass through the container itself */
}

/* This rule stacks the up/down buttons vertically */
#d-pad {
    display: flex;
    flex-direction: column;
    pointer-events: auto; /* Make the buttons clickable */
}

#action-button {
    pointer-events: auto; /* Make the shoot button clickable */
}

#controls button {
    width: 70px;
    height: 70px;
    font-size: 30px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    border-radius: 50%;
    margin: 5px 0;
    font-family: 'Bangers', cursive;
    text-shadow: 2px 2px 2px #000;
}

#action-button button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 28px;
}

/* Show controls only on touch devices (most mobile phones) */
@media (hover: none) and (pointer: coarse) {
    #controls {
        display: flex;
    }
}
