/* filter.css — TROLL FILTERS (items.json type "filter", drawn by assets/filters.js).
 * A match drops <div class="tfilter tf-<fx> it-<id>"> on the target's camera tile for ~25 s:
 *   .tf-canvas      = the WebGL-warped copy of their video (bulges/pinches/drags around face points)
 *   .tf-part.tf-p-* = a sticker that filters.js moves onto a face point every frame (left/top 0 + transform, width in px).
 *                     Animate the sticker's CHILD (svg / span), never .tf-part itself: its transform is the tracking.
 * Plus the in-match filter bar (#filter-bar) and the shop card art. */

.tfilter { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: inherit; animation: tfIn .35s ease-out both; }
.tfilter.tf-mirror { transform: scaleX(-1); }
.tfilter.tf-out { animation: tfOut .4s ease-in both; }
@keyframes tfIn { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: none; } }
@keyframes tfOut { to { opacity: 0; filter: blur(6px); } }
.tf-canvas { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .2s; }
.tf-part { position: absolute; left: 0; top: 0; will-change: transform; }
.tf-part > svg { display: block; width: 100%; height: auto; }

/* Alien: green glow, huge black eyes, bobbing antennae */
.tf-alien::before { content: ""; position: absolute; inset: 0; z-index: 1; background: #48ff6a; mix-blend-mode: color; opacity: .38; }
.tf-alien .tf-part { z-index: 2; }
.tf-p-aeye > svg { animation: tfBlink 3.2s infinite; }
.tf-p-ant > svg { transform-origin: 50% 100%; animation: tfBob 1.1s ease-in-out infinite; }
.tf-p-ant.b > svg { animation-delay: -.5s; }
@keyframes tfBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes tfBob { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }

/* Clown: honking red nose, rosy cheeks, rainbow wig */
.tf-p-nose > svg { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); animation: tfHonk 1.4s ease-in-out infinite; }
.tf-p-blush .tf-blush { display: block; width: 100%; aspect-ratio: 1.4; border-radius: 50%; background: radial-gradient(#ff3b5c, transparent 70%); opacity: .75; mix-blend-mode: multiply; }
.tf-p-wig > svg { transform: translateY(-24%); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
@keyframes tfHonk { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.18, .86); } 24% { transform: scale(.94, 1.06); } }

/* Googly eyes: filters.js swings the pupils (spring + gravity + head moves) */
.tf-goo { position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 55%, #d9dde6); border: 3px solid #222; box-shadow: 0 4px 10px rgba(0, 0, 0, .4); }
.tf-goo i { position: absolute; width: 46%; height: 46%; left: 27%; top: 27%; border-radius: 50%; background: #111; }

/* Mustache + unibrow: they wiggle while the person sings */
.tf-p-stache > svg, .tf-p-brow > svg { transform-origin: 50% 30%; }
.tf-singing > svg { animation: tfWiggle .35s ease-in-out infinite; }
@keyframes tfWiggle { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(5deg) translateY(-4%); } 60% { transform: rotate(-5deg); } }

/* Fat face: double-chin creases under the real chin */
.tf-p-chin > svg { mix-blend-mode: multiply; }

/* Bobblehead: the spring under the chin boings */
.tf-p-spring > svg { transform-origin: 50% 0; animation: tfBoing .28s ease-in-out infinite alternate; }
@keyframes tfBoing { to { transform: scaleY(.8); } }

/* Melted face: a nervous sweat drop */
.tf-p-sweat > svg { animation: tfSweat 1.6s ease-in infinite; }
@keyframes tfSweat { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(260%); opacity: 0; } }

/* Baby face: the pacifier sucks */
.tf-p-paci > svg { animation: tfSuck .5s ease-in-out infinite; }
@keyframes tfSuck { 50% { transform: scale(.9); } }

/* Funhouse: a little carnival sparkle on top of the waves */
.tf-funhouse::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255, 80, 200, .14), rgba(80, 220, 255, .14)); mix-blend-mode: screen; animation: tfHue 2s linear infinite; }
@keyframes tfHue { to { filter: hue-rotate(360deg); } }

/* ---- pack filters (ELI-45) ---- */
/* GOD TIER (Divine Glow): golden light, floating halo, glowing eyes */
.tf-divine::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle at 50% 20%, rgba(255, 236, 150, .55), transparent 65%); mix-blend-mode: screen; animation: tfShine 2.4s ease-in-out infinite; }
.tf-divine .tf-part { z-index: 2; }
.tf-p-halo > svg { filter: drop-shadow(0 0 10px #ffd23a) drop-shadow(0 0 22px rgba(255, 210, 58, .6)); animation: tfFloat 2s ease-in-out infinite; }
.tf-p-glow > svg { mix-blend-mode: screen; animation: tfPulse 1.2s ease-in-out infinite; }
@keyframes tfShine { 50% { opacity: .6; } }
@keyframes tfFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12%); } }
@keyframes tfPulse { 50% { transform: scale(1.18); opacity: .8; } }

/* Rockstar (Rock God): the mohawk bangs along, the star shades flash */
.tf-p-hawk > svg { transform-origin: 50% 100%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); animation: tfBang .22s ease-in-out infinite alternate; }
.tf-p-shades > svg { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); animation: tfGlint 1.6s linear infinite; }
@keyframes tfBang { from { transform: rotate(-5deg); } to { transform: rotate(5deg) scaleY(1.04); } }
@keyframes tfGlint { 0%, 80%, 100% { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); } 88% { filter: drop-shadow(0 0 14px #fff) brightness(1.4); } }

/* Diva (Drama Queen): flutter lashes, kissy lips */
.tf-p-lash > svg { transform-origin: 50% 100%; animation: tfFlutter 1.1s ease-in-out infinite; }
.tf-p-lash.b > svg { transform: scaleX(-1); animation-name: tfFlutterB; }
.tf-p-lips > svg { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); animation: tfKiss 1.4s ease-in-out infinite; }
@keyframes tfFlutter { 0%, 70%, 100% { transform: scaleY(1); } 80% { transform: scaleY(.3); } 90% { transform: scaleY(1.1); } }
@keyframes tfFlutterB { 0%, 70%, 100% { transform: scaleX(-1) scaleY(1); } 80% { transform: scaleX(-1) scaleY(.3); } 90% { transform: scaleX(-1) scaleY(1.1); } }
@keyframes tfKiss { 0%, 100% { transform: scale(1); } 15% { transform: scale(.82, .9); } 30% { transform: scale(1.06); } }

/* Spooky (Wicked Witch): green skin, wobbly hat */
.tf-witch::before { content: ""; position: absolute; inset: 0; z-index: 1; background: #5bd84a; mix-blend-mode: color; opacity: .42; }
.tf-witch .tf-part { z-index: 2; }
.tf-p-hat > svg { transform-origin: 50% 90%; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)); animation: tfBob 2.2s ease-in-out infinite; }

/* Frostbite (Frozen Solid): icy blue, frost round the edges, a swinging icicle */
.tf-frozen::before { content: ""; position: absolute; inset: 0; z-index: 1; background: #6cc8ff; mix-blend-mode: color; opacity: .45; }
.tf-frozen::after { content: ""; position: absolute; inset: 0; z-index: 1; box-shadow: inset 0 0 40px 14px rgba(230, 250, 255, .85); border-radius: inherit; }
.tf-frozen .tf-part { z-index: 2; }
.tf-p-beanie > svg { filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
.tf-p-icicle > svg { transform-origin: 50% 0; animation: tfSwing 1.3s ease-in-out infinite; }
@keyframes tfSwing { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

/* Heartbreaker (Love Struck): beating heart eyes, hearts drifting up */
.tf-p-heye > svg { animation: tfBeat .7s ease-in-out infinite; }
.tf-p-hearts > svg { animation: tfRise 2s ease-out infinite; }
@keyframes tfBeat { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.22); } 40% { transform: scale(.96); } 60% { transform: scale(1.12); } }
@keyframes tfRise { 0% { transform: translateY(30%); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(-60%); opacity: 0; } }

/* Spring Bloom (Flower Child): the crown sways, the bee buzzes round */
.tf-p-flowers > svg { transform: translateY(-30%); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3)); }
.tf-p-bee > svg { animation: tfBuzz 2.6s linear infinite; }
@keyframes tfBuzz { 0% { transform: translate(0, 0) rotate(-8deg); } 25% { transform: translate(-180%, -60%) rotate(8deg); } 50% { transform: translate(-360%, 0) scaleX(-1); }
  75% { transform: translate(-180%, 60%) scaleX(-1) rotate(8deg); } 100% { transform: translate(0, 0) rotate(-8deg); } }

/* Heatwave (Sunburnt): lobster red, the aviators shine */
.tf-sunburnt::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle at 50% 40%, #ff4a2a, #ff8a3c); mix-blend-mode: multiply; opacity: .32; }
.tf-sunburnt .tf-part { z-index: 2; }
.tf-p-avi > svg { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); animation: tfGlint 2s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .tf-part > svg, .tf-singing > svg { animation: none; }
}

/* In-match bar (under the reactions) */
.filter-bar { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.filter-bar .fb-title { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.filter-btn { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 1px; min-width: 56px; padding: 4px 6px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: inherit; cursor: pointer; font-size: 1.3rem; line-height: 1.1; overflow: hidden; transition: transform .08s; }
.filter-btn small { font-size: .6rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.filter-btn:hover:not(:disabled) { transform: translateY(-2px); }
.filter-btn:disabled { cursor: default; opacity: .55; }
.filter-btn::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--cd, 0) * 100%); background: var(--pink, #ff4fa0); }

/* Shop card art */
.filter-art { position: relative; }
