/* ═══════════════════════════════════════════════════
   RANKS / Statystyki — Dark Fantasy + level-up FX
   ═══════════════════════════════════════════════════ */

.lbn-ranks {
  --rk-gold: #d4af37;
  --rk-gold-bright: #ffe566;
  --rk-ink: #e8dcc0;
  --rk-muted: #8a7a5e;
}

/* ── Featured stats (4 najważniejsze) ── */
.rk-featured {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}

.rk-feat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 118px;
  padding: 14px 8px 12px;
  text-decoration: none !important;
  color: var(--rk-ink);
  border: 2px solid rgba(138, 106, 26, 0.55);
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 220, 80, 0.12) 0%, transparent 55%),
    linear-gradient(180deg, #2c2116 0%, #161210 100%);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.rk-feat:hover,
.rk-feat:focus {
  transform: translateY(-2px);
  text-decoration: none !important;
  color: #fff8e0;
}

.rk-feat.is-active {
  border-color: var(--rk-gold-bright);
  box-shadow:
    0 0 18px rgba(255, 215, 0, 0.35),
    inset 0 0 20px rgba(255, 180, 40, 0.12);
}

/* per-stat accent */
.rk-feat--level {
  --fx: #ffd54a;
  --fx-soft: rgba(255, 213, 74, 0.45);
}
.rk-feat--dmg {
  --fx: #ff6b4a;
  --fx-soft: rgba(255, 80, 40, 0.4);
}
.rk-feat--def {
  --fx: #5eb8ff;
  --fx-soft: rgba(70, 160, 255, 0.4);
}
.rk-feat--magic {
  --fx: #c084fc;
  --fx-soft: rgba(180, 100, 255, 0.45);
}

.rk-feat--level:hover,
.rk-feat--level.is-active { border-color: #ffd54a; box-shadow: 0 0 20px rgba(255, 213, 74, 0.4), inset 0 0 18px rgba(255, 200, 50, 0.15); }
.rk-feat--dmg:hover,
.rk-feat--dmg.is-active { border-color: #ff6b4a; box-shadow: 0 0 20px rgba(255, 80, 40, 0.4), inset 0 0 18px rgba(255, 60, 20, 0.12); }
.rk-feat--def:hover,
.rk-feat--def.is-active { border-color: #5eb8ff; box-shadow: 0 0 20px rgba(70, 160, 255, 0.4), inset 0 0 18px rgba(40, 120, 255, 0.12); }
.rk-feat--magic:hover,
.rk-feat--magic.is-active { border-color: #c084fc; box-shadow: 0 0 20px rgba(180, 100, 255, 0.4), inset 0 0 18px rgba(160, 80, 255, 0.12); }

/* Level-up burst ring */
.rk-feat__burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.rk-feat__burst::before,
.rk-feat__burst::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  border: 2px solid var(--fx);
  opacity: 0;
  animation: rk-burst 2.8s ease-out infinite;
}

.rk-feat__burst::after {
  animation-delay: 1.4s;
  border-width: 1px;
}

.rk-feat:nth-child(2) .rk-feat__burst::before { animation-delay: 0.35s; }
.rk-feat:nth-child(2) .rk-feat__burst::after { animation-delay: 1.75s; }
.rk-feat:nth-child(3) .rk-feat__burst::before { animation-delay: 0.7s; }
.rk-feat:nth-child(3) .rk-feat__burst::after { animation-delay: 2.1s; }
.rk-feat:nth-child(4) .rk-feat__burst::before { animation-delay: 1.05s; }
.rk-feat:nth-child(4) .rk-feat__burst::after { animation-delay: 2.45s; }

@keyframes rk-burst {
  0% {
    transform: scale(0.35);
    opacity: 0.85;
    box-shadow: 0 0 8px var(--fx-soft);
  }
  70% {
    opacity: 0.25;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
    box-shadow: 0 0 0 transparent;
  }
}

/* floating spark particles (level-up style) */
.rk-feat__sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.rk-feat__sparks span {
  position: absolute;
  bottom: 18%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--fx);
  box-shadow: 0 0 6px var(--fx), 0 0 12px var(--fx-soft);
  opacity: 0;
  animation: rk-spark 2.4s ease-out infinite;
}

.rk-feat__sparks span:nth-child(1) { margin-left: -18px; animation-delay: 0s; }
.rk-feat__sparks span:nth-child(2) { margin-left: 10px; width: 2px; height: 2px; animation-delay: 0.4s; }
.rk-feat__sparks span:nth-child(3) { margin-left: -4px; animation-delay: 0.8s; }
.rk-feat__sparks span:nth-child(4) { margin-left: 20px; width: 2px; height: 2px; animation-delay: 1.2s; }
.rk-feat__sparks span:nth-child(5) { margin-left: -26px; animation-delay: 1.6s; }
.rk-feat__sparks span:nth-child(6) { margin-left: 2px; width: 4px; height: 4px; animation-delay: 2s; }

@keyframes rk-spark {
  0% {
    transform: translateY(8px) scale(0.4);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translateY(-52px) scale(0.2);
    opacity: 0;
  }
}

/* shine sweep like EXP gain */
.rk-feat__shine {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 255, 220, 0.14) 48%,
    transparent 62%
  );
  background-size: 220% 100%;
  animation: rk-shine 3.8s linear infinite;
}

.rk-feat:nth-child(2) .rk-feat__shine { animation-delay: 0.9s; }
.rk-feat:nth-child(3) .rk-feat__shine { animation-delay: 1.8s; }
.rk-feat:nth-child(4) .rk-feat__shine { animation-delay: 2.7s; }

@keyframes rk-shine {
  0% { background-position: 140% 0; }
  100% { background-position: -140% 0; }
}

.rk-feat__icon {
  position: relative;
  z-index: 2;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px var(--fx-soft));
  animation: rk-icon-pulse 2.2s ease-in-out infinite;
}

.rk-feat:nth-child(2) .rk-feat__icon { animation-delay: 0.3s; }
.rk-feat:nth-child(3) .rk-feat__icon { animation-delay: 0.6s; }
.rk-feat:nth-child(4) .rk-feat__icon { animation-delay: 0.9s; }

.rk-feat__icon img {
  max-width: 40px;
  max-height: 40px;
  image-rendering: auto;
}

@keyframes rk-icon-pulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px var(--fx-soft));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 14px var(--fx));
  }
}

.rk-feat__label {
  position: relative;
  z-index: 2;
  font-family: "Cinzel", Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--fx);
  text-shadow: 0 0 10px var(--fx-soft), 0 1px 2px #000;
}

.rk-feat__sub {
  position: relative;
  z-index: 2;
  font-size: 10px;
  color: var(--rk-muted);
  text-align: center;
  line-height: 1.2;
}

.rk-feat__badge {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 3;
  padding: 1px 5px;
  font-family: "Cinzel", serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a1208;
  background: linear-gradient(180deg, var(--rk-gold-bright), var(--rk-gold));
  border: 1px solid rgba(255, 240, 160, 0.6);
  box-shadow: 0 0 8px var(--fx-soft);
  animation: rk-badge-glow 2s ease-in-out infinite;
}

@keyframes rk-badge-glow {
  0%, 100% { box-shadow: 0 0 4px var(--fx-soft); }
  50% { box-shadow: 0 0 12px var(--fx); }
}

/* ── Section labels ── */
.rk-section-label {
  margin: 4px 0 8px;
  padding: 0 2px;
  font-family: "Cinzel", Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rk-gold);
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.35);
}

/* ── Secondary skill picker ── */
.rk-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 0 0 14px;
}

.rk-skill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 72px;
  padding: 7px 4px 6px;
  text-decoration: none !important;
  color: var(--rk-ink);
  border: 1px solid rgba(138, 106, 26, 0.4);
  background: rgba(28, 22, 16, 0.92);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rk-skill:hover,
.rk-skill:focus {
  border-color: var(--rk-gold);
  background: rgba(40, 30, 18, 0.95);
  color: #fff8e0;
  text-decoration: none !important;
}

.rk-skill.is-active {
  border-color: var(--rk-gold-bright);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
  background: rgba(50, 38, 18, 0.95);
}

.rk-skill img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.rk-skill__name {
  font-size: 9px;
  font-family: "Cinzel", serif;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--rk-muted);
  line-height: 1.15;
}

.rk-skill.is-active .rk-skill__name,
.rk-skill:hover .rk-skill__name {
  color: var(--rk-gold);
}

/* ── Ranking board ── */
.rk-board {
  border: 2px solid rgba(138, 106, 26, 0.5);
  background:
    linear-gradient(180deg, rgba(40, 30, 18, 0.55), rgba(20, 14, 10, 0.85));
  overflow: hidden;
}

.rk-board__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(138, 106, 26, 0.4);
  background: linear-gradient(180deg, #32261a, #1c1510);
}

.rk-board__title {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--rk-gold-bright);
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px rgba(255, 200, 50, 0.35);
}

.rk-board__title span {
  color: var(--rk-ink);
  font-weight: 600;
}

.rk-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.rk-pages a,
.rk-pages span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  font-family: "Cinzel", serif;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(138, 106, 26, 0.45);
  color: var(--rk-muted);
  text-decoration: none !important;
  background: rgba(0, 0, 0, 0.3);
}

.rk-pages a:hover {
  border-color: var(--rk-gold);
  color: var(--rk-gold-bright);
}

.rk-pages span.is-current {
  border-color: var(--rk-gold);
  color: #1a1208;
  background: linear-gradient(180deg, var(--rk-gold-bright), var(--rk-gold));
}

.rk-table {
  width: 100%;
  border-collapse: collapse;
}

.rk-table th,
.rk-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(138, 106, 26, 0.22);
  font-size: 13px;
  color: var(--rk-ink);
}

.rk-table th {
  font-family: "Cinzel", serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rk-gold);
  background: rgba(0, 0, 0, 0.25);
}

.rk-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.15);
}

.rk-table tr:hover td {
  background: rgba(212, 175, 55, 0.08);
}

.rk-table a {
  color: var(--rk-gold-bright);
  text-decoration: none;
  font-weight: 600;
}

.rk-table a:hover {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.rk-pos {
  font-family: "Cinzel", serif;
  font-weight: 700;
  color: var(--rk-muted);
  width: 40px;
}

.rk-pos--1 { color: #ffd700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.55); }
.rk-pos--2 { color: #c0c8d4; text-shadow: 0 0 6px rgba(180, 200, 220, 0.4); }
.rk-pos--3 { color: #cd7f32; text-shadow: 0 0 6px rgba(205, 127, 50, 0.45); }

.rk-val {
  font-family: "Cinzel", Consolas, monospace;
  font-weight: 700;
  color: var(--rk-gold);
  text-align: right !important;
  white-space: nowrap;
}

.rk-val--glow {
  color: var(--rk-gold-bright);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
  animation: rk-val-pulse 2s ease-in-out infinite;
}

@keyframes rk-val-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 215, 0, 0.3); }
  50% { text-shadow: 0 0 14px rgba(255, 230, 100, 0.7); }
}

/* top-3 row accent */
.rk-table tr.rk-row--top td {
  background: rgba(212, 175, 55, 0.06);
}

.rk-table tr.rk-row--1 td {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.12), transparent 70%);
}

/* ── Overview / other stats ── */
.rk-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rk-card {
  border: 1px solid rgba(138, 106, 26, 0.4);
  background: rgba(28, 22, 16, 0.92);
  overflow: hidden;
}

.rk-card__head {
  padding: 8px 10px;
  font-family: "Cinzel", serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rk-gold);
  border-bottom: 1px solid rgba(138, 106, 26, 0.35);
  background: rgba(0, 0, 0, 0.25);
}

.rk-card__body {
  padding: 4px 0;
}

.rk-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--rk-ink);
  border-bottom: 1px solid rgba(138, 106, 26, 0.12);
}

.rk-stat-row:last-child {
  border-bottom: 0;
}

.rk-stat-row strong {
  color: var(--rk-gold);
  font-family: "Cinzel", Consolas, monospace;
}

.rk-empty,
.rk-error {
  text-align: center;
  padding: 18px 12px;
  color: var(--rk-muted);
  font-size: 13px;
}

.rk-error {
  color: #e07070;
}

.rk-refresh {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--rk-muted);
}

.rk-refresh strong {
  color: var(--rk-gold);
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .rk-featured {
    grid-template-columns: repeat(2, 1fr);
  }

  .rk-overview {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .rk-featured {
    grid-template-columns: 1fr 1fr;
  }

  .rk-feat {
    min-height: 100px;
    padding: 10px 6px;
  }

  .rk-skill {
    width: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rk-feat__burst::before,
  .rk-feat__burst::after,
  .rk-feat__sparks span,
  .rk-feat__shine,
  .rk-feat__icon,
  .rk-feat__badge,
  .rk-val--glow {
    animation: none !important;
  }
}
