/* Tennis API Hub widgets
   Palette: navy var(--tah-dark, #0b2a5b), court blue var(--tah-primary, #2e6db4), green var(--tah-win, #3e7c4a), ball var(--tah-accent, #d8e64a) */

.tah-widget,
.tah-widget * {
	box-sizing: border-box;
}

.tah-widget {
	position: relative;
	border: 1px solid #d7e0ee;
	border-radius: 12px;
	overflow: hidden;
	margin: 1.5em 0;
	background: #ffffff;
	font-size: 15px;
	line-height: 1.45;
	box-shadow: 0 1px 3px color-mix(in srgb, var(--tah-dark, #0b2a5b) 6%, transparent);
}

/* Title bar: works whether it is an h2, h3, h4, or p */
.tah-widget .tah-title {
	display: flex;
	align-items: center;
	gap: 10px;
	background: linear-gradient(135deg, var(--tah-dark, #0b2a5b) 0%, var(--tah-dark-2, #143a75) 100%);
	color: #ffffff;
	font-weight: 700;
	margin: 0;
	padding: 13px 16px;
	font-size: 17px;
	letter-spacing: 0.02em;
	border-bottom: 3px solid var(--tah-accent, #d8e64a);
}

.tah-widget .tah-title::before {
	content: "";
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--tah-accent, #d8e64a);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--tah-accent, #d8e64a) 25%, transparent);
}

.tah-body {
	padding: 10px 12px;
}

.tah-credit {
	padding: 8px 16px;
	font-size: 12px;
	color: #5a6b84;
	background: #f4f7fb;
	border-top: 1px solid #e3eaf4;
}

/* ---- Match cards ---- */

.tah-match {
	border: 1px solid #e3eaf4;
	border-radius: 8px;
	margin: 8px 0;
	overflow: hidden;
	transition: border-color 0.15s ease;
}

.tah-match:hover {
	border-color: var(--tah-primary, #2e6db4);
}

.tah-match-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	background: #eef3fa;
	padding: 6px 12px;
	font-size: 13px;
}

.tah-tournament {
	color: var(--tah-dark, #0b2a5b);
	font-weight: 600;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tah-badge {
	flex: none;
	font-size: 12px;
	font-weight: 600;
	color: #40506a;
	padding: 2px 9px;
	border-radius: 999px;
	background: #ffffff;
	border: 1px solid #d7e0ee;
	white-space: nowrap;
}

.tah-badge time {
	font: inherit;
	color: inherit;
}

.tah-badge-live {
	background: var(--tah-win, #3e7c4a);
	border-color: var(--tah-win, #3e7c4a);
	color: #ffffff;
}

.tah-badge-live::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--tah-accent, #d8e64a);
	margin-right: 6px;
	animation: tah-pulse 1.4s infinite;
}

.tah-badge-done {
	background: var(--tah-dark, #0b2a5b);
	border-color: var(--tah-dark, #0b2a5b);
	color: #ffffff;
}

@keyframes tah-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
	.tah-badge-live::before { animation: none; }
	.tah-match { transition: none; }
}

.tah-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 12px;
	gap: 10px;
}

.tah-row + .tah-row {
	border-top: 1px dashed #e3eaf4;
}

.tah-player {
	color: #1c2b42;
	flex: 1 1 auto;
	min-width: 0; /* required for ellipsis inside flex */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tah-won .tah-player {
	font-weight: 700;
	color: var(--tah-dark, #0b2a5b);
}

.tah-sets {
	display: inline-flex;
	gap: 7px;
	flex: none;
	flex-wrap: nowrap;
	justify-content: flex-end;
}

.tah-set {
	min-width: 24px;
	text-align: center;
	background: #eef3fa;
	color: var(--tah-dark, #0b2a5b);
	border-radius: 4px;
	padding: 2px 4px;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	font-size: 13px;
}

.tah-won .tah-set {
	background: var(--tah-primary, #2e6db4);
	color: #ffffff;
}

/* ---- Rankings table ---- */

.tah-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

table.tah-rankings {
	width: 100%;
	border-collapse: collapse;
	margin: 4px 0;
}

table.tah-rankings caption {
	caption-side: top;
	text-align: left;
	font-weight: 700;
	color: var(--tah-dark, #0b2a5b);
	padding: 6px 4px;
}

table.tah-rankings th {
	background: var(--tah-primary, #2e6db4);
	color: #ffffff;
	text-align: left;
	padding: 8px 10px;
	font-size: 13px;
}

table.tah-rankings td {
	padding: 7px 10px;
	border-bottom: 1px solid #e3eaf4;
}

table.tah-rankings tbody tr:nth-child(even) {
	background: #f4f7fb;
}

table.tah-rankings tbody tr:hover {
	background: #eef3fa;
}

.tah-rk, .tah-pts {
	text-align: right !important;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.tah-country {
	color: #5a6b84;
	font-size: 13px;
}

/* ---- Bracket / draw ---- */

.tah-round {
	margin: 10px 0 18px;
}

.tah-round-label {
	font-weight: 700;
	color: #ffffff;
	background: var(--tah-primary, #2e6db4);
	padding: 6px 12px;
	border-radius: 6px;
	display: inline-block;
	font-size: 13px;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	margin-bottom: 8px;
	border-left: 4px solid var(--tah-accent, #d8e64a);
}

.tah-tie {
	border: 1px solid #e3eaf4;
	border-radius: 8px;
	margin: 6px 0;
	overflow: hidden;
	transition: border-color 0.15s ease;
}

.tah-tie:hover {
	border-color: var(--tah-primary, #2e6db4);
}

.tah-tie-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	padding: 7px 12px;
}

.tah-tie-row + .tah-tie-row {
	border-top: 1px dashed #e3eaf4;
}

.tah-tie-row.tah-won {
	background: #f2f7f0;
}

.tah-tie-row.tah-won .tah-player {
	font-weight: 700;
	color: var(--tah-dark, #0b2a5b);
}

.tah-tie-row.tah-won .tah-set {
	background: var(--tah-win, #3e7c4a);
	color: #ffffff;
}

/* Two-column bracket rounds on wide screens; single column on phones */
@media (min-width: 700px) {
	.tah-round-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 0 12px;
	}
	.tah-round-grid .tah-tie {
		margin: 6px 0;
	}
}

.tah-notice {
	padding: 14px 12px;
	color: #40506a;
	background: #f4f7fb;
	border-radius: 8px;
	margin: 8px 0;
}

/* ---- Small screens ---- */

@media (max-width: 480px) {
	.tah-widget { font-size: 14px; border-radius: 10px; }
	.tah-widget .tah-title { font-size: 15px; padding: 11px 12px; }
	.tah-body { padding: 8px; }
	.tah-set { min-width: 20px; font-size: 12px; }
	.tah-row, .tah-tie-row { padding: 7px 10px; }
	table.tah-rankings th, table.tah-rankings td { padding: 6px 8px; font-size: 13px; }
}

/* ---- ESPN-style bracket tree ---- */

.tah-hidden { display: none !important; }

.tah-draw-picker {
	margin: 4px 0 10px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.tah-draw-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--tah-dark, #0b2a5b);
}

.tah-draw-select {
	border: 1px solid #d7e0ee;
	border-radius: 999px;
	padding: 5px 14px;
	font-size: 13px;
	color: var(--tah-dark, #0b2a5b);
	background: #ffffff;
}

.tah-tree-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 4px 0 10px;
}

.tah-tree-tab {
	border: 1px solid #d7e0ee;
	background: #eef3fa;
	color: var(--tah-dark, #0b2a5b);
	font-size: 13px;
	font-weight: 600;
	padding: 5px 14px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.tah-tree-tab:hover {
	background: var(--tah-primary, #2e6db4);
	color: #ffffff;
}

.tah-tree-tab.is-active {
	background: var(--tah-dark, #0b2a5b);
	color: #ffffff;
	border-color: var(--tah-dark, #0b2a5b);
	box-shadow: inset 0 -3px 0 var(--tah-accent, #d8e64a);
}

.tah-tree-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 8px;
}

.tah-tree {
	display: flex;
	align-items: stretch;
	min-width: max-content;
}

.tah-tree-round {
	display: flex;
	flex-direction: column;
	width: 230px;
	flex: none;
	padding-right: 28px; /* room for connector elbows */
}

.tah-tree-round-name {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #5a6b84;
	padding: 4px 2px 8px;
}

.tah-tree-col {
	display: flex;
	flex-direction: column;
	flex: 1;
}

/* Each pair evenly shares the column height; two matches sit at 25% and 75%,
   so the connector elbow aligns exactly with the next round's match center. */
.tah-tree-pair {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
	position: relative;
}

.tah-tree-pair:not(.tah-tree-pair-single)::after {
	content: "";
	position: absolute;
	right: -16px;
	top: 25%;
	bottom: 25%;
	width: 14px;
	border: 2px solid #c9d6e8;
	border-left: none;
	border-radius: 0 8px 8px 0;
}

.tah-tree-pair-single {
	justify-content: center;
}

.tah-tree-match {
	position: relative;
	background: #ffffff;
	border: 1px solid #e3eaf4;
	border-radius: 8px;
	box-shadow: 0 1px 2px color-mix(in srgb, var(--tah-dark, #0b2a5b) 5%, transparent);
	margin: 6px 0;
	transition: border-color 0.15s ease;
}

.tah-tree-match:hover {
	border-color: var(--tah-primary, #2e6db4);
}

/* Inbound stub from previous round's elbow */
.tah-tree-in::before {
	content: "";
	position: absolute;
	left: -16px;
	top: 50%;
	width: 14px;
	height: 2px;
	background: #c9d6e8;
}

/* When a tab hides earlier rounds, the new first column drops its stubs */
.tah-tree-first .tah-tree-in::before {
	display: none;
}

.tah-tree-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	min-height: 30px;
}

.tah-tree-row + .tah-tree-row {
	border-top: 1px dashed #e3eaf4;
}

.tah-tree-row .tah-player {
	font-size: 13px;
}

.tah-tree-row.tah-won .tah-player {
	font-weight: 700;
	color: var(--tah-dark, #0b2a5b);
}

.tah-tree-row.tah-won .tah-set {
	background: var(--tah-win, #3e7c4a);
	color: #ffffff;
}

.tah-seed {
	color: #5a6b84;
	font-size: 11px;
}

.tah-tree-date {
	font-size: 11px;
	color: #8a97ab;
	padding: 3px 10px 5px;
	border-top: 1px solid #f0f4f9;
}

.tah-tree-done .tah-tree-date {
	color: #5a6b84;
}

@media (max-width: 480px) {
	.tah-tree-round { width: 200px; padding-right: 24px; }
	.tah-tree-tab { font-size: 12px; padding: 4px 11px; }
}

/* ---- Live update flash ---- */

@keyframes tah-flash {
	0%, 55% {
		background-color: var(--tah-accent, #d8e64a);
		color: var(--tah-dark, #0b2a5b);
		box-shadow: 0 0 0 3px color-mix(in srgb, var(--tah-accent, #d8e64a) 45%, transparent);
	}
	100% {
		box-shadow: 0 0 0 0 color-mix(in srgb, var(--tah-accent, #d8e64a) 0%, transparent);
	}
}

.tah-set.tah-flash,
.tah-badge.tah-flash {
	animation: tah-flash 1.5s ease-out 2;
}

@media (prefers-reduced-motion: reduce) {
	.tah-set.tah-flash,
	.tah-badge.tah-flash {
		animation: none;
		outline: 2px solid var(--tah-accent, #d8e64a); /* still visibly marked, without motion */
	}
}

/* ---- Show More button and hidden rankings rows ---- */

.tah-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

tr.tah-row-hidden {
	display: none;
}

.tah-more-btn {
	display: block;
	width: 100%;
	margin: 10px 0 4px;
	padding: 10px 16px;
	background: var(--tah-dark, #0b2a5b);
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background 0.15s ease;
	box-shadow: inset 0 -3px 0 var(--tah-accent, #d8e64a);
}

.tah-more-btn:hover {
	background: var(--tah-primary, #2e6db4);
}

.tah-more-count {
	font-weight: 400;
	opacity: 0.8;
	font-size: 13px;
}

/* ---- Rankings: movement column, flags, Men/Women tabs ---- */

.tah-mvcol {
	width: 44px;
	text-align: center !important;
	white-space: nowrap;
}

.tah-mv {
	font-size: 11px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.tah-mv-up { color: var(--tah-win, #3e7c4a); }
.tah-mv-down { color: #b3413a; }
.tah-mv-flat { color: #b6c1d1; }

.tah-flag {
	font-size: 15px;
	line-height: 1;
}

.tah-rank-tabs {
	display: flex;
	border-bottom: 2px solid #e3eaf4;
	margin: 2px 0 10px;
}

.tah-rank-tab {
	flex: 1;
	background: none;
	border: none;
	padding: 10px 8px;
	font-size: 14px;
	font-weight: 700;
	color: #8a97ab;
	cursor: pointer;
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.tah-rank-tab:hover {
	color: var(--tah-primary, #2e6db4);
}

.tah-rank-tab.is-active {
	color: var(--tah-dark, #0b2a5b);
	border-bottom-color: var(--tah-accent, #d8e64a);
}

@media (max-width: 480px) {
	.tah-mvcol { width: 36px; }
	.tah-mv { font-size: 10px; }
}

.tah-updated {
	font-size: 12px;
	color: #8a97ab;
	font-style: italic;
	padding: 6px 2px 0;
}

/* ---- Heading resets (round names are h3 for SEO; themes must not restyle) ---- */

h3.tah-tree-round-name,
h3.tah-round-label {
	margin: 0;
	line-height: 1.3;
	font-family: inherit;
}

h3.tah-tree-round-name {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #5a6b84;
	padding: 4px 2px 8px;
}

h3.tah-round-label {
	margin-bottom: 8px;
}

/* ---- Print stylesheet ---- */

@media print {
	/* Reveal everything: full rankings, both tour panels, all rounds */
	tr.tah-row-hidden { display: table-row !important; }
	.tah-hidden { display: block !important; }
	[data-tah-rt-panel] { page-break-before: auto; }

	/* Label each panel comes from its sr-only caption, restore it in print */
	@page { margin: 1.5cm; }
	.tah-sr-only {
		position: static;
		width: auto;
		height: auto;
		margin: 0;
		clip: auto;
		white-space: normal;
		font-weight: 700;
		padding: 8px 0 4px;
	}

	/* Hide interactive chrome: buttons, tabs, pickers */
	.tah-more-btn,
	.tah-rank-tabs,
	.tah-tree-tabs,
	.tah-draw-picker { display: none !important; }
	.tah-topbar { display: none !important; }

	/* Bracket: let columns wrap instead of clipping in a scroll container */
	.tah-tree-scroll { overflow: visible !important; }
	.tah-tree { flex-wrap: wrap; }
	.tah-tree-round { page-break-inside: avoid; }

	/* No animations or shadows on paper */
	.tah-widget { box-shadow: none; }
	.tah-badge-live::before { animation: none !important; }
	.tah-match, .tah-tie, .tah-tree-match { page-break-inside: avoid; }
}

/* ---- Theme-conflict armor for buttons and tabs ----
   Many themes style all button elements globally with their own background
   and text colors, which can leave our button text invisible (same color as
   its background). These rules pin the plugin's palette. */

.tah-widget .tah-more-btn {
	background: var(--tah-dark, #0b2a5b) !important;
	color: #ffffff !important;
	border: none !important;
	text-decoration: none !important;
	text-transform: none !important;
	box-shadow: inset 0 -3px 0 var(--tah-accent, #d8e64a) !important;
}

.tah-widget .tah-more-btn:hover,
.tah-widget .tah-more-btn:focus {
	background: var(--tah-primary, #2e6db4) !important;
	color: #ffffff !important;
}

.tah-widget .tah-more-btn .tah-more-count {
	color: #ffffff !important;
}

.tah-widget .tah-rank-tab {
	background: transparent !important;
	color: #8a97ab !important;
	border: none !important;
	border-bottom: 3px solid transparent !important;
	text-transform: none !important;
	box-shadow: none !important;
}

.tah-widget .tah-rank-tab:hover,
.tah-widget .tah-rank-tab:focus {
	color: var(--tah-primary, #2e6db4) !important;
	background: transparent !important;
}

.tah-widget .tah-rank-tab.is-active {
	color: var(--tah-dark, #0b2a5b) !important;
	border-bottom-color: var(--tah-accent, #d8e64a) !important;
}

.tah-widget .tah-tree-tab {
	background: #eef3fa !important;
	color: var(--tah-dark, #0b2a5b) !important;
	border: 1px solid #d7e0ee !important;
	text-transform: none !important;
	box-shadow: none !important;
}

.tah-widget .tah-tree-tab:hover,
.tah-widget .tah-tree-tab:focus {
	background: var(--tah-primary, #2e6db4) !important;
	color: #ffffff !important;
}

.tah-widget .tah-tree-tab.is-active {
	background: var(--tah-dark, #0b2a5b) !important;
	color: #ffffff !important;
	border-color: var(--tah-dark, #0b2a5b) !important;
	box-shadow: inset 0 -3px 0 var(--tah-accent, #d8e64a) !important;
}

/* ---- ESPN-style header labels ---- */

table.tah-rankings th {
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: 12px;
}

table.tah-rankings th.tah-mvcol {
	text-align: center !important;
	font-size: 13px;
}

/* ESPN-style seed: small gray number before the player name */
.tah-tree-row .tah-seed {
	color: #8a97ab;
	font-size: 11px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.tah-tree-row .tah-flag {
	font-size: 14px;
}

/* ---- Events-built tree: no connector lines (feed order unknown) ---- */

.tah-tree-noline .tah-tree-pair:not(.tah-tree-pair-single)::after,
.tah-tree-noline .tah-tree-in::before {
	display: none;
}

.tah-tree-noline .tah-tree-round {
	padding-right: 14px;
}

/* Doubles pairs: two stacked lines per side, ESPN style */
.tah-pair-name {
	display: block;
	line-height: 1.35;
}

/* Venue under the Championship heading */
.tah-venue {
	font-size: 11px;
	color: #8a97ab;
	margin: -4px 2px 6px;
}

/* ESPN-style in-card Championship header */
.tah-tree-final-head {
	padding: 8px 10px 6px;
	border-bottom: 1px solid #f0f4f9;
}

.tah-tree-final-head strong {
	display: block;
	font-size: 14px;
	color: var(--tah-dark, #0b2a5b);
}

.tah-tree-final-head .tah-venue {
	display: block;
	margin: 1px 0 0;
	font-size: 11px;
	color: #8a97ab;
}

/* ==================================================================== */
/* ESPN-style top bar: pill controls, right-aligned                     */
/* ==================================================================== */

.tah-topbar {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin: 0 0 12px;
}

.tah-widget .tah-pill {
	display: inline-flex;
	align-items: center;
	border: 1px solid #d7dee8;
	border-radius: 999px;
	background: #fff;
	padding: 6px 14px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--tah-dark, #0b2a5b);
	white-space: nowrap;
}

.tah-widget .tah-pill-select {
	padding: 0;
	cursor: pointer;
}

.tah-widget .tah-pill-select select.tah-draw-select {
	border: 0 !important;
	margin: 0;
	background-color: transparent !important;
	font: inherit;
	color: inherit;
	padding: 6px 30px 6px 14px;
	border-radius: 999px;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%232E6DB4' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	cursor: pointer;
}

.tah-widget .tah-pill-select select.tah-draw-select:focus {
	outline: 2px solid var(--tah-primary, #2e6db4);
	outline-offset: 1px;
}

/* ==================================================================== */
/* Responsive: phones and small tablets                                 */
/* ==================================================================== */

.tah-tree-tabs {
	flex-wrap: nowrap;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
}

.tah-tree-tabs::-webkit-scrollbar {
	display: none;
}

@media ( max-width: 640px ) {
	.tah-topbar {
		justify-content: flex-start;
		gap: 6px;
	}

	.tah-widget .tah-pill {
		font-size: 11px;
		padding: 5px 11px;
	}

	.tah-widget .tah-pill-select select.tah-draw-select {
		padding: 5px 26px 5px 11px;
	}

	.tah-tree-round {
		min-width: 208px;
		padding-right: 12px;
	}

	.tah-tree-match {
		min-width: 190px;
	}

	.tah-tree-row .tah-player {
		font-size: 12px;
	}

	.tah-tree-date {
		font-size: 10px;
	}

	.tah-tree-tab {
		font-size: 11px;
		padding: 6px 12px;
	}
}

/* Gray placeholder flag disc for undecided slots, ESPN style */
.tah-tree-row .tah-flag-tbd {
	display: inline-block;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #d8dee6;
	vertical-align: -2px;
}

/* Real flag images (ESPN-style rectangles) */
.tah-widget .tah-flagimg {
	width: 16px;
	height: 12px;
	border-radius: 2px;
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--tah-dark, #0b2a5b) 8%, transparent);
	vertical-align: -1px;
	display: inline-block;
}

.tah-tree-date time {
	white-space: nowrap;
}

/* Finished matches: ESPN-style "Final" label */
.tah-tree-date .tah-final-label {
	font-weight: 700;
	color: var(--tah-win, #3e7c4a);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* Per-set scores with tiebreak superscripts, ESPN style */
.tah-tree-row .tah-sets {
	display: inline-flex;
	gap: 7px;
	font-variant-numeric: tabular-nums;
	font-size: 12px;
	font-weight: 600;
	color: #33415c;
	margin-left: 8px;
	white-space: nowrap;
}

.tah-tree-row .tah-sets .tah-set {
	position: relative;
}

.tah-tree-row .tah-sets sup {
	font-size: 8px;
	line-height: 0;
	margin-left: 1px;
}

/* Doubles: one flag per player line */
.tah-pair-line {
	display: block;
	line-height: 1.5;
}

/* Losing side dims on finished matches, winner stays bold */
.tah-tree-done .tah-tree-row:not(.tah-won) .tah-player,
.tah-tree-done .tah-tree-row:not(.tah-won) .tah-sets {
	color: #8a97ab;
}

/* ==================================================================== */
/* ESPN finished-card polish                                            */
/* ==================================================================== */

/* "Final" sits at the top of the card, like ESPN */
.tah-tree-status {
	padding: 7px 10px 0;
	font-size: 10px;
}

/* Set scores as plain bold numbers, not chips */
.tah-tree-row .tah-sets .tah-set {
	background: none !important;
	border: 0 !important;
	padding: 0 !important;
	min-width: 0 !important;
	color: inherit;
	font-weight: 700;
	border-radius: 0;
}

/* Order-of-play round headings */
.tah-widget .tah-oop-round {
	margin: 14px 2px 8px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #55627a;
}

/* ==================================================================== */
/* Official-style live scoreboard                                       */
/* ==================================================================== */

.tah-badge-live .tah-live-dot {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #e0342f;
	margin-right: 6px;
	vertical-align: 1px;
	animation: tah-pulse 1.4s ease-in-out infinite;
}

@keyframes tah-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.35; }
}

.tah-row .tah-score-cells {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-variant-numeric: tabular-nums;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.tah-row .tah-score-cells .tah-set {
	background: none;
	border: 0;
	padding: 0;
	min-width: 14px;
	text-align: center;
	color: #55627a;
}

.tah-row .tah-score-cells .tah-set sup {
	font-size: 8px;
	line-height: 0;
	margin-left: 1px;
}

/* The set being played right now stands out */
.tah-row .tah-score-cells .tah-set-cur {
	color: var(--tah-dark, #0b2a5b);
	font-weight: 800;
}

/* Current game points: ball-yellow chip like the official scoreboard */
.tah-row .tah-point {
	background: var(--tah-accent, #d8e64a);
	color: var(--tah-dark, #0b2a5b);
	border-radius: 4px;
	padding: 1px 6px;
	font-size: 12px;
	font-weight: 800;
	min-width: 22px;
	text-align: center;
}

.tah-row .tah-win-tick {
	color: var(--tah-win, #3e7c4a);
	font-weight: 800;
}

.tah-row.tah-won .tah-score-cells .tah-set {
	color: #1d2b45;
}

@media ( prefers-reduced-motion: reduce ) {
	.tah-badge-live .tah-live-dot { animation: none; }
}

/* ==================================================================== */
/* Scoreboard grid, won sets, winner arrow, day navigation              */
/* ==================================================================== */

.tah-score-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	align-items: start;
	margin-bottom: 6px;
}

@media ( max-width: 720px ) {
	.tah-score-grid {
		grid-template-columns: 1fr;
	}
}

.tah-score-grid .tah-match {
	margin: 0;
}

/* Won sets bold and dark; lost sets stay light (both official sites) */
.tah-row .tah-score-cells .tah-set-won,
.tah-tree-row .tah-sets .tah-set-won {
	color: var(--tah-dark, #0b2a5b);
	font-weight: 800;
}

/* ESPN-style winner arrow */
.tah-row .tah-win-tick {
	color: var(--tah-dark, #0b2a5b);
	font-size: 10px;
}

/* Day navigation pills */
.tah-daynav {
	display: flex;
	gap: 8px;
	margin: 0 0 12px;
	flex-wrap: wrap;
}

.tah-widget .tah-daynav .tah-pill {
	text-decoration: none;
	cursor: pointer;
}

.tah-widget .tah-daynav .tah-pill-active {
	background: var(--tah-dark, #0b2a5b);
	border-color: var(--tah-dark, #0b2a5b);
	color: #fff;
}

/* ==================================================================== */
/* Results calendar strip, ESPN scoreboard style: text-only days with an  */
/* underline on the selected one                                          */
/* ==================================================================== */

.tah-calwrap {
	display: flex;
	align-items: stretch;
	border: 0;
	border-bottom: 1px solid #e4e9f0;
	background: none;
	margin: 0 0 2px;
}

.tah-calnav {
	display: flex;
	flex: 1 1 auto;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
}

.tah-calnav::-webkit-scrollbar {
	display: none;
}

.tah-widget .tah-cal-pill {
	position: relative;
	display: grid;
	grid-template-columns: auto auto;
	grid-template-rows: auto auto;
	column-gap: 4px;
	justify-content: center;
	align-content: center;
	min-width: 66px;
	padding: 9px 12px 11px;
	background: none;
	border: 0;
	text-decoration: none;
	line-height: 1.25;
	flex: 0 0 auto;
	box-sizing: border-box;
}

.tah-widget .tah-cal-dow {
	grid-column: 1 / 3;
	grid-row: 1;
	justify-self: center;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #8a97ab;
}

.tah-widget .tah-cal-mon {
	grid-column: 1;
	grid-row: 2;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	color: #8a97ab;
	align-self: center;
}

.tah-widget .tah-cal-day {
	grid-column: 2;
	grid-row: 2;
	font-size: 11px;
	font-weight: 700;
	color: #8a97ab;
	align-self: center;
}

/* ESPN has no per-day icon */
.tah-widget .tah-cal-ball {
	display: none;
}

.tah-widget a.tah-cal-pill:hover .tah-cal-dow,
.tah-widget a.tah-cal-pill:hover .tah-cal-mon,
.tah-widget a.tah-cal-pill:hover .tah-cal-day {
	color: var(--tah-dark, #0b2a5b);
}

/* Selected day: dark text, brand-yellow underline bar (ESPN's red bar) */
.tah-widget .tah-cal-active .tah-cal-dow,
.tah-widget .tah-cal-active .tah-cal-mon,
.tah-widget .tah-cal-active .tah-cal-day {
	color: var(--tah-dark, #0b2a5b);
}

.tah-widget .tah-cal-active::after {
	content: '';
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 0;
	height: 3px;
	border-radius: 2px;
	background: var(--tah-accent, #d8e64a);
}

.tah-widget .tah-cal-off {
	opacity: 0.45;
}

/* Minimal chevrons */
.tah-widget .tah-cal-arrow {
	flex: 0 0 auto;
	width: 24px;
	border: 0;
	background: none;
	color: var(--tah-primary, #2e6db4);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

.tah-widget .tah-cal-arrow:hover {
	color: var(--tah-dark, #0b2a5b);
}

@media print {
	.tah-calwrap { display: none !important; }
}

.tah-results-sub {
	margin: 0 0 14px;
	padding: 8px 12px;
	background: #f4f6f9;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	color: #1d2b45;
}


/* ==================================================================== */
/* Scoreboard row hard layout: sets stay on ONE line (theme-proof)      */
/* ==================================================================== */

.tah-widget .tah-row {
	display: flex !important;
	flex-wrap: nowrap !important;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 34px;
}

.tah-widget .tah-row .tah-player {
	flex: 1 1 auto;
	min-width: 0;
}

.tah-widget .tah-row .tah-score-cells {
	display: inline-flex !important;
	flex: 0 0 auto;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	white-space: nowrap;
}

.tah-widget .tah-row .tah-score-cells .tah-set,
.tah-widget .tah-row .tah-score-cells .tah-point,
.tah-widget .tah-row .tah-score-cells .tah-win-tick {
	display: inline-block;
	float: none;
}

/* Slim header for cards inside grouped day views (ESPN style) */
.tah-match-head-slim {
	justify-content: flex-end;
	background: none;
	border-bottom: 0;
	padding: 8px 12px 0;
}

/* Finished matches: losing player grays out, winner stays dark */
.tah-match-done .tah-row:not(.tah-won) .tah-player,
.tah-match-done .tah-row:not(.tah-won) .tah-score-cells .tah-set {
	color: #8a97ab;
}

/* Draw filter bar + card round footer (ESPN scores page) */
.tah-filterbar {
	display: flex;
	justify-content: flex-end;
	margin: 0 0 10px;
}

.tah-draw-sec {
	margin: 0 0 4px;
}

.tah-match .tah-match-foot {
	border-top: 1px solid #edf1f6;
	margin-top: 6px;
	padding: 6px 12px 8px;
	font-size: 11px;
	color: #8a97ab;
}

/* Permanent scoreboard filter sits top-right like ESPN */
.tah-filterbar-top {
	margin: 0 0 12px;
}

/* ==================================================================== */
/* Scoreboard header: date range, venue, defending champion, controls    */
/* ==================================================================== */

.tah-sb-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	flex-wrap: wrap;
	margin: 0 0 12px;
}

.tah-sb-range {
	font-size: 14px;
	font-weight: 700;
	color: #1d2b45;
}

.tah-sb-venue {
	font-size: 12px;
	color: #55627a;
	margin-top: 2px;
}

.tah-champ {
	border: 1px solid #d7dee8;
	border-radius: 10px;
	background: #fff;
	padding: 8px 14px;
	display: inline-flex;
	flex-direction: column;
	gap: 2px;
	min-width: 150px;
}

.tah-champ-label {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #8a97ab;
}

.tah-champ-name {
	font-size: 13px;
	font-weight: 700;
	color: var(--tah-dark, #0b2a5b);
}

/* Controls row sits left, ESPN-style */
.tah-filterbar-top {
	justify-content: flex-start;
	gap: 8px;
	align-items: center;
}

/* Round sub-headers inside a draw section (FINAL / SEMIFINAL) */
.tah-widget .tah-round-sub {
	margin: 12px 2px 8px;
	padding-bottom: 4px;
	border-bottom: 1px solid #edf1f6;
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #55627a;
}

/* ==================================================================== */
/* ESPN slim cards: plain Final label top-left, no inner dividers        */
/* ==================================================================== */

.tah-widget .tah-match-head-slim {
	justify-content: flex-start;
	padding: 9px 12px 2px;
}

.tah-widget .tah-match-head-slim .tah-badge {
	background: none;
	border: 0;
	padding: 0;
	border-radius: 0;
	color: #1d2b45;
	font-size: 11px;
	font-weight: 800;
}

.tah-widget .tah-match-head-slim .tah-badge-live {
	color: #e0342f;
}

.tah-widget .tah-match-head-slim time {
	color: #55627a;
	font-weight: 600;
}

.tah-score-grid .tah-row + .tah-row {
	border-top: 0;
}

.tah-score-grid .tah-row {
	padding: 4px 12px;
	min-height: 28px;
}

.tah-score-grid .tah-match .tah-match-foot {
	margin-top: 4px;
}

/* ==================================================================== */
/* Mobile hardening across the whole plugin                             */
/* ==================================================================== */

/* Round tabs: fixed-size, swipeable strip; text never wraps vertically */
.tah-widget .tah-tree-tab {
	flex: 0 0 auto;
	white-space: nowrap;
}

/* Day-nav and top-bar pills keep their shape on narrow screens */
.tah-widget .tah-daynav .tah-pill,
.tah-widget .tah-topbar .tah-pill {
	white-space: nowrap;
	flex: 0 0 auto;
}

.tah-daynav {
	overflow-x: auto;
	flex-wrap: nowrap;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.tah-daynav::-webkit-scrollbar {
	display: none;
}

/* Long tournament names on live cards truncate instead of breaking rows */
.tah-match-head .tah-tournament {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media ( max-width: 640px ) {
	/* Comfortable touch targets for the calendar chevrons */
	.tah-widget .tah-cal-arrow {
		width: 32px;
		font-size: 22px;
	}

	.tah-widget .tah-cal-pill {
		min-width: 60px;
		padding: 8px 9px 10px;
	}

	/* Header stacks cleanly: meta above, champion card below */
	.tah-sb-head {
		flex-direction: column;
		align-items: stretch;
	}

	.tah-champ {
		align-self: flex-start;
	}

	/* Filter row scrolls if the select plus year pill overflow */
	.tah-filterbar-top {
		overflow-x: auto;
		flex-wrap: nowrap;
		scrollbar-width: none;
	}

	.tah-filterbar-top::-webkit-scrollbar {
		display: none;
	}

	/* Compact scoreboard rows on phones */
	.tah-score-grid .tah-row {
		padding: 4px 10px;
	}

	.tah-row .tah-score-cells {
		gap: 6px;
		font-size: 12px;
	}
}

/* ==================================================================== */
/* Ranking Movers of the Week                                           */
/* ==================================================================== */

.tah-movers .tah-mv-row {
	min-height: 30px;
}

.tah-mv-rank {
	display: inline-block;
	min-width: 26px;
	font-weight: 800;
	color: var(--tah-dark, #0b2a5b);
	font-variant-numeric: tabular-nums;
}

.tah-mv-was {
	font-size: 11px;
	color: #8a97ab;
	font-weight: 400;
}

.tah-mv-none {
	padding: 10px 12px;
	font-size: 12px;
	color: #8a97ab;
}

/* ==================================================================== */
/* Seed Tracker                                                         */
/* ==================================================================== */

.tah-seed-sum {
	margin: 2px 2px 10px;
	font-size: 13px;
	font-weight: 700;
	color: var(--tah-win, #3e7c4a);
}

.tah-seed-grid {
	display: grid;
	/* Wide enough for the longest tour names (Etcheverry, Alexandrova)
	   on one line: 4-5 chips per row on desktop instead of 6. */
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 8px;
	margin-bottom: 14px;
}

.tah-seed-chip {
	display: grid;
	grid-template-columns: auto auto 1fr;
	align-items: center;
	column-gap: 6px;
	border: 1px solid #d7dee8;
	border-radius: 8px;
	background: #fff;
	padding: 7px 10px;
	font-size: 13px;
	font-weight: 600;
	color: #1d2b45;
	min-width: 0;
}

.tah-seed-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

.tah-seed-note {
	grid-column: 3;
	font-size: 10px;
	font-weight: 700;
	color: #b0413e;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.tah-seed-out {
	background: #f4f6f9;
	opacity: 0.75;
}

.tah-seed-out .tah-seed-name {
	text-decoration: line-through;
	color: #8a97ab;
	font-weight: 400;
}

.tah-seed-champ {
	border-color: var(--tah-accent, #d8e64a);
	background: #fbfde9;
}

.tah-seed-note-champ {
	color: var(--tah-win, #3e7c4a);
}

/* ==================================================================== */
/* Match of the Day                                                     */
/* ==================================================================== */

.tah-motd {
	border: 1px solid #d7dee8;
	border-left: 4px solid var(--tah-accent, #d8e64a);
	border-radius: 10px;
	background: #fff;
	padding: 12px 12px 6px;
}

.tah-motd-eyebrow {
	font-size: 10px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--tah-primary, #2e6db4);
	margin-bottom: 8px;
}

.tah-motd-billing {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

.tah-motd-name {
	font-size: 17px;
	font-weight: 800;
	color: var(--tah-dark, #0b2a5b);
}

.tah-motd-rank {
	font-size: 11px;
	font-weight: 600;
	color: #8a97ab;
}

.tah-motd-vs {
	font-size: 12px;
	font-weight: 700;
	color: var(--tah-win, #3e7c4a);
	text-transform: uppercase;
}

.tah-motd .tah-match {
	border: 0;
	box-shadow: none;
	margin: 0;
}

/* Upset Alert: red-accented featured cards */
.tah-upset {
	border-left-color: #e0342f;
}

.tah-upset-eyebrow {
	color: #e0342f;
}

.tah-upset-def {
	color: #e0342f;
}

/* ==================================================================== */
/* Champion's Path timeline                                             */
/* ==================================================================== */

.tah-path {
	border: 1px solid #d7dee8;
	border-left: 4px solid var(--tah-primary, #2e6db4);
	border-radius: 10px;
	background: #fff;
	padding: 12px 14px;
}

.tah-path-head {
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid #edf1f6;
}

.tah-path-step {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 0;
	border-bottom: 1px dashed #edf1f6;
}

.tah-path-step:last-of-type {
	border-bottom: 0;
}

.tah-path-round {
	flex: 0 0 auto;
	min-width: 96px;
	font-size: 10px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #55627a;
}

.tah-path-opp {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 13px;
	font-weight: 600;
	color: #1d2b45;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tah-path-result {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.tah-path-chip {
	display: inline-block;
	min-width: 20px;
	text-align: center;
	border-radius: 4px;
	padding: 1px 6px;
	font-size: 11px;
	font-weight: 800;
}

.tah-path-w {
	background: #e4f1e4;
	color: var(--tah-win, #3e7c4a);
}

.tah-path-l {
	background: #fbe9e8;
	color: #b0413e;
}

.tah-path-up {
	background: none;
	color: #55627a;
	font-weight: 600;
	font-size: 11px;
	white-space: nowrap;
}

.tah-path-sets {
	font-size: 12px;
	font-weight: 700;
	color: var(--tah-dark, #0b2a5b);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.tah-path-sets sup {
	font-size: 8px;
}

.tah-path-lost .tah-path-opp {
	color: #8a97ab;
}

.tah-path-note {
	padding: 6px 0 2px;
	font-size: 12px;
	font-weight: 700;
	color: #b0413e;
}

.tah-path-note-champ {
	color: var(--tah-win, #3e7c4a);
}

.tah-path-champ {
	background: #fbfde9;
	border-radius: 6px;
	padding-left: 6px;
	padding-right: 6px;
}

/* ==================================================================== */
/* Player Tracker                                                       */
/* ==================================================================== */

.tah-ptrack {
	border: 1px solid #d7dee8;
	border-left: 4px solid var(--tah-win, #3e7c4a);
	border-radius: 10px;
	background: #fff;
	padding: 12px 14px;
}

.tah-ptrack .tah-motd-eyebrow {
	margin-top: 10px;
}

.tah-ptrack .tah-match {
	border: 0;
	box-shadow: none;
	margin: 0;
}

.tah-form-row {
	display: flex;
	gap: 6px;
	margin: 2px 0 8px;
}

.tah-form-chip {
	display: inline-block;
	min-width: 24px;
	text-align: center;
	border-radius: 5px;
	padding: 3px 0;
	font-size: 12px;
	font-weight: 800;
}

.tah-ptrack-date {
	flex: 0 0 auto;
	font-size: 11px;
	color: #8a97ab;
}

/* Timeline rows on phones: round label gets its own line, the rest wraps */
@media ( max-width: 560px ) {
	.tah-path-step {
		flex-wrap: wrap;
		row-gap: 2px;
	}

	.tah-path-round {
		flex: 1 0 100%;
		min-width: 0;
	}

	.tah-path-opp {
		white-space: normal;
	}

	.tah-motd-name {
		font-size: 15px;
	}
}

/* Automatic champions card: ball-yellow to mark the new title holders */
.tah-champ-new {
	border-color: var(--tah-accent, #d8e64a);
	background: #fbfde9;
}
