* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html,
body {
	height: 100%;
	background: #000;
	color: #fff;
	font-family:
		"TikTok Sans",
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		"Helvetica Neue",
		sans-serif;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

button {
	background: none;
	border: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.phone {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100dvh;
	max-width: calc(100dvh * 9 / 16);
	margin: 0 auto;
	background: #000;
	overflow: hidden;
}

@media (min-width: 700px) and (max-width: 899px) {
	body {
		background:
			radial-gradient(circle at 30% 20%, #25f4ee22, transparent 45%),
			radial-gradient(circle at 70% 80%, #fe2c5522, transparent 45%), #0b0b0f;
	}
	.phone {
		height: min(92dvh, 900px);
		max-width: calc(min(92dvh, 900px) * 9 / 16);
		margin-top: max(4dvh, calc((100dvh - 900px) / 2));
		border-radius: 28px;
		box-shadow:
			0 0 0 10px #1a1a1f,
			0 30px 80px #000c;
	}
}

.icon-shadow,
.topbar svg,
.rail svg {
	filter: drop-shadow(0 1px 2px #0005);
}

/* Top bar: LIVE, tabs, search */

.topbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: max(14px, env(safe-area-inset-top)) 14px 24px;
	background: linear-gradient(#0006, transparent);
	pointer-events: none;
}

.topbar > * {
	pointer-events: auto;
}

.live svg,
.search svg {
	display: block;
	width: 30px;
	height: 30px;
}

.search svg {
	width: 27px;
	height: 27px;
}

.tabs {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow-x: auto;
	scrollbar-width: none;
	mask-image: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 8px), transparent);
}

.tabs button {
	position: relative;
	flex: none;
	padding: 4px 9px;
	color: #ffffffa6;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.2px;
	text-shadow: 0 1px 2px #0006;
	transition: color 0.15s;
}

.tabs button + button::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 1px;
	height: 12px;
	margin-top: -6px;
	background: #ffffff59;
}

.tabs button.active {
	color: #fff;
	font-weight: 700;
}

.tabs .dot {
	position: absolute;
	top: 1px;
	right: 2px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #fe2c55;
}

/* Feed */

.feed {
	flex: 1;
	min-height: 0;
	overflow-y: scroll;
	scroll-snap-type: y mandatory;
	overscroll-behavior: contain;
	scrollbar-width: none;
}

.feed::-webkit-scrollbar,
.tabs::-webkit-scrollbar {
	display: none;
}

.slide {
	position: relative;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	overflow: hidden;
	background: #000;
	user-select: none;
	-webkit-user-select: none;
}

.card {
	position: absolute;
	inset: 0;
}

.sidebar,
.arrows {
	display: none;
}

.stage {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
}

.stage video {
	flex: 1;
	min-height: 0;
	width: 100%;
	object-fit: cover;
	background: #111;
}

.stage video + video {
	border-top: 2px solid #000;
}

.shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(transparent 62%, #0009);
	pointer-events: none;
}

.paused-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 76px;
	height: 76px;
	transform: translate(-50%, -50%) scale(1.3);
	opacity: 0;
	transition:
		opacity 0.15s,
		transform 0.15s;
	pointer-events: none;
	filter: drop-shadow(0 2px 8px #0006);
}

.slide.paused .paused-icon {
	opacity: 0.55;
	transform: translate(-50%, -50%) scale(1);
}

.spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	margin: -18px 0 0 -18px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s;
}

.spinner::before,
.spinner::after {
	content: "";
	position: absolute;
	top: 10px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	mix-blend-mode: screen;
}

.spinner::before {
	background: #25f4ee;
	animation: orbit 0.9s ease-in-out infinite;
}

.spinner::after {
	background: #fe2c55;
	animation: orbit 0.9s ease-in-out infinite reverse;
}

.slide.loading .spinner,
.boot .spinner {
	opacity: 1;
}

.boot {
	position: relative;
	display: grid;
	place-items: center;
	height: 100%;
	color: #ffffff8c;
	font-size: 14px;
}

.boot p {
	margin-top: 64px;
}

.unsupported-note {
	display: none;
	position: absolute;
	top: 38%;
	left: 32px;
	right: 32px;
	z-index: 4;
	text-align: center;
	font-size: 15px;
	line-height: 1.45;
	color: #ffffffd9;
}

.slide.unsupported .unsupported-note {
	display: block;
}

@keyframes orbit {
	0%,
	100% {
		left: 0;
	}
	50% {
		left: 20px;
	}
}

/* Right action rail */

.rail {
	position: absolute;
	right: 6px;
	bottom: 16px;
	z-index: 5;
	width: 56px;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.avatar {
	position: relative;
	width: 48px;
	height: 48px;
	margin-bottom: 26px;
	border-radius: 50%;
	border: 1.5px solid #fff;
	background: #fff center / cover;
}

.avatar .follow {
	position: absolute;
	left: 50%;
	bottom: -11px;
	width: 22px;
	height: 22px;
	transform: translateX(-50%);
	border-radius: 50%;
	background: #fe2c55;
	display: grid;
	place-items: center;
	transition:
		background 0.25s,
		transform 0.25s;
}

.avatar .follow svg {
	width: 12px;
	height: 12px;
	filter: none;
}

.avatar.following .follow {
	background: #fff;
	transform: translateX(-50%) rotate(360deg);
}

.avatar.following .follow path {
	stroke: #fe2c55;
}

.rail .action {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-bottom: 14px;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1;
	text-shadow: 0 1px 1px #0005;
}

.rail .action svg {
	width: 40px;
	height: 40px;
	margin-bottom: 4px;
	transition: transform 0.15s;
}

.rail .action:active svg {
	transform: scale(0.85);
}

.like.on svg path {
	fill: #fe2c55;
}

.like.on svg {
	animation: pop 0.35s ease-out;
}

.save.on svg path {
	fill: #face15;
}

.save.on svg {
	animation: pop 0.35s ease-out;
}

@keyframes pop {
	40% {
		transform: scale(1.3);
	}
}

.disc-wrap {
	position: relative;
	margin-top: 6px;
}

.disc {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background:
		radial-gradient(circle, transparent 12px, #161616 12.5px, #2b2b2b 19px, #161616 24px),
		#161616;
	display: grid;
	place-items: center;
	animation: spin 5s linear infinite;
}

.disc span {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #fff center / cover;
}

.slide.paused .disc,
.slide.paused .note {
	animation-play-state: paused;
}

.note {
	position: absolute;
	left: 4px;
	bottom: 16px;
	width: 12px;
	height: 12px;
	opacity: 0;
	animation: note 2.4s linear infinite;
	pointer-events: none;
}

.note:nth-of-type(2) {
	animation-delay: 1.2s;
}

@keyframes note {
	0% {
		transform: translate(0, 0) scale(0.6) rotate(0);
		opacity: 0;
	}
	15% {
		opacity: 1;
	}
	100% {
		transform: translate(-26px, -42px) scale(1.1) rotate(-25deg);
		opacity: 0;
	}
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* Caption */

.meta {
	position: absolute;
	left: 12px;
	right: 78px;
	bottom: 16px;
	z-index: 5;
	text-shadow: 0 1px 1px #0006;
}

.handle {
	font-size: 16px;
	font-weight: 700;
	margin-bottom: 5px;
}

.caption {
	font-size: 14.5px;
	line-height: 1.35;
	margin-bottom: 8px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.caption .tag {
	font-weight: 700;
}

.joints {
	display: block;
	width: 100%;
	height: 30px;
	margin-bottom: 8px;
	opacity: 0;
	transition: opacity 0.4s;
}

.joints.ready {
	opacity: 1;
}

.sound {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	overflow: hidden;
	white-space: nowrap;
}

.sound svg {
	flex: none;
	width: 15px;
	height: 15px;
}

.sound .track {
	flex: 1;
	overflow: hidden;
	mask-image: linear-gradient(90deg, #000 85%, transparent);
}

.sound .track span {
	display: inline-block;
	padding-right: 48px;
	animation: marquee 10s linear infinite;
}

@keyframes marquee {
	to {
		transform: translateX(-100%);
	}
}

/* Progress scrubber */

.progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 14px;
	z-index: 6;
	cursor: pointer;
	touch-action: none;
}

.progress::before,
.progress .fill {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
}

.progress::before {
	right: 0;
	background: #ffffff33;
}

.progress .fill {
	width: 0;
	background: #ffffffcc;
}

.progress:hover::before,
.progress:hover .fill,
.progress.dragging::before,
.progress.dragging .fill {
	height: 4px;
}

/* Bottom navigation */

.bottombar {
	flex: none;
	display: flex;
	align-items: flex-start;
	justify-content: space-around;
	height: calc(56px + env(safe-area-inset-bottom));
	padding: 6px 4px env(safe-area-inset-bottom);
	background: #000;
	border-top: 0.5px solid #ffffff1f;
}

.bottombar button {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	color: #ffffff99;
	font-size: 10.5px;
	font-weight: 500;
}

.bottombar button.active {
	color: #fff;
	font-weight: 700;
}

.bottombar svg {
	width: 28px;
	height: 28px;
	opacity: 0.6;
}

.bottombar button.active svg {
	opacity: 1;
}

.create {
	padding-top: 4px;
}

.create .plus {
	position: relative;
	display: grid;
	place-items: center;
	width: 46px;
	height: 30px;
	border-radius: 9px;
	background: #fff;
	box-shadow:
		-3.5px 0 0 #25f4ee,
		3.5px 0 0 #fe2c55;
}

.create .plus svg {
	width: 20px;
	height: 20px;
	opacity: 1;
}

/* Bottom sheet (details + search) */

.sheet-backdrop {
	position: absolute;
	inset: 0;
	z-index: 40;
	background: #0000;
	pointer-events: none;
	transition: background 0.25s;
}

.sheet-backdrop.open {
	background: #0006;
	pointer-events: auto;
}

.sheet {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 41;
	display: flex;
	flex-direction: column;
	height: 68%;
	border-radius: 12px 12px 0 0;
	background: #fff;
	color: #161823;
	transform: translateY(100%);
	transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.open {
	transform: translateY(0);
}

.sheet-header {
	position: relative;
	flex: none;
	padding: 16px 44px 12px;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
}

.sheet-header button {
	position: absolute;
	right: 12px;
	top: 12px;
	width: 24px;
	height: 24px;
}

.sheet-body {
	flex: 1;
	overflow-y: auto;
	padding: 0 16px 24px;
}

.row {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	padding: 10px 0;
	text-align: left;
}

.row .pic {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #f1f1f2 center / cover;
	display: grid;
	place-items: center;
	font-size: 16px;
}

.row .who {
	font-size: 13px;
	font-weight: 600;
	color: #16182399;
	margin-bottom: 2px;
}

.row .what {
	font-size: 15px;
	line-height: 1.35;
	color: #161823;
	word-break: break-word;
}

.row.selectable .what::after {
	content: " ›";
	color: #16182366;
}

.row.selected .what {
	color: #fe2c55;
	font-weight: 600;
}

.search-input {
	width: 100%;
	margin: 4px 0 8px;
	padding: 10px 14px;
	border: none;
	border-radius: 8px;
	background: #f1f1f2;
	color: #161823;
	font: inherit;
	font-size: 15px;
	outline: none;
}

.sheet-note {
	padding: 16px 0;
	text-align: center;
	font-size: 13px;
	color: #16182380;
}

/* Floating hearts, toast, empty state */

.burst {
	position: absolute;
	z-index: 10;
	width: 96px;
	height: 96px;
	margin: -48px 0 0 -48px;
	pointer-events: none;
	animation: burst 0.9s ease-out forwards;
}

.burst path {
	fill: #fe2c55;
}

@keyframes burst {
	0% {
		transform: scale(0.4) rotate(var(--tilt));
		opacity: 0;
	}
	20% {
		transform: scale(1.15) rotate(var(--tilt));
		opacity: 1;
	}
	35% {
		transform: scale(1) rotate(var(--tilt));
	}
	100% {
		transform: translateY(-140px) scale(1.6) rotate(var(--tilt));
		opacity: 0;
	}
}

.toast {
	position: absolute;
	left: 50%;
	top: 45%;
	z-index: 50;
	max-width: 85%;
	padding: 10px 16px;
	border-radius: 6px;
	background: #000000b3;
	font-size: 14px;
	text-align: center;
	transform: translateX(-50%);
	opacity: 0;
	transition: opacity 0.2s;
	pointer-events: none;
}

.toast.show {
	opacity: 1;
}

.empty {
	display: grid;
	place-items: center;
	height: 100%;
	padding: 32px;
	text-align: center;
	color: #fffa;
	font-size: 14px;
	line-height: 1.5;
}

/* Desktop: sidebar, centered video card, rail beside it, arrows on the right */

@media (min-width: 900px) {
	body {
		background: #121212;
	}

	.phone {
		display: grid;
		grid-template-columns: 248px 1fr;
		max-width: none;
		height: 100dvh;
		margin: 0;
		background: #121212;
	}

	.topbar,
	.bottombar,
	.disc-wrap {
		display: none;
	}

	.sidebar {
		display: flex;
		flex-direction: column;
		gap: 6px;
		padding: 18px 12px 20px 16px;
		overflow-y: auto;
		border-right: 1px solid #ffffff14;
	}

	.logo {
		display: flex;
		align-items: center;
		gap: 6px;
		padding: 4px 8px 14px;
		color: #fff;
		font-size: 26px;
		font-weight: 800;
		letter-spacing: -0.8px;
		text-decoration: none;
	}

	.logo svg {
		width: 34px;
		height: 34px;
	}

	.side-search {
		display: flex;
		align-items: center;
		gap: 10px;
		height: 40px;
		margin-bottom: 10px;
		padding: 0 14px;
		border-radius: 20px;
		background: #ffffff14;
		color: #ffffff80;
		font-size: 15px;
		text-align: left;
	}

	.side-search svg {
		width: 18px;
		height: 18px;
	}

	.side-nav {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.side-nav button {
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 10px 8px;
		border-radius: 6px;
		color: #fff;
		font-size: 17px;
		font-weight: 600;
		text-align: left;
	}

	.side-nav button:hover {
		background: #ffffff0f;
	}

	.side-nav button.active {
		color: #fe2c55;
	}

	.side-nav svg {
		flex: none;
		width: 26px;
		height: 26px;
	}

	.side-foot {
		margin-top: auto;
		padding: 16px 8px 0;
		border-top: 1px solid #ffffff14;
		color: #ffffff73;
		font-size: 12.5px;
		line-height: 1.5;
	}

	.side-foot p + p {
		margin-top: 8px;
	}

	.side-foot a {
		color: #ffffffb3;
	}

	.feed {
		height: 100dvh;
	}

	.slide {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 16px;
		padding: 16px 0;
		background: transparent;
	}

	.card {
		position: relative;
		inset: auto;
		height: 100%;
		aspect-ratio: 9 / 16;
		border-radius: 16px;
		overflow: hidden;
		background: #000;
	}

	.meta {
		right: 16px;
	}

	.rail {
		position: static;
		align-self: flex-end;
		width: auto;
		margin-bottom: 6px;
	}

	.avatar {
		margin-bottom: 22px;
	}

	.rail .action {
		margin-bottom: 12px;
		color: #ffffffe6;
		font-size: 12px;
		font-weight: 700;
		text-shadow: none;
	}

	.rail .action svg {
		width: 48px;
		height: 48px;
		padding: 11px;
		margin-bottom: 6px;
		border-radius: 50%;
		background: #ffffff1f;
		filter: none;
		transition:
			background 0.15s,
			transform 0.15s;
	}

	.rail .action:hover svg {
		background: #ffffff33;
	}

	.rail .action svg circle[fill="#161823"] {
		fill: #2a2a2a;
	}

	.arrows {
		display: flex;
		flex-direction: column;
		gap: 16px;
		position: absolute;
		right: 28px;
		top: 50%;
		z-index: 20;
		transform: translateY(-50%);
	}

	.arrows button {
		display: grid;
		place-items: center;
		width: 48px;
		height: 48px;
		border-radius: 50%;
		background: #ffffff1f;
		color: #fff;
		transition: background 0.15s;
	}

	.arrows button:hover {
		background: #ffffff33;
	}

	.arrows svg {
		width: 24px;
		height: 24px;
	}

	.sheet {
		left: auto;
		top: 0;
		width: 420px;
		height: 100%;
		border-radius: 0;
		transform: translateX(100%);
	}

	.sheet.open {
		transform: translateX(0);
	}
}
