.formulario {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    background: gray;
    border-radius: 10px;
}

.formulario h1 {
    text-align: center;
    padding: 0 0 20px 0;
    border-bottom: 1px solid silver;
}

.formulario form {
    padding: 0 40px;
    box-sizing: border-box;
}

form .username {
    position: relative;
    border-bottom: 2px solid #adadad;
    margin: 30px 0;
}

.username input {
    width: 100%;
    padding: 0 5px;
    height: 40px;
    font-size: 16px;
    border: none;
    background: none;
    outline: none;
}

.username label {
    position: absolute;
    top: 50%;
    left: 5px;
    color: #adadad;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
    transition: .5s;
}

.username span::before {
    content: '';
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #274372;
    transition: .5s;
}

.username input:focus ~ label,
.username input:valid ~ label {
    top: -5px;
    color: #274372;
    transition: top 0.3s ease, color 0.3s ease;
}

.username input:focus ~ span::before,
.username input:valid ~ span::before {
    width: 100%;
}

.recordar {
    margin: -5px 0 20px 5px;
    color: blue;
    cursor: pointer;
}

.recordar:hover {
    text-decoration: underline;
}

input[type="submit"] {
    width: 100%;
    height: 50px;
    border: 1px solid;
    background: #274372;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    outline: none;
}

input[type="submit"]:hover {
    border-color: #274372;
    transition: .5s;
}

.registrarse {
    margin: 30px 0;
    text-align: center;
    font-size: 16px;
    color: black;
}

.registrarse a {
    color: blue;
    text-decoration: none;
}

.registrarse a:hover {
    text-decoration: underline;
}