/* ==========================================================================
   CPUDJ queue sheet fix — 2026-10-21
   小屏手机打开队列后，弹层不能盖住播放条；并且始终有一个“只关闭、不清空”的按钮。

   v2：清空 / 关闭统一成 32×32 触控区 + 20×20 图标，两个按钮拉开间距；
       ✕ 不再常驻深色圆底，视觉尺寸和红色垃圾桶一致。
   ========================================================================== */

/* 桌面端也按动态视口兜一下，避免浏览器工具栏把弹层顶出屏幕 */
@supports (height: 100dvh) {
	.ma_player_playlist {
		max-height: calc(100dvh - 130px);
	}
}

/* 标题栏吸顶：队列很长、往下滚时，关闭按钮不会跟着滚走 */
.ma_player_playlist .queue_head {
	background-color: #161616;
	position: sticky;
	top: 0;
	z-index: 12;
}
.ma_player_playlist .queue_head.yy-queue-head {
	padding-right: 60px;
}

/* 清空、关闭做成同一档：32×32 的触控区 + 20×20 的图标，
   两个按钮之间留 16px，视觉上不再挤在一起 */
.ma_player_playlist .queue_head.yy-queue-head > span {
	align-items: center;
	border-radius: 50%;
	display: inline-flex;
	flex: 0 0 32px;
	height: 32px;
	justify-content: center;
	width: 32px;
	-webkit-tap-highlight-color: transparent;
}
.ma_player_playlist .queue_head.yy-queue-head > span:hover {
	background: rgba(244, 67, 54, .14);
}

/* 只收起弹层的 ✕（垃圾桶仍然是清空队列，两者分开）
   平时不画圆圈，只留和垃圾桶一样大的图标；按下时才出现浅色圆底 */
.ma_player_playlist .yy-queue-close {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: #f0f0f0;
	cursor: pointer;
	display: flex;
	height: 32px;
	justify-content: center;
	margin-top: -16px;
	padding: 0;
	position: absolute;
	right: 12px;
	top: 50%;
	width: 32px;
	z-index: 30;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.ma_player_playlist .yy-queue-close svg {
	height: 20px;
	pointer-events: none;
	width: 20px;
}
.ma_player_playlist .yy-queue-close:hover {
	background: rgba(255, 255, 255, .10);
	color: #fff;
}
.ma_player_playlist .yy-queue-close:active {
	background: rgba(255, 255, 255, .18);
	transform: scale(.9);
}
/* 鼠标/触摸点按不画系统描边，键盘 Tab 过来仍保留可见焦点 */
.ma_player_playlist .yy-queue-close:focus {
	outline: none;
}
.ma_player_playlist .yy-queue-close:focus-visible {
	outline: 2px solid var(--main-color, #f98f1d);
	outline-offset: 2px;
}

/* SimpleBar 1.x 只在初始化时量一次高度；弹层高度是脚本动态算的，
   这里让内部滚动层跟着弹层走，改用原生滚动，队列长也能滑 */
.ma_player_playlist[data-simplebar="init"] > .simplebar-scroll-content {
	box-sizing: border-box !important;
	height: 100% !important;
	margin-bottom: 0 !important;
	max-height: 100% !important;
	min-width: 0 !important;
	overflow-x: hidden !important;
	overflow-y: auto !important;
	padding-right: 0 !important;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}
.ma_player_playlist[data-simplebar="init"] > .simplebar-scroll-content .simplebar-content {
	box-sizing: border-box !important;
	min-height: 0 !important;
	overflow: visible !important;
	padding-bottom: 0 !important;
}
/* 原生滚动条已经够用，隐藏 SimpleBar 的假滚动条 */
.ma_player_playlist .simplebar-track {
	display: none !important;
}

/* 播放条永远压在弹层上面：就算弹层高度算错，队列按钮也还能点第二次 */
body.data-queue-open .ma_player .player {
	position: relative;
	z-index: 10001;
}
body.data-queue-open .ma_player .song_progress_right {
	position: relative;
	z-index: 10002;
}

@media (max-width: 767.98px) {
	/* 弹层锚在播放条上方，高度取“可视高度 - 播放条 - 底栏 - 间距”，
	   永远不会因为 100vh 比实际可视区域大而盖住播放条 */
	.ma_player_playlist {
		border-radius: 14px 14px 0 0;
		bottom: 144px;
		height: min(620px, calc(100vh - 154px));
		height: min(620px, calc(100dvh - 154px));
		max-height: none;
		top: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}

	.ma_player_playlist .queue_head {
		padding: 7px 10px 7px 16px;
	}
	.ma_player_playlist .queue_head.yy-queue-head {
		padding-right: 60px;
	}
	.ma_player_playlist .queue_head h4 {
		font-size: 18px;
		line-height: 30px;
	}

	/* 小屏上弹层和播放条之间留出 6px，视觉上不粘连 */
	.ma_player_playlist .song {
		min-height: 62px;
	}
}

/* 特别矮的屏幕（iPhone SE 等）：再收一点，优先保证播放条露出来 */
@media (max-width: 767.98px) and (max-height: 640px) {
	.ma_player_playlist {
		height: min(560px, calc(100vh - 154px));
		height: min(560px, calc(100dvh - 154px));
	}
}
