/*
 * Badges: the profile's Badges tab (ProfileBadges and its parts BadgePicture, BadgeTrackRow and BadgeTile, all
 * under .badge-showcase-container), a combined badge's requirement list (CompositeBadgeRequirements), the badge
 * detail dialog (Dialogs/BadgeDetailDialog) and the picture in the admin award dialog (BadgeAwardDialog).
 *
 * Global on purpose: a client component's scoped CSS never loads, and an in-body <style> misses the prerender
 * first paint. Every selector sits under its component's root class so nothing leaks onto the rest of the page,
 * and every animation name starts with "badge-". Colours come from the MudBlazor palette, so dark mode follows.
 * Members read "tracks" and "levels", and class names reach the page, so this file never names the old words.
 */

/* ---------- The Badges tab (ProfileBadges: .badge-showcase-container) ----------
 * Built from the approved mockup (2026-12-01). Its tokens map to the palette: surface and background, text
 * primary (strong and body text) and secondary, lines for borders and empty bars, secondary for fills and the
 * next level's ring, success for the tick, primary with its contrast text for the chosen chip.
 *
 * The layout follows the TAB's width, not the window's (the drawer may or may not be docked), so the root is a
 * container and the breakpoints are container queries. A track row: full size from 1,020px, three tighter columns
 * from 900px (a 1280 window gives about 950px), two rows below that. The summary: three across from 960px, two rows
 * below. The phone layout below 600px. */

.badge-showcase-container {
    display: grid;
    gap: 20px;
    color: var(--mud-palette-text-primary);
    line-height: 1.45;
    container-type: inline-size;
    /* Earned green and the chosen chip, readable at 4.5:1 in light mode (dark mode below). */
    --bt-earned-text: #04795a;
    --bt-chip-on-bg: var(--mud-palette-primary);
    --bt-chip-on-text: var(--mud-palette-primary-text);
}

html.elevate-theme-dark .badge-showcase-container {
    --bt-earned-text: #6ee7b7;
    --bt-chip-on-bg: #2563eb;
    --bt-chip-on-text: #ffffff;
}

.badge-showcase-container .num {
    font-variant-numeric: tabular-nums;
}

/* Visually hidden text for screen readers (the standard clip pattern). */
.badge-showcase-container .bt-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.badge-showcase-container .bt-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(38, 43, 64, .05), 0 6px 20px rgba(38, 43, 64, .06);
    min-width: 0;
}

.badge-showcase-container .bt-eyebrow {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    margin: 0 0 12px;
}

/* Pictures: the art is transparent and carries its own plate. A locked level is faded, the next one dimmed. */
.badge-showcase-container .bt-pic {
    display: block;
    flex: none;
}

.badge-showcase-container .bt-art {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.badge-showcase-container .bt-art-fallback {
    display: grid;
    place-items: center;
}

.badge-showcase-container .bt-art-fallback .mud-icon-root {
    width: 70%;
    height: 70%;
    font-size: inherit;
}

.badge-showcase-container .bt-level.locked .bt-art,
.badge-showcase-container .bt-tile.locked .bt-art {
    filter: grayscale(1);
    opacity: .32;
}

.badge-showcase-container .bt-level.next .bt-art,
.badge-showcase-container .bt-up.next .bt-art {
    filter: grayscale(.7);
    opacity: .86;
}

.badge-showcase-container .bt-bar {
    display: block;
    height: 5px;
    border-radius: 99px;
    background: var(--mud-palette-lines-default);
    overflow: hidden;
}

.badge-showcase-container .bt-bar i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: var(--mud-palette-secondary);
}

/* Summary: the count, the showcase, then up next or recently earned. The count column is as wide as its facts
   need, so "8 of 10 tracks started" never wraps. */
.badge-showcase-container .bt-summary {
    display: grid;
    grid-template-columns: minmax(184px, auto) minmax(0, 1fr) 300px;
    grid-template-areas: "count show side";
}

.badge-showcase-container .bt-summary.bt-summary--two {
    grid-template-columns: minmax(184px, auto) minmax(0, 1fr);
    grid-template-areas: "count show";
}

.badge-showcase-container .bt-summary > section {
    padding: 22px 24px;
    min-width: 0;
}

.badge-showcase-container .bt-summary-count {
    grid-area: count;
}

.badge-showcase-container .bt-summary-showcase {
    grid-area: show;
    border-left: 1px solid var(--mud-palette-lines-default);
}

.badge-showcase-container .bt-summary-side {
    grid-area: side;
    border-left: 1px solid var(--mud-palette-lines-default);
}

.badge-showcase-container .bt-count {
    font-size: 46px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -.02em;
}

.badge-showcase-container .bt-count-label {
    margin: 6px 0 16px;
    font-weight: 600;
}

.badge-showcase-container .bt-facts {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
}

.badge-showcase-container .bt-facts li {
    white-space: nowrap;
}

.badge-showcase-container .bt-facts b {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.badge-showcase-container .bt-empty-line {
    margin: 0;
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
}

.badge-showcase-container .bt-showcase {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    align-items: start;
}

.badge-showcase-container .bt-show-item {
    border: 0;
    background: transparent;
    padding: 8px 4px;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    font: inherit;
    color: inherit;
}

.badge-showcase-container .bt-show-item:hover {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
}

.badge-showcase-container .bt-show-item:focus-visible {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
    outline: 2px solid var(--mud-palette-secondary);
    outline-offset: 2px;
}

/* A picture may shrink in a narrow cell rather than overflow it. */
.badge-showcase-container .bt-show-item .bt-pic {
    width: 72px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto 6px;
}

.badge-showcase-container .bt-show-item strong {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
}

.badge-showcase-container .bt-show-item small {
    display: block;
    font-size: 11.5px;
    color: var(--mud-palette-text-secondary);
    margin-top: 2px;
}

.badge-showcase-container .bt-upnext {
    display: grid;
    gap: 14px;
}

.badge-showcase-container .bt-up {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    border-radius: 8px;
}

.badge-showcase-container .bt-up:focus-visible {
    outline: 2px solid var(--mud-palette-secondary);
    outline-offset: 3px;
}

.badge-showcase-container .bt-up .bt-pic {
    width: 44px;
    height: 44px;
}

.badge-showcase-container .bt-up-body {
    display: block;
    min-width: 0;
}

.badge-showcase-container .bt-up-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.badge-showcase-container .bt-up strong {
    font-size: 13.5px;
    font-weight: 600;
}

.badge-showcase-container .bt-frac {
    font-size: 12px;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.badge-showcase-container .bt-up-line {
    display: block;
    margin: 1px 0 6px;
    font-size: 12.5px;
    color: var(--mud-palette-text-secondary);
}

/* The Tracks card. */
.badge-showcase-container .bt-sec-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px 14px;
    flex-wrap: wrap;
}

.badge-showcase-container .bt-sec-head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.badge-showcase-container .bt-sec-head p {
    margin: 0;
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
    flex: 1;
    min-width: 180px;
}

.badge-showcase-container .bt-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge-showcase-container .bt-chips button {
    border: 1px solid var(--mud-palette-lines-default);
    background: transparent;
    border-radius: 99px;
    padding: 6px 12px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    cursor: pointer;
}

.badge-showcase-container .bt-chips button:focus-visible {
    outline: 2px solid var(--mud-palette-secondary);
    outline-offset: 2px;
}

.badge-showcase-container .bt-chips button[aria-pressed="true"] {
    background: var(--bt-chip-on-bg);
    color: var(--bt-chip-on-text);
    border-color: var(--bt-chip-on-bg);
}

.badge-showcase-container .bt-empty-filter {
    margin: 0;
    padding: 14px 24px 18px;
    border-top: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
    font-size: 13px;
}

/* A track row: title, levels and next step side by side when the tab is wide. */
.badge-showcase-container .bt-track {
    position: relative;
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr) 212px;
    grid-template-areas: "head levels step";
    gap: 22px;
    align-items: center;
    padding: 15px 24px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.badge-showcase-container .bt-track:hover {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 4%, var(--mud-palette-surface));
}

.badge-showcase-container .bt-track-head {
    grid-area: head;
    min-width: 0;
}

.badge-showcase-container .bt-track h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.badge-showcase-container .bt-what {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--mud-palette-text-secondary);
}

.badge-showcase-container .bt-levels {
    grid-area: levels;
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Levels and the lines between them may shrink; a cap keeps a short track from stretching. */
.badge-showcase-container .bt-level {
    position: relative;
    flex: 0 1 60px;
    min-width: 44px;
    height: auto;
    aspect-ratio: 1 / 1;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    font: inherit;
    color: inherit;
}

.badge-showcase-container .bt-level:focus-visible {
    outline: 2px solid var(--mud-palette-secondary);
    outline-offset: 3px;
}

.badge-showcase-container .bt-level.next {
    background: color-mix(in srgb, var(--mud-palette-secondary) 9%, transparent);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--mud-palette-secondary) 42%, transparent);
}

/* The tick sits in the top right corner, off the number printed at the foot of the picture. */
.badge-showcase-container .bt-level.earned::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--mud-palette-surface);
    background: var(--mud-palette-success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3L12.5 5'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* Dark mode: a dark stroke on the light green, so the tick reads. */
html.elevate-theme-dark .badge-showcase-container .bt-level.earned::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2305231a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3L12.5 5'/%3E%3C/svg%3E");
}

.badge-showcase-container .bt-link {
    display: block;
    flex: 1 1 36px;
    min-width: 4px;
    max-width: 48px;
    height: 4px;
    background: var(--mud-palette-lines-default);
    border-radius: 99px;
    margin: 0 3px;
    overflow: hidden;
}

.badge-showcase-container .bt-link i {
    display: block;
    height: 100%;
    background: var(--mud-palette-secondary);
    border-radius: 99px;
}

/* The level tooltip: CSS only. It shows on keyboard focus everywhere and on hover only with a real pointer (a touch
   screen has no tooltip: a tap opens the dialog). Near the row's edges it anchors to that edge. */
.badge-showcase-container .bt-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    width: 228px;
    background: var(--mud-palette-dark);
    color: var(--mud-palette-dark-text);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.4;
    display: none;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

html.elevate-theme-dark .badge-showcase-container .bt-tip {
    background: #2c3454;
}

.badge-showcase-container .bt-level:first-child .bt-tip {
    left: 0;
    right: auto;
    transform: none;
}

.badge-showcase-container .bt-level:last-child .bt-tip {
    left: auto;
    right: 0;
    transform: none;
}

.badge-showcase-container .bt-tip b {
    display: block;
    font-size: 13px;
    margin-bottom: 2px;
}

.badge-showcase-container .bt-tip em {
    display: block;
    font-style: normal;
    margin-top: 6px;
    color: #9fe7d2;
    font-weight: 600;
}

.badge-showcase-container .bt-level:focus-visible .bt-tip {
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    .badge-showcase-container .bt-level:hover .bt-tip {
        display: block;
    }
}

.badge-showcase-container .bt-step {
    grid-area: step;
    min-width: 0;
}

.badge-showcase-container .bt-step strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.badge-showcase-container .bt-step-line {
    display: block;
    font-size: 12.5px;
    color: var(--mud-palette-text-secondary);
    margin: 1px 0 7px;
}

.badge-showcase-container .bt-step-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.badge-showcase-container .bt-step.done strong {
    color: var(--bt-earned-text);
}

.badge-showcase-container .bt-track.idle h3,
.badge-showcase-container .bt-track.idle .bt-step strong {
    font-weight: 500;
}

/* Milestones and staff awards. With a staff award the two cards sit side by side (one tile per row each);
   without one, Milestones takes the full width with its tiles two across. */
.badge-showcase-container .bt-pair {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.badge-showcase-container .bt-solo {
    display: block;
}

.badge-showcase-container .bt-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--mud-palette-lines-default);
}

.badge-showcase-container .bt-tile {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    width: 100%;
    padding: 16px 24px;
    border: 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.badge-showcase-container .bt-tile:hover {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 4%, var(--mud-palette-surface));
}

.badge-showcase-container .bt-tile:focus-visible {
    outline: 2px solid var(--mud-palette-secondary);
    outline-offset: -2px;
}

.badge-showcase-container .bt-tile:nth-child(odd) {
    border-right: 1px solid var(--mud-palette-lines-default);
}

.badge-showcase-container .bt-tile:last-child,
.badge-showcase-container .bt-tile:nth-last-child(2):nth-child(odd) {
    border-bottom: 0;
}

.badge-showcase-container .bt-pair .bt-tiles {
    grid-template-columns: 1fr;
}

.badge-showcase-container .bt-pair .bt-tile {
    border-right: 0;
}

.badge-showcase-container .bt-pair .bt-tile:not(:last-child) {
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.badge-showcase-container .bt-tile .bt-pic {
    width: 64px;
    height: 64px;
}

.badge-showcase-container .bt-tile-body {
    display: block;
    min-width: 0;
}

.badge-showcase-container .bt-tile-title {
    display: block;
    font-size: 14.5px;
    font-weight: 600;
}

.badge-showcase-container .bt-tile-text {
    display: block;
    margin: 2px 0 8px;
    font-size: 12.5px;
    color: var(--mud-palette-text-secondary);
}

.badge-showcase-container .bt-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 99px;
    padding: 3px 9px;
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
    color: var(--mud-palette-text-secondary);
}

.badge-showcase-container .bt-pill.ok {
    background: color-mix(in srgb, var(--mud-palette-success) 14%, transparent);
    color: var(--bt-earned-text);
}

.badge-showcase-container .bt-pill svg {
    width: 12px;
    height: 12px;
}

.badge-showcase-container .bt-needs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* A group the badge needs only one of: "Any one of:" and its pills, kept together. */
.badge-showcase-container .bt-any {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.badge-showcase-container .bt-any-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

/* The loading skeleton, shaped like the tab: a summary block and a few track rows. */
.badge-showcase-container .bt-skeleton {
    display: grid;
    gap: 20px;
}

.badge-showcase-container .bt-skel-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    padding: 22px 24px;
}

.badge-showcase-container .bt-skel-count {
    display: grid;
    gap: 8px;
}

.badge-showcase-container .bt-skel-showcase {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.badge-showcase-container .bt-skel-track {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr) 212px;
    gap: 22px;
    align-items: center;
    padding: 15px 24px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.badge-showcase-container .bt-skel-track:first-child {
    border-top: 0;
}

.badge-showcase-container .bt-skel-levels {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Nothing at all to show. */
.badge-showcase-container .empty-state {
    text-align: center;
    padding: 48px 24px;
}

.badge-showcase-container .empty-state-icon {
    font-size: 64px !important;
    color: var(--mud-palette-text-disabled);
    margin-bottom: 16px;
}

.badge-showcase-container .empty-state-title {
    color: var(--mud-palette-text-secondary);
    margin-bottom: 8px;
}

.badge-showcase-container .empty-state-text {
    color: var(--mud-palette-text-disabled);
    max-width: 400px;
    margin: 0 auto;
}

/* From about 900 to 1,019px of tab (a 1280 window): the track row keeps its three columns, tighter. Five 52px levels
   with 30px lines need 404px; the middle column has 900 - 2 (border) - 48 (padding) - 200 - 196 - 32 (gaps) = 422px. */
@container (max-width: 1019px) {
    .badge-showcase-container .bt-track {
        grid-template-columns: 200px minmax(0, 1fr) 196px;
        gap: 16px;
    }

    .badge-showcase-container .bt-level {
        flex: 0 1 52px;
    }

    .badge-showcase-container .bt-link {
        max-width: 30px;
    }
}

/* Below about 900px of tab: a track row takes two rows (title and next step side by side, the levels across the
   full width under them, back at full size). */
@container (max-width: 899px) {
    .badge-showcase-container .bt-track {
        grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
        grid-template-areas:
            "head step"
            "levels levels";
        gap: 12px 22px;
    }

    .badge-showcase-container .bt-level {
        flex: 0 1 60px;
    }

    .badge-showcase-container .bt-link {
        max-width: 48px;
    }

    .badge-showcase-container .bt-skel-track {
        grid-template-columns: minmax(0, 1fr) 180px;
    }
}

/* Below about 960px of tab the showcase cannot show five pictures at full size beside the other two parts: the
   count and the third part share the first row and the showcase takes the full row under them. */
@container (max-width: 959px) {
    .badge-showcase-container .bt-summary {
        grid-template-columns: minmax(184px, auto) minmax(0, 1fr);
        grid-template-areas:
            "count side"
            "show show";
    }

    .badge-showcase-container .bt-summary-showcase {
        border-left: 0;
        border-top: 1px solid var(--mud-palette-lines-default);
    }
}

/* Phone (the mockup's rules, below 600px of tab): the summary stacks, each track row stacks (title, levels, next
   step), five levels stay on one line by shrinking from 44px to 32px (five fit at 320px, a 238px inner width), the
   tick is 14px, the tooltip anchors to the row, chips are at least 40px tall, and nothing scrolls sideways. */
@container (max-width: 599px) {
    .badge-showcase-container .bt-summary {
        grid-template-columns: 1fr;
        grid-template-areas:
            "count"
            "show"
            "side";
    }

    .badge-showcase-container .bt-summary.bt-summary--two {
        grid-template-columns: 1fr;
        grid-template-areas:
            "count"
            "show";
    }

    .badge-showcase-container .bt-summary-showcase,
    .badge-showcase-container .bt-summary-side {
        border-left: 0;
        border-top: 1px solid var(--mud-palette-lines-default);
    }

    .badge-showcase-container .bt-summary > section {
        padding: 18px 16px;
    }

    .badge-showcase-container .bt-lead {
        display: flex;
        align-items: baseline;
        gap: 10px;
        flex-wrap: wrap;
    }

    .badge-showcase-container .bt-count {
        font-size: 38px;
    }

    .badge-showcase-container .bt-count-label {
        margin: 0 12px 0 0;
    }

    .badge-showcase-container .bt-facts {
        display: flex;
        gap: 4px 14px;
        flex-wrap: wrap;
        flex-basis: 100%;
        margin-top: 8px;
    }

    .badge-showcase-container .bt-showcase {
        gap: 0;
    }

    .badge-showcase-container .bt-show-item {
        padding: 6px 2px;
    }

    .badge-showcase-container .bt-show-item .bt-pic {
        width: 52px;
    }

    .badge-showcase-container .bt-show-item strong {
        font-size: 11.5px;
    }

    .badge-showcase-container .bt-show-item small {
        display: none;
    }

    .badge-showcase-container .bt-sec-head {
        padding: 16px 16px 12px;
    }

    .badge-showcase-container .bt-chips button {
        min-height: 40px;
    }

    .badge-showcase-container .bt-empty-filter {
        padding: 12px 16px 16px;
    }

    .badge-showcase-container .bt-track {
        grid-template-columns: 1fr;
        grid-template-areas:
            "head"
            "levels"
            "step";
        gap: 10px;
        padding: 14px 16px;
    }

    .badge-showcase-container .bt-levels {
        flex-wrap: nowrap;
    }

    .badge-showcase-container .bt-level {
        position: static;
        flex: 1 1 44px;
        max-width: 44px;
        min-width: 32px;
    }

    .badge-showcase-container .bt-level.earned,
    .badge-showcase-container .bt-level.next {
        position: relative;
    }

    .badge-showcase-container .bt-level.earned::after {
        width: 14px;
        height: 14px;
        background-size: 9px;
    }

    .badge-showcase-container .bt-link {
        flex: 1 1 0;
        min-width: 4px;
        max-width: 40px;
        margin: 0 2px;
    }

    /* Anchored to the row (the track is the positioned box), across its width under the title. */
    .badge-showcase-container .bt-tip {
        left: 16px;
        right: 16px;
        width: auto;
        transform: none;
        bottom: auto;
        top: 44px;
    }

    .badge-showcase-container .bt-level.earned .bt-tip,
    .badge-showcase-container .bt-level.next .bt-tip {
        left: 50%;
        right: auto;
        width: 228px;
        max-width: calc(100cqw - 32px);
        transform: translateX(-50%);
        top: auto;
        bottom: calc(100% + 10px);
    }

    .badge-showcase-container .bt-level.earned:first-child .bt-tip,
    .badge-showcase-container .bt-level.next:first-child .bt-tip {
        left: 0;
        transform: none;
    }

    .badge-showcase-container .bt-level.earned:last-child .bt-tip,
    .badge-showcase-container .bt-level.next:last-child .bt-tip {
        left: auto;
        right: 0;
        transform: none;
    }

    .badge-showcase-container .bt-tiles {
        grid-template-columns: 1fr;
    }

    .badge-showcase-container .bt-tile {
        padding: 14px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }

    .badge-showcase-container .bt-tile:nth-child(odd) {
        border-right: 0;
    }

    .badge-showcase-container .bt-tile:nth-last-child(2):nth-child(odd) {
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }

    .badge-showcase-container .bt-tile:last-child {
        border-bottom: 0;
    }

    .badge-showcase-container .bt-pair {
        grid-template-columns: 1fr;
    }

    .badge-showcase-container .bt-skel-track {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 16px;
    }
}

/* ---------- A combined badge's requirements (CompositeBadgeRequirements: .composite-requirements-container) ---------- */

.composite-requirements-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.composite-requirements-container .requirement-section {
    background: var(--mud-palette-background);
    border-radius: 12px;
    padding: 16px;
}

.composite-requirements-container .section-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
}

.composite-requirements-container .requirement-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.composite-requirements-container .requirement-item {
    border-radius: 8px;
    overflow: hidden;
}

/* Only a row with somewhere to go looks clickable. */
.composite-requirements-container .requirement-item--clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.composite-requirements-container .requirement-item--clickable:hover {
    background: var(--mud-palette-action-default-hover);
}

.composite-requirements-container .requirement-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.composite-requirements-container .badge-icon-wrapper,
.composite-requirements-container .badge-image-wrapper {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
    border-radius: 50%;
    flex-shrink: 0;
}

.composite-requirements-container .badge-icon {
    font-size: 28px !important;
}

.composite-requirements-container .badge-image {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.composite-requirements-container .badge-details {
    flex: 1;
    min-width: 0;
}

.composite-requirements-container .badge-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.composite-requirements-container .badge-description {
    color: var(--mud-palette-text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.composite-requirements-container .requirement-status {
    flex-shrink: 0;
}

.composite-requirements-container .requirement-item.met {
    background: rgba(76, 175, 80, 0.08);
}

.composite-requirements-container .requirement-item.met .badge-name {
    color: var(--mud-palette-success);
}

.composite-requirements-container .progress-summary {
    background: var(--mud-palette-surface);
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
}

@media (max-width: 600px) {
    .composite-requirements-container .badge-icon-wrapper,
    .composite-requirements-container .badge-image-wrapper {
        width: 40px;
        height: 40px;
    }

    .composite-requirements-container .badge-icon {
        font-size: 24px !important;
    }

    .composite-requirements-container .badge-image {
        width: 30px;
        height: 30px;
    }

    .composite-requirements-container .requirement-badge {
        padding: 8px;
    }
}

/* ---------- The badge detail dialog (Dialogs/BadgeDetailDialog: .badge-detail-container) ---------- */

.badge-detail-container {
    padding: 16px;
}

.badge-detail-container .badge-detail-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 32px;
}

.badge-detail-container .badge-detail-icon {
    flex-shrink: 0;
}

.badge-detail-container .detail-icon-wrapper,
.badge-detail-container .detail-image-wrapper {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: var(--mud-palette-background);
    position: relative;
    overflow: hidden;
}

.badge-detail-container .detail-icon-wrapper {
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Follows the theme, like the card's disc (it was white). */
.badge-detail-container .detail-image-wrapper {
    background: var(--mud-palette-surface);
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.badge-detail-container .detail-icon {
    font-size: 64px !important;
}

.badge-detail-container .detail-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.badge-detail-container .badge-detail-info {
    flex: 1;
}

.badge-detail-container .badge-detail-title {
    margin-bottom: 8px;
    font-weight: 600;
}

.badge-detail-container .badge-detail-description {
    color: var(--mud-palette-text-secondary);
    margin-bottom: 16px;
}

.badge-detail-container .badge-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge-detail-container .badge-detail-progress {
    background: var(--mud-palette-background);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.badge-detail-container .progress-visualization {
    margin-top: 16px;
}

.badge-detail-container .progress-track {
    height: 24px;
    background: var(--mud-palette-divider);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.badge-detail-container .progress-fill-animated {
    height: 100%;
    background: linear-gradient(90deg, var(--mud-palette-success) 0%, var(--mud-palette-success-lighten) 100%);
    border-radius: 12px;
    position: relative;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-detail-container .progress-glow {
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: badge-progress-glow 2s ease-in-out infinite;
}

.badge-detail-container .progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.badge-detail-container .badge-detail-prerequisite,
.badge-detail-container .badge-detail-composite {
    margin-bottom: 24px;
}

.badge-detail-container .prerequisite-badge {
    display: flex;
    align-items: center;
}

.badge-detail-container .prerequisite-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

@media (max-width: 600px) {
    .badge-detail-container .badge-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .badge-detail-container .badge-detail-stats {
        justify-content: center;
    }
}

/* ---------- The award dialog's picture (BadgeAwardDialog: .badge-award-picture) ---------- */

/* A fixed box, so a narrow screen never squashes the art. */
.badge-award-picture {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* ---------- Animations ---------- */

@keyframes badge-progress-glow {
    0% {
        transform: translateX(-100px);
    }

    100% {
        transform: translateX(100px);
    }
}
