/* TapTrade visual effects: pets that pop out of their cards, rarity tiers,
   mystery-pet silhouettes and page motion. Loaded after every page stylesheet. */

/* ---------- Mystery-pet silhouettes (pets without a picture) ---------- */
.art.no-img .art-ph {
  width: 74%; aspect-ratio: 1; border-radius: 0;
  background: none; box-shadow: none;
}
.art-sil { width: 100%; height: 100%; overflow: visible; }
.art-sil .sil-body {
  fill: #07090f;
  stroke: color-mix(in srgb, var(--rc) 55%, transparent);
  stroke-width: 0.9;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--rc) 45%, transparent));
}
.art-sil .sil-q {
  font: 800 20px/1 var(--font-display);
  fill: color-mix(in srgb, var(--rc) 55%, #fff);
  opacity: 0.85;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--rc) 70%, transparent));
}
.art.no-img .art-inner::before { display: none; }

/* ---------- Pets break out of their cards ---------- */
.grid { row-gap: 40px; padding-top: 26px; }
/* room inside the scrolling rails for pets that pop out and for glows, so nothing gets clipped */
.rail { padding: 34px 18px 36px; margin: -30px -18px -32px; scroll-padding: 0 18px; }
.pet-card.has-pic .pc-tile .art-inner { overflow: visible; }
.pet-card.has-pic .pc-tile .art-inner img {
  inset: auto; left: -4%; top: -26%;
  width: 108%; height: 108%;
  padding: 2%;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.6));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.2), filter 0.35s ease;
  will-change: transform;
}
/* soft coloured glow pooled under the pet */
.pet-card.has-pic .pc-tile::after {
  content: ''; position: absolute; z-index: 1; pointer-events: none;
  left: 14%; right: 14%; bottom: 8%; height: 26%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rc) 70%, transparent), transparent);
  filter: blur(10px); opacity: 0.75;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.pet-card.has-pic .pc-tile .art-inner img { z-index: 3; }
.pet-card.has-pic .pc-tile .vtag { z-index: 4; }
.pet-card:hover { transform: translateY(-3px); }
.pet-card.has-pic:hover .pc-tile .art-inner img {
  transform: translateY(-8px) scale(1.08);
  filter: drop-shadow(0 22px 22px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 18px color-mix(in srgb, var(--rc) 45%, transparent));
}
.pet-card.has-pic:hover .pc-tile::after { opacity: 1; transform: scale(1.15); }
/* the earlier hover zoom would double up with the lift */
.pet-card:hover .pc-tile .art-ph { transform: scale(1.04); }

/* ---------- Rarity you can feel ---------- */
/* Secrets and Godly: a quiet glow in the rarity colour */
.pet-card.tier-secret {
  border-color: color-mix(in srgb, var(--rc) 22%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rc) 8%, transparent), 0 18px 40px -26px color-mix(in srgb, var(--rc) 70%, transparent);
}
.pet-card.tier-secret:hover { border-color: color-mix(in srgb, var(--rc) 45%, transparent); }

/* Secret X, Leaderboard, Release: animated shimmering border plus sparkles */
.pet-card.tier-legend { border-color: transparent; isolation: isolate; }
.pet-card.tier-legend::before {
  content: ''; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--ang), color-mix(in srgb, var(--rc) 20%, transparent), var(--rc), #fff, var(--rc), color-mix(in srgb, var(--rc) 20%, transparent) 60%, color-mix(in srgb, var(--rc) 20%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: fx-spin 3.6s linear infinite;
}
.pet-card.tier-legend {
  box-shadow: 0 0 34px -12px color-mix(in srgb, var(--rc) 75%, transparent), 0 20px 44px -28px color-mix(in srgb, var(--rc) 90%, transparent);
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--rc) 12%, transparent), transparent 70%),
    var(--surface);
}
@keyframes fx-spin { to { --ang: 360deg; } }
.fx-spark {
  position: absolute; z-index: 5; width: 12px; aspect-ratio: 1; pointer-events: none;
  background: #fff;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 4px var(--rc)) drop-shadow(0 0 2px #fff);
  animation: fx-twinkle 2.6s ease-in-out infinite;
}
.fx-spark.f1 { top: 10px; left: 12px; }
.fx-spark.f2 { top: 46%; right: 8px; width: 9px; animation-delay: 0.9s; }
.fx-spark.f3 { bottom: 74px; left: 18px; width: 7px; animation-delay: 1.7s; }
@keyframes fx-twinkle { 0%, 100% { opacity: 0; transform: scale(0.3) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(90deg); } }

/* Same tiers on big art tiles (pet page) */
.art.tier-legend { box-shadow: 0 0 60px -14px color-mix(in srgb, var(--rc) 70%, transparent); }
.art.tier-secret { box-shadow: 0 0 44px -18px color-mix(in srgb, var(--rc) 60%, transparent); }

/* ---------- Motion ---------- */
/* Cards and sections fade up as they scroll into view (class added by js/app.js) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }
.grid .pet-card { animation: none; }

/* Rarity bar fills in from the left on load */
.mbar-seg { transform-origin: left center; animation: fx-fill 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.mbar-seg:nth-child(2) { animation-delay: 0.06s; } .mbar-seg:nth-child(3) { animation-delay: 0.12s; }
.mbar-seg:nth-child(4) { animation-delay: 0.18s; } .mbar-seg:nth-child(5) { animation-delay: 0.24s; }
.mbar-seg:nth-child(6) { animation-delay: 0.3s; }  .mbar-seg:nth-child(n + 7) { animation-delay: 0.36s; }
@keyframes fx-fill { from { transform: scaleX(0); opacity: 0.4; } to { transform: scaleX(1); opacity: 1; } }

/* Smooth page changes (View Transitions where supported, a fade-up elsewhere) */
::view-transition-old(root) { animation: fx-out 0.18s ease both; }
::view-transition-new(root) { animation: fx-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes fx-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes fx-in { from { opacity: 0; transform: translateY(10px); } }
.view { animation: fx-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .mbar-seg, .pet-card.tier-legend::before, .fx-spark { animation: none; }
  .fx-spark { opacity: 0.8; }
  .pet-card.has-pic .pc-tile .art-inner img { transition: none; }
}
@media (max-width: 720px) {
  .rail { margin: -30px -16px -32px; padding: 34px 16px 36px; scroll-padding: 0 16px; }
}
/* Pop-out pets and glows near the screen edge must not make the page scroll sideways */
main { overflow-x: clip; }

/* ---------- Sky: drifting starfield and slow light beams behind everything ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky .stars {
  position: absolute; inset: -50% 0 0; opacity: 0.55;
  background-image:
    radial-gradient(1.2px 1.2px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 120px 80px, #cfe2ff, transparent),
    radial-gradient(1.4px 1.4px at 200px 160px, #fff, transparent),
    radial-gradient(1px 1px at 60px 210px, #a9c8ff, transparent),
    radial-gradient(1px 1px at 260px 40px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 300px 250px, #e2ecff, transparent);
  background-size: 320px 280px;
  animation: sky-drift 140s linear infinite;
}
.sky .stars.s2 {
  opacity: 0.35; background-size: 520px 460px;
  animation-duration: 220s; animation-name: sky-drift, sky-twinkle;
  animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite, infinite;
  animation-duration: 220s, 5s; animation-direction: normal, alternate;
}
@keyframes sky-drift { to { transform: translateY(280px); } }
@keyframes sky-twinkle { from { opacity: 0.2; } to { opacity: 0.5; } }
.sky .beam {
  position: absolute; top: -20%; width: 34vw; height: 120vh;
  /* elliptical falloff on every side so no straight edge ever shows */
  background: radial-gradient(50% 60% at 50% 0%, rgba(120, 170, 255, 0.10), rgba(80, 140, 255, 0.035) 50%, transparent 75%);
  filter: blur(40px); transform-origin: top center;
  animation: beam-sway 18s ease-in-out infinite alternate;
}
.sky .b1 { left: 4%; transform: rotate(18deg); }
.sky .b2 { left: 38%; transform: rotate(-6deg); width: 22vw; animation-duration: 24s; opacity: 0.8; }
.sky .b3 { right: 2%; transform: rotate(-20deg); animation-duration: 21s; }
@keyframes beam-sway { from { opacity: 0.55; rotate: -4deg; } to { opacity: 1; rotate: 4deg; } }

/* ---------- Loading screen: wobbling egg that cracks, then fades away ---------- */
.boot {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  background: radial-gradient(600px 400px at 50% 40%, rgba(47, 140, 255, 0.16), transparent 70%), var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot.done .boot-egg svg { animation: egg-pop 0.45s ease-in forwards; }
.boot-egg { position: relative; width: 84px; display: grid; justify-items: center; }
.boot-egg svg { width: 84px; height: auto; transform-origin: 50% 90%; animation: egg-wobble 1.1s ease-in-out infinite; filter: drop-shadow(0 0 22px rgba(47, 140, 255, 0.55)); }
.boot-egg .crack { stroke-dasharray: 90; stroke-dashoffset: 90; animation: egg-crack 1.6s ease-out 0.4s forwards; }
.boot-shadow { width: 60px; height: 10px; margin-top: 6px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent); animation: egg-shadow 1.1s ease-in-out infinite; }
.boot-brand { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.boot-brand .brand-name { font-size: 20px; }
.boot-msg { color: var(--muted); font-size: 13.5px; font-weight: 500; }
@keyframes egg-wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-9deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(2deg); } }
@keyframes egg-shadow { 20%, 60% { transform: scaleX(0.85); } }
@keyframes egg-crack { to { stroke-dashoffset: 0; } }
@keyframes egg-pop { 60% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }

/* ---------- Sound toggle ---------- */
.sound-btn { width: 40px; height: 40px; color: var(--muted); }
.sound-btn svg { width: 19px; height: 19px; }
.sound-btn .snd-on, .sound-btn.on .snd-off { display: none; }
.sound-btn.on .snd-on { display: block; }
.sound-btn.on { color: var(--accent); border-color: rgba(47, 140, 255, 0.4); }

/* ---------- Rarity badges with icons ---------- */
.rarity { gap: 5px; }
.rarity:has(.r-ico)::before { display: none; }
.r-ico { width: 12px; height: 12px; flex-shrink: 0; color: var(--rc); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--rc) 60%, transparent)); }
.rarity.tier-legend {
  color: #fff;
  background: linear-gradient(110deg, color-mix(in srgb, var(--rc) 35%, transparent) 20%, color-mix(in srgb, var(--rc) 70%, #fff) 50%, color-mix(in srgb, var(--rc) 35%, transparent) 80%) 0 0 / 250% 100%;
  border-color: color-mix(in srgb, var(--rc) 70%, transparent);
  animation: pill-shine 3s linear infinite;
}
.rarity.tier-legend .r-ico { color: #fff; }
.rarity.tier-secret { box-shadow: 0 0 12px -3px color-mix(in srgb, var(--rc) 70%, transparent); }
@keyframes pill-shine { to { background-position: -250% 0; } }

@media (prefers-reduced-motion: reduce) {
  .sky .stars, .sky .beam, .boot-egg svg, .boot-shadow, .rarity.tier-legend { animation: none; }
  .boot-egg .crack { animation: none; stroke-dashoffset: 0; }
}

/* Token coin in front of values */
.tok {
  display: inline-block; width: 0.86em; height: 0.86em; margin-right: 0.24em;
  vertical-align: -0.1em; object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(140, 120, 255, 0.45));
}
.val { white-space: nowrap; }
.pd-big .tok { width: 0.62em; height: 0.62em; margin-right: 0.14em; vertical-align: 0.02em; }
.st-val-wrap { display: flex; align-items: center; gap: 10px; }
.st-val-wrap .tok { width: 34px; height: 34px; margin: 0; }
@media (max-width: 520px) { .st-val-wrap .tok { width: 26px; height: 26px; } }

/* ---------- Header brand: pet render icon, name and a Values tag ---------- */
.brand-pet { gap: 10px; }
.brand-icon {
  position: relative; width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
}
.brand-icon::before {
  content: ''; position: absolute; inset: 4px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(47, 140, 255, 0.55), transparent);
  filter: blur(6px);
}
.brand-pet .brand-icon img {
  position: relative; width: 40px; height: 40px; border-radius: 0; object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1.3);
}
.brand-pet:hover .brand-icon img { transform: rotate(-8deg) scale(1.1); }
.brand-pet .brand-name { font-size: 20px; }
.brand-tag {
  font-size: 12px; font-weight: 600; line-height: 1; color: var(--text-2);
  padding: 5px 8px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line-2);
}
@media (max-width: 400px) { .brand-tag { display: none; } }

/* ---------- Card badges: rarity and exist count on the picture ---------- */
.pc-badges {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 4;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  pointer-events: none;
}
.pc-badges .rarity {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-size: 11px; padding: 4px 8px 4px 7px;
  background-color: rgba(10, 14, 24, 0.82);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pc-ex {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(10, 14, 24, 0.82); border: 1px solid var(--line-2);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pc-ex svg { width: 11px; height: 11px; color: var(--muted); }
@media (max-width: 520px) {
  .pc-badges { left: 6px; right: 6px; bottom: 6px; gap: 4px; }
  .pc-badges .rarity, .pc-ex { font-size: 10px; padding: 3px 6px; }
  .pc-badges .rarity .r-ico { width: 10px; height: 10px; }
}

/* Keep the Golden / Rainbow / Diamond tint on pop-out pet images */
.pet-card.has-pic .pc-tile .art.v-golden .art-inner img { filter: sepia(0.85) saturate(2.4) hue-rotate(-12deg) brightness(1.08) contrast(1.05) drop-shadow(0 14px 16px rgba(0, 0, 0, 0.6)); }
.pet-card.has-pic .pc-tile .art.v-diamond .art-inner img { filter: grayscale(1) brightness(0.65) sepia(1) hue-rotate(190deg) saturate(7) contrast(1.2) brightness(1.1) drop-shadow(0 14px 16px rgba(0, 0, 0, 0.6)); }
.pet-card.has-pic .pc-tile .art.v-rainbow .art-inner img { animation: rainbow-hue 6s linear infinite; }
@media (max-width: 720px) { .nav a[data-nav="about"] { display: none; } }

/* =====================================================================
   Polish pass: display-case art tiles, holo foil, card tilt + glare,
   rarity rings, slot-machine numbers. JS side lives in js/fx.js.
   ===================================================================== */

/* ---------- Display case: every art tile is a little lit showcase ---------- */
.art { --glow: 34%; --ray: rgba(255, 255, 255, 0.05); --case-x: linear-gradient(transparent, transparent); }
.art.tier-secret { --glow: 46%; --ray: rgba(255, 255, 255, 0.065); }
.art.tier-legend { --glow: 60%; --ray: rgba(255, 255, 255, 0.09); }
.art .art-inner, .art .art-inner.has-img {
  background:
    var(--case-x),
    /* glossy pedestal: a lit disc with a thin elliptical rim */
    radial-gradient(33% 6.5% at 50% 86%, transparent 86%, rgba(255, 255, 255, 0.16) 94%, transparent 100%),
    radial-gradient(33% 6.5% at 50% 86%, color-mix(in srgb, var(--rc) 26%, rgba(255, 255, 255, 0.07)), transparent),
    /* rarity light pooled behind the pet */
    radial-gradient(56% 50% at 50% 50%, color-mix(in srgb, var(--rc) var(--glow), transparent), color-mix(in srgb, var(--rc) calc(var(--glow) / 4), transparent) 60%, transparent 82%),
    /* spotlight from above */
    radial-gradient(64% 52% at 50% -8%, color-mix(in srgb, var(--rc) 22%, rgba(255, 255, 255, 0.09)), transparent 72%),
    /* soft vignette */
    radial-gradient(125% 100% at 50% 42%, transparent 52%, rgba(0, 0, 0, 0.45)),
    /* the floor: a faint horizon and a glossy reflection of the rarity light */
    radial-gradient(48% 9% at 50% 88%, color-mix(in srgb, var(--rc) calc(var(--glow) / 2), transparent), transparent),
    linear-gradient(180deg, transparent 70%, rgba(255, 255, 255, 0.03) 70.4%, rgba(255, 255, 255, 0.012) 76%, rgba(0, 0, 0, 0.28)),
    linear-gradient(180deg, color-mix(in srgb, var(--rc) 7%, #15171d), #0a0b0f);
}
/* light rays fanning down from the spotlight (static, so it costs nothing per frame) */
.art.lg::after, .pc-tile .art::after, .inv-top-stage .art::after, .cmp-stage .art::after {
  content: ''; position: absolute; inset: 1px; z-index: 1; border-radius: inherit; pointer-events: none;
  background: conic-gradient(at 50% -14%, transparent 0 147deg, var(--ray) 153deg, transparent 159deg 164deg,
    var(--ray) 170deg, transparent 175deg 184deg, var(--ray) 190deg, transparent 195deg 200deg, var(--ray) 206deg, transparent 212deg);
  -webkit-mask: linear-gradient(#000, transparent 80%); mask: linear-gradient(#000, transparent 80%);
}
/* contact shadow sits on the pedestal */
.art-inner::before { left: 28%; right: 28%; bottom: 12%; height: 5%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.7), transparent); }

/* Golden: warm rays and drifting gold dust */
.art.v-golden { --ray: rgba(255, 214, 120, 0.09); --glow: 36%;
  --case-x:
    radial-gradient(1.4cqw 1.4cqw at 18% 30%, rgba(255, 220, 140, 0.8), transparent),
    radial-gradient(0.9cqw 0.9cqw at 80% 22%, rgba(255, 230, 160, 0.6), transparent),
    radial-gradient(1.6cqw 1.6cqw at 74% 58%, rgba(255, 200, 100, 0.35), transparent),
    radial-gradient(1cqw 1cqw at 28% 66%, rgba(255, 236, 180, 0.7), transparent),
    radial-gradient(2.4cqw 2.4cqw at 86% 40%, rgba(255, 196, 80, 0.18), transparent),
    radial-gradient(2cqw 2cqw at 12% 52%, rgba(255, 196, 80, 0.16), transparent),
    radial-gradient(0.7cqw 0.7cqw at 60% 14%, rgba(255, 240, 200, 0.6), transparent);
}
/* Rainbow: a soft prismatic aurora behind the pet */
.art.v-rainbow { --ray: rgba(220, 210, 255, 0.06);
  --case-x:
    radial-gradient(34% 30% at 30% 40%, rgba(240, 86, 111, 0.2), transparent 70%),
    radial-gradient(34% 30% at 70% 38%, rgba(74, 156, 240, 0.22), transparent 70%),
    radial-gradient(36% 28% at 50% 66%, rgba(47, 207, 154, 0.18), transparent 70%),
    radial-gradient(30% 24% at 50% 22%, rgba(236, 210, 92, 0.14), transparent 70%),
    radial-gradient(28% 26% at 82% 62%, rgba(165, 118, 240, 0.2), transparent 70%);
}
/* Diamond: icy facets and frost */
.art.v-diamond { --ray: rgba(200, 240, 255, 0.08);
  --case-x:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.022) 50% 75%, transparent 75%) 0 0 / 22cqw 22cqw,
    repeating-linear-gradient(60deg, rgba(200, 240, 255, 0.025) 0 1px, transparent 1px 9cqw),
    repeating-linear-gradient(-60deg, rgba(200, 240, 255, 0.025) 0 1px, transparent 1px 9cqw),
    radial-gradient(60% 30% at 50% 100%, rgba(170, 230, 255, 0.12), transparent 70%);
}

/* Big pet-page tile: a brighter spotlight and a glossy sheen on the floor in front of the pet */
.art.lg .art-inner::before { left: 26%; right: 26%; bottom: 11.5%; height: 5%; }
.art.lg { --glow: 46%; }
.art.lg.tier-secret { --glow: 58%; }
.art.lg.tier-legend { --glow: 70%; }

/* Pet page: the case itself is premium glass */
.pd .pd-art, .pd-art {
  position: relative;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.012) 36%, color-mix(in srgb, var(--rc) 8%, transparent)),
    radial-gradient(80% 70% at 50% 40%, color-mix(in srgb, var(--rc) 13%, transparent), transparent 70%),
    rgba(12, 16, 27, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    inset 0 -30px 50px -36px color-mix(in srgb, var(--rc) 60%, transparent),
    0 30px 60px -34px rgba(0, 0, 0, 0.8),
    0 0 90px -40px color-mix(in srgb, var(--rc) 70%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
}
.pd-art::before {
  content: ''; position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none;
  background: linear-gradient(118deg, transparent 22%, rgba(255, 255, 255, 0.07) 34%, transparent 46%, transparent 70%, rgba(255, 255, 255, 0.035) 78%, transparent 86%);
}

/* ---------- Holo foil on Rainbow and Diamond art ---------- */
.art.v-rainbow .art-inner::after, .art.v-diamond .art-inner::after {
  content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(circle at var(--mx, 30%) var(--my, 20%), rgba(255, 255, 255, 0.5), transparent 42%),
    repeating-linear-gradient(115deg, #ff5f9e 0%, #ffcf5f 4%, #5fffc1 8%, #5fb8ff 12%, #b45fff 16%, #ff5f9e 20%);
  background-size: 100% 100%, 260% 260%;
  background-position: 0 0, 0% 0%;
  mix-blend-mode: soft-light; opacity: 0.4;
  transition: opacity 0.3s ease;
  animation: foil-drift 10s ease-in-out infinite alternate;
}
.art.v-diamond .art-inner::after {
  background:
    radial-gradient(circle at var(--mx, 30%) var(--my, 20%), rgba(255, 255, 255, 0.55), transparent 42%),
    repeating-linear-gradient(115deg, #e8fbff 0%, #8fe3ff 4%, #c9b8ff 8%, #ffffff 11%, #7fd6ff 15%, #e8fbff 20%);
  background-size: 100% 100%, 260% 260%;
}
@keyframes foil-drift { to { background-position: 0 0, 100% 100%; } }
/* stronger while hovered, and the sheen follows the pointer while the card tilts */
.pet-card:hover .art.v-rainbow .art-inner::after, .pet-card:hover .art.v-diamond .art-inner::after { opacity: 0.75; }
.fx-tilt .art.v-rainbow .art-inner::after, .fx-tilt .art.v-diamond .art-inner::after {
  animation: none; opacity: 0.8;
  background-position: 0 0, var(--mx, 50%) var(--my, 50%);
}

/* ---------- Card tilt with a glare that follows the cursor (desktop mouse only) ---------- */
html.fx-tilt-on .pet-card {
  transition: border-color 0.18s, background 0.18s, opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.9, 0.25, 1);
}
html.fx-tilt-on .pet-card.fx-tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-3px);
  transition-duration: 0.18s, 0.18s, 0.5s, 0.14s;
  transition-timing-function: ease, ease, ease, ease-out;
}
html.fx-tilt-on .pet-card.fx-tilt:active { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(0.985); }
/* the pet floats a little above its tile: it drifts against the tilt */
html.fx-tilt-on .pet-card.has-pic .pc-tile .art-inner img { translate: 0 0; transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.2), filter 0.35s ease, translate 0.6s cubic-bezier(0.2, 0.9, 0.25, 1); }
html.fx-tilt-on .pet-card.has-pic.fx-tilt .pc-tile .art-inner img { translate: calc(var(--px, 0) * 9px) calc(var(--py, 0) * 6px); transition-duration: 0.35s, 0.35s, 0.14s; }
html.fx-tilt-on .pd-art { transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.25, 1); }
html.fx-tilt-on .pd-art.fx-tilt { transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition-duration: 0.14s; }
.fx-glare {
  position: absolute; inset: 0; z-index: 6; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035) 32%, transparent 62%);
  opacity: 0; transition: opacity 0.35s ease;
}
.fx-tilt > .fx-glare { opacity: 1; }

/* ---------- Rarity rings: a slow light that travels round every card ---------- */
/* Two masked rings lit from opposite corners cross-fade, so only opacity animates. */
.pet-card { --ring-max: 0.32; --ring-min: 0.06; --ring-t: 7s; }
.pet-card[data-fxr='mid'] { --ring-max: 0.55; --ring-min: 0.12; --ring-t: 6s; }
.pet-card[data-fxr='hi'] { --ring-max: 0.9; --ring-min: 0.2; --ring-t: 5s; }
.pet-card:not(.tier-legend)::before, .pet-card:not(.tier-legend)::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  background: linear-gradient(155deg, var(--rc), color-mix(in srgb, var(--rc) 30%, transparent) 30%, transparent 55%);
  opacity: var(--ring-max);
}
.pet-card:not(.tier-legend)::after {
  background: linear-gradient(-25deg, var(--rc), color-mix(in srgb, var(--rc) 30%, transparent) 30%, transparent 55%);
  opacity: var(--ring-min);
}
.pet-card[data-fxr='mid']:not(.tier-legend) { box-shadow: 0 16px 34px -28px color-mix(in srgb, var(--rc) 80%, transparent); }
.pet-card[data-fxr='hi']:not(.tier-legend) { box-shadow: 0 0 0 1px color-mix(in srgb, var(--rc) 8%, transparent), 0 0 28px -14px color-mix(in srgb, var(--rc) 70%, transparent), 0 18px 40px -26px color-mix(in srgb, var(--rc) 80%, transparent); }
/* only cards on screen animate (js/fx.js toggles .fx-vis) */
html.fx-io .pet-card.fx-vis:not(.tier-legend)::before { animation: ring-a var(--ring-t) ease-in-out var(--fx-dl, 0s) infinite; }
html.fx-io .pet-card.fx-vis:not(.tier-legend)::after { animation: ring-b var(--ring-t) ease-in-out var(--fx-dl, 0s) infinite; }
@keyframes ring-a { 0%, 100% { opacity: var(--ring-max); } 50% { opacity: var(--ring-min); } }
@keyframes ring-b { 0%, 100% { opacity: var(--ring-min); } 50% { opacity: var(--ring-max); } }
.pet-card:hover:not(.tier-legend)::before, .pet-card:hover:not(.tier-legend)::after { --ring-min: 0.5; --ring-max: 1; }

/* Off-screen cards and rows stop their animations (shimmers, spinning frames, sparkles, rings) */
html.fx-io :is(.pet-card, .pet-row):not(.fx-vis),
html.fx-io :is(.pet-card, .pet-row):not(.fx-vis)::before,
html.fx-io :is(.pet-card, .pet-row):not(.fx-vis) :is(.art, .art-inner img, .fx-spark, .rarity, .spark),
html.fx-io :is(.pet-card, .pet-row):not(.fx-vis) .art-inner::after {
  animation-play-state: paused;
}

/* ---------- Slot-machine numbers (js/fx.js TTApp.roll) ---------- */
.rl { display: inline-block; white-space: nowrap; }
.rl-d { position: relative; display: inline-block; clip-path: inset(0 -0.3em); }
.rl-ph { visibility: hidden; }
.rl-s { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-direction: column; transform: translateY(0); }
.rl-s > span { display: block; }
.rl.go .rl-s { transform: translateY(var(--y)); transition: transform var(--t, 900ms) cubic-bezier(0.14, 0.9, 0.18, 1); }

@media (prefers-reduced-motion: reduce) {
  .art.v-rainbow .art-inner::after, .art.v-diamond .art-inner::after,
  .pet-card:not(.tier-legend)::before, .pet-card:not(.tier-legend)::after { animation: none !important; }
  .fx-glare { display: none; }
}

/* Pull to refresh (installed app only): the logo drops in and spins while reloading */
.ptr {
  --pull: 0px;
  position: fixed; top: 0; left: 50%; z-index: 120; pointer-events: none;
  width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  transform: translateY(calc(var(--pull) - 50px)) rotate(calc(var(--pull) * 2.5deg));
  opacity: 0;
  transition: transform 0.15s ease-out, opacity 0.15s;
}
.ptr img { width: 26px; height: 26px; }
.ptr.ready { border-color: var(--accent); box-shadow: 0 0 18px -4px var(--accent); }
.ptr.loading { --pull: 90px; opacity: 1 !important; animation: ptr-spin 0.7s linear infinite; }
@keyframes ptr-spin { to { transform: translateY(40px) rotate(360deg); } }
