body {
    font-family: 'Press Start 2P', cursive;
    background-color: #0d1117; /* Dark GitHub background */
    color: #c9d1d9; /* Light text */
    overflow: hidden; /* Prevent scrollbars */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Center game vertically */
    height: 100vh; /* MODIFIED: Use full viewport height */
    padding: 0; /* MODIFIED: Remove body padding */
    margin: 0; /* MODIFIED: Remove body margin */
    touch-action: manipulation; /* Prevent accidental zooming on mobile */
}
canvas {
    /* MODIFIED: background-color removed */
    border: 4px solid #30363d; /* Dark border */
    display: block; /* Remove extra space below canvas */
    cursor: none; /* Hide cursor over game area */
    image-rendering: pixelated; /* Crisp pixels */
    width: 100%;
    /* max-width: 600px; */ /* MODIFIED: Allow canvas style to be set by JS */
    height: 100%; /* MODIFIED: Fill container */
    /* aspect-ratio: 3 / 4; */ /* MODIFIED: Removed aspect ratio */
    touch-action: manipulation;
}
.pixel-text {
    text-shadow: 2px 2px #000;
}
 /* Overlay Styling */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 17, 23, 0.85); /* Dark semi-transparent overlay */
    color: #c9d1d9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
     border-radius: 0.5rem; /* Match canvas */
}
.overlay h2 {
     font-size: 1.5rem; /* Larger title */
     margin-bottom: 1rem;
     color: #ec4899; /* Pink */
}
 .overlay p {
     font-size: 0.7rem; /* Smaller instructions */
     margin-bottom: 1.5rem;
     line-height: 1.6;
     max-width: 90%;
 }

.btn:hover:not(:disabled) { /* Added :not(:disabled) */
    background-color: #30363d;
    transform: translate(2px, 2px);
    box-shadow: 2px 2px #000;
}
.btn:active:not(:disabled) { /* Added :not(:disabled) */
    transform: translate(4px, 4px);
    box-shadow: none;
}
.btn:disabled { /* Style for disabled button */
    opacity: 0.5;
    cursor: not-allowed;
    transform: none; /* Ensure no transform when disabled */
    box-shadow: 4px 4px #000; /* Keep shadow when disabled */
}
.hidden {
    display: none;
}

/* --- ADDED: Touch Controls --- */
#touch-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto; /* MODIFIED: Auto height */
    display: none; /* Hidden by default */
    flex-direction: column; /* MODIFIED: Stack vertically */
    justify-content: space-between;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    z-index: 20;
    padding: 0; /* MODIFIED: No padding */
    box-sizing: border-box;
}

/* Show touch controls only on touch devices */
@media (hover: none) and (pointer: coarse) {
    #touch-controls {
        display: flex;
        bottom: 60px; /* MODIFIED: Move up 60px to avoid floating btns */
    }
    /* Add padding to body to avoid overlap */
    body {
        /* Use !important to override inline style if any */
        /* MODIFIED: 120px for controls + 60px for floating btns */
        padding-bottom: 180px !important; 
    }
}

.touch-btn-group {
    display: flex;
    align-items: center; /* Align items vertically */
    gap: 0; /* MODIFIED: No gap */
    width: 100%; /* MODIFIED: Full width */
}

.touch-btn {
    flex: 1; /* MODIFIED: Share space equally */
    height: 60px; /* MODIFIED: Fixed height */
    background-color: rgba(255, 255, 255, 0.2);
    border-top: 2px solid rgba(255, 255, 255, 0.4); /* MODIFIED: Top border */
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0; /* MODIFIED: Rectangular */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem; /* MODIFIED: Smaller font */
    color: white;
    opacity: 0.7;
    cursor: pointer; /* For testing */
}
.touch-btn:first-child { border-left: 0; }
.touch-btn:last-child { border-right: 0; }

.touch-btn:active {
    background-color: rgba(255, 255, 255, 0.4);
    opacity: 1;
}

/* Specific styles for action buttons */
#touch-shoot {
    width: auto; /* MODIFIED: Reset width */
    height: 60px; /* MODIFIED: Fixed height */
    font-size: 1.5rem; /* MODIFIED: Smaller font */
    background-color: rgba(239, 68, 68, 0.2); /* Reddish */
    border-color: rgba(239, 68, 68, 0.4);
    order: 0; /* MODIFIED: Reset order */
}
#touch-deploy-turret, #touch-deploy-shield {
    width: auto; /* MODIFIED: Reset width */
    height: 60px; /* MODIFIED: Fixed height */
    font-size: 1.5rem; /* MODIFIED: Smaller font */
    background-color: rgba(59, 130, 246, 0.2); /* Bluish */
    border-color: rgba(59, 130, 246, 0.4);
    order: 0; /* MODIFIED: Reset order */
}
#touch-deploy-turret {
    background-color: rgba(34, 197, 94, 0.2); /* Greenish */
    border-color: rgba(34, 197, 94, 0.4);
}