/* Feed choices and the player each have one quiet, dedicated surface. */
body[selection-page], body[watch-page] {
	min-height: 100vh;
	min-height: 100dvh;
}
[visually-hidden] {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
div[content][selection-page], div[content][player-page] {
	min-width: 0;
	padding-left: env(safe-area-inset-left, 0px);
	padding-right: env(safe-area-inset-right, 0px);
}
div[content][selection-page] { max-width: 760px; }
div[selection-actions] {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding-top: 8px;
}
div[selection-actions] button { min-width: 10rem; }
div[selection-actions] #save-settings {
	color: #39364f;
	border-color: #b6b4c5;
	background: #efedf5;
	box-shadow: none;
}
div[selection-actions] #save-settings:hover:not(:disabled) { background: #e2dfee; }
body[selection-page] #settings-status { margin-bottom: 16px; }
body[selection-page] #reconnect a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

/* This header scrolls away on small screens instead of hiding the player. */
body[watch-page] div[header] {
	position: static;
	gap: 24px;
	padding-block: 4px;
	padding-top: max(4px, env(safe-area-inset-top));
}
body[watch-page] div[header] a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}
body[watch-page] div[header] nav { gap: 24px; }
div[content][player-page] {
	flex: none;
	margin-block: 20px 40px;
	padding-bottom: env(safe-area-inset-bottom, 0px);
}
div[player-heading] {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px 20px;
	margin-bottom: 12px;
}
div[player-heading] h1 {
	min-width: 0;
	font-size: clamp(1.25rem, 3vw, 1.65rem);
	line-height: 1.3;
	letter-spacing: -.035em;
	overflow-wrap: anywhere;
}
#change-feed {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	flex-shrink: 0;
	font-size: .875rem;
	font-weight: 600;
}

/* The reserved stage is unchanged by loading, empty results or video titles.
   Small viewport units keep browser chrome from continually resizing it. */
div[player-stage] {
	display: grid;
	min-width: 0;
	height: clamp(214px, 48vw, 470px);
	height: clamp(214px, calc((100vw - 32px) * .5625), min(100svh - 30rem, 470px));
}
div[player-stage] > * { grid-area: 1 / 1; min-width: 0; }
div[player-stage] div[player-frame] {
	min-height: 214px;
	margin: 0;
	padding: 6px;
	border: 1px solid #4b475a;
	border-radius: 12px;
	background: #292733;
	box-shadow: inset 0 1px #ffffff25, 0 6px 18px #29233417;
}
div[player-stage] iframe, div[player-stage] div[player-slot] {
	width: 100%;
	height: 100%;
	min-width: 200px;
	min-height: 200px;
	aspect-ratio: auto;
	border: 0;
	border-radius: 6px;
	display: block;
	background: #15151b;
}
#player-placeholder {
	display: grid;
	place-content: center;
	padding: 24px;
	border: 1px solid #c6c2d5;
	border-radius: 12px;
	background: #e8e5ef;
	color: #5c566c;
	text-align: center;
	font-size: .9375rem;
	overflow-wrap: anywhere;
	overflow: auto;
}

/* Full text remains readable and keyboard-scrollable without moving controls. */
div[video-details] { margin-top: 16px; }
#video-title {
	margin: 0;
	height: 2.8em;
	font-size: clamp(1.0625rem, 2.5vw, 1.25rem);
	line-height: 1.4;
	font-weight: 600;
}
#video-detail {
	height: 3em;
	margin-top: 6px;
	color: var(--muted);
	font-size: .8125rem;
	line-height: 1.5;
}
#video-title, #video-detail {
	overflow-wrap: anywhere;
	overflow: auto;
	scrollbar-width: thin;
}
div[player-toolbar] {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	min-height: 44px;
}
div[player-toolbar] #position {
	min-width: 0;
	margin: 0;
	font-size: .75rem;
	line-height: 1.5;
	letter-spacing: 0;
	overflow-wrap: anywhere;
}
#youtube-link {
	display: inline-flex;
	align-items: center;
	justify-content: flex-end;
	flex-shrink: 0;
	min-height: 44px;
	font-size: .8125rem;
}
div[player-page] div[feed-controls] {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	margin-top: 6px;
	padding-block: 12px;
	border-block: 1px solid var(--line);
}
div[player-page] div[feed-controls] button {
	min-height: 48px;
	min-width: 0;
	padding-inline: 8px;
	overflow-wrap: anywhere;
}
div[player-messages] {
	margin-top: 14px;
	font-size: .8125rem;
	line-height: 1.6;
	color: var(--muted);
	overflow-wrap: anywhere;
}
div[player-messages] p { margin-block: 8px; }
div[player-messages] p:empty { display: none; }
div[player-messages] #more { margin-top: 8px; }
div[player-messages] #reconnect a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}
div[player-page] nav[player-info] { margin-top: 16px; font-size: .75rem; }

@media (max-width: 580px) {
	div[content][player-page] { margin-top: 12px; }
	div[selection-actions] { flex-direction: column; }
	div[selection-actions] button { width: 100%; min-width: 0; }
	div[player-heading] { gap: 12px; margin-bottom: 8px; }
	div[player-stage] div[player-frame] { border-radius: 8px; }
	div[video-details] { margin-top: 12px; }
	div[player-page] div[feed-controls] { gap: 8px; }
	div[player-page] div[feed-controls] button { font-size: .875rem; }
}
@media (max-width: 540px) {
	body[watch-page] div[header] { gap: 0 12px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
	body[watch-page] a[brand] { font-size: 1.1rem; }
	body[watch-page] div[header] nav {
		order: 0;
		flex-basis: auto;
		gap: 12px;
		font-size: .75rem;
	}
	body[watch-page] a[login] { font-size: .75rem; }
}
@media (max-width: 360px) {
	div[player-heading] h1 { font-size: 1.125rem; }
	#change-feed { font-size: .8125rem; }
	div[player-toolbar] { gap: 10px; }
	div[player-toolbar] #position { font-size: .6875rem; }
}
