/*
   The stats popup (and the stats under the winner): the table, a game's heatmap,
   its tall layout.
   Loaded in order with the others (see index.html): a later rule wins. */

/* Match stats (also under the winner): one column per player, each line's
   leader in green. Many players scroll sideways. */
.stats-section {
	width: auto;
	min-width: 40%;
	max-width: 90%;
}

/* Tall (a game's heatmap, lifetime trends): centred in what's clear of a phone's
   status bar and home bar, not the whole screen, so its top isn't under them.
   Down to the screen's bottom where an installed iPhone app lays the page out
   a status bar short of it (--page-short, js/theme-early.js). */
#stats {
	bottom: calc(-1 * var(--page-short, 0px));
	box-sizing: border-box;
	padding-top: env(safe-area-inset-top);
	padding-bottom: env(safe-area-inset-bottom);
}

.stats-scroll {
	overflow-x: auto;
	scrollbar-width: none;
}

.stats-tbl {
	margin: calc(1 * var(--m)) auto calc(1.5 * var(--m));
	border-collapse: collapse;
	font-family: var(--font-condensed);
	font-size: calc(2.6 * var(--m));
	color: var(--text);
	font-variant-numeric: tabular-nums;
}

.stats-tbl :is(th, td) {
	padding: calc(0.5 * var(--m)) calc(1.6 * var(--m));
	text-align: center;
	white-space: nowrap;
}

.stats-tbl thead th {
	max-width: calc(18 * var(--m));
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 600;
	border-bottom: 1px solid var(--text-muted);
}

.stats-tbl tbody th {
	text-align: left;
	font-weight: normal;
	color: var(--text-soft);
}

/* A player linked to a profile: a ring before the name, as on the cards. */
.stats-tbl thead th.linked::before {
	content: "";
	display: inline-block;
	width: 0.7em;
	height: 0.7em;
	margin-right: 0.3em;
	border: 2px solid var(--checkout);
	border-radius: 50%;
	vertical-align: -0.05em;
}

/* Too many players for the width: it scrolls sideways, and the edge fades
   where there's more (JS sets the classes: watchSideways). */
.stats-scroll.more-right {
	mask-image: linear-gradient(to left, transparent, black calc(6 * var(--m)));
}

.stats-scroll.more-left {
	mask-image: linear-gradient(to right, transparent, black calc(6 * var(--m)));
}

.stats-scroll.more-left.more-right {
	mask-image: linear-gradient(to right, transparent, black calc(6 * var(--m)), black calc(100% - 6 * var(--m)), transparent);
}

.stats-tbl tbody tr + tr {
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-tbl .lead {
	color: var(--checkout);
	font-weight: 600;
}

.stats-tbl small {
	font-size: 0.8em;
	font-weight: normal;
	color: var(--text-muted);
}

.winner-section {
	width: auto;
	min-width: 40%;
	text-align: center;
}
