/*
 * Vibe Streaming — player facade and states.
 * Themes restyle through custom properties: --spos-accent, --spos-radius,
 * --spos-bg, --spos-fg. Selectors stay single-class to be easy to override.
 */
.spos-player {
	--spos-radius: 12px;
	--spos-bg: #0b0b0f;
	--spos-fg: #fff;
	position: relative;
	margin: 0 0 1.5em;
	color: var(--spos-fg);
}
.spos-player__stage {
	position: relative;
	overflow: hidden;
	border-radius: var(--spos-radius);
	background: var(--spos-bg);
	width: 100%;
}
.spos-player__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.spos-player__poster--empty { background: linear-gradient(135deg, #1c1c24, #0b0b0f); }
.spos-player__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: grid;
	place-items: center;
	width: 72px;
	height: 72px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--spos-accent, #ffb000);
	color: #000;
	cursor: pointer;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
	transition: transform .15s ease, box-shadow .15s ease;
}
.spos-player__play:hover { transform: translate(-50%, -50%) scale(1.06); }
.spos-player__play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.spos-player__play svg { margin-left: 3px; }
.spos-player__duration {
	position: absolute;
	right: 10px;
	bottom: 10px;
	padding: 2px 8px;
	border-radius: 6px;
	background: rgba(0, 0, 0, .75);
	font-size: .8125rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.5;
}
.spos-player__caption { margin-top: .5em; font-weight: 600; }

/* Engine layer: fills the stage. */
.spos-player__engine {
	position: absolute;
	inset: 0;
}
/* Video.js media elements are inline-block 300×150 by default: fill the stage. */
.spos-player__engine :is(youtube-video, vimeo-video, dailymotion-video, hls-video, dash-video),
.spos-player__engine > *,
.spos-player__engine iframe,
.spos-player__engine video,
.spos-player__engine .spos-vjs-skin {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/*
 * Provider links (YouTube/Vimeo title, logo, "watch on YouTube") inside a
 * Video.js player. Video.js keeps the iframe host out of hit-testing so the
 * skin's click-to-pause receives clicks. Policies (Settings > Player):
 *  - paused (default, like Plyr): links usable only while paused;
 *  - never: always blocked;  - always: never blocked.
 * Outer-document rules override the element's :host rule.
 */
.spos-player[data-spos-engine="videojs"][data-spos-links="paused"].is-paused :is(youtube-video, vimeo-video),
.spos-player[data-spos-engine="videojs"][data-spos-links="always"] :is(youtube-video, vimeo-video) {
	pointer-events: auto;
}
.spos-player[data-spos-engine="videojs"][data-spos-links="never"] :is(youtube-video, vimeo-video),
.spos-player[data-spos-engine="videojs"][data-spos-links="paused"].is-playing :is(youtube-video, vimeo-video) {
	pointer-events: none;
}

/* Loading: spinner over the poster, poster stays visible (no flash). */
.spos-player.is-loading .spos-player__play { pointer-events: none; }
.spos-player.is-loading .spos-player__play svg { opacity: 0; }
.spos-player.is-loading .spos-player__play::after {
	content: "";
	position: absolute;
	width: 30px;
	height: 30px;
	border: 3px solid rgba(0, 0, 0, .25);
	border-top-color: #000;
	border-radius: 50%;
	animation: spos-spin .8s linear infinite;
}
@keyframes spos-spin { to { transform: rotate(360deg); } }

/* Audio: compact row (cover + title), widget height when active. */
.spos-player--audio .spos-player__stage {
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 96px;
	padding: 12px;
	box-sizing: border-box;
}
.spos-player--audio .spos-player__poster {
	position: static;
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	border-radius: 8px;
}
.spos-player--audio .spos-player__play {
	position: static;
	transform: none;
	flex: 0 0 52px;
	width: 52px;
	height: 52px;
}
.spos-player--audio .spos-player__play:hover { transform: scale(1.06); }
.spos-player--audio .spos-player__title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spos-player--audio .spos-player__duration { position: static; }
.spos-player--audio.is-active .spos-player__stage { padding: 0; min-height: 96px; }
.spos-player--audio.is-active .spos-player__title { display: none; }
.spos-player--audio .spos-player__engine { position: relative; inset: auto; width: 100%; }
.spos-player--soundcloud.is-active .spos-player__engine { min-height: 166px; }
.spos-player--spotify.is-active .spos-player__engine { min-height: 152px; }

/* Error and unavailable states. */
.spos-player__error {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	gap: .5em;
	padding: 1.5em;
	background: rgba(11, 11, 15, .92);
	text-align: center;
}
.spos-player--audio .spos-player__error { position: static; width: 100%; padding: .5em; }
.spos-player__error p { margin: 0; }
.spos-player__error a { color: var(--spos-accent, #ffb000); }
.spos-player__retry {
	padding: .4em 1em;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
.spos-player--unavailable {
	padding: 1.25em 1.5em;
	border-radius: var(--spos-radius);
	background: #f3f3f5;
	color: #3c3c43;
}
.spos-player--unavailable p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
	.spos-player__play { transition: none; }
	.spos-player.is-loading .spos-player__play::after { animation-duration: 2.4s; }
}

/* Resume (watch history, Core 0.9.0). */
.spos-resume {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	height: 4px;
	background: rgba(255, 255, 255, .3);
	pointer-events: none;
}
.spos-resume::before {
	content: "";
	display: block;
	width: var(--p, 0%);
	height: 100%;
	background: var(--spos-accent, #ffb000);
}
.spos-resume__label {
	position: absolute;
	left: 10px;
	bottom: 12px;
	z-index: 2;
	padding: 2px 8px;
	border-radius: 6px;
	background: rgba(0, 0, 0, .75);
	color: #fff;
	font-size: .8125rem;
	line-height: 1.5;
	pointer-events: none;
}
.spos-player--audio .spos-resume__label { position: static; display: inline-block; margin-left: 8px; }
.spos-resume-toast {
	position: absolute;
	left: 12px;
	bottom: 56px;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 6px 6px 12px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .8);
	color: #fff;
	font-size: .875rem;
	animation: spos-toast-in .2s ease-out;
}
.spos-resume-toast button {
	min-height: 32px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: #111;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
@keyframes spos-toast-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .spos-resume-toast { animation: none; } }
.spos-player--audio .spos-resume-toast { position: static; margin-top: 8px; width: fit-content; }
