.game {
    --color-principal: #009251;
    --color-secundario: #FFD83B;
    display: flex;
    flex-direction: column;
    justify-content: center;
    justify-items: center;
    margin-bottom: 30px;
    font-family: 'Roboto Condensed', sans-serif;
}

.game #startScreen {

    background-color: var(--color-principal);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 15px;
    padding: 20px;
    align-self: center;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

#startScreen h4 {
    font-size: 1.2rem;
    margin-top: 10px;
    margin-bottom: 0;
    color: var(--color-secundario);
    text-align: center;
}

#startScreen h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--color-secundario);
}

#gameScreen {
    display: none;
    justify-items: center;
}

#startScreen p {
    font-size: 1.1rem;
    line-height: 1.4;
    margin: 10px 0;
    color: #fff;
    text-align: center;
    margin: 5px;
}

@media (max-width: 992px) {
    #startScreen h2 {
        font-size: 1.8rem;
    }

    #startScreen p {
        font-size: 1.1rem;
    }

}

#startScreen .highlight {
    color: var(--color-secundario);
    font-weight: bold;
}

.keys {
    font-weight: bold;
    color: #fff;
    text-align: center;
}

#startButton {
    background: var(--color-secundario);
    color: var(--color-principal);
    border: none;
    padding: 10px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    margin: 1rem 0 0;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.6);
    position: relative;
    z-index: 9999;
    pointer-events: auto;
    /* Asegúrate de que el botón pueda recibir eventos */
    touch-action: manipulation;
}

#startButton:hover {
    background: var(--color-secundario);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 204, 0, 0.9);
}



#gameInfo {
    display: flex;
    justify-content: space-evenly;
    width: 100%;
    padding: 0 10px;
}


#endScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    border-radius: 15px;
    padding: 20px;
}

#endScreen h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
}

#finalScore {
    font-size: 2rem;
    margin: 20px 0;
    color: #ffcc00;
}

#resultMessage {
    font-size: 2.2rem;
    margin-bottom: 30px;
    text-align: center;
    padding: 0 20px;
}

#restartButton {
    background: linear-gradient(to bottom, #4CAF50, #2E7D32);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
}

#restartButton:hover {
    background: linear-gradient(to bottom, #66BB6A, #388E3C);
    transform: scale(1.05);
}



.instructions {
    margin-top: 30px;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    max-width: 600px;
    text-align: left;
}

.instructions h3 {
    color: #ffcc00;
    margin-bottom: 10px;
}

.instructions ul {
    padding-left: 25px;
}

.instructions li {
    margin: 8px 0;
    line-height: 1.5;
}

.key__button {
    box-sizing: border-box;
    font-size: 20px;
    text-align: center;
    width: 40px;
    height: 50px;
    color: var(--color-principal);
    cursor: pointer;
    margin: 0 8px;
    border-color: #f2f2f2;
    border-style: solid;
    text-shadow: 0 0.5px 1px #777, 0 2px 6px #f2f2f2;
    border-width: 1px;
    border-radius: 10px;
    background: -webkit-linear-gradient(top, #f7fab8 0%, #fee43e 80%, #faca3b 100%);
    display: inline-block;
    transition: box-shadow 0.3s ease, transform 0.15s ease;
    box-shadow: 0 0 1px #888, 0 1px 0 #fff, 0 6px 0 #C0C0C0, 0 8px 17px rgba(#444, 0.4), 2px 1px 4px rgba(#444, 0.25), -2px 1px 4px rgba(#444, 0.25), 0 9px 16px rgba(#444, 0.1);

    &:hover,
    &:focus {
        box-shadow: 0 0 1px #888, 0 1px 0 #fff, 0 4px 0 #C0C0C0, 0 2px 35px rgba(#444, 0.3), 2px 2px 4px rgba(#444, 0.25), -2px 2px 4px rgba(#444, 0.25), 0 7px 4px rgba(#444, 0.1);
        transform: translateY(2px);
    }

    &:active {
        box-shadow: 0 0 1px #888, 0 1px 0 #fff, 0 0 0 #C0C0C0, 0 0px 30px rgba(#444, 0.15), 2px 2px 4px rgba(#444, 0.25), -2px 2px 4px rgba(#444, 0.25), 0 0px 4px rgba(#444, 0.25);
        transform: translateY(4px);
    }
}

.spacebar {
    width: 50px;
    border-radius: 50%;
    background: -webkit-linear-gradient(top, #7fa440 0%, #4b8f58 80%, #55a72b 100%);
    border: 3px solid #fadc6b;
}

.keys-left,
.keys-right {
    display: flex;
}

.keys-pad {
    display: flex;
    width: 95%;
    justify-content: space-around;
    align-items: center;
    margin-top: 20px;
    flex-direction: row;
}

.no-zoom {
    touch-action: manipulation;
}

@media (min-width: 992px) {
    .keys-pad {
        display: none;
    }
}



.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00f7ff, 0 0 20px #00b3ff;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    color: #a0d2eb;
    max-width: 600px;
    line-height: 1.6;
}



/* Media query para pantallas móviles (hasta 850px de ancho) */



.stats {
    display: flex;
    justify-content: space-between;
    width: 800px;
    background: rgba(10, 10, 40, 1);
    padding: 15px 25px;
    border-radius: 10px;
    border: 1px solid #009251;
    margin-bottom: 4px;
    margin: 0 auto;
}

.stat-box {
    text-align: center;
    color: white;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffcc00;
}

.controls {
    display: flex;
    justify-content: space-between;
    width: 800px;
    margin-top: 10px;
}

.control-group {
    background: rgba(20, 20, 60, 0.7);
    border-radius: 10px;
    padding: 20px;
    width: 48%;
    border: 1px solid #009251;
}

.control-group h3 {
    color: #ffcc00;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.4rem;
}



.instructions {
    background: rgba(20, 20, 60, 0.7);
    border-radius: 10px;
    padding: 20px;
    width: 800px;
    margin-top: 10px;
    border: 1px solid #009251;
}

.instructions h3 {
    color: #ffcc00;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.4rem;
}

.instructions ul {
    padding-left: 20px;
    line-height: 1.8;
}

.instructions li {
    margin-bottom: 8px;
}

.highlight {
    color: #ffcc00;
    font-weight: bold;
}

@media (max-width: 850px) {

    .game-container,
    .stats,
    .controls,
    .instructions {
        width: 95%;
        max-width: 800px;
        height: auto;
    }


}

.canvas-wrapper {
    width: 100%;
    height: auto;
    margin: 0 auto;
    aspect-ratio: 4/3;
}

@media (max-width: 850px) {
    .canvas-wrapper {
        aspect-ratio: 4/3;
        /* Ajustar la altura del canvas a 600px en dispositivos móviles */
    }
}

.canvas-wrapper .vb-canvas {
    width: 100%;
    height: 100%;
}

.rediEncabezado {
    text-align: left !important;
}


 .game-container {
            position: relative;
            width: 95%;
            height: auto;
            background: url('../img/tileGrass1.png') repeat center center;
            aspect-ratio: 4/3;           
            overflow: hidden;
            max-width: 800px;
            margin: 16px auto 16px auto;
        }     
       
        
        .player {
            position: absolute;
            width: 42px;
            height: 42px;
            background:transparent;
            transition: none;
            z-index: 10;
        }
        .player.facing-right, .enemy.facing-right{
            transform: rotate(-90deg);
        }
        .player.facing-down, .enemy.facing-down{
            transform: rotate(0deg);
        }
        .player.facing-left, .enemy.facing-left{
            transform: rotate(90deg);
        }
        .player.facing-up, .enemy.facing-up{
            transform: rotate(180deg);
        }
        .enemy {
            position: absolute;
            width: 42px;
            height: 42px;
            background-image: url('../img/tank_bigRed.png');
            background-size: contain;            
            z-index: 9;
            
        }
        
        .bomb {
            position: absolute;
            width: 20px;
            height: 20px;
            background: #fd3b29;
            border: 2px solid #ffa57a;
            border-radius: 50%;
            z-index: 8;
            animation: bombPulse 1s infinite;
            box-shadow: 0 0 10px rgb(255 213 213);
        }
        
        @keyframes bombPulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.3); }
        }
        
        .obstacle {
            position: absolute;
            z-index: 7;
        }
        
        .wall {
            background: url(../img/metal.png) #666666;
            background-size: cover;
            
            
        }
        
        .rock {
            background:url(../img/wood.png) #8B4513;
            border: 2px solid #654321;
            background-size: cover;
            
        }
        
        .mobile-controls {
            display: none;
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 100;
        }
        
        .control-pad {
            display: grid;
            grid-template-columns: 50px 50px 50px;
            grid-template-rows: 50px 50px 50px;
            gap: 10px;
            background: rgba(0,0,0,0.8);
            padding: 15px;
            border: 2px solid #00ff00;
            border-radius: 10px;
        }
        
        .control-btn {
            width: 50px;
            height: 50px;
            background: rgba(0,255,0,0.3);
            border: 2px solid #00ff00;
            color: #00ff00;
            font-size: 20px;
            font-weight: bold;
            border-radius: 5px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
        }
        
        .control-btn:active {
            background: rgba(0,255,0,0.6);
            transform: scale(0.95);
        }
        
        .control-btn.empty {
            background: transparent;
            border: none;
        }
        
        .game-over, .game-win {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0,0,0,0.9);
            color: #00ff00;
            padding: 30px;
            border: 3px solid #00ff00;
            text-align: center;
            font-size: 24px;
            z-index: 1000;
            display: none;
        }
        
        .game-win {
            color: #ffff00;
            border-color: #ffff00;
        }
        
        .restart-btn {
            background: #00ff00;
            color: #000;
            border: none;
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            margin-top: 15px;
            border-radius: 5px;
        }
        
        @media (max-width: 768px) {
            .keys-pad {
                display: flex;
            }
            
            .ui {
                font-size: 14px;
                padding: 8px;
            }
        }
        
        @media (max-width: 480px) {
            .ui {
                font-size: 12px;
                padding: 6px;
            }
            
            .control-pad {
                gap: 8px;
                padding: 12px;
            }
            
            .control-btn {
                width: 45px;
                height: 45px;
                font-size: 18px;
            }
        }