div.background-switcher {
    position: absolute;
    right: 100%;
    bottom: -1em;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.1s;
    text-align: right;
    display: flex;
    width: calc(var(--buttons-container-width) - 4em);
    flex-wrap: wrap;
    justify-content: flex-end;
    z-index: 1;
}

div.background-switcher-active {
    transform: scaleX(1);
}

div.background-switcher-item {
    background-color: var(--list-bg-color);
    cursor: pointer;
    box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5);
    display: inline-block;
    margin: 0.5em;
    width: 8em;
    border: 1px solid var(--border-color);
    position: relative;
}

div.background-switcher-item:hover {
    border: 1px solid var(--color-active);
}

div.background-switcher-item:hover div.background-switcher-group {
    display: block;
}

div.background-switcher-item-active {
    border: 1px solid var(--color-active);
}

div.background-switcher-item-active div.background-switcher-item-title {
    color: var(--color-active);
}

div.background-switcher-item-thumbnail {
    height: 4em;
}

div.background-switcher-item-thumbnail > img {
    width: 100%;
    height: 100%;
}

div.background-switcher-item-title > span:first-child,
div.background-switcher-group > div {
    font-weight: bold;
    font-size: 80%;
    text-align: center;
    overflow-x: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.25em;
}

div.background-switcher-item-title {
    display: flex;
    align-items: center;
}

div.background-switcher-item-title span:first-child {
    flex: 1 1 auto;
}

div.background-switcher-item-title span.icon {
    flex: 0 0 auto;
}

div.background-switcher-group {
    display: none;
    position: absolute;
    bottom: calc(100% + 1px);
    width: 100%;
    background-color: var(--list-bg-color);
    box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.5);
    clip-path: inset(-8px -8px 0 -8px);
}

div.background-switcher-group-item:hover {
    background-color: var(--list-item-bg-color-hover);
    color: var(--list-item-text-color-hover);
}

div.background-switcher-group-item-active {
    background-color: var(--list-item-bg-color-active);
    color: var(--list-item-text-color-active);
}

div.background-switcher-group-item-active:hover {
    background-color: var(--list-item-bg-color-active-hover);
    color: var(--list-item-text-color-active-hover);
}
