* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Exo+2:wght@300;400;700&display=swap');

body {
    font-family: 'Exo 2', sans-serif;
    background-color: #050A30;
    background-image:
    radial-gradient(circle at 20% 30%, rgba(76, 0, 255, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0, 247, 255, 0.1) 0%, transparent 40%);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    /*overflow: hidden;*/
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
    /*overflow: auto;*/
    padding: 10px;
}

.mobile-controls {
    display: none; /* Hidden by default */
    position: relative;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 100;
    pointer-events: none; /* Pass clicks through the container */
}

.control-button {
    background-color: rgba(200, 200, 200, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    font-size: 32px;
    color: white;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    pointer-events: auto; /* Buttons are clickable */
}
.control-button.fire {
    font-size: 40px;
}

.d-pad {
    display: flex;
    gap: 20px;
}

/* Star background */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 50px 160px, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 90px 40px, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 130px 80px, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 160px 120px, rgba(255, 255, 255, 0.9), rgba(0, 0, 0, 0));
    background-repeat: repeat;
    background-size: 200px 200px;
    opacity: 0.5;
    z-index: -1;
    animation: twinkle 5s infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.5; }
    100% { opacity: 0.8; }
}

.mobile-controls button {
    font-size: 24px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background-color: #00F7FF;
    color: black;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 1;
}

h1 {
    font-family: 'Orbitron', sans-serif;
    color: #00F7FF;
    text-shadow: 0 0 10px rgba(0, 247, 255, 0.7), 0 0 20px rgba(0, 247, 255, 0.4);
    margin-bottom: 0px;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.game-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    font-size: 1.2rem;
    padding: 10px 20px;
    background: rgba(5, 10, 48, 0.7);
    border-radius: 10px;
    border: 1px solid rgba(0, 247, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 247, 255, 0.2);
    backdrop-filter: blur(5px);
}

.score, .lives {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score::before {
    content: '🏆';
    font-size: 1.4rem;
}

.lives::before {
    content: '❤️';
    font-size: 1.4rem;
}

canvas {
  background-color: rgba(0, 0, 0, 0.8);
  border: 2px solid #00F7FF;
  border-radius: 5px;
  box-shadow: 
    0 0 20px rgba(0, 247, 255, 0.5),
    inset 0 0 30px rgba(0, 0, 0, 0.8);

  width: 100%;
  max-width: 800px;       /* never grow past your design size */
  aspect-ratio: 4 / 3;    /* lock 800×600 (4:3) shape */
  height: auto;           /* auto-calculate height from width */

  /* optional: prevent it growing taller than the viewport: */
 // max-height: 90vh;

  display: block;
  margin: 0 auto;

  /* keep touch & pointer events flowing through... */
  touch-action: none;
}

.game-controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    z-index: 100;
    position: relative;
}

.button {
    padding: 15px 30px;
    background: linear-gradient(45deg, #00F7FF, #7B00FF);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: bold;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 247, 255, 0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
    opacity: 0;
}

.button:hover::before {
    opacity: 1;
    animation: shine 1.5s infinite;
}

@keyframes shine {
    0% { left: -50%; }
    100% { left: 150%; }
}

.button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 247, 255, 0.8);
}

.button:active {
    transform: scale(0.98);
}

#startButton::before {
    content: '🚀';
    font-size: 1.5rem;
}

#restartButton::before {
    content: '🔄';
    font-size: 1.5rem;
}

.hidden {
    display: none;
}

/* Mobile responsiveness */
@media (max-width: 690px) {
    canvas {
        width: 100%;
        max-width: 400px;
    }

    .game-info {
        font-size: 1rem;
        padding: 0 10px;
    }

    h1 {
        font-size: 1.5rem;
    }
    
    .game-container img,
    .game-container{
        max-width: 100%;
    }

    .button {
        font-size: 1.1rem;
        padding: 12px 24px;
    }
    
    .mobile-controls {
        display: flex;
        justify-content: center;
        gap: 20px;
        margin-top: 10px;
        align-items: center;
    }
    
}
