html, body {
  height: 100%;
}

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

button {
  padding: 0.5rem 0;
  width: calc(80% - 1rem);
  max-width: 200px;
  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 {
    transform: translateX(0.5rem) scale(1);
  }
  to {
    transform: translateX(0.5rem) scale(1.1);
  }
}

@keyframes pulse {
  from {
    transform: translateX(0.5rem) scale(1);
  }
  to {
    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;
  transform: translateX(-50%);
}
.keyboard div {
  background: #fff;
  height: 40px;
  flex: 3;
  margin: 1px;
}
.keyboard div[class*=is] {
  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: flex;
  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: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

aside section {
  width: 100%;
}

@media (min-width: 800px) {
  article {
    flex-direction: row;
  }

  main {
    width: calc(80% - 1rem);
    order: 1;
  }

  aside {
    display: block;
    order: 2;
    width: 20%;
    margin-right: 1rem;
  }
  aside .output {
    flex-direction: column;
  }
  aside .output h1, aside .output h2 {
    flex-basis: auto;
  }
}
section {
  width: 100%;
  margin: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
  background: #f0f0f0;
  padding: 1rem;
}
section h1, section h2 {
  margin-top: 0;
  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 {
  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;
  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: flex;
  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 {
  flex: 1;
  background: white;
  text-transform: none;
}
section.keys div {
  flex-basis: calc(16.66% - 2px);
}
section.keys div sup {
  pointer-events: none;
  font-size: 0.6em;
}
section.patterns {
  align-content: center;
}
section.patterns div {
  max-width: 20%;
  flex-basis: 20%;
  flex-basis: calc(16.66% - 2px);
}
@media (min-width: 800px) {
  section.patterns div {
    max-width: 20%;
  }
  section.patterns.patterns-720 > div {
    flex-basis: calc(10% - 2px);
  }
  section.patterns.patterns-120 > div {
    flex-basis: calc(12% - 2px);
  }
  section.patterns.patterns-24 > div {
    flex-basis: calc(12% - 2px);
  }
  section.patterns.patterns-6 > div {
    flex-basis: calc(10% - 2px);
  }
}
@media (min-width: 800px) {
  section.chord {
    flex-basis: calc(100% - 1rem);
  }
  section.keys, section.modes, section.steps, section.type {
    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: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

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