/* ========== 自定义视频播放器控件（参照 m.kptv：播放中无操作自动隐藏，移动/点击唤醒） ========== */
.nf-cc {
	position: absolute !important;
	left: 0; right: 0; bottom: 0;
	background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
	padding: 0 16px 12px;
	opacity: 1;
	pointer-events: auto;
	transition: opacity 0.3s;
	z-index: 20;
	color: #fff;
	/* 真全屏时元素会被放进顶层(top layer)，透明度过渡有时不重绘，
	   导致"控件已显示但画面上看不到"。强制独立合成层，保证透明度变化可靠重绘 */
	will-change: opacity;
	transform: translateZ(0);
	backface-visibility: hidden;
}
/* 自动隐藏状态：用类控制，优先级高于默认显示 */
/* 注意：全屏(顶层 top layer)下，仅切换 opacity 的过渡在 Chrome 里常不重绘，
   表现为"状态已显示但画面看不到"。这里直接 display:none 移出渲染树，
   不依赖过渡/合成层，隐藏与显示必定立即生效（牺牲淡入淡出，换取可靠）。 */
.nf-cc.nf-cc-hidden {
	display: none !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* 全屏：参照 m.kptv —— 真全屏优先，CSS 伪全屏兜底，容器铺满视口不透明 */
.nf-player-wrap.nf-fullscreen {
	position: fixed !important;
	top: 0; left: 0;
	width: 100vw !important;
	height: 100vh !important;
	width: 100dvw !important;
	height: 100dvh !important;
	max-width: none !important;
	max-height: none !important;
	aspect-ratio: auto !important;
	padding: 0 !important;
	padding-bottom: 0 !important;
	background: #000 !important;
	z-index: 9999 !important;
	overflow: hidden;
}
.nf-player-wrap.nf-fullscreen video {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	background: #000 !important;
	display: block;
}
.nf-player-wrap.nf-fullscreen .nf-cc {
	position: absolute !important;
	left: 0; right: 0; bottom: 0;
	width: 100%;
	z-index: 2147483647;
	pointer-events: auto;
}
.nf-player-wrap.nf-fullscreen .nf-cc-center { position: absolute; }

/* 移动端设备逻辑（直接搬自 m.kptv） */

/* 1. 全屏无操作时隐藏鼠标指针（桌面全屏更沉浸） */
.nf-player-wrap.nf-hide-cursor,
.nf-player-wrap.nf-hide-cursor * { cursor: none !important; }

/* 2. iOS 伪全屏过渡动画 */
.nf-player-wrap.nf-ios-fullscreen { transition: all .4s ease; }

/* 3. 容器旋转已移除：m.kptv 的 force-landscape 仅适用于极少数 PWA 横屏场景，会误伤桌面浏览器。横屏由 screen.orientation.lock('landscape') 处理。 */

/* 4. 触摸设备：隐藏自定义音量条（移动端用系统音量键），由 JS 加 .touch-device */
.touch-device .nf-cc-volume,
.touch-device #ccVolumeBtn { display: none !important; }

/* 5. 移动端非全屏时播放器高度自适应（参照 m.kptv 的小屏高度限制） */
@media only screen and (max-width: 768px) {
	.nf-player-wrap:not(.nf-fullscreen) { max-height: 56.25vw; }
}

/* 浏览器原生 :fullscreen 状态下（真全屏），容器与视频同样铺满不透明 */
.nf-player-wrap:fullscreen {
	background: #000;
	display: block;
	overflow: hidden;
	width: 100% !important;
	height: 100% !important;
	padding: 0 !important;
	padding-bottom: 0 !important;
	aspect-ratio: auto !important;
}
.nf-player-wrap:fullscreen video {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	background: #000 !important;
}

/* 进度条（嵌在控件栏中间，水平方向自动伸缩） */
.nf-cc-progress {
	position: relative;
	flex: 1;
	min-width: 80px;
	height: 16px;
	display: flex;
	align-items: center;
	cursor: pointer;
	margin: 0 8px;
	outline: none;
	touch-action: none;
}
.nf-cc-progress-bg,
.nf-cc-progress-buffer,
.nf-cc-progress-played,
.nf-cc-progress-thumb {
	position: absolute;
	left: 0;
	border-radius: 3px;
}
.nf-cc-progress-bg {
	width: 100%;
	height: 4px;
	background: rgba(255,255,255,0.25);
}
.nf-cc-progress-buffer {
	height: 4px;
	background: rgba(255,255,255,0.4);
	width: 0;
}
.nf-cc-progress-played {
	height: 4px;
	background: #e50914;
	width: 0;
}
.nf-cc-progress-thumb {
	width: 14px; height: 14px;
	background: #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%) scale(0);
	top: 50%;
	left: 0;
	transition: transform 0.15s;
	box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.nf-cc-progress:hover .nf-cc-progress-thumb { transform: translate(-50%, -50%) scale(1); }
.nf-cc-progress:hover .nf-cc-progress-played,
.nf-cc-progress:hover .nf-cc-progress-bg,
.nf-cc-progress:hover .nf-cc-progress-buffer { height: 6px; }

/* 控件栏 */
.nf-cc-bar {
	display: flex;
	align-items: center;
	height: 32px;
	gap: 8px;
}
.nf-cc-btn {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 4px 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: background 0.2s;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}
.nf-cc-btn:focus,
.nf-cc-btn:focus-visible { outline: none; box-shadow: none; }
.nf-cc-btn:hover { background: rgba(255,255,255,0.15); }
.nf-cc-btn svg, .nf-cc-btn i { width: 22px; height: 22px; font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

.nf-cc-time {
	font-size: 13px;
	font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
	color: rgba(255,255,255,0.85);
	user-select: none;
	white-space: nowrap;
	min-width: 50px;
}
.nf-cc-time-cur { text-align: right; }
.nf-cc-time-dur { text-align: left; }

/* 手机/平板：音量键直接控制系统音量，隐藏自定义音量条 */
.touch-device .nf-cc-volume,
.touch-device #ccVolumeBtn { display: none !important; }

/* 音量条 */
.nf-cc-volume {
	position: relative;
	width: 80px;
	height: 16px;
	display: flex;
	align-items: center;
	cursor: pointer;
	outline: none;
}
.nf-cc-volume-bg,
.nf-cc-volume-fill {
	position: absolute;
	left: 0;
	height: 3px;
	border-radius: 2px;
}
.nf-cc-volume-bg {
	width: 100%;
	background: rgba(255,255,255,0.25);
}
.nf-cc-volume-fill {
	background: #fff;
	width: 100%;
}
.nf-cc-volume-thumb {
	position: absolute;
	width: 10px; height: 10px;
	background: #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	top: 50%;
	left: 100%;
	box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* 中央播放按钮 */
.nf-cc-center {
	position: absolute;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	width: 80px; height: 80px;
	border-radius: 50%;
	background: linear-gradient(135deg, #e50914, #ff232d);
	box-shadow: 0 4px 20px rgba(229,9,20,0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 15;
	transition: all 0.3s;
	border: 2px solid rgba(255,255,255,0.4);
	opacity: 0;
	pointer-events: none;
}
.nf-cc-center.show { opacity: 1; pointer-events: auto; }
.nf-cc-center:hover { background: linear-gradient(135deg, #b20710, #e50914); transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 6px 24px rgba(229,9,20,0.55); }
.nf-cc-center i { font-size: 36px; margin-left: 4px; }

/* 倍速菜单 */
.nf-cc-rate-menu {
	position: absolute;
	right: 60px;
	bottom: 50px;
	background: rgba(0,0,0,0.85);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-radius: 8px;
	padding: 6px 0;
	z-index: 30;
	min-width: 80px;
}
.nf-cc-rate-menu div {
	padding: 6px 16px;
	color: rgba(255,255,255,0.7);
	font-size: 13px;
	cursor: pointer;
	text-align: center;
	transition: all 0.15s;
}
.nf-cc-rate-menu div:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nf-cc-rate-menu div.active { color: #e50914; }

/* 手势提示：滑动快进/音量 */
#touchHint {
	position: absolute;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	pointer-events: none;
	z-index: 25;
	opacity: 0;
	transition: opacity 0.2s;
}
#touchHint.th-show { opacity: 1; }
#touchHint .th-icon {
	font-size: 40px;
	line-height: 1;
	color: #fff;
}
#touchHint .th-text {
	font-size: 15px;
	color: #fff;
	font-weight: 600;
	background: rgba(0,0,0,0.65);
	padding: 6px 14px;
	border-radius: 6px;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

/* ===== 全屏时改用浏览器原生视频控件 =====
   自定义控件条在全屏(顶层 top layer)下存在不被重绘的问题，
   全屏统一交给 Chrome 原生控件（自带自动隐藏/鼠标唤醒/进度条），更稳定。
   由 JS 在进入全屏时给容器加 .nf-native-ctrls 并打开 video.controls。 */
.nf-native-ctrls .nf-cc,
.nf-native-ctrls .nf-cc-center,
.nf-native-ctrls .nf-cc-rate-menu,
.nf-native-ctrls .nf-cc-volume,
.nf-native-ctrls #touchHint {
	display: none !important;
}
/* 原生控件下，视频必须完整铺满容器（不再受 .embed-responsive 绝对定位影响） */
.nf-native-ctrls video {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	background: #000 !important;
}

/* ===== 全屏关键修复（放在核心 player.css，避免插件目录被还原后失效）=====
   问题：插件 mytheme-site.css 里有 `.myui-player__video.embed-responsive.clearfix{padding-bottom:56.25% !important}`
        （3 个类 + !important），全屏时它仍然生效 → 容器内容区高度被压成 0，
        video 用 absolute 撑满 padding 盒后实际底边落在视口之外，
        导致控件（无论自定义还是 Chrome 原生）都在可视区外，看得见轮廓却点不到。
   这里用 4 个类（含 :fullscreen）提升优先级，彻底覆盖它。 */
.myui-player__video.embed-responsive.clearfix:fullscreen,
.myui-player__video.embed-responsive.clearfix.nf-realfs {
	padding: 0 !important;
	padding-bottom: 0 !important;
	height: 100% !important;
	width: 100% !important;
	box-sizing: border-box !important;
	overflow: hidden !important;
	background: #000 !important;
}
.myui-player__video.embed-responsive.clearfix:fullscreen video,
.myui-player__video.embed-responsive.clearfix.nf-realfs video {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	background: #000 !important;
}

/* 缓冲遮罩只做视觉提示，绝不拦截鼠标：
   它 z-index:999 覆盖整个播放器（高于控件条 z-index:20），
   缓冲期间会把全屏/播放等按钮全部挡住，表现为"点了没反应"。 */
#playerCacheMask {
	pointer-events: none !important;
}

/* 视频元素自身全屏时的几何修正：
   插件里 `.embed-responsive video` 有 position:absolute + top/bottom/left/width/height（无 !important），
   会把全屏的 video 拉回原容器的定位上下文，导致全屏画面错位或原生控件点不到。
   这里用 !important 强制铺满屏幕并保持等比。 */
video:fullscreen,
video:-webkit-full-screen {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	background: #000 !important;
}
