/* CV Mojo app (v2 preview): the community leaderboard (/leaderboard), lb- classes. */

/* Layout: board on the left, your rank and "how to earn rep" on the right.
   Below 1180px it becomes one column: controls, your rank, board, then the rest. */
.lb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; gap: 18px 24px; align-items: start; }
.lb-controls { grid-column: 1; grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; min-width: 0; }
.lb-board { grid-column: 1; grid-row: 2; min-width: 0; }
.lb-side { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 20px; min-width: 0; }
.lb-me-slot { min-width: 0; }
.lb-me-slot[hidden], .lb-me-slot:empty { display: none; }

/* Controls ----------------------------------------------------------------- */
.lb-tab-ic { display: inline-flex; opacity: .8; }
.lb-seg { background: #fff; border: 1px solid var(--line); }
.lb-seg[hidden] { display: none; }

/* Board card -------------------------------------------------------------- */
.lb-board { --tone: var(--yellow); --bar: var(--indigo); padding: 24px 24px 18px; }
.lb-board::before { content: ''; position: absolute; left: -1px; right: -1px; top: -1px; height: 6px; background: var(--tone); border-radius: 22px 22px 0 0; transition: background-color .2s ease; }
.lb-tone--reputation { --tone: var(--yellow); --bar: var(--indigo); }
.lb-tone--reviews { --tone: var(--cyan); --bar: #0e9f9a; }
.lb-tone--helpful { --tone: var(--channel); --bar: #6f79e6; }
.lb-tone--streaks { --tone: var(--ok); --bar: #2f9a00; }
.lb-board-h { margin-bottom: 14px; }
.lb-board-h h2 { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; color: var(--navy); }
.lb-board-h p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.lb-body .ap-empty { padding: 36px 16px; }

/* Podium ------------------------------------------------------------------- */
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; max-width: 560px; margin: 8px auto 0; padding: 0; list-style: none; }
.lb-pos-1 { order: 2; }
.lb-pos-2 { order: 1; }
.lb-pos-3 { order: 3; }
.lb-pod { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; border-radius: 16px; }
.lb-pod-who { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; color: inherit; text-decoration: none; border-radius: 14px; }
a.lb-pod-who:hover { color: inherit; text-decoration: none; }
a.lb-pod-who:hover .lb-pod-name { color: var(--indigo); text-decoration: underline; text-underline-offset: 3px; }
.lb .lb-pod-av { width: 60px; height: 60px; font-size: 22px; border: 3px solid #fff; box-shadow: 0 8px 18px rgba(25, 29, 59, .14); }
.lb .lb-pos-1 .lb-pod-av { width: 76px; height: 76px; font-size: 28px; }
.lb .lb-pod.is-me .lb-pod-av { box-shadow: 0 0 0 3px var(--indigo), 0 8px 18px rgba(25, 29, 59, .14); }
.lb-pod-name { display: block; max-width: 100%; overflow: hidden; font-size: 15px; font-weight: 800; color: var(--navy); white-space: nowrap; text-overflow: ellipsis; }
.lb-pod .lb-ind { max-width: 100%; }
.lb-pod-metric { display: grid; line-height: 1.2; }
.lb-pod-metric b { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; color: var(--navy); }
.lb-pod-metric span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.lb-crown { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: -16px; color: var(--navy); background: var(--yellow); border-radius: 10px; box-shadow: 0 6px 14px rgba(25, 29, 59, .15); transform: rotate(-8deg); }
.lb-step { display: grid; place-items: center; width: 100%; margin-top: 4px; font-size: 1.6rem; font-weight: 800; color: var(--navy); border-radius: 16px 16px 6px 6px; transform-origin: 50% 100%; animation: lb-rise .6s cubic-bezier(.2, .8, .2, 1) backwards; }
.lb-h-1 .lb-step { height: 96px; background: var(--yellow); }
.lb-h-2 .lb-step { height: 70px; background: var(--cyan); }
.lb-h-3 .lb-step { height: 52px; background: var(--channel); }
.lb-pos-2 .lb-step { animation-delay: .1s; }
.lb-pos-1 .lb-step { animation-delay: .2s; }
.lb-pod-who, .lb-pod-metric, .lb-crown { animation: db-in .45s ease backwards; }
.lb-pos-2 .lb-pod-who, .lb-pos-2 .lb-pod-metric { animation-delay: .15s; }
.lb-pos-1 .lb-pod-who, .lb-pos-1 .lb-pod-metric, .lb-crown { animation-delay: .25s; }

/* An empty podium place */
.lb-pod.is-open .lb-pod-name { font-weight: 700; color: var(--muted); }
.lb-pod.is-open .lb-step { color: #9da1c4; background: var(--mist); border: 2px dashed #d6d9ea; border-bottom: 0; }
.lb .lb-av-open { color: var(--muted); background: var(--mist); border: 2px dashed #cfd2e6; box-shadow: none; }
.lb .lb-av-anon { color: var(--muted); background: var(--mist); }

/* Ranks 4 and below -------------------------------------------------------- */
.lb-list { display: grid; gap: 2px; margin: 18px -8px 0; padding: 14px 0 0; list-style: none; border-top: 1px dashed var(--line); }
.lb-row { display: grid; grid-template-columns: 2rem 2.5rem minmax(0, 1fr) auto; grid-template-areas: "rank av main metric" "rank av bar bar"; align-items: center; gap: 5px 12px; padding: 10px; color: var(--text); text-decoration: none; border-radius: 14px; transition: background-color .15s ease; }
a.lb-row:hover { color: var(--text); text-decoration: none; background: var(--mist); }
a.lb-row:hover .lb-name-t { color: var(--indigo); }
.lb-rank { grid-area: rank; display: grid; place-items: center; width: 2rem; height: 2rem; font-size: 13px; font-weight: 800; color: var(--navy); background: var(--mist); border-radius: 10px; }
.lb .lb-row .lb-av { grid-area: av; width: 40px; height: 40px; font-size: 15px; }
.lb-main { grid-area: main; min-width: 0; }
.lb-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; font-weight: 700; color: var(--navy); }
.lb-name-t { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lb-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 13px; color: var(--muted); }
.lb-ind { display: inline-block; max-width: 16em; padding: 1px 9px; overflow: hidden; font-size: 12px; font-weight: 700; line-height: 1.6; color: var(--navy); white-space: nowrap; text-overflow: ellipsis; vertical-align: middle; background: var(--cyan-soft); border-radius: 999px; }
.lb-metric { grid-area: metric; display: grid; justify-items: end; line-height: 1.15; text-align: right; white-space: nowrap; }
.lb-metric b { font-size: 1.05rem; font-weight: 800; color: var(--navy); }
.lb-metric span { font-size: 12px; font-weight: 600; color: var(--muted); }
.lb-bar { grid-area: bar; display: block; height: 6px; overflow: hidden; background: var(--mist); border-radius: 999px; }
.lb-bar i { display: block; height: 100%; background: var(--bar); border-radius: inherit; transform-origin: 0 50%; animation: lb-grow .8s cubic-bezier(.2, .8, .2, 1) .1s backwards; }
.lb-you { flex: none; display: inline-block; padding: 1px 8px; font-size: 11px; font-weight: 800; line-height: 1.5; color: #fff; background: var(--navy); border-radius: 999px; }

/* Your own row */
.lb-item.is-me .lb-row { background: var(--yellow-soft); box-shadow: inset 0 0 0 1.5px #e3ea7a; }
.lb-item.is-me .lb-rank { background: var(--yellow); }
.lb-item.is-me .lb-bar { background: #fff; }
.lb-item.is-flash .lb-row, .lb-pod.is-flash { animation: lb-flash 1.4s ease; }

.lb-gap { display: flex; justify-content: center; gap: 5px; padding: 6px 0; }
.lb-gap i { width: 5px; height: 5px; background: #cfd2e6; border-radius: 50%; }
.lb-foot { display: flex; justify-content: center; margin-top: 14px; }

/* Loading ------------------------------------------------------------------ */
.lb-skel { display: grid; gap: 22px; }
.lb-sk-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; width: 100%; max-width: 560px; margin: 8px auto 0; }
.lb-sk-pod { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb .lb-sk-av { width: 60px; height: 60px; border-radius: 50%; }
.lb .lb-pos-1 .lb-sk-av { width: 76px; height: 76px; }
.lb .lb-sk-line { width: 70%; height: 12px; }
.lb .lb-sk-step { width: 100%; border-radius: 16px 16px 6px 6px; }
.lb .lb-sk-h1 { height: 96px; }
.lb .lb-sk-h2 { height: 70px; }
.lb .lb-sk-h3 { height: 52px; }
.lb-sk-rows { display: grid; gap: 14px; padding-top: 16px; border-top: 1px dashed var(--line); }
.lb-sk-row { display: flex; align-items: center; gap: 12px; }
.lb .lb-sk-dot { flex: none; width: 32px; height: 32px; }
.lb .lb-sk-round { width: 40px; height: 40px; border-radius: 50%; }
.lb .lb-sk-text { flex: 1; height: 14px; }
.lb .lb-sk-num { flex: none; width: 48px; height: 18px; }
.lb .lb-sk-big { width: 40%; height: 44px; }
.lb .lb-sk-short { width: 50%; }

/* Your rank (or a nudge, or a join card for guests) ------------------------ */
.lb-me { padding: 22px; }
.lb-me::before { content: ''; position: absolute; left: -1px; right: -1px; top: -1px; height: 6px; background: var(--accent, transparent); border-radius: 22px 22px 0 0; }
.lb-me--ranked { --accent: var(--yellow); animation: db-in .45s ease backwards; }
.lb-me--nudge { --accent: var(--cyan); }
.lb-me--guest::before, .lb-me--plain::before { display: none; }
.lb-me--loading { display: grid; gap: 12px; }
.lb-me-sticker { top: -12px; right: 18px; }
.lb-me-title { margin: 0; font-size: 1.1rem; font-weight: 800; letter-spacing: -.01em; color: var(--navy); }
.lb-me--guest .lb-me-title { color: #fff; }
.lb-me-text { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.lb-me--guest .lb-me-text { color: #c9cdea; }
.lb-me-where { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.lb-me-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.lb-me--nudge .btn { margin-top: 16px; }
.lb-me-ic { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; color: var(--navy); background: var(--cyan-soft); border-radius: 14px; transform: rotate(-6deg); }
.lb-me-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-me-who > span { min-width: 0; }
.lb-me-who b { display: block; overflow: hidden; font-size: 15px; color: var(--navy); white-space: nowrap; text-overflow: ellipsis; }
.lb-me-who b + span { display: block; font-size: 13px; color: var(--muted); }
.lb .lb-me-av { width: 44px; height: 44px; font-size: 16px; }
.lb-me-title--rank { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 18px; }
.lb-me-label { flex-basis: 100%; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.lb-me-n { padding: 0 .05em; font-size: 3rem; font-weight: 800; letter-spacing: -.05em; line-height: 1.05; color: var(--navy); background: linear-gradient(transparent 62%, var(--yellow) 62%, var(--yellow) 92%, transparent 92%); }
.lb-me-joint { font-size: 14px; font-weight: 700; color: var(--muted); }
.lb-me-stat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.lb-me-stat b { font-size: 1.05rem; font-weight: 800; color: var(--navy); }
.lb-me-gap { flex-basis: 100%; font-weight: 600; color: var(--text); }
.lb-me-jump { width: 100%; margin-top: 16px; }

/* How to earn rep ---------------------------------------------------------- */
.lb-how { padding: 22px; }
.lb-how .db-card-h { margin-bottom: 12px; }
.lb-how-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lb-how-list li { display: flex; align-items: baseline; gap: 10px; font-size: 14px; line-height: 1.45; color: var(--text); }
.lb-pts { flex: none; min-width: 3.4em; padding: 2px 8px; font-size: 12.5px; font-weight: 800; text-align: center; color: var(--navy); white-space: nowrap; background: var(--yellow-soft); border-radius: 999px; }
.lb-how-note { margin: 14px 0 0; padding-top: 12px; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); }

/* Focus -------------------------------------------------------------------- */
.lb-row:focus-visible, .lb-pod-who:focus-visible, .lb-seg button:focus-visible, .lb-me .btn:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }
.lb-me--guest .btn:focus-visible { outline-color: var(--yellow); }
span.lb-row:focus, span.lb-pod-who:focus { outline: none; }
span.lb-row:focus-visible, span.lb-pod-who:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }

/* Motion ------------------------------------------------------------------- */
@keyframes lb-rise { from { opacity: 0; transform: scaleY(.25); } }
@keyframes lb-grow { from { transform: scaleX(0); } }
@keyframes lb-flash { 0%, 40% { box-shadow: 0 0 0 4px var(--yellow), inset 0 0 0 1.5px #e3ea7a; } }
.lb-body.is-static .lb-step, .lb-body.is-static .lb-bar i, .lb-body.is-static .lb-pod-who,
.lb-body.is-static .lb-pod-metric, .lb-body.is-static .lb-crown { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .lb-step, .lb-bar i, .lb-pod-who, .lb-pod-metric, .lb-crown, .lb-me--ranked,
  .lb-item.is-flash .lb-row, .lb-pod.is-flash, .lb .skeleton { animation: none; }
  .lb-row, .lb-board::before { transition: none; }
}

/* Narrower screens ---------------------------------------------------------- */
@media (max-width: 1180px) {
  .lb-layout { display: flex; flex-direction: column; gap: 18px; }
  .lb-side { display: contents; }
  .lb-controls { order: 0; }
  .lb-me-slot { order: 3; }
  .lb-me-slot.is-member { order: 1; }
  .lb-board { order: 2; }
  .lb-how { order: 4; }
}
@media (max-width: 760px) {
  .lb-board { padding: 20px 16px 14px; }
  .lb-podium, .lb-sk-podium { gap: 8px; }
  .lb .lb-pod-av { width: 52px; height: 52px; font-size: 19px; }
  .lb .lb-pos-1 .lb-pod-av { width: 64px; height: 64px; font-size: 24px; }
  .lb-h-1 .lb-step, .lb .lb-sk-h1 { height: 80px; }
  .lb-h-2 .lb-step, .lb .lb-sk-h2 { height: 60px; }
  .lb-h-3 .lb-step, .lb .lb-sk-h3 { height: 44px; }
  .lb-step { font-size: 1.35rem; }
  .lb-pod-name { font-size: 13.5px; }
  .lb-pod-metric b { font-size: 1.1rem; }
  .lb-list { margin: 16px -6px 0; }
  .lb-row { grid-template-columns: 1.75rem 2.125rem minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 6px; }
  .lb-rank { width: 1.75rem; height: 1.75rem; font-size: 12px; border-radius: 8px; }
  .lb .lb-row .lb-av { width: 34px; height: 34px; font-size: 13px; }
  .lb-ind { max-width: 11em; }
  .lb-me, .lb-how { padding: 20px; }
}
@media (max-width: 560px) {
  .lb-controls .ap-tabs { width: 100%; }
  .lb-controls .ap-tab { flex: 1 1 auto; justify-content: center; padding: 8px 10px; font-size: 13.5px; }
  .lb-tab-ic { display: none; }
  .lb-seg { display: flex; width: 100%; }
  .lb-seg button { flex: 1; padding: 7px 8px; }
  .lb-pod .lb-ind { display: none; }
}
