
/* ============================ BADGES: Your badges, tiers, profile row, unlocks ============================ */
.bdg-dlg { padding: 0; border: none; background: transparent; max-width: none; max-height: none; color: var(--text); overflow: visible; }
.bdg-dlg::backdrop { background: rgba(0,0,0,.6); }
.bdg-dlg { --bdg-raise: color-mix(in srgb, var(--bright) 6%, var(--bg-1)); --bdg-raise2: color-mix(in srgb, var(--bright) 10%, var(--bg-1)); }
.bdg-x:focus:not(:focus-visible), .bdg-btn:focus:not(:focus-visible) { outline: none; }
dialog.bdg-dlg.bdg-unlock[open] { margin: auto !important; inset: 0 !important; display: flex; align-items: center; justify-content: center; }
.bdg-sheet:focus { outline: none; }
.bdg-grab { display: none; }
.bdg-sheet { background: var(--bg-1); color: var(--text); width: 480px; max-width: calc(100vw - 24px); max-height: min(86vh, 860px); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 60px rgba(0,0,0,.5); border: 1px solid var(--border); position: relative; }
.bdg-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--border); flex: none; }
.bdg-head h3 { margin: 0; text-align: center; font-size: 17px; font-weight: 700; color: var(--bright); }
.bdg-x { width: 40px; height: 40px; border: none; border-radius: 50%; background: transparent; color: var(--bright); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.bdg-x:hover { background: var(--hover); } .bdg-x .ic { width: 24px; height: 24px; }
.bdg-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 18px; flex: 1; -webkit-overflow-scrolling: touch; }
.bdg-h { font-size: 16px; color: var(--bright); font-weight: 500; margin: 18px 0 12px; }
.bdg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.bdg-tile { position: relative; aspect-ratio: 1; border-radius: 12px; background: var(--bdg-raise); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: transform .12s, background .12s; -webkit-tap-highlight-color: transparent; }
.bdg-tile:hover { background: var(--bdg-raise2); } .bdg-tile:active { transform: scale(.95); }
.bdg-tile svg { width: 48%; height: 48%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.bdg-tile.locked svg { filter: grayscale(.35) drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.bdg-tile .bdg-new { position: absolute; top: 9px; inset-inline-end: 9px; width: 9px; height: 9px; border-radius: 50%; background: #5865f2; box-shadow: 0 0 0 2px var(--bdg-raise); }
.bdg-empty { color: var(--muted); font-size: 13px; padding: 4px 0; }
.bdg-foot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); flex: none; }
.bdg-btn { width: 100%; min-height: 46px; border-radius: 10px; border: none; background: var(--bdg-raise2); color: var(--bright); font-size: 15px; font-weight: 600; cursor: pointer; }
.bdg-btn:hover { background: color-mix(in srgb, var(--bright) 14%, var(--bg-1)); } .bdg-btn.pri { background: #5865f2; color: #fff; } .bdg-btn.pri:hover { background: #4752c4; }
/* detail */
.bdg-detail .bdg-sheet { position: relative; }
.bdg-detail .bdg-head { position: absolute; top: 6px; inset-inline-start: 6px; z-index: 2; display: block; padding: 0; border: none !important; }
.bdg-detail .bdg-head > span { display: none; }
.bdg-detail .bdg-body { padding: 34px 18px 28px; }
.bdg-detail .bdg-hero { padding: 6px 6px 0; }
.bdg-dlg .bdg-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--bg-5); margin: 8px auto 0; flex: none; }
.bdg-hero { text-align: center; padding: 10px 6px 4px; }
.bdg-hero .bdg-art { width: 112px; height: 112px; margin: 6px auto 4px; display: block; filter: drop-shadow(0 6px 12px rgba(0,0,0,.35)); animation: bdgPop .5s cubic-bezier(.2,1.4,.4,1); }
.bdg-fam { color: var(--text); font-size: 16px; margin-top: 6px; }
.bdg-tier { color: var(--bright); font-size: 30px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; line-height: 1.1; margin: 2px 0 6px; overflow-wrap: anywhere; }
.bdg-meta { color: var(--muted); font-size: 14px; line-height: 1.4; }
.bdg-card { background: var(--bdg-raise); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-top: 16px; }
.bdg-card-h { font-size: 15px; color: var(--bright); margin-bottom: 12px; }
.bdg-prog { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 14px; }
.bdg-prog svg { width: 40px; height: 40px; }
.bdg-prog b { display: block; font-size: 14px; font-weight: 500; color: var(--bright); margin-bottom: 8px; }
.bdg-bar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--bright) 14%, var(--bg-1)); overflow: hidden; }
.bdg-bar i { display: block; height: 100%; border-radius: 4px; background: #5865f2; transition: width .6s ease; }
.bdg-desc { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; color: var(--bright); font-size: 15px; line-height: 1.45; }
.bdg-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 6px; margin-top: 18px; }
.bdg-t { text-align: center; min-width: 0; }
.bdg-t:last-child:nth-child(3n+1) { grid-column: 2; }
.bdg-t svg { width: 36px; height: 36px; display: block; margin: 0 auto 6px; }
.bdg-t b { display: block; font-size: 14px; color: var(--bright); font-weight: 700; overflow-wrap: anywhere; }
.bdg-t span { font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 3px; }
.bdg-t.locked svg { opacity: .5; filter: grayscale(.55); } .bdg-t.locked b, .bdg-t.locked span { color: var(--muted); font-weight: 600; }
.bdg-t span .ic { width: 12px; height: 12px; }
.bdg-t.cur b { color: var(--bright); }
/* customize */
.bdg-cz { list-style: none; margin: 8px 0 0; padding: 0; }
.bdg-cz li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.bdg-cz li svg { width: 32px; height: 32px; flex: none; }
.bdg-cz li.off svg { opacity: .4; }
.bdg-cz .bdg-czt { flex: 1; min-width: 0; } .bdg-cz .bdg-czt b { display: block; color: var(--bright); font-size: 14px; } .bdg-cz .bdg-czt small { color: var(--muted); font-size: 12px; }
.bdg-mv { width: 34px; height: 34px; border-radius: 8px; border: none; background: var(--bdg-raise2); color: var(--bright); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.bdg-mv:disabled { opacity: .3; cursor: default; } .bdg-mv .ic { width: 16px; height: 16px; }
.bdg-sw { position: relative; width: 44px; height: 26px; flex: none; } .bdg-sw input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.bdg-sw i { position: absolute; inset: 0; border-radius: 13px; background: var(--bg-5); transition: background .15s; } .bdg-sw i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.bdg-sw input:checked + i { background: #5865f2; } .bdg-sw input:checked + i::after { transform: translateX(18px); }
:root[dir="rtl"] .bdg-sw input:checked + i::after { transform: translateX(18px); }
/* the badges next to a name on a profile */
.pc-badges.bdg-row { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 2px; margin-top: 8px; padding: 3px 6px; border-radius: 9px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06); max-width: 100%; }
[data-theme^="light"] .pc-badges.bdg-row, .theme-light .pc-badges.bdg-row { background: rgba(0,0,0,.06); }
.bdg-row .pc-badge { background: none; border: none; padding: 2px; border-radius: 6px; cursor: pointer; display: inline-flex; line-height: 0; }
.bdg-row .pc-badge:hover { background: var(--hover-strong); }
.bdg-row .pc-badge svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.bdg-row .bdg-more { font-size: 13px; font-weight: 700; color: var(--bright); padding: 0 6px 0 4px; cursor: pointer; background: none; border: none; line-height: 22px; }
/* unlock celebration */
.bdg-unlock .bdg-sheet { width: 360px; text-align: center; padding: 26px 22px 18px; overflow: hidden; }
.bdg-unlock .bdg-glow { position: absolute; inset: -40% -20% auto; height: 300px; background: radial-gradient(closest-side, var(--bdg-c, #5865f2), transparent); opacity: .35; pointer-events: none; }
.bdg-unlock .bdg-art { width: 120px; height: 120px; display: block; margin: 4px auto 8px; position: relative; animation: bdgPop .7s cubic-bezier(.2,1.5,.4,1); }
.bdg-unlock .bdg-kick { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); position: relative; }
.bdg-unlock .bdg-tier { font-size: 26px; position: relative; }
.bdg-unlock .bdg-meta { position: relative; margin-bottom: 18px; }
.bdg-unlock .bdg-acts { display: flex; gap: 10px; position: relative; }
.bdg-unlock .bdg-rays { position: absolute; left: 50%; top: 114px; width: 340px; height: 340px; margin: -170px 0 0 -170px; border-radius: 50%; pointer-events: none; opacity: .22;
    background: repeating-conic-gradient(from 0deg, var(--bdg-c, #5865f2) 0 9deg, transparent 9deg 24deg);
    -webkit-mask: radial-gradient(closest-side, #000 25%, transparent); mask: radial-gradient(closest-side, #000 25%, transparent); animation: bdgSpin 18s linear infinite; }
.bdg-unlock .bdg-art { filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); }
@keyframes bdgSpin { to { transform: rotate(360deg); } }
.bdg-spark { position: absolute; width: 8px; height: 8px; border-radius: 2px; pointer-events: none; animation: bdgSpark 1.1s ease-out forwards; }
@keyframes bdgPop { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes bdgSpark { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(260deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bdg-hero .bdg-art, .bdg-unlock .bdg-art, .bdg-unlock .bdg-rays { animation: none; } .bdg-spark { display: none; } }
/* phones: the screens become sheets that come up from the bottom, like the usual */
@media (max-width: 700px) {
    .bdg-dlg:not(.bdg-unlock) { margin: auto 0 0; width: 100vw; }
    .bdg-dlg:not(.bdg-unlock) .bdg-sheet { width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; border: none; max-height: calc(100dvh - 44px - env(safe-area-inset-top)); height: calc(100dvh - 44px - env(safe-area-inset-top)); animation: bdgUp .28s cubic-bezier(.2,.9,.3,1); }
    .bdg-dlg.bdg-detail .bdg-sheet { height: auto; }
    .bdg-body { padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); }
    .bdg-grid { gap: 8px; }
    .bdg-dlg .bdg-grab { display: block; }
    .bdg-tier { font-size: 28px; }
}
@keyframes bdgUp { from { transform: translateY(100%); } to { transform: none; } }
