/* CTF LEADERBOARD POLISH */
.lb-wrap { padding-top: 0; padding-bottom: 3rem; }

body:has(.ctf-lb-top) .page-hero {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--navbar-h, 68px) + 2.25rem);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(0,212,255,.12);
  background:
    radial-gradient(ellipse at 70% 0%, rgba(0,212,255,.11) 0%, transparent 60%),
    linear-gradient(180deg, rgba(0,212,255,.05) 0%, transparent 100%);
}
body:has(.ctf-lb-top) .page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,.04) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent);
          mask-image: linear-gradient(180deg, #000, transparent);
  pointer-events: none;
}
body:has(.ctf-lb-top) .page-hero .container { position: relative; z-index: 1; }

.lb-summary { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; }
.lb-chip { padding: .4rem .95rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #aab5c6; font-size: .85rem; }
.lb-chip b { color: #fff; font-family: var(--font-mono, monospace); }
.lb-chip-me { border-color: rgba(0,212,255,.45); background: rgba(0,212,255,.1); color: #bfefff; }
.lb-chip-me b { color: #00d4ff; }

/* podium */
.ctf-lb-top { margin: 0 0 1.75rem; }
.lbp { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 1rem; max-width: 860px; margin: 0 auto; }
.lbp.n1 { grid-template-columns: minmax(0, 340px); justify-content: center; }
.lbp.n2 { grid-template-columns: 1fr 1.15fr; max-width: 600px; }
.lbp-slot { position: relative; display: flex; flex-direction: column; min-width: 0; animation: lbpIn .6s ease backwards; transition: transform .3s ease; }
.lbp-slot:hover { transform: translateY(-4px); }
.lbp-slot.r1 { order: 2; --tc: #f9e2af; --tc-a: rgba(249,226,175,.45); --tc-bg: rgba(249,226,175,.13); --tc-g: rgba(249,226,175,.28); animation-delay: .28s; }
.lbp-slot.r2 { order: 1; --tc: #cdd6f4; --tc-a: rgba(205,214,244,.35); --tc-bg: rgba(205,214,244,.09); --tc-g: rgba(205,214,244,.16); animation-delay: 0s; }
.lbp-slot.r3 { order: 3; --tc: #d8985a; --tc-a: rgba(216,152,90,.4);   --tc-bg: rgba(216,152,90,.1);   --tc-g: rgba(216,152,90,.2);  animation-delay: .14s; }
@keyframes lbpIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.lbp-head {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.1rem .8rem 1rem;
  border: 1px solid var(--tc-a);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, var(--tc-bg), #080d13 88%);
  transition: box-shadow .3s ease;
}
.lbp-slot:hover .lbp-head { box-shadow: 0 0 34px var(--tc-g); }
.lbp-slot.me .lbp-head { box-shadow: 0 0 0 1px #00d4ff, 0 0 26px rgba(0,212,255,.25); }
.lbp-slot.r1 .lbp-head::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.12), transparent);
  transform: skewX(-18deg);
  animation: lbpSheen 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lbpSheen { 0%, 55% { left: -60%; } 100% { left: 130%; } }

.lbp-crown { width: 28px; height: 28px; margin-bottom: .35rem; color: #f9e2af; filter: drop-shadow(0 0 8px rgba(249,226,175,.6)); animation: lbpFloat 3s ease-in-out infinite; }
.lbp-crown svg { width: 100%; height: 100%; display: block; }
@keyframes lbpFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.lbp-av {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 3px solid var(--tc);
  background: var(--tc-bg);
  color: var(--tc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, monospace);
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--tc-g);
}
.lbp-slot.r1 .lbp-av { width: 84px; height: 84px; font-size: 1.5rem; box-shadow: 0 0 30px var(--tc-g); }
.lbp-txt { min-width: 0; width: 100%; }
.lbp-name { margin-top: .7rem; display: flex; justify-content: center; font-weight: 700; color: #fff; font-size: 1rem; }
.lbp-slot.r1 .lbp-name { font-size: 1.15rem; }
.lbp-pts { margin-top: .3rem; font-family: var(--font-mono, monospace); font-weight: 700; color: var(--tc); font-size: .95rem; }
.lbp-pts b { font-size: 1.35rem; }
.lbp-slot.r1 .lbp-pts b { font-size: 1.75rem; }
.lbp-stg { font-family: var(--font-mono, monospace); font-size: .72rem; color: #8b98a5; margin-top: .1rem; }

.lbp-step {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tc-a);
  background: linear-gradient(180deg, var(--tc-bg), rgba(8,13,19,.4));
}
.lbp-step span { font-family: var(--font-mono, monospace); font-weight: 800; line-height: 1; color: var(--tc); text-shadow: 0 0 22px var(--tc-g); }
.lbp-slot.r1 .lbp-step { height: 96px; } .lbp-slot.r1 .lbp-step span { font-size: 2.8rem; }
.lbp-slot.r2 .lbp-step { height: 68px; } .lbp-slot.r2 .lbp-step span { font-size: 2.1rem; }
.lbp-slot.r3 .lbp-step { height: 48px; } .lbp-slot.r3 .lbp-step span { font-size: 1.7rem; }

.lb-line { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.lbp-name .lb-line { justify-content: center; max-width: 100%; }
.lb-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-you {
  flex-shrink: 0;
  padding: .12rem .5rem;
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #00d4ff;
  border: 1px solid rgba(0,212,255,.5);
  background: rgba(0,212,255,.1);
}

/* table */
.ctf-lb-table { border-radius: 14px; background: #080d13; border-color: rgba(0,212,255,.12); }
#ctfLeaderboardWrap { border-radius: 0 0 14px 14px !important; border-left: 0 !important; }
.ctf-lb-header { background: rgba(0,212,255,.04); border-bottom-color: rgba(0,212,255,.12); }
.ctf-lb-row { border-bottom-color: rgba(255,255,255,.06); animation: lbpIn .4s ease backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.ctf-lb-row:hover { background: rgba(0,212,255,.05); }
.ctf-lb-row.me { background: rgba(0,212,255,.08); border-left-color: #00d4ff; border-bottom-color: rgba(0,212,255,.2); }
.ctf-lb-row.me .ctf-lb-rank { border-color: #00d4ff; color: #00d4ff; }
.ctf-lb-row.me .ctf-lb-name::after { content: none; }
.ctf-lb-name { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.lb-bar { display: block; height: 4px; max-width: 260px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.lb-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #00d4ff, #00d4aa); }

@media (max-width: 700px) {
  .lbp, .lbp.n2 { grid-template-columns: 1fr; gap: .7rem; max-width: none; }
  .lbp-slot.r1 { order: 1; } .lbp-slot.r2 { order: 2; } .lbp-slot.r3 { order: 3; }
  .lbp-step { display: none; }
  .lbp-head { flex-direction: row; text-align: left; gap: .9rem; padding: .8rem 1rem; border-bottom: 1px solid var(--tc-a); border-radius: 14px; }
  .lbp-av, .lbp-slot.r1 .lbp-av { width: 52px; height: 52px; font-size: 1.05rem; }
  .lbp-name { margin-top: 0; justify-content: flex-start; }
  .lbp-name .lb-line { justify-content: flex-start; }
  .lbp-pts b, .lbp-slot.r1 .lbp-pts b { font-size: 1.2rem; }
  .lbp-crown { position: absolute; top: .6rem; right: .9rem; margin: 0; width: 24px; height: 24px; }
  .ctf-lb-header, .ctf-lb-row { grid-template-columns: 38px 34px minmax(0, 1fr) auto; gap: .6rem; padding-left: .8rem; padding-right: .8rem; }
  .ctf-lb-header span:nth-child(4), .ctf-lb-header span:nth-child(5), .ctf-lb-country, .ctf-lb-stages { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lbp-slot, .lbp-crown, .lbp-slot.r1 .lbp-head::after, .ctf-lb-row { animation: none; }
  .lbp-slot { transition: none; }
  .lbp-slot:hover { transform: none; }
}

/* CTF LEADERBOARD FONT */
.lb-summary, .lbp, .ctf-lb-table, .ctf-lb-header, .ctf-lb-row, .ctf-lb-rank, .ctf-lb-name, .ctf-lb-stages,
.ctf-lb-points, .ctf-lb-avatar, .lbp-av, .lbp-pts, .lbp-stg, .lbp-step span, .lb-chip, .lb-chip b, .lb-you {
  font-family: "Plus Jakarta Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
.ctf-lb-header { font-size: .72rem; font-weight: 700; letter-spacing: .1em; color: #8b98a5; }
.ctf-lb-rank { font-size: .85rem; font-weight: 700; }
.ctf-lb-name { font-size: 1rem; font-weight: 600; }
.ctf-lb-stages { font-size: .88rem; font-weight: 500; color: #9aa7b8; }
.ctf-lb-points { font-size: .85rem; font-weight: 700; }
.lbp-step span { font-weight: 800; }
.lbp-stg { font-size: .78rem; }
.lb-you { font-size: .62rem; font-weight: 700; }

/* CTF LEADERBOARD SUMMARY */
.lb-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; max-width: 780px; margin-top: 1.3rem; }
.lbs-card {
  display: flex;
  align-items: center;
  gap: .95rem;
  padding: .9rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(0,212,255,.16);
  background: linear-gradient(135deg, rgba(0,212,255,.09), #080d13 72%);
  animation: lbpIn .5s ease backwards;
  animation-delay: calc(var(--i, 0) * 90ms);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.lbs-card:hover { transform: translateY(-3px); border-color: rgba(0,212,255,.4); box-shadow: 0 10px 28px rgba(0,0,0,.4); }
.lbs-ico { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #00d4ff; background: rgba(0,212,255,.12); border: 1px solid rgba(0,212,255,.25); }
.lbs-ico svg { width: 22px; height: 22px; }
.lbs-txt { min-width: 0; display: flex; flex-direction: column; }
.lbs-txt b { font-size: 1.7rem; font-weight: 800; line-height: 1.1; color: #fff; letter-spacing: -.01em; }
.lbs-txt span { margin-top: .2rem; font-size: .8rem; color: #8b98a5; }
.lbs-txt em { margin-top: .15rem; font-style: normal; font-size: .76rem; color: #aab5c6; }
.lbs-me { border-color: rgba(0,212,255,.5); background: linear-gradient(135deg, rgba(0,212,255,.18), #080d13 72%); box-shadow: 0 0 26px rgba(0,212,255,.14); }
.lbs-me .lbs-txt b { color: #00d4ff; }
.lbs-gold { border-color: rgba(249,226,175,.55); background: linear-gradient(135deg, rgba(249,226,175,.16), #080d13 72%); box-shadow: 0 0 26px rgba(249,226,175,.14); }
.lbs-gold .lbs-ico { color: #f9e2af; background: rgba(249,226,175,.12); border-color: rgba(249,226,175,.35); }
.lbs-gold .lbs-txt b { color: #f9e2af; }
@media (prefers-reduced-motion: reduce) { .lbs-card { animation: none; transition: none; } .lbs-card:hover { transform: none; } }

/* CTF LEADERBOARD SUMMARY FONT */
.lb-summary, .lb-summary * {
  font-family: "Plus Jakarta Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
  font-variant-numeric: tabular-nums;
}
.lbs-txt b { font-weight: 800; letter-spacing: -.02em; }
.lbs-txt span { font-size: .84rem; font-weight: 600; color: #98a5b4; }
.lbs-txt em { font-size: .78rem; font-weight: 500; color: #b4becb; }
