/* KH Listen to Article */
.kh-listen {
	--kh-listen-accent: #b3285c;
	--kh-listen-accent-hover: #c93a70;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
	font: inherit;
	color: inherit;
}

.kh-listen button {
	font: inherit;
	color: inherit;
	cursor: pointer;
	border: 0;
	background: none;
	padding: 0;
	margin: 0;
	line-height: 1;
}

.kh-listen button:focus-visible,
.kh-listen-bar:focus-visible {
	outline: 2px solid var(--kh-listen-accent-hover);
	outline-offset: 2px;
}

/* Main pill */
.kh-listen-play {
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	padding: 4px 12px 4px 4px !important;
	border: 1px solid rgba(255, 255, 255, 0.18) !important;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.06) !important;
	font-size: 14px;
	font-weight: 600;
	color: #fff !important;
	transition: background 0.2s, border-color 0.2s;
}

.kh-listen-play:hover {
	background: rgba(255, 255, 255, 0.12) !important;
	border-color: rgba(255, 255, 255, 0.3) !important;
}

.kh-listen-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--kh-listen-accent);
	color: #fff;
	flex: none;
	transition: background 0.2s, transform 0.2s;
}

.kh-listen-play:hover .kh-listen-icon {
	background: var(--kh-listen-accent-hover);
	transform: scale(1.05);
}

.kh-listen-icon svg { display: block; }

/* Active-only controls */
.kh-listen-bar,
.kh-listen-time,
.kh-listen-speed,
.kh-listen-stop {
	display: none !important;
}

.kh-listen.is-active {
	padding: 4px 6px 4px 4px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.06);
	gap: 10px;
}

.kh-listen.is-active .kh-listen-play {
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
}

.kh-listen.is-active .kh-listen-bar,
.kh-listen.is-active .kh-listen-time,
.kh-listen.is-active .kh-listen-speed,
.kh-listen.is-active .kh-listen-stop {
	display: inline-flex !important;
}

.kh-listen-bar {
	position: relative;
	width: 120px;
	height: 4px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.18);
	cursor: pointer;
	align-items: center;
}

.kh-listen-bar::before { /* bigger click target */
	content: "";
	position: absolute;
	inset: -10px 0;
}

.kh-listen-fill {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 0;
	border-radius: 4px;
	background: var(--kh-listen-accent-hover);
	transition: width 0.4s ease;
}

.kh-listen-time {
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	opacity: 0.85;
}

.kh-listen-speed {
	min-width: 38px;
	height: 26px;
	padding: 0 8px !important;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.18) !important;
	font-size: 12px !important;
	font-weight: 600;
	justify-content: center;
	align-items: center;
	font-variant-numeric: tabular-nums;
}

.kh-listen-stop {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	justify-content: center;
	align-items: center;
	opacity: 0.8;
}

.kh-listen-speed:hover,
.kh-listen-stop:hover {
	background: rgba(255, 255, 255, 0.1) !important;
	opacity: 1;
}

/* Paragraph being read */
.kh-listen-current {
	background: rgba(179, 40, 92, 0.08);
	box-shadow: -12px 0 0 rgba(179, 40, 92, 0.08), 12px 0 0 rgba(179, 40, 92, 0.08), inset 3px 0 0 var(--kh-listen-accent, #b3285c);
	border-radius: 4px;
	transition: background 0.3s;
}

tr.kh-listen-current { box-shadow: none; }
tr.kh-listen-current > * { background: rgba(179, 40, 92, 0.08); }

/* Fallback placement when the theme has no meta row (light backgrounds) */
.kh-listen-standalone {
	margin: 0 0 1.5em;
	color: #1a2433;
}
.kh-listen-standalone .kh-listen-play { color: #1a2433 !important; border-color: rgba(0, 0, 0, 0.15) !important; background: rgba(0, 0, 0, 0.03) !important; }
.kh-listen-standalone.is-active { border-color: rgba(0, 0, 0, 0.15); background: rgba(0, 0, 0, 0.03); }
.kh-listen-standalone .kh-listen-bar { background: rgba(0, 0, 0, 0.12); }
.kh-listen-standalone .kh-listen-speed { border-color: rgba(0, 0, 0, 0.15) !important; }

@media (max-width: 600px) {
	.kh-listen.is-active { flex-basis: 100%; }
	.kh-listen-bar { flex: 1; width: auto; min-width: 80px; }
}

@media (prefers-reduced-motion: reduce) {
	.kh-listen *, .kh-listen-current { transition: none !important; }
}
