html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
}

body {
	line-height: 1;
	font-weight: normal;
	font-style: normal;
	font-family: Arial, Helvetica, sans-serif;
}

#video_wrap {
	position: relative;
	width: 100%;
	height: 100%;
	background-color: #000;
}

#video_wrap:before {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	content: '';
	opacity: .4;
	filter: blur(34px);
	/* poster is set from JS via this custom property (no string-built CSS rules) */
	background: center / cover no-repeat var(--td-poster, none) #000;
}

#video {
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	box-shadow: 0 0 50px -20px rgba(0, 0, 0, .75);
	/* responsive 16:9 */
	width: 100%;
	max-height: 100%;
	aspect-ratio: 16 / 9;
}

#video video {
	display: block;
	width: 100%;
	height: 100%;
	background-color: #000;
}

#td_overlay {
	background-color: rgba(0, 0, 0, .75);
	position: fixed;
	inset: 0;
	box-sizing: border-box;
	display: none;
	z-index: 3;
}

/* centred box, always inside the frame: flex centring (not left:50% + translate, which caps the box at half the width) */
#td_overlay.show {
	display: flex;
	align-items: center;
	justify-content: center;
}

#td_modal {
	box-sizing: border-box;
	text-align: center;
	background-color: #688a80;
	padding: clamp(8px, 3vmin, 20px) clamp(10px, 4vmin, 20px);
	width: auto;
	max-width: 80%;
	max-height: 90%;
	overflow: auto;
	border-radius: 10px;
	border: 1px solid #5d7c73;
	box-shadow: 0px 8px 14px -12px rgba(0, 0, 0, .75);
	font-size: clamp(12px, 3.4vw, 1.3em);
	line-height: 1.3;
	color: #fff;
	overflow-wrap: break-word;
	hyphens: none;
}

#td_modal.player_error > div:first-child {
	font-weight: bold;
	margin-bottom: .5em;
}

#td_modal.player_error > div:nth-of-type(2) {
	font-size: .8em;
	opacity: .9;
	margin-bottom: 0;
}

#td_modal.player_error div.links:empty {
	display: none;
}

#td_modal div.links {
	display: flex;
	justify-content: space-evenly;
	margin-top: 22px;
}

#td_modal div.links a {
	font-size: .8em;
	background-color: #574f39;
	color: #fff;
	padding: 12px 16px;
	border-radius: 5px;
	text-decoration: none;
	margin: 0 10px;
}

#td_modal.replay {
	border: none;
	box-shadow: none;
	overflow: visible;
	background-color: transparent;
}

#td_modal.replay > div {
	cursor: pointer;
}

#td_modal.replay .td-svg-icon-replay {
	height: 88px;
	width: 88px;
	position: relative;
	top: 7px;
	fill: #fff;
	opacity: .9;
	transition: opacity .15s;
}

#td_modal.replay > div:hover .td-svg-icon-replay {
	opacity: 1;
}



/* loading state: neutral spinner */
#td_loading {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 54px;
	height: 54px;
	transform: translate(-50%, -50%);
	z-index: 2;
}

#td_loading .td-spin {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 4px solid rgba(255, 255, 255, .2);
	border-top-color: #fff;
	animation: td-spin .9s linear infinite;
}

@keyframes td-spin { to { transform: rotate(360deg); } }

/* quality menu + readout (top right, neutral, no branding). The button label is the readout: "Auto · 720p" / "720p". */
#td_quality {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	font-size: 13px;
	line-height: 1;
	color: #fff;
	transition: opacity .25s;
}

#td_quality.td-hidden { display: none; }
#td_quality.td-idle { opacity: 0; pointer-events: none; }

#td_quality .td-q-btn {
	display: flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 6px 9px;
	border: 0;
	border-radius: 4px;
	background-color: rgba(0, 0, 0, .55);
	color: #fff;
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

#td_quality .td-q-btn:hover,
#td_quality.open .td-q-btn { background-color: rgba(0, 0, 0, .8); }

#td_quality .td-q-btn svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
}

/* only one rendition (or none known): readout only, no menu */
#td_quality.td-single .td-q-btn { cursor: default; }
#td_quality.td-single .td-q-btn svg { display: none; }
#td_quality.td-single .td-q-menu { display: none !important; }

#td_quality .td-q-menu {
	display: none;
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	min-width: 96px;
	max-height: calc(100vh - 60px);
	overflow-y: auto;
	padding: 4px 0;
	border-radius: 4px;
	background-color: rgba(0, 0, 0, .85);
}

#td_quality.open .td-q-menu { display: block; }

#td_quality .td-q-item {
	display: block;
	width: 100%;
	margin: 0;
	padding: 8px 14px 8px 26px;
	border: 0;
	background: none;
	color: #fff;
	font: inherit;
	text-align: left;
	cursor: pointer;
	position: relative;
	white-space: nowrap;
}

#td_quality .td-q-item:hover { background-color: rgba(255, 255, 255, .15); }

#td_quality .td-q-item.sel::before {
	content: '';
	position: absolute;
	left: 10px;
	top: 50%;
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-radius: 50%;
	background-color: #fff;
}
