/* ===== چون‌این — لیگ تخته ===== */
.chonin-league {
	--cl-primary: #26678a;
	--cl-primary-dark: #1d4f6b;
	--cl-brand: #6b210f;
	--cl-accent: #c28954;
	--cl-ink: #201e1e;
	--cl-muted: #7a7370;
	--cl-border: #e7e2de;
	--cl-soft: #f5efe9;
	--cl-line: #cbc3bc;
	font-family: 'Dana', 'Vazirmatn', system-ui, -apple-system, sans-serif;
	color: var(--cl-ink);
	direction: rtl;
	max-width: 1100px;
	margin: 0 auto;
	padding: 1rem;
}

.chonin-league .cl-title {
	color: var(--cl-brand);
	font-weight: 800;
	font-size: 1.7rem;
	text-align: center;
	margin: 0.5rem 0 1.5rem;
}
.chonin-league .cl-sub {
	color: var(--cl-brand);
	font-weight: 800;
	font-size: 1.2rem;
	text-align: center;
	margin: 2rem 0 1rem;
}
.chonin-league .cl-center { text-align: center; }
.chonin-league .cl-note { color: var(--cl-muted); }
.chonin-league .cl-empty { color: var(--cl-muted); font-style: italic; }

/* ---------- ثبت‌نام ---------- */
.cl-reg {
	background: #fff;
	border: 1px solid var(--cl-border);
	border-radius: 16px;
	padding: 1.6rem;
	max-width: 560px;
	margin: 0 auto;
	text-align: center;
	box-shadow: 0 4px 18px rgba(0,0,0,0.04);
}
.cl-reg-info {
	display: flex;
	justify-content: center;
	gap: 1.5rem;
	flex-wrap: wrap;
	margin: 0.8rem 0;
	color: var(--cl-ink);
}
.cl-info-row b { color: var(--cl-brand); }

.cl-progress {
	height: 12px;
	background: var(--cl-soft);
	border-radius: 9999px;
	overflow: hidden;
	margin: 1rem 0 1.4rem;
}
.cl-progress span {
	display: block;
	height: 100%;
	background: linear-gradient(90deg, var(--cl-accent), var(--cl-primary));
	transition: width 0.4s ease;
}

.cl-btn {
	display: inline-block;
	background: var(--cl-primary);
	color: #fff;
	border: none;
	border-radius: 10px;
	font-family: inherit;
	font-weight: 800;
	font-size: 1.05rem;
	padding: 0.8rem 2rem;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s ease;
}
.cl-btn:hover { background: var(--cl-primary-dark); color: #fff; }
.cl-btn:disabled { opacity: 0.6; cursor: default; }

.cl-ok { color: #1a7f4b; font-weight: 700; font-size: 1.1rem; }
.cl-full { color: var(--cl-brand); font-weight: 700; }
.cl-msg { margin-top: 0.8rem; font-weight: 700; }
.cl-msg.ok { color: #1a7f4b; }
.cl-msg.err { color: #c0392b; }

.cl-players {
	margin-top: 1.6rem;
	text-align: right;
	border-top: 1px dashed var(--cl-border);
	padding-top: 1rem;
}
.cl-players h3 { color: var(--cl-brand); font-size: 1.05rem; margin-bottom: 0.6rem; }
.cl-players-list {
	columns: 2;
	padding-right: 1.2rem;
	color: var(--cl-ink);
}
.cl-players-list li { margin: 0.25rem 0; }

/* ---------- چارت ---------- */

/* نوار تب مرحله‌ها */
.cl-tabs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 0.4rem 0;
	margin-bottom: 0.6rem;
	-webkit-overflow-scrolling: touch;
}
.cl-tab {
	flex: 0 0 auto;
	min-height: 42px;
	padding: 0 16px;
	border-radius: 999px;
	border: 1px solid var(--cl-border);
	background: #fff;
	color: var(--cl-brand);
	font-weight: 700;
	font-size: 0.9rem;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s, color .15s, border-color .15s;
}
.cl-tab:hover { border-color: var(--cl-primary); }
.cl-tab-active {
	background: var(--cl-primary);
	color: #fff;
	border-color: var(--cl-primary);
}

.cl-bracket-wrap {
	overflow-x: auto;
	padding: 1rem 0;
	-webkit-overflow-scrolling: touch;
}
.cl-bracket {
	display: flex;
	gap: 28px;
	min-width: min-content;
	align-items: stretch;
	/* از راست به چپ: دور اول سمت راست */
	direction: rtl;
}
.cl-round {
	display: flex;
	flex-direction: column;
	min-width: 200px;
}
.cl-round-title {
	text-align: center;
	font-weight: 800;
	color: var(--cl-brand);
	margin-bottom: 0.6rem;
	font-size: 0.95rem;
	background: var(--cl-soft);
	border-radius: 8px;
	/* هم‌ارتفاع برای همه‌ی مرحله‌ها */
	min-height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.cl-round-matches {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}
/* هر خانه باند مساوی می‌گیرد ولی هیچ‌وقت کوچک‌تر از باکس نمی‌شود (جلوگیری از هم‌پوشانی) */
.cl-match-cell {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	position: relative;
	padding: 12px 0;
}
.cl-match {
	background: #fff;
	border: 1px solid var(--cl-border);
	border-radius: 10px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.04);
	position: relative;
}
/* گوشه‌های گرد روی ردیف‌ها (چون overflow:hidden را برداشتیم تا خطوط بریده نشوند) */
.cl-team:first-child { border-top-right-radius: 10px; border-top-left-radius: 10px; }
.cl-team:last-child  { border-bottom-right-radius: 10px; border-bottom-left-radius: 10px; }

/* ---------- خطوط اتصال آرنجی (الهام از براکت رفرنس) ---------- */
/* استاب افقی خروجی از وسط هر باکس به سمت پل (در RTL سمت چپ) */
.cl-round:not(:last-child) .cl-match-cell::after {
	content: '';
	position: absolute;
	left: -14px;
	top: 50%;
	width: 14px;
	height: 2px;
	background: var(--cl-line, #cfc8c2);
}
/* پل عمودی که دو بازیِ هر جفت را به هم وصل می‌کند */
.cl-round:not(:last-child) .cl-match-cell:nth-child(even)::before {
	content: '';
	position: absolute;
	left: -14px;
	bottom: 50%;
	width: 2px;
	height: 100%;
	background: var(--cl-line, #cfc8c2);
}
/* استاب افقی ورودی از پل به باکسِ دورِ بعد (سمت راست باکس) */
.cl-round:not(:first-child) .cl-match::before {
	content: '';
	position: absolute;
	right: -14px;
	top: 50%;
	width: 14px;
	height: 2px;
	background: var(--cl-line, #cfc8c2);
}

.cl-team {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.6rem 0.8rem;
	font-size: 0.95rem;
}
.cl-team:first-child { border-bottom: 1px solid var(--cl-border); }
.cl-team .cl-name { font-weight: 600; }
.cl-team .cl-score {
	font-weight: 800;
	color: var(--cl-muted);
	min-width: 20px;
	text-align: center;
}
.cl-team.cl-win {
	background: rgba(38,103,138,0.08);
}
.cl-team.cl-win .cl-name { color: var(--cl-primary); font-weight: 800; }
.cl-team.cl-win .cl-score { color: var(--cl-primary); }

/* رده‌بندی سوم */
.cl-third {
	max-width: 280px;
	margin: 1rem auto 0;
}

/* سکوی قهرمانی */
.cl-podium {
	margin-top: 2rem;
}
.cl-podium-row {
	display: flex;
	justify-content: center;
	align-items: flex-end;
	gap: 1rem;
	flex-wrap: wrap;
}
.cl-podium-item {
	background: #fff;
	border: 1px solid var(--cl-border);
	border-radius: 12px;
	padding: 1rem 1.4rem;
	text-align: center;
	min-width: 130px;
}
.cl-podium-item.cl-rank-1 { border-color: #d4af37; transform: translateY(-8px); box-shadow: 0 6px 18px rgba(212,175,55,0.25); }
.cl-podium-item.cl-rank-2 { border-color: #b0b0b0; }
.cl-podium-item.cl-rank-3 { border-color: #cd7f32; }
.cl-medal { font-size: 1rem; font-weight: 800; margin-bottom: 0.4rem; color: var(--cl-brand); }
.cl-podium-name { font-weight: 700; font-size: 1.05rem; }

/* ---------- آرشیو ---------- */
.cl-archive {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}
.cl-archive-item {
	background: #fff;
	border: 1px solid var(--cl-border);
	border-radius: 12px;
	padding: 1rem;
}
.cl-archive-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.6rem;
	color: var(--cl-brand);
}
.cl-archive-head span { color: var(--cl-muted); font-size: 0.85rem; }
.cl-archive-ranks {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	font-size: 0.95rem;
	margin-bottom: 0.8rem;
}
.cl-link {
	display: inline-block;
	color: var(--cl-primary);
	font-weight: 700;
	text-decoration: none;
}
.cl-link:hover { color: var(--cl-primary-dark); }

@media (max-width: 600px) {
	.cl-players-list { columns: 1; }
	/* در موبایل هر مرحله تقریباً تمام عرض را می‌گیرد؛ با تب‌ها بین مراحل جابه‌جا می‌شویم */
	.cl-round { min-width: 78vw; }
	.cl-tabs { position: sticky; top: 0; z-index: 5; background: var(--cl-bg, #f3f1f0); }
}
