/* M4 Eternal — the rankings page: the client's hall of champions as the head, the three first on champion banners,
   then the board as gold-lined rows (cards on phones). Tokens, buttons, tabs and the kicker come from site.css. */

/* ---------- head ---------- */
.rk-head {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: clamp(420px, 46vw, 600px); padding: 130px 0 46px;
  display: grid; align-items: end;
}
.rk-head__art { position: absolute; inset: 0; z-index: -1; }
.rk-head__art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; animation: pan 26s ease-in-out infinite alternate; }
.rk-head__art::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: url("/assets/official/ui/glow.png") 50% 30% / 900px 600px no-repeat; opacity: 0.25; mix-blend-mode: screen;
}
.rk-head__art::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background:
    radial-gradient(70% 90% at 50% 30%, transparent 30%, rgba(5, 7, 11, 0.75) 100%),
    linear-gradient(0deg, var(--ink) 2%, rgba(5, 7, 11, 0.55) 45%, rgba(5, 7, 11, 0.35) 75%, rgba(5, 7, 11, 0.7));
}
.rk-head__inner { display: grid; gap: 36px; justify-items: center; text-align: center; }
.rk-head__copy { max-width: 760px; }
.rk-head__title {
  font-size: clamp(42px, 7vw, 96px); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px;
  background: linear-gradient(180deg, #fff6dc 0%, var(--gold-hi) 38%, var(--gold) 70%, var(--gold-lo) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.6)) drop-shadow(0 0 34px rgba(210, 171, 103, 0.28));
}
:lang(ko) .rk-head__title, :lang(ja) .rk-head__title, :lang(zh-Hant) .rk-head__title, :lang(zh-Hans) .rk-head__title { letter-spacing: 0.04em; }
.rk-head .lede { color: #d8d2c3; font-size: 17.5px; margin: 0 auto; max-width: 600px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }

.rk-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(880px, 100%); margin: 0;
  background: linear-gradient(180deg, rgba(14, 21, 32, 0.78), rgba(5, 7, 11, 0.88));
  border: 1px solid var(--gold-line); box-shadow: var(--shadow), inset 0 1px 0 rgba(246, 226, 174, 0.08);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  position: relative;
}
.rk-stats::before, .rk-stats::after {
  content: ""; position: absolute; top: -12px; width: 109px; height: 24px; pointer-events: none;
  background: url("/assets/official/ui/pattern-02.png") center / contain no-repeat; opacity: 0.55;
}
.rk-stats::before { left: 50%; transform: translateX(-50%); }
.rk-stats::after { display: none; }
.rk-stat { padding: 18px 14px 16px; }
.rk-stat + .rk-stat { border-left: 1px solid var(--gold-hair); }
.rk-stat dt { font-size: 11.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.rk-stat dd { margin: 0; font-size: clamp(22px, 2.2vw, 30px); color: var(--gold-hi); line-height: 1.2; }
:lang(ko) .rk-stat dt, :lang(ja) .rk-stat dt, :lang(zh-Hant) .rk-stat dt, :lang(zh-Hans) .rk-stat dt, :lang(th) .rk-stat dt { letter-spacing: 0.06em; }

/* ---------- body ---------- */
.rk-body { position: relative; padding: 40px 0 110px; isolation: isolate; overflow-x: clip; } /* the champions' glow bleeds past the edge on narrow screens */
.rk-body::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 900px; z-index: -1; pointer-events: none;
  background: radial-gradient(700px 420px at 50% 280px, rgba(210, 171, 103, 0.12), transparent 70%);
}
.rk-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.rk-tabs { margin: 0; background: rgba(5, 7, 11, 0.6); }
.rk-updated { margin: 0; font-size: 13.5px; }

/* ---------- podium ---------- */
.rk-podium {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2.4vw, 36px);
  align-items: end; max-width: 1040px; margin: 10px auto 54px;
}
.rk-podium[hidden] { display: none; }
.rk-champ { position: relative; text-align: center; min-width: 0; }
.rk-champ--1 { order: 2; } .rk-champ--2 { order: 1; } .rk-champ--3 { order: 3; }
.rk-podium.is-short { grid-template-columns: repeat(auto-fit, minmax(0, 300px)); justify-content: center; }
.rk-podium.is-short .rk-champ { order: 0; }

.rk-champ__stage { position: relative; width: min(100%, 230px); margin: 0 auto -54px; aspect-ratio: 262 / 488; }
.rk-champ--1 .rk-champ__stage { width: min(100%, 272px); }
.rk-champ__flag { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.7)); }
.rk-champ--2 .rk-champ__flag, .rk-champ--3 .rk-champ__flag { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.7)) saturate(0.85); }
.rk-champ--3 .rk-champ__flag { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.7)) sepia(0.55) hue-rotate(-12deg) saturate(1.2) brightness(0.85); }
.rk-champ__glow {
  position: absolute; left: -20%; right: -20%; top: 10%; bottom: 0;
  background: radial-gradient(closest-side, rgba(246, 226, 174, 0.28), transparent); filter: blur(10px);
  animation: rk-breathe 4.5s ease-in-out infinite alternate;
}
.rk-champ--2 .rk-champ__glow { background: radial-gradient(closest-side, rgba(116, 212, 242, 0.22), transparent); }
.rk-champ--3 .rk-champ__glow { background: radial-gradient(closest-side, rgba(214, 140, 84, 0.22), transparent); }
@keyframes rk-breathe { from { opacity: 0.55; } to { opacity: 1; } }
.rk-champ__hero {
  position: absolute; left: 7%; width: 86%; bottom: 14%; height: auto;
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 98%); mask-image: linear-gradient(180deg, #000 72%, transparent 98%);
  transition: transform 0.6s var(--ease);
}
.rk-champ:hover .rk-champ__hero { transform: translateY(-6px) scale(1.02); }
.rk-champ__emblem { position: absolute; left: 50%; top: 5%; width: 26%; transform: translateX(-50%); opacity: 0.9; filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.8)); }

.rk-champ__plate {
  position: relative; padding: 0 16px 18px;
  background: linear-gradient(180deg, rgba(14, 21, 32, 0.6), rgba(10, 15, 23, 0.95));
  border: 1px solid var(--gold-hair); border-top: 0;
}
.rk-champ--1 .rk-champ__plate { border-color: var(--gold-line); box-shadow: 0 30px 60px -30px rgba(210, 171, 103, 0.45); }
.rk-champ__plate::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.rk-champ__rank { width: 70px; margin: 0 auto 4px; position: relative; top: -2px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8)); }
.rk-champ--1 .rk-champ__rank { width: 84px; }
.rk-champ__name { font-size: clamp(18px, 1.8vw, 24px); color: #fff; overflow-wrap: anywhere; line-height: 1.25; }
.rk-champ--1 .rk-champ__name { color: var(--gold-hi); }
.rk-champ__class { margin: 2px 0 12px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); }
.rk-champ__stats { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid var(--gold-hair); }
.rk-champ__stat { padding: 10px 6px 0; }
.rk-champ__stat + .rk-champ__stat { border-left: 1px solid var(--gold-hair); }
.rk-champ__stat dt { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.rk-champ__stat dd { margin: 0; font-size: 18px; color: var(--text); }
.rk-champ__stat.is-key dd { color: var(--gold-hi); }

.rk-champ.is-ghost { height: 420px; border: 1px solid var(--gold-hair); background: linear-gradient(100deg, rgba(20, 29, 43, 0.4) 30%, rgba(36, 50, 70, 0.55) 50%, rgba(20, 29, 43, 0.4) 70%) 0 0 / 300% 100%; animation: rk-shimmer 1.4s linear infinite; }
.rk-champ--1.is-ghost { height: 480px; }
@keyframes rk-shimmer { to { background-position: -150% 0; } }

/* ---------- tools: class filter and search ---------- */
.rk-tools { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.rk-classes { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.rk-classes > .rk-chip { flex: 1 1 auto; }
.rk-chip {
  display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 44px; padding: 4px 6px 4px 4px;
  background: rgba(14, 21, 32, 0.72); border: 1px solid var(--gold-hair); color: var(--muted);
  font-size: 13px; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.rk-chip:hover { border-color: var(--gold-line); color: var(--text); }
.rk-chip[aria-pressed="true"] { color: #fff; border-color: var(--cyan-line); background: linear-gradient(180deg, rgba(116, 212, 242, 0.16), rgba(10, 15, 23, 0.8)); box-shadow: inset 0 -2px 0 var(--cyan); }
.rk-chip.is-empty { opacity: 0.45; }
.rk-chip__name { flex: 1; white-space: nowrap; text-align: left; }
.rk-chip img.emblem { flex: none; width: 26px; height: 26px; object-fit: contain; }
.rk-chip__all { flex: none; width: 26px; height: 26px; background: url("/assets/official/ui/frame-etc-deco.png") center / contain no-repeat; }
.rk-chip__count { flex: none; min-width: 20px; padding: 0 4px; font-size: 11.5px; line-height: 18px; text-align: center; color: var(--gold); border: 1px solid var(--gold-hair); }
.rk-search { position: relative; flex: 0 1 280px; }
.rk-search::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 13px; height: 13px; margin-top: -9px;
  border: 2px solid var(--muted); border-radius: 50%; pointer-events: none;
}
.rk-search::after { content: ""; position: absolute; left: 27px; top: 50%; width: 7px; height: 2px; margin-top: 4px; background: var(--muted); transform: rotate(45deg); pointer-events: none; }
.rk-search input {
  width: 100%; height: 44px; padding: 0 14px 0 42px; font-size: 15px; color: var(--text);
  background: rgba(5, 7, 11, 0.7); border: 1px solid var(--gold-hair); border-radius: var(--radius);
}
.rk-search input::placeholder { color: var(--faint); }
.rk-search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(116, 212, 242, 0.15); }

/* ---------- the board ---------- */
.rk-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.rk-list-head .rk-list-title { margin: 0; }
.rk-list-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; font-size: 20px; color: var(--gold-hi); text-transform: uppercase; letter-spacing: 0.1em; scroll-margin-top: 90px; }
.rk-count { font-size: 13.5px; text-transform: none; letter-spacing: 0.02em; }
.rk-table { display: grid; gap: 6px; }
.rk-row {
  display: grid; grid-template-columns: 76px minmax(0, 1.7fr) minmax(0, 1fr) 110px 150px; gap: 16px; align-items: center;
  min-height: 70px; padding: 8px 22px 8px 12px;
  background: linear-gradient(90deg, rgba(14, 21, 32, 0.86), rgba(10, 15, 23, 0.72));
  border: 1px solid var(--gold-hair); position: relative;
  transition: border-color 0.2s, background 0.2s;
}
.rk-rows .rk-row { animation: rise 0.55s var(--ease) both; }
.rk-rows .rk-row:hover { border-color: var(--gold-line); background: linear-gradient(90deg, rgba(24, 34, 49, 0.92), rgba(14, 21, 32, 0.8)); }
.rk-row--head { min-height: 0; padding-block: 6px; background: none; border-color: transparent; font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.rk-row--head > :first-child { text-align: center; }
.rk-row--top::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--gold); }
.rk-row--1 { background: linear-gradient(90deg, rgba(138, 106, 54, 0.32), rgba(14, 21, 32, 0.8) 55%); border-color: var(--gold-line); }
.rk-row--2::before { background: #b9c9d8; }
.rk-row--3::before { background: #c58a5a; }
.rk-rows .rk-rows__ghost { display: none; }
.rk-row--ghost { min-height: 70px; background: linear-gradient(100deg, rgba(20, 29, 43, 0.4) 30%, rgba(36, 50, 70, 0.55) 50%, rgba(20, 29, 43, 0.4) 70%) 0 0 / 300% 100%; animation: rk-shimmer 1.4s linear infinite !important; }
.r { text-align: right; }

.rk-cell { min-width: 0; }
.rk-cell--rank { display: grid; place-items: center; }
.rk-rank { display: inline-grid; place-items: center; min-width: 44px; height: 44px; font-size: 18px; color: var(--muted); }
.rk-rank--badge img { width: 50px; height: auto; }
.rk-cell--hero { display: flex; align-items: center; gap: 14px; }
.rk-avatar {
  flex: none; width: 70px; height: 46px; overflow: hidden; position: relative;
  border: 1px solid var(--gold-hair); background: var(--steel);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.rk-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.rk-row--top .rk-avatar { border-color: var(--gold-line); }
.rk-hero { display: grid; gap: 7px; min-width: 0; flex: 1; }
.rk-hero__name { font-size: 16.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-row--1 .rk-hero__name { color: var(--gold-hi); }
.rk-bar-meter { display: block; height: 2px; max-width: 280px; background: rgba(255, 255, 255, 0.06); }
.rk-bar-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); transform-origin: left; transition: transform 0.8s var(--ease); }
.rk-class { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); min-width: 0; }
.rk-class__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-class img.emblem { width: 30px; height: 30px; flex: none; object-fit: contain; }
.rk-cell--level, .rk-cell--cp { font-size: 16px; color: var(--text); }
.rk-cell.is-key { color: var(--gold-hi); font-size: 18px; }
.rk-label { display: none; }

/* states: empty, error, no match */
.rk-state { padding: 46px 20px; text-align: center; border: 1px dashed var(--gold-hair); background: rgba(10, 15, 23, 0.6); }
.rk-state > span { display: grid; justify-items: center; gap: 14px; }
.rk-state__mark { width: 64px; height: 64px; opacity: 0.6; }
.rk-state__text { color: var(--muted); font-size: 16px; max-width: 460px; }

/* pages */
.rk-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 28px; }
.rk-pager[hidden] { display: none; }
.rk-page {
  min-width: 44px; height: 44px; padding: 0 10px; font-size: 15px; color: var(--muted); cursor: pointer;
  background: rgba(14, 21, 32, 0.72); border: 1px solid var(--gold-hair); font-variant-numeric: tabular-nums;
}
.rk-page:hover:not(:disabled) { color: #fff; border-color: var(--gold-line); }
.rk-page[aria-current="page"] { color: #fff; border-color: var(--cyan-line); background: linear-gradient(180deg, rgba(116, 212, 242, 0.18), rgba(10, 15, 23, 0.8)); box-shadow: inset 0 -2px 0 var(--cyan); }
.rk-page:disabled { opacity: 0.35; cursor: default; }
.rk-page--step { font-size: 20px; line-height: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .rk-classes { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .rk-classes > .rk-chip { justify-content: center; }
  .rk-chip__name { display: none; }
}
@media (max-width: 1100px) {
  .rk-row { grid-template-columns: 64px minmax(0, 1.6fr) minmax(0, 1fr) 84px 120px; gap: 12px; padding-right: 16px; }
}
@media (max-width: 760px) {
  .rk-head { padding: 104px 0 30px; min-height: 0; }
  .rk-stats { grid-template-columns: 1fr 1fr; }
  .rk-stat:nth-child(3) { border-left: 0; }
  .rk-stat:nth-child(n + 3) { border-top: 1px solid var(--gold-hair); }
  .rk-stat { padding: 14px 10px 12px; }

  .rk-podium { grid-template-columns: 1fr 1fr; gap: 26px 12px; margin-bottom: 40px; }
  .rk-champ--1 { order: 0; grid-column: 1 / -1; }
  .rk-champ--1 .rk-champ__stage { width: min(62%, 230px); }
  .rk-champ--1 .rk-champ__plate { max-width: 330px; margin: 0 auto; }
  .rk-champ--2 { order: 1; } .rk-champ--3 { order: 2; }
  .rk-champ__stage { width: min(84%, 170px); margin-bottom: -40px; }
  .rk-champ__plate { padding: 0 10px 14px; }
  .rk-champ__rank { width: 56px; } .rk-champ--1 .rk-champ__rank { width: 70px; }
  .rk-champ__class { font-size: 11.5px; letter-spacing: 0.08em; margin-bottom: 10px; }
  .rk-champ__stat dd { font-size: 15.5px; }
  .rk-champ__stat dt { font-size: 10px; letter-spacing: 0.06em; }
  .rk-champ.is-ghost { height: 300px; } .rk-champ--1.is-ghost { height: 360px; }
  .rk-podium.is-short { grid-template-columns: 1fr 1fr; }

  .rk-tools { flex-direction: column; align-items: stretch; }
  .rk-classes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rk-classes > .rk-chip { flex: none; }
  .rk-chip { justify-content: center; padding: 4px 6px; }
  .rk-chip__name { display: none; }
  .rk-search { flex: 1 1 100%; }
  .rk-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }

  .rk-row--head { display: none; }
  .rk-row {
    grid-template-columns: 52px minmax(0, 1fr) auto auto; grid-template-areas: "rank hero hero hero" "rank class level cp";
    gap: 8px 14px; padding: 12px 14px 12px 8px;
  }
  .rk-cell--rank { grid-area: rank; align-self: start; }
  .rk-cell--hero { grid-area: hero; }
  .rk-cell--class { grid-area: class; }
  .rk-cell--level { grid-area: level; }
  .rk-cell--cp { grid-area: cp; }
  .rk-cell--class, .rk-cell--level, .rk-cell--cp { display: grid; gap: 1px; align-content: start; }
  .rk-label { display: block; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); line-height: 1.4; white-space: nowrap; }
  .rk-class { font-size: 13.5px; gap: 6px; }
  .rk-class img.emblem { width: 22px; height: 22px; }
  .rk-cell--level, .rk-cell--cp { font-size: 15px; }
  .rk-cell.is-key { font-size: 16px; }
  .rk-avatar { width: 58px; height: 38px; }
  .rk-rank--badge img { width: 42px; }
  .rk-row--ghost { min-height: 96px; }
}
@media (max-width: 400px) {
  .rk-row { grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 8px 10px; padding-right: 10px; }
  .rk-class > img.emblem { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rk-head__art img, .rk-champ__glow, .rk-champ.is-ghost, .rk-row--ghost { animation: none !important; }
}
