.tooltip {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--text-color);
    color: var(--primary-background);
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    user-select: none;
}

.tooltip::before {
    content: '?';
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    /* Align the tooltip's right edge with its trigger so a tooltip placed at
       the end of a line never spills past the form or viewport on the right. */
    right: 0;
    transform: translateY(10px);
    background-color: var(--header-background);
    color: var(--text-color);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-soft);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: none;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
