/* ============================================================
   LeagueModule CSS — هم‌شکل با بقیه‌ی ماژول‌ها. پیشوند lg-.
   ============================================================ */

.league-module {
  --lg-c-bg: #f5f5f3;
  --lg-c-surface: #ffffff;
  --lg-c-border: rgba(0,0,0,0.08);
  --lg-c-border-strong: rgba(0,0,0,0.14);
  --lg-c-text: #1a1a18;
  --lg-c-text-2: #5a5a56;
  --lg-c-text-3: #9a9994;
  --lg-c-accent: #2563eb;
  --lg-c-accent-bg: #eff6ff;
  --lg-c-accent-text: #1d4ed8;
  --lg-c-accent-border: #bfdbfe;
  --lg-c-success: #16a34a;
  --lg-c-success-bg: #f0fdf4;
  --lg-c-warning: #d97706;
  --lg-c-warning-bg: #fffbeb;
  --lg-c-danger: #dc2626;
  --lg-c-danger-bg: #fef2f2;
  --lg-radius-sm: 6px;
  --lg-radius: 10px;
  --lg-radius-lg: 14px;
  --lg-transition: 0.15s ease;

  font-family: 'Vazirmatn', system-ui, sans-serif;
  color: var(--lg-c-text);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

[data-theme="dark"] .league-module {
  --lg-c-bg: #15161a;
  --lg-c-surface: #1c1d22;
  --lg-c-border: rgba(255,255,255,0.08);
  --lg-c-border-strong: rgba(255,255,255,0.14);
  --lg-c-text: #f1f1ef;
  --lg-c-text-2: #b3b3ad;
  --lg-c-text-3: #76766f;
  --lg-c-accent-bg: rgba(37,99,235,0.14);
}

.league-module * { box-sizing: border-box; }

/* ── Buttons ── */
.lg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; height: 34px; border-radius: var(--lg-radius-sm); border: 1px solid var(--lg-c-border-strong); background: var(--lg-c-surface); color: var(--lg-c-text); font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit; }
.lg-btn:hover { background: var(--lg-c-bg); }
.lg-btn-primary { background: var(--lg-c-accent); border-color: var(--lg-c-accent); color: #fff; }
.lg-btn-primary:hover { background: #1d4ed8; }

/* ── Page header ── */
.lg-page-hdr { margin-bottom: 20px; }
.lg-page-title { font-size: 20px; font-weight: 600; }
.lg-page-desc { font-size: 13px; color: var(--lg-c-text-3); margin-top: 3px; }
.lg-formula-hdr { text-align: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; padding: 20px; border-radius: var(--lg-radius-lg); }
.lg-formula-hdr .lg-page-title, .lg-formula-hdr .lg-page-desc { color: #fff; }

/* ── Loading ── */
.lg-loading { display: flex; justify-content: center; padding: 24px 0; }
.lg-spinner { width: 14px; height: 14px; border: 2px solid var(--lg-c-border-strong); border-top-color: var(--lg-c-text-2); border-radius: 50%; display: inline-block; animation: lgSpin 0.7s linear infinite; }
.lg-spinner.large { width: 26px; height: 26px; border-width: 3px; }
@keyframes lgSpin { to { transform: rotate(360deg); } }

/* ── League page shell ── */
.lg-banner { background: url(/images/leagueheader.jpg); background-size: cover; width: 100%; max-width: 700px; height: 60px; border-radius: 8px; margin: 10px auto; }
.lg-period-bar { display: flex; justify-content: center; align-items: center; gap: 8px; max-width: 420px; margin: 10px auto 20px; }
.lg-period-bar .lg-btn { flex: 1; justify-content: center; }
.lg-period-select { height: 34px; border: 1px solid var(--lg-c-border-strong); border-radius: var(--lg-radius-sm); padding: 0 10px; font-size: 12px; background: var(--lg-c-surface); color: var(--lg-c-text); font-family: inherit; flex: 1; }

.lg-chart-card { max-width: 700px; margin: 0 auto 20px; background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius-lg); padding: 14px; }
.lg-chart-title { text-align: center; font-weight: 600; font-size: 12px; background: var(--lg-c-accent); color: #fff; padding: 6px; border-radius: var(--lg-radius-sm); margin-bottom: 10px; }
.lg-chart-canvas { width: 100%; max-width: 100%; background: var(--lg-c-bg); border-radius: var(--lg-radius); }

.lg-content { max-width: 700px; margin: 0 auto; }

/* ── Rank table ── */
.lg-rank-wrap { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius-lg); overflow: hidden; margin-bottom: 16px; }
table.lg-rank-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.lg-rank-tbl th { text-align: center; padding: 8px 4px; color: var(--lg-c-text-3); font-weight: 600; font-size: 10.5px; background: var(--lg-c-bg); }
table.lg-rank-tbl td { text-align: center; padding: 8px 4px; border-bottom: 1px solid var(--lg-c-border); }
table.lg-rank-tbl tr:last-child td { border-bottom: none; }
table.lg-rank-tbl tr.lg-highlight td { background: var(--lg-c-accent-bg); font-weight: 700; }
.lg-rank-icon { width: 30px; height: 30px; object-fit: contain; }
.lg-user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; margin: 0 auto; }
.lg-diamond-cell { display: inline-flex; align-items: center; gap: 3px; }
.lg-diamond-cell img { width: 14px; }

/* ── Competition banner ── */
.lg-competition-banner { display: flex; justify-content: center; margin: 20px 0; cursor: pointer; border-radius: var(--lg-radius-lg); overflow: hidden; transition: transform var(--lg-transition); }
.lg-competition-banner:hover { transform: translateY(-2px); }
.lg-competition-banner img { width: 100%; max-width: 320px; border-radius: var(--lg-radius-lg); }

.lg-diamond-tip { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 12px; font-size: 11px; }
.lg-diamond-tip img { width: 20px; }
.lg-diamond-tip a { color: var(--lg-c-accent-text); text-decoration: underline; }

/* ── Score formula settings ── */
.lg-formula-info { background: var(--lg-c-accent-bg); border: 1px solid var(--lg-c-accent-border); border-radius: var(--lg-radius); padding: 12px 14px; font-size: 12px; color: var(--lg-c-accent-text); margin: 16px 0; display: flex; gap: 8px; align-items: flex-start; }
.lg-formula-section { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius-lg); padding: 18px; margin-bottom: 16px; }
.lg-formula-section-title { font-size: 14px; font-weight: 700; color: var(--lg-c-accent-text); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--lg-c-border); }
.lg-formula-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--lg-c-border); gap: 10px; }
.lg-formula-item:last-child { border-bottom: none; }
.lg-formula-item label { font-size: 12.5px; color: var(--lg-c-text-2); flex: 1; }
.lg-formula-item input { width: 110px; height: 32px; border: 1px solid var(--lg-c-border-strong); border-radius: var(--lg-radius-sm); padding: 0 10px; font-size: 12px; text-align: center; background: var(--lg-c-surface); color: var(--lg-c-text); }
.lg-formula-preview { background: var(--lg-c-bg); padding: 14px; border-radius: var(--lg-radius); direction: ltr; text-align: left; font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.9; }
.lg-form-actions { display: flex; gap: 10px; margin: 20px 0; }
.lg-form-actions .lg-btn { flex: 1; justify-content: center; }

/* ── Modal (شل مسابقه) ── */
.lg-modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,15,14,0.5); z-index: 10000; align-items: center; justify-content: center; padding: 20px; }
.lg-modal-backdrop.open { display: flex; }
.lg-modal-box { width: 100%; max-width: 640px; background: var(--lg-c-surface); border-radius: var(--lg-radius-lg); border: 1px solid var(--lg-c-border); box-shadow: 0 24px 64px rgba(0,0,0,0.32); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.lg-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--lg-c-border); }
.lg-modal-title { font-size: 14px; font-weight: 600; }
.lg-modal-close { width: 30px; height: 30px; border: none; background: var(--lg-c-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--lg-c-text-2); cursor: pointer; }
.lg-modal-body { padding: 20px; overflow-y: auto; }

/* ── Confirm dialog ── */
.lg-confirm-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--lg-c-danger-bg); color: var(--lg-c-danger); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 26px; }
.lg-confirm-text { text-align: center; font-size: 13px; color: var(--lg-c-text-2); line-height: 1.7; }
.lg-modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.lg-modal-actions .lg-btn { flex: 1; justify-content: center; }

/* ── Waiting room (matchmaking) ── */
.lg-waiting-room { max-width: 420px; margin: 40px auto; text-align: center; }
.lg-waiting-spinner { margin-bottom: 16px; }
.lg-waiting-sub { color: var(--lg-c-text-3); font-size: 12px; margin-bottom: 16px; }
.lg-waiting-timer { font-size: 28px; font-weight: 700; font-family: 'Courier New', monospace; margin-bottom: 20px; color: var(--lg-c-accent); }
.lg-waiting-timeout { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lg-waiting-timeout p { color: var(--lg-c-warning); font-size: 12.5px; }
.lg-waiting-timeout .lg-btn { width: 100%; justify-content: center; }

/* ── Competition hub ── */
.lg-comp-hub { max-width: 480px; margin: 30px auto; text-align: center; }
.lg-comp-modes { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.lg-comp-mode-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border: 1px solid var(--lg-c-border-strong); border-radius: var(--lg-radius-lg); background: var(--lg-c-surface); cursor: pointer; text-align: right; font-family: inherit; transition: border-color var(--lg-transition), background var(--lg-transition); }
.lg-comp-mode-btn:hover:not(.disabled) { border-color: var(--lg-c-accent); background: var(--lg-c-accent-bg); }
.lg-comp-mode-btn.disabled { opacity: 0.55; cursor: not-allowed; }
.lg-comp-mode-btn > i:first-child { font-size: 26px; color: var(--lg-c-accent); }
.lg-comp-mode-btn div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lg-comp-mode-btn strong { font-size: 13.5px; }
.lg-comp-mode-btn span { font-size: 11px; color: var(--lg-c-text-3); }
.lg-soon-badge { font-size: 10px; background: var(--lg-c-warning-bg); color: var(--lg-c-warning); padding: 3px 8px; border-radius: 20px; font-weight: 600; }

/* ── Game play ── */
.lg-game { max-width: 640px; margin: 0 auto; }
.lg-game-timer-bar { position: relative; height: 30px; background: var(--lg-c-bg); border-radius: var(--lg-radius-sm); overflow: hidden; margin-bottom: 14px; }
.lg-game-timer-fill { position: absolute; inset: 0; background: linear-gradient(90deg, var(--lg-c-accent), #764ba2); transition: width 1s linear; }
.lg-game-timer-text { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; height: 100%; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

.lg-game-scoreboard { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.lg-game-score-item { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius); padding: 8px 16px; text-align: center; }
.lg-game-score-item span { display: block; font-size: 10.5px; color: var(--lg-c-text-3); }
.lg-game-score-item strong { font-size: 16px; }

.lg-game-section-title { text-align: center; font-size: 14px; margin-bottom: 14px; }
.lg-game-books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.lg-game-book-card { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border-strong); border-radius: var(--lg-radius-lg); padding: 16px 10px; text-align: center; cursor: pointer; transition: transform var(--lg-transition); }
.lg-game-book-card:hover { transform: translateY(-3px); }
.lg-game-book-card.completed { opacity: 0.6; cursor: default; }
.lg-game-book-card.completed:hover { transform: none; }
.lg-game-book-icon { width: 44px; height: 44px; object-fit: contain; margin-bottom: 8px; }
.lg-game-book-title { font-size: 12px; font-weight: 600; }
.lg-game-book-status { font-size: 10px; color: var(--lg-c-success); margin-top: 6px; }

.lg-game-loading { text-align: center; padding: 40px 0; }
.lg-game-loading-sub { font-size: 11px; color: var(--lg-c-text-3); }

.lg-game-question { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius-lg); padding: 20px; }
.lg-game-question-hdr { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--lg-c-text-3); margin-bottom: 14px; }
.lg-game-book-timer { color: var(--lg-c-warning); font-weight: 600; }
.lg-game-question-text { font-size: 15px; font-weight: 600; margin-bottom: 18px; line-height: 1.8; }
.lg-game-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.lg-game-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--lg-c-border-strong); border-radius: var(--lg-radius); background: var(--lg-c-surface); cursor: pointer; text-align: right; font-family: inherit; font-size: 12.5px; }
.lg-game-option:hover { background: var(--lg-c-bg); }
.lg-game-option.selected { border-color: var(--lg-c-accent); background: var(--lg-c-accent-bg); font-weight: 600; }
.lg-game-option-label { width: 24px; height: 24px; border-radius: 50%; background: var(--lg-c-bg); display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.lg-game-actions { display: flex; gap: 8px; margin-top: 12px; }
.lg-game-actions .lg-btn { flex: 1; justify-content: center; }

/* ── Results page ── */
.lg-results-notfound { text-align: center; padding: 60px 20px; }
.lg-results-container { max-width: 560px; margin: 0 auto; }
.lg-results-header { text-align: center; margin-bottom: 24px; }
.lg-result-badge { width: 90px; height: 90px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 44px; }
.lg-result-badge.lg-result-win { background: linear-gradient(135deg, #667eea, #764ba2); }
.lg-result-badge.lg-result-draw { background: linear-gradient(135deg, #f093fb, #f5576c); }
.lg-result-badge.lg-result-loss { background: linear-gradient(135deg, #a8a8a8, #6b6b6b); }
.lg-result-badge.lg-result-withdrawn { background: linear-gradient(135deg, #f6ad55, #dd6b20); }
.lg-result-title { font-size: 18px; font-weight: 700; margin: 0; }
.lg-result-subtitle { color: var(--lg-c-text-3); font-size: 12px; margin-top: 4px; }

.lg-rewards-section { text-align: center; background: linear-gradient(135deg, #ffd700, #ffb700); border-radius: var(--lg-radius-lg); padding: 18px; margin-bottom: 16px; color: #5a3e00; }
.lg-diamond-display { font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px 0; }

.lg-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.lg-stat-card { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius); padding: 12px; text-align: center; }
.lg-stat-label { font-size: 10.5px; color: var(--lg-c-text-3); }
.lg-stat-value { font-size: 17px; font-weight: 700; margin-top: 4px; }

.lg-section-title { font-size: 13px; margin-bottom: 10px; }
.lg-participants-section, .lg-books-section { margin-bottom: 18px; }
.lg-participant-card { display: flex; justify-content: space-between; align-items: center; background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius); padding: 10px 14px; margin-bottom: 8px; }
.lg-participant-card.winner { border-color: #ffd700; background: #fffbea; }
.lg-participant-info { display: flex; align-items: center; gap: 10px; }
.lg-rank-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--lg-c-bg); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.lg-participant-score { font-weight: 700; }
.lg-book-result-card { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--lg-c-bg); border-radius: var(--lg-radius-sm); margin-bottom: 6px; font-size: 12px; }
.lg-results-actions { display: flex; gap: 10px; margin-top: 20px; }
.lg-results-actions .lg-btn { flex: 1; justify-content: center; }

/* ── Toast ── */
.lg-toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.lg-toast { display: flex; align-items: center; gap: 10px; background: var(--lg-c-text); color: #fff; padding: 12px 16px; border-radius: var(--lg-radius); font-size: 13px; font-weight: 500; cursor: pointer; }

@media (max-width: 720px) {
  .lg-modal-backdrop { padding: 0; align-items: flex-end; }
  .lg-modal-box { max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .lg-toast-wrap { bottom: 12px; left: 12px; right: 12px; }
  .lg-toast { width: 100%; }
  .lg-formula-item { flex-direction: column; align-items: stretch; }
  .lg-formula-item input { width: 100%; }
}

/* ── نشانگر «رتبه‌بندی مدرسه‌محور» (۲۶ اوت ۲۰۲۶) ── */
.lg-school-scope-banner {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  background: var(--lg-c-accent-bg); color: var(--lg-c-accent-text);
  border: 1px solid var(--lg-c-accent-border); border-radius: var(--lg-radius-sm);
  padding: 10px 14px; margin-bottom: 14px;
}
.lg-school-scope-banner .ti { font-size: 15px; flex-shrink: 0; }

/* ══════════ 🆕 (Update 31) نمودارِ شاخص‌هایِ لیگ (lgm-) و صفحه‌ی تنظیماتِ ادمین (lgs-) ══════════ */
.lgm { margin: 12px 0 18px; font-family: 'Vazirmatn', system-ui, sans-serif; }
.lgm-metrics { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.lgm-metric { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
    border: 1px solid #e5e7eb; background: #fff; color: #374151; font: inherit; font-size: 13px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.lgm-metric:hover { border-color: #93c5fd; }
.lgm-metric.on { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 700; box-shadow: 0 6px 16px rgba(37,99,235,.25); }
.lgm-period { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 10px; }
.lgm-nav { width: 38px; height: 38px; border-radius: 50%; border: 1px solid #e5e7eb; background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.lgm-nav:disabled { opacity: .35; cursor: not-allowed; }
.lgm-period-types { display: inline-flex; background: #f3f4f6; padding: 4px; border-radius: 12px; gap: 4px; }
.lgm-period-types button { border: none; background: transparent; padding: 7px 16px; border-radius: 9px; font: inherit; font-size: 13px; cursor: pointer; color: #4b5563; }
.lgm-period-types button.on { background: #fff; color: #1d4ed8; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.lgm-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 18px; padding: 16px; box-shadow: 0 4px 18px rgba(15,23,42,.05); }
.lgm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.lgm-title { margin: 0; font-size: 17px; font-weight: 800; color: #111827; }
.lgm-sub { font-size: 12.5px; color: #6b7280; margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lgm-today { border: none; background: #eff6ff; color: #1d4ed8; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 11.5px; cursor: pointer; }
.lgm-kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.lgm-kpi { background: #f8fafc; border-radius: 14px; padding: 8px 14px; display: grid; gap: 2px; min-width: 96px; text-align: center; }
.lgm-kpi .v { font-size: 20px; font-weight: 900; color: #111827; }
.lgm-kpi .l { font-size: 11px; color: #6b7280; }
.lgm-kpi.main { background: linear-gradient(135deg, #eff6ff, #eef2ff); }
.lgm-kpi.main .v { color: #1d4ed8; font-size: 24px; }
.lgm-change { display: inline-flex; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 1px 8px; margin-top: 2px; }
.lgm-change.up { background: #dcfce7; color: #15803d; }
.lgm-change.down { background: #fee2e2; color: #b91c1c; }
.lgm-compare { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 6px; }
.lgm-compare-lbl { font-size: 12px; color: #6b7280; font-weight: 700; }
.lgm-chip { border: 1px solid #e5e7eb; background: #fff; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; color: #4b5563; }
.lgm-chip.on.s-PreviousPeriod { border-color: #94a3b8; background: #f1f5f9; color: #334155; font-weight: 700; }
.lgm-chip.on.s-School { border-color: #16a34a; background: #f0fdf4; color: #15803d; font-weight: 700; }
.lgm-chip.on.s-Platform { border-color: #d97706; background: #fffbeb; color: #b45309; font-weight: 700; }
.lgm-chart { position: relative; margin-top: 6px; }
.lgm-canvas-wrap { position: relative; height: 300px; }
.lgm-chart.loading .lgm-canvas-wrap { opacity: .35; }
.lgm-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.lgm-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: #6b7280; background: rgba(255,255,255,.7); border-radius: 12px; text-align: center; padding: 10px; }
.lgm-desc { margin: 10px 0 0; font-size: 12px; color: #6b7280; line-height: 1.9; }
.lgm-metric:focus-visible, .lgm-chip:focus-visible, .lgm-nav:focus-visible, .lgm-period-types button:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
@media (max-width: 560px) {
    .lgm-canvas-wrap { height: 240px; }
    .lgm-head { flex-direction: column; }
    .lgm-kpis { width: 100%; }
    .lgm-kpi { flex: 1; }
}

.lgs-page { max-width: 1000px; margin: 0 auto; padding: 16px; font-family: 'Vazirmatn', system-ui, sans-serif; }
.lgs-hdr { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.lgs-hdr h1 { margin: 0 0 4px; font-size: 20px; font-weight: 800; display: flex; gap: 8px; align-items: center; }
.lgs-hdr h1 i { color: #2563eb; }
.lgs-hdr p { margin: 0; font-size: 12.5px; color: #4b5563; }
.lgs-hdr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lgs-btn { min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.lgs-btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.lgs-btn:disabled { opacity: .5; cursor: not-allowed; }
.lgs-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: #374151; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.lgs-legend .muted { color: #6b7280; }
.lgs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lgs-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; transition: opacity .15s; }
.lgs-row.off { opacity: .6; background: #fafafa; }
.lgs-order { display: grid; gap: 2px; }
.lgs-order button { border: 1px solid #e5e7eb; background: #fff; border-radius: 6px; width: 28px; height: 22px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.lgs-order button:disabled { opacity: .3; cursor: default; }
.lgs-icon { width: 42px; height: 42px; border-radius: 12px; background: #eff6ff; color: #2563eb; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.lgs-name { font-size: 14px; font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lgs-unit { font-size: 11px; font-weight: 600; color: #6b7280; background: #f3f4f6; border-radius: 999px; padding: 1px 8px; }
.lgs-badge { font-size: 10.5px; border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.lgs-badge.rec { background: #fef3c7; color: #b45309; }
.lgs-badge.def { background: #dbeafe; color: #1d4ed8; }
.lgs-desc { font-size: 12px; color: #4b5563; margin: 2px 0 6px; line-height: 1.8; }
.lgs-compares { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.lgs-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #374151; cursor: pointer; }
.lgs-switch { width: 46px; height: 26px; border-radius: 999px; border: none; background: #d1d5db; position: relative; cursor: pointer; padding: 0; }
.lgs-switch span { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: inset-inline-start .15s; }
.lgs-switch.on { background: #16a34a; }
.lgs-switch.on span { inset-inline-start: 23px; }
.lgs-switch:focus-visible, .lgs-btn:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
.lgs-footer { margin-top: 10px; font-size: 12.5px; color: #4b5563; }
.lgs-skel { height: 76px; border-radius: 14px; margin-bottom: 8px; background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 37%, #f3f4f6 63%); background-size: 400% 100%; animation: lgs-skel 1.3s ease infinite; }
@keyframes lgs-skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.lgs-spin { animation: lgs-spin 1s linear infinite; display: inline-block; }
@keyframes lgs-spin { to { transform: rotate(360deg); } }
.lgs-toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: #065f46; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 13px; z-index: 10001; }
.lgs-toast.error { background: #b91c1c; }
.lgs-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px; }
.lgs-denied { text-align: center; color: #4b5563; padding: 40px; }
@media (max-width: 640px) {
    .lgs-row { grid-template-columns: auto 1fr auto; }
    .lgs-icon { display: none; }
}
@media (prefers-reduced-motion: reduce) { .lgs-skel, .lgs-spin { animation: none; } }

/* ═══════ 🆕 (Update 53) جدولِ لیگِ متصل به موتورِ الماس ═══════ */
.lg-diamond-tip { width: 100%; border: 0; background: transparent; color: var(--lg-c-accent-text); font-family: inherit; cursor: pointer; padding: 8px; border-radius: var(--lg-radius-sm); }
.lg-diamond-tip span { text-decoration: underline; text-underline-offset: 3px; }
.lg-diamond-tip:hover { background: var(--lg-c-accent-bg); }
.lg-diamond-tip:focus-visible, .lgr button:focus-visible { outline: 2px solid var(--lg-c-accent); outline-offset: 2px; }

.lgr { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: var(--lg-radius-lg); padding: 14px; margin-bottom: 16px; }
.lgr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.lgr-title { margin: 0; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.lgr-title .ti { color: #d97706; }
.lgr-sub { font-size: 11.5px; color: var(--lg-c-text-3); margin-top: 2px; }
.lgr-icon-btn { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; border: 1px solid var(--lg-c-border-strong); background: var(--lg-c-surface); color: var(--lg-c-text-2); cursor: pointer; display: grid; place-items: center; font-size: 16px; }
.lgr-icon-btn:disabled { opacity: .6; cursor: default; }
.lgr-spin { animation: lgSpin .8s linear infinite; }
.lgr-note { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; color: var(--lg-c-accent-text); background: var(--lg-c-accent-bg); border: 1px solid var(--lg-c-accent-border); border-radius: var(--lg-radius); padding: 8px 10px; margin-bottom: 10px; }
.lgr-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.lgr-tbl { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 12.5px; }
.lgr-tbl th { font-size: 10.5px; font-weight: 600; color: var(--lg-c-text-3); padding: 2px 6px; text-align: center; }
.lgr-tbl td { padding: 8px 6px; text-align: center; background: var(--lg-c-bg); }
.lgr-tbl td:first-child { border-radius: 0 var(--lg-radius) var(--lg-radius) 0; }
.lgr-tbl td:last-child { border-radius: var(--lg-radius) 0 0 var(--lg-radius); }
.lgr-tbl tr.me td { background: var(--lg-c-accent-bg); font-weight: 700; box-shadow: inset 0 1px 0 var(--lg-c-accent-border), inset 0 -1px 0 var(--lg-c-accent-border); }
.lgr-tbl .lgr-name-col { text-align: right; }
.lgr-rank { width: 46px; font-weight: 800; color: var(--lg-c-text-2); font-variant-numeric: tabular-nums; }
.lgr-medal { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; }
.lgr-person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.lgr-avatar { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; object-fit: cover; }
.lgr-initial { display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-weight: 700; font-size: 13px; }
.lgr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lgr-badge { font-size: 10px; font-weight: 700; color: #fff; background: var(--lg-c-accent); border-radius: 999px; padding: 1px 8px; flex: 0 0 auto; }
.lgr-diamond { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lgr-diamond img { width: 16px; height: 16px; }
.lgr-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.lgr-gap td { background: transparent !important; color: var(--lg-c-text-3); padding: 0; line-height: 1; letter-spacing: 3px; }

.lgr-skeleton { display: grid; gap: 6px; }
.lgr-sk-row { display: grid; grid-template-columns: 40px 1fr 70px; gap: 10px; }
.lgr-sk-row span { height: 34px; border-radius: var(--lg-radius); background: linear-gradient(90deg, var(--lg-c-bg) 25%, var(--lg-c-border) 50%, var(--lg-c-bg) 75%); background-size: 200% 100%; animation: lgrShimmer 1.2s infinite; }
@keyframes lgrShimmer { to { background-position: -200% 0; } }
.lgr-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--lg-c-text-2); padding: 18px 8px; font-size: 12.5px; }
.lgr-state .ti { font-size: 28px; color: var(--lg-c-text-3); }

.lgr-me { margin-top: 12px; border-top: 1px dashed var(--lg-c-border-strong); padding-top: 12px; }
.lgr-me-hint { margin: 0 0 10px; font-size: 12px; color: var(--lg-c-text-2); display: flex; gap: 6px; }
.lgr-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.lgr-kpi { background: var(--lg-c-bg); border-radius: var(--lg-radius); padding: 8px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.lgr-kpi .v { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lgr-kpi .l { font-size: 10.5px; color: var(--lg-c-text-3); display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.lgr-kpi .l img { width: 12px; }
.lgr-link { margin-top: 10px; border: 0; background: transparent; color: var(--lg-c-accent-text); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; }
.lgr-chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.lgr-chips li { font-size: 11.5px; background: var(--lg-c-bg); border: 1px solid var(--lg-c-border); border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 4px; }
.lgr-chips li b { font-variant-numeric: tabular-nums; }
.lgr-chips li.zero { opacity: .55; }
.lgr-chips li.neg { color: var(--lg-c-warning); border-color: currentColor; }

.lgr-rules { margin-top: 12px; border-top: 1px solid var(--lg-c-border); padding-top: 8px; }
.lgr-rules-toggle { width: 100%; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--lg-c-text); cursor: pointer; padding: 6px 0; text-align: right; }
.lgr-rules-toggle img { width: 18px; }
.lgr-rules-toggle .ti { margin-inline-start: auto; color: var(--lg-c-text-3); }
.lgr-rules ul { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: 12px; color: var(--lg-c-text-2); }
.lgr-rules-foot { font-size: 11px; color: var(--lg-c-text-3); margin: 8px 0 0; }

@media (max-width: 480px) {
  .lgr { padding: 10px; }
  .lgr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lgr-tbl td { padding: 7px 4px; }
  .lgr-avatar { width: 26px; height: 26px; flex-basis: 26px; }
}
@media (prefers-reduced-motion: reduce) { .lgr-spin, .lgr-sk-row span { animation: none; } }

/* ═══════ 🆕 (Update 53) صفحه‌ی فرمولِ لیگ ═══════ */
.lsf-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: thin; }
.lsf-tabs button { flex: 0 0 auto; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--lg-c-border-strong); background: var(--lg-c-surface); color: var(--lg-c-text-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.lsf-tabs button.on { background: var(--lg-c-accent); border-color: var(--lg-c-accent); color: #fff; }
.lsf-tabs button:focus-visible, .lsf-seg button:focus-visible, .lsf-field input:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
.lsf-panel { display: grid; gap: 12px; padding-bottom: 90px; }
.lsf-card { background: var(--lg-c-surface); border: 1px solid var(--lg-c-border); border-radius: 14px; padding: 16px; }
.lsf-card h2 { margin: 0 0 6px; font-size: 14.5px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.lsf-card h2 .ti { color: var(--lg-c-accent); }
.lsf-help { margin: 0 0 12px; font-size: 12px; color: var(--lg-c-text-2); line-height: 1.8; }
.lsf-note { margin: 10px 0 0; font-size: 12px; color: var(--lg-c-text-2); display: flex; gap: 6px; align-items: center; }
.lsf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lsf-field { display: flex; flex-direction: column; gap: 4px; }
.lsf-field label { font-size: 12px; font-weight: 600; color: var(--lg-c-text); }
.lsf-field small { font-size: 11px; color: var(--lg-c-text-3); }
.lsf-field input { width: 100%; height: 38px; border: 1px solid var(--lg-c-border-strong); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 13px; background: var(--lg-c-surface); color: var(--lg-c-text); font-variant-numeric: tabular-nums; }
.lsf-input { position: relative; }
.lsf-input input { padding-inline-end: 58px; }
.lsf-unit { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--lg-c-text-3); pointer-events: none; }
.lsf-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--lg-c-bg); border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.lsf-seg button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--lg-c-text-2); cursor: pointer; }
.lsf-seg button.on { background: var(--lg-c-surface); color: var(--lg-c-accent-text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.lsf-toggle { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--lg-c-border); }
.lsf-toggle:last-of-type { border-bottom: 0; }
.lsf-toggle .lgs-switch { flex: 0 0 46px; margin-top: 2px; }
.lsf-toggle-label { font-size: 13px; font-weight: 700; }
.lsf-toggle small { font-size: 11.5px; color: var(--lg-c-text-3); line-height: 1.7; }
.lsf-formula code { display: block; direction: rtl; white-space: normal; line-height: 2.1; font-family: inherit; font-size: 12px; background: var(--lg-c-bg); border-radius: 10px; padding: 10px 12px; color: var(--lg-c-text-2); }
.lsf-result-kpis { display: flex; gap: 12px; margin-bottom: 10px; }
.lsf-result-kpis > div { flex: 1; background: var(--lg-c-accent-bg); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.lsf-result-kpis .v { font-size: 22px; font-weight: 800; color: var(--lg-c-accent-text); font-variant-numeric: tabular-nums; }
.lsf-result-kpis .l { font-size: 11.5px; color: var(--lg-c-text-2); }
.lsf-delta { font-size: 11.5px; font-weight: 700; color: var(--lg-c-text-3); }
.lsf-delta.up { color: var(--lg-c-success); }
.lsf-delta.down { color: var(--lg-c-danger); }
.lsf-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lsf-history li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; padding: 10px; border: 1px solid var(--lg-c-border); border-radius: 10px; flex-wrap: wrap; }
.lsf-savebar { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--lg-c-surface); border: 1px solid var(--lg-c-border-strong); border-radius: 14px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.lsf-savebar.dirty { border-color: var(--lg-c-warning); }
.lsf-state { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; color: var(--lg-c-success); }
.lsf-savebar.dirty .lsf-state { color: var(--lg-c-warning); }
.lsf-note-input { flex: 1 1 180px; min-width: 0; height: 38px; border: 1px solid var(--lg-c-border-strong); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 12.5px; background: var(--lg-c-surface); color: var(--lg-c-text); }
.lsf-note-input:disabled { opacity: .5; }
@media (max-width: 560px) {
  .lsf-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lsf-card { padding: 12px; }
  .lsf-savebar .lgs-btn { flex: 1; justify-content: center; }
}

/* 🆕 (Update 64) جدولِ قابلِ‌اسکرول با ردیفِ چسبانِ کاربر */
.lgr-scroll { --lgr-row: 54px; max-height: calc(var(--lgr-row) * 4 + 34px); overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth;
  border-radius: 14px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.lgr-scroll:focus-visible { outline: 2px solid var(--lg-c-primary, #2563eb); outline-offset: 2px; }
.lgr-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--lg-c-surface, #fff); }
.lgr-scroll tbody tr td { height: calc(var(--lgr-row) - 8px); }
.lgr-scroll tr.lgr-sticky-me td { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 -8px 16px -10px rgba(15,23,42,.35); }
.lgr-scroll tr.lgr-sticky-me td:first-child { border-radius: 0 12px 12px 0; }
.lgr-scroll tr.lgr-sticky-me td:last-child { border-radius: 12px 0 0 12px; }

/* ═══════════ 🆕 (Update 66) صحنه‌ی مسابقه‌ی جدید ═══════════ */
.lg2 { max-width: 680px; margin: 0 auto; font-family: 'Vazirmatn', system-ui, sans-serif; }
.lg2-hero { text-align: center; background: linear-gradient(135deg, #312e81, #6d28d9 55%, #db2777); color: #fff; border-radius: 22px; padding: 22px 18px; margin-bottom: 16px; position: relative; overflow: hidden; }
.lg2-hero::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.lg2-hero-emoji { font-size: 42px; animation: lg2-bob 2.6s ease-in-out infinite; }
.lg2-hero h1 { margin: 6px 0 4px; font-size: 20px; font-weight: 800; }
.lg2-hero p { margin: 0 auto; max-width: 460px; font-size: 13px; line-height: 1.9; opacity: .92; }
.lg2-rules { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.lg2-rules span { background: rgba(255,255,255,.16); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; display: inline-flex; gap: 4px; align-items: center; }

.lg2-time { position: relative; height: 34px; border-radius: 12px; background: #eef2ff; overflow: hidden; margin-bottom: 12px; }
.lg2-time-fill { position: absolute; inset: 0 0 0 auto; background: linear-gradient(90deg, #6366f1, #8b5cf6); transition: width 1s linear; }
.lg2-time span { position: relative; z-index: 1; height: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; color: #fff; font-weight: 800; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
.lg2-time.warn .lg2-time-fill { background: linear-gradient(90deg, #f43f5e, #f59e0b); }
.lg2-time.warn { animation: lg2-pulse 1s ease-in-out infinite; }

.lg2-board { display: grid; gap: 8px; margin-bottom: 12px; }
.lg2-player { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 10px 12px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.lg2-player.me { border-color: #c7d2fe; background: linear-gradient(90deg, #eef2ff, #fff); }
.lg2-player.lead { border-color: #fbbf24; box-shadow: 0 8px 20px -14px rgba(245,158,11,.8); }
.lg2-player.pop .lg2-score { animation: lg2-pop .6s ease-out; }
.lg2-av { position: relative; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #a855f7); display: grid; place-items: center; flex-shrink: 0; }
.lg2-av img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); border-radius: 50%; object-fit: cover; }
.lg2-av-ini { color: #fff; font-weight: 800; }
.lg2-av-bot { font-size: 24px; }
.lg2-crown { position: absolute; top: -14px; right: -4px; font-size: 18px; animation: lg2-bob 2s ease-in-out infinite; z-index: 1; }
.lg2-pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lg2-pinfo b { font-size: 13.5px; }
.lg2-status, .lg2-streak { font-size: 11px; color: #64748b; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg2-streak { color: #ea580c; font-weight: 800; }
.lg2-dots { display: inline-flex; gap: 2px; }
.lg2-dots i { width: 4px; height: 4px; border-radius: 50%; background: #8b5cf6; animation: lg2-dot 1.2s infinite; }
.lg2-dots i:nth-child(2) { animation-delay: .2s; } .lg2-dots i:nth-child(3) { animation-delay: .4s; }
.lg2-prog { height: 6px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.lg2-prog span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c55e, #10b981); transition: width .5s ease; margin-inline-start: auto; }
.lg2-score { min-width: 46px; text-align: center; font-size: 24px; font-weight: 900; color: #312e81; font-variant-numeric: tabular-nums; }

.lg2-banner { margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; font-weight: 800; font-size: 13px; text-align: center; animation: lg2-in .25s ease-out; }
.lg2-banner.lead { background: #dcfce7; color: #166534; } .lg2-banner.behind { background: #fef3c7; color: #92400e; }
.lg2-banner.hot { background: #ffedd5; color: #c2410c; } .lg2-banner.info { background: #e0e7ff; color: #3730a3; }

.lg2-books h3 { text-align: center; font-size: 15px; margin: 6px 0 2px; }
.lg2-hint { text-align: center; font-size: 12px; color: #64748b; margin: 0 0 12px; }
.lg2-book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lg2-book { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border-radius: 16px; border: 1px solid #e2e8f0; background: #fff; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; min-height: 132px; }
.lg2-book:hover:not(:disabled) { transform: translateY(-3px); border-color: #a5b4fc; box-shadow: 0 12px 24px -16px rgba(79,70,229,.6); }
.lg2-book img { width: 44px; height: 44px; object-fit: contain; }
.lg2-book > i { font-size: 32px; color: #6366f1; }
.lg2-book-t { font-size: 12.5px; font-weight: 800; text-align: center; line-height: 1.6; }
.lg2-book-go { margin-top: auto; font-size: 11.5px; font-weight: 800; color: #4f46e5; display: inline-flex; gap: 3px; align-items: center; }
.lg2-book.done { background: #f8fafc; cursor: default; }
.lg2-book-s { margin-top: auto; color: #f59e0b; font-size: 13px; letter-spacing: 1px; }
.lg2-book-s em { font-style: normal; color: #475569; font-size: 11.5px; margin-inline-start: 4px; letter-spacing: 0; }
.lg2-quit, .lg2-link { font: inherit; border: 0; background: transparent; color: #64748b; font-size: 12.5px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; padding: 8px; border-radius: 10px; }
.lg2-quit { display: flex; margin: 14px auto 0; }
.lg2-link:hover, .lg2-quit:hover { background: #f1f5f9; } .lg2-link.danger { color: #e11d48; }

.lg2-loading { text-align: center; padding: 34px 10px; display: grid; gap: 6px; justify-items: center; }
.lg2-loading small { color: #64748b; }
.lg2-loader { display: flex; gap: 6px; } .lg2-loader i { width: 12px; height: 12px; border-radius: 50%; background: #8b5cf6; animation: lg2-dot 1s infinite; }
.lg2-loader i:nth-child(2) { animation-delay: .15s; background: #ec4899; } .lg2-loader i:nth-child(3) { animation-delay: .3s; background: #f59e0b; }

.lg2-q { background: #fff; border: 1px solid #e5e7eb; border-radius: 20px; padding: 16px; box-shadow: 0 16px 34px -26px rgba(15,23,42,.5); animation: lg2-in .25s ease-out; }
.lg2-q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: #475569; }
.lg2-q-book { display: inline-flex; gap: 4px; align-items: center; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg2-q-timer { display: inline-flex; gap: 4px; align-items: center; font-weight: 800; color: #4f46e5; background: #eef2ff; border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums; }
.lg2-q-timer.warn { color: #be123c; background: #ffe4e6; animation: lg2-pulse 1s ease-in-out infinite; }
.lg2-q-dots { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.lg2-q-dots span { width: 28px; height: 6px; border-radius: 999px; background: #e2e8f0; }
.lg2-q-dots span.now { background: #6366f1; } .lg2-q-dots span.ok { background: #22c55e; } .lg2-q-dots span.bad { background: #f43f5e; }
.lg2-q-text { font-size: 15.5px; font-weight: 700; line-height: 2; margin-bottom: 14px; color: #0f172a; }
.lg2-opts { display: grid; gap: 8px; }
.lg2-opt { font: inherit; display: flex; align-items: center; gap: 10px; text-align: right; padding: 12px 12px; min-height: 52px; border-radius: 14px; border: 1.5px solid #e2e8f0; background: #fff; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; font-size: 14px; }
.lg2-opt:hover:not(:disabled) { border-color: #a5b4fc; background: #f8fafc; }
.lg2-opt:active:not(:disabled) { transform: scale(.99); }
.lg2-opt-l { width: 30px; height: 30px; border-radius: 10px; background: #f1f5f9; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.lg2-opt-t { flex: 1; min-width: 0; }
.lg2-opt > i { font-size: 22px; }
.lg2-opt.selected { border-color: #6366f1; background: #eef2ff; } .lg2-opt.selected .lg2-opt-l { background: #6366f1; color: #fff; }
.lg2-opt.correct { border-color: #22c55e; background: #dcfce7; color: #14532d; animation: lg2-pop .4s ease-out; } .lg2-opt.correct .lg2-opt-l { background: #22c55e; color: #fff; } .lg2-opt.correct > i { color: #16a34a; }
.lg2-opt.wrong { border-color: #f43f5e; background: #ffe4e6; color: #881337; animation: lg2-shake .35s ease-in-out; } .lg2-opt.wrong .lg2-opt-l { background: #f43f5e; color: #fff; } .lg2-opt.wrong > i { color: #e11d48; }
.lg2-opt.dim { opacity: .55; }
.lg2-submit { font: inherit; width: 100%; margin-top: 12px; min-height: 50px; border: 0; border-radius: 14px; background: linear-gradient(90deg, #4f46e5, #7c3aed); color: #fff; font-weight: 800; font-size: 14px; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 6px; }
.lg2-submit:disabled { background: #cbd5e1; cursor: not-allowed; }
.lg2-fb { margin-top: 12px; min-height: 50px; display: grid; place-items: center; border-radius: 14px; font-weight: 800; font-size: 14px; animation: lg2-in .2s ease-out; }
.lg2-fb.ok { background: #dcfce7; color: #166534; } .lg2-fb.bad { background: #fff1f2; color: #9f1239; }
.lg2-q-foot { display: flex; justify-content: space-between; margin-top: 8px; }

@keyframes lg2-pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes lg2-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes lg2-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
@keyframes lg2-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
@keyframes lg2-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes lg2-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .lg2 *, .lg2-hero-emoji { animation: none !important; transition: none !important; } }
@media (max-width: 480px) { .lg2-score { font-size: 20px; min-width: 38px; } .lg2-av { width: 38px; height: 38px; } .lg2-q { padding: 12px; } }
