/* PunchCard overlay styles. Transparent stage for OBS; the card itself
   carries the viewer's chosen background, so chrome (text, chips, ring)
   is built to stay readable on anything: permanent text shadows plus a
   scrim layer under text whenever an image/GIF background is active. */

:root {
  --bg-0:#07080e; --bg-1:#0d0f17; --bg-2:#131623; --bg-3:#1a1e2e; --bg-4:#232739;
  --bdr-1:#1f2233; --bdr-2:#2a2f48; --bdr-3:#363c5b;
  --txt-1:#f5f6fb; --txt-2:#c9cdd9; --txt-3:#8b91a3; --txt-4:#61667a;
  --acc:#ff6ab5; --teal:#2dd4bf; --ok:#5bff95; --warn:#ffc270; --err:#ff6b6b;
  --r-lg:8px; --r-xl:16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pc-scale: 1;
  --pc-dx: 0px;
  --pc-dy: 0px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: transparent; overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- stage + anchoring ---- */
#pc-stage {
  position: fixed; inset: 0; display: flex; padding: 36px;
  pointer-events: none;
}
#pc-stage[data-anchor="br"] { align-items: flex-end;   justify-content: flex-end; }
#pc-stage[data-anchor="bl"] { align-items: flex-end;   justify-content: flex-start; }
#pc-stage[data-anchor="bc"] { align-items: flex-end;   justify-content: center; }
#pc-stage[data-anchor="tr"] { align-items: flex-start; justify-content: flex-end; }
#pc-stage[data-anchor="tl"] { align-items: flex-start; justify-content: flex-start; }
#pc-stage[data-anchor="tc"] { align-items: flex-start; justify-content: center; }

#pc-holder {
  transform: translate(var(--pc-dx), var(--pc-dy)) scale(var(--pc-scale));
  transform-origin: bottom right;
}
#pc-stage[data-anchor="bl"] #pc-holder { transform-origin: bottom left; }
#pc-stage[data-anchor="bc"] #pc-holder { transform-origin: bottom center; }
#pc-stage[data-anchor="tr"] #pc-holder { transform-origin: top right; }
#pc-stage[data-anchor="tl"] #pc-holder { transform-origin: top left; }
#pc-stage[data-anchor="tc"] #pc-holder { transform-origin: top center; }

/* ---- card ---- */
.pc-card {
  position: relative;
  width: 480px;
  border-radius: var(--r-xl);
  padding: 18px 20px 14px;
  color: var(--txt-1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.45), 0 2px 10px rgba(0,0,0,0.3);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.09);
  --pc-accent: var(--acc);
  --pc-glow: var(--acc);
}
.pc-card[data-theme="light"]:not(.pc-hasimg) { border-color: rgba(0,0,0,0.12); }
.pc-card[data-theme="glass"] { backdrop-filter: blur(10px); }

.pc-bgimg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
}
/* Viewer placement layouts: the gif hugs one side and fades across. */
.pc-bgimg.pc-bg-right {
  -webkit-mask-image: linear-gradient(90deg, transparent 6%, #000 52%);
  mask-image: linear-gradient(90deg, transparent 6%, #000 52%);
}
.pc-bgimg.pc-bg-left {
  -webkit-mask-image: linear-gradient(270deg, transparent 6%, #000 52%);
  mask-image: linear-gradient(270deg, transparent 6%, #000 52%);
}
/* Full-strength gradient; the renderer scales it with the viewer's
   darken setting via element opacity (default 0.75 ≈ the v1 look). */
.pc-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(7,8,14,1) 0%, rgba(7,8,14,0.6) 55%, rgba(7,8,14,0.85) 100%);
}

.pc-row {
  position: relative; display: flex; align-items: center; gap: 14px;
}
.pc-avatar {
  flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%;
  overflow: hidden; background: rgba(255,255,255,0.08);
  border: 2px solid var(--pc-accent);
  /* fallback first: older OBS CEF (Chrome <111) has no color-mix */
  box-shadow: 0 0 18px rgba(255,106,181,0.4);
  box-shadow: 0 0 18px color-mix(in srgb, var(--pc-accent) 45%, transparent);
  display: flex; align-items: center; justify-content: center;
}
.pc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-avatar.pc-initials span {
  font: 800 22px/1 'Inter', sans-serif; letter-spacing: 0.02em;
  color: #fff;
}
.pc-avatar.pc-initials {
  background: linear-gradient(135deg, hsl(var(--pc-hue, 280), 55%, 38%), hsl(calc(var(--pc-hue, 280) + 40), 60%, 26%));
}

.pc-main { flex: 1; min-width: 0; }
.pc-name {
  font-family: var(--pc-font, 'Inter', sans-serif);
  font-size: 22px; font-weight: 800; line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-name em { font-style: normal; }
.pc-msg {
  margin-top: 4px;
  font-size: 13.5px; font-weight: 500; color: var(--txt-2);
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* first-ever check-in: WELCOME corner ribbon + gradient chip */
.pc-ribbon {
  position: absolute; top: 13px; left: -36px; width: 138px;
  transform: rotate(-45deg);
  background: linear-gradient(90deg, var(--pc-accent), var(--teal));
  color: #14060e;
  font: 800 10px/1 'Inter', sans-serif; letter-spacing: 0.14em;
  text-align: center; padding: 5px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  z-index: 4; pointer-events: none;
  animation: pc-ribbon-in 0.5s var(--ease) 0.3s both;
}
@keyframes pc-ribbon-in {
  from { transform: rotate(-45deg) translateY(-44px); opacity: 0; }
  to   { transform: rotate(-45deg) translateY(0); opacity: 1; }
}
.pc-chip-welcome {
  background: linear-gradient(90deg, var(--pc-accent), var(--teal));
  border: 0; color: #14060e; text-shadow: none;
  animation: pc-chip-pop 0.6s var(--ease);
}

/* earned badge chips under the message */
.pc-badges { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.pc-bdg {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 11px; text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.pc-bdg i { font-style: normal; font-size: 11.5px; }
.pc-bdg b { font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.pc-bdg-t1 { border-color: rgba(205,127,80,0.75); background: rgba(205,127,80,0.16); }
.pc-bdg-t2 { border-color: rgba(201,209,227,0.75); background: rgba(201,209,227,0.14); }
.pc-bdg-t3 { border-color: rgba(245,197,66,0.8); background: rgba(245,197,66,0.16); box-shadow: 0 0 8px rgba(245,197,66,0.25); }
.pc-bdg-t4 {
  border-color: transparent;
  background:
    linear-gradient(rgba(13,15,23,0.75), rgba(13,15,23,0.75)) padding-box,
    linear-gradient(120deg, #5bff95, #2dd4bf, #9a82ff, #ff6ab5) border-box;
  border: 1px solid transparent;
  box-shadow: 0 0 10px rgba(154,130,255,0.35);
}

.pc-streak { flex: 0 0 auto; text-align: center; padding-left: 6px; }
.pc-flame {
  display: flex; align-items: center; gap: 4px; justify-content: center;
}
.pc-flame i { font-style: normal; font-size: 24px; filter: drop-shadow(0 2px 6px rgba(251,146,60,0.5)); }
.pc-flame b {
  font: 800 32px/1 'Inter', sans-serif; font-variant-numeric: tabular-nums;
  color: var(--pc-accent);
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,0.55), 0 0 22px color-mix(in srgb, var(--pc-accent) 55%, transparent);
}
.pc-sub {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--txt-3); margin-top: 3px; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pc-dup .pc-flame i { filter: grayscale(0.85) opacity(0.7); }
.pc-dup .pc-flame b { color: var(--txt-3); text-shadow: none; }

/* ── Punch-row strip: the coffee-shop punch card (7 punches / page),
   mirroring the Discord check-in embed. Newest punch slams in. ── */
.pc-punch-strip {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
}
.pc-punch-row { display: flex; align-items: center; gap: 6px; }
.pc-punch-cell {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
}
.pc-punch-cell.stamped {
  border-style: solid;
  border-color: color-mix(in srgb, var(--pc-accent) 55%, transparent);
  background: rgba(0,0,0,0.38);
  box-shadow: 0 0 10px -3px var(--pc-accent);
}
.pc-punch-cell img { width: 20px; height: 20px; object-fit: contain; }
.pc-punch-cell.pc-stamp-new {
  animation: pc-stamp-in 0.55s cubic-bezier(0.22, 1.4, 0.36, 1) 0.5s both;
}
@keyframes pc-stamp-in {
  0%   { transform: scale(2.3) rotate(-14deg); opacity: 0; }
  55%  { transform: scale(0.88) rotate(3deg); opacity: 1; }
  78%  { transform: scale(1.1) rotate(-1deg); }
  100% { transform: scale(1) rotate(0); }
}
.pc-punch-label {
  font: 700 9.5px/1 'Inter', sans-serif; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--txt-3); white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .pc-punch-cell.pc-stamp-new { animation: none; }
}

.pc-foot {
  position: relative; display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.pc-chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.12);
  background: color-mix(in srgb, var(--pc-accent) 18%, transparent);
  border: 1px solid rgba(255,255,255,0.3);
  border: 1px solid color-mix(in srgb, var(--pc-accent) 45%, transparent);
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.pc-chip-milestone {
  background: linear-gradient(90deg, var(--pc-accent), var(--teal));
  border: 0; color: #0b0714; text-shadow: none;
  animation: pc-chip-pop 0.6s var(--ease);
}
.pc-chip-freeze {
  background: rgba(125,211,252,0.18);
  border-color: rgba(125,211,252,0.5);
  animation: pc-chip-pop 0.6s var(--ease);
}
.pc-chip-first {
  background: rgba(91,255,149,0.15);
  border-color: rgba(91,255,149,0.45);
}
.pc-total {
  font-size: 11px; font-weight: 600; color: var(--txt-3);
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.pc-brand {
  margin-left: auto;
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em;
  background: linear-gradient(90deg, var(--pc-accent), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- per-font fit tweaks ---- */
.pc-font-pressstart .pc-name { font-size: 14px; line-height: 1.4; }
.pc-font-bangers .pc-name { font-size: 26px; letter-spacing: 0.04em; }
.pc-font-pacifico .pc-name { font-size: 21px; }
.pc-font-caveat .pc-name { font-size: 27px; }
.pc-font-oswald .pc-name { font-size: 23px; letter-spacing: 0.02em; }

/* ---- the punch moment ---- */
.pc-punch {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  --hx: 60%;                      /* where the punch lands */
  --pc-paccent: var(--pc-accent);
}
/* card recoil at impact */
.pc-punching { animation: pc-recoil 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes pc-recoil {
  0% { transform: translateY(0) scale(1) rotate(0); }
  12% { transform: translateY(8px) scale(0.955) rotate(-1.1deg); }
  28% { transform: translateY(-5px) scale(1.035) rotate(1.3deg); }
  46% { transform: translateY(3px) scale(0.99) rotate(-0.7deg); }
  64% { transform: translateY(-2px) rotate(0.4deg); }
  82% { transform: translateY(1px) rotate(-0.2deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}
/* the hole every punch leaves (laser keeps it glowing for a beat) */
.pc-hole {
  position: absolute; left: var(--hx); top: 7px; transform: translateX(-50%);
  width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #04050a 55%, #131524 100%);
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.85), 0 0 0 2px rgba(255,255,255,0.22);
  opacity: 0;
  animation: pc-hole-in 0.12s ease-out both;
}
@keyframes pc-hole-in {
  from { opacity: 0; transform: translateX(-50%) scale(0.4); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}
.pc-hole-hot { animation: pc-hole-in 0.12s ease-out both, pc-hole-cool 1.2s ease-out both; }
@keyframes pc-hole-cool {
  0% { box-shadow: inset 0 2px 3px rgba(0,0,0,0.85), 0 0 0 2px rgba(45,212,191,0.9), 0 0 16px rgba(45,212,191,0.8); }
  100% { box-shadow: inset 0 2px 3px rgba(0,0,0,0.85), 0 0 0 2px rgba(255,255,255,0.22); }
}
/* impact ring */
.pc-pring {
  position: absolute; left: var(--hx); top: 13px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--pc-paccent);
  transform: translate(-50%, -50%) scale(0.3); opacity: 0;
  animation: pc-pring 0.5s var(--ease) both;
}
@keyframes pc-pring {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1.9); opacity: 0; }
}
/* impact flash + anticipation shadow, shared */
.pc-flash {
  position: absolute; left: var(--hx); top: 13px;
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0) 65%);
  transform: translate(-50%, -50%) scale(0.3); opacity: 0;
  animation: pc-flash 0.22s ease-out both;
}
@keyframes pc-flash {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
}
.pc-pshadow {
  position: absolute; left: var(--hx); top: 9px;
  width: 30px; height: 9px; border-radius: 50%;
  background: rgba(0,0,0,0.45); filter: blur(2px);
  transform: translate(-50%, 0) scale(0.25); opacity: 0;
  animation: pc-pshadow 0.62s cubic-bezier(0.5, 0, 0.6, 1) both;
}
@keyframes pc-pshadow {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.25); }
  38% { opacity: 0.7; transform: translate(-50%, 0) scale(1); }
  60% { opacity: 0.7; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 0) scale(0.4); }
}
/* classic: the mechanical puncher head, with squash on impact */
.pc-puncher {
  position: absolute; left: var(--hx); top: 0; transform: translate(-50%, -52px);
  width: 26px; height: 30px; border-radius: 6px 6px 11px 11px;
  background: linear-gradient(180deg, #d7dcec 0%, #9aa2bd 55%, #6f7793 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 3px 8px rgba(0,0,0,0.45);
  animation: pc-pdrop 0.62s cubic-bezier(0.5, 0, 0.6, 1) both;
}
.pc-puncher::after {
  content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
  width: 14px; height: 7px; border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #565d75, #3a4054);
}
@keyframes pc-pdrop {
  0% { transform: translate(-50%, -52px) scaleY(1); }
  34% { transform: translate(-50%, -46px) scaleY(1.06); }  /* hang + stretch */
  46% { transform: translate(-50%, -8px) scaleY(0.84); }   /* impact squash */
  56% { transform: translate(-50%, -11px) scaleY(1.02); }  /* rebound */
  100% { transform: translate(-50%, -52px) scaleY(1); }
}
/* paper crumbs bursting from the hole */
.pc-bit {
  position: absolute; left: var(--hx); top: 12px;
  width: 5px; height: 4px; border-radius: 1.5px;
  background: #e9edf8; opacity: 0;
  animation: pc-bit 0.66s cubic-bezier(0.25, 0.4, 0.6, 1) both;
}
.pc-bit-1 { --bx: -26px; --by: 26px; --br: -260deg; }
.pc-bit-2 { --bx: 14px;  --by: 34px; --br: 200deg; animation-duration: 0.74s; }
.pc-bit-3 { --bx: 30px;  --by: 18px; --br: 320deg; animation-duration: 0.6s; }
@keyframes pc-bit {
  0% { opacity: 1; transform: translate(-50%, 0) rotate(0deg); }
  30% { opacity: 1; transform: translate(calc(-50% + var(--bx) * 0.6), -10px) rotate(calc(var(--br) * 0.4)); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--bx)), var(--by)) rotate(var(--br)); }
}
/* the punched-out paper chad, tumbling away */
.pc-chad {
  position: absolute; left: var(--hx); top: 12px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #e9edf8; box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  opacity: 0;
  animation: pc-chad 0.8s cubic-bezier(0.3, 0.2, 0.7, 1) both;
}
@keyframes pc-chad {
  0% { opacity: 1; transform: translate(-50%, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(26px, 64px) rotate(420deg) scale(0.8); }
}
/* stamp: handle slams in, ink stays */
.pc-stamp {
  position: absolute; left: var(--hx); top: -6px; transform: translate(-50%, -52px) rotate(-14deg);
  width: 30px; height: 26px; border-radius: 6px;
  background: linear-gradient(180deg, #b07a4f 0%, #8a5a36 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.45);
  animation: pc-stampdrop 0.66s cubic-bezier(0.5, 0, 0.6, 1) both;
}
.pc-stamp::before {
  content: ''; position: absolute; left: 50%; top: -12px; transform: translateX(-50%);
  width: 12px; height: 14px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #c98f60, #9a6a42);
}
.pc-stamp::after {
  content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
  width: 34px; height: 7px; border-radius: 3px;
  background: var(--pc-paccent); opacity: 0.9;
}
@keyframes pc-stampdrop {
  0% { transform: translate(-50%, -52px) rotate(-14deg); }
  18% { transform: translate(-50%, -46px) rotate(-9deg); }   /* hover wiggle */
  30% { transform: translate(-50%, -48px) rotate(-16deg); }
  44% { transform: translate(-50%, -6px) rotate(0deg) scaleY(0.88); }  /* slam squash */
  56% { transform: translate(-50%, -9px) rotate(0deg) scaleY(1); }
  100% { transform: translate(-50%, -52px) rotate(8deg); }
}
/* ink droplets spraying from the slam */
.pc-drip {
  position: absolute; left: var(--hx); top: 12px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--pc-paccent); opacity: 0;
  animation: pc-drip 0.55s cubic-bezier(0.25, 0.4, 0.6, 1) both;
}
.pc-drip-1 { --dx: -22px; --dy: 18px; }
.pc-drip-2 { --dx: 18px;  --dy: 24px; animation-duration: 0.62s; }
.pc-drip-3 { --dx: 6px;   --dy: -14px; animation-duration: 0.48s; }
@keyframes pc-drip {
  0% { opacity: 0.95; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), var(--dy)) scale(0.5); }
}
.pc-ink-ghost {
  opacity: 0;
  animation: pc-ghost-in 0.16s ease-out both;
  margin-top: 2px; margin-left: 1.5px;
}
@keyframes pc-ghost-in {
  0% { opacity: 0; }
  100% { opacity: 0.28; }
}
.pc-ink {
  position: absolute; left: var(--hx); top: 2px; transform: translateX(-50%) rotate(-10deg);
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--pc-paccent);
  color: var(--pc-paccent);
  font: 800 13px/17px 'Inter', sans-serif; text-align: center;
  opacity: 0;
  animation: pc-ink-in 0.18s ease-out both;
}
@keyframes pc-ink-in {
  0% { opacity: 0; transform: translateX(-50%) rotate(-10deg) scale(1.6); }
  100% { opacity: 0.92; transform: translateX(-50%) rotate(-10deg) scale(1); }
}
/* fist bump */
.pc-fist {
  position: absolute; left: var(--hx); top: -4px; transform: translateX(-50%) scale(2.4);
  font-size: 26px; line-height: 1; opacity: 0;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
  animation: pc-fist 0.55s var(--ease) both;
}
@keyframes pc-fist {
  0% { opacity: 0; transform: translateX(-50%) scale(2.6) rotate(-24deg); filter: blur(0); }
  22% { opacity: 1; transform: translateX(-50%) scale(2.45) rotate(-28deg); filter: blur(0); }  /* wind-up */
  34% { opacity: 1; transform: translateX(-50%) scale(1.4) rotate(-10deg); filter: blur(2.5px); } /* travel blur */
  40%, 58% { opacity: 1; transform: translateX(-50%) scale(0.92) rotate(0deg); filter: blur(0); } /* impact */
  100% { opacity: 0; transform: translateX(-50%) scale(1.2) rotate(8deg); filter: blur(0); }
}
.pc-pring-2 { border-width: 1.5px; animation-duration: 0.6s; }
/* ✦ stars + hairline cracks from the hit */
.pc-spark {
  position: absolute; left: var(--hx); top: 12px;
  color: #ffe9b8; font-size: 11px; line-height: 1; opacity: 0;
  text-shadow: 0 0 6px rgba(255,212,122,0.9);
  animation: pc-spark 0.6s ease-out both;
}
.pc-spark-1 { --sx: -28px; --sy: -16px; }
.pc-spark-2 { --sx: 24px;  --sy: -20px; animation-duration: 0.68s; }
.pc-spark-3 { --sx: -16px; --sy: 22px; animation-duration: 0.55s; }
.pc-spark-4 { --sx: 30px;  --sy: 14px; animation-duration: 0.72s; }
@keyframes pc-spark {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.5) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--sx)), var(--sy)) scale(1.2) rotate(120deg); }
}
.pc-crack {
  position: absolute; left: var(--hx); top: 13px;
  width: 16px; height: 1.5px; border-radius: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.75), rgba(255,255,255,0));
  transform-origin: 0 50%; opacity: 0;
  animation: pc-crack 0.7s ease-out both;
}
.pc-crack-1 { transform: rotate(-160deg); }
.pc-crack-2 { transform: rotate(-15deg); }
.pc-crack-3 { transform: rotate(115deg); }
@keyframes pc-crack {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}
/* laser: charge glow builds, beam fires, hole smokes + molten rim spins */
.pc-charge {
  position: absolute; left: var(--hx); top: 13px;
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle, rgba(125,243,227,0.9) 0%, rgba(45,212,191,0) 70%);
  transform: translate(-50%, -50%) scale(0.2); opacity: 0;
  animation: pc-charge 0.42s ease-in both;
}
@keyframes pc-charge {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  70% { opacity: 0.9; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}
.pc-smoke {
  position: absolute; left: var(--hx); top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(180,190,210,0.4); filter: blur(4px);
  transform: translate(-50%, 0) scale(0.5); opacity: 0;
  animation: pc-smoke 1.1s ease-out both;
}
@keyframes pc-smoke {
  0% { opacity: 0.7; transform: translate(-50%, 0) scale(0.5); }
  100% { opacity: 0; transform: translate(calc(-50% + 8px), -30px) scale(1.6); }
}
.pc-hole-hot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(125,243,227,0.9), rgba(255,212,122,0.6), rgba(125,243,227,0) 40%, rgba(125,243,227,0.9));
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 60%, #000 100%);
  mask: radial-gradient(circle, transparent 55%, #000 60%, #000 100%);
  animation: pc-molten 1.1s linear both;
}
@keyframes pc-molten {
  0% { transform: rotate(0deg); opacity: 1; }
  100% { transform: rotate(300deg); opacity: 0; }
}
.pc-beam {
  position: absolute; left: var(--hx); top: -8px; transform: translateX(-50%);
  width: 3px; height: 24px; border-radius: 2px;
  background: linear-gradient(180deg, rgba(45,212,191,0) 0%, #7df3e3 30%, #2dd4bf 100%);
  box-shadow: 0 0 10px rgba(45,212,191,0.9);
  opacity: 0;
  animation: pc-beam 0.5s steps(6) both;
}
@keyframes pc-beam {
  0% { opacity: 0; }
  20% { opacity: 1; }
  35% { opacity: 0.4; }
  50% { opacity: 1; }
  80% { opacity: 0.85; }
  100% { opacity: 0; }
}
.pc-ember {
  position: absolute; left: var(--hx); top: 12px;
  width: 4px; height: 4px; border-radius: 50%;
  background: #7df3e3; box-shadow: 0 0 6px rgba(45,212,191,0.9);
  opacity: 0;
  animation: pc-ember 0.9s ease-out both;
}
.pc-ember-b { background: #ffd47a; box-shadow: 0 0 6px rgba(255,194,112,0.9); }
@keyframes pc-ember {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--ex, 10px)), -26px); }
}
.pc-ember-a { --ex: -12px; }
.pc-ember-b { --ex: 4px; }
.pc-ember-c { --ex: 16px; }

/* ---- viewer cosmetics ---- */
.pc-name-accent span { color: var(--pc-accent); }
.pc-name-gradient span, .pc-name-rainbow span {
  background-clip: text; -webkit-background-clip: text; color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.55));
}
.pc-name-gradient span { background-image: linear-gradient(90deg, var(--pc-accent), var(--teal)); }
.pc-name-rainbow span {
  background-image: linear-gradient(90deg, #ff6b6b, #ffc270, #5bff95, #2dd4bf, #9a82ff, #ff6ab5, #ff6b6b);
  background-size: 300% 100%;
  animation: pc-rainbow 4s linear infinite;
}
@keyframes pc-rainbow {
  0% { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}

.pc-texture { position: absolute; inset: 0; pointer-events: none; }
.pc-tex-dots {
  background-image: radial-gradient(rgba(255,255,255,0.08) 1.2px, transparent 1.3px);
  background-size: 14px 14px;
}
.pc-tex-scan {
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.05) 3px 4px);
}
.pc-tex-sparkle {
  background-image:
    radial-gradient(circle at 18% 30%, rgba(255,255,255,0.5) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 64% 70%, rgba(255,255,255,0.4) 0 1.2px, transparent 2.2px),
    radial-gradient(circle at 84% 22%, rgba(255,255,255,0.45) 0 1.4px, transparent 2.4px),
    radial-gradient(circle at 38% 80%, rgba(255,255,255,0.35) 0 1px, transparent 2px),
    radial-gradient(circle at 50% 14%, rgba(255,255,255,0.4) 0 1.2px, transparent 2.2px);
  animation: pc-twinkle 2.6s ease-in-out infinite alternate;
}
@keyframes pc-twinkle {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

/* Holo foil: earned at the gold ring (100 day best), viewer-toggled. */
.pc-holo {
  position: absolute; inset: 0; pointer-events: none;
  overflow: hidden;
  mix-blend-mode: color-dodge;
}
/* The foil rides a 300%-wide child that slides on transform (GPU composite).
   Animating background-position on this full-card blended layer forced a
   per-frame repaint; the transform sweep looks the same and stays smooth. */
.pc-holo::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 300%;
  background: linear-gradient(115deg,
    rgba(255,107,107,0.0) 18%, rgba(255,194,112,0.14) 30%, rgba(91,255,149,0.14) 42%,
    rgba(45,212,191,0.14) 54%, rgba(154,130,255,0.16) 66%, rgba(255,106,181,0.14) 78%,
    rgba(255,106,181,0.0) 90%);
  will-change: transform;
  animation: pc-holo-sweep 4.5s var(--ease) infinite;
}
@keyframes pc-holo-sweep {
  0% { transform: translate3d(0, 0, 0); }
  60%, 100% { transform: translate3d(-66.667%, 0, 0); }
}

.pc-avatar.pc-av-squircle { border-radius: 26%; }
.pc-avatar.pc-av-squircle img { border-radius: 0; }
.pc-avatar.pc-av-hex {
  border-radius: 0; border: 0;
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  filter: drop-shadow(0 0 10px var(--pc-accent));
}

/* Viewer-picked entrance animations (slide stays the anchor-aware
   default defined further down). */
.pc-in-pop { animation: pc-pop 0.55s var(--ease) both; }
.pc-in-flip { animation: pc-flip 0.65s var(--ease) both; }
.pc-in-drop { animation: pc-drop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes pc-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pc-flip {
  0% { transform: perspective(900px) rotateY(95deg); opacity: 0; }
  100% { transform: perspective(900px) rotateY(0deg); opacity: 1; }
}
@keyframes pc-drop {
  0% { transform: translateY(-220px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---- emotes + platform chips ---- */
.pc-badge-emote { width: 24px; height: 24px; object-fit: contain; vertical-align: -5px; margin-left: 7px; }
.pc-msg-emote { height: 22px; vertical-align: -6px; margin: 0 1px; }
.pc-plat {
  display: inline-flex; width: 18px; height: 18px; border-radius: 5px;
  align-items: center; justify-content: center; margin-right: 7px;
  vertical-align: -2px; color: #fff; flex: 0 0 auto;
}
.pc-plat svg { width: 12px; height: 12px; }
.pc-plat-youtube { background: #ff0000; }
.pc-plat-kick { background: #53fc18; color: #0b0f06; }
.pc-plat-tiktok { background: linear-gradient(135deg, #25f4ee 0%, #fe2c55 100%); }

/* ---- sub tier effects (stack on top of viewer customization) ----
   T1: soft silver sheen sweep. T2: gold sheen, faster. T3: iridescent
   sweep + persistent aura. drop-shadow (not box-shadow) so earned-ring
   glows still compose. The sheen sweeps OVER content by design. */
.pc-sub-1::before, .pc-sub-2::before, .pc-sub-3::before {
  content: ''; position: absolute; top: -20%; bottom: -20%; left: -30%; width: 34%;
  transform: skewX(-18deg) translateX(-180%);
  pointer-events: none; z-index: 2;
}
.pc-sub-1::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
  animation: pc-sheen 5.2s var(--ease) infinite;
}
.pc-sub-2::before {
  background: linear-gradient(90deg, transparent, rgba(245,197,66,0.17), transparent);
  animation: pc-sheen 4.2s var(--ease) infinite;
}
.pc-sub-3::before {
  background: linear-gradient(90deg, transparent,
    rgba(45,212,191,0.12), rgba(154,130,255,0.18), rgba(255,106,181,0.12), transparent);
  animation: pc-sheen 3.4s var(--ease) infinite;
}
.pc-sub-3 { filter: drop-shadow(0 0 14px rgba(154,130,255,0.35)); }

/* Subscriber bigger cards (streamer opt-in), scaled up by tier. The
   entrance animation plays, then the card settles at this size. */
.pc-big-1 { transform: scale(1.05); }
.pc-big-2 { transform: scale(1.10); }
.pc-big-3 { transform: scale(1.16); }

/* Leaderboard rank flair — a medal for the current top 3. */
.pc-rankflair {
  position: absolute; top: -11px; left: 14px;
  font-size: 12px; font-weight: 800; letter-spacing: .2px;
  padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(135deg, #ffd86b, #ff9d3c);
  color: #1a1205; box-shadow: 0 4px 14px rgba(255,170,60,0.45);
  z-index: 5; white-space: nowrap;
}
.pc-rank-2 { background: linear-gradient(135deg, #e8edf5, #aab6c6); color: #1a2230; }
.pc-rank-3 { background: linear-gradient(135deg, #f0b27a, #c47b43); color: #fff; }

/* Loyalty banner — total-check-in milestone / anniversary. */
.pc-loyal {
  position: absolute; top: -11px; right: 14px;
  font-size: 12px; font-weight: 800; letter-spacing: .3px;
  padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(135deg, #c084fc, #f0abfc);
  color: #1a0a25; box-shadow: 0 4px 14px rgba(192,132,252,0.45);
  z-index: 5; white-space: nowrap;
}
@keyframes pc-sheen {
  0% { transform: skewX(-18deg) translateX(-180%); }
  55%, 100% { transform: skewX(-18deg) translateX(620%); }
}

/* ---- earned rings (best streak, permanent) ---- */
.pc-ring-bronze { border-color: rgba(205,127,80,0.65); }
.pc-ring-silver { border-color: rgba(201,209,227,0.7); }
.pc-ring-gold   { border-color: rgba(245,197,66,0.75); box-shadow: 0 10px 40px rgba(0,0,0,0.45), 0 0 24px rgba(245,197,66,0.22); }
.pc-ring-bronze::after, .pc-ring-silver::after, .pc-ring-gold::after, .pc-ring-aurora::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: 1.5px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.pc-ring-bronze::after { background: linear-gradient(135deg, #cd7f50, #8a4f2d); }
.pc-ring-silver::after { background: linear-gradient(135deg, #e7ecf7, #97a1b8); }
.pc-ring-gold::after   { background: linear-gradient(135deg, #ffe18a, #d9a514); }
.pc-ring-aurora::after {
  background: linear-gradient(120deg, #5bff95, #2dd4bf, #9a82ff, #ff6ab5, #5bff95);
  background-size: 300% 300%;
  animation: pc-aurora 5s linear infinite;
}
@keyframes pc-aurora {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ---- enter / exit ---- */
.pc-anim-in { animation: pc-in 0.55s var(--ease) both; }
.pc-anim-out { animation: pc-out 0.4s ease-in both; }
#pc-stage[data-anchor="br"] .pc-anim-in, #pc-stage[data-anchor="tr"] .pc-anim-in { --pc-from: translateX(130%); }
#pc-stage[data-anchor="bl"] .pc-anim-in, #pc-stage[data-anchor="tl"] .pc-anim-in { --pc-from: translateX(-130%); }
#pc-stage[data-anchor="bc"] .pc-anim-in { --pc-from: translateY(160%); }
#pc-stage[data-anchor="tc"] .pc-anim-in { --pc-from: translateY(-160%); }
#pc-stage[data-anchor="br"] .pc-anim-out, #pc-stage[data-anchor="tr"] .pc-anim-out { --pc-to: translateX(130%); }
#pc-stage[data-anchor="bl"] .pc-anim-out, #pc-stage[data-anchor="tl"] .pc-anim-out { --pc-to: translateX(-130%); }
#pc-stage[data-anchor="bc"] .pc-anim-out { --pc-to: translateY(160%); }
#pc-stage[data-anchor="tc"] .pc-anim-out { --pc-to: translateY(-160%); }
@keyframes pc-in {
  from { transform: var(--pc-from, translateX(130%)); opacity: 0; }
  to   { transform: translate(0, 0); opacity: 1; }
}
@keyframes pc-out {
  from { transform: translate(0, 0); opacity: 1; }
  to   { transform: var(--pc-to, translateX(130%)); opacity: 0; }
}
@keyframes pc-chip-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Milestone glow rides WITH whichever entrance the viewer picked. */
.pc-milestone.pc-anim-in { animation: pc-in 0.55s var(--ease) both, pc-glow 1.6s var(--ease) 0.4s; }
.pc-milestone.pc-in-pop { animation: pc-pop 0.55s var(--ease) both, pc-glow 1.6s var(--ease) 0.4s; }
.pc-milestone.pc-in-flip { animation: pc-flip 0.65s var(--ease) both, pc-glow 1.6s var(--ease) 0.45s; }
.pc-milestone.pc-in-drop { animation: pc-drop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both, pc-glow 1.6s var(--ease) 0.45s; }
@keyframes pc-glow {
  0%, 100% { box-shadow: 0 10px 40px rgba(0,0,0,0.45); }
  35% { box-shadow: 0 10px 46px rgba(0,0,0,0.4), 0 0 60px rgba(255,106,181,0.55); }
}

/* ---- confetti ---- */
.pc-confetti { position: absolute; inset: -40px 0 0; pointer-events: none; overflow: visible; }
.pc-confetti i {
  position: absolute; top: 0; width: 8px; height: 12px; border-radius: 2px;
  animation: pc-fall var(--d, 1.8s) ease-in var(--w, 0s) both;
  transform-origin: center; will-change: transform, opacity;
}
@keyframes pc-fall {
  from { transform: translateY(-30px) rotate(0deg); opacity: 1; }
  to   { transform: translateY(240px) rotate(var(--r, 540deg)); opacity: 0; }
}

/* ---- connection toast ---- */
#pc-toast {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(13,15,23,0.92); border: 1px solid var(--bdr-2);
  color: var(--txt-2); font: 600 12px/1.4 'Inter', sans-serif;
  padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  opacity: 0; transition: opacity 0.3s var(--ease);
  pointer-events: none; max-width: 80vw; text-align: center;
}
#pc-toast.show { opacity: 1; }
#pc-toast .err { color: var(--warn); }

/* ---- feature-expansion cosmetics ---- */
.pc-crown {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(90deg, #ffcf45, #ff9e2c); color: #2a1800;
  font: 800 10px/1 'Inter', sans-serif; letter-spacing: 0.12em;
  padding: 4px 11px; border-radius: 999px; white-space: nowrap; z-index: 6;
  box-shadow: 0 2px 16px rgba(255, 200, 60, 0.6);
}
.pc-crowned { box-shadow: 0 0 0 2px rgba(255, 207, 69, 0.85), 0 12px 44px rgba(0, 0, 0, 0.42); }
.pc-frame-gold { box-shadow: inset 0 0 0 2px #ffcf45, 0 8px 32px rgba(0, 0, 0, 0.36); }
.pc-frame-neon { box-shadow: inset 0 0 0 2px var(--pc-accent, #ff6ab5), 0 0 20px var(--pc-accent, #ff6ab5); }
.pc-frame-retro { box-shadow: 5px 5px 0 0 var(--pc-accent, #ff6ab5), inset 0 0 0 2px #0b0b12; }
.pc-frame-holo { box-shadow: inset 0 0 0 2px #2dd4bf, inset 0 0 16px rgba(167, 139, 250, 0.5), 0 8px 32px rgba(0, 0, 0, 0.36); }
.pc-name-glow { text-shadow: 0 0 8px var(--pc-accent, #ff6ab5), 0 0 18px var(--pc-accent, #ff6ab5); }
.pc-tex-grid { background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px); background-size: 16px 16px; }
.pc-tex-noise { background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px); background-size: 4px 4px; opacity: 0.6; }
.pc-av-star { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); border-radius: 0 !important; }
@keyframes pc-zoom-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
.pc-in-zoom { animation: pc-zoom-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* live Twitch chat badges next to the name */
.pc-tbadges { display: inline-flex; align-items: center; gap: 3px; margin: 0 5px; vertical-align: middle; }
.pc-tbadge { width: 18px; height: 18px; border-radius: 3px; display: block; }
/* the viewer's emote raining like confetti on check-in */
.pc-emote-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 7; }
.pc-emote-confetti img {
  position: absolute; top: -12%; width: 34px; height: 34px; object-fit: contain;
  will-change: transform, opacity;
  animation: pc-emote-fall var(--d, 1.6s) cubic-bezier(0.3, 0.5, 0.5, 1) var(--w, 0s) forwards;
}
/* transform-only (GPU composite) — animating `top` thrashed layout every frame. */
@keyframes pc-emote-fall {
  0% { opacity: 0; transform: translateY(0) translateX(0) rotate(0) scale(var(--s, 1)); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translateY(300px) translateX(var(--x, 0)) rotate(var(--r, 180deg)) scale(var(--s, 1)); }
}

/* Reduced-motion: neutralize the always-on ambient cosmetic loops. The
   punch + stamp celebration has its own guard above; this scopes only the
   perpetual sheen/holo/aurora/rainbow/twinkle so motion-sensitive viewers
   get a calm card without touching the one-shot check-in choreography. */
@media (prefers-reduced-motion: reduce) {
  .pc-name-rainbow span,
  .pc-tex-sparkle,
  .pc-holo::before,
  .pc-sub-1::before,
  .pc-sub-2::before,
  .pc-sub-3::before,
  .pc-ring-aurora::after {
    animation: none !important;
  }
}
