:root {
	--hvp-primary-color: #ff2f6d;
	--hvp-control-bg: linear-gradient(180deg, rgba(8, 8, 12, 0) 0%, rgba(8, 8, 12, 0.88) 42%, rgba(8, 8, 12, 0.96) 100%);
	--hvp-panel-bg: rgba(14, 14, 18, 0.96);
	--hvp-border: rgba(255, 255, 255, 0.12);
	--hvp-text-color: #ffffff;
	--hvp-muted-text: rgba(255, 255, 255, 0.72);
	--hvp-btn-size: 40px;
}

.hvp-wrapper {
	position: relative;
	width: 100%;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
	color: var(--hvp-text-color);
	overflow: hidden;
	border-radius: 16px;
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
	outline: none;
	font-family: inherit;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

.hvp-wrapper:focus-visible {
	box-shadow: 0 0 0 2px var(--hvp-primary-color), 0 24px 48px rgba(0, 0, 0, 0.4);
}

/* Fullscreen owns the entire viewport while preserving the video aspect ratio. */
.hvp-wrapper:fullscreen,
.hvp-wrapper:-webkit-full-screen {
	width: 100vw;
	height: 100vh;
	max-width: none;
	aspect-ratio: auto;
	border-radius: 0;
	box-shadow: none;
}

.hvp-wrapper:fullscreen .hvp-video,
.hvp-wrapper:-webkit-full-screen .hvp-video {
	width: 100%;
	height: 100%;
}

.hvp-video {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	background: #000;
	cursor: pointer;
}

.hvp-icon {
	width: 20px;
	height: 20px;
	display: block;
	flex-shrink: 0;
	pointer-events: none;
}

.hvp-btn-icon {
	width: var(--hvp-btn-size);
	height: var(--hvp-btn-size);
	padding: 0;
	justify-content: center;
	background: transparent;
	border-color: transparent;
	box-shadow: none;
	color: rgba(255, 255, 255, 0.94);
}

.hvp-btn-icon:hover,
.hvp-btn-icon:focus-visible,
.hvp-btn-icon.active {
	background: rgba(255, 255, 255, 0.1);
	border-color: transparent;
	color: #fff;
}

/* Transparent gesture surface — covers video only, never the control bar */
.hvp-surface {
	position: absolute;
	inset: 0 0 56px;
	z-index: 2;
	cursor: pointer;
	background: transparent;
}

.hvp-skip-feedback {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.92);
	min-width: 72px;
	padding: 12px 16px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.14);
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
	z-index: 5;
}

.hvp-skip-feedback.active {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.hvp-controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 0 12px 10px;
	background: var(--hvp-control-bg);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
	z-index: 4;
}

.hvp-wrapper:hover .hvp-controls,
.hvp-wrapper.hvp-paused .hvp-controls,
.hvp-wrapper.hvp-active .hvp-controls,
.hvp-wrapper:focus-within .hvp-controls,
.hvp-wrapper.hvp-settings-open .hvp-controls {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* Fullscreen controls must hide even when a mouse still rests over the player. */
.hvp-wrapper.hvp-fullscreen-idle:fullscreen .hvp-controls,
.hvp-wrapper.hvp-fullscreen-idle:-webkit-full-screen .hvp-controls {
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
}

.hvp-progress-container {
	position: relative;
	height: 4px;
	margin: 0 0 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.22);
	cursor: pointer;
	touch-action: none;
}

.hvp-progress-container:hover,
.hvp-wrapper.hvp-scrubbing .hvp-progress-container {
	height: 6px;
}

.hvp-buffered-bar,
.hvp-progress-bar {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	border-radius: inherit;
	width: 0;
}

.hvp-buffered-bar {
	background: rgba(255, 255, 255, 0.28);
	max-width: 100%;
}

.hvp-progress-bar {
	background: var(--hvp-primary-color);
}

.hvp-progress-handle {
	position: absolute;
	top: 50%;
	left: 0;
	width: 13px;
	height: 13px;
	background: #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%) scale(0.85);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
	opacity: 0;
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.hvp-wrapper:hover .hvp-progress-handle,
.hvp-wrapper.hvp-active .hvp-progress-handle,
.hvp-wrapper.hvp-paused .hvp-progress-handle,
.hvp-progress-container:hover .hvp-progress-handle,
.hvp-wrapper.hvp-scrubbing .hvp-progress-handle {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.hvp-tooltip {
	position: absolute;
	bottom: 16px;
	left: 0;
	transform: translateX(-50%);
	padding: 4px 8px;
	border-radius: 6px;
	font-size: 11px;
	line-height: 1;
	white-space: nowrap;
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.hvp-progress-container:hover .hvp-tooltip,
.hvp-wrapper.hvp-scrubbing .hvp-tooltip {
	opacity: 1;
}

.hvp-buttons,
.hvp-left-controls,
.hvp-right-controls,
.hvp-volume-group {
	display: flex;
	align-items: center;
}

.hvp-buttons {
	justify-content: space-between;
	gap: 8px;
	min-height: var(--hvp-btn-size);
}

.hvp-left-controls,
.hvp-right-controls {
	gap: 2px;
	flex-wrap: nowrap;
	min-width: 0;
}

.hvp-left-controls {
	flex: 1 1 auto;
}

.hvp-right-controls {
	flex: 0 0 auto;
	justify-content: flex-end;
}

.hvp-btn {
	appearance: none;
	border: 0;
	background: transparent;
	color: inherit;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--hvp-btn-size);
	height: var(--hvp-btn-size);
	padding: 0;
	border-radius: 10px;
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.hvp-btn:hover,
.hvp-btn:focus-visible {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	outline: none;
}

.hvp-btn.active {
	color: var(--hvp-primary-color);
}

.hvp-btn:active {
	transform: scale(0.96);
}

a.hvp-btn,
a.hvp-menu-item {
	text-decoration: none;
	color: inherit;
	box-sizing: border-box;
}

.hvp-play-btn .hvp-icon-pause,
.hvp-wrapper.hvp-playing .hvp-play-btn .hvp-icon-play {
	display: none;
}

.hvp-wrapper.hvp-playing .hvp-play-btn .hvp-icon-pause {
	display: block;
}

.hvp-mute-btn .hvp-icon-muted,
.hvp-mute-btn.active .hvp-icon-volume {
	display: none;
}

.hvp-mute-btn.active .hvp-icon-muted {
	display: block;
}

.hvp-fullscreen-btn .hvp-icon-compress,
.hvp-fullscreen-btn.active .hvp-icon-expand {
	display: none;
}

.hvp-fullscreen-btn.active .hvp-icon-compress {
	display: block;
}

.hvp-volume-group {
	gap: 0;
	margin-right: 4px;
}

.hvp-volume-container {
	width: 0;
	overflow: hidden;
	opacity: 0;
	transition: width 0.18s ease, opacity 0.18s ease, margin 0.18s ease;
	display: flex;
	align-items: center;
}

.hvp-volume-group:hover .hvp-volume-container,
.hvp-volume-group:focus-within .hvp-volume-container {
	width: 84px;
	opacity: 1;
	margin-left: 2px;
	margin-right: 4px;
}

.hvp-volume-slider {
	width: 100%;
	height: 4px;
	appearance: none;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.25);
	accent-color: var(--hvp-primary-color);
	cursor: pointer;
}

.hvp-volume-slider::-webkit-slider-thumb {
	appearance: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #fff;
	border: 0;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.hvp-time {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0 8px;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: var(--hvp-muted-text);
	white-space: nowrap;
	flex-shrink: 0;
}

.hvp-settings-wrapper {
	position: relative;
	display: inline-flex;
}

.hvp-settings-btn {
	position: relative;
}

.hvp-quality-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--hvp-primary-color);
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	letter-spacing: 0.02em;
	pointer-events: none;
}

/* Settings panel — right-aligned, bounded width on desktop, full-width on mobile */
.hvp-settings-menu {
	position: absolute;
	right: 10px;
	bottom: 62px;
	min-width: 200px;
	max-width: 320px;
	max-height: min(58%, 280px);
	padding: 0;
	border: 1px solid var(--hvp-border);
	border-radius: 14px;
	background: var(--hvp-panel-bg);
	backdrop-filter: blur(18px);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
	z-index: 6;
	overflow: hidden;
	display: none;
	flex-direction: column;
}

.hvp-settings-menu.active {
	display: flex;
}

.hvp-settings-menu-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--hvp-border);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	flex-shrink: 0;
}

.hvp-settings-close {
	appearance: none;
	border: 0;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.hvp-settings-close:hover,
.hvp-settings-close:focus-visible {
	background: rgba(255, 255, 255, 0.16);
	outline: none;
}

.hvp-settings-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid var(--hvp-border);
	flex-shrink: 0;
}

.hvp-settings-tab {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--hvp-muted-text);
	padding: 10px 16px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	cursor: pointer;
	position: relative;
	transition: color 0.15s ease;
}

.hvp-settings-tab:hover,
.hvp-settings-tab:focus-visible {
	color: #fff;
	outline: none;
}

.hvp-settings-tab.active {
	color: #fff;
}

.hvp-settings-tab.active::after {
	content: '';
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: -1px;
	height: 2px;
	border-radius: 999px;
	background: var(--hvp-primary-color);
}

.hvp-settings-body {
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	flex: 1 1 auto;
	min-height: 0;
	padding: 12px;
}

.hvp-menu-panel {
	display: none;
}

.hvp-menu-panel.active {
	display: block;
}

.hvp-menu-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
	gap: 6px;
}

.hvp-menu-item {
	appearance: none;
	border: 1px solid var(--hvp-border);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.04);
	color: inherit;
	padding: 10px 6px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hvp-menu-item:hover,
.hvp-menu-item:focus-visible {
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	outline: none;
}

.hvp-menu-item.active {
	background: var(--hvp-primary-color);
	border-color: var(--hvp-primary-color);
	color: #fff;
}

/* Desktop: hide checkmark, use filled active state */
.hvp-menu-item-check {
	display: none;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.hvp-big-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 72px;
	height: 72px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, rgba(255, 47, 109, 0.95), rgba(255, 115, 0, 0.9));
	color: #fff;
	cursor: pointer;
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	pointer-events: auto;
}

.hvp-big-play .hvp-icon {
	width: 28px;
	height: 28px;
	margin-left: 3px;
}

.hvp-big-play:hover,
.hvp-big-play:focus-visible {
	transform: translate(-50%, -50%) scale(1.04);
	box-shadow: 0 20px 42px rgba(0, 0, 0, 0.48);
	outline: none;
}

.hvp-wrapper.hvp-playing .hvp-big-play,
.hvp-wrapper.hvp-settings-open .hvp-big-play {
	display: none;
}

.hvp-loader {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	margin: -22px 0 0 -22px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.18);
	border-top-color: var(--hvp-primary-color);
	animation: hvp-spin 1s linear infinite;
	display: none;
	z-index: 5;
}

.hvp-wrapper.hvp-waiting .hvp-loader {
	display: block;
}

.hvp-error {
	padding: 18px;
	border-radius: 14px;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	text-align: center;
}

.hvp-mobile-only {
	display: none !important;
}

@keyframes hvp-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

@keyframes hvp-sheet-up {
	from {
		transform: translateY(100%);
		opacity: 0.5;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

@media (max-width: 768px) {
	:root {
		--hvp-btn-size: 38px;
	}

	.hvp-wrapper {
		border-radius: 12px;
	}

	.hvp-desktop-only {
		display: none !important;
	}

	.hvp-mobile-only {
		display: initial !important;
	}

	.hvp-controls {
		padding: 0 8px 8px;
	}

	.hvp-buttons {
		gap: 4px;
	}

	.hvp-left-controls,
	.hvp-right-controls {
		gap: 0;
	}

	.hvp-time {
		padding: 0 6px;
		font-size: 11px;
	}

	/* Mobile settings: YouTube-style bottom sheet */
	.hvp-settings-menu {
		/*
		 * The player is only about 225px tall on a 400px-wide phone. A sheet
		 * limited to a percentage of that height leaves no room after its
		 * handle, header, and tabs. Anchor it to the viewport instead so the
		 * menu body always has usable space and can scroll on short screens.
		 */
		position: fixed;
		left: max(8px, env(safe-area-inset-left));
		right: max(8px, env(safe-area-inset-right));
		bottom: max(8px, env(safe-area-inset-bottom));
		min-width: 0;
		max-width: none;
		height: min(70vh, 460px);
		height: min(70dvh, 460px);
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
		border-radius: 16px 16px 0 0;
		border: none;
		border-top: 1px solid var(--hvp-border);
		animation: hvp-sheet-up 0.22s ease;
	}

	.hvp-settings-menu::before {
		content: '';
		display: block;
		width: 36px;
		height: 4px;
		margin: 8px auto 0;
		border-radius: 999px;
		background: rgba(255, 255, 255, 0.25);
		flex-shrink: 0;
	}

	.hvp-settings-menu-header {
		padding: 8px 16px 10px;
		font-size: 14px;
	}

	.hvp-settings-close {
		width: 30px;
		height: 30px;
		font-size: 20px;
	}

	.hvp-settings-tabs {
		padding: 0 8px;
	}

	.hvp-settings-tab {
		padding: 10px 14px;
		font-size: 12px;
	}

	.hvp-settings-body {
		min-height: 0;
		padding: 0;
		overscroll-behavior: contain;
	}

	/* Mobile menu items: clean vertical list, not grid */
	.hvp-menu-grid {
		display: flex;
		flex-direction: column;
		gap: 0;
	}

	.hvp-menu-item {
		width: 100%;
		border: none;
		border-radius: 0;
		background: transparent;
		padding: 14px 18px;
		font-size: 15px;
		font-weight: 500;
		text-align: left;
		justify-content: space-between;
		border-bottom: 1px solid rgba(255, 255, 255, 0.06);
		transition: background 0.12s ease;
	}

	.hvp-menu-item:last-child {
		border-bottom: none;
	}

	.hvp-menu-item:active {
		background: rgba(255, 255, 255, 0.08);
		transform: none;
	}

	/* Mobile active item: no filled bg, show checkmark in primary color */
	.hvp-menu-item.active {
		background: transparent;
		border: none;
		border-bottom: 1px solid rgba(255, 255, 255, 0.06);
		color: var(--hvp-primary-color);
	}

	.hvp-menu-item.active:last-child {
		border-bottom: none;
	}

	.hvp-menu-item-check {
		display: block;
		width: 20px;
		height: 20px;
		color: var(--hvp-primary-color);
	}

	.hvp-menu-item:not(.active) .hvp-menu-item-check {
		visibility: hidden;
	}

	.hvp-menu-item-label {
		flex: 1;
	}

	.hvp-big-play {
		width: 64px;
		height: 64px;
	}

	.hvp-surface {
		inset: 0 0 52px;
	}

	/* Keep one compact row — never stack controls mid-video */
	.hvp-buttons {
		flex-direction: row;
		align-items: center;
	}
}

@media (max-width: 420px) {
	.hvp-time-separator,
	.hvp-time-duration {
		display: none;
	}

	.hvp-captions-btn .hvp-btn-text {
		font-size: 11px;
		font-weight: 700;
	}
}

@media (hover: none) and (pointer: coarse) {
	.hvp-progress-handle {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}

	.hvp-progress-container {
		height: 5px;
	}
}
