
.badges main { max-width: 860px; margin: 0 auto; padding: calc(var(--nav-h) + 1.6rem) 1.5rem 4rem; }
.badges h1 {
  font-family: var(--display); font-size: clamp(30px, 6vw, 46px); font-weight: 700;
  text-transform: uppercase; color: #fff; line-height: 1.05; margin: 0 0 .6rem;
}
.badges h1 span { color: var(--brand-ink); }
.badges .lead { color: var(--ink); font-size: 1.02rem; margin: 0 0 1.2rem; max-width: 58ch; }
.badges .muted { color: var(--muted); font-size: .85rem; }

.bg-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.4rem 1.5rem; margin-bottom: 1.25rem;
}
.bg-card h2 {
  font-family: var(--display); font-size: 1.2rem; font-weight: 600;
  text-transform: uppercase; color: #fff; margin: 0 0 .5rem;
}
.bg-cta { text-align: center; padding: 1.6rem 1.5rem; }
.bg-cta .why { list-style: none; margin: .9rem 0 1.2rem; padding: 0; color: var(--muted); font-size: .9rem; }
.bg-cta .why li { margin: .3rem 0; }

.bg-stats { display: flex; gap: 1.6rem; flex-wrap: wrap; margin: .2rem 0 0; }
.bg-stat b {
  display: block; font-family: var(--display); font-size: 1.5rem;
  color: #fff; line-height: 1.1;
}
.bg-stat span { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.bg-fam { margin-top: 1.6rem; }
.bg-fam:first-child { margin-top: 0; }
.bg-fam > summary {
  display: flex; align-items: center; gap: .55rem; cursor: pointer;
  list-style: none; padding: .55rem 0;
}
.bg-fam > summary::-webkit-details-marker { display: none; }
.bg-fam > summary h3 {
  margin: 0; font-family: var(--display); font-size: .9rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.bg-fam > summary:hover h3 { color: #fff; }
.bg-fam > summary:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; border-radius: 6px; }
.bg-fam > summary::before {
  content: ""; width: .42rem; height: .42rem; flex: none; margin: 0 .3rem 0 .12rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s ease;
}
.bg-fam[open] > summary::before { transform: rotate(45deg); }
.bg-fam > summary:hover::before { border-color: #fff; }
.fam-count { font-size: .75rem; color: var(--muted); }
.fam-note { font-size: .8rem; color: var(--muted); margin: 0 0 .2rem; max-width: 52ch; }

.bg-grid {
  --cz: 62px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .7rem .5rem; margin-top: .75rem;
}
.bg-cell { position: relative; }
.bg-btn {
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  width: 100%; font: inherit; color: inherit; background: none; border: 0;
  border-radius: 12px; padding: .4rem .1rem .3rem; cursor: pointer; text-align: center;
}
.bg-btn:hover { background: rgba(255, 255, 255, .035); }
.bg-btn:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 1px; }
.bg-cell.locked .bg-btn { opacity: .5; }
.bg-name { color: #fff; font-weight: 600; font-size: .7rem; line-height: 1.25; overflow-wrap: anywhere; }

.crest {
  position: relative; overflow: hidden;
  width: var(--cz); height: var(--cz); flex: none;
  border-radius: calc(var(--cz) * .26); display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: calc(var(--cz) * .3);
  color: #12121f; background: #4a4a5c; border: 2px solid rgba(255, 255, 255, .12);
}
.crest.fam-first     { background: #e0b03c; }
.crest.fam-streak    { background: #e2703a; }
.crest.fam-results   { background: #4a9de0; }
.crest.fam-exact     { background: #a06bd4; }
.crest.fam-home      { background: #35c15e; }
.crest.fam-away      { background: #2fb3a8; }
.crest.fam-picks     { background: #8a8fd0; }
.crest.fam-profile   { background: #d47ba8; }
.crest.fam-placement { background: #f0d264; }
.crest.fam-hosts     { background: var(--brand-ink); color: var(--page); }
.crest.fam-opponent  { background: var(--accent); color: var(--on-accent); }
.crest.fam-hidden    { background: #2a2a38; color: var(--muted); border-style: dashed; }

.bg-cell.locked .crest { filter: grayscale(1); }

.crest.has-art { background: none; border: 0; }
.crest.has-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bg-cell.locked .crest.has-art { filter: none; }
.bg-modal-art.locked .crest.has-art { filter: none; opacity: 1; }
.bg-modal-art .crest.has-art img { object-fit: contain; }

.crest.star {
  box-shadow: 0 0 0 2px #f2c14e, 0 0 10px rgba(242, 193, 78, .55);
}
.bg-cell.locked .crest.star { box-shadow: none; }

.bg-head { display: flex; align-items: center; gap: 1rem; justify-content: space-between; flex-wrap: wrap; }
.bg-tools { display: flex; gap: .4rem; flex-wrap: wrap; }
.bg-head p { margin: 0; }
.toggle {
  font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: .35rem .8rem;
}
.toggle:hover { color: #fff; }
.toggle[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.toggle:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }

#badge-body.earned-only .bg-cell.locked { display: none; }
#badge-body.earned-only .bg-fam.no-earned { display: none; }
#badge-body.earned-only #bg-hidden { display: none !important; }
#badge-body.earned-only .bg-prog { display: none; }

.bg-prog { display: block; width: 100%; max-width: var(--cz); }
.bg-prog .bar { display: block; height: 4px; background: rgba(255, 255, 255, .08); border-radius: 3px; overflow: hidden; }
.bg-prog .bar i { display: block; height: 100%; background: var(--primary); }
.bg-prog .n { display: block; font-size: .62rem; color: var(--muted); line-height: 1.5; }

.bg-tip {
  position: absolute; z-index: 30; bottom: calc(100% - .35rem); left: 50%;
  transform: translateX(-50%); width: max-content; max-width: min(240px, 66vw);
  background: #08080f; border: 1px solid rgba(255, 255, 255, .15); border-radius: 10px;
  padding: .5rem .65rem; font-size: .75rem; line-height: 1.45; color: var(--ink);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55); text-align: left;
  opacity: 0; visibility: hidden; transition: opacity .12s ease; pointer-events: none;
}
.bg-tip b { color: #fff; }
.bg-tip .tip-when { color: var(--muted); font-size: .7rem; }
.bg-cell:hover .bg-tip, .bg-cell.open .bg-tip, .bg-btn:focus + .bg-tip { opacity: 1; visibility: visible; }
.bg-cell:nth-child(3n+1) .bg-tip { left: 0; transform: none; }
.bg-cell:nth-child(3n)   .bg-tip { left: auto; right: 0; transform: none; }

.bg-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1.2rem; }
.bg-modal[hidden] { display: none; }
.bg-modal-back { position: absolute; inset: 0; background: rgba(5, 5, 10, .78); backdrop-filter: blur(3px); }
.bg-modal-card {
  position: relative; width: min(26rem, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.6rem 1.4rem 1.5rem; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.bg-modal-x {
  position: absolute; top: .4rem; right: .6rem; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 1.7rem; line-height: 1; padding: .2rem .5rem;
}
.bg-modal-x:hover { color: #fff; }
.bg-modal-art { width: min(200px, 52vw); aspect-ratio: 1; margin: .2rem auto 1rem; display: grid; place-items: center; }
.bg-modal-art .crest { width: 100%; height: 100%; border-radius: 22%; font-size: 3rem; }
.bg-modal-art.locked .crest { filter: grayscale(1); opacity: .6; }
.bg-modal-card h2 { font-family: var(--display); font-size: 1.5rem; margin: 0 0 .35rem; color: #fff; }
.bg-modal-status {
  margin: 0 0 1rem; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase;
  font-weight: 700; color: var(--muted);
}
.bg-modal-status.got { color: var(--win); }
.bg-modal-crit { color: var(--ink); font-size: .9rem; margin: 0 0 .6rem; }
.bg-modal-quip { color: var(--muted); font-size: .85rem; font-style: italic; margin: 0; }

.bg-modal-share {
  display: block; width: 100%; margin: 1.2rem 0 0; padding: .7rem 1rem;
  font: 700 .82rem/1 var(--display), system-ui, sans-serif;
  letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  color: #fff; background: var(--brand-ink, var(--primary));
  border: 0; border-radius: 10px;
}
.bg-modal-share[hidden] { display: none; }
.bg-modal-share:hover { filter: brightness(1.12); }
.bg-modal-share:disabled { opacity: .6; cursor: default; }

@media (max-width: 560px) {
  .bg-grid { --cz: 54px; }
}
