/* IDL Learn – class leaderboards: the class tab, the create dialog, one board (podium and standings) and the learner page. */
.lb-state { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.lb-state--live { background: var(--ok-soft); color: #067647; }
.lb-state--live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: lb-pulse 1.6s ease infinite; }
.lb-state--soon { background: var(--brand-soft); color: var(--brand-dark); }
.lb-state--ended { background: var(--line-2); color: var(--muted); }
@keyframes lb-pulse { 50% { opacity: .3; } }

/* class tab */
.lb-list { display: grid; gap: 10px; }
.lb-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(120px, 200px) auto; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.lb-item:hover { color: var(--ink); border-color: #D0D5DD; box-shadow: var(--shadow); }
.lb-item__icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #FEF3C7, #FDE68A); font-size: 21px; }
.lb-item--ended .lb-item__icon { background: var(--line-2); }
.lb-item__main { min-width: 0; }
.lb-item__main b { display: block; font-size: 15.5px; }
.lb-item__main small { color: var(--muted); font-size: 12.5px; }
.lb-item__lead small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.lb-item__lead b { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .lb-item { grid-template-columns: 44px minmax(0, 1fr); } .lb-item__lead, .lb-item .lb-state { grid-column: 2; justify-self: start; } }

/* create dialog */
.lb-form { display: grid; gap: 14px; }
.lb-form .field { margin: 0; }
.lb-metrics, .lb-subs { margin: 0; padding: 0; border: 0; }
.lb-metrics legend, .lb-subs legend { margin-bottom: 8px; color: var(--ink); font-size: 14px; font-weight: 500; }
.lb-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.lb-metric { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.lb-metric:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.lb-metric input { margin-top: 3px; }
.lb-metric b { display: block; font-size: 14px; }
.lb-metric small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.lb-subs { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-subs legend { width: 100%; }
.lb-chip { position: relative; }
.lb-chip input { position: absolute; opacity: 0; }
.lb-chip span { display: inline-block; padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; font-weight: 600; cursor: pointer; }
.lb-chip input:checked + span { border-color: var(--c); background: var(--c); color: #fff; }
.lb-chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.lb-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lb-lock { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: #93370D; font-size: 13.5px; }

/* one board */
.lb-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding: 24px 26px; border-radius: var(--radius); color: #fff;
    background: radial-gradient(circle at 88% -20%, rgba(255, 255, 255, .22) 0 120px, transparent 121px), linear-gradient(120deg, #163EC4, #0E2CA0 55%, #DB2777); box-shadow: var(--shadow-md); }
.lb-hero .eyebrow { color: rgba(255, 255, 255, .8); }
.lb-hero h1 { margin: 2px 0 6px; color: #fff; }
.lb-hero__scope { margin: 0 0 10px; color: rgba(255, 255, 255, .88); font-size: 14.5px; }
.lb-hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: rgba(255, 255, 255, .9); font-size: 13.5px; }
.lb-hero .lb-state { background: rgba(255, 255, 255, .95); }
.lb-locked { padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .16); font-size: 12.5px; font-weight: 600; }
.lb-hero__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-hero__actions .btn--ghost:disabled { opacity: .75; }
.lb-note { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--brand-line); border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-size: 14px; }
.lb-stage { background: linear-gradient(180deg, #FFFBEB, #fff 70%); }
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 190px)); justify-content: center; align-items: end; gap: 14px; padding-top: 18px; }
.lb-pod { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.lb-pod__av { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 58px; height: 58px; border: 4px solid #fff; border-radius: 50%; color: #fff; font-size: 19px; font-weight: 800; box-shadow: var(--shadow-md); }
.lb-pod__av i { position: absolute; top: -24px; font-size: 22px; font-style: normal; }
.lb-pod__name { max-width: 100%; overflow: hidden; color: var(--ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.lb-pod__score { color: var(--text); font-size: 18px; font-weight: 800; }
.lb-pod__score small { color: var(--muted); font-size: 12px; font-weight: 600; }
.lb-pod__step { display: flex; align-items: flex-start; justify-content: center; width: 100%; padding-top: 10px; border-radius: 12px 12px 4px 4px; color: #fff; font-size: 20px; font-weight: 900; }
.lb-pod--gold .lb-pod__av, .lb-pod--gold .lb-pod__step { background: linear-gradient(135deg, #FBBF24, #D97706); }
.lb-pod--gold .lb-pod__step { height: 110px; }
.lb-pod--gold .lb-pod__av { width: 70px; height: 70px; font-size: 22px; }
.lb-pod--silver .lb-pod__av, .lb-pod--silver .lb-pod__step { background: linear-gradient(135deg, #CBD5E1, #64748B); }
.lb-pod--silver .lb-pod__step { height: 80px; }
.lb-pod--bronze .lb-pod__av, .lb-pod--bronze .lb-pod__step { background: linear-gradient(135deg, #FDBA74, #C2410C); }
.lb-pod--bronze .lb-pod__step { height: 60px; }
.lb-pod.is-me .lb-pod__name { color: var(--brand); }
.lb-wait { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; text-align: center; }
.lb-wait span { font-size: 32px; }
.lb-wait p { margin: 0; }
.lb-table .lb-rank { width: 44px; font-weight: 700; text-align: center; }
.lb-table .is-n { text-align: right; white-space: nowrap; }
.lb-table td:nth-child(3) { min-width: 170px; }
.lb-scorecell { display: flex; align-items: center; gap: 10px; }
.lb-bar { flex: 1; min-width: 60px; height: 8px; overflow: hidden; border-radius: 99px; background: var(--line-2); }
.lb-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #0E2CA0); }
.lb-score { min-width: 44px; color: var(--ink); text-align: right; }
.lb-medal { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 13px; }
.lb-medal--1 { background: linear-gradient(135deg, #FBBF24, #D97706); }
.lb-medal--2 { background: linear-gradient(135deg, #CBD5E1, #64748B); }
.lb-medal--3 { background: linear-gradient(135deg, #FDBA74, #C2410C); }
.lb-table tr.is-me td { background: var(--brand-soft); }
.lb-you { padding: 1px 7px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; }
.lb-print-foot { display: none; }

/* learner */
.lb-mine__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lb-mine__head h2 { margin: 0; }
.lb-mine__head p { margin: 2px 0 0; }
.lb-mine__me { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 14px 0; padding: 12px 16px; border-radius: 14px; background: linear-gradient(120deg, var(--brand-soft), #FDF2F8); color: var(--ink); font-weight: 600; }
.lb-mine__me .btn { margin-left: auto; }
.lb-mine__place { font-size: 30px; font-weight: 900; background: linear-gradient(135deg, #163EC4, #DB2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lb-past-h { margin: 28px 0 12px; color: var(--muted); font-size: 18px; }
@media (max-width: 560px) { .lb-podium { gap: 6px; } .lb-pod__name { font-size: 13px; } .lb-dates { grid-template-columns: 1fr; } }

@media print {
    .lbp .lb-hero, .lbp .lb-stage, .lbp .lb-pod__av, .lbp .lb-pod__step, .lbp .lb-medal, .lbp .lb-bar i, .lbp .lb-state { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .lbp .lb-table tr, .lbp .lb-stage { break-inside: avoid; }
    .lbp .lb-print-foot { display: block; margin-top: 14px; color: #64748B; font-size: 11px; text-align: center; }
}
.lb-hero .btn:not(.btn--ghost):not(.btn--danger):not(.btn--amber) { background: #0F172A; } .lb-hero .btn:not(.btn--ghost):not(.btn--danger):not(.btn--amber):hover { background: #1E293B; }
/* medal colour follows the learner's real place (tied learners share it); step height follows the podium position */
.lb-pod--c-gold .lb-pod__av, .lb-pod--c-gold .lb-pod__step { background: linear-gradient(135deg, #FBBF24, #D97706); }
.lb-pod--c-silver .lb-pod__av, .lb-pod--c-silver .lb-pod__step { background: linear-gradient(135deg, #CBD5E1, #64748B); }
.lb-pod--c-bronze .lb-pod__av, .lb-pod--c-bronze .lb-pod__step { background: linear-gradient(135deg, #FDBA74, #C2410C); }
.lb-pod__step small { margin-left: 2px; font-size: .7em; opacity: .85; }
@media print {
    .lbp .lb-table { font-size: 12px; } .lbp .lb-table td, .lbp .lb-table th { padding: 6px 6px; }
    .lbp .lb-table td:nth-child(3) { min-width: 120px; } .lbp .lb-bar { min-width: 40px; }
    .lbp .lb-table td:nth-child(2) b { white-space: nowrap; }
}
