.fm_episodes_wrapper {
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 20px;
	box-sizing: border-box;
	font-family: 'Kanit', sans-serif;
}

.fm_episodes_wrapper * {
	box-sizing: border-box;
}

.fm_heading {
	font-size: 32px;
	font-weight: 800;
	margin: 0 0 28px;
	color: #111;
}

.fm_carousel_shell {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
}

.fm_episodes_track {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	width: 100%;
}

.fm_layout_grid .fm_episodes_track.fm_columns_1 { grid-template-columns: repeat(1, 1fr); }
.fm_layout_grid .fm_episodes_track.fm_columns_2 { grid-template-columns: repeat(2, 1fr); }
.fm_layout_grid .fm_episodes_track.fm_columns_3 { grid-template-columns: repeat(3, 1fr); }
.fm_layout_grid .fm_episodes_track.fm_columns_4 { grid-template-columns: repeat(4, 1fr); }

.fm_layout_carousel .fm_episodes_track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.fm_layout_carousel .fm_episodes_track::-webkit-scrollbar {
	display: none;
}

.fm_layout_carousel .fm_episode_card {
	flex: 0 0 calc(33.333% - 16px);
	scroll-snap-align: start;
}

.fm_layout_carousel.fm_columns_1 .fm_episode_card,
.fm_layout_carousel .fm_columns_1 .fm_episode_card { flex-basis: 100%; }
.fm_layout_carousel .fm_columns_2 .fm_episode_card { flex-basis: calc(50% - 12px); }
.fm_layout_carousel .fm_columns_3 .fm_episode_card { flex-basis: calc(33.333% - 16px); }
.fm_layout_carousel .fm_columns_4 .fm_episode_card { flex-basis: calc(25% - 18px); }

.fm_carousel_nav {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: none;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	color: #222;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fm_carousel_nav:hover {
	background: #f2f2f2;
}

.fm_episode_card {
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.fm_episode_thumb {
	width: 100%;
	height: 230px;
	background: #e9e9e9;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fm_episode_thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
	display: block;
}

.fm_thumb_placeholder {
	color: #b7b7b7;
}

.fm_episode_title {
	font-size: 17px;
	font-weight: 700;
	margin: 18px 20px 8px;
	color: #161616;
	line-height: 1.35;
}

.fm_episode_summary {
	font-size: 14px;
	color: #767676;
	margin: 0 20px 16px;
	line-height: 1.55;
}

.fm_player {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: auto 20px 20px;
}

.fm_play_btn,
.fm_volume_btn {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: none;
	background: #e4e4e4;
	color: #333;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
}

.fm_play_btn:hover,
.fm_volume_btn:hover {
	background: #d5d5d5;
}

.fm_time_current,
.fm_time_duration {
	font-size: 12px;
	color: #9a9a9a;
	flex: 0 0 auto;
	min-width: 32px;
}

.fm_progress_track {
	flex: 1 1 auto;
	height: 4px;
	border-radius: 2px;
	background: #e6e6e6;
	position: relative;
	cursor: pointer;
	min-width: 30px;
}

.fm_progress_fill {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0;
	background: #1c1c1c;
	border-radius: 2px;
}

.fm_volume_slider {
	flex: 0 0 60px;
	width: 60px;
	accent-color: #1c1c1c;
}

.fm_error {
	color: #c1272d;
	font-size: 14px;
}

@media (max-width: 900px) {
	.fm_episodes_track,
	.fm_layout_grid .fm_episodes_track.fm_columns_3,
	.fm_layout_grid .fm_episodes_track.fm_columns_4 {
		grid-template-columns: repeat(2, 1fr);
	}
	.fm_layout_carousel .fm_columns_3 .fm_episode_card,
	.fm_layout_carousel .fm_columns_4 .fm_episode_card {
		flex-basis: calc(50% - 12px);
	}
}

@media (max-width: 600px) {
	.fm_episodes_track,
	.fm_layout_grid .fm_episodes_track.fm_columns_2,
	.fm_layout_grid .fm_episodes_track.fm_columns_3,
	.fm_layout_grid .fm_episodes_track.fm_columns_4 {
		grid-template-columns: 1fr;
	}
	.fm_layout_carousel .fm_episode_card {
		flex-basis: 88%;
	}
}

/* Force Kanit over the active theme's font (e.g. Cardo), which otherwise wins on these elements. */
.fm_heading {
	font-family: 'Kanit', sans-serif !important;
}

.fm_episode_card .fm_episode_title {
	font-family: 'Kanit', sans-serif !important;
}

.fm_episode_card p {
	font-family: 'Kanit', sans-serif !important;
}

.fm_episodes_wrapper * {
	font-family: 'Kanit', sans-serif !important;
}

@media (max-width: 768px) {
	.fm_episodes_track {
		grid-template-columns: 1fr !important;
	}

	.fm_episode_card {
		min-width: 100% !important;
		max-width: 100% !important;
		width: 100% !important;
	}

	.fm_columns_3,
	.fm_columns_2 {
		grid-template-columns: 1fr !important;
	}
}
