:is(.character,.duel-face,.battle-entrant,.cinema-reward,.foil-example).foil-card {
  --metal:#98a6b6;
  --ink:#121a26;
  --stock:#263140;
  position:relative;
  isolation:isolate;
  color:#f2f4f8;
  background-color:var(--ink);
  background-image:radial-gradient(circle at 1px 1px,#ebf4ff18 .65px,transparent .85px),
    repeating-linear-gradient(138deg,#080d1400 0px 6px,#03091524 7px 8px),
    linear-gradient(140deg,var(--stock),var(--ink) 78%);
  background-size:4px 4px, auto, auto;
  border:1px solid var(--metal);
  border-bottom:2px solid color-mix(in srgb,var(--metal) 54%,#161e2b);
  border-radius:7px 7px 11px 5px;
  box-shadow:inset 0 1px color-mix(in srgb,var(--metal) 22%,transparent),0 3px 8px #06091048;
}
.foil-card[data-rarity="uncommon"] { --metal:#9bb39a; --stock:#2c3b34; border-block-end-style:double; border-block-end-width:3px; }
.foil-card[data-rarity="rare"] { --metal:#81bcca; --stock:#263b50; border-radius:13px 5px; }
.foil-card[data-rarity="epic"] { --metal:#b99ed1; --stock:#382b49; border-radius:3px 12px 3px 12px; }
.foil-card[data-rarity="legendary"] { --metal:#dcb974; --stock:#50402c; border:3px double var(--metal); border-radius:7px 7px 13px 13px; }
.foil-card[data-rarity="mythic"] { --metal:#bd9cdf; --stock:#3a294f; border-inline-width:3px; border-inline-style:double; }
.foil-card[data-rarity="secret"] { --metal:#c7c9c9; --stock:#2e2936; --ink:#101017; border:3px double var(--metal); border-radius:2px 11px 2px 11px; }
.foil-card::after {
  content:"";
  position:absolute;
  z-index:3;
  inset:3px;
  border:1px solid color-mix(in srgb,var(--metal) 27%,transparent);
  border-radius:inherit;
  background:linear-gradient(var(--metal),var(--metal)) left top / 10px 1px no-repeat,
    linear-gradient(var(--metal),var(--metal)) right bottom / 10px 1px no-repeat;
  pointer-events:none;
}
.foil-card.character:is(:hover,:focus-visible) {
  box-shadow:inset 0 0 0 1px var(--metal),0 3px 12px #08090a60;
}
.foil-card .character-body,.foil-card .duel-description,.foil-card figcaption {
  position:relative;
  z-index:1;
  background:linear-gradient(125deg,var(--stock),var(--ink) 72%);
  border-block-start:1px solid color-mix(in srgb,var(--metal) 49%,transparent);
}
.foil-card .tier,.foil-card .cinema-tier { color:color-mix(in srgb,var(--metal) 87%,white); }
.foil-card.character > :is(img,.card-illu) { position:relative; z-index:1; aspect-ratio:3/4; height:auto; }
.foil-card .foil-mark { margin-inline-end:.25em; }
.foil-mark[data-mark="secret"] {
  display:inline-grid; place-items:center; min-inline-size:1.25em; height:1.25em; aspect-ratio:1;
  color:#ebedeb; border:1px solid #e5e1dc; border-radius:50%; background:#121019;
  font-weight:900; line-height:1;
}
.foil-stage.summon-cinema {
  border-color:#455060;
  background:radial-gradient(ellipse at center,#283341,#111721 68%);
  animation:none;
}
.foil-stage.summon-cinema[data-tone="legendary"] { background:radial-gradient(ellipse at center,#453329,#151821 73%); }
.foil-stage.summon-cinema[data-tone="secret"] { background:radial-gradient(ellipse at center,#2d2a37,#111219 73%); }
.foil-stage .foil-card { align-self:center; z-index:2; }
.foil-stage .cinema-portrait { border-radius:3px 3px 0 0; }
.foil-stage .cinema-reward { overflow:visible; position:relative; }
.foil-stage .cinema-reward figcaption { padding:8px 6px; }
.foil-stage[data-motion="true"] .foil-card { animation:foil-appear calc(var(--finish) - var(--impact)) var(--impact) cubic-bezier(.16,.76,.3,1) both; }
.foil-stage[data-tone="secret"][data-motion="true"] .foil-card { animation-name:foil-unveil; }
@keyframes foil-appear { from { transform:translateY(8px) scale(.985); opacity:0; } }
@keyframes foil-unveil { from { clip-path:inset(0 49%); opacity:.25; } to { clip-path:inset(0); opacity:1; } }
.foil-reveal,.rarity-stage .foil-reveal { position:absolute; pointer-events:none; inset:0; overflow:visible; z-index:3; }
.foil-reveal i { position:absolute; display:block; }
.foil-corner {
  inset:3px auto auto 3px; width:22%; height:16%;
  border:2px solid #7ae1c7; border-width:2px 0 0 2px; border-radius:7px 0 0;
  animation:foil-fit var(--foil-run,450ms) var(--foil-delay,0ms) ease-out both;
}
.foil-corner + .foil-corner { inset:auto 3px 3px auto; rotate:180deg; }
@keyframes foil-fit {
  from { opacity:0; transform:translate(-8px,-8px); }
  52%,78% { opacity:.83; transform:translate(0); }
  to { opacity:0; }
}
.foil-reveal[data-effect="rare"] .foil-arrow {
  --start:0%; --end:98%;
  width:19px; height:10px;
  color:#f0f8eb;
  offset-path:inset(3px round 12px);
  offset-rotate:auto;
  clip-path:polygon(0 37%,64% 37%,52% 5%,72% 5%,100% 48%,72% 95%,52% 95%,64% 61%,0 61%);
  background:currentColor;
  animation:foil-orbit var(--foil-run,560ms) var(--foil-delay,0ms) linear both;
}
.foil-reveal[data-effect="rare"] .foil-arrow + .foil-arrow { --start:50%; --end:148%; color:#81c4d2; }
@keyframes foil-orbit {
  from { offset-distance:var(--start); opacity:0; }
  14%,85% { opacity:1; }
  81%,100% { offset-distance:var(--end); }
  to { offset-distance:var(--end); opacity:0; }
}
.foil-reveal[data-effect="legendary"],.foil-reveal[data-effect="mythic"] { z-index:0; }
.foil-reveal[data-effect="secret"] { z-index:auto; }
.foil-flame {
  --atlas:url("assets/forge-flame.webp");
  --atlas-ratio:120/152;
  --steps:23;
  inset:auto auto 0 -29%; width:84%; aspect-ratio:var(--atlas-ratio);
  background-image:var(--atlas);
  background-position:0 0;
  background-size:calc((var(--steps) + 1) * 100%) 100%;
  background-repeat:no-repeat;
  image-rendering:pixelated;
  transform:rotate(-13deg) scaleX(1.05);
  transform-origin:bottom center;
  animation:foil-flare-frames var(--foil-run,900ms) var(--foil-delay,0ms) steps(var(--steps),end) both,
    foil-flare var(--foil-run,900ms) var(--foil-delay,0ms) ease-out both;
}
.foil-flame + .foil-flame { inset:auto -25% 4% auto; transform:rotate(16deg) scaleX(-1); }
@keyframes foil-flare-frames { to { background-position:100% 0; } }
@keyframes foil-flare {
  from { opacity:0; translate:0 16%; }
  22% { opacity:.88; }
  60% { opacity:.76; }
  to { opacity:0; translate:0 -17%; }
}
.foil-mythic-halo {
  inset:-10% -13%;
  background:linear-gradient(153deg,#b790eb,#5b357e 40%,#bb99f5 68%,#321a51);
  clip-path:polygon(1% 35%,17% 29%,10% 8%,39% 18%,49% 0%,58% 17%,91% 6%,84% 30%,100% 33%,91% 55%,100% 71%,85% 71%,91% 95%,58% 87%,50% 100%,39% 86%,7% 95%,15% 73%,0 71%,11% 53%);
  mask-image:radial-gradient(ellipse at center,transparent 40%,#000c 64%,black 100%);
  animation:foil-mythic var(--foil-run,900ms) var(--foil-delay,0ms) cubic-bezier(.17,.75,.33,1) both;
}
@keyframes foil-mythic {
  from { opacity:.18; transform:scale(1.15) rotate(-3deg); }
  25% { opacity:.57; transform:scale(.86) rotate(-2deg); }
  53% { opacity:.86; transform:scale(1.12) rotate(2deg); }
  to { opacity:0; transform:scale(1) rotate(0deg); }
}
.foil-eclipse {
  inset:1% auto auto 50%; translate:-50% 0;
  z-index:0; width:122%; aspect-ratio:1; border-radius:50%;
  background:#09080e;
  border:1px solid #d1cbc6;
  box-shadow:0 0 8px #e2dacf65, 0 0 26px #b2a0bb2b;
  mask-image:linear-gradient(153deg,#fff 44%,#ffffff40 92%);
  animation:foil-eclipse var(--foil-run,1250ms) var(--foil-delay,0ms) cubic-bezier(.2,.7,.3,1) both;
}
.foil-slit {
  z-index:4; top:43%; left:-9%; width:118%; height:1px; rotate:-24deg;
  background:linear-gradient(90deg,transparent,#a19ebc 22%,#f3e5db 47%,#d1e5e3 64%,transparent);
  box-shadow:0 0 6px #d5d4ea98;
  animation:foil-slit var(--foil-run,1250ms) var(--foil-delay,0ms) ease-in-out both;
}
@keyframes foil-eclipse {
  from { opacity:0; transform:scale(.84); }
  36%,69% { opacity:.96; transform:scale(1); }
  to { opacity:.35; transform:scale(1.04); }
}
@keyframes foil-slit {
  0%,22% { transform:scaleX(.06); opacity:0; }
  47% { transform:scaleX(1); opacity:.94; }
  to { opacity:0; transform:scaleX(.92); }
}
.foil-trace { inset:4%; border:1px solid var(--metal,#c8d6dd); border-radius:6px; animation:foil-etch var(--foil-run,390ms) var(--foil-delay,0ms) ease-out both; }
.foil-crack {
  top:12%; right:-3%; width:17%; height:50%; rotate:-17deg;
  background:linear-gradient(#c49deb,#764bb1);
  clip-path:polygon(51% 0,76% 41%,47% 49%,57% 100%,31% 56%,60% 43%);
  animation:foil-etch var(--foil-run,450ms) var(--foil-delay,0ms) ease-out both;
}
.foil-shard {
  --shard-x:10px; --shard-y:-12px; top:29%; right:1%;
  width:11px; height:17px; background:#d6adff; clip-path:polygon(44% 0,100% 54%,13% 100%);
  animation:foil-splinter var(--foil-run,450ms) var(--foil-delay,0ms) ease-out both;
}
.foil-shard:nth-of-type(3) { --shard-x:15px; --shard-y:0px; rotate:53deg; }
.foil-shard:nth-of-type(4) { --shard-x:12px; --shard-y:14px; rotate:101deg; }
@keyframes foil-splinter {
  from { opacity:0; scale:.35; }
  30% { opacity:.9; scale:1; }
  to { opacity:0; translate:var(--shard-x) var(--shard-y); }
}
@keyframes foil-etch {
  from { opacity:0; scale:.86; }
  33% { opacity:.83; scale:1; }
  to { opacity:0; scale:1.05; }
}
.duel-stage .duel-table { overflow:clip; }
.duel-card-stage { position:relative; isolation:isolate; }
.duel-card-stage .duel-face { z-index:2; }
.duel-card-stage .foil-reveal { --foil-run:var(--settle-ms,450ms); }
.duel-card-stage > [data-effect="legendary"] .foil-flame { width:88%; inset-block-end:1%; }
.duel-card-stage > [data-effect="legendary"] .foil-flame + .foil-flame { inset-inline:auto -31%; bottom:-2%; }
.foil-stage .foil-reveal { --foil-delay:var(--portal); --foil-run:calc(var(--finish) - var(--portal)); inset:14% 27%; }
.foil-stage .foil-reveal[data-effect="secret"] { inset:16% 24%; }
.foil-stage .foil-card > .foil-reveal[data-effect="rare"] { inset:0; --foil-delay:calc(var(--impact) - 30ms); --foil-run:calc(var(--finish) - var(--impact)); }
.is-revealing:has(> .foil-reveal) > :not(.foil-reveal) { animation:foil-appear 270ms cubic-bezier(.16,.76,.3,1) both; }
.is-revealing > .foil-reveal { --foil-run:380ms; }
.duel-stage .duel-card-stage .duel-face.face-reveal:not(.is-revealing) {
  animation:duel-settle 260ms cubic-bezier(.16,.8,.23,1) both;
}
.duel-stage .duel-card-stage .duel-face.face-reveal:not(.is-revealing) > :is(img,.card-illu) {
  animation:none;
}
.duel-stage .duel-card-stage .duel-face.face-reveal:not(.is-revealing) > .duel-description,
.duel-stage .value-reveal { animation:folio-text 190ms 260ms cubic-bezier(.2,.7,.36,1) both; }
.duel-stage .duel-card-stage .duel-face.face-reveal.draw-highlight:not(.is-revealing) {
  border-color:var(--metal);
}
.duel-reel .reel-entry[data-final="true"] .reel-portrait { object-fit:contain; object-position:center; }
.duel-reel .reel-entry[data-final="true"] strong { visibility:hidden; }
.foil-combat {
  position:absolute; z-index:4; inset:0; pointer-events:none; border-radius:inherit;
  overflow:hidden;
}
.foil-combat::before {
  content:""; position:absolute; inset:0;
  background:linear-gradient(135deg,transparent 44%,#f7f1d920 46%,#fff5ce 49%,#efbe73 50%,transparent 56%);
  animation:foil-strike 245ms cubic-bezier(.12,.8,.26,1) both;
}
.foil-combat[data-move="guard"]::before {
  inset:12%; border-radius:34% 35% 49% 49%; border:2px solid #95e7d9; background:#94ecdb22;
  animation:foil-parry 270ms ease-out both;
}
.foil-combat[data-move="ultimate"]::before {
  background:linear-gradient(38deg,transparent 46%,#fcd681b3 48%,transparent 53%),
    linear-gradient(143deg,transparent 42%,#ffeacc 49%,#bc6c57b8 54%,transparent 59%);
  animation-duration:385ms;
}
.foil-attack { animation:foil-tell 255ms ease-out both; }
@keyframes foil-strike { from { opacity:0; transform:translateX(-76%); } 38% { opacity:.92; } to { opacity:0; transform:translateX(65%); } }
@keyframes foil-parry { from { opacity:0; scale:.74; } 24% { opacity:1; } to { opacity:0; scale:1.16; } }
@keyframes foil-tell { 19% { translate:0 2px; } 39% { translate:0 -4px; } }
html[data-reduced="true"] :is(.foil-reveal,.foil-combat) { display:none; }
@media (prefers-reduced-motion: reduce) {
  :is(.foil-reveal,.foil-combat) { display:none; }
  .foil-stage .foil-card,.foil-attack { animation:none !important; }
}
