/**
 * 表格/工具条内联标签：小圆角、细边、浅底。
 * 对齐 Bootstrap 表单半径；禁 999px 胶囊、禁大色块包一整行。
 *
 * DOM：.csg-tag-wrap > .csg-tag.csg-tag-{tone}
 * 语义 tone：ok / danger / warn / info / muted / default + 奖牌等。
 * 修饰：csg-tag--stack（中英上下）/ --live（执行中）/ --ellipsis / --wrap
 * 哈希配色：csg.hashTagBadgeHtml → 同节点加 .csg-hash-tag-badge，色走 --csg-tag-*
 */

.csg-tag-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.3rem;
    max-width: 100%;
    min-width: 0;
}

.csg-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2em 0.35em;
    box-sizing: border-box;
    padding: 0.05rem 0.32rem;
    border: 1px solid var(--csg-tag-bd, #ced4da);
    border-radius: var(--csg-radius, 0.2rem);
    background: var(--csg-tag-bg, #f8f9fa);
    color: var(--csg-tag-fg, #212529);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    vertical-align: middle;
}

.csg-tag--ellipsis {
    display: inline-block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.csg-tag--wrap {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
}

.csg-tag--stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
    min-width: 4.4rem;
    text-align: center;
    white-space: normal;
}

.csg-tag--stack > .csg-tag-cn {
    font-weight: 600;
    font-size: inherit;
    line-height: 1.2;
    white-space: nowrap;
}

.csg-tag--stack > .en-text {
    display: block !important;
    margin: 0.04rem 0 0;
    font-size: 0.65rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.15;
    opacity: 0.82;
    white-space: nowrap;
}

.csg-tag[data-csg-hover-popover] {
    cursor: help;
}

.csg-tag.bilingual-inline {
    flex-direction: row;
    align-items: baseline;
    gap: 0.25em;
}

.csg-tag.bilingual-inline > .en-text {
    display: inline !important;
    margin: 0;
    font-size: 0.65em;
    font-weight: 400;
    font-style: italic;
    line-height: inherit;
    opacity: 0.78;
}

.csg-tag--live {
    position: relative;
    padding-left: 0.85rem;
}

.csg-tag--live::before {
    content: "";
    position: absolute;
    left: 0.28rem;
    top: 50%;
    width: 0.32rem;
    height: 0.32rem;
    margin-top: -0.16rem;
    border-radius: var(--csg-radius-tight, 0.125rem);
    background: currentColor;
    animation: csg-tag-live-pulse 1.4s ease-in-out infinite;
}

@keyframes csg-tag-live-pulse {
    0%, 100% { opacity: 0.28; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .csg-tag--live::before {
        animation-duration: 3.2s;
    }
}

.csg-tag-gold {
    --csg-tag-fg: #6b5200;
    --csg-tag-bg: #fffbeb;
    --csg-tag-bd: #d4a017;
}
.csg-tag-silver {
    --csg-tag-fg: #3d4a57;
    --csg-tag-bg: #f4f6f8;
    --csg-tag-bd: #9aa8b5;
}
.csg-tag-bronze {
    --csg-tag-fg: #7a3e22;
    --csg-tag-bg: #fbf4ef;
    --csg-tag-bd: #c0845c;
}
.csg-tag-champion {
    --csg-tag-fg: #5d3b00;
    --csg-tag-bg: #fff8e8;
    --csg-tag-bd: #c9a227;
}
.csg-tag-runnerup {
    --csg-tag-fg: #334155;
    --csg-tag-bg: #f1f5f9;
    --csg-tag-bd: #8ba0b4;
}
.csg-tag-third {
    --csg-tag-fg: #7c2d12;
    --csg-tag-bg: #faf4f0;
    --csg-tag-bd: #b7794f;
}
.csg-tag-first-blood {
    --csg-tag-fg: #0c4a6e;
    --csg-tag-bg: #f0f7fc;
    --csg-tag-bd: #7eb6d9;
}
.csg-tag-girl {
    --csg-tag-fg: #9d174d;
    --csg-tag-bg: #fdf2f8;
    --csg-tag-bd: #e8a0bf;
}
.csg-tag-tenacity {
    --csg-tag-fg: #1e3a5f;
    --csg-tag-bg: #f1f5f9;
    --csg-tag-bd: #94a3b8;
}
.csg-tag-default {
    --csg-tag-fg: #1e4b7a;
    --csg-tag-bg: #f4f8fc;
    --csg-tag-bd: #8ab0d4;
}
.csg-tag-ok {
    --csg-tag-fg: var(--csg-ok);
    --csg-tag-bg: var(--csg-ok-bg);
    --csg-tag-bd: var(--csg-ok-bd);
}
.csg-tag-danger {
    --csg-tag-fg: var(--csg-danger);
    --csg-tag-bg: var(--csg-danger-bg);
    --csg-tag-bd: var(--csg-danger-bd);
}
.csg-tag-warn {
    --csg-tag-fg: var(--csg-warn);
    --csg-tag-bg: var(--csg-warn-bg);
    --csg-tag-bd: var(--csg-warn-bd);
}
.csg-tag-info {
    --csg-tag-fg: var(--csg-info);
    --csg-tag-bg: var(--csg-info-bg);
    --csg-tag-bd: var(--csg-info-bd);
}
.csg-tag-muted {
    --csg-tag-fg: var(--csg-muted);
    --csg-tag-bg: var(--csg-muted-bg);
    --csg-tag-bd: var(--csg-muted-bd);
}
