/* ======== BADGES — pixel badges (badges.js) ======== */
/* A pixel badge wherever one shows: My Badges, the Trophy Hall shelves, the
   "Badge Earned!" popup. Locked ones are a grey silhouette of their frame. */
img.badge-px { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; vertical-align: middle;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.2)); }
.badge-card .badge-icon img.badge-px { width: 72px; height: 72px; }
.badge-card.locked .badge-icon img.badge-px, .badge-slot.locked img.badge-px { filter: grayscale(1) brightness(0.75) opacity(0.55); }
.badge-emoji { font-size: 2.5rem; line-height: 1; }

/* A subject's shelf (badgeShelfHTML), in a Curious World card or My Badges. */
.badge-shelf-head { display: flex; align-items: center; gap: 12px; margin: 0 28px 12px 0; }
.badge-shelf-icon { font-size: 2rem; }
.badge-shelf-head h3 { margin: 0; }
.badge-shelf-count { color: var(--color-text-muted, #6b7280); font-size: 0.85rem; font-weight: 700; }
.badge-shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.badge-slot { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 6px 8px;
  border-radius: 14px; background: #fff8e6; border: 2px solid #e6cf98; position: relative; }
.badge-slot.locked { background: #f3f1ec; border-color: #ddd8cc; }
.badge-slot-name { font-weight: 800; font-size: 0.85rem; color: #3f2711; line-height: 1.15; }
.badge-slot.locked .badge-slot-name { color: #8a8378; }
.badge-slot-how { font-size: 0.72rem; color: #7a6a55; line-height: 1.2; }
.badge-slot.earned .badge-slot-how { color: #2f8a3c; font-weight: 800; }
.badge-slot.tier-gold.earned { border-color: #e0b040; }
.badge-slot.tier-silver.earned { border-color: #b9c2cc; }
.badge-slot.tier-bronze.earned { border-color: #c98a5a; }

/* Earned but not looked at yet: it glows until its shelf is opened. */
.badge-slot.is-new { box-shadow: 0 0 0 3px #ffd34d, 0 0 16px 4px rgba(255, 211, 77, 0.8); animation: badge-new 1.4s ease-in-out infinite; }
.badge-slot.is-new::after { content: "NEW"; position: absolute; top: -8px; right: -6px; padding: 1px 6px; border-radius: 8px;
  background: #e8443a; color: #fff; font-size: 0.65rem; font-weight: 900; letter-spacing: 0.5px; }
@keyframes badge-new { 50% { box-shadow: 0 0 0 3px #ffd34d, 0 0 24px 8px rgba(255, 211, 77, 0.95); } }
.cwi-station.is-new .cwi-tag { background: #e8443a; color: #fff; }
/* The kid's best badge in a subject, standing on its stand in the Trophy Hall. */
.cwi-stand-badge { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); pointer-events: none; z-index: 1; line-height: 0; }
.cwi-stand-badge img.badge-px { width: 30px; height: 30px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
.cwi-stand-badge .badge-emoji { font-size: 1.3rem; }
.cwi-station.is-new .cwi-stand-badge { animation: badge-stand-hop 1s ease-in-out infinite; }
@keyframes badge-stand-hop { 50% { transform: translate(-50%, -4px); } }

/* The popup (showRewardCelebration "badge"): the pixel badge with a shine. */
.reward-icon .badge-px { width: 112px; height: 112px; }
.reward-icon.has-badge-px { position: relative; overflow: hidden; border-radius: 50%; }
.reward-icon.has-badge-px::after { content: ""; position: absolute; top: -20%; left: -60%; width: 40%; height: 140%; transform: rotate(20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent); animation: badge-shine 2.2s ease-in-out 0.4s infinite; }
@keyframes badge-shine { 0% { left: -60%; } 45%, 100% { left: 130%; } }

@media (prefers-reduced-motion: reduce) {
  .badge-slot.is-new, .reward-icon.has-badge-px::after { animation: none; }
}

/* My Badges: every subject's shelf, one under the other. */
.badges-shelves .badge-shelf { margin-bottom: 26px; }
