/* ============================================================
   leaderboard.css — #leaderboard, set like a Snellen acuity chart
   ------------------------------------------------------------
   The chart is warm paper with dotted "line" rules. Line 1 is set
   largest and each line steps down (lb-row--l1 … l7), with the acuity
   fraction in the margin (6/60 → 6/6) — decoration only, aria-hidden.
   Your own line carries the amber catch-light of the brand mark.
   Also styles the same rows inside the profile's preview.
   ============================================================ */

/* ── Header ───────────────────────────────────────────────── */
.lb-page { display: grid; gap: clamp(18px, 2.6vw, 28px); }
.lb-head { display: grid; gap: 24px; align-items: end; grid-template-columns: 1fr; }
@media (min-width: 860px) { .lb-head { grid-template-columns: 1fr auto; } }
.lb-title { font-size: clamp(2.4rem, 1.4rem + 4vw, 4.2rem); }
.lb-head__chart {
  display: grid; justify-items: center; gap: 2px; padding: 18px 26px 14px;
  border: 1px solid var(--acct-line); border-radius: 14px; background: var(--acct-paper);
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; color: var(--acct-teal-deep); line-height: 1;
  letter-spacing: .28em; direction: ltr; user-select: none;
}
.lb-head__chart span:nth-child(1) { font-size: 3.1rem; }
.lb-head__chart span:nth-child(2) { font-size: 1.9rem; }
.lb-head__chart span:nth-child(3) { font-size: 1.25rem; opacity: .85; }
.lb-head__chart span:nth-child(4) { font-size: .82rem; opacity: .7; }
@media (max-width: 859px) { .lb-head__chart { display: none; } }

/* ── Controls ─────────────────────────────────────────────── */
.lb-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px;
  position: sticky; top: 64px; z-index: 5; padding: 10px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.lb-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-sunken); }
.lb-tab {
  min-height: 40px; padding: 0 18px; border: 0; border-radius: 10px; background: transparent;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--acct-ink-soft); cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.lb-tab[aria-selected="true"] { background: var(--surface); color: var(--acct-teal-deep); box-shadow: 0 1px 3px hsl(var(--shadow-color) / .14); }
.lb-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--acct-teal) 40%, transparent); outline-offset: 1px; }
.lb-scopes { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.lb-scope {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--acct-line-strong);
  background: var(--surface); font: inherit; font-size: .84rem; font-weight: 600; color: var(--acct-ink-soft); cursor: pointer;
}
.lb-scope[aria-pressed="true"] { border-color: var(--acct-teal); background: var(--acct-teal); color: #fff; }
.lb-scope:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 640px) {
  .lb-controls { top: 52px; }
  .lb-tabs { width: 100%; }
  .lb-tab { flex: 1; padding: 0 8px; font-size: .84rem; }
}

/* ── The chart ────────────────────────────────────────────── */
.lb-chart {
  position: relative;
  padding: clamp(10px, 2vw, 22px) clamp(12px, 3vw, 36px);
  border: 1px solid var(--acct-line); border-radius: calc(var(--acct-radius) + 4px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.7), rgba(255,255,255,0) 30%),
    var(--acct-paper);
  box-shadow: var(--acct-shadow);
  min-height: 280px;
}
.lb-rows { list-style: none; margin: 0; padding: 0; }
.lb-row {
  --lb-name: 1rem;
  display: grid; align-items: center; gap: 4px 18px;
  grid-template-columns: 58px 2.6ch minmax(0, 1fr) auto;
  grid-template-areas: "acuity rank who score";
  padding: 14px 4px;
  border-bottom: 1.5px dotted color-mix(in srgb, var(--acct-teal) 22%, transparent);
  animation: acct-rise .5s var(--acct-ease) both;
}
.lb-row:last-child { border-bottom: 0; }
.lb-row:nth-child(2) { animation-delay: .04s; } .lb-row:nth-child(3) { animation-delay: .08s; }
.lb-row:nth-child(4) { animation-delay: .12s; } .lb-row:nth-child(5) { animation-delay: .16s; }
.lb-row:nth-child(n+6) { animation-delay: .2s; }
.lb-row__acuity { grid-area: acuity; font-family: var(--acct-mono); font-size: .72rem; color: var(--acct-ink-faint); direction: ltr; text-align: start; }
.lb-row__rank { grid-area: rank; font-family: var(--acct-mono); font-weight: 600; font-size: .95rem; color: var(--acct-teal); font-variant-numeric: tabular-nums; }
.lb-row__who { grid-area: who; display: grid; gap: 6px; min-width: 0; }
.lb-row__name {
  display: flex; align-items: baseline; gap: 10px; min-width: 0;
  font-family: var(--acct-display); font-weight: 600; font-size: var(--lb-name); line-height: 1.1;
  color: var(--acct-ink); letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-row__name bdi { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lb-row__name.is-alias { font-style: italic; color: var(--acct-ink-soft); }
html[dir="rtl"] .lb-row__name { letter-spacing: 0; }
.lb-row__you {
  flex: none; font-family: 'Inter', 'IBM Plex Sans Arabic', sans-serif; font-style: normal;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--acct-amber); color: #2b2007;
}
.lb-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.lb-row__tag { padding: 2px 8px; border-radius: 999px; background: var(--acct-tint); color: var(--acct-teal-deep); font-size: .74rem; font-weight: 600; }
.lb-row__tag--mono { font-family: var(--acct-mono); letter-spacing: .04em; }
.lb-row__inst { font-size: .78rem; color: var(--acct-ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; }
/* IBM Plex Mono has no Arabic glyphs: in Arabic the unit ("نقطة") would fall back
   with monospace spacing, so scores use the Arabic face with tabular digits. */
html[dir="rtl"] .lb-row__score, html[dir="rtl"] .lb-me__score { font-family: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif; font-weight: 700; }
.lb-row__score { grid-area: score; font-family: var(--acct-mono); font-weight: 600; font-size: .92rem; color: var(--acct-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Snellen type scale: each line smaller than the one above */
.lb-row--l1 { --lb-name: clamp(1.9rem, 1.1rem + 2.6vw, 3rem); padding-block: 22px; }
.lb-row--l2 { --lb-name: clamp(1.6rem, 1rem + 1.9vw, 2.35rem); padding-block: 18px; }
.lb-row--l3 { --lb-name: clamp(1.4rem, .95rem + 1.4vw, 1.9rem); padding-block: 16px; }
.lb-row--l4 { --lb-name: clamp(1.22rem, .95rem + .8vw, 1.5rem); }
.lb-row--l5 { --lb-name: 1.25rem; }
.lb-row--l6 { --lb-name: 1.12rem; }
.lb-row--l7 { --lb-name: 1.02rem; padding-block: 11px; }
.lb-row--l1 .lb-row__rank { font-size: 1.3rem; color: var(--acct-teal-deep); }
.lb-row--l1 .lb-row__score { font-size: 1.08rem; }

/* Your line */
.lb-row.is-mine {
  position: relative; margin-inline: -12px; padding-inline: 16px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--acct-amber) 14%, var(--surface));
  box-shadow: inset 4px 0 0 var(--acct-amber);
}
html[dir="rtl"] .lb-row.is-mine { box-shadow: inset -4px 0 0 var(--acct-amber); }

/* In the profile preview there is no acuity margin */
.lb-rows--preview .lb-row { grid-template-columns: 2.6ch minmax(0, 1fr) auto; grid-template-areas: "rank who score"; animation: none; padding: 10px 0; border: 0; }

@media (max-width: 640px) {
  .lb-row { grid-template-columns: 2.6ch minmax(0, 1fr) auto; grid-template-areas: "rank who score"; gap: 4px 12px; }
  .lb-row__acuity { display: none; }
  .lb-row__inst { max-width: 20ch; }
}

/* ── States ───────────────────────────────────────────────── */
.lb-rows--skeleton .lb-row { grid-template-columns: 1fr; }
.lb-skel { display: block; height: calc(var(--lb-name) * .9); max-width: calc(80% - (var(--i, 0) * 6%)); border-radius: 8px;
  background: linear-gradient(90deg, #eef0ee 0%, #f7f7f4 50%, #eef0ee 100%) 0 0 / 200% 100%; animation: acct-shimmer 1.4s linear infinite; }
.lb-state { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; text-align: center; color: var(--acct-ink-soft); }
.lb-state p { margin: 0; max-width: 46ch; line-height: 1.6; }
.lb-state > svg { width: 28px; height: 28px; color: var(--acct-danger); }
.acct .lb-state .acct-iris { width: 72px; height: 72px; }
.lb-ghost { display: grid; justify-items: center; gap: 4px; margin-bottom: 8px; font-family: 'Fraunces', Georgia, serif; font-weight: 600;
  color: color-mix(in srgb, var(--acct-teal) 18%, transparent); letter-spacing: .3em; line-height: 1; direction: ltr; user-select: none; }
.lb-ghost span:nth-child(1) { font-size: 4rem; } .lb-ghost span:nth-child(2) { font-size: 2.4rem; }
.lb-ghost span:nth-child(3) { font-size: 1.5rem; } .lb-ghost span:nth-child(4) { font-size: 1rem; }
.lb-more { justify-self: center; margin: 18px auto 4px; display: flex; }

/* ── Your place ───────────────────────────────────────────── */
.lb-me {
  position: sticky; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 6;
  display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap;
  padding: 14px 20px; border-radius: 16px;
  background: color-mix(in srgb, var(--mark-disc) 94%, transparent); color: #fff;
  backdrop-filter: blur(10px); box-shadow: 0 18px 40px -18px rgba(0,0,0,.5);
  animation: acct-rise .45s var(--acct-ease) both;
}
.lb-me__label { font-size: .8rem; font-weight: 600; color: #a9d6d2; }
.lb-me__rank { font-family: 'Fraunces', Georgia, serif; font-size: 1.8rem; font-weight: 600; line-height: 1; }
.lb-me__score { margin-inline-start: auto; font-family: var(--acct-mono); font-weight: 600; color: var(--acct-amber); }
.lb-me--note { background: var(--surface); color: var(--acct-ink-soft); border: 1px solid var(--acct-line); box-shadow: var(--acct-shadow); justify-content: space-between; font-size: .92rem; }

.lb-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; color: var(--acct-ink-faint); font-size: .8rem; }
.lb-foot p { display: flex; gap: 8px; align-items: flex-start; margin: 0; line-height: 1.5; }
.lb-foot svg { color: var(--acct-teal); margin-top: 2px; }
.lb-foot__time { font-family: var(--acct-mono); }
