/* Weekly leagues (public/leagues.js). Built for 375px first; motion is transform/opacity only. */

.lg-badge { display: block; flex: none; overflow: visible; stroke: none; stroke-width: 0; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .18)); }
.lg-badge.lg-dim { filter: grayscale(.8); opacity: .45; }

/* ---------- card on Home and the Arena ---------- */
.lg-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0 0 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; text-decoration: none;
}
.lg-card:active { transform: scale(.99); }
.lg-card .main { flex: 1; min-width: 0; }
.lg-card b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-card small { display: block; color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-card-xp { flex: none; text-align: right; font-weight: 800; font-size: 18px; line-height: 1.05; }
.lg-card-xp small { font-size: 11px; font-weight: 700; }
.lg-card-up { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.lg-card-down { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

/* ---------- #/league ---------- */
.lg-head { text-align: center; padding: 8px 0 4px; }
.lg-head-badge { display: grid; place-items: center; margin: 6px auto 4px; }
.lg-head h1 { margin: 4px 0 2px; font-size: 26px; }
.lg-left { margin: 0; color: var(--ink-2); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.lg-left svg { width: 16px; height: 16px; }
.lg-name-btn {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px auto 0; padding: 6px 12px; min-height: 36px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer;
}
.lg-name-btn b { color: var(--ink); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-name-btn svg { width: 16px; height: 16px; }
.lg-head { display: flex; flex-direction: column; align-items: center; }
.lg-ladder {
  align-self: stretch;
  display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 12px 4px 6px;
  scroll-snap-type: x proximity; mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.lg-ladder::-webkit-scrollbar { display: none; }
.lg-step { flex: none; scroll-snap-align: center; display: grid; place-items: center; width: 34px; }
.lg-here { width: 44px; }

.lg-tabs { display: flex; gap: 4px; padding: 4px; margin: 12px 0; border-radius: 14px; background: var(--surface-2); }
.lg-tabs button {
  flex: 1; min-height: 40px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-2);
  font: inherit; font-weight: 700; cursor: pointer; transition: background .2s var(--ease-out, ease), color .2s;
}
.lg-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.lg-board { padding: 4px 0; }
.lg-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; min-height: 52px; }
.lg-row + .lg-row { border-top: 1px solid var(--line); }
.lg-rank { flex: none; width: 24px; text-align: center; font-weight: 800; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lg-up .lg-rank { color: var(--ok); }
.lg-down .lg-rank { color: var(--danger); }
.lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lg-xp { flex: none; text-align: right; line-height: 1.05; font-variant-numeric: tabular-nums; }
.lg-xp b { display: block; font-size: 17px; font-weight: 800; }
.lg-xp small { font-size: 11px; color: var(--ink-3); font-weight: 700; }
/* Her own row stays on screen while the board scrolls (under the top bar, above the tab bar). */
.lg-me { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); position: sticky; top: 66px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 1; box-shadow: 0 0 0 1px var(--line); }
.lg-crown { font-size: 14px; }

.lg-zone {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 12px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
}
.lg-zone-up { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border-top: 2px dashed color-mix(in srgb, var(--ok) 55%, transparent); }
.lg-zone-down { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); border-top: 2px dashed color-mix(in srgb, var(--danger) 55%, transparent); }
.lg-zone-up { border-top: 0; border-bottom: 2px dashed color-mix(in srgb, var(--ok) 55%, transparent); }

.lg-top1 {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 14px; margin-bottom: 12px; border-radius: 22px; text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, #ffd34d 30%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, #ffd34d 45%, var(--line)); box-shadow: var(--shadow);
}
.lg-top1 small { font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.lg-top1-who { display: flex; align-items: flex-end; margin: 6px 0 2px; }
.lg-top1-who .lg-badge { margin-left: -14px; }
.lg-top1 b { font-size: 22px; }
.lg-top1 span { color: var(--ink-2); font-weight: 600; }

.lg-switch { display: flex; align-items: center; gap: 10px; margin: 18px 4px 8px; color: var(--ink-2); font-size: 14px; }
.lg-switch input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---------- Monday results ---------- */
.lg-result {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); text-align: center;
  background: radial-gradient(90% 60% at 50% 35%, color-mix(in srgb, var(--accent) 22%, var(--bg, var(--surface))), var(--bg, var(--surface)));
}
.lg-result-up { background: radial-gradient(90% 60% at 50% 35%, color-mix(in srgb, #ffd34d 30%, var(--bg, var(--surface))), var(--bg, var(--surface))); }
.lg-result-down { background: var(--bg, var(--surface)); }
.lg-result-stage { position: relative; display: grid; place-items: center; width: 160px; height: 160px; margin-bottom: 8px; }
.lg-result-stage > span { grid-area: 1 / 1; display: grid; place-items: center; }
.lg-result h2 { margin: 6px 0 0; font-size: 28px; }
.lg-result-line { margin: 0; font-weight: 700; color: var(--ink-2); }
.lg-result .hint { margin: 2px 0 8px; max-width: 30ch; }
.lg-result-buttons { display: flex; gap: 10px; width: 100%; max-width: 340px; margin-top: 10px; }
.lg-result-buttons .btn { flex: 1; }
.lg-medal {
  position: absolute; top: -6px; right: 4px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 20px; color: #4a3200; border: 3px solid #fff; box-shadow: 0 3px 8px rgb(0 0 0 / .2);
}
.lg-medal-1 { background: linear-gradient(#ffe07a, #e0a400); }
.lg-medal-2 { background: linear-gradient(#f1f4f7, #a8b3bf); }
.lg-medal-3 { background: linear-gradient(#f0b07a, #b0642c); color: #3b1d06; }

@media (prefers-reduced-motion: reduce) {
  .lg-tabs button { transition: none; }
}
