body {
    background-color: #111;
    color: #eee;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    touch-action: manipulation;
}

/* NEW: Wrapper to center content and controls correctly */
#page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 10px;
    box-sizing: border-box;
}

h1 {
    text-shadow: 0 0 10px #0ff;
    text-align: center;
}

#game-container {
    position: relative;
    border: 3px solid #0ff;
    box-shadow: 0 0 20px #0ff;
    width: 100%;
    max-width: 600px; /* Game scales down, but doesn't get too big */
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    background-color: #02021a;
}

#ui-container {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 24px;
}

/* Styles for overlays */
.hidden {
    display: none !important;
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 200; /* Ensure overlays are on top of UI text */
}

h2 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 0 0 15px #f0f;
}

p {
    font-size: 18px;
    margin: 10px;
}

button {
    padding: 15px 30px;
    font-size: 20px;
    cursor: pointer;
    background-color: #f0f;
    border: none;
    color: white;
    box-shadow: 0 0 15px #f0f;
    border-radius: 5px;
    margin-top: 20px;
}

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

/* --- CORRECTED: Styles for Touch Controls --- */
#touch-controls {
    width: 100%;
    max-width: 600px; /* Match the game container width */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 10px; /* Add some space above and to the sides */
    box-sizing: border-box;
}

.left-controls, .right-controls {
    display: flex;
    gap: 20px;
}

.control-button {
    width: 70px;
    height: 70px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 32px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    user-select: none;
}

.control-button.attack {
    background-color: rgba(255, 0, 255, 0.3);
    border-color: rgba(255, 0, 255, 0.8);
    font-size: 24px;
}

.control-button:active {
    background-color: rgba(255, 255, 255, 0.5);
}

/* This code hides the controls on devices with a mouse/trackpad */
@media (hover: hover) and (pointer: fine) {
  #touch-controls {
    display: none;
  }
}