/* Thin optical layers, always clipped by the original object alpha. */
/* Static rarity light follows the existing gem palette: silver, green, blue,
   violet and gold. A transparent contour sits behind the printed front, outside
   its clipped surface. No extra filter, animation or 3D plane is introduced;
   the owning front face still handles flips, and backs reveal no rarity. */
.game-card[data-rarity="C"]{--card-rarity-rgb:188 194 197}
.game-card[data-rarity="UC"]{--card-rarity-rgb:142 185 147}
.game-card[data-rarity="R"]{--card-rarity-rgb:164 196 210}
.game-card[data-rarity="SR"]{--card-rarity-rgb:199 166 230}
.game-card[data-rarity="UR"]{--card-rarity-rgb:230 194 116}
.game-card[data-rarity="AR"]{--card-rarity-rgb:205 226 238}
.game-card[data-rarity]:not(.card-illustration)::before{
 content:"";position:absolute;inset:2.2% 3.2% 2.25%;border-radius:10cqw;
 pointer-events:none;
 box-shadow:0 0 1px .5px rgb(var(--card-rarity-rgb,188 194 197) / .32),0 0 clamp(2px,1.7cqw,5px) .8px rgb(var(--card-rarity-rgb,188 194 197) / .24);
}
.game-card[data-foil]:not([data-foil="0"]){--foil-x:42%;--foil-y:44%;--foil-sweep:36%;--foil-intensity:.66;--foil-tilt-x:0deg;--foil-tilt-y:0deg}
.game-card[data-foil]:not([data-foil="0"]) .card-surface{transform:perspective(950px) rotateX(var(--foil-tilt-x)) rotateY(var(--foil-tilt-y));transform-origin:50% 50%;transition:transform .24s cubic-bezier(.2,.65,.3,1)}
.game-card[data-foil-controlled="true"] .card-surface{transition:transform .09s linear}
/* Tilt eligibility is independent of rarity. Only fixed detail-card regions
   consume touch drags; cards in scrolling grids keep their existing pan policy. */
.game-card[data-card-tilt="detail"]{--foil-tilt-x:0deg;--foil-tilt-y:0deg}
:is(.inspect-art-stage,.collection-detail-art)>.game-card[data-card-tilt="detail"]{touch-action:none;cursor:grab}
:is(.inspect-art-stage,.collection-detail-art)>.game-card[data-card-tilt="detail"] .card-surface{transform:perspective(950px) rotateX(var(--foil-tilt-x)) rotateY(var(--foil-tilt-y));transform-origin:50% 50%}
:is(.inspect-art-stage,.collection-detail-art)>.game-card[data-card-tilt-active="true"]{cursor:grabbing}
:is(.inspect-art-stage,.collection-detail-art)>.game-card[data-card-tilt-active="true"] .card-surface{transition:none}
.foil-layer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;transform-origin:0 0;mask-mode:alpha;mask-size:100% 100%;mask-repeat:no-repeat;-webkit-mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mix-blend-mode:screen;opacity:calc(var(--foil-strength,.52) * var(--foil-intensity,.66) * var(--foil-source-opacity,1));
 background-image:linear-gradient(112deg,transparent 30%,#d8c7ed05 38%,#baedd69c 43%,#b7d7efa6 47%,#fff7dfa8 49%,#ffffffed 50%,#d6b1ef99 52%,#eecea878 56%,transparent 64%),radial-gradient(ellipse at var(--foil-x) var(--foil-y),#fff7d675 0%,transparent 43%);
 background-size:330% 280%,100% 100%;background-position:var(--foil-sweep) var(--foil-sweep),center;
}
.foil-art-clip{clip-path:inset(2.5% 3.5% 2.6% round 10% / 6.67%)}
.foil-frame{--foil-strength:.95}
.foil-art{--foil-strength:.26;background-image:linear-gradient(116deg,transparent 28%,#adcfdd00 39%,#e1b8ee7a 43%,#afeeeaab 46%,#fff5d9ba 49.7%,#ffffffe5 50%,#e4bae98c 51%,#bedaf355 57%,transparent 64%),radial-gradient(ellipse at var(--foil-x) var(--foil-y),#eaf8ff5c 0%,transparent 48%)}
.game-card[data-foil="1"] .foil-frame{--foil-strength:.8;background-image:linear-gradient(114deg,transparent 33%,#accadc28 43%,#e6f5eea3 48%,#fffbe9ed 50%,#a8c3e779 52%,transparent 63%),radial-gradient(ellipse at var(--foil-x) var(--foil-y),#f5f3d858,transparent 48%)}
.game-card[data-foil="2"] .foil-frame{--foil-strength:1.03}
.game-card[data-foil="3"] .foil-layer{
 background-image:linear-gradient(116deg,transparent 28%,#e7c3f047 40%,#bdcffac9 44%,#aaf0e9d1 46.5%,#fff7cef0 49.6%,#ffffffff 50%,#ebcdf9d6 52%,#d1edfa6b 57%,transparent 67%),radial-gradient(ellipse at var(--foil-x) var(--foil-y),#ffebafaa 0%,#daf7ed19 26%,transparent 51%);
 background-size:330% 280%,100% 100%;background-position:var(--foil-sweep) var(--foil-sweep),center;
}
.game-card[data-foil="3"] .foil-frame{--foil-strength:1.18}
.game-card[data-foil="3"] .foil-art{--foil-strength:.36}
.game-card[data-foil="4"] .foil-layer{
 background-image:linear-gradient(116deg,transparent 24%,#91eaff66 35%,#dcb8ffc9 41%,#fff2add9 46%,#ffffffff 50%,#ffb9e9df 54%,#9df5e1c4 59%,#a9cbff7d 65%,transparent 75%),radial-gradient(ellipse at var(--foil-x) var(--foil-y),#ffffffc7 0%,#b9edff69 18%,#e9bfff35 34%,transparent 56%);
 background-size:300% 260%,100% 100%;background-position:var(--foil-sweep) var(--foil-sweep),center;
}
.game-card[data-foil="4"] .foil-frame{--foil-strength:1.35}
.game-card[data-foil="4"] .foil-art{--foil-strength:.48}
/* AR keeps the complete UR optical stack and adds a separate diffraction film. */
.game-card[data-foil="4"] .card-surface::after{
 content:"";position:absolute;z-index:12;inset:2.5% 3.5% 2.6%;border-radius:10% / 6.67%;pointer-events:none;mix-blend-mode:screen;
 background:
  conic-gradient(from 132deg at var(--foil-x) var(--foil-y),transparent 0 6%,#61eaffb5 12%,#b680ffcc 20%,#ff87d2c2 28%,#ffe889c9 36%,#7dffd1bd 44%,#75a9ffad 52%,transparent 62% 100%),
  linear-gradient(124deg,transparent 16%,#63edff00 28%,#63edff8f 37%,#cf8dffc2 44%,#ff8dc2c7 50%,#ffe884cc 56%,#78ffd4aa 63%,#6da9ff6f 70%,transparent 82%),
  radial-gradient(ellipse at var(--foil-x) var(--foil-y),#ffffffe0 0%,#a8f5ff8a 12%,#d7a5ff61 27%,transparent 50%);
 background-size:170% 170%,240% 210%,100% 100%;background-position:center,var(--foil-sweep) var(--foil-sweep),center;
 opacity:calc(.5 * var(--foil-intensity,.66));filter:saturate(1.45) contrast(1.08);
}
.game-card[data-foil="4"] .foil-gem{--foil-strength:1.55;filter:drop-shadow(0 0 clamp(2px,2.4cqw,8px) #b7e9ffb5) drop-shadow(0 0 clamp(1px,1.3cqw,5px) #e8b8ff9c)}
.foil-gem{--foil-strength:1.18}
.foil-class,.foil-might,.foil-health,.foil-cost{--foil-strength:.78}
/* Above the raised painted heart, below its live health numeral. */
.foil-health,.gold-health{z-index:6}
.foil-nameplate{--foil-strength:.58}
.foil-dimming{--foil-strength:.045}
/* Letters remain cream outside the narrow reflection band. No duplicated text/ARIA. */
.foil-text{background-image:linear-gradient(112deg,transparent 34%,#cdf8f9b3 46%,#fffdf2 50%,#ecccfca8 54%,transparent 64%),linear-gradient(#fff1d8,#fff1d8);background-size:330% 280%,100% 100%;background-position:var(--foil-sweep) var(--foil-sweep),center;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;color:#fff1d8}
.card-rules.foil-text{background-image:linear-gradient(112deg,transparent 38%,#e4faffb3 49%,#fffcf2 51%,transparent 61%),linear-gradient(#f8f1de,#f8f1de)}
/* A text shadow paints over a transparent glyph fill and makes numerals black.
   Keep the cream fill visible and cast a shadow behind the completed glyph. */
.foil-text{text-shadow:none;filter:drop-shadow(0 .2cqw .3cqw #130f0ac0)}
/* Current Unit values take precedence over UR numeral reflections. Removing
   these classes restores the original cream/foil treatment without inline paint. */
.card-number.stat-increased{color:#9bd6a2;-webkit-text-fill-color:currentColor;background-image:none}
.card-number.stat-decreased{color:#ee9b8e;-webkit-text-fill-color:currentColor;background-image:none}
/* Raised objects keep a softer, continuous reflection in their local box. */
.game-card:is([data-foil="3"],[data-foil="4"]) :is(.foil-cost,.foil-might,.foil-health,.foil-gem,.foil-class){background-image:linear-gradient(116deg,transparent 28%,#c2dffab0 44%,#aeefe7c0 47%,#fffbefff 50%,#eac9f5c0 53%,transparent 67%),radial-gradient(ellipse at var(--foil-x) var(--foil-y),#ffe7abb0,transparent 51%);background-size:330% 280%,100% 100%;background-position:var(--foil-sweep) var(--foil-sweep),center}
@container card (max-width:140px){.game-card[data-foil="4"] .card-surface::after{opacity:calc(.32 * var(--foil-intensity,.66));background-size:185% 185%,255% 230%,100% 100%}}
@media(prefers-reduced-motion:reduce){.game-card[data-foil] .card-surface{transform:none!important;transition:none!important}}

.card-illustration{aspect-ratio:2/3;cursor:grab}.card-illustration>.card-surface{clip-path:none;border-radius:12px;overflow:hidden}.card-illustration .card-art,.card-illustration .foil-art-clip{clip-path:none;inset:0;width:100%;height:100%;border-radius:12px}.card-illustration .card-art{object-fit:cover}#library-grid .card-illustration{width:100%}

/* Gold edition: full-surface metallic sheen plus printed crown holograms.
   Procedural optics only; original artwork, asset alpha and rarity foil stay intact. */
.game-card[data-finish="gold"] {
  --gold-light-x:50%;
  --gold-light-y:50%;
  --gold-phase:0deg;
  --gold-focus-x:8.335cqw;
  --gold-focus-y:8.1cqw;
  --gold-level:.28;
  --gold-sheen-x:50%;
  --gold-sheen-y:50%;
  --gold-sheen-level:.65;
}
.gold-layer {
  position:absolute;
  inset:0;
  pointer-events:none;
  mask-mode:alpha;
  mask-repeat:no-repeat;
  -webkit-mask-repeat:no-repeat;
  mix-blend-mode:normal;
  opacity:var(--finish-source-opacity,1);
}
.gold-sheen {
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:calc(var(--finish-gold-strength,1) * var(--gold-sheen-level,.65));
  /* A continuous low gold body tone and wide moving metallic highlight. */
  background-image:linear-gradient(114deg,
    #ad741b24 0%,#e6af363b 18%,#ffd96d66 33%,#fff0b88a 43%,
    #e5ac3229 52%,#b276191f 64%,#f9d16959 78%,#fff0b878 89%,#d39a2c33 100%);
  background-size:200% 180%;
  background-position:var(--gold-sheen-x) var(--gold-sheen-y);
}
.crown-sheet {
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:calc(var(--finish-crown-strength,1) * var(--gold-level,.28));
  mask-image:radial-gradient(ellipse 31% 28% at var(--gold-light-x) var(--gold-light-y),
    #000 0%,#000d 30%,#0006 60%,#0002 84%,transparent 100%);
}
.crown-field {
  position:absolute;
  inset:0;
  pointer-events:none;
  mask-image:radial-gradient(ellipse 23% 18% at 50% 29%,#0006,#000b 62%,#000 100%);
}
.crown-plane {
  position:absolute;
  display:block;
  inset:-6.6cqw -8.335cqw;
  pointer-events:none;
  --crown-offset:18deg;
  background-color:#dfac3c35;
  background-image:conic-gradient(from calc(var(--crown-offset) + var(--gold-phase)) at var(--gold-focus-x) var(--gold-focus-y),
    #d3992740 0deg 20deg,#67ded3b0 52deg,#b293f6cc 77deg,#ffe396ee 99deg,
    #ffefc1cb 117deg,#d496253d 145deg 215deg,#d1a53b90 242deg,
    #a9e5d0b0 267deg,#fff0bfe6 289deg,#ffc64bb0 307deg,#d3992740 330deg 360deg);
  background-size:16.67cqw 32.4cqw;
  /* Each crown leans 30 degrees counterclockwise within its tile; the print grid and gold sheen stay fixed. */
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 167 324'%3E%3Cpath transform='rotate(-30 83.5 71)' fill='white' fill-opacity='.55' stroke='white' stroke-width='5' stroke-linejoin='round' d='M12 40 L44 65 L83.5 23 L123 65 L155 40 L137 119 L30 119 Z'/%3E%3C/svg%3E");
  mask-size:16.67cqw 32.4cqw;
}
.crown-odd {
  --crown-offset:55deg;
  background-position:8.335cqw 16.2cqw;
  mask-position:8.335cqw 16.2cqw;
}
.gold-art {
  --finish-gold-strength:.7;
  --finish-crown-strength:1;
  clip-path:inset(2.5% 3.5% 2.6% round 10% / 6.67%);
}
.gold-frame { --finish-gold-strength:1.55; --finish-crown-strength:1.1; }
.gold-gem { --finish-gold-strength:1; --finish-crown-strength:.85; }
.gold-class,.gold-might,.gold-health,.gold-cost { --finish-gold-strength:1.3; --finish-crown-strength:1; }
.gold-nameplate { --finish-gold-strength:.8; --finish-crown-strength:.4; }

/* Art gold blends against its existing luminance instead of painting a pale veil.
   Metalwork keeps its stronger warm specular treatment. */
.gold-art.gold-coat { mix-blend-mode:soft-light; }
.gold-art .gold-sheen {
  opacity:calc(.7 * var(--gold-sheen-level,.65));
  background-image:linear-gradient(114deg,
    #905018b0 0%,#e9b83edd 25%,#fff1b7f0 43%,#ce8b1699 55%,
    #94590d99 65%,#f5ce67ee 80%,#fff1b7ee 90%,#c69338aa 100%);
}

.gold-layer{width:100%;height:100%;mask-size:100% 100%;-webkit-mask-size:100% 100%;transform-origin:0 0}
.card-illustration .gold-art{clip-path:none;border-radius:0}
