/*
 * Tabellen des Optionen-Simulators gegen die globalen Tabellen-Stile schützen.
 *
 * TWtheme stylt jede Tabelle im Beitragsinhalt als „Legacy-Tabelle“
 * (`.entry-content :not(.wp-block-table) > table …`, source/scss/_table.scss):
 * heller Kopf, weiße Zeilen, Rahmen, große Abstände. Diese Selektoren sind
 * spezifischer als die Regeln in ezopt.css (bis 0,3,3 gegen meist 0,2,1).
 *
 * Darum hier zweistufig, mit dem dreifachen .ezopt als Gewicht:
 * 1. Was das Parent setzt, auf den Reset von ezopt.css zurückdrehen.
 * 2. Die Tabellenregeln aus ezopt.css nachziehen, soweit sie Eigenschaften
 *    betreffen, die Stufe 1 oder das Parent anfassen. Werte 1:1 aus ezopt.css —
 *    ändert ezzy dort eine Tabellenregel, hier mitziehen.
 */

:is(.entry-content, .wp-block-post-content) .ezopt.ezopt.ezopt {
	/* ── Stufe 1: Parent-Stile zurücknehmen ── */
	& table {
		overflow: visible;
		margin: 0;
		border: 0;
		border-radius: 0;
		border-collapse: collapse;
		border-spacing: 0;
		background: none;
		width: auto;
		font-size: inherit;
		line-height: inherit;
		color: inherit;
	}
	& tr {
		background: none;
		transition: none;
	}
	& :is(th, td) {
		padding: 0;
		border-bottom: 0;
		vertical-align: middle;
		font-weight: inherit;
	}
	& th {
		background: none;
		color: inherit;
		text-align: left;
	}

	/* ── Stufe 2: Regeln aus ezopt.css ── */

	/* Positionen */
	& .ezopt-legs {
		width: 100%;
		font-size: 0.78rem;
	}
	& .ezopt-legs th {
		padding: 0 6px 6px 0;
		font-weight: 500;
		color: var(--ez-muted);
	}
	& .ezopt-legs td {
		padding: 3px 6px 3px 0;
	}
	@media (min-width: 901px) and (min-height: 620px) and (max-height: 820px) {
		&.ezopt--kompakt .ezopt-legs td {
			padding: 2px 5px 2px 0;
		}
	}
	& .ezopt-legs :is(th, td):last-child {
		padding-right: 0;
	}
	& .ezopt-legs :is(th, td).ezopt-leg-an {
		padding-right: 2px;
		text-align: left;
	}

	/* Ergebnis nach Kursniveau, Wahrscheinlichkeiten, Expected Move */
	& .ezopt-table {
		margin-top: 12px;
		width: 100%;
		font-size: 0.76rem;
	}
	& .ezopt-table :is(th, td) {
		padding: 5px 12px;
		border-bottom: 1px solid var(--ez-grid);
		text-align: right;
	}
	& .ezopt-table :is(th, td):first-child {
		text-align: left;
	}
	& .ezopt-table th {
		font-weight: 500;
		color: var(--ez-text-2);
	}

	/* Gewinnmatrix */
	& .ezopt-matrix {
		width: 100%;
		border-collapse: separate;
		border-spacing: 1px;
		font-size: 0.68rem;
	}
	& .ezopt-matrix :is(th, td) {
		padding: 2px 4px;
		text-align: right;
	}
	& .ezopt-matrix thead th {
		padding-bottom: 4px;
		border-bottom: 1px solid var(--ez-border);
		font-weight: 500;
		color: var(--ez-text);
	}
	& .ezopt-matrix tbody th {
		text-align: left;
		font-weight: 500;
		color: var(--ez-text);
	}
	& .ezopt-matrix .ezopt-matrix-ecke {
		text-align: left;
		font-weight: 500;
		color: var(--ez-muted);
	}
	& .ezopt-matrix tbody tr.ezopt-matrix-aktiv th {
		color: var(--ez-accent);
	}
	& .ezopt-matrix thead th.ezopt-matrix-aktiv {
		background: rgba(var(--ez-accent-rgb), 0.30);
	}
}
