/*
 * Hockey Tournament Manager – front end
 *
 * Every colour/size is a CSS custom property with a fallback, so Elementor
 * style controls (set on the widget wrapper) and your theme can override them:
 *   --htm-accent, --htm-head-bg, --htm-head-text, --htm-card-bg, --htm-border,
 *   --htm-text, --htm-muted, --htm-winner-bg, --htm-winner-text, --htm-score-bg,
 *   --htm-line, --htm-line-w, --htm-champ-bg, --htm-champ-text, --htm-stripe,
 *   --htm-qual-bg, --htm-title, --htm-radius, --htm-logo, --htm-card-width,
 *   --htm-connector, --htm-gap, --htm-cell-pad, --htm-card-logo, --htm-grid-gap,
 *   --htm-header-logo, --htm-team-tpl
 */

.htm-bracket,
.htm-standings,
.htm-teams,
.htm-roster,
.htm-schedule {
	--_accent: var(--htm-accent, #c8102e);
	--_head-bg: var(--htm-head-bg, #0b1f3a);
	--_head-text: var(--htm-head-text, #ffffff);
	--_card-bg: var(--htm-card-bg, #ffffff);
	--_border: var(--htm-border, #d5dbe3);
	--_text: var(--htm-text, #14213d);
	--_muted: var(--htm-muted, #6b7686);
	--_radius: var(--htm-radius, 6px);
	--_logo: var(--htm-logo, 22px);
	--_stripe: var(--htm-stripe, #f5f7fa);
	--_qual-bg: var(--htm-qual-bg, #fdf1f3);
	--_title: var(--htm-title, inherit);
	--_pad: var(--htm-cell-pad, 9px);
	box-sizing: border-box;
	color: var(--_text);
}

.htm-bracket *,
.htm-standings *,
.htm-teams *,
.htm-roster *,
.htm-schedule * {
	box-sizing: border-box;
}

.htm-logo {
	width: var(--_logo);
	height: var(--_logo);
	object-fit: contain;
	flex: 0 0 auto;
	display: inline-block;
	margin: 0 !important;
	border-radius: 0;
	box-shadow: none;
}

.htm-logo-empty {
	border-radius: 50%;
	background: var(--_border);
	opacity: .55;
}

.htm-team-name a {
	color: inherit;
	text-decoration: none;
}

.htm-team-name a:hover {
	color: var(--_accent);
	text-decoration: underline;
}

.htm-editor-notice {
	padding: 16px;
	border: 2px dashed #c3c4c7;
	color: #50575e;
	text-align: center;
	font-size: 14px;
}

/* ==================================================================
 * Bracket
 * ================================================================== */

.htm-bracket {
	--_card-w: var(--htm-card-width, 220px);
	--_c: var(--htm-connector, 36px);
	--_gap: var(--htm-gap, 16px);
	--_line: var(--htm-line, #9aa6b5);
	--_lw: var(--htm-line-w, 2px);
	--_winner-bg: var(--htm-winner-bg, var(--_card-bg));
	--_winner-text: var(--htm-winner-text, var(--_text));
	--_score-bg: var(--htm-score-bg, #eef2f7);
	--_champ-bg: var(--htm-champ-bg, var(--_head-bg));
	--_champ-text: var(--htm-champ-text, var(--_head-text));
	margin: 0 0 2em;
}

.htm-bracket + .htm-bracket {
	margin-top: 2.5em;
}

.htm-bracket-title,
.htm-standings-title,
.htm-roster-title {
	color: var(--_title);
	margin: 0 0 .6em;
}

.htm-bracket-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 6px;
}

.htm-bracket-grid {
	display: flex;
	align-items: stretch;
	min-width: min-content;
}

.htm-round {
	display: flex;
	flex-direction: column;
	flex: 0 0 var(--_card-w);
	width: var(--_card-w);
	margin-right: var(--_c);
}

.htm-round-last {
	margin-right: 0;
}

.htm-round-label {
	background: var(--_head-bg);
	color: var(--_head-text);
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: 7px 8px;
	border-radius: var(--_radius);
	line-height: 1.2;
}

.htm-no-labels .htm-round-label {
	display: none;
}

.htm-round-games {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding-top: calc(var(--_gap) / 2);
}

.htm-pair {
	flex: 1;
	display: flex;
	flex-direction: column;
	position: relative;
}

.htm-slot {
	flex: 1;
	display: flex;
	align-items: center;
	position: relative;
	padding: calc(var(--_gap) / 2) 0;
}

/* Connector lines ------------------------------------------------- */

/* stub out of each game (all rounds except the last column) */
.htm-round:not(.htm-round-last) .htm-slot::after {
	content: "";
	position: absolute;
	top: 50%;
	right: calc(var(--_c) / -2);
	width: calc(var(--_c) / 2);
	border-top: var(--_lw) solid var(--_line);
	transform: translateY(calc(var(--_lw) / -2));
}

/* vertical joiner between the two games of a pair */
.htm-round:not(.htm-round-last) .htm-pair:not(.htm-pair-single)::after {
	content: "";
	position: absolute;
	top: 25%;
	bottom: 25%;
	right: calc(var(--_c) / -2);
	border-right: var(--_lw) solid var(--_line);
	transform: translateX(calc(var(--_lw) / 2));
}

/* stub into each game (all rounds except the first) */
.htm-round:not(.htm-round-first) .htm-slot::before {
	content: "";
	position: absolute;
	top: 50%;
	left: calc(var(--_c) / -2);
	width: calc(var(--_c) / 2);
	border-top: var(--_lw) solid var(--_line);
	transform: translateY(calc(var(--_lw) / -2));
}

/* Game card -------------------------------------------------------- */

.htm-game {
	width: 100%;
	background: var(--_card-bg);
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
	position: relative;
	z-index: 1;
}

.htm-team {
	display: flex;
	align-items: stretch;
	gap: 8px;
	min-height: 36px;
	padding-left: 10px;
	line-height: 1.25;
	font-size: 14px;
	color: var(--_text);
}

.htm-team + .htm-team {
	border-top: 1px solid var(--_border);
}

.htm-team .htm-logo {
	align-self: center;
}

.htm-team-name {
	flex: 1;
	min-width: 0;
	align-self: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	padding: 6px 0;
}

.htm-tbd-text {
	color: var(--_muted);
	font-style: italic;
}

.htm-score {
	flex: 0 0 auto;
	min-width: 40px;
	padding: 0 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	background: var(--_score-bg);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.htm-note {
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	color: var(--_accent);
	letter-spacing: .03em;
	align-self: flex-start;
	margin-top: 8px;
}

.htm-team-winner {
	background: var(--_winner-bg);
	color: var(--_winner-text);
	box-shadow: inset 3px 0 0 var(--_accent);
}

.htm-team-winner .htm-team-name {
	font-weight: 700;
}

.htm-team-winner .htm-score {
	background: var(--_accent);
	color: #fff;
}

.htm-team-winner .htm-note {
	color: inherit;
	opacity: .9;
}

.htm-team-loser .htm-team-name,
.htm-team-loser .htm-score {
	color: var(--_muted);
}

.htm-team-loser .htm-logo {
	opacity: .6;
}

.htm-game-meta {
	font-size: 11.5px;
	color: var(--_muted);
	padding: 4px 10px;
	border-top: 1px solid var(--_border);
	background: var(--_stripe);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.4;
}

/* Champion -------------------------------------------------------- */

.htm-champion {
	width: 100%;
	background: var(--_champ-bg);
	color: var(--_champ-text);
	border-radius: var(--_radius);
	padding: 14px 12px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	position: relative;
	z-index: 1;
}

.htm-champion .htm-logo {
	--_logo: 48px;
}

.htm-champion .htm-team-name {
	font-weight: 800;
	font-size: 16px;
	white-space: normal;
	padding: 0;
	color: inherit;
}

.htm-trophy {
	color: #f2c14e;
	line-height: 0;
}

.htm-champion-tbd {
	background: transparent;
	color: var(--_muted);
	border: 2px dashed var(--_border);
}

.htm-champion-tbd .htm-trophy {
	color: var(--_border);
}

.htm-champion-tbd .htm-team-name {
	font-weight: 600;
	color: var(--_muted);
}

/* ==================================================================
 * Tables (standings + roster)
 * ================================================================== */

.htm-standings + .htm-standings {
	margin-top: 2em;
}

.htm-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
	background: var(--_card-bg);
}

.htm-table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	margin: 0 !important;
	border: 0 !important;
	font-size: 14px;
	color: var(--_text);
	background: transparent;
	table-layout: auto;
}

.htm-table th,
.htm-table td {
	padding: var(--_pad) 10px;
	border: 0 !important;
	border-bottom: 1px solid var(--_border) !important;
	text-align: center;
	vertical-align: middle;
	white-space: nowrap;
	background: transparent;
	line-height: 1.3;
}

.htm-table tbody tr:last-child td {
	border-bottom: 0 !important;
}

.htm-table thead th {
	background: var(--_head-bg) !important;
	color: var(--_head-text);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.htm-table tbody tr {
	background: var(--_card-bg);
}

.htm-table tbody tr:nth-child(even) {
	background: var(--_stripe);
}

.htm-table td {
	font-variant-numeric: tabular-nums;
}

.htm-table .htm-col-team,
.htm-table .htm-col-player {
	text-align: left;
	width: 100%;
}

.htm-team-cell {
	display: flex;
	align-items: center;
	gap: 10px;
}

.htm-team-cell .htm-team-name {
	padding: 0;
	white-space: nowrap;
}

.htm-table .htm-col-rank,
.htm-table .htm-col-number {
	width: 1%;
	color: var(--_muted);
	font-weight: 600;
}

.htm-table thead .htm-col-rank,
.htm-table thead .htm-col-number {
	color: var(--_head-text);
}

.htm-table td.htm-col-pts {
	font-weight: 800;
}

.htm-table tr.htm-qualified {
	background: var(--_qual-bg) !important;
}

.htm-table tr.htm-qualified td:first-child {
	box-shadow: inset 4px 0 0 var(--_accent);
}

.htm-table .htm-empty {
	color: var(--_muted);
	text-align: center;
	font-style: italic;
}

/* ==================================================================
 * Teams
 * ================================================================== */

.htm-teams-grid {
	display: grid;
	grid-template-columns: var(--htm-team-tpl, repeat(auto-fill, minmax(150px, 1fr)));
	gap: var(--htm-grid-gap, 16px);
}

.htm-team-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 10px;
	padding: 18px 12px 16px;
	background: var(--_card-bg);
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
	color: var(--_text) !important;
	text-decoration: none !important;
	text-align: center;
	transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

a.htm-team-card:hover,
a.htm-team-card:focus-visible {
	border-color: var(--_accent);
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(16, 24, 40, .1);
}

.htm-team-card-logo {
	width: var(--htm-card-logo, 88px);
	height: var(--htm-card-logo, 88px);
	display: flex;
	align-items: center;
	justify-content: center;
}

.htm-team-card-logo img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	margin: 0 !important;
}

.htm-team-card-logo.htm-logo-empty {
	width: calc(var(--htm-card-logo, 88px) * .7);
	height: calc(var(--htm-card-logo, 88px) * .7);
	margin: calc(var(--htm-card-logo, 88px) * .15);
}

.htm-team-card-name {
	font-weight: 700;
	line-height: 1.25;
}

.htm-team-card-count {
	font-size: 12px;
	color: var(--_muted);
}

/* list layout */
.htm-teams-list {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
	overflow: hidden;
}

.htm-teams-list .htm-team-card {
	flex-direction: row;
	border: 0;
	border-radius: 0;
	padding: 10px 14px;
	text-align: left;
	gap: 12px;
}

.htm-teams-list .htm-team-card + .htm-team-card {
	border-top: 1px solid var(--_border);
}

.htm-teams-list .htm-team-card:nth-child(even) {
	background: var(--_stripe);
}

.htm-teams-list a.htm-team-card:hover {
	transform: none;
	box-shadow: inset 4px 0 0 var(--_accent);
}

.htm-teams-list .htm-team-card-logo {
	width: var(--htm-card-logo, 32px);
	height: var(--htm-card-logo, 32px);
}

.htm-teams-list .htm-team-card-logo.htm-logo-empty {
	width: 24px;
	height: 24px;
	margin: 4px;
}

.htm-teams-list .htm-team-card-name {
	flex: 1;
}

.htm-teams.htm-empty {
	color: var(--_muted);
	font-style: italic;
}

/* ==================================================================
 * Roster
 * ================================================================== */

.htm-roster {
	margin: 1.5em 0;
}

.htm-roster-header {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: .8em;
}

.htm-roster-header .htm-logo {
	--_logo: var(--htm-header-logo, 64px);
}

.htm-roster-header .htm-roster-title {
	margin: 0;
}

.htm-roster .htm-empty {
	color: var(--_muted);
	font-style: italic;
}

/* ==================================================================
 * Small screens
 * ================================================================== */

@media (max-width: 600px) {
	.htm-bracket {
		--_card-w: var(--htm-card-width, 190px);
		--_c: var(--htm-connector, 24px);
	}

	.htm-table th,
	.htm-table td {
		padding-left: 7px;
		padding-right: 7px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.htm-team-card {
		transition: none;
	}
}

/* ==================================================================
 * Consolation column
 * ================================================================== */

.htm-round-cons .htm-slot::before,
.htm-round-cons .htm-slot::after,
.htm-round-cons .htm-pair::after {
	display: none !important;
}

.htm-game-cons {
	border-style: dashed;
}

/* ==================================================================
 * Schedule & Results
 * ================================================================== */

.htm-sch-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 1.5em;
}

.htm-sch-filter-btn {
	appearance: none;
	border: 2px solid var(--_head-bg) !important;
	background: transparent !important;
	color: var(--_head-bg) !important;
	border-radius: 999px !important;
	padding: 7px 18px !important;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	text-transform: none;
	letter-spacing: 0;
}

.htm-sch-filter-btn:hover {
	border-color: var(--_accent) !important;
	color: var(--_accent) !important;
}

.htm-sch-filter-btn.is-active {
	background: var(--_head-bg) !important;
	color: var(--_head-text) !important;
}

.htm-sch-day + .htm-sch-day {
	margin-top: 2em;
}

.htm-sch-day[hidden],
.htm-sch-game[hidden] {
	display: none !important;
}

.htm-sch-day-title {
	color: var(--_title);
	margin: 0 0 .7em;
	padding-bottom: .35em;
	border-bottom: 3px solid var(--_accent);
}

.htm-sch-list {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
	overflow: hidden;
	background: var(--_card-bg);
}

.htm-sch-game {
	display: grid;
	grid-template-columns: 130px minmax(0, 1fr) 150px;
	grid-template-areas: "info match status" "info mvp mvp";
	align-items: center;
	gap: 4px 16px;
	padding: 12px 16px;
	font-size: 15px;
}

.htm-sch-game + .htm-sch-game {
	border-top: 1px solid var(--_border);
}

.htm-sch-game:nth-child(even) {
	background: var(--_stripe);
}

.htm-sch-info {
	grid-area: info;
	display: flex;
	flex-direction: column;
	line-height: 1.3;
}

.htm-sch-time {
	font-weight: 800;
	font-size: 16px;
}

.htm-sch-meta {
	font-size: 12.5px;
	color: var(--_muted);
}

.htm-sch-matchup {
	grid-area: match;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 12px;
}

.htm-sch-team {
	min-width: 0;
}

.htm-sch-team-inner {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.htm-sch-home .htm-sch-team-inner {
	justify-content: flex-end;
	text-align: right;
}

.htm-sch-team .htm-team-name {
	flex: 0 1 auto;
	padding: 0;
	white-space: normal;
	font-weight: 600;
	line-height: 1.25;
}

.htm-sch-game {
	--_logo: var(--htm-logo, 30px);
}

.htm-sch-winner .htm-team-name {
	font-weight: 800;
}

.htm-sch-loser .htm-team-name {
	color: var(--_muted);
}

.htm-sch-score {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 76px;
	padding: 6px 10px;
	border-radius: var(--_radius);
	background: var(--_head-bg);
	color: var(--_head-text);
	font-weight: 800;
	font-size: 17px;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

.htm-sch-vs {
	font-size: 12px;
	letter-spacing: .1em;
	text-transform: uppercase;
	opacity: .85;
}

.htm-sch-game:not(.htm-sch-played) .htm-sch-score {
	background: transparent;
	color: var(--_muted);
	border: 1px solid var(--_border);
}

.htm-sch-status {
	grid-area: status;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	text-align: right;
	font-size: 12px;
	line-height: 1.25;
}

.htm-sch-tags {
	color: var(--_muted);
}

.htm-sch-final {
	display: inline-block;
	background: var(--_accent);
	color: #fff;
	font-weight: 800;
	letter-spacing: .06em;
	text-transform: uppercase;
	font-size: 11px;
	padding: 3px 8px;
	border-radius: 3px;
}

.htm-sch-mvp {
	grid-area: mvp;
	font-size: 12.5px;
	color: var(--_muted);
}

.htm-sch-mvp-label {
	font-weight: 700;
	color: var(--_text);
}

@media (max-width: 767px) {
	.htm-sch-game {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas: "info status" "match match" "mvp mvp";
		gap: 8px 10px;
		padding: 12px;
		font-size: 14px;
	}

	.htm-sch-info {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: baseline;
		gap: 2px 10px;
	}

	.htm-sch-status {
		flex-direction: row;
		align-items: center;
		gap: 8px;
	}

	.htm-sch-matchup {
		gap: 8px;
	}

	.htm-sch-game {
		--_logo: var(--htm-logo, 24px);
	}

	.htm-sch-score {
		min-width: 60px;
		font-size: 15px;
	}
}

/* ==================================================================
 * Countdown
 * ================================================================== */

.htm-countdown {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
}

.htm-cd-unit {
	width: var(--htm-cd-w, 110px);
	padding: 14px 6px 12px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	border: 1px solid rgba(255, 255, 255, .25);
	border-radius: 8px;
	background: rgba(11, 31, 58, .55);
	text-align: center;
}

.htm-cd-num {
	font-size: 42px;
	font-weight: 800;
	line-height: 1;
	color: #fff;
	font-variant-numeric: tabular-nums;
}

.htm-cd-label {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .8);
}

.htm-cd-done {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	color: #fff;
}

@media (max-width: 767px) {
	.htm-countdown {
		gap: 8px;
	}

	.htm-cd-unit {
		width: calc(25% - 6px);
		padding: 10px 2px;
	}

	.htm-cd-num {
		font-size: 28px;
	}

	.htm-cd-label {
		font-size: 10px;
		letter-spacing: .06em;
	}
}

/* Team page */
.htm-roster-header {
	display: flex;
	align-items: center;
	gap: 18px;
	margin-bottom: 1.2em;
}

.htm-roster-header .htm-logo {
	--_logo: 96px;
}

.htm-roster-header .htm-roster-title {
	margin: 0;
}

.htm-team-games-title {
	margin: 2em 0 .8em;
}

/* Live stream button */
.htm-sch-watch,
a.htm-sch-watch {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--_accent);
	color: #fff !important;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .04em;
	text-transform: uppercase;
	text-decoration: none !important;
	white-space: nowrap;
	line-height: 1.2;
	transition: background .15s ease, transform .15s ease;
}

a.htm-sch-watch:hover,
a.htm-sch-watch:focus-visible {
	background: var(--_head-bg);
	transform: translateY(-1px);
}

.htm-sch-watch-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 0 0 rgba(255, 255, 255, .7);
	animation: htm-live 1.6s infinite;
}

@keyframes htm-live {
	0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }
	70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
	100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.htm-sch-watch-dot { animation: none; }
}
