/* 🎖 Rank up (world/js/rpg/ui-rankup.js): the Rank up window and the World's chat line. Everything takes the rank's
   colour from --rk (data.js HOLDER_TIERS). The show follows League up's (league.css): the old emblem spins up
   (.spinning, .charged), bursts into the new one (.landed; the window jolts, .modal.rku-boom), then the perks pop in
   ([data-pop].on). .rku-view (someone's rank, from a chat line) starts landed, no show. */
.rku { position: relative; text-align: center; --rk-hi: color-mix(in srgb, var(--rk) 55%, #fff); }
.rku-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.rku-kick { margin: 0 0 2px; font-size: 13px; font-weight: 700; line-height: 1.3; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rk); }
.modal .rku-h { margin: 0 0 8px; font-size: 26px; line-height: 1.15; color: #fff; text-shadow: 0 2px 0 #000; }
.rku-h span { color: var(--rk-hi); }
.rku.landed:not(.rku-view) .rku-h { animation: rku-title 0.55s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes rku-title { from { scale: 0.7; } }

/* The stage: rays and a glow behind the emblem, the rank's name on a ribbon under it. */
.rku-stage { position: relative; height: 210px; margin: 0 0 14px; border-radius: 14px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--rk) 55%, #2e3d74); background: radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--rk) 30%, #16224e), #0d1438 72%); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5); }
.rku-rays { position: absolute; left: 50%; top: 42%; width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%; background: repeating-conic-gradient(color-mix(in srgb, var(--rk-hi) 45%, transparent) 0 9deg, transparent 9deg 22.5deg); -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%); mask: radial-gradient(circle, #000 18%, transparent 62%); opacity: 0.18; scale: 0.6; transition: opacity 0.4s, scale 0.6s; animation: rku-spin 22s linear infinite; }
.rku.charged .rku-rays { opacity: 0.35; scale: 0.7; }
.rku.landed .rku-rays { opacity: 1; scale: 1; }
@keyframes rku-spin { to { rotate: 360deg; } }
.rku-glow { position: absolute; left: 50%; top: 42%; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.8), color-mix(in srgb, var(--rk) 45%, transparent) 42%, transparent 70%); opacity: 0.25; transition: opacity 0.3s, scale 0.3s; }
.rku.spinning .rku-glow { opacity: 0.45; }
.rku.charged .rku-glow { opacity: 1; scale: 1.35; animation: rku-throb 0.16s ease-in-out infinite alternate; }
.rku.landed .rku-glow { opacity: 0.6; scale: 1.2; animation: none; }
@keyframes rku-throb { to { scale: 1.5; } }
.rku-tap { position: absolute; left: 50%; top: 42%; translate: -50% -50%; z-index: 1; padding: 0; border: 0; background: none; cursor: pointer; }
.rku-emb { display: block; width: 116px; height: 116px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); animation: rku-idle 1.6s ease-in-out infinite; }
.rku-emb.rku-none { filter: grayscale(1) brightness(0.55) drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); }
.rku.spinning .rku-emb { animation: none; }
.rku.charged .rku-emb { filter: brightness(1.4) drop-shadow(0 0 16px #fff); }
.rku.landed .rku-tap { animation: rku-land 0.7s cubic-bezier(0.2, 1.5, 0.4, 1); }
.rku.landed .rku-emb { filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)) drop-shadow(0 0 16px color-mix(in srgb, var(--rk) 85%, transparent)); animation: rku-bob 1.8s ease-in-out 0.8s infinite; }
@keyframes rku-idle { 0%, 100% { rotate: 0deg; } 25% { rotate: -3deg; } 75% { rotate: 3deg; } }
@keyframes rku-land { 0% { scale: 0.55; } 100% { scale: 1; } }
@keyframes rku-bob { 50% { translate: 0 -5px; } }
.rku-flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 42%, #fff, rgba(255, 255, 255, 0.85) 35%, color-mix(in srgb, var(--rk-hi) 40%, transparent) 75%); }
.rku.landed:not(.rku-view) .rku-flash { animation: rku-flash 0.6s ease-out; }
@keyframes rku-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.rku-was, .rku-name { position: absolute; left: 50%; bottom: 12px; translate: -50% 0; z-index: 2; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-family: var(--display); line-height: 1.2; }
.rku-was, .rku-name { font-size: 18px; }
.rku-was { color: #fff; text-shadow: 0 2px 0 #000; transition: opacity 0.2s; }
.rku-was .tier-ico { width: 16px; height: 16px; }
.rku.landed .rku-was { opacity: 0; }
.rku-name { padding: 4px 20px; border-radius: 6px; border: 2px solid rgba(10, 8, 20, 0.7); background: linear-gradient(180deg, var(--rk-hi), color-mix(in srgb, var(--rk) 80%, #000)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 3px 0 rgba(0, 0, 0, 0.45); color: #160f24; font-size: 20px; opacity: 0; scale: 0.6; }
.rku-name .tier-ico { width: 18px; height: 18px; }
.rku.landed .rku-name { animation: rku-name 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) 0.25s forwards; }
.rku-view .rku-name { animation: none !important; opacity: 1; scale: 1; }
@keyframes rku-name { to { opacity: 1; scale: 1; } }
.modal.rku-boom { animation: rku-boom 0.45s ease-out; }
@keyframes rku-boom { 0%, 100% { translate: 0 0; } 15% { translate: -7px 3px; } 30% { translate: 6px -4px; } 45% { translate: -4px 2px; } 60% { translate: 3px -1px; } 80% { translate: -1px 0; } }

/* The others' window: the hero (drawn 4x, as the map draws them) stands left of the emblem on the stage. */
.rku-hero { position: absolute; left: calc(50% - 56px); top: 44%; translate: -50% -50%; z-index: 1; width: 64px; height: 128px; image-rendering: pixelated; opacity: 0; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.35)) drop-shadow(0 0 10px color-mix(in srgb, var(--rk) 55%, transparent)); }
.rku-hero.on { opacity: 1; animation: rku-hero-bob 1.8s ease-in-out infinite; }
@keyframes rku-hero-bob { 0%, 100% { translate: -50% -50%; } 50% { translate: -50% calc(-50% - 5px); } } /* keeps the centring: a bare translate would drop it */
.rku-drawn .rku-tap { left: calc(50% + 52px); }
.rku-drawn .rku-emb { width: 100px; height: 100px; }
.rku-drawn .rku-glow { left: calc(50% + 52px); }

/* The perks: new ones as tiles, the rest as chips, what waits on something else dimmed with how. */
.modal .rku-q { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 17px; letter-spacing: 0.02em; color: var(--rk-hi); text-align: left; }
.modal .rku-q2 { margin-top: 12px; font-size: 15px; color: #bcc5ea; }
.rku-tiles { list-style: none; margin: 0; padding: 8px 0 0; display: grid; row-gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 8px; text-align: left; }
.rku-tile { position: relative; display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--rk) 65%, #34468a); background: linear-gradient(180deg, #1a2663, #141e52); box-shadow: 0 3px 0 #000a2e, 0 0 12px color-mix(in srgb, var(--rk) 22%, transparent); }
.rku-ico { display: grid; place-items: center; width: 40px; height: 40px; font-size: 26px; line-height: 1; }
.rku-tile b, .rku-wait b { display: block; font-family: var(--display); font-weight: 400; font-size: 17px; line-height: 1.2; color: #fff; }
.rku-tile small, .rku-wait small { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.35; color: #bcc5ea; }
.rku-chip { position: absolute; top: -8px; left: 10px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--rk); color: #160f24; font-style: normal; font-size: 12px; font-weight: 800; line-height: 1; letter-spacing: 0.06em; }
.rku-chip.up { background: #5fe86f; }
.rku-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rku-chips li { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 7px; border-radius: 8px; border: 1px solid #34468a; background: #141e52; color: #dfe5fa; font-size: 14px; line-height: 1; cursor: help; }
.rku-chips li span { font-size: 16px; line-height: 1; }
.rku-wait { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.rku-wait li { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; border: 1px dashed #3a4a86; background: rgba(255, 255, 255, 0.03); }
.rku-wait .rku-ico { filter: grayscale(0.7); opacity: 0.75; }
.rku-wait b { color: #dfe5fa; }

/* The others' window: what the ranks under it give, folded (owner: "keep the stuff bellow it, minimized"). */
.rku-more { margin-top: 12px; text-align: left; }
.rku-more summary { display: flex; align-items: center; gap: 8px; width: fit-content; padding: 6px 12px 6px 10px; border-radius: 8px; border: 1px solid #34468a; background: #141e52; color: #bcc5ea; font-family: var(--display); font-size: 15px; line-height: 1.2; cursor: pointer; list-style: none; }
.rku-more summary::-webkit-details-marker { display: none; }
.rku-more summary::before { content: "▸"; color: var(--rk-hi); transition: rotate 0.2s; }
.rku-more[open] summary::before { rotate: 90deg; }
.rku-more summary b { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 6px; background: color-mix(in srgb, var(--rk) 30%, #0d1438); color: #fff; font-size: 13px; }
.rku-more summary:hover, .rku-more summary:focus-visible { border-color: color-mix(in srgb, var(--rk) 70%, #34468a); color: #fff; }
.rku-more .rku-chips { margin-top: 8px; }

/* The next rank: its badge, what it adds, Get there. */
.rku-next { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--nk) 50%, #34468a); background: linear-gradient(90deg, color-mix(in srgb, var(--nk) 14%, #141e52), #141e52); text-align: left; }
.rku-nb .tier-ico { display: block; width: 30px; height: 30px; }
.rku-next small { display: block; font-size: 14px; line-height: 1.3; color: #bcc5ea; }
.rku-next small b { color: var(--nk); }
.rku-next em { display: block; margin-top: 2px; font-style: normal; font-size: 13.5px; line-height: 1.35; color: #fff; }
.rku-next .btn { white-space: nowrap; }
.modal .rku-top { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--rk) 55%, transparent); background: rgba(255, 255, 255, 0.04); font-size: 14.5px; line-height: 1.4; color: #dfe5fa; text-align: left; }
.rku .actions { justify-content: center; margin-top: 14px; }
.rku [data-pop] { opacity: 0; visibility: hidden; }
.rku [data-pop].on { visibility: visible; animation: rku-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) forwards; }
@keyframes rku-pop { 0% { opacity: 0; scale: 0.7; translate: 0 10px; } 100% { opacity: 1; scale: 1; translate: 0 0; } }

/* The World's chat line: the name, the rank's badge and name in its colour. */
.rku-line .rku-who { color: #fff; cursor: pointer; }
.rku-line .rku-rank { color: var(--rk); }
.rku-line .rku-rank .tier-ico { width: 1em; height: 1em; margin-right: 3px; vertical-align: -0.14em; }

@media (max-width: 560px) {
  .modal .rku-h { font-size: 22px; }
  .rku-stage { height: 186px; }
  .rku-emb, .rku-drawn .rku-emb { width: 88px; height: 88px; }
  .rku-hero { left: calc(50% - 48px); width: 48px; height: 96px; } /* 3x on a phone: the feet clear the rank's ribbon */
  .rku-drawn .rku-tap, .rku-drawn .rku-glow { left: calc(50% + 44px); }
  .rku-tiles { grid-template-columns: 1fr; }
  .rku-next { grid-template-columns: 30px 1fr; }
  .rku-next .btn { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .rku-rays, .rku-emb, .rku.landed .rku-emb, .rku.landed .rku-tap, .rku.landed .rku-h, .modal.rku-boom, .rku-hero.on { animation: none !important; }
  .rku.landed .rku-flash { animation: none; }
  .rku.landed .rku-name { animation: none; opacity: 1; scale: 1; }
  .rku [data-pop].on { animation: none; opacity: 1; }
}
