/* Rank tiers: the rank card art. Kept on its own so the public landing page can show real rank cards without the
   rest of the game's styles; the game loads it just before social.css, where it used to live. */
/* ---------- tiers ----------
   Rank cards are solid, textured and animated: the color and motion say the tier, so names need no label.
   They are dark, so text inside them uses light inks. */
/* The Emperor's crown, hung off the corner of champion cards and the champion's profile. */
:root { --crown-art: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 32'%3E%3Cdefs%3E%3ClinearGradient id='m' x2='.8' y2='1'%3E%3Cstop stop-color='%23fff3ac'/%3E%3Cstop offset='.45' stop-color='%23d6a83d'/%3E%3Cstop offset='.55' stop-color='%23fff3ac'/%3E%3Cstop offset='1' stop-color='%23a8781f'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x2='0' y2='1'%3E%3Cstop stop-color='%23b0182e'/%3E%3Cstop offset='1' stop-color='%23520814'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M5 27 3 8l9 8 8-13 8 13 9-8-2 19Z' fill='url(%23m)' stroke='%23382d17' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M6.5 24.5h27v3.5h-27z' fill='url(%23b)' stroke='%23382d17' stroke-width='1.2'/%3E%3Cpath d='m8 11 4 4M32 11l-4 4' stroke='%23fff3ac' stroke-opacity='.6' stroke-width='.8'/%3E%3Ccircle cx='3' cy='8' r='2' fill='url(%23m)' stroke='%23382d17'/%3E%3Ccircle cx='20' cy='3' r='2.2' fill='url(%23m)' stroke='%23382d17'/%3E%3Ccircle cx='37' cy='8' r='2' fill='url(%23m)' stroke='%23382d17'/%3E%3Cpath d='m20 15 2.4 3-2.4 3-2.4-3Z' fill='%23e34b7d' stroke='%233c1730' stroke-width='.8'/%3E%3Ccircle cx='12' cy='26.2' r='1.3' fill='%234cd7ed'/%3E%3Ccircle cx='28' cy='26.2' r='1.3' fill='%234cd7ed'/%3E%3Ccircle cx='20' cy='26.2' r='1.5' fill='%23ffe6ff'/%3E%3C/svg%3E"); }
@property --rank-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
/* Black opal's color patches swell and fade on these, each on its own beat (social.css). */
@property --opal-a { syntax: '<number>'; inherits: false; initial-value: .5; }
@property --opal-b { syntax: '<number>'; inherits: false; initial-value: .5; }
@property --opal-c { syntax: '<number>'; inherits: false; initial-value: .5; }

.rank-unranked { --rank-base: var(--surface-2); --rank-edge: var(--border-strong); --rank-ink: var(--text-2); --rank-glow: transparent; --rank-texture: none; }
.rank-wood { --rank-base: #221a12; --rank-edge: #8f6d49; --rank-ink: #e8cfa8; --rank-glow: #7a5a3a70;
  --rank-texture: repeating-linear-gradient(6deg, #b58b5528 0 2px, transparent 2px 9px, #0e0b0866 10px 12px); }
.rank-bronze { --rank-base: #2f1810; --rank-edge: #d6834f; --rank-ink: #ffc29a; --rank-glow: #d46b3280;
  --rank-texture: repeating-linear-gradient(135deg, #ffab7016 0 1px, transparent 1px 6px); }
.rank-silver { --rank-base: #1f2938; --rank-edge: #cddcf2; --rank-ink: #f4f8ff; --rank-glow: #c1d6ef60;
  --rank-texture: repeating-linear-gradient(90deg, #ffffff0a 0 1px, transparent 1px 3px); }
.rank-gold { --rank-base: #322508; --rank-edge: #ffd84d; --rank-ink: #fff2a8; --rank-glow: #ffcf2699;
  --rank-texture: radial-gradient(120% 140% at 0% 0%, #ffe68a26, transparent 55%), repeating-linear-gradient(100deg, #ffd84d0d 0 2px, transparent 2px 7px); }
.rank-emerald { --rank-base: #082b1c; --rank-edge: #48e59b; --rank-ink: #c9ffe3; --rank-glow: #19c87999;
  --rank-texture: radial-gradient(120% 140% at 0% 0%, #5cffb32e, transparent 55%), repeating-linear-gradient(135deg, #48e59b12 0 2px, transparent 2px 7px); }
.rank-diamond { --rank-base: #0b2733; --rank-edge: #72f2ff; --rank-ink: #d6ffff; --rank-glow: #20d9ed88;
  --rank-texture: repeating-conic-gradient(from 30deg at 80% 50%, #b6ffff1c 0deg 30deg, transparent 30deg 60deg); }
/* Ruby: a pigeon-blood ruby in deep crimson, cut in a few large facets. Six broad pavilion facets fan from the center,
   two wide crown facets catch and shade the light, the corners are cut deep, and a hot heart of red fire breathes
   under it all while embers rise (::after). */
.rank-ruby { --rank-base: #4a000f; --rank-edge: #ff8a9a; --rank-ink: #fff0f2; --rank-glow: #d80a2ddd;
  --rank-texture:
    radial-gradient(circle at 14% 26%, #ffffff 0 1px, #ffb8c2cc 1.6px, transparent 3.2px),
    radial-gradient(circle at 81% 24%, #ffffff 0 .9px, #ff8c9ccc 1.5px, transparent 2.8px),
    radial-gradient(circle at 63% 80%, #ffe0e4 0 .8px, transparent 2px),
    radial-gradient(circle at 37% 70%, #ffc8d0 0 .7px, transparent 1.8px),
    linear-gradient(135deg, #ffb3bfcc 0 16px, #e0304caa 16px 17px, transparent 17.5px),
    linear-gradient(225deg, #ff9aaabb 0 16px, #c81e3aaa 16px 17px, transparent 17.5px),
    linear-gradient(45deg, #1a0006e6 0 16px, #d01c3a55 16px 17px, transparent 17.5px),
    linear-gradient(315deg, #1a0006d9 0 16px, #d01c3a55 16px 17px, transparent 17.5px),
    linear-gradient(112deg, #ff5a6e3d 0 34%, #ff8a9a66 34% calc(34% + 1px), transparent calc(34% + 1px)),
    linear-gradient(292deg, #14000466 0 30%, #b0163066 30% calc(30% + 1px), transparent calc(30% + 1px)),
    radial-gradient(38% 70% at 50% 50%, #ff3a50aa, #d80a2d44 55%, transparent 75%),
    conic-gradient(from 30deg at 50% 50%, #e0263f 0 60deg, #6a0014 0 120deg, #c8102e 0 180deg, #420009 0 240deg,
      #e0263f 0 300deg, #6a0014 0) center / 100% 100%,
    radial-gradient(70% 110% at 30% -10%, #ffa8b4b3, transparent 58%),
    linear-gradient(180deg, #c40a2c, #8a0420 45%, #3a000c); }
.rank-card.rank-ruby {
  background: var(--rank-texture), var(--rank-base);
  background-blend-mode: normal, normal, normal, normal, normal, normal, normal, normal, normal, normal, screen, soft-light, normal, normal, normal;
  box-shadow: inset 0 1px 0 #ffe6ea, inset 0 -2px 0 #26000acc, inset 0 0 0 3px #3a000c66, inset 0 0 0 4px #ff9aaaaa, inset 0 0 16px #d01c3a66, 0 0 18px #d80a2daa; }
.rank-card.rank-ruby :is(b, strong, span, .rank-badge) { text-shadow: 0 1px 2px #26000aee, 0 0 7px #3a000ccc; }
.rank-card.rank-card.rank-ruby::before { background: linear-gradient(105deg, transparent 15%, #d01c3a33 30%, #ffdfe4ee 46%, #ffffff 50%, #e0304caa 56%, transparent 82%); --sheen: 3.5s; }
/* Embers: hot pink and white sparks that drift up through the stone and flicker. Every tile height divides 120px,
   so the layer (one period taller than the card) rises 120px and loops seamlessly on transform alone. */
.rank-card.rank-ruby::after {
  content: ''; position: absolute; inset: 0 0 -120px; z-index: -1; pointer-events: none; mix-blend-mode: screen;
  background-image: radial-gradient(circle, #ffffff 0 1px, #ffb8c288 1.6px, transparent 2.8px), radial-gradient(circle, #ff3a50 0 1.3px, transparent 2.4px),
    radial-gradient(circle, #ffc8d0 0 .9px, transparent 1.8px), radial-gradient(circle, #ff6a7a 0 1.1px, transparent 2.2px);
  background-size: 53px 40px, 79px 60px, 37px 40px, 97px 120px; background-position: 0 0, 23px 11px, 9px 29px, 51px 5px;
  animation: rank-rise-120 calc(6s * var(--rank-speed, 1)) linear var(--rank-delay, 0s) infinite,
    rank-twinkle calc(1.4s * var(--rank-speed, 1)) ease-in-out var(--rank-delay, 0s) infinite;
}
/* Emperor: deep red velvet (a soft pile sheen over crushed folds) trimmed in gold. */
.rank-champion { --rank-base: #3a0710; --rank-edge: #f3c64e; --rank-ink: #ffecc0; --rank-glow: #c4142eaa;
  --rank-texture: radial-gradient(140% 120% at 100% 0%, #ff3d5a2e, transparent 60%), radial-gradient(90% 140% at 10% 100%, #12000488, transparent 65%),
    repeating-linear-gradient(72deg, #ffffff06 0 2px, #00000014 2px 5px); }
.rank-card.rank-champion { overflow: visible; }
/* The Emperor's card lets its crown hang off the top-left corner, so it cannot clip a moving layer: the shine and
   particles share one layer inside the card's bounds that glints and twinkles in place (opacity only, which runs off
   the main thread). */
.rank-card.rank-card.rank-champion::before {
  inset: 0; width: auto; border-radius: inherit; transform: none; opacity: .35;
  background:
    linear-gradient(105deg, transparent 30%, #ffe9a899 46%, #fff6d6cc 50%, #ffe9a899 54%, transparent 70%),
    radial-gradient(circle, #ffffff 0 1px, transparent 1.6px) 0 0 / 43px 37px,
    radial-gradient(circle, #f3c64e 0 1.2px, transparent 2px) 20px 10px / 71px 53px;
  animation: emperor-glint calc(3.4s * var(--rank-speed, 1)) ease-in-out var(--rank-delay, 0s) infinite;
}
@keyframes emperor-glint { 0%, 100% { opacity: .3; } 45% { opacity: 1; } 60% { opacity: .55; } }
.rank-card.rank-card.rank-champion::after {
  content: ''; position: absolute; z-index: 2; pointer-events: none; inset: auto;
  top: max(-1.35em, -16px); left: max(-1em, -12px); width: clamp(22px, 2.8em, 40px); height: clamp(18px, 2.25em, 32px); opacity: 1;
  background: var(--crown-art) center / contain no-repeat;
  transform: rotate(-24deg); filter: drop-shadow(0 2px 2px rgb(0 0 0 / .6)); animation: none;
}
/* Granite: speckled gray stone. Quartz: a pale, milky-pink crystal with soft facets. */
.rank-granite { --rank-base: #1d2024; --rank-edge: #8d96a3; --rank-ink: #dde3ea; --rank-glow: #6d778560;
  --rank-texture: radial-gradient(circle at 20% 30%, #ffffff12 0 2px, transparent 3px) 0 0 / 11px 9px, radial-gradient(circle at 70% 60%, #0000003a 0 2px, transparent 3px) 0 0 / 13px 12px,
    radial-gradient(circle at 50% 50%, #e8c8b018 0 1px, transparent 2px) 0 0 / 7px 8px; }
.rank-quartz { --rank-base: #2a2229; --rank-edge: #f2cfe0; --rank-ink: #fff0f6; --rank-glow: #f0b8d455;
  --rank-texture: linear-gradient(125deg, #ffffff1c 0 18%, transparent 18% 40%, #ffffff10 40% 52%, transparent 52%),
    radial-gradient(120% 140% at 0% 0%, #ffd6e830, transparent 55%); }
/* Opal: a clear, glassy stone. The card is partly see-through (the page blurs behind it), with vivid play of color
   drifting under a glossy surface and bright colored sparks winking through it. */
.rank-opal { --rank-base: rgb(30 36 54 / .68); --rank-edge: #f4fbff; --rank-ink: #ffffff; --rank-glow: #8ff0ffaa;
  --rank-texture: radial-gradient(42% 70% at 16% 30%, #ff4fb8a6, transparent 70%), radial-gradient(42% 70% at 60% 82%, #22ffaa99, transparent 70%),
    radial-gradient(38% 62% at 86% 22%, #3f9dffb3, transparent 70%), radial-gradient(32% 55% at 44% 8%, #ffd23f99, transparent 70%),
    radial-gradient(30% 60% at 96% 90%, #b45cff99, transparent 70%); }
.rank-card.rank-opal {
  background:
    linear-gradient(180deg, #ffffff47 0, #ffffff14 46%, transparent 47%),
    var(--rank-texture), linear-gradient(120deg, var(--rank-glow), transparent 80%), var(--rank-base);
  background-size: auto, 170% 170%, 170% 170%, 170% 170%, 170% 170%, 170% 170%, auto, auto;
  backdrop-filter: blur(8px) saturate(1.6); -webkit-backdrop-filter: blur(8px) saturate(1.6);
  box-shadow: inset 0 1px 0 #ffffffcc, inset 0 0 0 1px #ffffff2e, inset 0 -10px 18px #0a0f2a55, 0 0 14px #8ff0ff40; }
/* Topaz: an imperial topaz, a brilliant-cut stone in bright orange. Four pavilion facets meet under the table, fine
   facet lines cross the stone, the corners are cut (light at the top, shade below), and glints sit on the facet edges.
   The body stays deep enough under the facets for the light card text to read. */
.rank-topaz { --rank-base: #d45f00; --rank-edge: #ffd98a; --rank-ink: #fff6e6; --rank-glow: #ff9a1fee;
  --rank-texture:
    radial-gradient(circle at 18% 22%, #fff8e6 0 1px, #ffe3a8aa 1.6px, transparent 3px),
    radial-gradient(circle at 74% 30%, #fff8e6 0 .8px, #ffd28acc 1.4px, transparent 2.6px),
    radial-gradient(circle at 58% 78%, #ffefcf 0 .8px, transparent 2px),
    linear-gradient(135deg, #ffe7bfcc 0 9px, #ffc06a88 9px 10px, transparent 10.5px),
    linear-gradient(225deg, #ffd79acc 0 9px, #ffb04d70 9px 10px, transparent 10.5px),
    linear-gradient(45deg, #4a1600cc 0 9px, #ff9a3c40 9px 10px, transparent 10.5px),
    linear-gradient(315deg, #4a1600b0 0 9px, #ff9a3c40 9px 10px, transparent 10.5px),
    repeating-linear-gradient(62deg, #fff1d040 0 1px, transparent 1px 19px),
    repeating-linear-gradient(-62deg, #fff1d02e 0 1px, transparent 1px 19px),
    repeating-linear-gradient(90deg, transparent 0 37px, #5a1c0030 37px 38px),
    conic-gradient(from 45deg at 50% 50%, #ffe0a066 0 25%, #ff9a2a38 0 50%, #ffc46b5c 0 75%, #a8420055 0),
    radial-gradient(70% 110% at 32% -8%, #ffe9b8bb, transparent 58%),
    linear-gradient(180deg, #ffa024, #ff7a0a 45%, #c45200); }
.rank-card.rank-topaz { box-shadow: inset 0 1px 0 #fff6e0ee, inset 0 -2px 0 #7a2a00aa, inset 0 0 0 3px #a8420055, inset 0 0 0 4px #ffd98a77, 0 0 14px #ff9a1f77; }
.rank-card.rank-topaz :is(b, strong, span, .rank-badge) { text-shadow: 0 1px 2px #5a1c00dd, 0 0 6px #7a2a0099; }
/* Black opal: a deep blue-black stone. Large patches of color glow through it (they swell and fade out of step under
   the high-rank animations, social.css), a thin rim slowly turns through the colors, and its play of color is Opal's
   inverted (::before): the same grid of pinpoints, each in the complement of Opal's hue, sinking through the dark stone
   where Opal's rise through the milky one, and winking out of step with them. It throws off no particles.
   The base is a gradient layer: a bare color is only valid as the last layer, and anywhere else it drops the whole
   background and leaves the card see-through. */
.rank-blackopal { --rank-base: #05070f; --rank-edge: #f0b45c; --rank-ink: #fff1db; --rank-glow: #13285a80;
  --rank-texture: radial-gradient(120% 140% at 15% 110%, #0f3a4a66, transparent 55%), radial-gradient(90% 120% at 95% -10%, #2a1452aa, transparent 60%),
    repeating-linear-gradient(118deg, #ffffff05 0 1px, transparent 1px 14px); }
.rank-card.rank-blackopal {
  border: 1.5px solid transparent !important;
  background: radial-gradient(70% 170% at 16% 66%, #ff8a2a4a, transparent 70%) padding-box, radial-gradient(62% 160% at 54% 22%, #2fd3c540, transparent 70%) padding-box,
    radial-gradient(60% 170% at 90% 72%, #7a5cff4d, transparent 70%) padding-box, radial-gradient(46% 130% at 38% 104%, #3f8cff33, transparent 70%) padding-box,
    var(--rank-texture) padding-box, linear-gradient(120deg, var(--rank-glow), transparent 80%) padding-box, linear-gradient(var(--rank-base), var(--rank-base)) padding-box,
    conic-gradient(from 200deg, #f0b45c, #3fe0c5, #4a7dff, #b06cff, #ff6a4d, #f0b45c) border-box;
  box-shadow: 0 0 18px #3f6bff2e, inset 0 0 22px #00000080;
}
/* Opal's spark grid (its tile sizes and offsets), in the complementary hues, falling: the layer reaches 120px above the
   card and slides down that far, so the card is always covered and the loop is seamless. */
.rank-card.rank-blackopal::before {
  content: ''; position: absolute; inset: -120px 0 0; z-index: -1; pointer-events: none; mix-blend-mode: screen;
  background-image: radial-gradient(circle, #ffe9a8 0 1px, #ffe9a866 1.5px, transparent 2.6px), radial-gradient(circle, #5cffa3 0 1.2px, transparent 2.2px),
    radial-gradient(circle, #ff3d86 0 1.1px, transparent 2px), radial-gradient(circle, #4a6dff 0 1px, transparent 1.9px), radial-gradient(circle, #ffaa5a 0 1.2px, transparent 2.2px);
  background-size: 47px 30px, 67px 40px, 83px 60px, 59px 120px, 101px 40px; background-position: 0 0, 21px 13px, 40px 27px, 9px 35px, 55px 7px;
  animation: rank-fall-120 calc(8s * var(--rank-speed, 1)) linear var(--rank-delay, 0s) infinite,
    rank-twinkle calc(1.6s * var(--rank-speed, 1)) ease-in-out calc(var(--rank-delay, 0s) - .8s) infinite;
}
:root.reduce-motion .rank-card.rank-blackopal, :root.reduce-motion .rank-card.rank-blackopal::before, :root.reduce-motion .rank-card.rank-blackopal::after { animation: none; }
/* A card well out of view stands still (motion.js). */
.rank-card.rank-far, .rank-card.rank-far::before, .rank-card.rank-far::after, .rank-card.rank-far *, .rank-card.rank-far *::before, .rank-card.rank-far *::after { animation: none !important; }

.rank-card {
  position: relative; isolation: isolate; overflow: hidden;
  border: 1px solid var(--rank-edge); border-radius: var(--radius);
  background: var(--rank-texture, none), linear-gradient(120deg, var(--rank-glow), transparent 80%), var(--rank-base);
}
.rank-card:not(.rank-unranked) { --text: #eef1f7; --text-2: #c2c9d8; --text-3: #8c95a8; color: var(--text); color-scheme: dark; }
.rank-card::before, .rank-card::after { content: none; }
.rank-badge { color: var(--rank-ink, var(--accent)); font: 700 9.5px/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; }
.ranked-identity .rank-badge { font: 700 30px/1 var(--font-head); letter-spacing: .04em; }

/* Sheen: a bright band sweeps across every tier from bronze up; faster and brighter the higher the tier. */
.rank-card:is(.rank-quartz, .rank-bronze, .rank-silver, .rank-gold, .rank-emerald, .rank-topaz, .rank-diamond, .rank-ruby, .rank-opal, .rank-champion)::before {
  content: ''; position: absolute; inset: -1px auto -1px 0; width: 55%; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 20%, #ffffff10 38%, #ffffff66 50%, #ffffff10 62%, transparent 80%);
  transform: translateX(-130%) skewX(-12deg);
  animation: rank-sheen calc(var(--sheen, 5.5s) * var(--rank-speed, 1)) cubic-bezier(.5, 0, .3, 1) var(--rank-delay, 0s) infinite;
}
.rank-quartz::before { opacity: .4; --sheen: 7.5s; }
.rank-bronze::before { opacity: .45; --sheen: 7s; }
.rank-opal::before { background: linear-gradient(105deg, transparent 15%, #ff7ad033 30%, #ffffffee 46%, #5ff7ff88 54%, #ffe27a44 62%, transparent 82%); --sheen: 3.6s; }
.rank-silver::before { opacity: .7; --sheen: 6s; }
.rank-gold::before { background: linear-gradient(105deg, transparent 20%, #fff3b010 38%, #fff7c8aa 50%, #fff3b010 62%, transparent 80%); --sheen: 4.6s; }
.rank-emerald::before { background: linear-gradient(105deg, transparent 20%, #73ffb022 38%, #c5ffdeaa 50%, #73ffb022 62%, transparent 80%); --sheen: 5.2s; }
.rank-topaz::before { background: linear-gradient(105deg, transparent 18%, #ffcf8a33 34%, #fff6e2dd 48%, #ffb04d66 56%, transparent 80%); --sheen: 4.4s; }
.rank-diamond::before { background: linear-gradient(105deg, transparent 15%, #7ff6ff22 32%, #ffffffbb 46%, #ff9cf655 54%, #7ff6ff22 66%, transparent 85%); --sheen: 3.9s; }
.rank-champion::before { background: linear-gradient(105deg, transparent 15%, #ff3d5a33 32%, #ffeab0dd 48%, #f3c64e55 62%, transparent 85%); --sheen: 3.4s; }

/* Glow: gold, emerald and diamond carry a soft halo. It holds still: an animated shadow repaints on the main thread
   every frame, once per card, which is what made long player lists slow on weaker devices. */
.rank-card:is(.rank-gold, .rank-emerald, .rank-diamond) { box-shadow: 0 0 0 1px color-mix(in srgb, var(--rank-glow) 50%, transparent), 0 0 12px var(--rank-glow); }

/* Diamond and champion throw off particles. */
.rank-card:is(.rank-diamond, .rank-champion)::after {
  content: ''; position: absolute; inset: 0 0 -120px; z-index: -1; pointer-events: none;
  background-image: radial-gradient(circle, #ffffff 0 1px, transparent 1.6px), radial-gradient(circle, var(--rank-edge) 0 1.2px, transparent 2px), radial-gradient(circle, #ffffffaa 0 .8px, transparent 1.5px);
  background-size: 43px 40px, 71px 60px, 101px 120px; background-position: 0 0, 20px 10px, 40px 30px;
  animation: rank-rise-120 calc(var(--drift, 7s) * var(--rank-speed, 1)) linear var(--rank-delay, 0s) infinite,
    rank-twinkle calc(var(--twinkle, 2.4s) * var(--rank-speed, 1)) ease-in-out var(--rank-delay, 0s) infinite;
}
.rank-diamond::after { opacity: .5; --drift: 11s; --twinkle: 1.8s; }
/* Opal sparks: pinpoints in its play-of-color hues that drift and wink. */
.rank-card.rank-opal::after {
  content: ''; position: absolute; inset: 0 0 -120px; z-index: -1; pointer-events: none; mix-blend-mode: screen;
  background-image: radial-gradient(circle, #ffffff 0 1px, #ffffff66 1.5px, transparent 2.6px), radial-gradient(circle, #ff5cc8 0 1.2px, transparent 2.2px),
    radial-gradient(circle, #3dffb8 0 1.1px, transparent 2px), radial-gradient(circle, #ffd84a 0 1px, transparent 1.9px), radial-gradient(circle, #5aaaff 0 1.2px, transparent 2.2px);
  background-size: 47px 30px, 67px 40px, 83px 60px, 59px 120px, 101px 40px; background-position: 0 0, 21px 13px, 40px 27px, 9px 35px, 55px 7px;
  animation: rank-rise-120 calc(8s * var(--rank-speed, 1)) linear var(--rank-delay, 0s) infinite,
    rank-twinkle calc(1.6s * var(--rank-speed, 1)) ease-in-out var(--rank-delay, 0s) infinite;
}

/* Champion: a gold-and-crimson border and a heavier aura. */
.rank-card.rank-champion {
  border: 2px solid transparent;
  background:
    var(--rank-texture) padding-box, linear-gradient(120deg, var(--rank-glow), transparent 80%) padding-box, linear-gradient(var(--rank-base), var(--rank-base)) padding-box,
    conic-gradient(from 135deg, #fff1b8, #c99a26, #ffe08a, #9c1427, #fff1b8) border-box;
  box-shadow: inset 0 0 18px #ff445c4d, 0 0 18px #f3c64e80; animation: none;
}

@keyframes rank-sheen { 0%, 35% { transform: translateX(-130%) skewX(-12deg); } 75%, 100% { transform: translateX(260%) skewX(-12deg); } }
@keyframes rank-twinkle { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
/* Particle layers are one 120px period taller (or wider) than their card and slide by exactly that period. */
@keyframes rank-rise-120 { to { translate: 0 -120px; } }
@keyframes rank-fall-120 { to { translate: 0 120px; } }
:root.reduce-motion .rank-card, :root.reduce-motion .rank-card::before, :root.reduce-motion .rank-card::after { animation: none !important; }

/* ---------- the Patron's ribbon (public/patron-ribbon.js) ----------
   A short length of purple silk coming over the top edge of the rank card at its top right, a gold chevron a level.
   It hangs in the card's own right margin, absolutely placed, so the card keeps its size and nothing moves for it. One
   look for everyone, in no tier's colors. Where it comes over the edge it throws a soft shadow on the plate; on a foil
   (skinned) card under the mouse it tilts with the card, a light crosses the silk against the pointer and the silk
   brightens a little as the top tips toward the lamp, all by transform and filter on this one card. Shown on the
   Players list's card and the profile's only. */
.rank-card > .patron-ribbon { position: absolute; z-index: 3; top: 0; right: var(--pr-right, 12px); display: block; width: var(--pr-w, 14px);
  filter: drop-shadow(0 1px .5px rgb(0 0 0 / .6)) drop-shadow(1px 2px 2.5px rgb(0 0 0 / .45)); }
.rank-card > .patron-ribbon > svg { display: block; width: 100%; height: auto; overflow: visible; transition: filter 240ms var(--ease); }
/* The fold's shadow on the plate, a little wider than the ribbon, just under the card's top edge. */
.rank-card > .patron-ribbon::before { content: ''; position: absolute; top: 0; left: -35%; right: -35%; height: 5px; pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0, rgb(0 0 0 / .5), transparent); }
.patron-ribbon .patron-ribbon-light { opacity: 0; transition: opacity 260ms var(--ease), transform 120ms linear; }
.rank-card.cs-lamp > .patron-ribbon .patron-ribbon-light { opacity: .85; transform: translateX(calc(var(--mx, 0) * -14px)); }
.rank-card.cs-lamp > .patron-ribbon > svg { filter: brightness(calc(1.06 - var(--my, 0) * .08)); }
/* The Players list's band keeps 16px on its right; the ribbon stands 5px in, clear of the card's rounded corner. */
.player-account-band > .patron-ribbon { --pr-w: 12px; --pr-right: 5px; }
.profile-hero > .patron-ribbon.patron-ribbon { --pr-w: 22px; --pr-right: 38px; position: absolute; z-index: 3; }
@media (max-width: 640px) {
  .profile-hero > .patron-ribbon.patron-ribbon { --pr-w: 17px; --pr-right: 4px; }
}
/* The gem store's line under Buy: the buyer's own ribbon at the Players list's size, beside what the next chevron takes. */
.gem-patron { display: inline-flex; align-items: center; gap: var(--space-4); max-width: 46ch; margin: var(--space-6) 0 0; color: var(--text-2);
  font: 500 var(--fs-xs)/1.4 var(--font-ui); text-align: left; }
.gem-patron:empty { display: none; }
.gem-patron > .patron-ribbon { flex: none; width: 13px; filter: drop-shadow(0 1px 1px rgb(40 20 60 / .4)); }
.gem-patron > .patron-ribbon > svg { display: block; width: 100%; height: auto; }

/* ---------- a rank-up: the old rank breaks (public/app-mint.js) ----------
   One scene of about three and a half seconds over a dimmed lobby, in the new tier's own tokens (.mint carries
   rank-<tier>; the old badge's box carries the tier left behind, so its bits take that tier's colors):
   0ms     the badge of the tier just left (a plain shield below wood) comes up, full size, and sits still;
   620ms   a crack runs across it along the edges it will break on, lit from behind in the new tier's light, and the
           badge shakes harder as it spreads; the light shows round its rim;
   960ms   it bursts in its own material's way (app-mint.js throws the pieces under gravity) while the new tier's badge
           comes through from behind, tipped back, and drives at the viewer past where it will rest (1170ms), its
           shadow on the floor broad and faint;
   1320ms  it seats with weight: the shadow pulls tight under it, the stage takes one knock, "Ranked up" rises in;
   1380ms  its material answers (app-mint.js mintArrive: a metal's highlight slides across, a gem lights from inside,
           wood and granite only take a pale rim); the tier's name is stamped and the bell rings at 1500ms;
   1440ms  it holds, tilting to the mouse with its lamp following, or settling once on its own;
   2700ms  app-mint.js flies it along a curve into the player's rank card where one is on screen (or the sidebar's
           account), turning its face to it, or it sinks away here;
   3520ms  gone; the card it went into takes it (.mint-landed). Any click or key ends it at once. Glow is on two things
   only: the crack, and the light behind the new badge. Reduced motion: no scene, one line in a toast. */
.mint { position: fixed; inset: 0; z-index: 95; overflow: hidden; display: grid; place-content: center; justify-items: center; gap: var(--space-8);
  --mint-light: color-mix(in srgb, var(--rank-edge) 72%, var(--white));
  background: radial-gradient(closest-side, rgb(4 5 9 / .74), rgb(4 5 9 / .92)); cursor: pointer; animation: mint-dim 3520ms linear both; }
/* The tier classes give their own layers to a rank card's pseudo-elements; the overlay takes only their colors. */
.mint::before, .mint::after, .mint-old::before, .mint-old::after { content: none; }
.mint-stage { position: relative; width: min(220px, calc(100vw - 48px)); aspect-ratio: 1; transition: transform 500ms var(--ease), opacity 500ms var(--ease);
  animation: mint-knock 280ms linear 1320ms both; }

/* The light behind: it gathers round the old badge's rim while it cracks, flares as it bursts, and stays low behind
   the new one. */
.mint-halo { position: absolute; inset: -30%; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, var(--mint-light), color-mix(in srgb, var(--rank-edge) 40%, transparent) 38%, transparent 72%);
  animation: mint-halo 900ms linear 620ms both; }
/* The new badge's shadow on the floor: broad and faint while it is up near the viewer, tight and dark once it sits,
   with a darker core where it touches. It slides a little against the badge's tilt (app-mint.js). */
.mint-floor { position: absolute; left: 16%; right: 16%; bottom: -7%; height: 12%; border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, rgb(0 0 0 / .7), transparent); animation: mint-floor 480ms 960ms both; }
.mint-floor::after { content: ''; position: absolute; inset: 28% 24%; border-radius: 50%; opacity: 0;
  background: radial-gradient(closest-side, rgb(0 0 0 / .85), transparent); animation: mint-contact 200ms ease-out 1300ms both; }

/* The old badge, in full colour, with its pieces laid over it, hidden until it breaks. */
.mint-old { position: absolute; inset: 11.8%; z-index: 2; perspective: 560px;
  animation: mint-old-in 280ms var(--ease) both, mint-tremor 340ms linear 620ms both; }
.mint-old > img { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 12px 14px rgb(0 0 0 / .6)); }
.mint-piece { position: absolute; inset: 0; visibility: hidden; background: var(--old) center / 100% 100% no-repeat; will-change: transform; }
.mint-bit { position: absolute; visibility: hidden; translate: -50% -50%; }
.mint-old.broken > img, .mint-old.broken > .mint-crack { visibility: hidden; }
.mint-old.broken > :is(.mint-piece, .mint-bit) { visibility: visible; }
/* Wood's slivers, stone's grit, gold's coins. */
.mint-splinter { border-radius: 1px; background: linear-gradient(180deg, color-mix(in srgb, var(--rank-edge) 60%, #fff), color-mix(in srgb, var(--rank-edge) 55%, #000)); }
.mint-grain { clip-path: polygon(10% 20%, 70% 0, 100% 60%, 60% 100%, 0 75%);
  background: linear-gradient(150deg, color-mix(in srgb, var(--rank-edge) 80%, #fff), color-mix(in srgb, var(--rank-edge) 45%, #000)); }
.mint-coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffbe0, #f1c453 40%, #c98a06 75%, #7a4d00);
  box-shadow: inset 0 0 0 1px #fff3b099, 0 2px 3px rgb(0 0 0 / .5); }
.mint-dust { position: absolute; left: 50%; top: 60%; width: 150%; aspect-ratio: 1.6; translate: -50% -50%; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--rank-edge) 50%, transparent), transparent); animation: mint-dust 900ms var(--ease) 960ms both; }
.mint-ring { position: absolute; inset: 8%; border: 2px solid var(--rank-edge); border-radius: 50%; opacity: 0; animation: mint-ring 640ms var(--ease) 960ms both; }
/* The crack: drawn along the break lines, lit in the new tier's light, kept to the badge's own shape; it opens wider
   just before the burst. Each line's delays are set inline. */
.mint-crack { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
  -webkit-mask: var(--old) center / 100% 100% no-repeat; mask: var(--old) center / 100% 100% no-repeat;
  filter: drop-shadow(0 0 1.5px var(--mint-light)) drop-shadow(0 0 5px var(--mint-light)); }
.mint-crack path { fill: none; stroke: color-mix(in srgb, var(--mint-light) 35%, #fff); stroke-width: .9; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: mint-crack 180ms cubic-bezier(.3, 0, .7, 1) both, mint-crack-open 150ms ease-in both; }

/* The new badge, an object: .mint-new holds the depth it is seen in (and flies, app-mint.js), .mint-body takes its way
   in, .mint-tilt its turn to the mouse and to the card. In the tilt, the face (the badge's own art, inlined) lies over
   five silhouettes of it set deeper and darker, which show as its thickness only when it turns. Its pose is set from
   app-mint.js; the one here is where it starts, behind the break. */
.mint-new { position: absolute; inset: 0; z-index: 1; opacity: 0; perspective: 720px; animation: mint-new-in 90ms linear 960ms both; }
.mint-body, .mint-tilt { position: absolute; inset: 0; transform-style: preserve-3d; }
.mint-body { transform: translateY(16px) translateZ(-300px) rotateX(24deg); }
.mint-edge { position: absolute; inset: 0; -webkit-mask: var(--new) center / 100% 100% no-repeat; mask: var(--new) center / 100% 100% no-repeat; }
.mint-face { position: absolute; inset: 0; }
.mint-face > :is(img, svg) { display: block; width: 100%; height: 100%; overflow: visible; }
/* The art's own lights: the inner facets turn about the field's middle. */
.mint-art .mint-turn { transform-box: view-box; transform-origin: 20px 21px; }
/* While the art is still on its way the badge is a picture, and one band of light crosses it as it seats. */
.mint-shine { position: absolute; inset: 0; mix-blend-mode: screen; pointer-events: none;
  -webkit-mask: var(--new) center / 100% 100% no-repeat; mask: var(--new) center / 100% 100% no-repeat;
  background: linear-gradient(105deg, transparent 40%, rgb(255 255 255 / .12) 45%, rgb(255 255 255 / .72) 50%, rgb(255 255 255 / .12) 55%, transparent 60%) 100% 0 / 260% 100% no-repeat;
  animation: mint-shine 620ms cubic-bezier(.5, 0, .3, 1) 1380ms both; }

/* The caption, set under the badge as it seats: "Ranked up" small, rising from behind its own line, then the tier's
   name large in the tier's ink, stamped down. */
.mint-caption { display: grid; justify-items: center; gap: var(--space-3); margin: 0; max-width: calc(100vw - 32px); text-align: center; }
.mint-kicker { display: block; overflow: hidden; padding: 0 2px 2px; color: var(--text-2); font: 600 var(--fs-md)/1.2 var(--font-ui); letter-spacing: .02em; }
.mint-kicker > span { display: block; translate: 0 115%; animation: mint-wipe 320ms var(--ease) 1340ms both; }
.mint-caption b { display: block; color: var(--rank-ink); font: 700 clamp(34px, 10vw, var(--fs-7xl))/1 var(--font-head); letter-spacing: .04em; text-transform: uppercase;
  text-shadow: 0 2px 0 rgb(0 0 0 / .55); opacity: 0; animation: mint-stamp 230ms linear 1370ms both; }
.mint.settling :is(.mint-caption, .mint-floor) { animation: mint-out 260ms var(--ease) both; }
.mint.settling .mint-halo { animation: mint-halo-out 260ms var(--ease) both; }

@keyframes mint-dim { 0% { opacity: 0; } 4% { opacity: 1; } 79% { opacity: 1; } 100% { opacity: 0; } }
@keyframes mint-old-in { from { opacity: 0; scale: .94; } to { opacity: 1; scale: 1; } }
@keyframes mint-tremor { 0% { translate: 0 0; } 12% { translate: 1px 0; } 24% { translate: -1px 1px; } 38% { translate: 2px -1px; } 52% { translate: -2px 1px; }
  66% { translate: 2px 0; } 80% { translate: -3px 1px; } 92% { translate: 3px -1px; } 100% { translate: 0 0; } }
@keyframes mint-crack { to { stroke-dashoffset: 0; } }
@keyframes mint-crack-open { to { stroke-width: 2.4; } }
@keyframes mint-halo { 0% { opacity: 0; scale: .45; } 37% { opacity: .55; scale: .56; } 46% { opacity: 1; scale: 1.1; animation-timing-function: var(--ease); } 100% { opacity: .32; scale: .86; } }
@keyframes mint-halo-out { from { opacity: .32; scale: .86; } to { opacity: 0; scale: .86; } }
@keyframes mint-new-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mint-knock { 0% { translate: 0 0; } 18% { translate: 0 5px; } 45% { translate: 0 -2px; } 72% { translate: 0 1px; } 100% { translate: 0 0; } }
@keyframes mint-floor { 0% { opacity: 0; scale: .5 .6; animation-timing-function: cubic-bezier(.12, .75, .3, 1); }
  44% { opacity: .28; scale: 1.5 1.25; animation-timing-function: cubic-bezier(.6, 0, .92, .45); }
  75% { opacity: 1; scale: .86 .8; animation-timing-function: var(--ease); } 100% { opacity: .92; scale: 1; } }
@keyframes mint-contact { from { opacity: 0; scale: 1.4 1; } to { opacity: 1; scale: 1; } }
@keyframes mint-dust { 0% { opacity: 0; scale: .4; } 15% { opacity: .9; } 100% { opacity: 0; scale: 1.35; translate: -50% -36%; } }
@keyframes mint-ring { 0% { opacity: .9; scale: .5; } 100% { opacity: 0; scale: 1.9; } }
@keyframes mint-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes mint-wipe { to { translate: 0 0; } }
@keyframes mint-stamp { 0% { opacity: 0; scale: 1.7; filter: blur(3px); animation-timing-function: cubic-bezier(.55, 0, .85, .35); }
  58% { opacity: 1; scale: .96; filter: blur(0); animation-timing-function: cubic-bezier(.2, .7, .3, 1); } 100% { opacity: 1; scale: 1; filter: none; } }
@keyframes mint-out { from { opacity: 1; } to { opacity: 0; } }
/* With no rank card in view the new badge lies back and sinks where it is. */
.mint.sinking .mint-stage { transform: scale(.6); opacity: 0; }
/* The rank card the badge went into takes it: knocked a little the way it came (--mint-kx and --mint-ky, set by
   app-mint.js), pressed in and lit for a moment, and back with a small give. */
.mint-landed.mint-landed { animation: mint-landed 620ms linear both; }
@keyframes mint-landed {
  0% { translate: 0 0; scale: 1; filter: brightness(1); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  14% { translate: calc(var(--mint-kx, 0) * 4px) calc(var(--mint-ky, 0) * 4px); scale: .97; filter: brightness(1.45); animation-timing-function: cubic-bezier(.4, 0, .4, 1); }
  48% { translate: calc(var(--mint-kx, 0) * -1px) calc(var(--mint-ky, 0) * -1px); scale: 1.012; filter: brightness(1.1); animation-timing-function: var(--ease); }
  100% { translate: 0 0; scale: 1; filter: none; } }
:root.reduce-motion .mint { display: none; }
:root.reduce-motion .mint-landed { animation: none; }
