/* Class league screen (#screen-league). Rendered by js/ui/league.js. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#league-root {
  --lg-bronze: #e0a876;
  --lg-silver: #e8ecff;
  --lg-gold: #ffd166;
  --lg-diamond: #8ff0ff;
  max-width: 660px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#league-root code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.92em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ---------- top bar ---------- */
.lg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.lg-back { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
.lg-flip { transform: scaleX(-1); }
.lg-kicker {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.lg-card { padding: 20px; }
.lg-h3 { font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

/* ---------- tier ladder ---------- */
.lg-tiers {
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 14px;
}
.lg-tier {
  display: grid;
  grid-template-rows: 66px auto;
  justify-items: center;
  align-items: center;
  row-gap: 6px;
  width: 84px;
  text-align: center;
  position: relative;
}
.lg-tier + .lg-tier::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 32px;
  width: 36px;
  border-top: 2px dashed rgba(255, 255, 255, 0.16);
  z-index: -1;
}
.lg-tier-name { align-self: start; }
.lg-tier-badge {
  --ink: var(--muted);
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #1a2140;
  border: 2px solid #2d3760;
}
.lg-tier-name {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--muted);
}
.lg-tier--bronze-lock { --tone: var(--lg-bronze); --tone-bg: #3a2a1a; }
.lg-tier--silver-safe { --tone: var(--lg-silver); --tone-bg: #2a3048; }
.lg-tier--gold-vault { --tone: var(--lg-gold); --tone-bg: #3a3014; }
.lg-tier--diamond-vault { --tone: var(--lg-diamond); --tone-bg: #10303a; }
.lg-tier.is-passed .lg-tier-badge {
  --ink: var(--tone);
  background: var(--tone-bg);
  border-color: color-mix(in srgb, var(--tone) 45%, transparent);
  opacity: 0.75;
}
.lg-tier.is-current .lg-tier-badge {
  --ink: var(--tone);
  width: 66px;
  height: 66px;
  border-radius: 18px;
  background: var(--tone-bg);
  border-color: var(--tone);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 18%, transparent), 0 10px 26px rgba(0, 0, 0, 0.4);
}
.lg-tier.is-current .lg-tier-name { color: var(--tone); }
.lg-tier.is-ahead .lg-tier-badge { opacity: 0.8; }

/* ---------- joined header ---------- */
.lg-head { text-align: center; padding-top: 4px; }
.lg-title { font-size: clamp(24px, 5vw, 32px); line-height: 1.05; }
.lg-title--bronze-lock { color: var(--lg-bronze); }
.lg-title--silver-safe { color: var(--lg-silver); }
.lg-title--gold-vault { color: var(--lg-gold); }
.lg-title--diamond-vault { color: var(--lg-diamond); }
.lg-title:focus { outline: none; }
.lg-title:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; border-radius: 6px; }
.lg-sub { margin-top: 6px; color: #c7cce3; font-size: 15px; font-weight: 600; }

/* ---------- table ---------- */
.lg-board { padding: 8px; }
.lg-table { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.lg-row {
  display: grid;
  grid-template-columns: 28px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 6px 12px;
  border-radius: 14px;
}
.lg-row:nth-child(even) { background: rgba(255, 255, 255, 0.025); }
.lg-row.is-you {
  background: linear-gradient(90deg, rgba(52, 225, 255, 0.2), rgba(52, 225, 255, 0.07));
  box-shadow: inset 0 0 0 1.5px rgba(52, 225, 255, 0.55);
}
.lg-rank { font-weight: 900; font-size: 16px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.lg-row.is-podium .lg-rank { color: var(--gold); }
.lg-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  color: #0b0e1a;
  background: var(--lg-dot, #9aa3c7);
  overflow: hidden;
}
.lg-avatar--pixel {
  background: radial-gradient(circle at 50% 30%, #2a3a6a, #141a2e);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14);
}
.lg-avatar--you { box-shadow: inset 0 0 0 2px var(--cyan); }
.lg-avatar--pixel .hr-char { transform: translateY(5px) scale(1.25); }
.lg-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 800;
  font-size: 16px;
}
.lg-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-you {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #04202b;
  background: var(--cyan);
}
.lg-xp { font-weight: 800; font-size: 15px; color: #c7cce3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-xp-unit { font-size: 12px; color: var(--muted); }
.lg-row.is-you .lg-xp { color: var(--text); }

.lg-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lg-zone::before,
.lg-zone::after { content: ""; flex: 1; border-top: 2px dashed currentColor; opacity: 0.55; }
.lg-zone--up { color: var(--green); }
.lg-zone--down { color: #ff7a8f; }
.lg-empty { padding: 22px 14px; text-align: center; color: var(--muted); }

/* ---------- sync + status ---------- */
.lg-sync {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 4px;
}
.lg-sync-text { font-size: 14px; color: var(--muted); font-weight: 600; }
.lg-refresh { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.lg-spin { animation: lgSpin 0.9s linear infinite; }
@keyframes lgSpin { to { transform: rotate(360deg); } }

.lg-offline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 159, 67, 0.12);
  border: 1px solid rgba(255, 159, 67, 0.45);
  color: #ffd2a6;
  font-size: 14px;
  font-weight: 600;
}
.lg-offline svg { flex: 0 0 auto; margin-top: 1px; color: var(--gold-2); }

.lg-you-line { text-align: center; font-size: 14px; color: var(--muted); }
.lg-you-line b { color: var(--text); }

.lg-notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(139, 124, 255, 0.14);
  border: 1px solid rgba(139, 124, 255, 0.45);
  font-size: 14px;
  color: #dcd8ff;
  text-align: left;
}
.lg-notice b { color: var(--text); }

.lg-error {
  color: #ff8fa1;
  font-weight: 700;
  font-size: 14px;
  margin-top: 10px;
}

/* ---------- loading ---------- */
.lg-loading { text-align: center; }
.lg-loading .btn { margin-top: 12px; }
.lg-skeleton { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.lg-skeleton i {
  display: block;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: scan 1.4s linear infinite;
}

/* ---------- leave ---------- */
.lg-leave { display: flex; justify-content: center; }
.lg-leave .btn { min-height: 44px; }
.lg-leave.is-confirming {
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 84, 112, 0.08);
  border: 1px solid rgba(255, 84, 112, 0.4);
  font-size: 14px;
}
.lg-leave.is-confirming .lg-error { margin-top: 0; }
.lg-leave-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- intro (not configured) + join ---------- */
.lg-intro,
.lg-join {
  display: flex;
  align-items: center;
  gap: 20px;
}
.lg-intro-art,
.lg-join-art { flex: 0 0 auto; }
.lg-intro-body,
.lg-join-body { flex: 1 1 auto; min-width: 0; }
.lg-intro h2,
.lg-join h2 { font-size: clamp(22px, 4.6vw, 28px); line-height: 1.1; margin-bottom: 8px; }
.lg-intro p { margin-top: 8px; }
.lg-preview p { margin-top: 4px; font-size: 14px; text-align: center; }
.lg-footnote { text-align: center; font-size: 13px; color: var(--muted); }

.lg-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.lg-code-row { display: flex; gap: 10px; }
.lg-code {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 54px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font: 900 24px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.lg-code::placeholder { color: #6c7499; letter-spacing: 0.18em; }
.lg-code:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(52, 225, 255, 0.25); }
.lg-code[aria-invalid="true"] { border-color: #ff7a8f; }
.lg-join-btn { min-width: 104px; min-height: 54px; }
.lg-join-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.lg-privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #c7cce3;
}
.lg-privacy svg { flex: 0 0 auto; color: var(--green); }

/* ---------- promotion / demotion moment ---------- */
.lg-moment {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  animation: pop 0.45s ease both;
}
.lg-moment.is-up {
  background: linear-gradient(120deg, rgba(255, 209, 102, 0.22), rgba(46, 230, 107, 0.12));
  border: 1px solid rgba(255, 209, 102, 0.55);
  animation: pop 0.45s ease both, glowPulse 2.2s ease 0.5s 2;
}
.lg-moment.is-down {
  background: linear-gradient(120deg, rgba(52, 225, 255, 0.14), rgba(139, 124, 255, 0.14));
  border: 1px solid rgba(52, 225, 255, 0.4);
}
.lg-moment-art { flex: 0 0 auto; }
.lg-moment-kicker {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.lg-moment h3 { font-size: clamp(20px, 4.4vw, 26px); line-height: 1.1; margin: 2px 0 6px; }
.lg-moment.is-up h3 { color: var(--gold); }
.lg-moment p { font-size: 15px; margin-bottom: 12px; }
.lg-moment .btn { min-height: 44px; }

/* ---------- phone ---------- */
@media (max-width: 560px) {
  .lg-card { padding: 16px; }
  .lg-board { padding: 6px; }
  .lg-row { grid-template-columns: 22px 40px minmax(0, 1fr) auto; gap: 10px; padding: 6px 8px; }
  .lg-avatar { width: 40px; height: 40px; font-size: 14px; }
  .lg-tier { width: 72px; }
  .lg-tier-name { font-size: 11px; }
  .lg-tier + .lg-tier::before { display: none; }
  .lg-intro,
  .lg-join,
  .lg-moment { flex-direction: column; text-align: center; }
  .lg-join-body { width: 100%; text-align: left; }
  .lg-join h2,
  .lg-join p.muted { text-align: center; }
  .lg-code { font-size: 20px; letter-spacing: 0.14em; }
  .lg-join-btn { min-width: 84px; }
  .lg-moment { padding: 16px; gap: 6px; }
  .lg-moment-art .hr-char { width: 84px !important; height: 84px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-spin,
  .lg-skeleton i,
  .lg-moment,
  .lg-moment.is-up { animation: none; }
}
