/* Avatar Shop & Leaderboard */

.avatar-shop {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface) 0%, var(--accent-light) 100%);
}
.avatar-shop::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(132, 204, 22, 0.12);
  filter: blur(60px);
  pointer-events: none;
}
.avatar-shop-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 56px;
  align-items: center;
}
.avatar-shop-copy h2 {
  margin: 0 0 16px;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.avatar-shop-copy > p {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.65;
}
.avatar-perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.avatar-perks li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--text-2);
  font-weight: 500;
}
.avatar-perks li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.avatar-shop-demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  position: relative;
}
.avatar-shop-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  animation: badge-pulse 2.5s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.avatar-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 20px 20px 28px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(37, 99, 235, 0.08), transparent),
    linear-gradient(165deg, #eef4ff 0%, #f8fafc 45%, #ffffff 100%);
  border-radius: 20px;
  margin-bottom: 24px;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}
.avatar-stage-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -58%);
  border-radius: 50%;
  border: 1px dashed rgba(37, 99, 235, 0.15);
  animation: ring-spin 48s linear infinite;
}
@keyframes ring-spin {
  to { transform: translate(-50%, -58%) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-stage-ring { animation: none; }
}
.avatar-stage-glow {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 48px;
  background: radial-gradient(ellipse, rgba(37, 99, 235, 0.22), transparent 70%);
}
.avatar-pedestal {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.02));
  border-radius: 50%;
  z-index: 0;
}
.avatar-character {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 220px;
  display: flex;
  justify-content: center;
  transform-origin: center bottom;
}
.avatar-character.bounce {
  animation: avatar-bounce 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes avatar-bounce {
  40% { transform: scale(1.04) translateY(-6px); }
}
.avatar-render {
  width: 100%;
  min-height: 240px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.avatar-render.is-loading .avatar-skeleton {
  display: block;
}
.avatar-skeleton {
  display: none;
  width: 120px;
  height: 200px;
  border-radius: 60px 60px 24px 24px;
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    #e2e8f0 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.avatar-render .avatar-svg-app {
  width: 100%;
  height: auto;
  max-height: 280px;
  display: block;
  filter: drop-shadow(0 12px 28px rgba(15, 23, 42, 0.12));
}
.avatar-fallback {
  margin: 0;
  padding: 24px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-2);
}
.avatar-base-picker { display: flex; gap: 10px; margin-bottom: 20px; }
.avatar-base-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.avatar-base-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
}
.avatar-control-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}
.avatar-swatch-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.avatar-swatch-row:last-child { margin-bottom: 0; }
.avatar-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.avatar-swatch:hover { transform: scale(1.12); }
.avatar-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.leaderboard-section {
  background: var(--text);
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  overflow: hidden;
}
.leaderboard-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 0%, rgba(37, 99, 235, 0.25), transparent),
    radial-gradient(ellipse 50% 40% at 90% 100%, rgba(132, 204, 22, 0.15), transparent);
  pointer-events: none;
}
.leaderboard-section .eyebrow { background: rgba(255,255,255,0.12); color: #93c5fd; }
.leaderboard-section .section-head h2 { color: #fff; }
.leaderboard-section .section-sub { color: rgba(255,255,255,0.65); }
.leaderboard-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
  align-items: start;
}
.leaderboard-intro p { margin: 0 0 20px; color: rgba(255,255,255,0.7); line-height: 1.65; }
.leaderboard-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.leaderboard-tag {
  padding: 8px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.leaderboard-panel {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
}
.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.leaderboard-header h3 { margin: 0; font-size: 1.125rem; color: #fff; }
.leaderboard-live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #86efac;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.leaderboard-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: live-blink 1.5s ease-in-out infinite;
}
@keyframes live-blink {
  50% { opacity: 0.5; box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}
.leaderboard-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
  min-height: 160px;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 120px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s, transform 0.6s;
}
.leaderboard-panel.visible .podium-item { opacity: 1; transform: translateY(0); }
.leaderboard-panel.visible .podium-item:nth-child(2) { transition-delay: 0.05s; }
.leaderboard-panel.visible .podium-item:nth-child(1) { transition-delay: 0.2s; }
.leaderboard-panel.visible .podium-item:nth-child(3) { transition-delay: 0.35s; }
.podium-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  border: 3px solid rgba(255,255,255,0.2);
  position: relative;
}
.podium-item--first .podium-avatar {
  width: 72px;
  height: 72px;
  font-size: 1.2rem;
  border-color: #fbbf24;
  animation: crown-glow 2s ease-in-out infinite;
}
@keyframes crown-glow {
  50% { box-shadow: 0 0 32px rgba(251,191,36,0.55); }
}
.podium-crown {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  animation: crown-bob 2s ease-in-out infinite;
}
@keyframes crown-bob {
  50% { transform: translateX(-50%) translateY(-4px); }
}
.podium-name { font-size: 0.85rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.podium-pts { font-size: 0.75rem; color: rgba(255,255,255,0.55); margin-bottom: 10px; }
.podium-pts strong { color: #fbbf24; }
.podium-bar {
  width: 100%;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.leaderboard-panel.visible .podium-bar { transform: scaleY(1); }
.podium-item--second .podium-bar { height: 72px; transition-delay: 0.15s; }
.podium-item--first .podium-bar { height: 96px; background: linear-gradient(180deg, #fbbf24, #f59e0b); transition-delay: 0.25s; }
.podium-item--third .podium-bar { height: 56px; transition-delay: 0.35s; }
.leaderboard-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lb-row {
  display: grid;
  grid-template-columns: 36px 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.5s, transform 0.5s;
}
.leaderboard-panel.visible .lb-row { opacity: 1; transform: translateX(0); }
.leaderboard-panel.visible .lb-row:nth-child(1) { transition-delay: 0.4s; }
.leaderboard-panel.visible .lb-row:nth-child(2) { transition-delay: 0.5s; }
.leaderboard-panel.visible .lb-row:nth-child(3) { transition-delay: 0.6s; }
.leaderboard-panel.visible .lb-row:nth-child(4) { transition-delay: 0.7s; }
.lb-rank { font-weight: 800; color: rgba(255,255,255,0.4); text-align: center; }
.lb-mini-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
}
.lb-info strong { display: block; font-size: 0.9rem; color: #fff; margin-bottom: 6px; }
.lb-bar-track { height: 6px; background: rgba(255,255,255,0.1); border-radius: 999px; overflow: hidden; }
.lb-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  width: var(--lb-pct, 0%);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.lb-points { font-weight: 800; color: #fff; text-align: right; min-width: 48px; }
.lb-points span { font-size: 0.7rem; font-weight: 600; color: rgba(255,255,255,0.45); display: block; }

@media (max-width: 960px) {
  .avatar-shop-grid, .leaderboard-wrap { grid-template-columns: 1fr; }
  .avatar-shop-copy { text-align: center; }
  .avatar-perks { align-items: center; }
}
