/* Página del top ranking: podio minimalista con medallas metálicas */
.rank-page {
  min-height: 100vh;
  background:
    radial-gradient(680px 380px at 50% -90px, rgba(92, 200, 255, 0.13), transparent 65%),
    radial-gradient(520px 320px at 105% 0%, rgba(233, 59, 45, 0.1), transparent 60%);
}

.rank-wrap {
  width: min(100% - 40px, 420px);
  margin: 0 auto;
  padding: 26px 0 48px;
}

/* Cabecera mínima --------------------------------------------------------- */
.rank-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 38px;
}

.rank-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.rank-brand img {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  object-fit: cover;
}

.rank-store {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.rank-store:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.rank-brand:focus-visible,
.rank-store:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* Título ------------------------------------------------------------------ */
.rank-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--brand-light);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.rank-eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.rank-hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 7vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.rank-sub {
  margin: 0 0 26px;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* Lista ------------------------------------------------------------------- */
.rank-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.028);
  transition: transform 0.25s ease, border-color 0.25s ease;
  animation: rankIn 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.rank-item:nth-child(2) { animation-delay: 0.06s; }
.rank-item:nth-child(3) { animation-delay: 0.12s; }

.rank-item--1 {
  grid-template-columns: 24px 60px minmax(0, 1fr) auto;
  padding: 16px;
  border-color: rgba(140, 230, 255, 0.34);
  background:
    radial-gradient(150px 90px at 88% 10%, rgba(96, 199, 255, 0.16), transparent 70%),
    linear-gradient(120deg, rgba(120, 220, 255, 0.11), rgba(120, 220, 255, 0.02) 58%, rgba(255, 255, 255, 0.02));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45), 0 0 64px rgba(92, 200, 255, 0.08);
}

@media (hover: hover) {
  .rank-item:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
  }
  .rank-item--1:hover {
    border-color: rgba(140, 230, 255, 0.55);
  }
}

@keyframes rankIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Medallas ---------------------------------------------------------------- */
.rank-medal {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe9a8, #e0a92b);
  box-shadow: 0 0 0 1px rgba(255, 224, 150, 0.3), inset 0 -2px 4px rgba(0, 0, 0, 0.28);
  color: #2a1d06;
  font-size: 0.66rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.rank-item--2 .rank-medal {
  background: linear-gradient(145deg, #eef3f9, #9aa5b4);
  box-shadow: 0 0 0 1px rgba(230, 238, 247, 0.28), inset 0 -2px 4px rgba(0, 0, 0, 0.22);
  color: #1b222c;
}
.rank-item--3 .rank-medal {
  background: linear-gradient(145deg, #f6c39d, #b4682f);
  box-shadow: 0 0 0 1px rgba(246, 195, 157, 0.26), inset 0 -2px 4px rgba(0, 0, 0, 0.25);
  color: #2b1507;
}

/* Avatares ---------------------------------------------------------------- */
.rank-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #ff7a6d, #b31f1a 75%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 1.5px rgba(230, 238, 247, 0.28);
}
.rank-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.rank-item--1 .rank-avatar {
  width: 60px;
  height: 60px;
  box-shadow: 0 0 0 2px rgba(140, 230, 255, 0.6), 0 0 28px rgba(92, 200, 255, 0.26);
}
.rank-item--3 .rank-avatar {
  box-shadow: 0 0 0 1.5px rgba(246, 195, 157, 0.3);
}

.rank-crown {
  position: absolute;
  top: -9px;
  right: -7px;
  width: 22px;
  height: 22px;
  transform: rotate(-12deg);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  animation: crownBob 3.2s ease-in-out infinite alternate;
}
.rank-crown path {
  fill: #ffd470;
  stroke: #b47c12;
  stroke-width: 0.7;
  stroke-linejoin: round;
}

@keyframes crownBob {
  from { transform: rotate(-12deg) translateY(0); }
  to { transform: rotate(-12deg) translateY(-2px); }
}

/* Datos ------------------------------------------------------------------- */
.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 600;
}
.rank-item--1 .rank-name {
  font-size: 1.02rem;
  font-weight: 700;
}

.rank-total {
  display: grid;
  justify-items: end;
  gap: 1px;
  line-height: 1.1;
}

.rank-diamonds {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.rank-num {
  color: #8ce4ff;
  filter: drop-shadow(0 2px 8px rgba(92, 200, 255, 0.3));
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .rank-num {
    background: linear-gradient(180deg, #e9fdff 0%, #9fe9ff 34%, #3fa9ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}
.rank-item--1 .rank-diamonds {
  font-size: 1.16rem;
}

.rank-dia {
  flex: none;
  width: 12px;
  height: 12px;
  opacity: 0.95;
  filter: drop-shadow(0 1px 4px rgba(92, 200, 255, 0.45));
}

.rank-total small {
  color: var(--text-dim);
  font-size: 0.62rem;
}

/* Pie --------------------------------------------------------------------- */
.rank-foot {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}
.rank-foot p {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text-dim);
  font-size: 0.66rem;
}

.rank-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8ce9ff;
  box-shadow: 0 0 0 0 rgba(140, 233, 255, 0.45);
  animation: rankPulse 2s infinite;
}

@keyframes rankPulse {
  0% { box-shadow: 0 0 0 0 rgba(140, 233, 255, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(140, 233, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(140, 233, 255, 0); }
}

/* Carga y vacío ----------------------------------------------------------- */
.rank-skeleton {
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.03) 30%, rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.03) 70%);
  background-size: 220% 100%;
  animation: rankShimmer 1.4s linear infinite;
}
.rank-skeleton:first-child {
  height: 94px;
}

@keyframes rankShimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

.rank-empty {
  padding: 34px 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .rank-item,
  .rank-crown,
  .rank-dot,
  .rank-skeleton {
    animation: none;
  }
  .rank-item,
  .rank-item:hover {
    transition: none;
    transform: none;
  }
}

.rank-avatar .rank-tier {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(6, 10, 16, 0.9);
  box-shadow: 0 0 8px rgba(255, 90, 70, 0.3);
  pointer-events: none;
}

.rank-item--1 .rank-tier {
  width: 36px;
  height: 36px;
  right: -10px;
  bottom: -10px;
}
