Can I replace the maxlength attribute with something in CSS?
Not with CSS, but you can emulate and extend / customize the desired behavior with JavaScript.