/* league.css — «Лига недели» во вкладке «Игра» (league.js, 25.10.2026). */
.league-card[hidden] { display: none; }
.league-card { margin-bottom: var(--s4, 16px); }

/* Цвет дивизиона: значок, лесенка, рамка своей строки (Дерево → Алмаз). */
.league-card, .league-result-badge { --lg-c: #8a5a2b; --lg-soft: #f6ece0; }
.league-card[data-div="stone"], .league-result-badge[data-div="stone"] { --lg-c: #6b7076; --lg-soft: #eef0f2; }
.league-card[data-div="bronze"], .league-result-badge[data-div="bronze"] { --lg-c: #a8642c; --lg-soft: #f8ebdf; }
.league-card[data-div="silver"], .league-result-badge[data-div="silver"] { --lg-c: #7d848f; --lg-soft: #f0f2f5; }
.league-card[data-div="gold"], .league-result-badge[data-div="gold"] { --lg-c: #c28a12; --lg-soft: #fbf3df; }
.league-card[data-div="diamond"], .league-result-badge[data-div="diamond"] { --lg-c: #1f7fa0; --lg-soft: #e4f6fb; }

.league-title { display: flex; align-items: center; gap: var(--s2, 8px); }
.league-badge {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--lg-soft); box-shadow: inset 0 0 0 2px var(--lg-c);
}
.league-badge img { width: 28px; height: 28px; display: block; }
.league-div { margin: var(--s2, 8px) 0 0; font-weight: 700; }
.league-left { margin: var(--s1, 4px) 0 0; color: var(--muted, #5d6273); font-size: .875rem; }

/* Итог недели — один раз после воскресенья. */
.league-result[hidden] { display: none; }
.league-result {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2, 8px) var(--s3, 12px);
  margin: var(--s3, 12px) 0 0; padding: var(--s3, 12px); border-radius: var(--r-md, 12px);
  background: var(--surface-2, #f3efe7);
}
.league-result[data-move="up"] { background: var(--ok-soft, #e6f4ec); }
.league-result[data-move="down"] { background: var(--danger-soft, #fdeceb); }
.league-result-text { flex: 1 1 12rem; min-width: 0; margin: 0; }
.league-result-text b { display: block; font-size: 1.0625rem; }

/* Лесенка дивизионов: шесть ступенек в ряд и на телефоне. */
.league-ladder {
  list-style: none; margin: var(--s3, 12px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px;
}
.league-ladder li {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  padding: 4px 0; border-radius: var(--r-sm, 8px);
  font-size: .6875rem; line-height: 1.2; color: var(--muted, #5d6273); text-align: center;
}
.league-ladder li span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.league-ladder img { width: 24px; height: 24px; display: block; opacity: .35; }
.league-ladder li.is-done img { opacity: .7; }
.league-ladder li.is-on { background: var(--lg-soft); color: var(--ink, #14151a); font-weight: 700; box-shadow: inset 0 0 0 1px var(--lg-c); }
.league-ladder li.is-on img { opacity: 1; }

/* Таблица группы: место, имя, очки, партии — без прокрутки вбок и на 320 px. */
.league-h { margin: var(--s4, 16px) 0 var(--s2, 8px); font-size: 1rem; }
.league-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .9375rem; }
.league-table th, .league-table td { padding: 7px 6px; border-bottom: 1px solid var(--line, #e5e0d6); text-align: left; vertical-align: middle; }
.league-table thead th { font-size: .75rem; font-weight: 600; color: var(--muted, #5d6273); }
.league-table thead abbr { text-decoration: none; }
.league-table .league-c-place { width: 2.9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.league-table .league-c-num { width: 3.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.league-table .league-c-games { width: 4.25rem; }
.league-table .league-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.league-table tr.is-up { background: var(--ok-soft, #e6f4ec); }
.league-table tr.is-down { background: var(--danger-soft, #fdeceb); }
.league-table tr.is-me th, .league-table tr.is-me td { font-weight: 800; }
.league-table tr.is-me .league-c-place { box-shadow: inset 3px 0 0 var(--lg-c); }
.league-arrow-up { color: var(--ok, #14663c); font-weight: 700; }
.league-arrow-down { color: var(--danger, #a3231a); font-weight: 700; }
.league-legend { display: flex; flex-wrap: wrap; gap: var(--s1, 4px) var(--s3, 12px); margin: var(--s2, 8px) 0 0; font-size: .8125rem; color: var(--muted, #5d6273); }
.league-legend-up { color: var(--ok, #14663c); font-weight: 600; }
.league-legend-down { color: var(--danger, #a3231a); font-weight: 600; }

.league-empty {
  margin: var(--s3, 12px) 0 0; padding: var(--s3, 12px);
  border: 1px dashed var(--line-strong, #cfc8ba); border-radius: var(--r-md, 12px); font-weight: 600;
}

/* Значок и заголовок — кнопка страницы лиги (27.10.2026). */
.league-head {
  display: flex; align-items: center; gap: var(--s2, 8px); width: 100%; min-height: 44px; margin: 0; padding: 0;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.league-head:focus-visible, .league-step:focus-visible, .league-rules:focus-visible { outline: 2px solid var(--accent, #b3202a); outline-offset: 2px; border-radius: var(--r-sm, 8px); }
.league-more { margin-left: auto; font-size: .875rem; font-weight: 600; color: var(--accent-ink, #7f1219); white-space: nowrap; }
.league-step {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; min-width: 0; padding: 0;
  border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
}

/* «Как получить очки» — кнопка на страницу лиги. */
.league-rules {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2, 8px); width: 100%; min-height: 44px;
  margin-top: var(--s3, 12px); padding: var(--s2, 8px) 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer;
  font-weight: 600; color: var(--accent-ink, #7f1219);
}
.league-rules-sub { font-weight: 400; font-size: .875rem; color: var(--muted, #5d6273); }

/* Страница лиги — окно на весь экран. */
.lp-dialog { --lg-c: #8a5a2b; --lg-soft: #f6ece0; }
.lp-dialog[data-div="stone"] { --lg-c: #6b7076; --lg-soft: #eef0f2; }
.lp-dialog[data-div="bronze"] { --lg-c: #a8642c; --lg-soft: #f8ebdf; }
.lp-dialog[data-div="silver"] { --lg-c: #7d848f; --lg-soft: #f0f2f5; }
.lp-dialog[data-div="gold"] { --lg-c: #c28a12; --lg-soft: #fbf3df; }
.lp-dialog[data-div="diamond"] { --lg-c: #1f7fa0; --lg-soft: #e4f6fb; }
.lp-dialog {
  width: min(640px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 auto; padding: 0;
  border: 0; background: var(--bg, #fbf8f2); color: var(--ink, #14151a); overflow-y: auto; overscroll-behavior: contain;
}
.lp-dialog::backdrop { background: rgba(20, 21, 26, .55); }
.lp-top {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: var(--s2, 8px);
  padding: var(--s2, 8px) var(--s3, 12px); background: var(--bg, #fbf8f2); border-bottom: 1px solid var(--line, #e5e0d6);
}
.lp-back { min-height: 44px; padding: 0 var(--s2, 8px); border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent-ink, #7f1219); cursor: pointer; }
.lp-title { margin: 0; font-size: 1.125rem; }
.lp-body { padding: var(--s3, 12px) var(--s4, 16px) calc(var(--s5, 24px) + env(safe-area-inset-bottom, 0px)); }
.lp-me {
  display: flex; gap: var(--s3, 12px); align-items: flex-start; padding: var(--s3, 12px);
  border-radius: var(--r-md, 12px); background: var(--lg-soft); box-shadow: inset 0 0 0 2px var(--lg-c);
}
.lp-badge { flex: 0 0 auto; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px var(--lg-c); }
.lp-badge img { width: 56px; height: 56px; display: block; }
.lp-me-text { min-width: 0; }
.lp-me-text p { margin: 0 0 var(--s1, 4px); }
.lp-me-div { font-size: 1.125rem; font-weight: 800; }
.lp-me-place { font-weight: 700; }
.lp-left { font-size: .875rem; color: var(--muted, #5d6273); }
.lp-sec { margin-top: 28px; padding: 0; scroll-margin-top: 64px; }
.lp-h { margin: 0 0 var(--s2, 8px); font-size: 1.0625rem; }
.lp-sec p { margin: 0 0 var(--s2, 8px); }
.lp-list { margin: 0; padding-left: 1.25rem; }
.lp-list li + li { margin-top: var(--s1, 4px); }
.lp-divs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1, 4px); }
.lp-divs li { border-radius: var(--r-sm, 8px); color: var(--muted, #5d6273); }
/* Строка лиги — кнопка (league.js divMore): пояснение раскрывается под ней. */
.lp-div-btn {
  display: flex; align-items: center; gap: var(--s3, 12px); width: 100%; min-height: 44px;
  padding: var(--s1, 4px) var(--s2, 8px); border: 0; border-radius: inherit; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.lp-div-btn:focus-visible { outline: 2px solid var(--lg-c, currentColor); outline-offset: 2px; }
.lp-div-more { margin: 0; padding: 0 var(--s2, 8px) var(--s2, 8px) calc(44px + var(--s3, 12px) + var(--s2, 8px)); font-size: .875rem; font-weight: 400; color: var(--ink, #14151a); }
.lp-divs img { width: 44px; height: 44px; display: block; opacity: .45; }
.lp-divs li.is-done img { opacity: .8; }
.lp-divs li.is-on { background: var(--lg-soft); color: var(--ink, #14151a); font-weight: 700; box-shadow: inset 0 0 0 2px var(--lg-c); }
.lp-divs li.is-on img { opacity: 1; }
.lp-div-name { font-size: 1rem; }
.lp-div-note { margin-left: auto; font-size: .8125rem; }
.lp-note { margin-top: var(--s2, 8px); font-size: .875rem; color: var(--muted, #5d6273); }
.lp-qa { border-bottom: 1px solid var(--line, #e5e0d6); }
.lp-qa summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.lp-qa > p, .lp-qa > ul { margin: 0 0 var(--s3, 12px); }
.lp-close { display: block; width: 100%; margin-top: var(--s5, 24px); }

/* Аватарка и профиль по нажатию, как в ленте (27.10.2026). */
.league-who { display: flex; align-items: center; min-width: 0; }
.league-who-b { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; min-height: 40px; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.league-who > .league-ava { margin-right: 8px; }
.league-who-b:focus-visible { outline: 3px solid var(--focus, #1d4ed8); outline-offset: 2px; border-radius: 6px; }
@media (hover: hover) { .league-who-b:hover .league-who-n { text-decoration: underline; } }
.league-who-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.league-ava { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: var(--accent-soft, #f6e3e1); color: var(--accent-ink, #8b1c1c); font-size: .875rem; font-weight: 700; }
.league-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
