.tree ul {
  position: relative;
  padding: 0.5em 0;
  white-space: nowrap;
  margin: 0 auto;
  text-align: center;
}
.tree ul::after {
  content: '';
  display: table;
  clear: both;
}

.tree li {
  display: inline-block;
  vertical-align: top;
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 0.5em .5em 0 .5em;
}
.tree li::before, .tree li::after {
  content: '';
  position: absolute;
  top: 0;
  right: 50%;
  border-top: 1px solid #ccc;
  width: 50%;
  height: 0.5em;
}
.tree li::after {
  right: auto;
  left: 50%;
  border-left: 1px solid #ccc;
}
.tree li:only-child::after, .tree li:only-child::before {
  display: none;
}
.tree li:only-child {
  padding-top: 0;
}
.tree li:first-child::before, .tree li:last-child::after {
  border: 0 none;
}
.tree li:last-child::before {
  border-right: 1px solid #ccc;
  border-radius: 0 3px 0 0;
}
.tree li:first-child::after {
  border-radius: 3px 0 0 0;
}

.tree ul ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 1px solid #ccc;
  width: 0;
  height: 0.5em;
}

.tree li a {
  border: 1px solid #ccc;
  padding: .5em .55em;
  text-decoration: none;
  display: inline-block;
  border-radius: 5px;
  background-color:white;
  color: #333;
  position: relative;
  top: 1px;
  cursor: default;
}

.tree li a:hover,
.tree li a:hover + ul li a {
  background: #a844b5;
  color: #fff;
  border: 1px solid #a844b5;
}

.tree li a:hover + ul li::after,
.tree li a:hover + ul li::before,
.tree li a:hover + ul::before,
.tree li a:hover + ul ul::before {
  border-color: #a844b5;
}