/* src/static/css/tokens.css */
.c_token_container {
    display: inline-flex;
    /* Чтобы контейнер облегал слово */
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    /* Центрируем, если слово одно */
    line-height: 1.4;
    cursor: default;
}

.c_token {
    position: relative;
    font-size: 16px;
    /* Делаем слово крупным, так как это вопрос */
    color: #ffffff;
    padding: 2px 2px;
    /* Отступы внутри для фона */
    border-radius: 6px;
    /* Скругление фона при нажатии */
    transition: all 0.2s;
}

.question_with_audio .c_token_container .c_token {
    font-size: 28px;
    /* Делаем слово крупным, так как это вопрос */
}


.c_token.is_interactive {
    cursor: pointer;

    /* Убираем фон и рамки (стиль чипов) */
    background: transparent;
    border: none;


    /* Делаем линию очень деликатной */
    text-decoration-style: solid;
    /* Или dotted, если нравится пунктир */
    text-decoration-color: rgba(255, 255, 255, 0.3);
    /* Тусклый белый */
    text-decoration-thickness: 1px;
    /* Очень тонкая линия */
    text-underline-offset: 4px;
    /* Отодвигаем от букв вниз */

    border-radius: 4px;
    /* Нужно для ховера */
    transition: all 0.2s;
}

/* При наведении (Hover) */
.c_token.is_interactive:hover,
.c_token.is_interactive:active,
.c_token.is_interactive:focus {
    /* Линия становится яркой */
    text-decoration-color: rgba(255, 255, 255, 1);

    /* Добавляем легкий фон ТОЛЬКО при наведении */
    background: var(--c-bg-card);
    /* Чуть расширяем зону, чтобы было красиво */
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
    text-decoration: none;
    color: var(--c-accent-green);
    z-index: 1000;
}

/* --- TOOLTIP --- */

.c_token.is_interactive::after {
    content: attr(data-trans);
    position: absolute;

    /* Позиционирование сверху (над словом), как в Duolingo */
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);

    /* Стиль плашки */
    background: #ffffff;
    /* Белый фон */
    color: #111111;
    /* Черный текст */
    border: none;

    padding: 6px 14px;
    border-radius: 12px;
    /* Сильное скругление */
    font-size: 16px;
    font-weight: 800;
    /* Очень жирный текст */
    text-transform: capitalize;
    /* Первая буква заглавная */
    white-space: nowrap;

    /* Тень обязательна, чтобы оторвать от фона */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);

    /* Анимация */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 100;

    /* Поднимаем повыше от слова */
    margin-bottom: 12px;
}

.c_token.is_interactive::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    /* Синхронизируем начальную позицию с баблом для плавной анимации */
    transform: translateX(-50%) translateY(-10px);

    /* Рисуем треугольник через границы */
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
    /* Принудительно чистый белый */

    /* Убираем любые фоны, которые могли наследоваться */
    background: none !important;

    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);

    /* Ставим z-index выше бабла, чтобы они сливались идеально */
    z-index: 101;

    /* 
       При margin-bottom: 5px и высоте треугольника 8px, 
       верхушка треугольника зайдет на 1 пиксель внутрь бабла (который на 12px).
       Это уберет возможную "щель" между ними.
    */
    margin-bottom: 5px;
}

/* Показ тултипа */
.c_token.is_interactive:hover::after,
.c_token.is_interactive:active::after,
.c_token.is_interactive:focus::after,
.c_token.is_interactive:hover::before,
.c_token.is_interactive:active::before,
.c_token.is_interactive:focus::before {
    opacity: 1;
    visibility: visible;
    /* При появлении немного сдвигаем вниз на место */
    transform: translateX(-50%) translateY(0);
}

.question_with_audio .c_token.is_interactive {
    color: #fff;
    text-decoration: underline dashed rgba(96, 165, 250, 0.5);
    text-underline-offset: 4px;
    cursor: pointer;
    font-size: 26px;
    font-weight: 800;
}

.question_with_audio .c_token.is_interactive:active {
    text-decoration-color: #60a5fa;
}
