html, body {
  height: 100%;
}

body {
  background: #ddd;
  color: #222;
}

button {
  padding: 0.5rem 0;
  width: calc(80% - 1rem);
  max-width: 200px;
  -webkit-transform: translateX(0.5rem);
          transform: translateX(0.5rem);
  border: none;
  text-align: center;
  background: #fb0;
  font-size: 1.2rem;
  color: white;
  display: block;
  margin: 1rem auto;
  border-radius: 4px;
  -webkit-animation: pulse 200ms ease-in-out infinite alternate;
          animation: pulse 200ms ease-in-out infinite alternate;
  border: 4px solid #f5b400;
  box-shadow: 0px 0px 0px 4px rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.125em;
}
button .pause {
  display: none;
}
button.active {
  -webkit-animation: none;
          animation: none;
  background: #222;
  border-color: #000;
}
button.active .pause {
  display: block;
}
button.active .play {
  display: none;
}

@-webkit-keyframes pulse {
  from {
    -webkit-transform: translateX(0.5rem) scale(1);
            transform: translateX(0.5rem) scale(1);
  }
  to {
    -webkit-transform: translateX(0.5rem) scale(1.1);
            transform: translateX(0.5rem) scale(1.1);
  }
}

@keyframes pulse {
  from {
    -webkit-transform: translateX(0.5rem) scale(1);
            transform: translateX(0.5rem) scale(1);
  }
  to {
    -webkit-transform: translateX(0.5rem) scale(1.1);
            transform: translateX(0.5rem) scale(1.1);
  }
}
.keyboard {
  position: fixed;
  top: 0;
  margin: 0;
  left: 50%;
  z-index: 2;
  width: calc(100% - 2rem);
  max-width: calc(1400px - 1rem);
  border-bottom: 4px solid #ddd;
  -webkit-transform: translateX(-50%);
          transform: translateX(-50%);
}
.keyboard div {
  background: #fff;
  height: 40px;
  -webkit-box-flex: 3;
      -ms-flex: 3;
          flex: 3;
  margin: 1px;
}
.keyboard div[class*="is"] {
  -webkit-box-flex: 2;
      -ms-flex: 2;
          flex: 2;
  background: #222;
}
.keyboard div.active-b, .keyboard div.active-t {
  background: #FB0;
}
.keyboard div.active-b[class*="is"], .keyboard div.active-t[class*="is"] {
  background: #997000;
}

article {
  max-width: 1400px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  padding-top: calc(40px + 3rem);
  padding-bottom: 5rem;
  width: calc(100% - 1rem);
  margin: 0 auto;
}

main, aside {
  width: 100%;
}

aside,
main {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
}

aside section {
  width: 100%;
}

@media (min-width: 800px) {
  article {
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
        -ms-flex-direction: row;
            flex-direction: row;
  }

  main {
    width: calc(80% - 1rem);
    -webkit-box-ordinal-group: 2;
        -ms-flex-order: 1;
            order: 1;
  }

  aside {
    display: block;
    -webkit-box-ordinal-group: 3;
        -ms-flex-order: 2;
            order: 2;
    width: 20%;
    margin-right: 1rem;
  }
  aside .output {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
  }
  aside .output h1, aside .output h2 {
    -ms-flex-preferred-size: auto;
        flex-basis: auto;
  }
}
section {
  width: 100%;
  margin: 0.5rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  box-sizing: border-box;
  background: #f0f0f0;
  padding: 1rem;
}
section h1, section h2 {
  margin-top: 0;
  -ms-flex-preferred-size: 100%;
      flex-basis: 100%;
  margin-left: 1px;
  margin-right: 1px;
  line-height: 1;
  text-align: left;
}
section h1 {
  font-size: 1.2em;
}
section h2 {
  font-size: 1em;
}
section > span {
  -webkit-box-flex: 1;
      -ms-flex: 1;
          flex: 1;
  box-sizing: border-box;
  text-align: center;
  padding: 0.5em;
  margin: 1px;
  border: 1px solid #ccc;
  color: #444;
  font-size: 0.6em;
  text-transform: uppercase;
  letter-spacing: 0.125em;
  padding-top: 0.75em;
}
section > span sup {
  font-size: 0.6em;
  margin-left: -2px;
}
section:not(.keyboard) {
  margin: 0.5rem;
  border-radius: 4px;
  box-shadow: 0px 2px 0px 2px #d9d9d9;
}
section:not(.keyboard) div {
  box-sizing: border-box;
  cursor: pointer;
  text-align: center;
  padding: 0.5em;
  margin: 1px;
  background: white;
  font-size: 0.6em;
  text-transform: uppercase;
  letter-spacing: 0.125em;
  -webkit-box-flex: 1;
      -ms-flex: 1 0 auto;
          flex: 1 0 auto;
}
section:not(.keyboard) div:hover {
  background: #ccc;
}
section:not(.keyboard) div[class$="-current"] {
  background: #FB0;
  pointer-events: none;
}
section.chord > div {
  background: transparent;
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  font-size: 1em;
}
section.chord > div + div {
  margin-left: 0.5em;
}
section.chord > div:hover {
  background: transparent;
}
section.chord > div.active {
  box-shadow: 0px 0px 0px 1px #fb0;
}
section.chord > div div {
  -webkit-box-flex: 1;
      -ms-flex: 1;
          flex: 1;
  background: white;
}
section.keys div {
  -ms-flex-preferred-size: calc(16.66667% - 2px);
      flex-basis: calc(16.66667% - 2px);
}
section.keys div sup {
  pointer-events: none;
  font-size: 0.6em;
}
section.patterns {
  -ms-flex-line-pack: center;
      align-content: center;
}
@media (min-width: 800px) {
  section.chord {
    -ms-flex-preferred-size: calc(100% - 1rem);
        flex-basis: calc(100% - 1rem);
  }
  section.keys, section.modes, section.steps, section.type {
    -ms-flex-preferred-size: calc(50% - 1rem);
        flex-basis: calc(50% - 1rem);
  }
}
section.chord > div > div, section.bpm > div, section.keys > div, section.modes > div, section.steps > div, section.type > div {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  text-align: center;
}
section.midi-out label {
  padding: 0.5rem 0;
  display: block;
  width: 100%;
}
section.midi-out input {
  margin-right: 0.25rem;
}
section.midi-transpose label {
  padding: 0.5rem;
  display: inline-block;
  width: 10%;
}
section.midi-transpose input {
  margin-right: 0.25rem;
}

svg {
  width: 100%;
  height: auto;
  pointer-events: none;
}
svg polyline {
  fill: none;
  stroke: black;
  stroke-linecap: round;
  stroke-linejoin: round;
}
