/* Foil is an independent finish, driven by the existing foil flag. */
/* Explicit paint order: arena, lightning, wrestler, foil. Coordinates alone
   cannot protect every pose, especially raised hands and wide arms. */
body .rd-card.rd-arena-card .tfig{isolation:isolate}
body .rd-card.rd-arena-card .tfig .rd-arena-frame{position:absolute;inset:0;z-index:0}
body .rd-card.rd-arena-card .tfig :is(.rd-sumo-silhouette,.rd-person-portrait){z-index:2}
body .rd-card.rd-arena-card.rd-type-epic .tfig::before{z-index:1!important}
body .card-study{isolation:isolate}
body .card-study>img:first-child{position:relative;z-index:0}
body .card-study .silhouette{z-index:2}
body .card-study.epic .lightning{z-index:1!important}
body .card-study :is(.name,.stats){z-index:4}
/* Uncommon is warm, burnished bronze; Rare is bright, cool steel. */
body .rd-card.rd-arena-card.rd-type-uncommon .rd-arena-frame,
body .card-study.uncommon>img:first-child{filter:grayscale(1) sepia(.7) saturate(.85) brightness(.7)!important}
body :is(.rd-card.rd-arena-card,.card-study) .rarity.uncommon{background:linear-gradient(110deg,#493429,#aa7754,#62422e)!important;color:#f6e6d3!important;border-color:#bc916d;text-shadow:0 1px 2px #281b12;clip-path:polygon(0 0,100% 0,100% 80%,95% 100%,5% 100%,0 80%)}
body .rd-card.rd-arena-card.rd-type-rare .rd-arena-frame,
body .card-study.rare>img:first-child{filter:grayscale(1) sepia(.3) hue-rotate(155deg) saturate(1.5) brightness(1.1)!important}
body :is(.rd-card.rd-arena-card,.card-study) .rarity.rare{background:linear-gradient(110deg,#183b50,#b9dfef 48%,#306783)!important;color:#102736!important;border:2px solid #ceeafa;box-shadow:0 2px 8px #0009,inset 0 0 0 1px #355e73!important}
body .card-study:not(.holo) .shine{display:none!important}
body .rd-card.rd-arena-card:not(.rd-foil) .tinner::after{display:none!important}
body .rd-card.rd-arena-card.rd-foil .tinner::after,
body .card-study.holo::after{content:'';display:block!important;position:absolute;inset:3% 4% 24%!important;z-index:3;pointer-events:none;clip-path:none!important;opacity:.55!important;mix-blend-mode:screen;background:repeating-linear-gradient(115deg,transparent 0%,#55eaff77 9%,#aaa5ff88 18%,#ee98c477 27%,#a9edc077 36%,transparent 46%),radial-gradient(circle at 35% 30%,#ffffff88,transparent 40%)!important;background-size:250% 100%!important;animation:holo-travel 5s ease-in-out infinite!important;border-radius:6px}
body .card-study.holo .shine{display:none!important}
body .rd-card.rd-arena-card.rd-type-epic .tfig::before,
body .card-study.epic .silhouette+ .lightning{content:'';display:block;position:absolute;inset:18% 6% 34%;width:auto;height:auto;aspect-ratio:auto;border-radius:0;transform:none;z-index:1;pointer-events:none;background:linear-gradient(100deg,#84dfff,#eefaff,#59b7ff);clip-path:none;-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M7 0L1 28L5 27L0 57L4 55L1 100L10 48L6 50L11 20L7 22Z' fill='%23000'/%3E%3Cpath d='M93 0L99 28L95 27L100 57L96 55L99 100L90 48L94 50L89 20L93 22Z' fill='%23000'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M7 0L1 28L5 27L0 57L4 55L1 100L10 48L6 50L11 20L7 22Z' fill='%23000'/%3E%3Cpath d='M93 0L99 28L95 27L100 57L96 55L99 100L90 48L94 50L89 20L93 22Z' fill='%23000'/%3E%3C/svg%3E");-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;filter:drop-shadow(0 0 5px #58c8ff);opacity:.85;animation:epic-current 3.6s ease-in-out infinite}
body .rd-card.rd-arena-card.rd-type-epic .tfig .rd-sumo-silhouette,
body .card-study.epic .silhouette{filter:grayscale(1) drop-shadow(0 0 10px #60caff)!important}
body :is(.rd-card.rd-arena-card,.card-study) .rarity.epic{background:linear-gradient(100deg,#102638,#246487,#102638)!important;border-color:#85d8ff;color:#e6faff!important;box-shadow:0 0 10px #58c8ff66,inset 0 0 0 2px #102638!important}
body :is(.rd-card.rd-arena-card,.card-study) .rarity.epic::before{content:'ϟ';color:#b6edff}
@keyframes holo-travel{0%,100%{background-position:100% 0}50%{background-position:0 0}}
@keyframes epic-current{0%,100%{opacity:.55}45%{opacity:.95}65%{opacity:.65}}
@media(prefers-reduced-motion:reduce){body .rd-card.rd-arena-card.rd-foil .tinner::after,body .card-study.holo::after,body .rd-card.rd-arena-card.rd-type-epic .tfig::before,body .card-study.epic .lightning{animation:none!important}}
/* Rainbow perimeter echoes the original foil cards; rarity stays in the banner. */
body .rd-card.rd-arena-card.rd-foil::before,body .card-study.holo::before{content:'';position:absolute;inset:0;z-index:10;padding:2px;border-radius:8px;pointer-events:none;background:conic-gradient(from 25deg,#f197a9,#f7db93,#7ce4ca,#6bc5f1,#ba9bec,#f197a9);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask-composite:exclude;box-sizing:border-box}
body .rd-card.rd-arena-card.rd-foil .tinner::after,body .card-study.holo::after{
 opacity:.64!important;
 background:radial-gradient(circle at var(--foil-x,35%) var(--foil-y,30%),#ffffffa0,transparent 32%),repeating-linear-gradient(115deg,transparent 0%,#53e5ff80 8%,#9991ff80 16%,#ee91c080 24%,#90efc080 32%,transparent 42%),radial-gradient(circle,#ffffffb0 .6px,transparent 1.3px)!important;
 background-size:100% 100%,250% 100%,9px 13px!important;
 animation:foil-reflection 4.5s ease-in-out infinite!important;
}
body .rd-card.rd-arena-card.rd-foil:hover .tinner::after,body .card-study.holo:hover::after{opacity:.85!important}
@keyframes foil-reflection{0%,100%{background-position:center,100% 0,0 0}50%{background-position:center,0 0,5px 7px}}
@media(prefers-reduced-motion:reduce){body .rd-card.rd-arena-card.rd-foil .tinner::after,body .card-study.holo::after{animation:none!important}}
