/* Skill-test leaderboard stage (Views/SkillTest/_SkillBoard.cshtml, wwwroot/js/st-board.js). Prefix stb-. Needs st-theme.css tokens on an ancestor .st.
   Vivid cyan > blue > indigo stage (same family as the site gradient); ring colours come from --st-gold/silver/bronze. Only transform/opacity animate. */
.stb {
  --stb-1: #0e7490; --stb-2: #1d4ed8; --stb-3: #4338ca;      /* stage gradient stops */
  --stb-ink: #ffffff;
  --stb-dim: rgba(255, 255, 255, .80);
  --stb-glass: rgba(255, 255, 255, .14);
  --stb-glass-line: rgba(255, 255, 255, .28);
  --stb-thumb: #ffffff; --stb-thumb-ink: #0b2a4a;
  --stb-gold: color-mix(in srgb, var(--st-gold) 60%, #ffe27a);
  --stb-silver: color-mix(in srgb, var(--st-silver) 45%, #ffffff);
  --stb-bronze: color-mix(in srgb, var(--st-bronze) 60%, #ffb27a);
  --stb-p0: linear-gradient(100deg, #0e7490, #1d4ed8);       /* row pills: all keep white text >= 4.5:1 */
  --stb-p1: linear-gradient(100deg, #1d4ed8, #4338ca);
  --stb-p2: linear-gradient(100deg, #0f766e, #0e7490);
  --stb-p3: linear-gradient(100deg, #4338ca, #6d28d9);
  --stb-you: linear-gradient(100deg, #0b1b3a, #142a5c);
  --stb-you-line: var(--stb-gold);
  --stb-shadow: 0 30px 60px -28px rgba(29, 78, 216, .65), 0 2px 6px rgba(15, 60, 100, .18);
  --stb-ease: cubic-bezier(.16, 1, .3, 1);
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; gap: 14px; align-content: start;
  padding: clamp(18px, 2.2vw, 28px) clamp(14px, 2vw, 26px) 18px;
  border-radius: 28px; color: var(--stb-ink);
  background: linear-gradient(155deg, var(--stb-1) 0%, var(--stb-2) 58%, var(--stb-3) 100%);
  border: 1px solid var(--stb-glass-line);
  box-shadow: var(--stb-shadow);
  font-family: var(--st-font, "Plus Jakarta Sans", system-ui, sans-serif);
}
[data-bs-theme="dark"] .stb {
  --stb-1: #0b5a73; --stb-2: #1b3a9a; --stb-3: #2e2a7a;
  --stb-thumb: #e8f6ff;
  --stb-p0: linear-gradient(100deg, #0b5f78, #1e40af);
  --stb-p1: linear-gradient(100deg, #1e40af, #3730a3);
  --stb-p2: linear-gradient(100deg, #0f6b64, #0b5f78);
  --stb-p3: linear-gradient(100deg, #3730a3, #5b21b6);
  --stb-you: linear-gradient(100deg, #050b1a, #0e1d45);
  --stb-shadow: 0 30px 60px -28px rgba(0, 0, 0, .8), 0 2px 6px rgba(0, 0, 0, .4);
}
.stb *, .stb *::before, .stb *::after { box-sizing: border-box; }
.stb h2, .stb p, .stb ol, .stb ul { margin: 0; padding: 0; }
.stb ol { list-style: none; }
.stb :focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }
.stb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* decorative backdrop: soft orbs + slow rays */
.stb-fx { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; pointer-events: none; }
.stb-orb { position: absolute; border-radius: 50%; filter: blur(34px); opacity: .55; will-change: transform; }
.stb-orb--1 { width: 220px; height: 220px; left: -60px; top: -50px; background: #22d3ee; }
.stb-orb--2 { width: 260px; height: 260px; right: -90px; top: 38%; background: #818cf8; }
.stb-orb--3 { width: 180px; height: 180px; left: 18%; bottom: -70px; background: #38bdf8; }
.stb-rays { position: absolute; left: 50%; top: 22%; width: 640px; height: 640px; margin: -320px 0 0 -320px; opacity: .13; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .9) 0 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 68%); mask: radial-gradient(circle, #000 0, transparent 68%); }

/* header + segmented period switch */
.stb-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; }
.stb-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--stb-ink); }
.stb-pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 999px; background: var(--stb-glass); border: 1px solid var(--stb-glass-line); font-size: 13px; font-weight: 700; }
.stb-tabs { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); min-width: min(100%, 300px); padding: 4px; border-radius: 999px; background: rgba(8, 20, 60, .32); border: 1px solid var(--stb-glass-line); }
.stb-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 999px; background: var(--stb-thumb); box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5); transform: translateX(calc(var(--k, 0) * 100%)); transition: transform .35s var(--stb-ease); }
.stb-tab { position: relative; z-index: 1; min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--stb-ink); font: 700 14px var(--st-font, system-ui); border-radius: 999px; cursor: pointer; white-space: nowrap; transition: color .25s; }
.stb-tab[aria-selected="true"] { color: var(--stb-thumb-ink); }
.stb-tab:not([aria-selected="true"]):hover { color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, .8); }
.stb-tab:focus-visible { outline-offset: -3px; outline-color: var(--stb-thumb-ink); }
.stb-tabs:has(.stb-tab[aria-selected="true"]:focus-visible) .stb-thumb { box-shadow: 0 0 0 3px #fff, 0 6px 14px -6px rgba(0, 0, 0, .5); }
.stb-range { font-size: 13px; font-weight: 600; color: var(--stb-dim); margin-top: -6px; }
.stb-range[hidden] { display: none; }

/* podium */
.stb-body { min-height: 300px; }
.stb-pod { display: flex; justify-content: center; align-items: flex-end; gap: clamp(6px, 2.2vw, 22px); padding: 46px 0 6px; }
.stb-slot { flex: 1 1 0; max-width: 170px; min-width: 0; display: grid; justify-items: center; text-align: center; gap: 4px; padding-bottom: 6px; }
.stb-slot--1 { order: 2; margin-bottom: 26px; }
.stb-slot--2 { order: 1; }
.stb-slot--3 { order: 3; }
.stb-avwrap { position: relative; display: grid; place-items: center; margin-bottom: 14px; }
.stb-av { --h: 200; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(135deg, hsl(var(--h) 72% 42%), hsl(calc(var(--h) + 38) 68% 30%)); }
.stb-av--p { width: 64px; height: 64px; font-size: 1.15rem; border: 4px solid var(--ring, var(--stb-silver)); box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .55); position: relative; z-index: 1; }
.stb-slot--1 .stb-av--p { width: 92px; height: 92px; font-size: 1.7rem; --ring: var(--stb-gold); }
.stb-slot--2 .stb-av--p { --ring: var(--stb-silver); }
.stb-slot--3 .stb-av--p { --ring: var(--stb-bronze); }
.stb-badge { position: absolute; z-index: 2; left: 50%; bottom: -12px; margin-left: -12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #0b1b3a; background: var(--ring, var(--stb-silver)); border: 2px solid rgba(255, 255, 255, .85); }
.stb-slot--1 .stb-badge { --ring: var(--stb-gold); width: 30px; height: 30px; margin-left: -15px; bottom: -14px; }
.stb-slot--2 .stb-badge { --ring: var(--stb-silver); }
.stb-slot--3 .stb-badge { --ring: var(--stb-bronze); }
.stb-crown { position: absolute; z-index: 2; left: 50%; top: -34px; width: 44px; height: 31px; margin-left: -22px; fill: var(--stb-gold); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); transform-origin: 50% 100%; }
.stb-glow { position: absolute; left: 50%; top: 50%; width: 140%; aspect-ratio: 1; margin: -70% 0 0 -70%; border-radius: 50%; opacity: 0; pointer-events: none;
  background: conic-gradient(from 0deg, transparent, var(--stb-gold), transparent 40%, var(--stb-gold), transparent 80%); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%, #000 66%, transparent 70%); mask: radial-gradient(circle, transparent 58%, #000 60%, #000 66%, transparent 70%); }
.stb-slot--1 .stb-glow { opacity: .9; }
.stb-name { max-width: 100%; font-size: 14px; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.stb-slot--1 .stb-name { font-size: 16px; }
.stb-pts { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--stb-dim); }
.stb-pts b { font-weight: 800; color: var(--stb-ink); }
.stb-sub { font-size: 12px; color: var(--stb-dim); }
.stb-medal { width: 18px; height: 18px; }
.stb-medal .r { fill: #ef4444; }
.stb-medal circle { fill: var(--stb-gold); }
.stb-medal--2 circle { fill: var(--stb-silver); }
.stb-medal--3 circle { fill: var(--stb-bronze); }
.stb-medal .s { fill: rgba(11, 27, 58, .75); }
.stb-you { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--stb-gold); }
.stb-slot.is-you .stb-name { text-shadow: 0 0 14px rgba(255, 226, 122, .6); }

/* list: header + vivid pill rows */
.stb-lh { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 14px 18px 6px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--stb-dim); }
.stb-lh span:nth-child(2) { padding-left: 42px; }
.stb-rows { display: grid; gap: 7px; }
.stb-row { position: relative; overflow: hidden; display: grid; grid-template-columns: 30px 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 52px; padding: 6px 18px 6px 12px; border-radius: 999px; color: #fff;
  background: var(--stb-p0); border: 1px solid rgba(255, 255, 255, .22); box-shadow: 0 10px 18px -12px rgba(5, 20, 70, .7); transition: transform .25s var(--stb-ease), box-shadow .25s; }
.stb-c1 { background: var(--stb-p1); } .stb-c2 { background: var(--stb-p2); } .stb-c3 { background: var(--stb-p3); }
.stb-row.is-you { background: var(--stb-you); border-color: var(--stb-you-line); box-shadow: 0 0 0 1px var(--stb-you-line), 0 12px 22px -12px rgba(0, 0, 0, .8); }
.stb-row::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s var(--stb-ease); pointer-events: none; }
.stb-row:hover { transform: translateY(-3px); box-shadow: 0 16px 24px -12px rgba(5, 20, 70, .8); }
.stb-row:hover::after { transform: translateX(120%); }
.stb-rk { font-size: 16px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.stb-av--s { width: 34px; height: 34px; font-size: 12px; border: 2px solid rgba(255, 255, 255, .55); }
.stb-nm { display: grid; min-width: 0; line-height: 1.2; }
.stb-nm__n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stb-nm small { font-size: 12px; color: rgba(255, 255, 255, .8); }
.stb-sc { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* empty + error + skeleton */
.stb-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 34px 16px; border: 1px dashed var(--stb-glass-line); border-radius: 22px; background: var(--stb-glass); }
.stb-empty svg { width: 64px; height: 64px; fill: var(--stb-gold); stroke: var(--stb-gold); margin-bottom: 4px; animation: stb-float 3.2s ease-in-out infinite; }
.stb-empty strong { font-size: 1.1rem; font-weight: 800; }
.stb-empty span { color: var(--stb-dim); font-size: 14px; }
.stb-retry { min-height: 44px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--stb-thumb); color: var(--stb-thumb-ink); font: 700 14px var(--st-font, system-ui); cursor: pointer; }
.stb-skel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; padding-top: 24px; }
.stb-skel i, .stb-skel b { position: relative; overflow: hidden; display: block; border-radius: 999px; background: var(--stb-glass); }
.stb-skel i { width: 70px; height: 70px; justify-self: center; align-self: end; }
.stb-skel i:nth-child(2) { width: 96px; height: 96px; }
.stb-skel b { grid-column: 1 / -1; height: 48px; }
.stb-skel i::after, .stb-skel b::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .3), transparent); transform: translateX(-100%); animation: stb-shimmer 1.2s linear infinite; }
.stb-foot { font-size: 13px; line-height: 1.5; color: var(--stb-dim); }

/* motion */
@keyframes stb-up { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes stb-shimmer { to { transform: translateX(100%); } }
@keyframes stb-float { 50% { transform: translateY(-7px); } }
@keyframes stb-spin { to { transform: rotate(360deg); } }
@keyframes stb-drift { 50% { transform: translate3d(18px, -14px, 0) scale(1.06); } }
@keyframes stb-pulse { 50% { transform: scale(1.06); opacity: .55; } }
@keyframes stb-crown { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(3deg); } }
@media (prefers-reduced-motion: no-preference) {
  .stb-in .stb-slot, .stb-in .stb-row, .stb-in .stb-lh, .stb-in .stb-empty { animation: stb-up .65s var(--stb-ease) both; animation-delay: calc(var(--i, 0) * 80ms); }
  .stb-in .stb-lh { animation-delay: 240ms; }
  .stb-orb--1 { animation: stb-drift 11s ease-in-out infinite; }
  .stb-orb--2 { animation: stb-drift 14s ease-in-out -4s infinite reverse; }
  .stb-orb--3 { animation: stb-drift 12s ease-in-out -7s infinite; }
  .stb-rays { animation: stb-spin 60s linear infinite; }
  .stb-slot--1 .stb-glow { animation: stb-spin 6s linear infinite; }
  .stb-slot--1 .stb-avwrap::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--stb-gold); opacity: .8; animation: stb-pulse 2.4s ease-in-out infinite; }
  .stb-crown { animation: stb-crown 3.6s ease-in-out infinite; }
}
@media (prefers-reduced-motion: reduce) {
  .stb *, .stb *::before, .stb *::after { animation: none !important; transition: none !important; }
  .stb-slot--1 .stb-glow { opacity: .5; }
}

@media (max-width: 479.98px) {
  .stb { border-radius: 22px; }
  .stb-tabs { width: 100%; }
  .stb-tab { padding: 0 6px; font-size: 13px; }
  .stb-av--p { width: 52px; height: 52px; font-size: 1rem; }
  .stb-slot--1 .stb-av--p { width: 76px; height: 76px; }
  .stb-name { font-size: 13px; }
  .stb-row { grid-template-columns: 24px 32px minmax(0, 1fr) auto; gap: 8px; padding-right: 14px; }
  .stb-lh { grid-template-columns: 24px 1fr auto; padding-inline: 12px; }
  .stb-lh span:nth-child(2) { padding-left: 34px; }
}
/* per-test board has a long title ("{Test} leaderboard"): give the crown room below it */
.stb[data-mode="test"] .stb-pod { margin-top: 18px; }
