/**
 * Overlay ads in stream player frame.
 */
.stream-player-shell {
	display: flex;
	flex-direction: column;
	width: 100%;
}

.stream-player-shell--hot {
	flex: 1;
	min-height: 0;
	min-width: 0;
}

.stream-player-ads {
	position: absolute;
	inset: 0;
	z-index: 4;
	pointer-events: none;
}

.stream-player-ads__header a,
.stream-player-ads__corner a,
.stream-player-ads__footer-item a,
.stream-player-ads__footer-close {
	pointer-events: auto;
}

.stream-player-controls,
.stream-player-controls * {
	pointer-events: none;
}

.stream-single-iframe-wrap.stream-player-ui-active .stream-player-controls,
.stream-single-iframe-wrap.stream-player-ui-active .stream-player-controls *,
.stream-hot-iframe-container.stream-player-ui-active .stream-player-controls,
.stream-hot-iframe-container.stream-player-ui-active .stream-player-controls * {
	pointer-events: auto;
}

.stream-single-iframe-wrap:hover .stream-player-controls,
.stream-single-iframe-wrap:hover .stream-player-controls *,
.stream-single-iframe-wrap:focus-within .stream-player-controls,
.stream-single-iframe-wrap:focus-within .stream-player-controls *,
.stream-hot-iframe-container:hover .stream-player-controls,
.stream-hot-iframe-container:hover .stream-player-controls *,
.stream-hot-iframe-container:focus-within .stream-player-controls,
.stream-hot-iframe-container:focus-within .stream-player-controls * {
	pointer-events: auto;
}

.stream-player-ads img {
	display: block;
	width: 100%;
	height: auto;
}

.stream-single-iframe-wrap iframe,
.stream-hot-iframe-container iframe {
	pointer-events: none;
}

/* Unknown embeds (e.g. cdnx1): use native in-iframe controls for audio. */
.stream-single-iframe-wrap.stream-player-passthrough iframe,
.stream-hot-iframe-container.stream-player-passthrough iframe {
	pointer-events: auto;
}

.stream-player-passthrough .stream-player-ads__shield {
	pointer-events: none;
}

.stream-player-passthrough .stream-player-ads__native-mask {
	display: none;
}

.stream-player-passthrough .stream-player-controls__play,
.stream-player-passthrough .stream-player-controls__mute,
.stream-player-passthrough .stream-player-controls__volume {
	display: none !important;
}

.stream-player-passthrough .stream-player-controls {
	background: transparent;
	pointer-events: none;
	padding: 0;
	opacity: 1;
	visibility: visible;
}

.stream-player-passthrough .stream-player-controls__fullscreen {
	display: flex !important;
	pointer-events: auto;
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 7;
	opacity: 0;
}

.stream-player-ads__shield {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: auto;
	background: transparent;
	cursor: pointer;
}

.stream-player-ads__native-mask {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 72px;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.78) 72%, rgba(0, 0, 0, 0.9) 100%);
	pointer-events: none;
	z-index: 2;
}

.stream-player-ads__header {
	pointer-events: none;
	z-index: 3;
}

.stream-player-ads__header {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
}

.stream-player-ads__corner {
	left: auto;
	pointer-events: auto;
	position: absolute;
	right: 4%;
	top: 5.5%;
	width: 16%;
	z-index: 24;
}

.stream-player-ads__footer {
	position: relative;
	width: 100%;
	flex: 0 0 auto;
	background: #0a0a0a;
	padding: 4px 2px 2px;
	pointer-events: auto;
}

.stream-player-shell--hot .stream-player-ads__footer {
	background: #0d0d0d;
}

.stream-player-ads__footer-row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2px;
	padding: 2px;
	border-radius: 8px;
}

.stream-player-ads__footer-item {
	flex: 1 1 0;
	min-width: 0;
}

.stream-player-ads__footer-item:first-child {
	grid-column: 1 / -1;
    max-width: min(350px, 34%);
    width: 100%;
    justify-self: start;
}

.stream-player-ads__footer-item a,
.stream-player-ads__footer-item img {
	display: block;
	width: 100%;
}

.stream-player-ads__footer-item img {
	border-radius: 4px;
}

.stream-player-ads__footer-close {
	position: absolute;
	top: 4px;
	right: 4px;
	border: none;
	border-radius: 50%;
	background: #ff9900;
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 25px;
	height: 25px;
	min-height: unset;
	margin: 0;
	padding: 0;
	transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.stream-player-ads__footer-close:hover {
	background: #d82121;
}

.stream-player-controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	transform: none;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 12px;
	border-radius: 0 0 8px 8px;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82));
	color: #fff;
	pointer-events: none;
	z-index: 10;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.stream-single-iframe-wrap.stream-player-ui-active .stream-player-controls,
.stream-hot-iframe-container.stream-player-ui-active .stream-player-controls {
	opacity: 1;
	visibility: visible;
}

.stream-single-iframe-wrap:hover .stream-player-controls,
.stream-single-iframe-wrap:focus-within .stream-player-controls,
.stream-hot-iframe-container:hover .stream-player-controls,
.stream-hot-iframe-container:focus-within .stream-player-controls {
	opacity: 1;
	visibility: visible;
}

.stream-player-controls button {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	min-height: 36px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	padding: 0;
	margin-bottom: 0;
	transition: background 0.2s ease;
	box-shadow: none;
}

.stream-player-controls button:hover {
	background: rgba(255, 255, 255, 0.22);
}

.stream-player-controls svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

/* Mặc định: play, vol-on, expand */
.stream-player-controls__icon-pause,
.stream-player-controls__icon-vol-off,
.stream-player-controls__icon-shrink {
	display: none;
}

/* Đang phát */
.stream-player-controls:not(.stream-player-controls--paused) .stream-player-controls__icon-play {
	display: none;
}

.stream-player-controls:not(.stream-player-controls--paused) .stream-player-controls__icon-pause {
	display: block;
}

/* Tắt tiếng */
.stream-player-controls.stream-player-controls--muted .stream-player-controls__icon-vol-on {
	display: none;
}

.stream-player-controls.stream-player-controls--muted .stream-player-controls__icon-vol-off {
	display: block;
}

/* Fullscreen */
.stream-player-controls.is-fullscreen .stream-player-controls__icon-expand {
	display: none;
}

.stream-player-controls.is-fullscreen .stream-player-controls__icon-shrink {
	display: block;
}

.stream-player-controls__volume {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 1;
	min-width: 0;
	max-width: 140px;
}

.stream-player-controls__range {
	width: 100%;
	min-width: 48px;
	height: 4px;
	margin: 0;
	accent-color: #fff;
	cursor: pointer;
}

.stream-player-controls__fullscreen {
	margin-left: auto;
}

.stream-player-controls.is-disabled .stream-player-controls__play,
.stream-player-controls.is-disabled .stream-player-controls__mute,
.stream-player-controls.is-disabled .stream-player-controls__volume {
	opacity: 0.65;
}

/* Hide native controls (for direct HTML5 video players in our frame). */
.stream-single-iframe-wrap video::-webkit-media-controls,
.stream-hot-iframe-container video::-webkit-media-controls {
	display: none !important;
}

.stream-single-iframe-wrap video::-webkit-media-controls-enclosure,
.stream-hot-iframe-container video::-webkit-media-controls-enclosure {
	display: none !important;
}

:fullscreen .stream-player-ads,
:-webkit-full-screen .stream-player-ads {
	z-index: 9999;
}

:fullscreen .stream-player-controls,
:-webkit-full-screen .stream-player-controls {
	bottom: 0;
}

.stream-player-shell:fullscreen,
.stream-player-shell:-webkit-full-screen {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	max-height: 100%;
	background: #0a0a0a;
	border-radius: 0;
	overflow: hidden;
}

.stream-player-shell--hot:fullscreen,
.stream-player-shell--hot:-webkit-full-screen {
	background: #0d0d0d;
}

.stream-player-shell:fullscreen .stream-single-iframe-wrap,
.stream-player-shell:fullscreen .stream-hot-iframe-container,
.stream-player-shell:-webkit-full-screen .stream-single-iframe-wrap,
.stream-player-shell:-webkit-full-screen .stream-hot-iframe-container {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	height: auto;
	aspect-ratio: auto;
	padding-bottom: 0;
}

.stream-player-shell:fullscreen .stream-player-ads__footer,
.stream-player-shell:-webkit-full-screen .stream-player-ads__footer {
	flex: 0 0 auto;
	width: 100%;
}

/* iOS Safari: Fullscreen API không hoạt động trên div — dùng pseudo-fullscreen. */
body.stream-player-pseudo-fs-active {
	overflow: hidden;
	touch-action: none;
}

.stream-player-shell.stream-player-shell--pseudo-fs {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	height: 100dvh;
	max-height: 100dvh;
	z-index: 2147483646;
	margin: 0;
	border-radius: 0;
	display: flex;
	flex-direction: column;
	background: #0a0a0a;
	overflow: hidden;
	padding:
		env(safe-area-inset-top)
		env(safe-area-inset-right)
		env(safe-area-inset-bottom)
		env(safe-area-inset-left);
}

.stream-player-shell--hot.stream-player-shell--pseudo-fs {
	background: #0d0d0d;
}

.stream-player-shell.stream-player-shell--pseudo-fs .stream-single-iframe-wrap,
.stream-player-shell.stream-player-shell--pseudo-fs .stream-hot-iframe-container {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	height: auto;
	aspect-ratio: auto;
	padding-bottom: 0;
}

.stream-player-shell.stream-player-shell--pseudo-fs .stream-player-ads__footer {
	flex: 0 0 auto;
	width: 100%;
}

.stream-player-shell.stream-player-shell--pseudo-fs .stream-player-ads {
	z-index: 9999;
}

.stream-player-shell.stream-player-shell--pseudo-fs .stream-player-controls {
	bottom: 0;
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

@media (max-width: 767px) {
	.stream-player-ads__native-mask {
		height: 62px;
	}

	.stream-player-ads__footer-item:last-child {
		display: none;
	}

	.stream-player-ads__footer-row {
		grid-template-columns: 1fr;
	}

	.stream-player-controls {
		bottom: 0;
		padding: 8px 10px;
		gap: 6px;
	}

	.stream-player-controls__volume {
		max-width: 120px;
	}

	.stream-player-controls__range {
		width: 100%;
	}
}

@media (hover: none), (pointer: coarse) {
	.stream-player-controls,
	.stream-player-controls * {
		pointer-events: auto;
	}

	.stream-player-controls {
		opacity: 1;
		visibility: visible;
	}
}
