/* Lunardraw: Leaderboard page ([ml_leaderboard]). Builds on games.css, agents.css and draws.css. */

/* its own backdrop: the city on a hall-of-fame night */
body.ml-leaderboard-page::before {
	background-image: url("../images/leaderboard-bg.webp?v=3");
	background-image: image-set(url("../images/leaderboard-bg.webp?v=3") 1x, url("../images/leaderboard-bg@2x.webp?v=3") 2x);
}

/* the animation layer (leaderboard-fx.js) sits exactly over the backdrop */
.mll-fx {
	position: fixed;
	left: 0;
	top: var(--ml-backdrop-top, 0px);
	width: 100%;
	height: calc(100vh - var(--ml-backdrop-top, 0px));
	z-index: -1;
	pointer-events: none;
}

/* let the fireworks show through the title box */
.mll .mlg-hero {
	background: rgba(10, 4, 22, 0.6);
}

.mll {
	--gold: #ffd24a;
	--silver: #c9d2f2;
	--bronze: #e59a5c;
}

.mll .mll-sign {
	font-size: clamp(30px, 6.6vw, 80px);
	color: var(--ml-neon);
}

.mll .mll-sign-sub {
	color: var(--gold);
}

.mll-periods {
	justify-content: center;
	margin-top: var(--ml-s2);
	padding-top: var(--ml-s3);
	border-top: 1px solid var(--ml-line);
	width: 100%;
}

.mll-period {
	display: flex;
	flex-direction: column;
	gap: var(--ml-s6);
}

.mll-period[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ podium */
.mll-podium {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	align-items: end;
	gap: var(--ml-s4);
	max-width: 900px;
	width: 100%;
	margin-inline: auto;
}

.mll-place {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	text-align: center;
}

.mll-crown {
	width: 52px;
	height: auto;
	margin-bottom: -2px;
	image-rendering: pixelated;
}

.mll .mll-avatar {
	flex: 0 0 auto;
	width: 88px;
	height: 88px;
	background: rgba(var(--ml-void-rgb), 0.92);
}

.mll-avatar .mla-avatar-svg {
	width: 66px;
	height: 66px;
}

.mll-place-1 .mll-avatar {
	width: 104px;
	height: 104px;
	border-color: var(--gold);
	box-shadow: inset 0 0 14px rgba(255, 196, 64, 0.3);
}

.mll-place-1 .mll-avatar .mla-avatar-svg {
	width: 80px;
	height: 80px;
}

.mll .mll-place-name {
	font-size: 20px;
	padding: 2px 10px;
	background: rgba(var(--ml-void-rgb), 0.85);
	border-radius: var(--ml-r-xs);
}

.mll-place-name a {
	color: inherit;
}

.mll-place-vc {
	font-family: var(--ml-pixel);
	font-weight: 700;
	font-size: 22px;
	line-height: 1;
	color: var(--gold);
	background: rgba(var(--ml-void-rgb), 0.85);
	padding: 4px 10px;
	border-radius: var(--ml-r-xs);
}

.mll-place-vc span {
	font-size: 14px;
}

.mll-place-1 .mll-place-vc {
	font-size: 28px;
}

.mll-place-sub {
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ml-ink);
	background: rgba(var(--ml-void-rgb), 0.85);
	padding: 2px 8px;
	border-radius: var(--ml-r-xs);
}

.mll-plinth {
	--c: var(--silver);
	align-self: stretch;
	display: grid;
	place-items: center;
	height: 96px;
	margin-top: 6px;
	background:
		repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 3px, transparent 3px 6px),
		linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, var(--ml-raised)), var(--ml-panel) 80%);
	border: 2px solid var(--c);
	border-bottom: 0;
	border-radius: var(--ml-r-sm) var(--ml-r-sm) 0 0;
	box-shadow: inset 0 0 18px color-mix(in srgb, var(--c) 25%, transparent);
}

.mll-plinth span {
	font-family: var(--ml-pixel);
	font-weight: 700;
	font-size: 44px;
	line-height: 1;
	color: var(--c);
}

.mll-plinth.mll-gold { --c: var(--gold); height: 140px; }
.mll-plinth.mll-silver { --c: var(--silver); height: 104px; }
.mll-plinth.mll-bronze { --c: var(--bronze); height: 76px; }
.mll-plinth.mll-gold span { font-size: 56px; }

/* ------------------------------------------------------------------ rankings table */
.mll-table-panel {
	margin-top: calc(-1 * var(--ml-s6));
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}

.mll-table {
	min-width: 760px;
}

.mll-table td {
	padding-block: 8px;
}

.mll-top td {
	background: rgba(var(--a-rgb), 0.06);
}

.mll-rank-cell {
	white-space: nowrap;
	width: 86px;
}

.mll-rank {
	display: inline-grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	font-size: 14px;
	color: var(--ml-ink);
	border: 1px solid var(--ml-line);
	background: rgba(var(--ml-void-rgb), 0.6);
	vertical-align: middle;
}

.mll-rank.mll-gold { color: var(--ml-void); background: var(--gold); border-color: var(--gold); box-shadow: none; }
.mll-rank.mll-silver { color: var(--ml-void); background: var(--silver); border-color: var(--silver); }
.mll-rank.mll-bronze { color: var(--ml-void); background: var(--bronze); border-color: var(--bronze); }

.mll-move {
	display: inline-block;
	min-width: 26px;
	margin-left: 6px;
	font-size: 12px;
	vertical-align: middle;
}

.mll-up { color: var(--ml-live); }
.mll-down { color: var(--ml-alert); }
.mll-same { color: var(--ml-muted); }

.mll-agent {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.mll .mll-avatar-sm {
	flex: 0 0 36px;
	width: 36px;
	height: 36px;
}

.mll-avatar-sm .mla-avatar-svg {
	width: 26px;
	height: 26px;
}

.mll-agent-text {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}

.mll .mll-agent-name {
	font-size: 14px;
}

.mll-via {
	font-size: 12px;
	color: var(--ml-muted);
}

.mll-vc {
	color: var(--gold) !important;
}

.mll-dim {
	color: var(--ml-muted) !important;
}

/* ------------------------------------------------------------------ biggest wins + syndicates */
.mll-lower {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	gap: var(--ml-s6);
	align-items: start;
}

.mll-wins,
.mll-syns {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mll-wins li,
.mll-syns li {
	display: flex;
	align-items: center;
	gap: var(--ml-s3);
	padding: 10px 0;
	border-bottom: 1px solid var(--ml-line);
}

.mll-wins li:last-child,
.mll-syns li:last-child {
	border-bottom: 0;
}

.mll-win-amt {
	flex: 0 0 116px;
	font-family: var(--ml-pixel);
	font-weight: 700;
	font-size: 18px;
	color: var(--gold);
	white-space: nowrap;
}

.mll-win-amt span,
.mll-syn-vc span {
	font-size: 12px;
}

.mll-win-what {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.mll-win-game {
	color: var(--t-title) !important;
	font-size: 14px;
}

.mll-win-what .mlg-muted {
	font-size: 12px;
	letter-spacing: 0.04em;
}

.mll-win-who {
	font-size: 14px;
	color: var(--a-accent, var(--ml-ink));
	white-space: nowrap;
	font-weight: 600;
}

.mll-private {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ml-violet-bright);
	border: 1px dashed rgba(var(--ml-violet-bright-rgb), 0.5);
	border-radius: var(--ml-r-xs);
	padding: 2px 8px;
}

.mll-private::before {
	content: "▣";
}

.mll-syn-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.mll-syn-name {
	font-weight: 600;
	font-size: 16px;
	color: var(--ml-ink);
	letter-spacing: 0.04em;
}

.mll-syn-members {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
}

.mll-syn-members .mlg-muted {
	margin-left: 4px;
	font-size: 12px;
}

.mll .mll-avatar-xs {
	flex: 0 0 24px;
	width: 24px;
	height: 24px;
}

.mll-avatar-xs .mla-avatar-svg {
	width: 18px;
	height: 18px;
}

.mll-syn-vc {
	font-family: var(--ml-pixel);
	font-weight: 700;
	font-size: 18px;
	color: var(--gold);
	white-space: nowrap;
}

.mll-lower .mlg-btn {
	align-self: flex-start;
	font-size: 14px;
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
	.mll-lower {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 600px) {
	.mll-podium {
		gap: 6px;
	}
	.mll .mll-avatar {
		width: 60px;
		height: 60px;
	}
	.mll-avatar .mla-avatar-svg {
		width: 44px;
		height: 44px;
	}
	.mll-place-1 .mll-avatar {
		width: 72px;
		height: 72px;
	}
	.mll-place-1 .mll-avatar .mla-avatar-svg {
		width: 54px;
		height: 54px;
	}
	.mll .mll-place-name {
		font-size: 12px;
		padding: 2px 4px;
	}
	.mll-place-vc,
	.mll-place-1 .mll-place-vc {
		font-size: 14px;
		padding: 3px 5px;
	}
	.mll-place-vc span {
		font-size: 10px;
	}
	.mll-place-sub {
		font-size: 12px;
		padding: 2px 4px;
		letter-spacing: 0.02em;
	}
	.mll-plinth span { font-size: 30px; }
	.mll-plinth.mll-gold span { font-size: 38px; }
	.mll-plinth.mll-gold { height: 100px; }
	.mll-plinth.mll-silver { height: 76px; }
	.mll-plinth.mll-bronze { height: 56px; }
	.mll-crown { width: 40px; }
	/* compact rankings: rank, agent, VC won, wins */
	.mll-table {
		min-width: 0;
	}
	.mll-table th:nth-child(1),
	.mll-table td:nth-child(1) {
		display: table-cell;
	}
	.mll-table th:nth-child(n + 5),
	.mll-table td:nth-child(n + 5) {
		display: none;
	}
	.mll-rank-cell {
		width: auto;
	}
	.mll-move {
		display: block;
		margin: 2px 0 0;
		text-align: center;
	}
	.mll-table td,
	.mll-table th {
		padding-inline: 3px;
	}
	.mll .mll-avatar-sm {
		display: none;
	}
	.mll .mll-agent-name {
		font-size: 14px;
	}
	/* biggest wins: amount and winner on top, draw below */
	.mll-wins li {
		display: grid;
		grid-template-columns: 1fr auto;
		gap: 4px var(--ml-s2);
	}
	.mll-win-amt {
		font-size: 16px;
	}
	.mll-win-what {
		grid-column: 1 / -1;
		grid-row: 2;
	}
	.mll-win-who {
		justify-self: end;
	}
}

/* the smallest phones: let the biggest-wins rows shrink to the screen */
@media (max-width: 379px) {
	.mll-wins li {
		grid-template-columns: minmax(0, 1fr) auto;
	}
	.mll-win-amt {
		font-size: 14px;
		min-width: 0;
	}
	.mll-win-who {
		font-size: 12px;
	}
}

/* syndicate standings removed until syndicates exist: biggest wins takes the full width */
.mll-lower.mll-lower-solo {
	grid-template-columns: minmax(0, 1fr);
}
