/**
 * Frontend styles for IG Predictions Game.
 *
 * The pg-* contract intentionally follows the approved private-page prototype.
 */

.predictions-game {
	--pg-aqua: #55bed8;
	--pg-aqua-dark: #1687a3;
	--pg-border: #dce3e8;
	--pg-green: #4fba57;
	--pg-green-dark: #358f3c;
	--pg-ink: #17222b;
	--pg-muted: #687782;
	--pg-surface: #f5f7f8;
	background: #fff;
	border: 1px solid var( --pg-border );
	border-radius: 14px;
	box-shadow: 0 9px 28px rgba( 27, 48, 61, 0.08 );
	color: var( --pg-ink );
	font-family: inherit;
	margin: 24px auto;
	max-width: 980px;
	overflow: hidden;
}

.predictions-game *,
.predictions-game *::before,
.predictions-game *::after {
	box-sizing: border-box;
}

.pg-header {
	align-items: center;
	background: linear-gradient( 135deg, #f8fcfd 0%, #eff9fb 100% );
	border-bottom: 1px solid var( --pg-border );
	display: flex;
	gap: 24px;
	justify-content: space-between;
	padding: 24px 28px;
}

.pg-title,
.predictions-game .pg-header .pg-title {
	color: #fff;
	font-size: clamp( 20px, 2.7vw, 30px );
	font-weight: 800;
	letter-spacing: -0.025em;
	line-height: 1.15;
	margin: 0;
}

.pg-title span {
	color: var( --pg-green-dark );
}

.pg-progress {
	align-items: center;
	display: flex;
	flex: 0 0 auto;
	gap: 15px;
}

.pg-progress-copy {
	text-align: right;
}

.pg-progress-label {
	color: var( --pg-muted );
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.08em;
}

.pg-progress-value {
	font-size: 21px;
	font-weight: 800;
	line-height: 1.1;
}

.pg-progress-divider {
	background: var( --pg-border );
	height: 38px;
	width: 1px;
}

.pg-progress-ring {
	align-items: center;
	background: conic-gradient( var( --pg-green ) var( --pg-progress ), #dce6e9 0 );
	border-radius: 50%;
	display: flex;
	height: 54px;
	justify-content: center;
	position: relative;
	transition: background 180ms ease;
	width: 54px;
}

.pg-progress-ring::before {
	background: #f5fbfc;
	border-radius: inherit;
	content: '';
	inset: 5px;
	position: absolute;
}

.pg-progress-percent {
	font-size: 11px;
	font-weight: 800;
	position: relative;
	z-index: 1;
}

.pg-week-switcher {
	align-items: center;
	background: #fff;
	border-bottom: 1px solid var( --pg-border );
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	padding: 12px 28px;
}

.pg-week-switcher label {
	color: var( --pg-muted );
	font-size: 12px;
	font-weight: 700;
}

.pg-week-switcher__control {
	align-items: center;
	display: flex;
	gap: 9px;
}

.pg-week-spinner-slot {
	flex: 0 0 17px;
	height: 17px;
	width: 17px;
}

.pg-week-switcher select {
	background: #fff;
	border: 1px solid #bdc9cf;
	border-radius: 6px;
	color: var( --pg-ink );
	font: inherit;
	font-size: 13px;
	max-width: 310px;
	padding: 7px 34px 7px 10px;
}

.pg-week-switcher select:disabled {
	cursor: wait;
	opacity: 0.72;
}

.pg-week-spinner {
	animation: pg-spin 700ms linear infinite;
	border: 2px solid #c9d7dc;
	border-radius: 50%;
	border-top-color: var( --pg-aqua-dark );
	box-sizing: border-box;
	display: block;
	height: 17px;
	width: 17px;
}

.pg-week-spinner[hidden] {
	display: none;
}

.pg-week-status.is-error {
	color: #ae2929;
	font-size: 12px;
	font-weight: 600;
}

.pg-form {
	margin: 0;
}

.pg-matches {
	padding: 8px 28px 4px;
}

.pg-match {
	align-items: center;
	border-bottom: 1px solid #e8edf0;
	display: grid;
	gap: 14px;
	grid-template-columns: 34px minmax( 0, 1fr ) auto;
	min-height: 74px;
	padding: 12px 0;
	transition: background-color 150ms ease;
}

.pg-match:last-child {
	border-bottom: 0;
}

.pg-match.is-complete {
	background: linear-gradient( 90deg, rgba( 79, 186, 87, 0.055 ), transparent 42% );
}

.pg-match-number {
	align-items: center;
	background: var( --pg-surface );
	border: 1px solid var( --pg-border );
	border-radius: 50%;
	color: var( --pg-muted );
	display: flex;
	font-size: 12px;
	font-weight: 800;
	height: 30px;
	justify-content: center;
	width: 30px;
}

.pg-match.is-complete .pg-match-number {
	background: var( --pg-green );
	border-color: var( --pg-green );
	color: #fff;
}

.pg-match-teams,
.predictions-game .pg-match-teams {
	color: var( --pg-ink );
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
}

.pg-match-versus {
	color: #97a3aa;
	font-size: 11px;
	font-weight: 600;
	margin: 0 5px;
	text-transform: uppercase;
}

.pg-match-choices {
	display: flex;
	gap: 8px;
}

.pg-match-result {
	cursor: pointer;
	display: block;
	margin: 0;
}

.pg-match-result-input {
	clip: rect( 0 0 0 0 );
	clip-path: inset( 50% );
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.pg-match-result-box {
	align-items: center;
	background: #fff;
	border: 1px solid #c9d2d7;
	border-radius: 7px;
	color: #41505a;
	display: flex;
	font-size: 14px;
	font-weight: 800;
	height: 40px;
	justify-content: center;
	transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, transform 120ms ease;
	width: 44px;
}

.pg-match-result:hover .pg-match-result-box {
	border-color: var( --pg-aqua-dark );
	transform: translateY( -1px );
}

.pg-match-result-input:focus-visible + .pg-match-result-box {
	box-shadow: 0 0 0 3px rgba( 85, 190, 216, 0.28 );
	outline: 2px solid transparent;
}

.pg-match-result-input:checked + .pg-match-result-box {
	background: var( --pg-aqua );
	border-color: var( --pg-aqua-dark );
	box-shadow: inset 0 -2px 0 rgba( 0, 0, 0, 0.08 );
	color: #073945;
}

.pg-participant {
	background: var( --pg-surface );
	border: 1px solid var( --pg-border );
	border-radius: 8px;
	margin-top: 0;
	padding: 20px;
}

.pg-participant[hidden] {
	display: none !important;
}

.pg-participant-heading {
	align-items: flex-start;
	display: flex;
	gap: 12px;
	justify-content: space-between;
	margin-bottom: 14px;
}

.pg-participant-heading h3,
.predictions-game .pg-participant-heading h3 {
	font-size: 17px;
	line-height: 1.3;
	margin: 0;
}

.pg-participant-heading p,
.predictions-game .pg-participant-heading p {
	color: var( --pg-muted );
	font-size: 12px;
	margin: 0;
}

.pg-participant-heading__copy {
	display: grid;
	gap: 3px;
}

.predictions-game .pg-participant-heading .pg-entry-eligibility {
	background: #e9f7eb;
	border: 1px solid #c5e6c9;
	border-radius: 6px;
	color: #286d2d;
	font-weight: 700;
	line-height: 1.4;
	max-width: 390px;
	padding: 7px 9px;
}

.pg-participant-fields {
	display: grid;
	gap: 14px;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
}

.pg-field {
	display: grid;
	gap: 6px;
}

.pg-field span {
	font-size: 12px;
	font-weight: 700;
}

.pg-field input {
	background: #fff;
	border: 1px solid #c3ced3;
	border-radius: 7px;
	box-shadow: none;
	color: var( --pg-ink );
	font: inherit;
	font-size: 14px;
	height: 44px;
	line-height: 1.2;
	margin: 0;
	padding: 10px 12px;
	width: 100%;
}

.pg-field input:focus {
	border-color: var( --pg-aqua-dark );
	box-shadow: 0 0 0 3px rgba( 85, 190, 216, 0.2 );
	outline: 0;
}

.pg-consents {
	display: grid;
	gap: 9px;
	margin-top: 14px;
}

.pg-consent {
	align-items: flex-start;
	color: var( --pg-muted );
	display: flex;
	font-size: 12px;
	gap: 8px;
	line-height: 1.45;
	margin: 0;
}

.pg-consent input {
	flex: 0 0 auto;
	margin: 2px 0 0;
}

.pg-consent a,
.pg-privacy-notice a {
	color: var( --pg-green-dark );
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.pg-privacy-notice {
	background: #fff;
	border: 1px solid var( --pg-border );
	border-radius: 7px;
	color: var( --pg-muted );
	font-size: 11px;
	line-height: 1.55;
	margin-top: 14px;
}

.pg-privacy-notice summary {
	color: var( --pg-ink );
	cursor: pointer;
	font-size: 12px;
	font-weight: 700;
	padding: 10px 12px;
}

.pg-privacy-notice summary:focus-visible {
	box-shadow: inset 0 0 0 2px var( --pg-aqua-dark );
	outline: 0;
}

.pg-privacy-notice__content {
	border-top: 1px solid var( --pg-border );
	padding: 5px 12px 11px;
}

.predictions-game .pg-privacy-notice__content p {
	margin: 8px 0 0;
}

.pg-participant-submit {
	margin: 16px 0 0;
}

.pg-footer,
.predictions-game .pg-footer {
	display: grid;
	row-gap: 15px;
	padding: 20px 28px 24px;
}

.predictions-game .pg-footer > p {
	margin: 0;
}

.predictions-game [data-reveal-participant-wrap][hidden] {
	display: none !important;
}

.predictions-game .pg-footer .pg-footer-nav {
	margin-top: 0;
}

.predictions-game .pg-footer .pg-message {
	margin: 0;
	min-height: 0;
}

.pg-button,
.predictions-game .pg-button {
	align-items: center;
	background: var( --pg-green );
	border: 0;
	border-radius: 7px;
	box-shadow: inset 0 -2px 0 rgba( 0, 0, 0, 0.12 );
	color: #fff;
	cursor: pointer;
	display: flex;
	font: inherit;
	font-size: 14px;
	font-weight: 800;
	justify-content: center;
	min-height: 46px;
	padding: 10px 18px;
	transition: background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
	width: 100%;
}

.pg-button:hover:not( :disabled ) {
	background: var( --pg-green-dark );
	transform: translateY( -1px );
}

.pg-button:focus-visible,
.pg-footer-link:focus-visible,
.pg-ranking-tab:focus-visible,
.pg-ranking-close:focus-visible {
	box-shadow: 0 0 0 3px rgba( 85, 190, 216, 0.3 );
	outline: 2px solid transparent;
}

.pg-button:disabled {
	background: #a9b7ad;
	box-shadow: none;
	cursor: not-allowed;
	opacity: 0.72;
}

.pg-button.is-loading::before {
	animation: pg-spin 700ms linear infinite;
	border: 2px solid rgba( 255, 255, 255, 0.45 );
	border-radius: 50%;
	border-top-color: #fff;
	content: '';
	height: 15px;
	margin-right: 8px;
	width: 15px;
}

.pg-message,
.predictions-game .pg-message {
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	margin: 9px 0 0;
	min-height: 17px;
	text-align: center;
}

.pg-message.is-error {
	color: #ae2929;
}

.pg-message.is-success {
	color: #24742b;
}

.pg-footer-nav {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	margin-top: 14px;
}

.pg-footer-link,
.predictions-game .pg-footer-link {
	align-items: center;
	background: var( --pg-aqua );
	border: 0;
	border-radius: 5px;
	color: #073945;
	cursor: pointer;
	display: flex;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	justify-content: center;
	line-height: 1.25;
	min-height: 39px;
	padding: 8px 10px;
	text-align: center;
	text-decoration: none;
	transition: background-color 140ms ease, transform 140ms ease;
}

.pg-footer-link:hover {
	background: #74cce1;
	color: #052d36;
	text-decoration: none;
	transform: translateY( -1px );
}

.pg-honeypot {
	clip: rect( 0 0 0 0 ) !important;
	clip-path: inset( 50% ) !important;
	height: 1px !important;
	overflow: hidden !important;
	position: absolute !important;
	white-space: nowrap !important;
	width: 1px !important;
}

.pg-empty-state {
	padding: 48px 28px 26px;
	text-align: center;
}

.pg-empty-state__icon {
	align-items: center;
	background: #e9f7eb;
	border-radius: 50%;
	color: var( --pg-green-dark );
	display: flex;
	font-size: 24px;
	font-weight: 800;
	height: 58px;
	justify-content: center;
	margin: 0 auto 15px;
	width: 58px;
}

.pg-empty-state h3,
.predictions-game .pg-empty-state h3 {
	font-size: 20px;
	margin: 0 0 7px;
}

.pg-empty-state p,
.predictions-game .pg-empty-state p {
	color: var( --pg-muted );
	margin: 0 auto;
	max-width: 560px;
}

.pg-footer--empty {
	padding-top: 0;
}

/* In-place ranking view shown by either footer ranking button. */
.pg-ranking {
	background: #fff;
}

.pg-ranking-header {
	align-items: flex-start;
	background: linear-gradient( 135deg, #f8fcfd 0%, #eff9fb 100% );
	border-bottom: 1px solid var( --pg-border );
	display: flex;
	gap: 20px;
	justify-content: space-between;
	padding: 24px 28px 20px;
}

.pg-ranking-header h3,
.predictions-game .pg-ranking-header h3 {
	font-size: clamp( 21px, 2.5vw, 28px );
	letter-spacing: -0.02em;
	line-height: 1.2;
	margin: 0;
}

.pg-ranking-header p,
.predictions-game .pg-ranking-header p {
	color: var( --pg-muted );
	font-size: 12px;
	margin: 5px 0 0;
}

.pg-ranking-close {
	align-items: center;
	background: #fff;
	border: 1px solid var( --pg-border );
	border-radius: 50%;
	color: var( --pg-muted );
	cursor: pointer;
	display: flex;
	font-size: 25px;
	height: 38px;
	justify-content: center;
	line-height: 1;
	padding: 0 0 3px;
	width: 38px;
}

.pg-ranking-switch {
	background: #eaf0f2;
	border-radius: 8px;
	display: grid;
	gap: 4px;
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	margin: 20px 28px;
	padding: 4px;
}

.pg-ranking-tab {
	background: transparent;
	border: 0;
	border-radius: 6px;
	color: #53626c;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	font-weight: 750;
	min-height: 39px;
	padding: 8px 13px;
}

.pg-ranking-tab.is-active {
	background: #fff;
	box-shadow: 0 1px 4px rgba( 34, 57, 68, 0.13 );
	color: var( --pg-aqua-dark );
}

.pg-ranking-status {
	color: var( --pg-muted );
	display: none;
	font-size: 14px;
	margin: 0 28px 22px;
	padding: 24px;
	text-align: center;
}

.pg-ranking-status.is-visible {
	background: var( --pg-surface );
	border: 1px dashed #c9d3d8;
	border-radius: 8px;
	display: block;
}

.pg-ranking-status.is-loading::before {
	animation: pg-spin 700ms linear infinite;
	border: 2px solid #c9d7dc;
	border-radius: 50%;
	border-top-color: var( --pg-aqua-dark );
	content: '';
	display: inline-block;
	height: 15px;
	margin: 0 8px -3px 0;
	width: 15px;
}

.pg-ranking-table-wrap {
	margin: 0 28px;
	overflow-x: auto;
}

.pg-ranking-table,
.predictions-game .pg-ranking-table {
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 14px;
	margin: 0;
	width: 100%;
}

.pg-ranking-table th,
.pg-ranking-table td {
	border: 0;
	border-bottom: 1px solid #e5eaed;
	padding: 12px 14px;
	text-align: left;
	vertical-align: middle;
}

.pg-ranking-table th {
	background: #f2f5f6;
	color: #60707a;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.pg-ranking-table th:first-child {
	border-radius: 7px 0 0;
}

.pg-ranking-table th:last-child {
	border-radius: 0 7px 0 0;
}

.pg-ranking-table tbody tr:hover {
	background: #f8fbfc;
}

.pg-ranking-table tbody tr.is-position-1 {
	background: #fffaf0;
}

.pg-ranking-table tbody tr.is-position-2 {
	background: #f8fafb;
}

.pg-ranking-table tbody tr.is-position-3 {
	background: #fff8f3;
}

.pg-ranking-position {
	text-align: center !important;
	width: 84px;
}

.pg-position-badge {
	align-items: center;
	background: #edf1f3;
	border-radius: 50%;
	color: #56656e;
	display: inline-flex;
	font-size: 12px;
	font-weight: 800;
	height: 30px;
	justify-content: center;
	width: 30px;
}

.is-position-1 .pg-position-badge {
	background: #f0bc49;
	color: #563b00;
}

.is-position-2 .pg-position-badge {
	background: #cbd4da;
	color: #36434b;
}

.is-position-3 .pg-position-badge {
	background: #d99d72;
	color: #4f2810;
}

.pg-ranking-participant strong {
	display: block;
}

.pg-ranking-participant strong {
	color: var( --pg-ink );
	font-size: 14px;
	line-height: 1.3;
}

.pg-ranking-weeks,
.pg-ranking-score {
	text-align: center !important;
	width: 100px;
}

.pg-ranking-score {
	color: var( --pg-green-dark );
	font-size: 18px;
	font-weight: 850;
}

.pg-ranking-footer {
	color: var( --pg-muted );
	display: grid;
	font-size: 11px;
	gap: 14px;
	padding: 18px 28px 24px;
}

.pg-ranking-footer__controls {
	align-items: center;
	display: flex;
	gap: 15px;
	justify-content: space-between;
}

.pg-responsible-notice,
.predictions-game .pg-responsible-notice {
	color: var( --pg-muted );
	font-size: 11px;
	font-weight: 600;
	line-height: 1.45;
	margin: 0;
	text-align: center;
}

.predictions-game .pg-responsible-notice--game {
	border-top: 1px solid var( --pg-border );
	padding: 12px 28px 14px;
}

.pg-ranking-footer > .pg-responsible-notice {
	border-top: 1px solid var( --pg-border );
	padding-top: 12px;
}

.pg-is-hidden {
	display: none !important;
}

.pg-form.is-submitted .pg-match-result,
.pg-form.is-submitted .pg-field,
.pg-form.is-submitted .pg-consent {
	opacity: 0.72;
}

@keyframes pg-spin {
	to {
		transform: rotate( 360deg );
	}
}

@media ( max-width: 680px ) {
	.predictions-game {
		border-left: 0;
		border-radius: 0;
		border-right: 0;
		margin-left: -15px;
		margin-right: -15px;
	}

	.pg-header {
		align-items: flex-start;
		padding: 20px 18px;
	}

	.pg-progress-copy,
	.pg-progress-divider {
		display: none;
	}

	.pg-progress-ring {
		height: 48px;
		width: 48px;
	}

	.pg-week-switcher {
		align-items: stretch;
		flex-direction: column;
		padding: 11px 18px;
	}

	.pg-week-switcher select {
		flex: 1 1 auto;
		max-width: none;
		width: 100%;
	}

	.pg-week-switcher__control {
		width: 100%;
	}

	.pg-matches {
		padding: 5px 18px;
	}

	.pg-match {
		gap: 9px;
		grid-template-columns: 30px minmax( 0, 1fr );
		padding: 13px 0;
	}

	.pg-match-choices {
		grid-column: 2;
	}

	.pg-match-result-box {
		height: 37px;
		width: 43px;
	}

	.pg-participant,
	.pg-footer,
	.pg-ranking-header {
		padding-left: 18px;
		padding-right: 18px;
	}

	.pg-participant-heading {
		align-items: flex-start;
		flex-direction: column;
		gap: 10px;
	}

	.predictions-game .pg-participant-heading .pg-entry-eligibility {
		max-width: none;
	}

	.pg-participant-fields,
	.pg-footer-nav {
		grid-template-columns: 1fr;
	}

	.pg-ranking-switch,
	.pg-ranking-table-wrap,
	.pg-ranking-status {
		margin-left: 18px;
		margin-right: 18px;
	}

	.pg-ranking-position {
		width: 58px;
	}

	.pg-ranking-table th,
	.pg-ranking-table td {
		padding: 10px 8px;
	}

	.pg-ranking-weeks {
		width: 68px;
	}

	.pg-ranking-score {
		width: 68px;
	}

	.pg-ranking-footer {
		align-items: stretch;
		padding-left: 18px;
		padding-right: 18px;
	}

	.pg-ranking-footer__controls {
		align-items: stretch;
		flex-direction: column;
	}

	.predictions-game .pg-responsible-notice--game {
		padding-left: 18px;
		padding-right: 18px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.predictions-game *,
	.predictions-game *::before,
	.predictions-game *::after {
		scroll-behavior: auto !important;
		transition: none !important;
	}
}
