.bubble {
    position: absolute;
    display: block;
    margin: 0;
    padding: 1em;
    font-size: 16px;
    line-height: 1.5;
    list-style: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 0 4px 1px rgba(0, 0, 0, .1);
    background: #fff;
    transform: none;
    transition: visibility 0s .1s, top 0s .1s, left 0s .1s, transform 0s .1s, opacity .1s ease;
    visibility: hidden;
    left: 0;
    top: 0;
    opacity: 0;
}

.bubble--active {
    visibility: visible;
    opacity: 1;
    transition: top .1s ease, left .1s ease, transform .1s ease, opacity .1s ease;
}

.bubble--showing {
    transition: top 0s ease, left 0s ease, transform 0s ease, opacity .1s ease;
}

.bubble--hiding {
    transition: visibility 0s .1s, top 0s .1s, left 0s .1s, transform 0s .1s, opacity .1s ease;
}

.bubble--repositioning {
    position: fixed;
    visibility: visible;
    transition: none;
}

.bubble::after {
    content: "";
    position: absolute;
    display: block;
    width: 4px;
    height: 4px;
    border: 1px solid #ccc;
    border-right: 0;
    border-bottom: 0;
    background: #fff;
}

.bubble[data-bubble-direction^="bottom"] {
    transform: translateY(4px);
}

.bubble[data-bubble-direction^="top"] {
    transform: translateY(-4px);
}

.bubble[data-bubble-direction^="right"] {
    transform: translateX(4px);
}

.bubble[data-bubble-direction^="left"] {
    transform: translateX(-4px);
}

.bubble[data-bubble-direction^="bottom"]::after {
    top: -4px;
    transform: translateX(-50%) rotate(45deg);
}

.bubble[data-bubble-direction^="top"]::after {
    bottom: -4px;
    transform: translateX(-50%) rotate(-135deg);
}

.bubble[data-bubble-direction$="left"]::after {
    left: 12px;
}

.bubble[data-bubble-direction$="right"]::after {
    left: calc(100% - 12px);
}

.bubble[data-bubble-direction$="center"]::after {
    left: 50%;
}

.bubble[data-bubble-direction^="right"]::after {
    left: -4px;
    transform: translateY(-50%) rotate(-45deg);
}

.bubble[data-bubble-direction^="left"]::after {
    right: -4px;
    transform: translateY(-50%) rotate(135deg);
}

.bubble[data-bubble-direction$="top"]::after {
    top: 12px;
}

.bubble[data-bubble-direction$="bottom"]::after {
    top: calc(100% - 12px);
}

.bubble[data-bubble-direction$="middle"]::after {
    top: 50%;
}
