body {
  background: #1e1e1e;
  color: #dedede;
  font-family: Helvetica, sans-serif;
  text-transform: uppercase;
  font-size: 14px;
  overflow-x: hidden;
  position: absolute;
  width: 100%;
}

* {
  transition: 0.1s;
}

#cassette {
  width: 400px;
  height: 200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2px solid #dedede;
  padding: 20px;
  border-radius: 5px;
  /* Quick hack to give more vertical space */
  transform: scale(0.7);
  margin-bottom: -30px;
  margin-top: -10px;
}

.reel {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 175px;
  height: 175px;
  border: 2px solid #dedede;
  border-radius: 50%;
}

.recording #cassette,
.recording .reel,
.recording .reel-inner {
  border-color: #d82323;
}

.recording .reel-inner i {
  background-color: #d82323;
}

.reel-inner {
  width: 50px;
  height: 50px;
  border: 2px solid #dedede;
  border-radius: 50%;
  background: #1e1e1e;
  position: relative;
  animation: spin 5s infinite;
  animation-timing-function: linear;
  animation-play-state: paused;
  --rotation: 0;
  transform: rotate(calc(var(--rotation) * 1deg));
}

.reel-tape {
  width: 100%;
  height: 100%;
  position: absolute;
  background: #353535;
  border-radius: 50%;
  transform: scale(0.3);
}

#cassette.spin .reel-inner {
  animation: spin2 0.5s;
}

#cassette.spin-back .reel-inner {
  animation: spin-back 0.5s;
}

body:not(.playing) .reel-inner {
  animation-play-state: paused;
}

body.playing .reel-inner {
  animation-play-state: running;
}

@keyframes spin {
  100% {
    transform: rotate(calc(var(--rotation) * 1deg - 360deg));
  }
}

@keyframes spin2 {
  100% {
    transform: rotate(calc(var(--rotation) * 1deg - 180deg));
  }
}

@keyframes spin-back {
  100% {
    transform: rotate(calc(var(--rotation) * 1deg + 180deg));
  }
}

.reel-inner i {
  width: 2px;
  height: 10px;
  background: #dedede;
  display: inline-block;
  position: absolute;
}

.reel-inner i:nth-child(1) {
  left: 24px;
  top: 0;
}

.reel-inner i:nth-child(2) {
  transform: rotate(56deg);
  top: 10px;
  right: 6px;
}

.reel-inner i:nth-child(3) {
  transform: rotate(116deg);
  bottom: 10px;
  right: 6px;
}

.reel-inner i:nth-child(4) {
  left: 24px;
  bottom: 0;
}

.reel-inner i:nth-child(5) {
  transform: rotate(56deg);
  bottom: 10px;
  left: 6px;
}

.reel-inner i:nth-child(6) {
  transform: rotate(116deg);
  top: 10px;
  left: 6px;
}

#timeline {
  background: linear-gradient(90deg, #dedede 1%, transparent 1%) 1px 0, #1e1e1e;
  background-size: 100px 1px;
  margin-top: 20px;
  margin-left: 50%;
  position: relative;
}

#status {
  display: flex;
}

#status > * {
  margin-right: 15px;
}

.timeline-segment {
  height: 10px;
  background: #dedede;
  position: absolute;
  min-width: 1px;
  top: calc(50% - 5px);
}

.timeline-pitchbend {
  position: absolute;
  width: 1px;
  height: 5px;
  background: #dedede;
  top: -2px;
}

.timeline-controlchange {
  position: absolute;
  width: 1px;
  height: 5px;
  background: #dedede;
  top: -2px;
}

.current-track .timeline-segment {
  background: #42af42;
}

.current-track .timeline-controlchange {
  background: cyan;
}

.current-track .timeline-pitchbend {
  background: #8617ff;
}

.recording .current-track .timeline-segment,
.recording .current-track .timeline-pitchbend,
.recording .current-track .timeline-controlchange {
  background: #d82323;
}

.recording .reel-tape {
  background: #462a2a;
}

#timeline-center {
  margin-left: calc(50% - 5px);
  width: 10px;
  height: 10px;
  margin-top: 10px;
  border: solid #42af42;
  border-width: 0 3px 3px 0;
  display: inline-block;
  transform: rotate(45deg);
}

.recording #timeline-center {
  border-color: #d82323;
}

.track {
  background: linear-gradient(
    to bottom,
    transparent calc(50% - 1px),
    #dedede calc(50% - 1px) calc(50% + 1px),
    transparent calc(50% + 1px)
  );
  height: 20px;
  margin: 20px 0;
  position: relative;
  margin-left: 1px;
}

.track:not(.current-track) {
  opacity: 0.3;
}

#buttons {
  margin: 30px 0;
  display: flex;
}

button {
  background: transparent;
  border: 1px solid #dedede;
  border-radius: 2px;
  text-transform: uppercase;
  color: #dedede;
  padding: 5px 10px;
  margin-right: 5px;
  font-size: 12px;
}

button:not(:disabled):hover,
button:not(:disabled):focus {
  background: #dedede;
  color: #1e1e1e;
}

button:disabled {
  opacity: 0.5;
}

#config {
  margin-top: 20px;
}

#config > div {
  margin-bottom: 10px;
}

.timeline-marker {
  position: absolute;
  height: 100%;
  width: 5px;
  display: none;
}

#timeline-start-marker {
  background: #42a5af;
}

#timeline-end-marker {
  background: #afa742;
}

#timeline-marker-bg {
  left: 0px;
  width: 200px;
  top: 10px;
  position: absolute;
  height: calc(100% - 20px);
  background: #dedede;
  opacity: 0.1;
}

#help {
  margin-left: auto;
}

#help a {
  color: #dedede;
}

#tape-name {
  background: none;
  border: none;
  border-bottom: 1px solid #dedede;
  margin-right: 5px;
  color: #dedede;
  width: 100px;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

#counter {
  text-align: center;
  font-size: 14px;
  font-family: monospace;
  margin-left: 2px;
}

#counter::before {
  content: attr(data-count);
}
