:root {
	--logo-width: 74px;
	--logo-height: 74px;
	--logo-bg-width: 180px;
	--logo-bg-height: 125px;
	--logo-corner: 30px;

	--player-panel-width: 320px;
	--player-panel-height: 425px;
	--player-height: 400px;
	--player-corner: 60px;

	--stat-height: 38px;
	--stats-height: calc(var(--stat-height) * 5) + 8px;
	--stats-height-with-agent: calc(var(--stats-height) + var(--stat-height));

	--coach-corner: 10px;

	--match-corner: 15px;
	--map-corner: 8px;

	--team-name-width: 1400px;
}

.page-header {
	top: 100px;
	z-index: 10;
}
.teams:not(:empty) ~ .page-header {
	background-color: transparent;
}
.teams:not(:empty) ~ .page-header:before,
.teams:not(:empty) ~ .page-header .page-title {
	opacity: 0;
}

video.bg-loop {
	/* filter: invert(1); */
}

.teams {
	position: absolute;
	z-index: 2;
	left: var(--left-offset);
	right: var(--right-offset);
	top: var(--top-offset);
	bottom: var(--bottom-offset);
	top: 100px;
	bottom: 100px;
	display: grid;
	grid-auto-rows: 1fr 1fr;
	gap: 0 0;
	align-items: center;
}

.team {
	display: grid;
	gap: 16px 0;
	height: 440px;
}
.team0 {
	align-content: flex-start;
}
.team1 {
	align-content: flex-end;
}
.team-info {
	display: grid;
	grid-auto-flow: column;
	align-items: flex-start;
	align-self: flex-end;
	grid-template-columns: calc(var(--logo-width) + 10px) 1fr;
	justify-content: flex-start;
	order: 1;
	color: var(--white);

	font-size: 40px;
	line-height: 84px;
	font-weight: 600;
	/* gap: 0 12px; */

	height: 84px;

	background-color: var(--black);
}
.team1 .team-info {
	grid-template-columns: 1fr calc(var(--logo-width) + 10px);
	align-self: flex-start;
}

.team-info .team-logo {
	order: 1;
	position: relative;

	background: no-repeat left center / contain;
	width: var(--logo-width);
	height: var(--logo-height);
	flex-shrink: 0;
	display: flex;
	margin: 5px;
}
.team-name {
	order: 2;
	position: relative;

	display: flex;
	align-items: center;
	justify-content: flex-start;
	line-height: 1;
	min-width: 1500px;
	flex-grow: 1;
	color: var(--black);
	background-color: var(--white);
	line-height: 84px;
	font-size: 40px;
	padding: 0 36px;
}

.team1 .team-name {
	justify-content: flex-end;
}
.team1 .team-logo {
	order: 3;
}

.players {
	order: 2;
	display: grid;
	gap: 0 16px;
	grid-auto-flow: column;
	text-align: center;
	white-space: nowrap;

	justify-content: center;
	align-items: flex-start;

	position: relative;
	z-index: 2;

	color: var(--black);
	align-self: flex-start;

	transition: opacity 0.8s ease-in-out;
}
.team1 .players {
	order: 0;
	align-self: flex-end;
}
.player {
	position: relative;
	width: var(--player-panel-width);

	display: grid;
	align-items: stretch;
	text-align: center;

	transition: all 0.5s;

	left: 0;
	opacity: 1;
}
.player:after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: -1;

	height: 100%;
	background: var(--white);
	display: none;
}
body:not(.visible) .player {
	opacity: 0;
	left: -10px;
}
body:not(.visible) .team1 .player {
	left: 10px;
}
.teams.data-swap .players,
.teams.data-swap .player {
	opacity: 0;
}
.teams.data-swapped .players,
.teams.data-swapped .player {
	opacity: 1;
}
.teams.hide-players .player {
	opacity: 0;
}
.agent-image {
	background-size: auto 600px;
	background-position: center top;
	background-repeat: no-repeat;
	height: calc(100% - 0px);
	width: 100%;
	overflow: hidden;
	-webkit-mask-image: radial-gradient(farthest-side at 50% 50%, black 50%, black 60%, transparent 100%);
	-webkit-mask-size: 225% 125%;
	-webkit-mask-position: center -75px;
	-webkit-mask-repeat: no-repeat;

	position: absolute;
	bottom: 0px;
	left: 0;
	right: 0;
	z-index: 0;
	opacity: 0.35;
	filter: saturate(0.75) brightness(1.2);
}

.p1, .pos-top { order: 1; transition-delay: 0ms; }
.p2, .pos-jungle, .pos-jungler { order: 2; transition-delay: 150ms; }
.p3, .pos-mid, .pos-middle { order: 3; transition-delay: 350ms; }
.p4, .pos-bot, .pos-adc { order: 4; transition-delay: 600ms; }
.p5, .pos-support { order: 5; transition-delay: 900ms; }

.team1 .p5, .team1 .pos-top { transition-delay: 0ms; }
.team1 .p4, .team1 .pos-jungle, .pos-jungler { transition-delay: 150ms; }
.team1 .p3, .team1 .pos-mid, .pos-middle { transition-delay: 350ms; }
.team1 .p2, .team1 .pos-bot, .pos-adc { transition-delay: 600ms; }
.team1 .p1, .team1 .pos-support { transition-delay: 900ms; }

/* javascript race condition fix/workaround */
.p1 ~ .p1,
.p2 ~ .p2,
.p3 ~ .p3,
.p4 ~ .p4,
.p5 ~ .p5 {
	display: none;
}

.ordered .player {
	order: 0;
}
.team0 .ordered .player:nth-child(1), .team1 .ordered .player:nth-child(5) { transition-delay: 0ms; }
.team0 .ordered .player:nth-child(2), .team1 .ordered .player:nth-child(4) { transition-delay: 150ms; }
.team0 .ordered .player:nth-child(3), .team1 .ordered .player:nth-child(3) { transition-delay: 350ms; }
.team0 .ordered .player:nth-child(4), .team1 .ordered .player:nth-child(2) { transition-delay: 600ms; }
.team0 .ordered .player:nth-child(5), .team1 .ordered .player:nth-child(1) { transition-delay: 900ms; }

.player-data {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
}

.player-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: left;
	font-size: 30px;
	line-height: 70px;
	font-weight: 600;
	width: 100%;
	z-index: 3;
}
.nickname,
.realname {
	/*display: flex;
	align-items: center;
	justify-content: center;*/
	width: 100%;
	padding: 0 12px;
}
.nickname {
	order: 1;
	color: var(--white);
	background-color: rgba(var(--black-rgb), 1);
}
.realname {
	order: 2;
	width: 100%;
	font-weight: 600;
	font-size: 20px;
	line-height: 30px;
	color: var(--black);
	background-color: rgba(var(--white-rgb), 1);
}
.realname:not(:empty) ~ .nickname {
}
.realname:empty,
.nickname.hide,
.realname.hide {
	display: none;
}

.photo {
	background-size: 100% auto;
	background-position: center 85%;
	background-position: center center; /* 600x1000 canvas */
	background-position: center top;
	background-repeat: no-repeat;
	height: 100%;
	width: 100%;
	overflow: hidden;
	-webkit-mask-image: radial-gradient(farthest-side at 50% 300px, black 40%, rgba(var(--black-rgb),0.9) 70%, transparent 100%);
	-webkit-mask-image: radial-gradient(farthest-side at 50% 50%, black 0%, black 85%, transparent 100%);
	-webkit-mask-size: 225% 135%;
	-webkit-mask-position: center -45px;
	-webkit-mask-repeat: no-repeat;
	
	z-index: 1;
	display: none;
}
[data-teamnum="0"] .photo[style*="silhouette"] { background-image: url('../players/silhouette_ct.png') !important; }
[data-teamnum="1"] .photo[style*="silhouette"] { background-image: url('../players/silhouette_t.png') !important; }

.has-stats .photo {
}

.show-ratings .photo {
	background-position: center top;
	background-size: 80% auto;
	transform-origin: center bottom;
	display: block;
	height: 160px;
}
/*.player:not(.has-stats) .player-info { // When showing player photos?
	position: absolute;
	bottom: 25px;
}*/

:root {
	--team-bgcolor: var(--yellow-rgb);
	--team-text-color: var(--black-rgb);
}

[data-team="denmark"i] {
	--team-bgcolor: var(--denmark-primary-rgb);
	--team-text-color: var(--white-rgb);
}
[data-team="finland"i] {
	--team-bgcolor: var(--white-rgb);
	--team-text-color: var(--finland-primary-rgb);
}
[data-team="iceland"i] {
	--team-bgcolor: var(--iceland-primary-rgb);
	--team-text-color: var(--white-rgb);
}
[data-team="norway"i] {
	--team-bgcolor: var(--norway-primary-rgb);
	--team-text-color: var(--white-rgb);
}
[data-team="sweden"i] {
	--team-bgcolor: var(--sweden-primary-rgb);
	--team-text-color: var(--sweden-yellow-rgb);
}

[data-teamnum="0"] .coach-info .coach-name:before {
	background-color: var(--light-blue);
}
[data-teamnum="1"] .coach-info .coach-name:before {
	background-color: var(--yellow);
	color: var(--black);
}
.player {
	color: rgba(var(--team-text-color), 1);
	color: var(--white);
}
.player:after {
	background-color: rgba(var(--team-bgcolor), 1);
}
/*
[data-teamnum="0"] .players > .player:after {
	background: linear-gradient(to bottom, var(--white) 0%, var(--white) 60%, var(--light-blue) 100%);
}
[data-teamnum="1"] .players > .player:after {
	background: linear-gradient(to bottom, var(--white) 0%, var(--white) 60%, var(--yellow) 100%);
}*/

.show-stats ~ .coach-info {
	display: none;
}
.show-stats .has-stats .stats {
	display: flex;
}
.show-stats.highlight .stats {
}

.stats {
	display: none;
	flex-direction: column;
	justify-content: stretch;
	align-items: flex-start;
	font-weight: 500;
	font-size: 30px;
	line-height: 1;
	padding: 18px 24px 9px; /* bottom padding = top-border-stat bottom padding */
	margin-top: 8px;
	gap: 9px;
	z-index: 3;

	opacity: 0;
	transition: opacity 0.6s;
	background-color: rgba(var(--black-rgb), 0.5);
}
.show-stats .stats {
	opacity: 1;
}
.stats:empty {
	display: none;
}
.stat {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	height: calc(var(--stat-height) + 2px);
	height: calc(var(--stat-height));
	order: 3;
	border-bottom: 2px solid var(--white);
	padding: 0 0 7px 0;
	gap: 2px 0;
}
.stat:last-child {
	border-bottom-color: transparent;
}
.stat.agent,
.stat.agents,
.stat.roles {
	order: 1;
}
.stat-name {
	order: 1;
	letter-spacing: -0.05em;
}
.stat-value {
	order: 2;
	display: flex;
	font-size: 30px;
	align-items: center;
	font-weight: 800;
	letter-spacing: -0.01em;
}
.stat[class*="hltv"] {
	flex-direction: column;
	height: auto;
}
.stat[class*="hltv"] .stat-value {
	font-size: 40px;
}

.has-stats .role-icon {
	top: 25px;
}
.has-stats .player-info {
	top: 100px;
}
.has-stats .realname {
	/* display: none; */
	opacity: 0;
	position: absolute;
}
.show-ratings .stats {
	padding: 8px 8px 3px;
	
}

.role-info {
	z-index: 2;
	text-align: center;
}
.role-info:empty {
	display: none;
}
[data-game="league of legends"i] .role-icon {
	display: inline-block;
	width: 50px;
	height: 35px;
	background: no-repeat center / contain;
}
.role-icon.support {
	width: 60px;
}

.matches {
	position: absolute;
	z-index: 10;

	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	gap: 8px;

	text-align: center;
	color: var(--white);

	line-height: 36px;
	font-size: 32px;

	transform: scale(0.84);
}
.matches:before {
	width: 12px;
	height: 100%;
	content: '';
	background: no-repeat 14% center / auto 120px;
	background-image: url('../img/prism.png');
	position: absolute;
	top: 0;
	z-index: 0;
}
.matches.team0:before { left: -12px; }
.matches.team1:before { right: -12px; }
.matches.team0 {
	right: var(--right-offset);
	top: 100px;
	transform-origin: top right;
	align-items: flex-end;
}
.matches.team1 {
	left: var(--left-offset);
	bottom: 100px;
	transform-origin: bottom left;
	align-items: flex-start;
}
.matches.team0:not(:empty) ~ .page-header {
	display: none;
}
.matches:empty {
	display: none;
}
.match {
	position: relative;
	background-color: rgba(var(--black-rgb), 0.2);

	transition: all 0.5s;
	transition-delay: 2s;
	opacity: 1;
	left: 0;
}

.win .match-info {
	background-color: rgba(var(--val-green-rgb), 0.15);
}
.loss .match-info {
	background-color: rgba(var(--val-red-rgb), 0.15);
}
.win .map-name {
	color: #5A5;
}
.loss .map-name {
	color: #B22;
}

.map-image {
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: -1;
	opacity: 0.8;

	filter: grayscale(0.8);
}

.match-data {
	display: flex;
	align-items: center;
	justify-content: space-around;
	height: 40px;
	line-height: 25px;
	margin-bottom: 0px;

	display: none;
}
.match-info {
	color: var(--white);

	position: relative;
	overflow: hidden;

	display: grid;
	justify-content: space-evenly;
	justify-items: center;
	align-items: center;

	grid-template-columns: 80px 120px 80px;
	grid-template-rows: 40px 60px;
	column-gap: 0;
	row-gap: 0;
}
.match-info .team-logo {
	display: inline-block;
	width: 70px;
	height: 50px;
	margin: 10px 0 5px;
	margin: 5px 0;
	filter: drop-shadow(0px 0px rgba(var(--white-rgb), 1));

	background: no-repeat center / contain;

	grid-row: 2;
}

.team_1 {
	grid-column: 1;
}
.team_2 {
	grid-column: 3;
}

.team-divider {
	grid-row: 2;
	grid-column: 2;

	display: none;
}

.map-name {
	grid-row: 1;
	grid-column: 2;

	align-self: flex-start;

	width: 114px;
	padding: 0 3px;
	color: var(--black);
	background-color: rgba(var(--white-rgb), 0.8);
	background-color: rgba(var(--white-rgb), 1);
	font-weight: 500;
}
.match-score {
	grid-row: 2;
	grid-column: 2;

	/* margin-top: 5px; */
	margin-bottom: 5px;

	font-size: 38px;
	font-weight: normal;
	font-weight: 600;
	font-style: normal;

	letter-spacing: 0.05em;

	display: flex;
	justify-content: space-evenly;
	align-items: center;

	width: 120px;
}
.match-score .score {
	display: inline-block;
	/* width: 30px; */
}

.score-divider {
	font-size: 30px;
}

.match-score:empty {
	display: none;
}

.match-score .win {
	font-weight: 800;
}


.match-score:empty ~ .team-divider {
	grid-row: 1 / span 2;
}

.team-abbr {
	font-size: 26px;
}

/* abbr + vs background */
.show-scores .team-divider,
.show-scores .team-abbr {
	justify-self: stretch;
	/* background-color: rgba(var(--black-rgb), 0.5); */
}