/* 标题徽标统一为图标 + 玻璃底色；不覆盖作者、等级或评价徽标。（v4：新增 Switch 2 移植） */
body .gr-title-badges {
    display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
    min-width: 0; max-width: 100%; line-height: 1.4;
}
body .gr-title-badges .gr-title-badge {
    --badge-ink: #0862bc;
    --badge-rgb: 43, 116, 224;
    display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px;
    min-height: 25px; margin: 0; padding: 3px 8px; border-radius: 7px;
    border: 1px solid rgba(var(--badge-rgb), .24);
    background: linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(var(--badge-rgb), .11));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), 0 3px 8px rgba(var(--badge-rgb), .07);
    color: var(--badge-ink); font-family: inherit; font-size: 11px; font-style: normal;
    font-weight: 650; line-height: 1.2; letter-spacing: .02em; white-space: nowrap;
    text-shadow: none; vertical-align: middle; transform: none;
}
body .gr-title-badge svg { display: block; flex: 0 0 12px; width: 12px; height: 12px; }
body .gr-title-badges .is-new-release { --badge-ink: #08765e; --badge-rgb: 16, 146, 113; }
body .gr-title-badges .is-version-update { --badge-ink: #185fc2; --badge-rgb: 43, 116, 224; }
body .gr-title-badges .is-switch-port { --badge-ink: #b43f52; --badge-rgb: 220, 83, 108; }
body .gr-title-badges .is-switch2-port { --badge-ink: #b91c1c; --badge-rgb: 220, 38, 38; }
body .gr-title-badges .is-sony-port { --badge-ink: #3d53ae; --badge-rgb: 84, 104, 199; }
/* PS2 / PS4 / Switch2 模拟器（2026-11-03） */
body .gr-title-badges .is-ps2-port { --badge-ink: #312e81; --badge-rgb: 79, 70, 229; }
body .gr-title-badges .is-ps4-port { --badge-ink: #1e40af; --badge-rgb: 30, 64, 175; }
body .gr-title-badges .is-switch2-emu { --badge-ink: #9f1239; --badge-rgb: 225, 29, 72; }
body .gr-title-badges .is-new-dlc { --badge-ink: #b45309; --badge-rgb: 217, 119, 6; }

/* 详情页为标题和徽标分行，避免长名称挤压或截断徽标。 */
body.single .uc-title-main .single-title {
    display: flex !important; flex-direction: column; align-items: flex-start; gap: 7px;
    overflow: visible !important; white-space: normal !important; text-overflow: clip !important;
    margin-bottom: 6px !important;
}
body.single .uc-title-main .single-title .resource-title-text {
    display: block; width: 100%; max-width: 100%;
    white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip;
}
body.single .uc-title-bar .gr-title-badges .gr-title-badge {
    min-height: 25px; padding: 4px 9px !important; font-size: 11px !important;
    margin: 0 !important; transform: none; border-radius: 8px;
}
body.single .uc-title-bar .gr-title-badge svg { width: 13px; height: 13px; flex-basis: 13px; }
body.single .uc-title-bar { align-items: center; }

/* 共享列表渲染：名称独占一行，徽标可换行。 */
body .resource-title:has(> .gr-title-badges),
body .game-title:has(> .gr-title-badges),
body .mobile-game-title:has(> .gr-title-badges) {
    display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
}
body .resource-title > .resource-title-text,
body .game-title > .resource-title-text,
body .mobile-game-title > .resource-title-text { max-width: 100%; }

/* 首页卡片与排行榜使用同一徽标组件。 */
body .jidi-card > .gr-title-badges { margin: 0 10px 8px; gap: 5px; }
body .jidi-rank-body > .gr-title-badges { margin-top: 6px; gap: 5px; }
body .jidi-home .gr-title-badges .gr-title-badge {
    min-height: 23px; padding: 3px 6px; border-radius: 7px; font-size: 10px; gap: 4px;
}
body .jidi-home .gr-title-badge svg { width: 12px; height: 12px; flex-basis: 12px; }

html[data-theme="dark"] body .gr-title-badges .gr-title-badge {
    background: linear-gradient(135deg, rgba(var(--badge-rgb), .23), rgba(var(--badge-rgb), .1));
    border-color: rgba(var(--badge-rgb), .45); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 3px 8px rgba(0, 0, 0, .08);
    color: #c3d9ff;
}
html[data-theme="dark"] body .gr-title-badges .is-new-release { color: #8ee4c6; }
html[data-theme="dark"] body .gr-title-badges .is-switch-port { color: #ffb6c1; }
html[data-theme="dark"] body .gr-title-badges .is-switch2-port { color: #fecaca; }
html[data-theme="dark"] body .gr-title-badges .is-sony-port { color: #c5cfff; }
html[data-theme="dark"] body .gr-title-badges .is-ps2-port { color: #c7d2fe; }
html[data-theme="dark"] body .gr-title-badges .is-ps4-port { color: #bfdbfe; }
html[data-theme="dark"] body .gr-title-badges .is-switch2-emu { color: #fecdd3; }
html[data-theme="dark"] body .gr-title-badges .is-new-dlc { color: #fcd34d; }
@media (max-width: 640px) {
    body.single .uc-title-main .single-title { gap: 6px; }
    body.single .uc-title-bar .gr-title-badges .gr-title-badge {
        min-height: 24px; font-size: 11px !important; padding: 3px 8px !important;
    }
    body .jidi-home .gr-title-badges .gr-title-badge { font-size: 10px; padding: 3px 5px; min-height: 22px; }
}
