html,
body {
	height: 100%;
	overflow: hidden;
}

/* Feed video luon nam duoi header (header luon hien tren moi man hinh,
   xem style.css .site-header). Header cao 64px (dat trong style.css). */
.reel-feed {
	position: relative;
	height: calc(100vh - 64px);
	height: calc(100dvh - 64px);
	overflow-y: scroll;
	scroll-snap-type: y mandatory;
	scroll-behavior: smooth;
	background: #000;
	-webkit-overflow-scrolling: touch;
}

.reel-slide {
	position: relative;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	overflow: hidden;
}

.reel-embed {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.reel-embed iframe,
.reel-embed .fb_iframe_widget,
.reel-embed .fb_iframe_widget iframe {
	width: 100% !important;
	height: 100% !important;
	border: 0;
}

.reel-embed.tiktok-embed {
	display: block;
	max-width: 100%;
}

.reel-embed--unsupported {
	color: #fff;
	padding: 24px;
	text-align: center;
	word-break: break-all;
}

.reel-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 16px 12px calc(20px + env(safe-area-inset-bottom, 0px)) 16px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 70%);
	color: #fff;
	pointer-events: none;
}

.reel-title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 600;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.reel-desc {
	font-size: 13px;
	line-height: 1.4;
	opacity: 0.9;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.reel-slide--empty .reel-caption {
	position: static;
	background: none;
	pointer-events: auto;
	text-align: center;
	padding: 20px;
}

/*
 * Nut mute: 1 ban duy nhat cho ca feed (khong lap lai theo slide), goc tren
 * ben phai. Dung position:fixed tren mobile de luon dinh vi theo man hinh
 * thuc te bat ke cuon slide nao; chuyen sang position:absolute (gan voi
 * khung .reel-feed) o breakpoint desktop, vi luc do .reel-feed la 1 khung
 * hep nam giua man hinh chu khong con la toan bo viewport nua.
 */
.reel-mute-toggle {
	position: fixed;
	top: calc(80px + env(safe-area-inset-top, 0px));
	right: 14px;
	z-index: 10;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.3);
	color: #fff;
	font-size: 16px;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

/*
 * Nut "Mua tai day": goc tren ben trai CUA TUNG SLIDE (khong phai cua ca
 * feed), nen luon la position:absolute gan voi .reel-slide, dung tren moi
 * kich thuoc man hinh. Dat o tren (khong con nam trong caption o duoi) de
 * tranh bi thanh cong cu cua trinh duyet/thiet bi che mat o day man hinh.
 */
.reel-cart-toggle {
	position: absolute;
	top: 16px;
	left: 14px;
	z-index: 10;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px 7px 10px;
	border: none;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.96);
	color: #111;
	font-size: 13px;
	font-weight: 700;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	cursor: pointer;
}

.reel-cart-toggle-icon {
	display: flex;
	color: var(--color-accent);
}

.reel-cart-toggle-icon svg {
	width: 16px;
	height: 16px;
}

.reel-cart-backdrop {
	position: absolute;
	inset: 0;
	z-index: 15;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.reel-cart-backdrop.is-open {
	opacity: 1;
	pointer-events: auto;
}

.reel-cart-panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 20;
	max-height: 48%;
	display: flex;
	flex-direction: column;
	background: var(--color-surface);
	border-radius: 16px 16px 0 0;
	transform: translateY(100%);
	transition: transform 0.25s ease;
	color: #fff;
	padding-top: 10px;
}

.reel-cart-panel::before {
	content: "";
	width: 36px;
	height: 4px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.25);
	margin: 0 auto 8px;
}

.reel-cart-panel.is-open {
	transform: translateY(0);
}

.reel-cart-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px 10px;
	font-size: 14px;
	font-weight: 600;
	border-bottom: 1px solid var(--color-border);
}

.reel-cart-close {
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.reel-cart-list {
	overflow-y: auto;
	padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

.reel-product {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 0;
	border-bottom: 1px solid var(--color-border);
	color: #fff;
	text-decoration: none;
}

.reel-product:last-child {
	border-bottom: none;
}

.reel-product-info {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.reel-product-name {
	font-size: 13.5px;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.reel-product-price {
	font-size: 12px;
	color: var(--color-accent);
}

.reel-product-badge {
	flex: none;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.2px;
	background: rgba(255, 255, 255, 0.12);
}

.reel-product-badge--shopee {
	background: #ee4d2d;
	color: #fff;
}

.reel-product-badge--lazada {
	background: #0f146d;
	color: #fff;
}

.reel-product-badge--tiktokshop {
	background: #000;
	color: #fff;
	box-shadow: inset 0 0 0 1px var(--color-accent);
}

/*
 * Giao dien may tinh (kieu TikTok.com desktop): video thu vao 1 khung doc
 * kieu dien thoai nam giua man hinh, duoi header. Nguong 700px (thay vi
 * 768/769px) de tranh dung dung ranh gioi chieu rong cua iPad.
 */
@media (min-width: 700px) {
	.reel-feed {
		width: 100%;
		max-width: 430px;
		height: calc(100vh - 64px - 48px);
		height: calc(100dvh - 64px - 48px);
		margin: 24px auto;
		border-radius: 24px;
		border: 1px solid var(--color-border);
		box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
		overflow-x: hidden;
	}

	.reel-mute-toggle {
		position: absolute;
		top: 16px;
	}
}
