/* Sticky Video Bar */
:root {
	--svb-bg: #4a4a4a;
	--svb-fg: #ffffff;
	--svb-accent: #2b6cff;
	--svb-offset: 0px;
	--svb-media-w: clamp(100px, 26vw, 150px);
}

body.svb-has-bar {
	padding-bottom: var(--svb-offset) !important;
}

.svb,
.svb * {
	box-sizing: border-box;
}

.svb {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99990;
	display: grid;
	grid-template-columns: var(--svb-media-w) minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 12px;
	padding: 0 4px 0 0;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	background: var(--svb-bg);
	color: var(--svb-fg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.28);
	transform: translateY(110%);
	transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.svb.svb--visible {
	transform: translateY(0);
}

/* ---------- video ---------- */
.svb-media {
	grid-column: 1;
	grid-row: 1;
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
	overflow: hidden;
	align-self: stretch;
}

.svb-stage,
.svb-stage video,
.svb-stage iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.svb-stage video {
	object-fit: cover;
	cursor: pointer;
}

.svb-shield {
	position: absolute;
	inset: 0;
	z-index: 2;
	cursor: pointer;
}

.svb-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	z-index: 3;
	background: rgba(255, 255, 255, 0.18);
	pointer-events: none;
}

.svb-progress span {
	display: block;
	height: 100%;
	background: var(--svb-accent);
	transform-origin: left center;
	transform: scaleX(0);
	transition: transform 0.25s linear;
}

.svb-expand {
	position: absolute;
	top: 4px;
	right: 4px;
	z-index: 4;
	width: 26px;
	height: 26px;
	padding: 4px;
	border: 0;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.svb-expand svg {
	width: 100%;
	height: 100%;
	display: block;
}

.svb-media:hover .svb-expand,
.svb-expand:focus-visible,
.svb--expanded .svb-expand {
	opacity: 1;
}

/* ---------- title ---------- */
.svb-title {
	grid-column: 2;
	grid-row: 1;
	min-width: 0;
	padding: 8px 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
}

.svb-title a,
.svb-title span {
	color: inherit;
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.svb-title a:hover {
	text-decoration: underline;
}

/* ---------- controls ---------- */
.svb-controls {
	grid-column: 3;
	grid-row: 1;
	display: flex;
	align-items: center;
	gap: 2px;
}

.svb-btn {
	width: 44px;
	height: 44px;
	padding: 10px;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--svb-fg);
	cursor: pointer;
	line-height: 0;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.15s ease;
}

.svb-btn svg {
	width: 100%;
	height: 100%;
	display: block;
}

.svb-btn:hover {
	background: rgba(255, 255, 255, 0.12);
}

.svb-btn:focus-visible,
.svb-expand:focus-visible,
.svb-title a:focus-visible {
	outline: 2px solid var(--svb-accent);
	outline-offset: 2px;
}

/* ---------- desktop: full-width bar ---------- */
@media (min-width: 768px) {
	:root {
		--svb-media-w: 168px;
	}
	.svb {
		column-gap: 20px;
		padding-right: 14px;
	}
	.svb-title {
		font-size: 18px;
	}
}

/* ---------- desktop: floating corner card ---------- */
.svb.svb--corner-active {
	left: auto;
	right: 20px;
	bottom: 20px;
	width: 380px;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: auto auto;
	column-gap: 8px;
	padding: 0;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
	transform: translateY(calc(100% + 40px));
	transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.3s ease;
}

.svb.svb--corner-active.svb--visible {
	transform: translateY(0);
}

.svb--corner-active .svb-media {
	grid-column: 1 / -1;
	grid-row: 1;
}

.svb--corner-active .svb-title {
	grid-column: 1;
	grid-row: 2;
	padding: 10px 0 10px 14px;
	font-size: 15px;
}

.svb--corner-active .svb-controls {
	padding-right: 6px;
	grid-column: 2;
	grid-row: 2;
}

.svb--corner-active .svb-btn {
	width: 38px;
	height: 38px;
	padding: 9px;
}

.svb.svb--corner-active.svb--expanded {
	width: min(640px, calc(100vw - 40px));
}

/* ---------- expanded (bar style): video pops up above the bar ---------- */
.svb:not(.svb--corner-active).svb--expanded .svb-media {
	position: fixed;
	right: 12px;
	bottom: calc(var(--svb-offset) + 12px);
	width: min(560px, calc(100vw - 24px));
	height: auto;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
	animation: svb-pop 0.25s ease-out;
}

.svb:not(.svb--corner-active).svb--expanded::before {
	content: "";
	grid-column: 1;
	grid-row: 1;
	align-self: stretch;
	aspect-ratio: 16 / 9;
	background: rgba(0, 0, 0, 0.35);
}

@keyframes svb-pop {
	from { opacity: 0; transform: translateY(16px) scale(0.96); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.svb,
	.svb.svb--corner-active,
	.svb-progress span {
		transition: none;
	}
	.svb:not(.svb--corner-active).svb--expanded .svb-media {
		animation: none;
	}
}

@media print {
	.svb { display: none !important; }
}
