.ypt-playlist-tracker {
	--ypt-ink: #172b4d;
	--ypt-muted: #607080;
	--ypt-accent: #0a66c2;
	--ypt-border: #e2e8ee;
	max-width: 1240px;
	margin: 2rem auto;
	color: var(--ypt-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ypt-course-layout {
	display: grid;
	align-items: stretch;
	margin-top: 20px;
	grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.9fr);
	gap: 24px;
}

.ypt-course-main {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 20px;
}

.ypt-playlist-tracker *,
.ypt-playlist-tracker *::before,
.ypt-playlist-tracker *::after {
	box-sizing: border-box;
}

.ypt-course-header {
	grid-area: header;
	padding: clamp(24px, 4vw, 42px);
	border-radius: 12px;
	background: linear-gradient(115deg, #102a43 0%, #163b56 68%, #145c65 100%);
	color: #fff;
}

.ypt-course-eyebrow,
.ypt-playlist-eyebrow {
	display: block;
	color: #9ce5df;
	font-size: 0.72rem;
	font-weight: 750;
	letter-spacing: 0.12em;
	line-height: 1.4;
}

.ypt-course-header h1 {
	margin: 8px 0 6px;
	color: inherit;
	font-size: clamp(1.65rem, 3vw, 2.25rem);
	font-weight: 700;
	letter-spacing: -0.035em;
	line-height: 1.2;
}

.ypt-course-header p {
	max-width: 600px;
	margin: 0;
	color: #d3e2ec;
	font-size: 1rem;
	line-height: 1.55;
}

.ypt-player {
	position: relative;
	width: 100%;
	height: auto !important;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 10px;
	background: #0b1118;
	box-shadow: 0 8px 24px rgba(16, 42, 67, 0.16);
}

.ypt-player iframe {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
}

.ypt-progress-panel {
	padding: 22px 24px;
	border: 1px solid var(--ypt-border);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 3px 12px rgba(16, 42, 67, 0.045);
}

.ypt-progress-heading,
.ypt-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
}

.ypt-progress-heading strong {
	font-size: 1.05rem;
	font-weight: 700;
}

.ypt-progress-count {
	color: var(--ypt-muted);
	font-size: 0.88rem;
	text-align: right;
}

.ypt-progress-track {
	height: 8px;
	margin-top: 16px;
	overflow: hidden;
	border-radius: 999px;
	background: #e8edf2;
}

.ypt-progress-fill {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, #0a66c2, #21a6a1);
	transition: width 240ms ease;
}

.ypt-current-progress {
	margin: 14px 0 18px;
	color: var(--ypt-muted);
	font-size: 0.9rem;
}

.ypt-current-summary {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 14px 0 18px;
}

.ypt-current-summary .ypt-current-progress {
	margin: 0;
}

.ypt-completion-badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 9px;
	border: 1px solid #b9e5d0;
	border-radius: 999px;
	background: #effaf4;
	color: #18794e;
	font-size: 0.76rem;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

.ypt-completion-badge[hidden] {
	display: none;
}

.ypt-mark-complete {
	min-height: 42px;
	padding: 0.65em 1.1em;
	border: 0;
	border-radius: 6px;
	background: var(--ypt-accent);
	color: #fff;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 650;
	cursor: pointer;
	transition: background-color 140ms ease, transform 140ms ease;
}

.ypt-mark-complete:hover:not(:disabled) {
	transform: translateY(-1px);
	background: #084f96;
}

.ypt-mark-complete.is-completed,
.ypt-refresh-course {
	min-height: 42px;
	padding: 0.65em 1.1em;
	border: 0;
	border-radius: 6px;
	background: linear-gradient(110deg, #0a66c2 0%, #0b858e 100%);
	color: #fff;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 650;
	cursor: pointer;
	transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ypt-mark-complete.is-completed:hover:not(:disabled),
.ypt-refresh-course:hover:not(:disabled) {
	transform: translateY(-1px);
	background: linear-gradient(110deg, #084f96 0%, #086b74 100%);
	box-shadow: 0 4px 10px rgba(10, 102, 194, 0.2);
}

.ypt-refresh-course {
	order: 3;
	margin-left: auto;
}

.ypt-refresh-course:disabled {
	opacity: 0.6;
	cursor: wait;
}

.ypt-mark-complete:disabled {
	background: #54736f;
	cursor: default;
}

.ypt-mark-complete:focus-visible,
.ypt-refresh-course:focus-visible {
	outline: 3px solid #77c8df;
	outline-offset: 3px;
}

.ypt-status {
	order: 2;
	flex: 1;
	color: var(--ypt-muted);
	font-size: 0.84rem;
}

.ypt-playlist-panel {
	display: flex;
	min-width: 0;
	min-height: 0;
	flex-direction: column;
	height: min(660px, calc(37vw + 200px));
	overflow: hidden;
	border: 1px solid var(--ypt-border);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 3px 12px rgba(16, 42, 67, 0.045);
}

.ypt-playlist-heading {
	display: flex;
	min-height: 84px;
	align-items: center;
	justify-content: space-between;
	padding: 17px 20px;
	border-bottom: 1px solid var(--ypt-border);
}

.ypt-playlist-eyebrow {
	margin-bottom: 3px;
	color: var(--ypt-accent);
	font-size: 0.65rem;
}

.ypt-playlist-panel h2 {
	margin: 0;
	color: var(--ypt-ink);
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.015em;
}

.ypt-video-list {
	min-height: 0;
	flex: 1;
	margin: 0;
	padding: 4px 0;
	overflow-y: auto;
	list-style: none;
	scrollbar-color: #c6d1dc transparent;
	scrollbar-width: thin;
}

.ypt-video-list li + li {
	border-top: 1px solid #eef1f4;
}

.ypt-video-button {
	display: flex;
	width: 100%;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border: 0;
	background: #fff;
	color: var(--ypt-ink);
	text-align: left;
	cursor: pointer;
	transition: background-color 140ms ease, box-shadow 140ms ease;
}

.ypt-video-button:hover,
.ypt-video-button.is-current {
	background: #f1f7fc;
}

.ypt-playlist-tracker .ypt-video-button:hover,
.ypt-playlist-tracker .ypt-video-button:focus,
.ypt-playlist-tracker .ypt-video-button:active,
.ypt-playlist-tracker .ypt-video-button.is-current,
.ypt-playlist-tracker .ypt-video-button:hover .ypt-video-title,
.ypt-playlist-tracker .ypt-video-button:focus .ypt-video-title,
.ypt-playlist-tracker .ypt-video-button:active .ypt-video-title,
.ypt-playlist-tracker .ypt-video-button.is-current .ypt-video-title {
	color: var(--ypt-ink) !important;
}

.ypt-video-button.is-current {
	box-shadow: inset 3px 0 0 var(--ypt-accent);
}

.ypt-video-button:focus-visible {
	position: relative;
	outline: 2px solid var(--ypt-accent);
	outline-offset: -2px;
}

.ypt-video-button img {
	width: 104px;
	height: 59px;
	flex: 0 0 auto;
	border-radius: 4px;
	object-fit: cover;
	background: #0b1118;
}

.ypt-video-details {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 5px;
}

.ypt-video-title {
	display: -webkit-box;
	overflow: hidden;
	color: var(--ypt-ink);
	font-size: 0.86rem;
	font-weight: 650;
	text-overflow: ellipsis;
	line-height: 1.4;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.ypt-video-state {
	min-height: 1em;
	color: #4a657c;
	font-size: 0.76rem;
	font-weight: 550;
}

.ypt-video-button.is-current .ypt-video-state {
	color: var(--ypt-accent);
}

.ypt-video-list-loading {
	padding: 20px;
	color: var(--ypt-muted);
	font-size: 0.9rem;
}

@media (max-width: 820px) {
	.ypt-course-layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.ypt-playlist-panel {
		height: auto;
	}

	.ypt-video-list {
		max-height: 440px;
		flex: initial;
	}
}

@media (max-width: 600px) {
	.ypt-playlist-tracker {
		margin: 1rem auto;
	}

	.ypt-course-header {
		padding: 24px 20px;
		border-radius: 8px;
	}

	.ypt-player {
		border-radius: 7px;
	}

	.ypt-progress-panel {
		padding: 18px;
	}

	.ypt-progress-heading,
	.ypt-controls {
		align-items: flex-start;
		flex-direction: column;
		gap: 10px;
	}

	.ypt-refresh-course {
		order: 0;
		margin-left: 0;
	}

	.ypt-status {
		order: 0;
	}

	.ypt-progress-count {
		text-align: left;
	}

	.ypt-playlist-heading {
		min-height: 72px;
		padding: 15px 16px;
	}

	.ypt-video-button img {
		width: 88px;
		height: 50px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ypt-playlist-tracker *,
	.ypt-playlist-tracker *::before,
	.ypt-playlist-tracker *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}
