body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    touch-action: none;
    /* Prevenir scroll y zoom en móviles */
    user-select: none;
    /* Prevenir selección de texto */
}

canvas {
    display: block;
}

/* Mensaje para rotar pantalla en móviles verticales */
#rotate-message {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    z-index: 1000;
    text-align: center;
}

/* Ocultar mensaje si es landscape o desktop */
@media (orientation: landscape) {
    #rotate-message {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    #rotate-message {
        display: none !important;
    }
}

/* Mostrar solo en portrait móvil */
@media (orientation: portrait) and (max-width: 1024px) {
    #rotate-message {
        display: flex !important;
    }
}

/* Controles en pantalla */
#controls {
    display: none;
    /* Oculto por defecto en desktop */
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
}

/* Mostrar controles en dispositivos táctiles/móviles */
@media (hover: none) and (pointer: coarse) {
    #controls {
        display: block;
    }
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.dpad button {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    touch-action: manipulation;
    /* Importante para respuesta rápida */
    user-select: none;
    -webkit-user-select: none;
}

.dpad button:active {
    background: rgba(255, 255, 255, 0.5);
}

.dpad .horizontal {
    display: flex;
    gap: 60px;
    /* Espacio para el dedo central */
}

/* Botón de Pausa */
#btn-pause {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    touch-action: manipulation;
}


/* Pantalla de Carga */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    font-family: Arial, sans-serif;
}

/* Menú Principal */
#main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('image/portada.png');
    background-size: 100% 100%;
    background-position: center;
    z-index: 250;
    display: none;
    /* Oculto hasta que cargue */
    flex-direction: column;
    justify-content: center;
    /* Centrado vertical */
    align-items: center;
    /* Centrado horizontal inicial */
}

#btn-play {
    padding: 15px 40px;
    font-size: 32px;
    background: linear-gradient(to bottom, #4CAF50, #2E7D32);
    color: white;
    border: 3px solid #fff;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    font-weight: bold;
    animation: pulse 1.5s infinite;
    margin-left: 20%;
    /* Un poco a la derecha */
}

#btn-play:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}