/* Political Market Report — market widgets.
   Neutral by design: inherits the theme's fonts and adapts to dark mode. */

.pmr-board,
.pmr-archive,
.pmr-single {
	--pmr-accent: #2563eb;
	--pmr-up: #16a34a;
	--pmr-down: #dc2626;
	--pmr-ink: currentColor;
	/* Opaque fallbacks first: older browsers ignore the color-mix() lines
	   below and keep these, so borders never vanish. */
	--pmr-muted: #6b7280;
	--pmr-line: rgba( 128, 128, 128, 0.28 );
	--pmr-surface: rgba( 128, 128, 128, 0.06 );
	--pmr-grid: rgba( 128, 128, 128, 0.16 );
	font-size: 16px;
	line-height: 1.45;
}

@supports ( color: color-mix( in srgb, currentColor 50%, transparent ) ) {
	.pmr-board,
	.pmr-archive,
	.pmr-single {
		--pmr-muted: color-mix( in srgb, currentColor 60%, transparent );
		--pmr-line: color-mix( in srgb, currentColor 20%, transparent );
		--pmr-surface: color-mix( in srgb, currentColor 5%, transparent );
		--pmr-grid: color-mix( in srgb, currentColor 10%, transparent );
	}
}

/* ── Live board ─────────────────────────────────────────────────────────── */

.pmr-board__heading {
	margin: 0 0 0.75rem;
	font-size: 1.35rem;
}

.pmr-board__grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 260px, 1fr ) );
	gap: 0.85rem;
}

.pmr-board--compact .pmr-board__grid {
	grid-template-columns: repeat( auto-fill, minmax( 200px, 1fr ) );
}

.pmr-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 0.85rem 0.9rem;
	border: 1px solid var( --pmr-line );
	border-radius: 12px;
	background: var( --pmr-surface );
}

.pmr-card__head {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.pmr-chip {
	display: inline-block;
	padding: 0.1rem 0.45rem;
	border: 1px solid var( --pmr-line );
	border-radius: 999px;
	font-size: 0.68rem;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	opacity: 0.85;
}

.pmr-chip--polymarket { border-color: #1652f0; color: #1652f0; }
.pmr-chip--kalshi { border-color: #00b37e; color: #00b37e; }
.pmr-chip--draftkings { border-color: #61a105; color: #61a105; }

.pmr-card__q {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 600;
	line-height: 1.3;
}

.pmr-card__q a {
	color: inherit;
	text-decoration: none;
}

.pmr-card__q a:hover {
	text-decoration: underline;
}

.pmr-card__price {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.pmr-pct {
	font-size: 1.7rem;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.pmr-american {
	font-size: 0.9rem;
	color: var( --pmr-muted );
	font-variant-numeric: tabular-nums;
}

.pmr-move {
	font-size: 0.75rem;
	font-weight: 600;
	padding: 0.05rem 0.4rem;
	border-radius: 999px;
	white-space: nowrap;
}

.pmr-move--up { color: var( --pmr-up ); background: color-mix( in srgb, var( --pmr-up ) 12%, transparent ); }
.pmr-move--down { color: var( --pmr-down ); background: color-mix( in srgb, var( --pmr-down ) 12%, transparent ); }
.pmr-move--flat { color: var( --pmr-muted ); }

.pmr-spark {
	height: 46px;
	position: relative;
}

.pmr-spark__none {
	font-size: 0.72rem;
	color: var( --pmr-muted );
	font-style: italic;
}

.pmr-card__foot {
	display: flex;
	justify-content: space-between;
	gap: 0.5rem;
	font-size: 0.76rem;
	color: var( --pmr-muted );
}

.pmr-board__stamp {
	margin: 0.7rem 0 0;
	font-size: 0.76rem;
	color: var( --pmr-muted );
}

/* ── Ticker ─────────────────────────────────────────────────────────────── */

.pmr-ticker {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 1rem 0;
}

.pmr-ticker__item {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.3rem 0.6rem;
	border: 1px solid var( --pmr-line );
	border-radius: 999px;
	font-size: 0.82rem;
	text-decoration: none;
	color: inherit;
}

.pmr-ticker__item:hover { background: var( --pmr-surface ); }
.pmr-ticker__p { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Chart ──────────────────────────────────────────────────────────────── */

.pmr-chart {
	margin: 1.25rem 0;
	padding: 0.9rem;
	border: 1px solid var( --pmr-line );
	border-radius: 12px;
}

.pmr-chart__cap {
	margin-top: 0.5rem;
	font-size: 0.76rem;
	color: var( --pmr-muted );
	text-align: center;
}

/* ── Archive ────────────────────────────────────────────────────────────── */

.pmr-filters {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 0.9rem;
	border: 1px solid var( --pmr-line );
	border-radius: 12px;
	background: var( --pmr-surface );
	margin-bottom: 1rem;
}

.pmr-filters__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	align-items: flex-end;
}

.pmr-filters__field {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.76rem;
	color: var( --pmr-muted );
	min-width: 140px;
}

.pmr-filters__field--grow { flex: 1 1 240px; }

.pmr-filters__field input,
.pmr-filters__field select {
	font-size: 0.9rem;
	padding: 0.4rem 0.5rem;
	border: 1px solid var( --pmr-line );
	border-radius: 8px;
	background: transparent;
	color: inherit;
	width: 100%;
}

.pmr-filters__actions {
	display: flex;
	gap: 0.4rem;
}

.pmr-btn {
	display: inline-block;
	padding: 0.45rem 0.9rem;
	border-radius: 8px;
	border: 1px solid var( --pmr-accent );
	background: var( --pmr-accent );
	color: #fff;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}

.pmr-btn--ghost {
	background: transparent;
	color: inherit;
	border-color: var( --pmr-line );
}

.pmr-archive__count {
	font-size: 0.82rem;
	color: var( --pmr-muted );
	margin: 0 0 0.5rem;
}

.pmr-table-wrap { overflow-x: auto; }

.pmr-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.88rem;
}

.pmr-table th,
.pmr-table td {
	padding: 0.5rem 0.6rem;
	border-bottom: 1px solid var( --pmr-line );
	text-align: left;
	vertical-align: top;
}

.pmr-table th {
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --pmr-muted );
	white-space: nowrap;
}

.pmr-row__q { min-width: 260px; }
.pmr-row__q a { color: inherit; text-decoration: none; font-weight: 600; }
.pmr-row__q a:hover { text-decoration: underline; }
.pmr-row__pct,
.pmr-row__odds { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pmr-row--settled { opacity: 0.55; }

.pmr-pager {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-top: 1rem;
}

.pmr-pager__pos { font-size: 0.8rem; color: var( --pmr-muted ); }

/* ── Single market ──────────────────────────────────────────────────────── */

.pmr-single__stats {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 120px, 1fr ) );
	gap: 0.6rem;
	margin: 1rem 0;
}

.pmr-stat {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.6rem 0.7rem;
	border: 1px solid var( --pmr-line );
	border-radius: 10px;
}

.pmr-stat__k {
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --pmr-muted );
}

.pmr-stat__v {
	font-size: 1.05rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.pmr-single__link { font-size: 0.88rem; }

/* ── Shared ─────────────────────────────────────────────────────────────── */

.pmr-empty {
	padding: 1rem;
	border: 1px dashed var( --pmr-line );
	border-radius: 10px;
	color: var( --pmr-muted );
	font-size: 0.88rem;
}

@media ( max-width: 600px ) {
	.pmr-board__grid { grid-template-columns: 1fr; }
	.pmr-filters__field { min-width: 100%; }
}

/* ── Comparison grid ─────────────────────────────────────────────────────
   OddsTrader-style board: row per event, column per venue. Dense by design —
   this is a scanning tool, not reading material. */

.pmr-grid {
	--pmr-accent: #1D4ED8;
	--pmr-up: #15803D;
	--pmr-down: #B91C1C;
	--pmr-muted: #5B6472;
	--pmr-line: rgba( 128, 128, 128, 0.28 );
	--pmr-surface: rgba( 128, 128, 128, 0.06 );
	font-size: 16px;
}

@supports ( color: color-mix( in srgb, currentColor 50%, transparent ) ) {
	.pmr-grid {
		--pmr-muted: color-mix( in srgb, currentColor 60%, transparent );
		--pmr-line: color-mix( in srgb, currentColor 20%, transparent );
		--pmr-surface: color-mix( in srgb, currentColor 5%, transparent );
	}
}

.pmr-grid__heading {
	margin: 0 0 0.75rem;
	font-size: 1.35rem;
}

.pmr-grid__controls {
	display: flex;
	flex-wrap: wrap;
	gap: 0.7rem;
	align-items: flex-end;
	padding: 0.7rem 0.85rem;
	border: 1px solid var( --pmr-line );
	border-radius: 10px;
	background: var( --pmr-surface );
	margin-bottom: 0.85rem;
}

.pmr-grid__field {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var( --pmr-muted );
}

.pmr-grid__field select {
	font-size: 0.9rem;
	padding: 0.35rem 0.5rem;
	border: 1px solid var( --pmr-line );
	border-radius: 7px;
	background: transparent;
	color: inherit;
}

.pmr-grid__wrap {
	overflow-x: auto;
	border: 1px solid var( --pmr-line );
	border-radius: 10px;
}

.pmr-grid__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.pmr-grid__table thead th {
	position: sticky;
	top: 0;
	background: var( --pmr-surface );
	backdrop-filter: blur( 6px );
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var( --pmr-muted );
	font-weight: 700;
	padding: 0.55rem 0.7rem;
	text-align: center;
	white-space: nowrap;
	border-bottom: 1px solid var( --pmr-line );
}

.pmr-grid__table thead th.pmr-grid__event { text-align: left; }

.pmr-grid__table tbody tr:not( :last-child ) td,
.pmr-grid__table tbody tr:not( :last-child ) th {
	border-bottom: 1px solid var( --pmr-line );
}

.pmr-grid__table tbody tr:hover { background: var( --pmr-surface ); }

th.pmr-grid__event {
	text-align: left;
	font-weight: 600;
	padding: 0.6rem 0.7rem;
	min-width: 260px;
	max-width: 420px;
}

th.pmr-grid__event a {
	color: inherit;
	text-decoration: none;
	display: block;
	line-height: 1.3;
}

th.pmr-grid__event a:hover { text-decoration: underline; }

.pmr-grid__meta {
	display: block;
	margin-top: 0.2rem;
	font-size: 0.7rem;
	font-weight: 400;
	color: var( --pmr-muted );
}

.pmr-grid__cell {
	text-align: center;
	padding: 0.5rem 0.6rem;
	white-space: nowrap;
	min-width: 96px;
}

.pmr-grid__cell--none { color: var( --pmr-muted ); }

.pmr-grid__price {
	display: flex;
	flex-direction: column;
	gap: 0.05rem;
	text-decoration: none;
	color: inherit;
}

.pmr-grid__pct {
	font-size: 1.05rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.pmr-grid__am {
	font-size: 0.72rem;
	color: var( --pmr-muted );
	font-variant-numeric: tabular-nums;
}

/* Best price highlighting. Cheapest YES is the LOWEST implied probability;
   cheapest NO is the highest. Underlines rather than fills so a cell can
   legitimately be both without turning into mud. */
.pmr-grid__cell.is-best-yes { box-shadow: inset 0 -3px 0 var( --pmr-up ); }
.pmr-grid__cell.is-best-no  { box-shadow: inset 0 3px 0 var( --pmr-down ); }
.pmr-grid__cell.is-best-yes.is-best-no {
	box-shadow: inset 0 -3px 0 var( --pmr-up ), inset 0 3px 0 var( --pmr-down );
}

.pmr-grid__edge { text-align: center; white-space: nowrap; padding: 0.5rem 0.7rem; }

.pmr-edge {
	font-size: 0.85rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var( --pmr-muted );
}

.pmr-edge--wide {
	color: var( --pmr-accent );
	background: rgba( 29, 78, 216, 0.10 );
	border-radius: 999px;
	padding: 0.1rem 0.5rem;
}

.pmr-grid__legend,
.pmr-grid__caveat {
	margin: 0.6rem 0 0;
	font-size: 0.75rem;
	color: var( --pmr-muted );
	line-height: 1.5;
}

.pmr-grid__caveat { font-style: italic; }

.pmr-key {
	display: inline-block;
	width: 14px;
	height: 3px;
	vertical-align: middle;
	margin-right: 0.2rem;
	border-radius: 2px;
}

.pmr-key--yes { background: var( --pmr-up ); }
.pmr-key--no  { background: var( --pmr-down ); }

@media ( max-width: 782px ) {
	.pmr-grid__table { font-size: 0.82rem; }
	th.pmr-grid__event { min-width: 200px; }
	.pmr-grid__cell { min-width: 78px; }
}

/* Race section headers inside the grid — the equivalent of OddsTrader's
   league bands. Sticky under the column headers so you always know which
   race you're looking at while scrolling a long board. */

.pmr-grid__sectionhead th {
	text-align: left;
	padding: 0.5rem 0.7rem;
	background: var( --pmr-accent );
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	border-bottom: 1px solid var( --pmr-line );
}

.pmr-grid__sectioncount {
	display: inline-block;
	margin-left: 0.5rem;
	padding: 0 0.4rem;
	border-radius: 999px;
	background: rgba( 255, 255, 255, 0.22 );
	font-size: 0.68rem;
	font-weight: 600;
}

.pmr-grid__section + .pmr-grid__section .pmr-grid__sectionhead th {
	border-top: 1px solid var( --pmr-line );
}
