/* ==========================================================================
   الدوريات — واجهة اللاعب
   يمتد من متغيّرات style.css الحالية ويتبع أسلوب table.css في دعم الوضع الفاتح.
   ========================================================================== */

.league-page {
    --lg-bg: #080b12;
    --lg-card: #14181f;
    --lg-section: rgba(255, 255, 255, .035);
    --lg-card-soft: rgba(255, 255, 255, .035);
    --lg-line: rgba(255, 255, 255, .07);
    --lg-line-strong: rgba(148, 163, 184, .22);
    --lg-text: #f4f7fb;
    --lg-text-2: #b9c4d2;
    --lg-muted: #7d8a99;
    --lg-primary: #00d4aa;
    --lg-emerald: #00cc99;
    --lg-blue: #0099ff;
    --lg-gold: #f5a623;
    --lg-danger: #ff4d6d;
    --lg-radius: 24px;
    --lg-shadow: 0 24px 60px rgba(0, 0, 0, .38);
    min-height: 70vh;
    padding: 120px 0 118px;
    color: var(--lg-text);
    background-color: var(--lg-card) !important;
}

body.light-mode .league-page {
    --lg-bg: #eef1f4;
    --lg-card: #ffffff;
    --lg-section: #F7F7F7;
    --lg-card-soft: rgba(15, 23, 42, .035);
    --lg-line: rgba(15, 23, 42, .09);
    --lg-line-strong: rgba(15, 23, 42, .14);
    --lg-text: #16202e;
    --lg-text-2: #3f4c5c;
    --lg-muted: #6b7787;
    --lg-shadow: 0 20px 50px rgba(15, 23, 42, .10);
}


/* ---------- ترويسة الصفحة ---------- */

.league-hero {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.league-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.5rem, 3.4vw, 2.1rem);
    font-weight: 800;
    color: var(--lg-text);
}

.league-hero p {
    margin: 0;
    font-size: .95rem;
    color: var(--lg-muted);
    font-weight: 500;
}

.league-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- الأزرار ---------- */

.lg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-size: .92rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: .22s ease;
    white-space: nowrap;
}

.lg-btn:disabled,
.lg-btn.is-disabled {
    opacity: .5;
    pointer-events: none;
}

.lg-btn-primary {
    background: linear-gradient(135deg, var(--lg-emerald), #05d4b7);
    color: var(--lg-bg);
    box-shadow: 0px 0px 26px rgba(0, 204, 153, .24);
    border: 1px solid var(--bs-gray-400);
}

.lg-btn-primary:hover {
    color: var(--lg-bg);
    transform: translateY(-2px);
    box-shadow: 0 0px 32px rgba(0, 204, 153, .34);
}

.lg-btn-blue {
    background: var(--lg-blue);
    color: #fff;
}

.lg-btn-blue:hover {
    color: #fff;
    transform: translateY(-2px);
}

.lg-btn-ghost {
    background: var(--lg-card-soft);
    border-color: var(--lg-line);
    color: var(--lg-text-2);
}

.lg-btn-ghost:hover {
    color: var(--lg-text);
    border-color: var(--lg-primary);
    background: rgba(0, 212, 170, .08);
}

.lg-btn-block {
    width: 100%;
}

/* ---------- شارات الحالة ---------- */

.lg-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
    background: rgba(148, 163, 184, .16);
    /* color: var(--lg-muted); */
}

.lg-badge.green {
    color: #12c79c;
    background: rgba(0, 204, 153, .16);
}

.lg-badge.orange {
    color: #d47329;
    background: rgba(212, 115, 41, .16);
}

.lg-badge.blue {
    color: #2aa3ff;
    background: rgba(0, 153, 255, .16);
}

.lg-badge.pink {
    color: #ff4d6d;
    background: rgba(255, 77, 109, .14);
}

.lg-badge.official {
    color: #2b1a02;
    background: linear-gradient(90deg, #ffd166, #f5a623);
}

.lg-badge.lock {
    color: #94a3b8;
    background: rgba(148, 163, 184, .14);
}

/* ---------- شريط جولات الدوري ---------- */

.round-strip {
    display: flex;
    align-items: center;
    gap: 4px;
    direction: ltr; /* تسلسل زمني يُقرأ من اليسار لليمين حتى في واجهة RTL */
    flex-wrap: wrap;
}

.round-strip.lg {
    gap: 6px;
}

.round-dot {
    position: relative;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(148, 163, 184, .12);
    border: 1px solid var(--lg-line-strong);
}

.round-strip.lg .round-dot {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
    border-radius: 9px;
    color: var(--lg-muted);
}

.round-dot.correct {
    background: var(--lg-emerald);
    border-color: var(--lg-emerald);
    color: #04140f;
}

.round-dot.wrong {
    background: rgba(255, 77, 109, .18);
    border-color: rgba(255, 77, 109, .75);
    color: #ff8098;
}

.round-dot.missed {
    background: rgba(255, 77, 109, .1);
    border-color: rgba(255, 77, 109, .4);
    color: rgba(255, 128, 152, .8);
}

.round-dot.missed::after {
    content: "";
    position: absolute;
    inset-inline: 22%;
    top: 50%;
    height: 1.5px;
    transform: translateY(-50%);
    background: rgba(255, 128, 152, .75);
    border-radius: 2px;
}

.round-strip.lg .round-dot.missed::after {
    display: none;
}

.round-dot.today {
    background: rgba(0, 153, 255, .2);
    border-color: var(--lg-blue);
    color: #6cc2ff;
    box-shadow: 0 0 0 3px rgba(0, 153, 255, .16);
    animation: lg-pulse 1.8s ease-in-out infinite;
}

.round-dot.upcoming {
    background: transparent;
    border-color: var(--lg-line-strong);
}

@keyframes lg-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(0, 153, 255, .16); }
    50%      { box-shadow: 0 0 0 6px rgba(0, 153, 255, .05); }
}

@media (prefers-reduced-motion: reduce) {
    .round-dot.today { animation: none; }
}

.round-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: .75rem;
    color: var(--lg-muted);
}

.round-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.round-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ---------- كارت الدوري ---------- */

.league-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 20px;
}

.league-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--lg-card);
    border: 1px solid var(--lg-line);
    border-radius: var(--lg-radius);
    box-shadow: var(--lg-shadow);
    transition: .28s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.league-card:hover {
    color: inherit;
    border-color: var(--lg-emerald);
    transform: translateY(-5px);
}

.league-card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(150deg, #10333f, #0a0e27);
}

.league-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: .4s ease;
}

.league-card:hover .league-card-cover img {
    transform: scale(1.05);
}

.league-card-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(2, 4, 9, .1) 0%, rgba(2, 4, 9, .72) 100%);
}

.league-card-cover .lg-badge {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    z-index: 2;
    backdrop-filter: blur(12px);
}

.league-card-cover .lg-badge.official {
    inset-inline-end: auto;
    inset-inline-start: 12px;
}

.league-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    padding: 16px 18px 18px;
}

.league-card-body h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--lg-text);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.league-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: .78rem;
    color: var(--lg-muted);
    font-weight: 600;
}

.league-card-meta i {
    margin-inline-end: 5px;
    color: var(--lg-primary);
}

.league-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--lg-line);
}

.league-card-rank {
    font-size: .78rem;
    font-weight: 800;
    color: var(--lg-emerald);
}

.league-card-alert {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .76rem;
    font-weight: 700;
    color: #6cc2ff;
}

.league-card-alert .pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lg-blue);
    animation: lg-pulse 1.6s ease-in-out infinite;
}

/* ---------- صف الدوري المنتهي ---------- */

.league-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: var(--lg-card);
    border: 1px solid var(--lg-line);
    border-radius: 18px;
    text-decoration: none;
    color: inherit;
    transition: .22s ease;
}

.league-row:hover {
    color: inherit;
    border-color: var(--lg-emerald);
    transform: translateX(-4px);
}

.league-row-thumb {
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    border-radius: 14px;
    object-fit: cover;
    background: rgba(148, 163, 184, .12);
}

.league-row-info {
    flex: 1;
    min-width: 0;
}

.league-row-info b {
    display: block;
    font-size: .92rem;
    color: var(--lg-text);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.league-row-info span {
    font-size: .78rem;
    color: var(--lg-muted);
}

.league-row-rank {
    flex: 0 0 auto;
    text-align: center;
}

.league-row-rank strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--lg-emerald);
}

.league-row-rank small {
    font-size: .68rem;
    color: var(--lg-muted);
}

/* ---------- بطاقات المحتوى ---------- */

.lg-panel {
    background: var(--lg-card);
    border: 1px solid var(--lg-line);
    border-radius: var(--lg-radius);
    box-shadow: var(--lg-shadow);
    overflow: hidden;
}

.lg-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--lg-line);
}

.lg-panel-head h2,
.lg-panel-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--lg-text);
}

.lg-panel-head a {
    font-size: .82rem;
    font-weight: 700;
    color: var(--lg-primary);
    text-decoration: none;
}

.lg-panel-body {
    padding: 20px 22px;
}

/* ---------- صفحة الدوري ---------- */

.league-detail-cover {
    position: relative;
    border-radius: var(--lg-radius);
    overflow: hidden;
    aspect-ratio: 21 / 9;
    min-height: 190px;
    box-shadow: var(--lg-shadow);
}

.league-detail-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.league-detail-cover .overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
    padding: 22px;
    background: linear-gradient(180deg, rgba(2, 4, 9, .15) 0%, rgba(2, 4, 9, .88) 100%);
}

.league-detail-cover h1 {
    margin: 0;
    font-size: clamp(1.3rem, 3.2vw, 1.9rem);
    font-weight: 800;
    color: #fff;
}

.league-detail-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.league-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.league-stat {
    padding: 14px 16px;
    background: var(--lg-card-soft);
    border: 1px solid var(--lg-line);
    border-radius: 16px;
}

.league-stat span {
    display: block;
    font-size: .74rem;
    font-weight: 700;
    color: var(--lg-muted);
    margin-bottom: 6px;
}

.league-stat strong {
    /* font-size: 1.05rem; */
    font-weight: 900;
    color: var(--lg-text);
}

.league-stat strong.accent {
    color: var(--lg-emerald);
}

.league-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.8;
}

.league-note i {
    margin-top: 3px;
}

.league-note.info {
    color: #27a5ff;
    background: rgba(0, 153, 255, .1);
    border: 1px solid rgba(0, 153, 255, .28);
}

.league-note.warn {
    color: #e29045;
    background: rgba(212, 115, 41, .1);
    border: 1px solid rgba(212, 115, 41, .3);
}

.league-note.danger {
    color: #ff8098;
    background: rgba(255, 77, 109, .1);
    border: 1px solid rgba(255, 77, 109, .3);
}

.league-note.success {
    color: #12c79c;
    background: rgba(0, 204, 153, .1);
    border: 1px solid rgba(0, 204, 153, .3);
}

/* ---------- العدّاد التنازلي ---------- */

.league-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    direction: ltr;
}

.league-countdown .unit {
    min-width: 62px;
    padding: 10px 6px;
    text-align: center;
    background: var(--lg-card-soft);
    border: 1px solid var(--lg-line);
    border-radius: 14px;
}

.league-countdown .unit b {
    display: block;
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--lg-text);
    font-variant-numeric: tabular-nums;
}

.league-countdown .unit small {
    font-size: .66rem;
    color: var(--lg-muted);
    font-weight: 700;
}

/* ---------- سؤال اليوم ---------- */

.league-question {
    text-align: center;
}

.league-question-day {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    margin-bottom: 16px;
    border-radius: 100px;
    background: rgba(0, 153, 255, .12);
    border: 1px solid rgba(0, 153, 255, .3);
    color: #6cc2ff;
    font-size: .8rem;
    font-weight: 800;
}

.league-question-text {
    margin: 0 0 8px;
    font-size: clamp(1.1rem, 2.6vw, 1.4rem);
    font-weight: 700;
    line-height: 1.75;
    color: var(--lg-text);
}

.league-question-image {
    max-width: 100%;
    max-height: 240px;
    border-radius: 18px;
    margin: 14px auto 4px;
    display: block;
    object-fit: cover;
}

.league-choices {
    display: grid;
    gap: 12px;
    margin-top: 22px;
    text-align: start;
}

.league-choice {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: var(--lg-card-soft);
    border: 1px solid var(--lg-line-strong);
    border-radius: 16px;
    color: var(--lg-text);
    font-size: .95rem;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
    transition: .2s ease;
}

.league-choice:hover:not(:disabled) {
    border-color: var(--lg-primary);
    background: rgba(0, 212, 170, .08);
    transform: translateY(-2px);
}

.league-choice:disabled {
    cursor: default;
}

.league-choice .key {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(148, 163, 184, .16);
    color: var(--lg-muted);
    font-weight: 900;
    font-size: .82rem;
}

.league-choice .mark {
    margin-inline-start: auto;
    font-size: 1.05rem;
    opacity: 0;
}

.league-choice.correct {
    border-color: var(--lg-emerald);
    background: rgba(0, 204, 153, .14);
    color: #12c79c;
}

.league-choice.correct .key {
    background: var(--lg-emerald);
    color: #04140f;
}

.league-choice.correct .mark {
    opacity: 1;
    color: var(--lg-emerald);
}

.league-choice.wrong {
    border-color: rgba(255, 77, 109, .6);
    background: rgba(255, 77, 109, .12);
    color: #ff8098;
}

.league-choice.wrong .key {
    background: rgba(255, 77, 109, .7);
    color: #fff;
}

.league-choice.wrong .mark {
    opacity: 1;
    color: #ff8098;
}

.league-choice.dimmed {
    opacity: .45;
}

.league-feedback {
    display: none;
    margin-top: 20px;
    padding: 18px;
    border-radius: 18px;
    text-align: center;
}

.league-feedback.show {
    display: block;
    animation: lg-rise .35s ease;
}

@keyframes lg-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.league-feedback h4 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 800;
}

.league-feedback p {
    margin: 0;
    font-size: .88rem;
    color: var(--lg-text-2);
}

.league-feedback.correct {
    background: rgba(0, 204, 153, .12);
    border: 1px solid rgba(0, 204, 153, .35);
}

.league-feedback.correct h4 { color: #12c79c; }

.league-feedback.wrong {
    background: rgba(255, 77, 109, .1);
    border: 1px solid rgba(255, 77, 109, .32);
}

.league-feedback.wrong h4 { color: #ff8098; }

/* ---------- الترتيب ---------- */

.league-standings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.standing-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--lg-card-soft);
    border: 1px solid var(--lg-line);
    border-radius: 14px;
}

.standing-row.me {
    border-color: rgba(0, 204, 153, .5);
    background: rgba(0, 204, 153, .09);
}

.standing-row.sticky-me {
    position: sticky;
    bottom: 0;
    z-index: 3;
    box-shadow: 0 -12px 26px rgba(0, 0, 0, .35);
    background: var(--lg-card);
}

.standing-rank {
    flex: 0 0 auto;
    width: 30px;
    text-align: center;
    font-weight: 900;
    font-size: .85rem;
    color: var(--lg-muted);
    font-variant-numeric: tabular-nums;
}

.standing-row.me .standing-rank {
    color: var(--lg-emerald);
}

.standing-rank.medal-1 { color: #f5a623; }
.standing-rank.medal-2 { color: #cbd5e1; }
.standing-rank.medal-3 { color: #d98244; }

body.light-mode .standing-rank.medal-2 { color: #6b7688; }

.standing-avatar {
    display: none;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 13px;
    /* display: grid; */
    place-items: center;
    font-size: .78rem;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--lg-emerald), var(--lg-blue));
}

.standing-name {
    flex: 1;
    min-width: 0;
    font-size: .88rem;
    font-weight: 700;
    color: var(--lg-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.standing-points {
    flex: 0 0 auto;
    font-size: .82rem;
    font-weight: 900;
    color: var(--lg-emerald);
    font-variant-numeric: tabular-nums;
}

/* ---------- منصة التتويج ---------- */

.league-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin: 26px 0 10px;
}

.league-podium .p-item {
    flex: 1 1 0;
    max-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.league-podium .p-crown {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    border-radius: 20px;
    color: #00d2a0;
    font-size: 1.4rem;
    border: 2px solid rgba(0, 204, 153, 1);
    box-shadow: 0 0 16px 2px rgba(0, 153, 255, .3) inset;
    filter: drop-shadow(0 0 8px rgba(0, 210, 160, .5));
}

.league-podium .p-badge {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    border-radius: 16px;
    font-weight: 900;
    color: #fff;
    background: rgba(100, 116, 139, .15);
    border: 2px solid rgba(203, 213, 225, .5);
}

.league-podium .p-badge.bronze {
    background: rgba(180, 83, 9, .15);
    border-color: rgba(245, 158, 11, .5);
}

.league-podium .p-name {
    font-size: .85rem;
    font-weight: 800;
    color: var(--lg-text);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.league-podium .p-score {
    padding: 5px 14px;
    margin-bottom: 10px;
    border-radius: 20px;
    font-size: .76rem;
    font-weight: 800;
    color: var(--lg-text);
    background: rgba(100, 116, 139, .15);
    border: 1px solid rgba(203, 213, 225, .2);
}

.league-podium .p-score.green {
    color: #00d2a0;
    background: rgba(0, 204, 153, .2);
    border-color: rgba(0, 204, 153, .4);
    box-shadow: 0 0 18px rgba(0, 153, 255, .3);
}

.league-podium .p-block {
    width: 100%;
    border-radius: 12px 12px 0 0;
}

.league-podium .p-block.rank-1 {
    height: 128px;
    background: linear-gradient(180deg, #00d2a033 0%, #00d2a000 100%);
    border-top: 4px solid #00d2a0;
}

.league-podium .p-block.rank-2 {
    height: 96px;
    background: linear-gradient(180deg, #ffffff1a 0%, #ffffff00 100%);
    border-top: 4px solid #ffffff4d;
}

.league-podium .p-block.rank-3 {
    height: 72px;
    background: linear-gradient(180deg, #ff950033 0%, #ff950000 100%);
    border-top: 4px solid #ff9500;
}

/* ---------- بطاقة المشاركة ---------- */

.league-share {
    text-align: center;
}

.league-share-qr {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border-radius: 20px;
    line-height: 0;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .3);
}

.league-share-qr img {
    width: 168px;
    height: 168px;
    display: block;
}

.league-share-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding: 12px 16px;
    background: var(--lg-card-soft);
    border: 1px dashed var(--lg-line-strong);
    border-radius: 16px;
}

.league-share-code span {
    font-size: .76rem;
    font-weight: 700;
    color: var(--lg-muted);
}

.league-share-code b {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: .18em;
    color: var(--lg-emerald);
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

.league-share-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--lg-card-soft);
    border: 1px solid var(--lg-line);
    border-radius: 14px;
}

.league-share-link input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--lg-text-2);
    font-size: .8rem;
    direction: ltr;
    text-align: left;
}

/* ---------- الحالة الفارغة ---------- */

.league-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 54px 24px;
    text-align: center;
    background: var(--lg-card);
    border: 1px dashed var(--lg-line-strong);
    border-radius: var(--lg-radius);
}

.league-empty i {
    font-size: 1.4rem;
    /* color: var(--lg-primary); */
    opacity: .8;
}

.league-empty h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--lg-text);
}

.league-empty p {
    margin: 0;
    max-width: 420px;
    font-size: .88rem;
    color: var(--lg-muted);
    line-height: 1.9;
}

/* ---------- خطوات الإنشاء ---------- */

.lg-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.lg-step {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: .45;
}

.lg-step.active {
    opacity: 1;
}

.lg-step-num {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: .9rem;
    color: var(--lg-primary);
    background: rgba(0, 212, 170, .14);
    border: 2px solid var(--lg-primary);
}

.lg-step.active .lg-step-num {
    color: #04140f;
    background: var(--lg-primary);
    box-shadow: 0 0 18px rgba(0, 212, 170, .3);
}

.lg-step-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--lg-text-2);
}

.lg-step-sep {
    width: 34px;
    height: 2px;
    background: var(--lg-line-strong);
}

/* ---------- النماذج ---------- */

.lg-field {
    margin-bottom: 18px;
}

.lg-field > label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--lg-text);
}

.lg-field .hint {
    font-size: .75rem;
    font-weight: 500;
    color: var(--lg-muted);
    margin-top: 6px;
    display: block;
}

/* ---------- تلميح وصف الفئة (Create.cshtml) ---------- */

.lg-category-tip {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--lg-card-soft);
    border: 1px solid var(--lg-line);
    border-radius: 12px;
    font-size: .82rem;
    line-height: 1.6;
    color: var(--lg-text-2);
    animation: lg-category-tip-in .18s ease;
}

.lg-category-tip i {
    flex: none;
    margin-top: 2px;
    color: var(--lg-primary);
    font-size: .8rem;
}

@keyframes lg-category-tip-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.lg-input,
.lg-select,
.lg-textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    background: rgba(10, 10, 16, .55);
    border: 1px solid var(--lg-line-strong);
    border-radius: 14px;
    color: var(--lg-text);
    font-size: .92rem;
    font-family: inherit;
    transition: .2s ease;
}

body.light-mode .lg-input,
body.light-mode .lg-select,
body.light-mode .lg-textarea {
    background: #fff;
}

.lg-input:focus,
.lg-select:focus,
.lg-textarea:focus {
    outline: 0;
    border-color: var(--lg-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, .14);
}

.lg-input::placeholder,
.lg-textarea::placeholder {
    color: var(--lg-muted);
}

.lg-textarea {
    min-height: 96px;
    resize: vertical;
}

.lg-error {
    display: block;
    margin-top: 6px;
    font-size: .78rem;
    font-weight: 600;
    color: #ff8098;
}

.lg-toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.lg-toggle {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--lg-card-soft);
    border: 1px solid var(--lg-line-strong);
    border-radius: 16px;
    cursor: pointer;
    transition: .2s ease;
}

.lg-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lg-toggle b {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--lg-text);
}

.lg-toggle small {
    font-size: .74rem;
    color: var(--lg-muted);
    line-height: 1.7;
}

.lg-toggle:has(input:checked) {
    border-color: var(--lg-emerald);
    background: rgba(0, 204, 153, .1);
}

.lg-toggle:has(input:checked) b {
    color: var(--lg-emerald);
}

/* ---------- بنّاء الأسئلة ---------- */

.lg-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.lg-progress-bar {
    flex: 1;
    height: 8px;
    border-radius: 100px;
    background: rgba(148, 163, 184, .18);
    overflow: hidden;
}

.lg-progress-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--lg-emerald), var(--lg-blue));
    transition: width .3s ease;
}

.lg-progress b {
    font-size: .82rem;
    font-weight: 800;
    color: var(--lg-text-2);
    white-space: nowrap;
}

.lg-day-card {
    border: 1px solid var(--lg-line);
    border-radius: 18px;
    background: var(--lg-card-soft);
    margin-bottom: 12px;
    overflow: hidden;
}

.lg-day-card.done {
    border-color: rgba(0, 204, 153, .4);
}

.lg-day-head {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: start;
    color: var(--lg-text);
}

.lg-day-head .n {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(148, 163, 184, .16);
    color: var(--lg-muted);
    font-weight: 900;
    font-size: .8rem;
    flex: 0 0 auto;
}

.lg-day-card.done .lg-day-head .n {
    background: var(--lg-emerald);
    color: #04140f;
}

.lg-day-head .t {
    flex: 1;
    min-width: 0;
    font-size: .88rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lg-day-head .d {
    font-size: .74rem;
    color: var(--lg-muted);
    font-weight: 600;
    white-space: nowrap;
}

.lg-day-body {
    display: none;
    padding: 4px 18px 18px;
    border-top: 1px solid var(--lg-line);
}

.lg-day-card.open .lg-day-body {
    display: block;
}

.lg-choice-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.lg-choice-input .pick {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--lg-line-strong);
    background: transparent;
    color: var(--lg-muted);
    cursor: pointer;
    transition: .2s ease;
}

.lg-choice-input .pick:hover {
    border-color: var(--lg-emerald);
    color: var(--lg-emerald);
}

.lg-choice-input .pick.selected {
    background: var(--lg-emerald);
    border-color: var(--lg-emerald);
    color: #04140f;
}

/* ---------- شريط المعاينة ---------- */

.demo-bar {
    /* position: fixed; */
    inset-inline: 0;
    bottom: 0;
    z-index: 1040;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(8, 11, 18, .93);
    border-top: 1px solid rgba(0, 212, 170, .3);
    backdrop-filter: blur(12px);
    font-size: .78rem;
    color: #94a3b8;
}

body.light-mode .demo-bar {
    background: rgba(255, 255, 255, .95);
    color: #64748b;
}

.demo-bar .tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    background: rgba(0, 212, 170, .14);
    color: #00d4aa;
    font-weight: 800;
}

.demo-bar form {
    margin: 0;
}

.demo-bar button {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, .3);
    background: transparent;
    color: inherit;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.demo-bar button:hover {
    border-color: #00d4aa;
    color: #00d4aa;
}

/* ---------- نافذة مشاركة الدوري (شاشة الإدارة) ---------- */

.league-share-modal .modal-content {
    background: #101720;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 24px;
    color: #f4f7fb;
}

body.light-mode .league-share-modal .modal-content {
    background: #fff;
    color: #16202e;
}

.league-share-modal .modal-header {
    border-bottom: 0;
    padding: 18px 18px 0;
}

.league-share-modal .modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.league-share-modal .modal-body {
    padding: 10px 26px 30px;
}

/* ---------- نافذة تسجيل الدخول للزائر ---------- */

.league-login-modal .modal-content {
    background: #101720;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 24px;
    color: #f4f7fb;
}

body.light-mode .league-login-modal .modal-content {
    background: #fff;
    color: #16202e;
}

.league-login-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 0;
}

.league-login-modal .modal-body {
    padding: 10px 26px 30px;
}

.league-auth-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    margin: auto;
    position: relative;
    left: -18px;
}

body.light-mode .league-auth-tabs {
    background: rgba(15, 23, 42, .04);
    border-color: rgba(15, 23, 42, .08);
}

.league-auth-tab {
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: .82rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 9px;
    cursor: pointer;
    transition: .2s ease;
}

.league-auth-tab.active {
    background: #00d4aa;
    color: #04140f;
}

.league-auth-tab:not(.active):hover {
    color: #f4f7fb;
}

body.light-mode .league-auth-tab:not(.active):hover {
    color: #16202e;
}

.league-auth-pane form {
    text-align: initial;
}

/* Bootstrap's .modal is z-index 1055. select2 ships with no z-index of its own, so the
   open dropdown it appends inside the modal (via dropdownParent) has no explicit stacking
   above the modal's own layers — it renders in the DOM with correct markup but ends up
   with no usable size/visibility. Force it above the modal explicitly, same fix pattern
   already used for .swal2-container vs .lg-modal below. */
.select2-container--open {
    z-index: 1065;
}

.league-login-head {
    text-align: center;
    margin-bottom: 18px;
}

.league-login-head i {
    font-size: 1.7rem;
    color: #00d4aa;
    margin-bottom: 8px;
    display: block;
}

.league-login-head p {
    margin: 0;
    font-size: .85rem;
    color: #7d8a99;
    line-height: 1.8;
}

.league-login-head b {
    color: #00d4aa;
}

/* ---------- تجاوب ---------- */

@media (max-width: 991px) {
    .league-page {
        padding: 100px 0 90px;
    }
}

@media (max-width: 767px) {
    .league-page {
        padding: 92px 0 96px;
    }

    .league-grid {
        grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
        gap: 14px;
    }

    .league-card-body {
        padding: 12px 13px 14px;
        gap: 8px;
    }

    .league-card-body h3 {
        font-size: .88rem;
    }

    .league-card-meta {
        font-size: .72rem;
    }

    .lg-panel-body {
        padding: 16px;
    }

    .lg-panel-head {
        padding: 15px 16px;
    }

    .league-detail-cover .overlay {
        padding: 16px;
    }

    .league-podium .p-block.rank-1 { height: 96px; }
    .league-podium .p-block.rank-2 { height: 72px; }
    .league-podium .p-block.rank-3 { height: 54px; }

    .league-podium .p-crown { width: 46px; height: 46px; font-size: 1.1rem; }
    .league-podium .p-badge { width: 34px; height: 34px; font-size: .8rem; }
    .league-podium .p-name  { font-size: .74rem; }
    .league-podium .p-score { font-size: .68rem; padding: 4px 10px; }

    .lg-toggle-group {
        grid-template-columns: 1fr;
    }

    .lg-step-label {
        display: none;
    }

    .lg-step-sep {
        width: 20px;
    }
}

@media (max-width: 420px) {
    .league-grid {
        grid-template-columns: 1fr;
    }

    .league-share-qr img {
        width: 140px;
        height: 140px;
    }
    .lg-btn {
        font-size: .8rem;
    }
}

/* Narrow phones: the hero's title row and its two action buttons wrap onto
   separate lines (see .league-hero's flex-wrap) - without this, the wrapped
   actions row stretches to the hero's full flex width with each button
   sharing it evenly, reading as two oversized, unevenly-spaced blocks
   instead of a compact button pair. Stack title above actions explicitly,
   size both down a notch, and let the actions hug their own content. */
@media (max-width: 480px) {
    .league-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .league-hero h1 {
        font-size: 1.35rem;
    }

    .league-hero p {
        font-size: .82rem;
    }

    .league-hero .lg-badge {
        font-size: .68rem;
        padding: 5px 11px;
    }

    .league-hero-actions {
        justify-content: flex-start;
    }

    .league-hero-actions .lg-btn {
        flex: 0 1 auto;
        min-height: 38px;
        padding: 0 14px;
        font-size: .8rem;
    }
}
