/* Shared with #screen-table-leaderboard — same page shell/table/badge styles,
   plus the .trend-badge classes below (used only by the table-leaderboard screen). */
#screen-leaderboard, #screen-table-leaderboard {
	min-height: 100vh;
	display: grid;
	place-items: start center;

	.page {
		width: min(1100px, calc(100% - 32px));
		margin: 0 auto;
		padding: 32px 0 44px;
	}

	/* Page header */
	.panel-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 24px;
	}

	.panel-header h1 {
		margin: 0;
		font-size: clamp(2rem, 4vw, 3rem);
		letter-spacing: -0.04em;
		text-align: left;
		width: auto;
	}

	.header-actions {
		display: flex;
		gap: 8px;
		align-items: center;
	}

	.btn-nav {
		display: inline-flex;
		align-items: center;
		padding: 9px 18px;
		border-radius: 999px;
		border: 1px solid var(--panel-strong);
		background: #fff;
		color: var(--text);
		font-family: inherit;
		font-size: 0.9rem;
		font-weight: 700;
		text-decoration: none;
		white-space: nowrap;
	}

	.btn-nav:hover { background: #f5f5f5; }

	/* Group code bar */
	.group-row {
		display: flex;
		align-items: center;
		gap: 0;
		margin-bottom: 24px;
		max-width: 420px;
		background: #fff;
		border: 1px solid var(--panel-strong);
		border-radius: 999px;
		padding: 4px 4px 4px 18px;
		box-shadow: 0 1px 4px rgba(0,0,0,0.06);
	}

	.group-label {
		font-size: 0.68rem;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		color: var(--muted);
		font-weight: 800;
		font-family: system-ui, sans-serif;
		white-space: nowrap;
		flex-shrink: 0;
	}

	.group-input {
		flex: 1;
		min-width: 80px;
		padding: 7px 10px;
		border: none;
		background: transparent;
		color: var(--text);
		font-family: system-ui, sans-serif;
		font-size: 0.95rem;
		font-weight: 700;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		outline: none;
	}

	.group-input::placeholder {
		color: #bbb;
		font-weight: 500;
		letter-spacing: 0.04em;
	}

	.group-submit {
		padding: 8px 20px;
		border: none;
		border-radius: 999px;
		background: var(--accent);
		color: #fff;
		font-family: inherit;
		font-size: 0.88rem;
		font-weight: 700;
		cursor: pointer;
		white-space: nowrap;
		flex-shrink: 0;
	}

	.group-submit:hover {
		opacity: 0.88;
	}

	.group-placeholder {
		padding: 48px 24px;
		text-align: center;
		color: var(--muted);
		font-size: 1rem;
		font-style: italic;
	}

	/* Prize pot banner */
	.prize-pot {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		background: #fff;
		border: 1px solid var(--panel-strong);
		color: var(--text);
		border-radius: 16px;
		padding: 18px 24px;
		margin-bottom: 20px;
	}

	.prize-pot--active {
		background: linear-gradient(135deg, #1d3fbe 0%, var(--accent) 100%);
		border-color: transparent;
		color: #fff;
	}

	.prize-pot[hidden] { display: none; }

	.prize-pot-inner {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.prize-pot-label {
		font-size: 0.65rem;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		font-family: system-ui, sans-serif;
		font-weight: 800;
		color: var(--muted);
	}

	.prize-pot--active .prize-pot-label {
		color: inherit;
		opacity: 0.75;
	}

	.prize-pot-amount {
		font-size: 2.2rem;
		font-weight: 900;
		letter-spacing: -0.04em;
		line-height: 1;
	}

	.prize-pot-detail {
		font-size: 0.8rem;
		color: var(--muted);
		font-family: system-ui, sans-serif;
		font-weight: 600;
		white-space: nowrap;
	}

	.prize-pot--active .prize-pot-detail {
		color: inherit;
		opacity: 0.7;
	}

	/* Competition / week filter bar */
	.filter-bar {
		display: flex;
		flex-direction: column;
		gap: 8px;
		margin-bottom: 16px;
	}

	.comp-pills,
	.week-pills {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}

	.week-pills[hidden] { display: none; }

	.filter-pill {
		padding: 6px 14px;
		border: 1px solid var(--panel-strong);
		border-radius: 999px;
		background: #fff;
		color: var(--muted);
		font-family: system-ui, sans-serif;
		font-size: 0.78rem;
		font-weight: 700;
		letter-spacing: 0.04em;
		cursor: pointer;
		white-space: nowrap;
	}

	.filter-pill--active {
		background: var(--accent);
		border-color: var(--accent);
		color: #fff;
	}

	.filter-pill:hover:not(.filter-pill--active) {
		background: #f0f0f0;
		color: var(--text);
	}

	h1 {
		margin: 0;
		width: 100%;
		font-size: clamp(2.2rem, 5vw, 4rem);
		line-height: 1;
		letter-spacing: -0.05em;
		text-align: center;
	}

	/* User detail header */
	.user-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 20px;
	}

	.user-header[hidden] {
		display: none;
	}

	.user-profile {
		display: flex;
		align-items: center;
		gap: 16px;
	}

	.user-avatar {
		width: 56px;
		height: 56px;
		border-radius: 50%;
		background: #3b48cc;
		color: #fff;
		font-size: 1.1rem;
		font-weight: 800;
		font-family: system-ui, sans-serif;
		letter-spacing: 0.02em;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
	}

	.user-name {
		font-size: 2.4rem;
		font-weight: 900;
		line-height: 1.1;
		letter-spacing: -0.04em;
	}

	.user-subtitle {
		font-size: 1rem;
		color: var(--text);
		opacity: 0.6;
		margin-top: 5px;
		font-weight: 600;
	}

	.back-button {
		padding: 10px 14px;
		border: 1px solid var(--panel-strong);
		border-radius: 999px;
		background: #fff;
		color: var(--text);
		font-family: inherit;
		font-size: 0.95rem;
		font-weight: 700;
		white-space: nowrap;
		cursor: pointer;
		flex-shrink: 0;
	}

	.back-button:hover {
		background: #f7f7f7;
	}

	/* Stats boxes */
	.user-stats {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 12px;
		margin-bottom: 20px;
	}

	.user-stats[hidden] {
		display: none;
	}

	.stat-box {
		background: #fff;
		border: 1px solid var(--panel-border);
		border-radius: 14px;
		padding: 18px 22px;
	}

	.stat-box--primary {
		background: #eef0f8;
		border-color: #cdd0ea;
	}

	.stat-label {
		font-size: 0.7rem;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		color: var(--muted);
		font-weight: 700;
		margin-bottom: 8px;
		font-family: system-ui, sans-serif;
	}

	.stat-value {
		font-size: 2.4rem;
		font-weight: 900;
		line-height: 1;
		letter-spacing: -0.04em;
	}

	/* Table */
	.error {
		min-height: 1.5em;
		margin: 0 0 14px;
		color: #8a1f11;
		font-size: 0.95rem;
		line-height: 1.5;
	}

	.error[hidden] {
		display: none;
	}

	.table-wrap {
		overflow: hidden;
		border-radius: 18px;
		border: 1px solid var(--panel-strong);
		background: #fff;
	}

	.sort-bar {
		display: flex;
		align-items: center;
		gap: 6px;
		padding: 12px 16px 0;
		flex-wrap: wrap;
	}

	.sort-label {
		font-family: system-ui, sans-serif;
		font-size: 0.72rem;
		font-weight: 800;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		color: var(--muted);
		margin-right: 2px;
	}

	.sort-btn {
		padding: 5px 14px;
		border-radius: 999px;
		border: 1px solid var(--panel-strong);
		background: #fff;
		color: var(--text);
		font-family: system-ui, sans-serif;
		font-size: 0.8rem;
		font-weight: 700;
		cursor: pointer;
	}

	.sort-btn:hover { background: #f5f5f5; }

	.sort-btn--active {
		background: var(--accent);
		color: #fff;
		border-color: var(--accent);
	}

	table {
		width: 100%;
		border-collapse: separate;
		border-spacing: 0;
	}

	thead th {
		position: sticky;
		top: 0;
		background: #fff;
		z-index: 1;
	}

	th,
	td {
		padding: 14px 18px;
		border-bottom: 1px solid rgba(20, 20, 20, 0.08);
		text-align: center;
		vertical-align: middle;
		font-size: 0.95rem;
	}

	th {
		font-size: 0.72rem;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		color: var(--muted);
		font-weight: 800;
		font-family: system-ui, sans-serif;
	}

	tbody tr {
		transition: background-color 160ms ease;
	}

	tbody tr:nth-child(even) td {
		background: rgba(36, 87, 214, 0.02);
	}

	tbody tr:hover td {
		background: rgba(36, 87, 214, 0.05);
	}

	tbody tr:last-child td {
		border-bottom: 0;
	}

	td:first-child,
	th:first-child {
		width: 96px;
		font-variant-numeric: tabular-nums;
	}

	td.score {
		font-variant-numeric: tabular-nums;
		font-weight: 800;
	}

	.name-button {
		padding: 0;
		border: 0;
		background: transparent;
		color: var(--accent);
		font: inherit;
		font-weight: 700;
		cursor: pointer;
		text-align: center;
	}

	.name-button:hover {
		text-decoration: underline;
	}

	td.empty {
		font-style: italic;
		color: var(--muted);
	}

	.rank-tied {
		font-size: 0.88rem;
		font-weight: 700;
		color: var(--muted);
		letter-spacing: -0.01em;
	}

	/* Match detail table */
	.match-table .col-home {
		text-align: right;
		width: 28%;
		padding-right: 10px;
	}

	.match-table .col-away {
		text-align: left;
		width: 28%;
		padding-left: 10px;
	}

	.match-table .col-num {
		text-align: center;
		width: 110px;
		font-variant-numeric: tabular-nums;
		font-weight: 700;
	}

	.match-table .col-pts {
		text-align: center;
		width: 80px;
	}

	/* Points badges */
	.pts-badge {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 3px 11px;
		border-radius: 999px;
		font-size: 0.82rem;
		font-weight: 700;
		font-family: system-ui, sans-serif;
		letter-spacing: 0;
	}

	.pts-badge--exact {
		background: var(--accent);
		color: #fff;
	}

	.pts-badge--correct {
		background: #e8a020;
		color: #fff;
	}

	.pts-badge--wrong {
		background: #fdf2f2;
		color: #c0392b;
		border: 1px solid #f5c6c6;
	}

	.pts-badge--pending {
		background: transparent;
		color: var(--muted);
		font-size: 0.9rem;
	}

	/* Trend badges — table-predictions per-team over/under-performance indicator
	   (#screen-table-leaderboard only). Green = team's current actual position is
	   the same as or better than the user's prediction (team overperforming the
	   guess); red = team currently worse than predicted. */
	.trend-badge {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 4px;
		padding: 3px 11px;
		border-radius: 999px;
		font-size: 0.82rem;
		font-weight: 700;
		font-family: system-ui, sans-serif;
		white-space: nowrap;
	}

	.trend-badge--up {
		background: #e6f4ea;
		color: #1a7a4a;
		border: 1px solid #b8e0c4;
	}

	.trend-badge--down {
		background: #fdf2f2;
		color: #c0392b;
		border: 1px solid #f5c6c6;
	}

	.trend-badge--exact {
		background: var(--accent);
		color: #fff;
	}

	/* League user profile panel */
	.profile-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 24px;
	}

	.profile-name {
		font-size: 2.4rem;
		font-weight: 900;
		line-height: 1.1;
		letter-spacing: -0.04em;
		margin: 0;
		text-align: left;
		width: auto;
	}

	.profile-stats {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 12px;
		margin-bottom: 20px;
	}

	.week-nav-bar {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 16px;
		margin-bottom: 20px;
		padding: 14px;
		background: #fff;
		border: 1px solid var(--panel-strong);
		border-radius: 14px;
	}

	.week-nav-btn {
		width: 40px;
		height: 40px;
		border-radius: 50%;
		border: 1px solid var(--panel-strong);
		background: #fff;
		color: var(--text);
		font-family: system-ui, sans-serif;
		font-size: 1.1rem;
		font-weight: 700;
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		transition: background 140ms, color 140ms, border-color 140ms;
	}

	.week-nav-btn:hover:not(:disabled) {
		background: var(--accent);
		color: #fff;
		border-color: var(--accent);
	}

	.week-nav-btn:disabled {
		opacity: 0.3;
		cursor: default;
	}

	.week-progress {
		font-family: system-ui, sans-serif;
		font-size: 1rem;
		font-weight: 700;
		letter-spacing: -0.01em;
		color: var(--text);
		min-width: 140px;
		text-align: center;
	}

	@media (max-width: 720px) {
		.page {
			width: min(100%, calc(100% - 20px));
			padding-top: 12px;
		}

		h1 {
			font-size: clamp(2rem, 10vw, 3rem);
		}

		.user-name {
			font-size: 1.6rem;
		}

		.user-stats {
			grid-template-columns: 1fr;
		}

		.profile-stats {
			grid-template-columns: repeat(2, 1fr);
		}

		.profile-name {
			font-size: 1.6rem;
		}

		.user-header {
			flex-wrap: wrap;
			gap: 12px;
		}

		.table-wrap {
			overflow-x: auto;
		}

		table {
			min-width: 580px;
		}
	}
}
