/* ============================================================
   Math of Lottery — explanatory motion tied to mathematical state changes.
   No scroll-reveal or decorative loops; every visual answers a probability question.
   ============================================================ */
.math-page .brand-home {
	display: inline-block;
	color: var(--text);
	font-family: var(--font-display);
	font-size: 1.25rem;
	font-weight: 700;
}

.math-main {
	max-width: 940px;
	margin: 0 auto;
	padding: 48px 16px 72px;
}

.math-intro {
	padding-bottom: 34px;
	border-bottom: 1px solid var(--border);
}

.math-kicker,
.math-concept {
	color: var(--accent);
	font-family: var(--font-data);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
}

.math-intro h1 {
	max-width: 760px;
	margin-top: 8px;
	font-family: var(--font-display);
	font-size: clamp(2.1rem, 6vw, 4.4rem);
	font-weight: 400;
	line-height: 0.98;
	letter-spacing: -0.025em;
}

.math-lede {
	max-width: 760px;
	margin-top: 20px;
	color: var(--text);
	font-size: 1rem;
	line-height: 1.7;
}

.math-model-source,
.math-caveat {
	max-width: 820px;
	margin-top: 18px;
	color: var(--text-dim);
	font-size: 0.86rem;
	line-height: 1.6;
}

.math-lesson {
	padding: 46px 0;
	border-bottom: 1px solid var(--border);
}

.math-lesson-head {
	max-width: 800px;
}

.math-lesson h2,
.math-sources h2 {
	margin-top: 7px;
	font-size: clamp(1.45rem, 3.5vw, 2.2rem);
	line-height: 1.16;
}

.math-lesson-head > p:last-child,
.math-sources > p {
	margin-top: 12px;
	color: var(--text-dim);
	line-height: 1.65;
}

.math-equation {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 9px 13px;
	margin-top: 24px;
	padding: 18px 0;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
	font-family: var(--font-data);
	font-size: clamp(1rem, 3vw, 1.35rem);
}

.math-equation span {
	font-family: inherit;
	font-weight: 600;
}

.ev-visual {
	margin-top: 24px;
}

.ev-track {
	position: relative;
	height: 42px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--surface);
}

.ev-cost-line {
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.025));
}

.ev-payout-bar {
	position: absolute;
	inset: 0;
	background: var(--accent);
	transform: scaleX(0.645903796080581);
	transform-origin: left center;
}

.math-measures,
.independence-readout {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1px;
	margin-top: 1px;
	background: var(--border);
	border: 1px solid var(--border);
}

.math-measures > div,
.independence-readout > div {
	min-width: 0;
	padding: 13px;
	background: var(--surface);
}

.math-measures span,
.independence-readout span {
	display: block;
	color: var(--text-dim);
	font-size: 0.75rem;
	line-height: 1.35;
}

.math-measures strong,
.independence-readout strong {
	display: block;
	margin-top: 4px;
	font-family: var(--font-data);
	font-size: 0.95rem;
	font-weight: 600;
}

.math-action {
	width: auto;
	min-height: 44px;
	margin-top: 16px;
	padding-inline: 15px;
}

.math-status {
	margin-top: 12px;
	color: var(--text-dim);
	font-size: 0.84rem;
	line-height: 1.55;
}

.math-bridge {
	margin-top: 20px;
	font-size: 0.88rem;
	line-height: 1.55;
}

.math-trial-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 22px;
}

.math-trial-btn,
.math-streak-btn {
	min-width: 74px;
	min-height: 44px;
	padding: 9px 13px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: transparent;
	color: var(--text-dim);
	font-family: var(--font-data);
	font-size: 0.8rem;
}

.math-trial-btn[aria-pressed="true"],
.math-streak-btn[aria-pressed="true"] {
	border-color: var(--accent);
	background: color-mix(in srgb, var(--accent) 12%, var(--surface));
	color: var(--text);
}

.math-chart-frame {
	margin-top: 18px;
	padding: 12px 12px 9px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}

.math-chart {
	display: block;
	width: 100%;
	height: auto;
	min-height: 220px;
}

.math-chart-reference {
	stroke: var(--text-dim);
	stroke-width: 1.5;
	stroke-dasharray: 5 5;
	vector-effect: non-scaling-stroke;
}

.math-chart-path {
	fill: none;
	stroke: var(--accent);
	stroke-width: 2.5;
	stroke-linejoin: round;
	stroke-linecap: round;
	vector-effect: non-scaling-stroke;
}

.math-chart-key {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	padding-top: 8px;
	border-top: 1px solid var(--border);
	color: var(--text-dim);
	font-size: 0.73rem;
}

.math-chart-key span::before {
	content: "";
	display: inline-block;
	width: 18px;
	height: 2px;
	margin-right: 7px;
	vertical-align: middle;
	background: var(--accent);
}

.math-chart-key .math-key-theoretical::before {
	background: var(--text-dim);
}

.independence-visual {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	min-height: 64px;
	margin-top: 18px;
	padding: 14px;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
}

.math-trial-dot {
	width: 28px;
	height: 28px;
	border: 1px solid var(--border);
	border-radius: 50%;
	background: var(--surface-2);
}

.math-trial-dot.is-loss {
	position: relative;
}

.math-trial-dot.is-loss::before,
.math-trial-dot.is-loss::after {
	content: "";
	position: absolute;
	top: 13px;
	left: 6px;
	width: 14px;
	height: 2px;
	background: var(--loss);
	transform: rotate(45deg);
}

.math-trial-dot.is-loss::after {
	transform: rotate(-45deg);
}

.math-trial-dot.is-next {
	border-color: var(--accent);
	box-shadow: inset 0 0 0 5px var(--bg);
	background: var(--accent);
}

.independence-readout {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.math-caveat strong {
	color: var(--text);
	font-weight: 600;
}

.math-sources {
	padding-top: 46px;
}

.math-sources ul {
	margin-top: 18px;
	padding-left: 20px;
}

.math-sources li {
	list-style: disc;
	margin-top: 8px;
	color: var(--text-dim);
	font-size: 0.86rem;
	line-height: 1.5;
}

.math-sources a {
	text-decoration: underline;
}

@media (max-width: 700px) {
	.math-main {
		padding-top: 30px;
	}

	.math-measures {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.math-chart {
		min-height: 180px;
	}
}

@media (max-width: 430px) {
	.math-measures,
	.independence-readout {
		grid-template-columns: minmax(0, 1fr);
	}

	.math-trial-controls {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.math-trial-btn,
	.math-streak-btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ev-payout-bar,
	.math-chart-path,
	.math-trial-dot {
		animation: none !important;
		transition: none !important;
	}
}
