body {
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
    overflow: hidden;

    background-image: url('background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.game-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.sidebar {
    width: 200px;
    border: 2px solid #666;
    padding: 10px;
    background-color: #f0f0f0;
    flex-shrink: 0; /* Prevents sidebar from shrinking */
}

.game-container {
    aspect-ratio: 18 / 13;
    position: relative;
    overflow: hidden;
    border: 2px solid #333;
    padding: 10px;
    box-sizing: border-box;
    background-color: white;
    margin: 0 auto; /* Centers the grid */
    flex: 1;
}

.bottom-display {
    border: 2px solid #666;
    padding: 10px;
    background-color: #f0f0f0;
    flex-grow: 1; /* Takes up remaining vertical space */
    min-height: 150px;
}

.grid {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    gap: 1px;
    background-color: white;
    width: 100%;
    height: 100%;
}

.cell {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: white;
    border: 1px solid #999;
}

.player1 {
    background-color: red;
    border-radius: 50%;
}

.player2 {
    background-color: blue;
    border-radius: 50%;
}

.object {
    background-color: green;
}

.wall {
    background-color: #333;
}

.bottom-display {
    /* Existing styles */
    display: flex;
    justify-content: center;
    align-items: center;
}

.life-display {
    display: flex;
    gap: 50px;
}

.life {
    background-color: white;
    padding: 20px 40px;
    border-radius: 10px;
    border: 2px solid #666;
    text-align: center;
    min-width: 150px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.life .value {
    font-size: 1.9em;
    font-weight: bold;
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.player1-life .value {
    color: red;
}

.player2-life .value {
    color: blue;
}

.bullet {
    background-color: yellow;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    margin: 20px;
}

.hit {
    animation: hitFlash 0.2s;
}

@keyframes hitFlash {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background-color: orange; }
    100% { transform: scale(1); }
}

#gameOverOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#gameOverOverlay.hidden {
    display: none;
}

.game-over-content {
    background-color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#restartButton {
    padding: 15px 30px;
    font-size: 1.2em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
}

#restartButton:hover {
    background-color: #45a049;
}

.bullet-count {
    position: absolute;
    top: 12px;
    left: 15px;
    font-size: 1.5em;
    color: black;
    font-weight: bold;
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .game-layout {
        gap: 10px;
    }
    
    .sidebar {
        width: 100%;
        padding: 5px;
        box-sizing: border-box;
    }
    
    .life .value {
        font-size: 1.2em;
        gap: 8px;
    }
}

@media (max-height: 600px) {
    .bottom-display {
        min-height: 100px;
    }
    
    .life {
        padding: 10px;
    }
}

.game-container {
    min-width: 300px;
    min-height: 200px;
}

html {
    touch-action: manipulation;
    overscroll-behavior: none;
}
