/* K1C parent badge engine styles: the one source of truth, shared by the parent pages and the Badge Library. */
/* Catalog tokens mapped onto the app theme, scoped to the badge board. */
.k1c-badges {
  --base-100: var(--color-base-100); --base-200: var(--color-base-200); --base-300: var(--color-base-300);
  --primary: var(--color-primary); --accent: var(--color-accent);
  --ink: var(--color-base-content); --muted: color-mix(in oklab, var(--color-base-content) 62%, transparent);
}
/* ---------- badge engine ---------- */
.bdg { --bs: 132; position: relative; width: calc(var(--bs) * 1px); height: calc(var(--bs) * 1px); perspective: 700px; touch-action: pan-y; flex-shrink: 0; }
.bdg.lg { --bs: 168; }
@media (max-width: 480px) { .bdg { --bs: 118; } .bdg.lg { --bs: 140; } }
.bdg .tilt { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .18s ease-out; }
.bdg .idle { position: absolute; inset: 0; transform-style: preserve-3d; }
.bdg.l2:not(.hot) .idle, .bdg.l3:not(.hot) .idle, .bdg.l4:not(.hot) .idle, .bdg.foil:not(.hot) .idle { animation: wobble 8s ease-in-out infinite; }
.bdg svg.face { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 10px rgba(20, 40, 20, .28)); }
.bdg .glare { position: absolute; inset: 4%; border-radius: 50%; pointer-events: none; mix-blend-mode: soft-light; opacity: .35; transition: opacity .2s;
  background: radial-gradient(circle at var(--gx, 32%) var(--gy, 24%), rgba(255,255,255,.95), rgba(255,255,255,0) 48%); }
.bdg.hot .glare { opacity: 1; }
.bdg .rays { position: absolute; inset: -16%; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, var(--ray) 0 5deg, transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 40%, transparent 70%); mask: radial-gradient(circle, #000 40%, transparent 70%);
  animation: spin 60s linear infinite; }
.bdg .aura { position: absolute; inset: -10%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 214, 120, .75), rgba(255, 214, 120, 0) 66%); animation: breathe 3.8s ease-in-out infinite; }
.bdg .spk { position: absolute; width: 14%; aspect-ratio: 1; color: #fff7cf; opacity: 0; pointer-events: none; filter: drop-shadow(0 0 4px rgba(255, 236, 160, .95)); animation: twinkle 4.4s ease-in-out infinite; }
.bdg .spk svg { width: 100%; height: 100%; display: block; }
.bdg .sheen-bar { animation: sheen 7s ease-in-out infinite; }
.bdg.l3 .sheen-bar, .bdg.l4 .sheen-bar { animation-duration: 5.5s; }
.bdg .leaf-run { animation: leafrun 3.2s ease-in-out infinite; }
.bdg.locked svg.face { filter: none; }
.bdg .coin { position: absolute; right: -6%; bottom: -6%; width: 34%; aspect-ratio: 1; transform: translateZ(30px); }
.bdg .coin svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }

/* stand-alone coins */
.coin-solo { position: relative; width: var(--cs, 64px); aspect-ratio: 1; }
.coin-solo svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.coin-glint { animation: coin-glint 4.5s ease-in-out infinite; }
.coin-spark { position: absolute; width: 34%; aspect-ratio: 1; right: -8%; top: -8%; color: #fff7cf; opacity: 0; animation: twinkle 3.6s ease-in-out infinite 1s; filter: drop-shadow(0 0 3px rgba(255,236,160,.9)); }
.coin-spark svg { width: 100%; height: 100%; display: block; }

/* ---------- ambassador foil (authored at 200px, scaled) ---------- */
.bdg.foil .scale { position: absolute; left: 0; top: 0; width: 200px; height: 200px; transform-origin: 0 0; transform: scale(calc(var(--bs) / 200)); }
.foil .card { position: absolute; inset: 0; border-radius: 20px; padding: 7px; box-shadow: 0 12px 26px -12px rgba(15, 51, 19, .6);
  background: conic-gradient(from var(--a, 0deg), #D9A441, #f8e9a6, #ed9975, #8dc63f, #7ab9e5, #c9a7f0, #D9A441); animation: holo-spin 7s linear infinite; }
.foil .fface { position: relative; height: 100%; border-radius: 14px; overflow: hidden; color: #fffcec; text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, #2d7a33 0%, #1d5521 45%, #0f3313 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding-top: 14px; }
.foil .fface::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 2px, transparent 2px 9px); }
.foil .holo-sheet { position: absolute; inset: -25%; mix-blend-mode: color-dodge; opacity: .5; pointer-events: none; transition: transform .2s ease-out;
  background: linear-gradient(115deg, transparent 25%, rgba(239,218,107,.6) 38%, rgba(141,198,63,.5) 46%, rgba(122,185,229,.55) 54%, rgba(237,153,117,.55) 62%, transparent 75%);
  transform: translateX(calc((var(--gxn, .2) - .5) * 70%)); }
.foil .fglare { position: absolute; inset: 0; border-radius: 14px; pointer-events: none; mix-blend-mode: soft-light; opacity: .4;
  background: radial-gradient(circle at var(--gx, 30%) var(--gy, 20%), rgba(255,255,255,.9), transparent 50%); }
.bdg.foil.hot .fglare { opacity: 1; }
.foil .yrs { position: absolute; top: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; }
.foil .yrs svg { width: 13px; height: 13px; color: #efda6b; filter: drop-shadow(0 0 3px rgba(239, 218, 107, .8)); animation: star-pop 3.4s ease-in-out infinite; }
.foil .torch { position: relative; width: 58px; height: 66px; }
.foil .torch svg { width: 100%; height: 100%; overflow: visible; }
.foil .flame { transform-origin: 31px 34px; animation: flicker 1.6s ease-in-out infinite alternate; }
.foil .k1 { position: relative; font: 600 9.5px/1 var(--font-body); letter-spacing: .32em; text-transform: uppercase; color: #f8e9a6; }
.foil .k2 { position: relative; font: 400 26px/1 var(--font-display); letter-spacing: .04em; text-transform: uppercase;
  background: linear-gradient(180deg, #fff7cf, #efda6b 55%, #D9A441); -webkit-background-clip: text; background-clip: text; color: transparent; }
.foil .k3 { position: relative; font: 600 8.5px/1 var(--font-body); letter-spacing: .2em; text-transform: uppercase; color: rgba(255,252,236,.72); margin-top: 4px; }
@property --a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

@keyframes wobble { 0%, 100% { transform: rotateY(-7deg) rotateX(3deg); } 50% { transform: rotateY(7deg) rotateX(-3deg); } }
@keyframes sheen { 0%, 55% { transform: translateX(0); } 85%, 100% { transform: translateX(300px); } }
@keyframes leafrun { 0%, 100% { filter: brightness(1); } 12% { filter: brightness(1.6) drop-shadow(0 0 3px #fff3bf); } 30% { filter: brightness(1); } }
@keyframes breathe { 0%, 100% { opacity: .45; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes holo-spin { to { --a: 360deg; } }
@keyframes flicker { 0% { transform: scale(1, 1) skewX(0); } 50% { transform: scale(.94, 1.06) skewX(-3deg); } 100% { transform: scale(1.04, .96) skewX(3deg); } }
@keyframes star-pop { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.35); } }
@keyframes coin-glint { 0%, 60% { transform: translateX(-60px); } 90%, 100% { transform: translateX(120px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 15% { opacity: 1; transform: scale(1) rotate(45deg); } 30% { opacity: 0; transform: scale(.4) rotate(90deg); } }
.bdg .glare.sq { inset: 2%; border-radius: 14%; }
.bdg .runner { animation: runner 4.5s linear infinite; filter: drop-shadow(0 0 3px rgba(255, 244, 194, .9)); }
@keyframes runner { to { stroke-dashoffset: -100; } }
.bdg.card .coin { width: 29%; right: -7%; bottom: -7%; }
@media (max-width: 480px) { .bdg { --bs: 112; } .bdg.lg { --bs: 124; } }
.bdg .aura.soft { inset: -6%; background: radial-gradient(circle, rgba(255, 214, 120, .55), rgba(255, 214, 120, 0) 64%); }
.bdg .glare.shield { inset: 6% 10% 3%; border-radius: 12% 12% 50% 50% / 10% 10% 60% 60%; }
.bdg .glare.hex { inset: 2%; border-radius: 0; clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.bdg .glare.ros { inset: 4% 6% 14%; }
.bdg .spin-slow { transform-box: fill-box; transform-origin: center; animation: spin 24s linear infinite; }
.sim h3 { font: 400 17px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .03em; }
.bdg.hexb .coin, .bdg.crest .coin { width: 29%; right: -5%; bottom: -5%; }
.bdg .glare.arch { inset: 2% 10% 2%; border-radius: 50% 50% 10% 10% / 42% 42% 8% 8%; }
.bdg.seat .coin { width: 29%; right: -4%; bottom: -5%; }
/* limited-edition stamps (authored at 200px; perforation = holes every 200/12 px on every edge) */
.bdg.stampb .scale { filter: drop-shadow(0 10px 14px rgba(15, 30, 20, .35)); }
.stampb .stamp { --r: 5px; --s: 16.6667px; position: absolute; inset: 0; padding: 12px;
  background: conic-gradient(from var(--a, 0deg), #D9A441, #f8e9a6, #ed9975, #8dc63f, #7ab9e5, #c9a7f0, #D9A441); animation: holo-spin 7s linear infinite;
  -webkit-mask: radial-gradient(circle at 0 0, #0000 var(--r), #000 calc(var(--r) + .6px)) 0 0 / var(--s) var(--s),
                linear-gradient(#000 0 0) center / calc(100% - 2 * var(--r)) calc(100% - 2 * var(--r)) no-repeat;
          mask: radial-gradient(circle at 0 0, #0000 var(--r), #000 calc(var(--r) + .6px)) 0 0 / var(--s) var(--s),
                linear-gradient(#000 0 0) center / calc(100% - 2 * var(--r)) calc(100% - 2 * var(--r)) no-repeat; }
.stampb .stamp-in { position: relative; height: 100%; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }
.stampb .stamp-in svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stampb .holo-sheet { opacity: .42; }
.stamp-ghost .open-tag, .stamp-ghost .closed-tag { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); white-space: nowrap; text-align: center;
  font: 700 9.5px/1.3 var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; }
.stamp-ghost .open-tag { background: #1d5521; color: #fffcec; box-shadow: 0 0 0 0 rgba(29, 85, 33, .45); animation: pulse-tag 2.2s ease-out infinite; }
.stamp-ghost .closed-tag { background: var(--base-200); color: var(--muted); border: 1px solid var(--base-300); }
@keyframes pulse-tag { 0% { box-shadow: 0 0 0 0 rgba(29, 85, 33, .45); } 70%, 100% { box-shadow: 0 0 0 10px rgba(29, 85, 33, 0); } }
/* "Next up" card */
.nextup { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 18px; align-items: center; background: var(--base-100); border: 1.5px solid var(--base-300); border-radius: 18px; padding: 18px; max-width: 640px; }
.nu-visual { display: grid; place-items: center; padding: 6px; }
.nu-visual .bdg { --bs: 118; }
@media (max-width: 480px) { .nextup { grid-template-columns: 1fr; padding: 14px; gap: 12px; } .nu-visual { justify-self: center; } }
.reveal { position: relative; width: max-content; }
.reveal .ghost-layer { filter: grayscale(1); opacity: .32; }
.reveal .ghost-layer .bdg * { animation: none !important; }
/* A partly earned badge (Next up) hides its corner ticker rather than showing it cut off. */
.reveal .coin { display: none; }
.reveal .fill-layer { position: absolute; inset: 0; clip-path: inset(var(--top) 0 0 0); animation: fill-up 1.2s ease-out both; }
@keyframes fill-up { from { clip-path: inset(100% 0 0 0); } }
.nu-text { display: grid; gap: 6px; min-width: 0; }
.nu-eyebrow { font: 600 11px/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.nu-title { margin: 0; font: 400 22px/1.15 var(--font-display); letter-spacing: .02em; text-transform: uppercase; color: var(--primary); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.nu-tag { font: 700 11px/1 var(--font-body); letter-spacing: .04em; text-transform: none; color: #2a2414; background: var(--accent); padding: 5px 8px; border-radius: 999px; }
.nu-line, .nu-tip { margin: 0; font-size: 14px; line-height: 1.45; }
.nu-tip { color: var(--muted); }
.nu-tip b { color: var(--ink); }
.nu-bar { height: 8px; border-radius: 999px; background: var(--base-200); overflow: hidden; }
.nu-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #1d5521, #8dc63f); animation: bar-in 1.2s ease-out both; }
@keyframes bar-in { from { width: 0; } }
.nu-also { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px dashed var(--base-300); padding-top: 12px; }
.nu-also-h { font: 600 11px/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.nu-chip { font-size: 12.5px; padding: 6px 10px; border-radius: 999px; background: var(--base-200); }

@media (prefers-reduced-motion: reduce) {
  .bdg *, .bdg, .nextup * { animation: none !important; transition: none !important; }
}
