:root {
  --fsb-border: 1px solid #ccc;
  --fsb-radius: 5px;
  --fsb-color: inherit;
  --fsb-background: #fff;
  --fsb-font-size: 1em;
  --fsb-shadow: 0 1px 1px rgba(0, 0, 0, .1);
  --fsb-padding: 8px;
  --fsb-padding-right: var(--fsb-padding);
  --fsb-arrow-size: 8px;
  --fsb-arrow-padding: var(--fsb-padding);
  --fsb-arrow-color: currentColor;
  --fsb-icon-color: currentColor;
  --fsb-list-height: auto;
  --fsb-list-border: var(--fsb-border);
  --fsb-list-radius: 3px;
  --fsb-list-color: var(--fsb-color);
  --fsb-list-background: var(--fsb-background);
  --fsb-hover-color: var(--fsb-color);
  --fsb-hover-background: #ddd;
}

.fsb-original-select {
  display: inline-block;
  margin: 0;
  padding: 8px 22px 8px 8px;
  padding: var(--fsb-padding);
  padding-right: calc(var(--fsb-arrow-padding) * 2 + var(--fsb-arrow-size));
  font-family: inherit;
  line-height: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

select::-ms-expand {
  display: none;
}

.fsb-original-select[disabled] {
  color: rgba(0, 0, 0, .3);
  cursor: not-allowed;
}

.fsb-select {
  display: inline-block;
  position: relative;
}

select[disabled] + .fsb-select {
  cursor: not-allowed;
}

.fsb-select,
.fsb-original-select {
  border: 1px solid #ccc;
  border: var(--fsb-border);
  border-radius: 5px;
  border-radius: var(--fsb-radius);
  box-sizing: border-box;
  color: inherit;
  color: var(--fsb-color);
  background-color: #fff;
  background-color: var(--fsb-background);
  font-size: 1em;
  font-size: var(--fsb-font-size);
  box-shadow: none;
  box-shadow: var(--fsb-shadow);
}

.fsb-select svg {
  width: 1em;
  height: 1em;
  margin-right: 8px;
  margin-right: var(--fsb-padding-right);
  fill: currentColor;
  fill: var(--fsb-icon-color);
  pointer-events: none;
}

.fsb-label {
  display: none;
}

/* While it's common sense to avoid using !important as much as possible, it is used
 * here to prevent inheriting style from other rules that may target buttons. */
.fsb-button {
  display: flex !important;
  align-items: center;
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  padding: 8px 22px 8px 8px !important;
  padding: var(--fsb-padding) !important;
  padding-right: var(--fsb-arrow-size) !important;
  border: 0 ;
  border-radius: inherit;
  color: inherit;
  background-color: inherit;
  font-size: 1em;
  font-family: inherit;
  text-align: inherit;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.fsb-button > span,
.fsb-option > span {
  pointer-events: none;
}

select[disabled] + .fsb-select .fsb-button {
  opacity: .4;
  pointer-events: none;
}

.fsb-button:after,
select[disabled] + .fsb-select .fsb-button[aria-expanded="true"]:after {
  content: '';
  display: block;
  position: absolute;
  width: 6px;
  width: var(--fsb-arrow-size);
  height: 6px;
  height: var(--fsb-arrow-size);
  right: 15px;
  top: 50%;
  transform: translateY(-65%) rotateZ(45deg);
  border: solid currentColor;
  border: solid var(--fsb-arrow-color);
  border-width: 0 2px 2px 0;
  box-sizing: border-box;
  transition: transform .3s ease-in-out;
  pointer-events: none;
}

.fsb-button[aria-expanded="true"]:after {
  transform: translateY(-35%) rotateZ(225deg);
}

.fsb-list,
select[disabled] + .fsb-select .fsb-list {
  display: block;
  visibility: hidden;
  position: absolute;
  min-width: 100%;
  height: 0;
  margin: 0;
  left: 0;
  top: 100%;
  z-index: 1000;
  padding: 0;
  border: inherit;
  border: var(--fsb-list-border);
  border-radius: inherit;
  border-radius: var(--fsb-list-radius);
  box-sizing: border-box;
  color: inherit;
  color: var(--fsb-list-color);
  background-color: inherit;
  background-color: var(--fsb-list-background);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  opacity: 0;
  transition: opacity .2s ease-in-out;
  overflow: auto;
}

.fsb-top .fsb-list {
  top: auto;
  bottom: 100%;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .2);
}

.fsb-button[aria-expanded="true"] + .fsb-list {
  height: var(--fsb-list-height);
  visibility: visible;
  opacity: 1;
}

.fsb-option {
  display: flex;
  align-items: center;
  padding: var(--fsb-padding);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.fsb-option:focus {
  outline: none;
  color: var(--fsb-hover-color);
  background-color: var(--fsb-hover-background);
}

.fsb-resize {
  display: block;
  height: 0;
  padding-right: 14px;
  padding-right: calc(var(--fsb-arrow-padding) * 2 + var(--fsb-arrow-size) - var(--fsb-padding-right));
  box-sizing: border-box;
}

.fsb-resize > * {
  display: block;
}