@import url(https://fonts.googleapis.com/css?family=Roboto:100,400,700);
@-webkit-keyframes pop_char {
  from {
    bottom: -.5em;
    opacity: 0;
    -webkit-transform: scale(0.8);
            transform: scale(0.8);
  }
}
@keyframes pop_char {
  from {
    bottom: -.5em;
    opacity: 0;
    -webkit-transform: scale(0.8);
            transform: scale(0.8);
  }
}
@-webkit-keyframes hide_char {
  to {
    -webkit-transform: scale(0.5);
            transform: scale(0.5);
  }
}
@keyframes hide_char {
  to {
    -webkit-transform: scale(0.5);
            transform: scale(0.5);
  }
}
@-webkit-keyframes hided_char {
  from {
    -webkit-transform: scale(0.5);
            transform: scale(0.5);
  }
}
@keyframes hided_char {
  from {
    -webkit-transform: scale(0.5);
            transform: scale(0.5);
  }
}
@-webkit-keyframes blink_cursor {
  from {
    opacity: 0;
  }
}
@keyframes blink_cursor {
  from {
    opacity: 0;
  }
}
.motion_field {
  display: inline-block;
  position: relative;
  font-family: 'Roboto';
  font-size: 2.2em;
  min-width: 6em;
  min-height: 2.2em;
  padding: .4em .6em;
  text-align: center;
  cursor: text;
}
.motion_field:before {
  content: '';
  display: block;
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: .2em;
  border: .08em solid #C5CAE9;
  border-top-width: 0;
}
.motion_field:after {
  content: '';
  display: inline-block;
  position: relative;
  width: .08em;
  height: 1em;
  top: .2em;
}
.motion_field:focus {
  outline: none;
}
.motion_field:focus:before {
  border-color: #3F51B5;
}
.motion_field:focus:after {
  background-color: #3F51B5;
  -webkit-animation: blink_cursor .5s alternate infinite;
          animation: blink_cursor .5s alternate infinite;
}
.motion_field input {
  display: none;
}
.motion_field label {
  display: block;
  font-size: .4em;
  font-weight: 400;
  text-align: left;
  color: #3F51B5;
  padding-bottom: 1em;
}
.motion_field b {
  position: relative;
  display: inline-block;
  font-weight: 700;
  bottom: 0;
  width: 1em;
  text-align: center;
  -webkit-transition: all .4s;
  transition: all .4s;
}
.motion_field b.new_char {
  -webkit-animation: pop_char .4s;
          animation: pop_char .4s;
}
.motion_field b.hide_char {
  -webkit-animation: hide_char .4s;
          animation: hide_char .4s;
}
.motion_field b.hided_char {
  -webkit-animation: hided_char .4s;
          animation: hided_char .4s;
}
.motion_field b.remove_char {
  width: 0;
}

/*---DEMO---*/
.motion_field {
  display: block;
  max-width: 9em;
  margin: 2em auto;
}

h1 {
  text-align: center;
  font-family: 'Roboto';
  font-weight: 100;
  font-size: 3em;
  margin: 150px 0 1em;
}

.small {
  font-size: .8em;
  font-weight: 400;
  margin-top: 9em;
  color: gray;
}
.small a {
  color: gray;
  text-decoration: none;
}
body { background-color: #fafafa; }
