/* Trading-card face (Pokémon-style layout, Fourth Wing dressing). Sized in container units so it scales as one object. */
.tcg {
  --w: min(92vw, 400px);
  position: relative; z-index: 1;
  width: var(--w); aspect-ratio: 63 / 88;
  container-type: inline-size;
  border: 0; padding: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* The 3D flip lives on an inner box, not on the <button>: Firefox wraps button children in an anonymous box, which
   breaks preserve-3d (the back then showed a mirrored front and the WebGL art vanished).
   v3: the motion engine (src/js/motion.js) owns this transform — perspective · tilt · flip from springs, written once
   per frame; the rule below is only the at-rest pose before the engine attaches (and without JS). Faces cull with
   backface-visibility; for engines that mis-cull (WPE WebKit draws the back mirrored over the front), the hidden face
   also gets opacity 0, switched with aria-pressed — which the engine flips exactly as the card passes edge-on, so the
   swap is never seen. Opacity on a composited face is not a repaint (v2's delayed visibility swap was). */
.tcg__flip {
  display: block; position: absolute; inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(calc(var(--flip, 0) * 180deg));
}
.tcg[aria-pressed='true'] { --flip: 1; }
.tcg__back, .tcg[aria-pressed='true'] .tcg__front { opacity: 0; }
.tcg[aria-pressed='true'] .tcg__back { opacity: 1; }
.tcg.is-active .tcg__face { will-change: opacity; }
/* will-change only while the engine is moving the card (is-active is set/cleared by the frame loop) */
.tcg.is-active .tcg__flip, .tcg.is-active .tcg__light { will-change: transform; }
.tcg.is-active .tcg__light[data-light='holo'], .tcg.is-active .tcg__light[data-light='glare'] { will-change: transform, opacity; }
/* codex: the card lifts as its entry opens (the shared-element view transition takes it from here) */
.deck .tcg { transition: transform 0.18s cubic-bezier(.2, .8, .2, 1); }
.deck .tcg.is-opening { transform: translate3d(0, -6px, 0) scale(1.03); }
.deck .tcg { --w: 100%; }

.tcg__face {
  /* Firefox: mix-blend-mode descendants flatten the preserve-3d context unless each face is its own group (D1) */
  isolation: isolate;
  position: absolute; inset: 0; border-radius: 4.6cqw; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 2.5cqw 7cqw rgba(0, 0, 0, 0.65), 0 0 9cqw color-mix(in srgb, var(--dragon-accent) 22%, transparent);
}

/* ---------- front: layered frame (v3 materials.css): outer gold leaf with a milled edge and an engraved groove
   (frame-front.svg), a blackened-steel ring, then the inner panel's bevel ---------- */
.tcg__front {
  padding: 3.4cqw;
  background: url("../img/frame-front.svg?v=40c3fd0b06") 0 0 / 100% 100% no-repeat, url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #c9a24a;
  background-blend-mode: normal, hard-light;
  box-shadow: inset 0 0 0 0.22cqw rgba(255, 246, 214, 0.5), inset 0 0 0 0.45cqw rgba(92, 60, 12, 0.35),
    0 2.5cqw 7cqw rgba(0, 0, 0, 0.65), 0 0 9cqw color-mix(in srgb, var(--dragon-accent) 22%, transparent);
}
.tcg__front::after { /* the gold's sheen bands: gradients only, under the panel (z -1 in the face's stacking context) */
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(135deg, rgba(255,245,200,.55) 0%, rgba(255,245,200,0) 18%, rgba(255,245,200,.45) 34%, rgba(60,35,0,.4) 52%, rgba(255,245,200,.35) 70%, rgba(60,35,0,.3) 86%, rgba(255,245,200,.5) 100%);
}
.tcg[data-rarity='unrecorded'] .tcg__front::after { background: linear-gradient(135deg, rgba(236,238,250,.55) 0%, rgba(236,238,250,0) 18%, rgba(236,238,250,.45) 34%, rgba(40,42,60,.4) 52%, rgba(236,238,250,.35) 70%, rgba(40,42,60,.3) 86%, rgba(236,238,250,.5) 100%); }
.tcg__front::before { /* the steel ring under the panel's edge */
  content: ''; position: absolute; inset: 2.45cqw; border-radius: 3.2cqw; pointer-events: none;
  background: url("../materials/steel.webp?v=2193069f85") 0 0 / 128px #1f1e24; background-blend-mode: hard-light;
  box-shadow: inset 0 0.5cqw 0.6cqw rgba(255, 255, 255, 0.07), inset 0 -0.5cqw 0.6cqw rgba(0, 0, 0, 0.35), 0 0 0 0.18cqw rgba(60, 38, 6, 0.85), 0 0.2cqw 0 0.18cqw rgba(255, 244, 210, 0.45), inset 0.15cqw 0.2cqw 0 rgba(255, 255, 255, 0.16);
}
.tcg__inner {
  position: relative; height: 100%; border-radius: 2.4cqw; overflow: hidden;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--dragon-accent) 30%, transparent), transparent 60%),
    linear-gradient(170deg, color-mix(in srgb, var(--dragon) 70%, #2a2230), #0d0b10 75%);
  /* the inner bevel: a dark step down from the steel, a fine gilt line, and the panel's own shadow under the lip */
  box-shadow: inset 0 0 0 0.35cqw rgba(10, 8, 6, 0.95), inset 0 0 0 0.6cqw rgba(243, 217, 139, 0.5), inset 0 0 0 0.75cqw rgba(20, 14, 8, 0.7),
    inset 0 1.2cqw 2cqw rgba(0, 0, 0, 0.55);
  color: #efe6cf;
}
.tcg__top { padding: 2.6cqw 3.4cqw 1.2cqw; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0 2cqw; }
.tcg__stage {
  grid-column: 1 / -1; justify-self: start;
  font-family: var(--display); font-size: 2.5cqw; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.5cqw 2cqw; border-radius: 999px; margin-bottom: 1.2cqw;
  /* an engraved gold plate */
  background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #d8b25a; background-blend-mode: hard-light; color: #1d140a; text-shadow: 0 0.15cqw 0 rgba(255, 240, 200, 0.5);
  box-shadow: inset 0 0.15cqw 0 rgba(255, 250, 228, 0.8), inset 0 0.9cqw 0.8cqw -0.3cqw rgba(255, 246, 210, 0.38), inset 0 -0.9cqw 0.8cqw -0.3cqw rgba(110, 72, 14, 0.4),
    inset 0 -0.2cqw 0 rgba(96, 62, 12, 0.55), 0 0 0 0.2cqw rgba(32, 22, 10, 0.85);
}
.tcg__name { margin: 0; font-family: var(--display); font-weight: 700; font-size: 8.6cqw; line-height: 1; letter-spacing: 0.04em; color: #fff4d6; text-shadow: 0 0.4cqw 0 rgba(0, 0, 0, 0.6); text-transform: none; }
.tcg__name::after { display: none; }
.tcg__type { display: flex; align-items: center; gap: 1.4cqw; font-family: var(--display); font-size: 2.7cqw; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-hi); }
.tcg__gem { width: 6.4cqw; height: 6.4cqw; border-radius: 50%; display: grid; place-items: center; color: #fff6dc;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--dragon-accent) 70%, #fff), var(--dragon) 55%, #000 100%);
  /* set in a gold bezel with a steel seat */
  box-shadow: 0 0 0 0.3cqw #20160a, 0 0 0 0.7cqw #d9b45a, 0 0 0 0.9cqw #6b4c16, inset 0 0.3cqw 0.6cqw rgba(255, 255, 255, 0.35), 0 0 2.4cqw color-mix(in srgb, var(--dragon-accent) 70%, transparent); }
.tcg__gem svg { width: 4.2cqw; height: 4.2cqw; }

.tcg__art {
  position: relative; margin: 0 3.4cqw; flex: 1 1 0; min-height: 38cqw; overflow: hidden; border-radius: 0.8cqw;
  box-shadow: 0 0 0 0.6cqw #20160a, 0 0 0 1.1cqw #d9b45a, 0 0 0 1.4cqw #6b4c16, 0 1.4cqw 3cqw rgba(0, 0, 0, 0.6);
  background: #050407;
}
.tcg__art img, .tcg__art canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tcg__art img { transform: scale(1.04); transform-origin: 50% 40%; }
.tcg__art canvas.fx { mix-blend-mode: screen; pointer-events: none; }
.tcg__art[data-living] img { object-position: 50% var(--focus-y, 50%); }
.tcg__art canvas.living { z-index: 0; }
.tcg__art.is-living img { visibility: hidden; }
.tcg__art canvas.fx { z-index: 1; }
.tcg__strip { margin: 2.2cqw 3.4cqw 0; padding: 0.8cqw 2cqw; text-align: center; font-style: italic; font-size: 2.7cqw;
  /* a gold-leaf ribbon (no mask: a masked raster in a moving card repaints every frame) */
  background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #d9b45a; background-blend-mode: hard-light; color: #1d140a; font-weight: 600; text-shadow: 0 0.15cqw 0 rgba(255, 240, 200, 0.45);
  border-radius: 0.5cqw; box-shadow: inset 0 0.15cqw 0 rgba(255, 250, 228, 0.75), inset 0 1cqw 1cqw -0.4cqw rgba(255, 246, 210, 0.35), inset 0 -1cqw 1cqw -0.4cqw rgba(110, 72, 14, 0.4), inset 0 -0.2cqw 0 rgba(96, 62, 12, 0.55), 0 0 0 0.25cqw rgba(20, 14, 6, 0.85); }

.tcg__mid { flex: none; display: flex; flex-direction: column; }
/* the text panel: vellum with its fibres, edges browned with age, set into the card on a gilt line */
.tcg__body { margin: 1.4cqw 2.4cqw 0; padding: 1.5cqw 1.8cqw 1.6cqw; display: flex; flex-direction: column; gap: 1cqw; border-radius: 0.9cqw;
  background: url("../materials/vellum.webp?v=cd9bcd7621") 0 0 / 192px #ead9b4; background-blend-mode: hard-light;
  box-shadow: inset 0 0 0 0.2cqw rgba(100, 66, 22, 0.45), inset 0 0 2.6cqw rgba(120, 78, 28, 0.42), inset 0 0 7cqw rgba(150, 105, 45, 0.22), 0 0 0 0.3cqw #1a1209, 0 0 0 0.55cqw rgba(217, 180, 90, 0.75);
  color: var(--parchment-ink); }
.tcg__ability, .tcg__move { display: grid; grid-template-columns: auto 1fr auto; gap: 0 2cqw; align-items: baseline; }
.tcg__ability .label { font-family: var(--display); font-size: 2.4cqw; letter-spacing: 0.12em; color: #fff; background: linear-gradient(90deg, #8b1e1e, #b8322a); padding: 0.3cqw 1.6cqw; border-radius: 0.6cqw; }
.tcg__ability .nm, .tcg__move .nm { font-family: var(--display); font-weight: 700; font-size: 3.5cqw; letter-spacing: 0.02em; color: #3a1608; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcg__ability p, .tcg__move p { grid-column: 1 / -1; margin: 0.3cqw 0 0; font-size: 2.7cqw; line-height: 1.25; color: #2e2418; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } /* two lines: the parchment panel is narrower than v2's dark one */
/* drop-cap initials, rubricated */
.tcg__ability p::first-letter, .tcg__move p::first-letter { font-family: var(--display); font-weight: 700; font-size: 1.32em; line-height: 1; color: #7a1616; }
.tcg__move { padding-top: 1cqw; border-top: 0.25cqw solid rgba(110, 74, 30, 0.35); box-shadow: inset 0 0.25cqw 0 rgba(255, 250, 230, 0.5); }
.tcg__move .cost { display: flex; gap: 0.6cqw; }
.tcg__move .cost i { width: 4cqw; height: 4cqw; border-radius: 50%; background: url("../img/coin.svg?v=442a19fdf6") center / contain no-repeat; }
.tcg__move .bk { font-family: var(--display); font-size: 2.6cqw; letter-spacing: 0.1em; color: #6e1414; border: 0.25cqw solid rgba(110, 20, 20, 0.5); border-radius: 999px; padding: 0 1.4cqw; }
.tcg__foot { flex: none; padding: 1.4cqw 4cqw 2.2cqw; }
.tcg__stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; border-top: 0.25cqw solid rgba(243, 217, 139, 0.35); padding-top: 1cqw; }
.tcg__stats div { font-size: 2.6cqw; line-height: 1.2; color: #efe6cf; }
.tcg__stats span { display: block; font-family: var(--display); font-size: 2cqw; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.tcg__flavor { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 1cqw 0 0; font-style: italic; font-size: 2.6cqw; line-height: 1.25; color: #cfc4a8; text-align: right; }
.tcg__set { display: flex; justify-content: space-between; align-items: center; margin-top: 1.2cqw; font-family: var(--display); font-size: 2.1cqw; letter-spacing: 0.1em; color: var(--muted); }
.tcg__set .sigil { display: inline-flex; align-items: center; gap: 1cqw; }
.tcg__set svg { width: 3.4cqw; height: 3.4cqw; color: var(--gold); }
/* the engraved tier plate */
.tcg__rarity { padding: 0.35cqw 1.6cqw 0.25cqw; border-radius: 0.6cqw; color: #2a1806; text-shadow: 0 0.15cqw 0 rgba(255, 240, 200, 0.5);
  background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #d4ab52; background-blend-mode: hard-light;
  box-shadow: inset 0 0.7cqw 0.6cqw -0.25cqw rgba(255, 246, 210, 0.38), inset 0 -0.7cqw 0.6cqw -0.25cqw rgba(110, 72, 14, 0.4), inset 0 0.15cqw 0 rgba(255, 250, 228, 0.8), inset 0 -0.2cqw 0 rgba(96, 62, 12, 0.6), 0 0 0 0.2cqw rgba(20, 14, 6, 0.9); }
.tcg[data-rarity='unrecorded'] .tcg__rarity { background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #b4b4c2; background-blend-mode: hard-light; }

/* ---------- holo + glare: the light (v3) ----------
   Each light is an oversized child of its face (1.5× the card, clipped by the face), moved by translate3d and dimmed by
   opacity from the motion engine — a composited layer, so tilting never repaints the card. At rest (centre, no tilt)
   it renders exactly like the v2 layers at --mx/--my = 50 %. */
.tcg__light { position: absolute; inset: -25%; pointer-events: none; }
.tcg__holo, .tcg__glare { z-index: 5; }
.tcg__holo {
  mix-blend-mode: color-dodge; opacity: calc(var(--holo, 0.35) * 0.06);
  background:
    repeating-linear-gradient(115deg, hsl(0 90% 60% / .35) 0%, hsl(45 90% 60% / .35) 4%, hsl(120 80% 55% / .3) 8%, hsl(200 90% 60% / .35) 12%, hsl(280 80% 60% / .35) 16%, hsl(360 90% 60% / .35) 20%),
    repeating-linear-gradient(25deg, rgba(255,255,255,0) 0 1.6cqw, rgba(255,255,255,0.08) 1.6cqw 1.9cqw);
  background-size: 200% 200%, 66.6667% 66.6667%;
  background-position: 50% 50%, 50% 50%;
  filter: brightness(0.8) contrast(1.3) saturate(1.2);
}
/* farthest-corner of the card from its centre = hypot(50cqw, 50cqw·88/63) */
.tcg__glare { mix-blend-mode: overlay; opacity: 0.2;
  background: radial-gradient(circle 85.88cqw at 50% 50%, rgba(255, 250, 230, 0.75) 0%, rgba(255, 255, 255, 0.15) 30%, rgba(0, 0, 0, 0.35) 90%); }
/* rarity: how much foil */
.tcg[data-rarity='legendary'] { --holo: 0.85; }
.tcg[data-rarity='legendary'] .tcg__holo { background:
    radial-gradient(circle, rgba(255,255,255,0.9) 0 0.18cqw, transparent 0.3cqw) 25cqw 34.9206cqw / 3.1cqw 3.1cqw,
    repeating-linear-gradient(115deg, hsl(0 90% 60% / .4) 0%, hsl(45 90% 60% / .4) 4%, hsl(120 80% 55% / .35) 8%, hsl(200 90% 60% / .4) 12%, hsl(280 80% 60% / .4) 16%, hsl(360 90% 60% / .4) 20%) 50% 50% / 200% 200%; }
.tcg[data-rarity='rare'] { --holo: 0.6; }
.tcg[data-rarity='uncommon'] { --holo: 0.4; }
.tcg[data-rarity='common'] { --holo: 0.22; }
.tcg[data-rarity='unrecorded'] { --holo: 0.3; }
.tcg[data-rarity='unrecorded'] .tcg__front { background: url("../img/frame-front.svg?v=40c3fd0b06") 0 0 / 100% 100% no-repeat, url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #8e92a6; background-blend-mode: normal, hard-light; }

/* ---------- back (the Codex back, v3 materials): a gold-leaf frame in the tier's metal, a tooled-leather panel with a
   gilt filigree border, and the sigil debossed into the leather in gold. Tier = metal + hide + tooling + wear/foil. ---------- */
.tcg__back {
  transform: rotateY(180deg);
  padding: 3.4cqw;
  --wear: 0;
  background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #c9a24a; background-blend-mode: hard-light;
  box-shadow: inset 0 0 0 0.22cqw rgba(255, 246, 214, 0.5), inset 0 0 0 0.45cqw rgba(92, 60, 12, 0.35),
    0 2.5cqw 7cqw rgba(0, 0, 0, 0.65), 0 0 9cqw color-mix(in srgb, var(--dragon-accent) 22%, transparent);
}
/* the back's metal: the gold-leaf raster on the tier's base colour (the face), the tier's sheen bands above it
   (::before, gradients only) and the engraving (::after, the frame svg only) — never a raster and a gradient in one
   background (see .tcg__back .tcg__inner) */
.tcg__back::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(135deg, rgba(255,245,200,.55) 0%, rgba(255,245,200,0) 18%, rgba(255,245,200,.45) 34%, rgba(60,35,0,.4) 52%, rgba(255,245,200,.35) 70%, rgba(60,35,0,.3) 86%, rgba(255,245,200,.5) 100%); }
.tcg__back::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: url("../img/frame-front.svg?v=40c3fd0b06") 0 0 / 100% 100% no-repeat; }
.tcg__back .tcg__inner { display: grid; place-items: center; text-align: center; background: #1f0d0b; }
/* Inside a moving card an element's background never mixes a raster with a gradient: Chromium re-records such a
   background on every frame (tests/motion.spec.ts pins 0 Paint). So the hide is two layers: ::before = the rasters
   (tooling lattice over leather on the hide colour, hard-light), ::after = the light (lit centre, vignette, the
   diagonal fall-off, wear on the edges) and the panel's inset rim, gradients only. */
.tcg__back .tcg__inner::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, #1f0d0b; background-blend-mode: normal;
}
.tcg__back .tcg__inner::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(70% 48% at 50% 40%, rgba(255, 196, 130, 0.1), transparent 72%), radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.6) 100%), linear-gradient(160deg, rgba(255, 230, 200, 0.05), rgba(0, 0, 0, 0.45) 85%);
  box-shadow: inset 0 0 0 0.35cqw rgba(10, 6, 4, 0.92), inset 0 0 0 0.6cqw rgba(243, 217, 139, 0.32), inset 0 1.2cqw 2.4cqw rgba(0, 0, 0, 0.55);
}
/* the gilt filigree border with its corner pieces: inline SVG in the tier's metal, raised off the hide
   (ornaments.svg#fil-<tier>; a face-down pack card shows the plain gold one) */
.tcg__filigree { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.tcg__filigree .fil-plain { display: none; }
.tcg__back-content { position: relative; z-index: 2; }
.tcg__back .emblem { width: 52cqw; margin: 0 auto; }
.tcg__back .emblem svg { width: 100%; height: auto; }
.tcg__back .title { font-family: var(--display); font-size: 5.4cqw; letter-spacing: 0.22em; margin-top: 4cqw;
  color: #ecd08a; text-shadow: 0 -0.2cqw 0 rgba(0, 0, 0, 0.75), 0 0.18cqw 0 rgba(255, 220, 160, 0.16); }
.tcg__back .sub { font-style: italic; font-size: 3cqw; color: #d2c6a8; margin-top: 1cqw; text-shadow: 0 -0.15cqw 0 rgba(0, 0, 0, 0.7); }
/* the specular sweep on gold leaf: a narrow band moved by the motion engine with the tilt (a glare-kind light) */
.tcg__sheen { z-index: 5; mix-blend-mode: overlay; opacity: 0.3;
  background: linear-gradient(115deg, transparent 41%, rgba(255, 248, 225, 0.55) 47%, rgba(255, 255, 245, 0.95) 50%, rgba(255, 248, 225, 0.55) 53%, transparent 59%); }

/* the collection deck: face-down until revealed */
.collect { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin: 8px 0 0; color: var(--parchment-2); font-family: var(--display); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
.collect button { font: inherit; background: var(--ink); color: var(--gold-hi); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.collect progress { width: 140px; accent-color: var(--gold); }
@keyframes reveal-flash { 0% { box-shadow: 0 0 0 0 rgba(255, 230, 150, 0.9); } 100% { box-shadow: 0 0 0 40px rgba(255, 230, 150, 0); } }
.tcg.just-revealed .tcg__front { animation: reveal-flash 0.9s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .deck .tcg { transition: none; }
  .deck .tcg.is-opening { transform: none; }
}

/* ---------- back: set number + rarity foil per tier (SPEC_v2 F1 / §8 Cards); v3: metal, hide, tooling, wear ---------- */
/* (every image value is literal per tier: an image value built from var() is re-created on each style recalc and
   repaints the card while it tilts) */
.tcg__back[data-tier='legendary'] { background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #e2c98f; background-blend-mode: hard-light; }
.tcg__back[data-tier='legendary']::before { background: conic-gradient(from 210deg at 50% 50%, rgba(255,240,190,.55), rgba(255,200,236,.6), rgba(176,226,255,.6), rgba(210,255,200,.55), rgba(255,236,170,.45), rgba(150,100,30,.4), rgba(255,244,200,.55), rgba(255,240,190,.55)); }
.tcg__back[data-tier='legendary'] .tcg__inner::before { background: url("../img/tooling-gilt.svg?v=2a67e60ac7") 50% 42% / 9.6cqw 9.6cqw, #3e0f11; background-blend-mode: normal; }
.tcg__back[data-tier='legendary'] .tcg__inner::after { background: radial-gradient(70% 48% at 50% 40%, rgba(255, 196, 130, 0.1), transparent 72%), radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.6) 100%), linear-gradient(160deg, rgba(255, 230, 200, 0.05), rgba(0, 0, 0, 0.45) 85%); }
.tcg__back[data-tier='rare'] { background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #d2a443; background-blend-mode: hard-light; }
.tcg__back[data-tier='rare']::before { background: linear-gradient(135deg, rgba(255,248,214,.55) 0%, rgba(255,248,214,0) 18%, rgba(255,248,214,.45) 34%, rgba(80,50,8,.4) 52%, rgba(255,248,214,.35) 70%, rgba(80,50,8,.3) 86%, rgba(255,248,214,.5) 100%); }
.tcg__back[data-tier='rare'] .tcg__inner::before { background: url("../img/tooling-gilt.svg?v=2a67e60ac7") 50% 42% / 9.6cqw 9.6cqw, #1e130d; background-blend-mode: normal; }
.tcg__back[data-tier='rare'] .tcg__inner::after { background: radial-gradient(70% 48% at 50% 40%, rgba(255, 196, 130, 0.1), transparent 72%), radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.6) 100%), linear-gradient(160deg, rgba(255, 230, 200, 0.05), rgba(0, 0, 0, 0.45) 85%); }
.tcg__back[data-tier='uncommon'] { background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #a6b0bd; background-blend-mode: hard-light; }
.tcg__back[data-tier='uncommon']::before { background: linear-gradient(135deg, rgba(248,252,255,.55) 0%, rgba(248,252,255,0) 18%, rgba(248,252,255,.45) 34%, rgba(40,50,64,.4) 52%, rgba(248,252,255,.35) 70%, rgba(40,50,64,.3) 86%, rgba(248,252,255,.5) 100%); }
.tcg__back[data-tier='uncommon'] .tcg__inner::before { background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, #121419; background-blend-mode: normal; }
.tcg__back[data-tier='uncommon'] .tcg__inner::after { background: radial-gradient(120% 90% at 50% 45%, transparent 58%, rgba(230, 190, 140, 0.06) 100%), radial-gradient(70% 48% at 50% 40%, rgba(255, 196, 130, 0.1), transparent 72%), radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.6) 100%), linear-gradient(160deg, rgba(255, 230, 200, 0.05), rgba(0, 0, 0, 0.45) 85%); }
.tcg__back[data-tier='common'] { background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #a5713e; background-blend-mode: hard-light; }
.tcg__back[data-tier='common']::before { background: linear-gradient(135deg, rgba(255,226,186,.55) 0%, rgba(255,226,186,0) 18%, rgba(255,226,186,.45) 34%, rgba(60,32,10,.4) 52%, rgba(255,226,186,.35) 70%, rgba(60,32,10,.3) 86%, rgba(255,226,186,.5) 100%); }
.tcg__back[data-tier='common'] .tcg__inner::before { background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, #2a190f; background-blend-mode: normal; }
.tcg__back[data-tier='common'] .tcg__inner::after { background: radial-gradient(120% 90% at 50% 45%, transparent 58%, rgba(230, 190, 140, 0.16) 100%), radial-gradient(70% 48% at 50% 40%, rgba(255, 196, 130, 0.1), transparent 72%), radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.6) 100%), linear-gradient(160deg, rgba(255, 230, 200, 0.05), rgba(0, 0, 0, 0.45) 85%); }
.tcg__back[data-tier='unrecorded'] { background: url("../materials/gold.webp?v=1a1d0dbee7") 0 0 / 128px #8a8ea6; background-blend-mode: hard-light; }
.tcg__back[data-tier='unrecorded']::before { background: linear-gradient(135deg, rgba(236,238,250,.55) 0%, rgba(236,238,250,0) 18%, rgba(236,238,250,.45) 34%, rgba(40,42,60,.4) 52%, rgba(236,238,250,.35) 70%, rgba(40,42,60,.3) 86%, rgba(236,238,250,.5) 100%); }
.tcg__back[data-tier='unrecorded'] .tcg__inner::before { background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, #17151e; background-blend-mode: normal; }
.tcg__back[data-tier='unrecorded'] .tcg__inner::after { background: radial-gradient(120% 90% at 50% 45%, transparent 58%, rgba(230, 190, 140, 0.09) 100%), radial-gradient(70% 48% at 50% 40%, rgba(255, 196, 130, 0.1), transparent 72%), radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.6) 100%), linear-gradient(160deg, rgba(255, 230, 200, 0.05), rgba(0, 0, 0, 0.45) 85%); }
.tcg__back-foil {
  position: absolute; inset: -25%; z-index: 1; pointer-events: none; mix-blend-mode: color-dodge; opacity: var(--back-foil, 0.1);
  background: repeating-linear-gradient(120deg, hsl(0 90% 60% / .35) 0%, hsl(50 90% 60% / .35) 5%, hsl(130 80% 55% / .3) 10%, hsl(200 90% 60% / .35) 15%, hsl(280 80% 60% / .35) 20%, hsl(360 90% 60% / .35) 25%) 50% 50% / 200% 200%;
}
.tcg__back[data-tier='legendary'] { --back-foil: 0.4; }
.tcg__back[data-tier='rare'] { --back-foil: 0.3; }
.tcg__back[data-tier='uncommon'] { --back-foil: 0.16; }
.tcg__back-number { margin-top: 3.4cqw; font-family: var(--display); font-size: 3.4cqw; letter-spacing: 0.24em; color: var(--gold-hi); }
.tcg__back-tier { margin-top: 1.2cqw; font-size: 3.2cqw; letter-spacing: 0.4em; color: var(--gold); }
.tcg__back[data-tier='legendary'] .tcg__back-tier { color: #ffe08a; text-shadow: 0 0 2cqw rgba(255, 214, 120, 0.8); }
.tcg__back[data-tier='rare'] .tcg__back-tier { color: #cfe4ff; text-shadow: 0 0 1.6cqw rgba(150, 200, 255, 0.7); }
.tcg__back[data-tier='unrecorded'] .tcg__back-tier { color: #c9cde6; }

/* ---------- artist's-interpretation mark (canon art.interpretation; the note itself is never rendered) ---------- */
.tcg__interp {
  font-style: italic; text-transform: none; letter-spacing: 0.03em; white-space: nowrap;
  color: #d9dcec; border: 0.25cqw solid rgba(217, 220, 236, 0.45); border-radius: 999px; padding: 0.15cqw 1.4cqw;
}

/* ---------- just added from a pack ---------- */
.tcg.is-new::before {
  content: ''; position: absolute; inset: -5%; z-index: -1; border-radius: 8cqw; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 214, 120, 0.55), rgba(255, 214, 120, 0.15) 60%, transparent);
  animation: new-glow 2.8s ease-in-out infinite;
}
.tcg.is-new::after {
  content: 'New'; position: absolute; top: 4.4cqw; right: -1.6cqw; z-index: 6; pointer-events: none;
  padding: 0.8cqw 3.4cqw 0.8cqw 3cqw; border-radius: 1cqw 0 0 1cqw;
  font-family: var(--display); font-weight: 700; font-size: 3.2cqw; letter-spacing: 0.2em; text-transform: uppercase; color: #1d140a;
  background: linear-gradient(180deg, #fff1bf, #e0b552 60%, #b88a2c);
  box-shadow: 0 1cqw 2.4cqw rgba(0, 0, 0, 0.5), 0 0 3cqw rgba(255, 214, 120, 0.5);
}
@keyframes new-glow { 0%, 100% { opacity: 0.55; transform: scale(0.98); } 50% { opacity: 1; transform: scale(1.02); } }
@media (prefers-reduced-motion: reduce) { .tcg.is-new::before { animation: none; } }
.tcg.fly-in { animation: fly-in 0.95s cubic-bezier(.2, .85, .25, 1.05) both; }
@keyframes fly-in {
  0% { opacity: 0; transform: translate3d(0, -42vh, 0) scale(0.35) rotate(-8deg); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .tcg.fly-in { animation: none; } }

/* the back's leather is invisible until a card turns over: it loads on the viewer's first interaction (page.js adds
   html.mat-ready), keeping it out of the first load; until then the back shows its hide colour and tooling */
html.mat-ready .tcg__back .tcg__inner::before { background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, url("../materials/leather.webp?v=ddbeb9cd22") 0 0 / 192px, #1f0d0b; background-blend-mode: normal, hard-light; }
html.mat-ready .tcg__back[data-tier='legendary'] .tcg__inner::before { background: url("../img/tooling-gilt.svg?v=2a67e60ac7") 50% 42% / 9.6cqw 9.6cqw, url("../materials/leather.webp?v=ddbeb9cd22") 0 0 / 192px, #3e0f11; background-blend-mode: normal, hard-light; }
html.mat-ready .tcg__back[data-tier='rare'] .tcg__inner::before { background: url("../img/tooling-gilt.svg?v=2a67e60ac7") 50% 42% / 9.6cqw 9.6cqw, url("../materials/leather.webp?v=ddbeb9cd22") 0 0 / 192px, #1e130d; background-blend-mode: normal, hard-light; }
html.mat-ready .tcg__back[data-tier='uncommon'] .tcg__inner::before { background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, url("../materials/leather.webp?v=ddbeb9cd22") 0 0 / 192px, #121419; background-blend-mode: normal, hard-light; }
html.mat-ready .tcg__back[data-tier='common'] .tcg__inner::before { background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, url("../materials/leather.webp?v=ddbeb9cd22") 0 0 / 192px, #2a190f; background-blend-mode: normal, hard-light; }
html.mat-ready .tcg__back[data-tier='unrecorded'] .tcg__inner::before { background: url("../img/tooling-blind.svg?v=7d8a01354f") 50% 42% / 9.6cqw 9.6cqw, url("../materials/leather.webp?v=ddbeb9cd22") 0 0 / 192px, #17151e; background-blend-mode: normal, hard-light; }
/* (direct url() values: a leather url fed through a custom property made Chromium repaint moving cards every frame) */
