/* Shared styles for the player pages in this folder (see player-page.js). */

#player-wrapper {
	display: block;
	margin: 0 auto;
}
/* Narrower on the page itself; embedded, the player fills its container.
   !important beats the inline style="width: 100%" of the embed code. */
.player-page #player-wrapper {
	width: 70% !important;
}
/* Viewer count, staff only (see player-page.js). */
.viewer-count {
	width: 70%;
	margin: 0.6em auto 0;
	color: #555;
	font-family: sans-serif;
	font-size: 0.85em;
	font-variant-numeric: tabular-nums;
}
.player-page.chat-side ~ .viewer-count {
	width: 94%;
}

/* Same corners as the chat next to it. Only on these pages: the embed code
   does not load this stylesheet, and the iframe view below stays square. */
.player-page video#player-wrapper {
	border-radius: 20px;
}

.embed-box {
	width: 70%;
	margin: 1em auto 0;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #f7f7f7;
	font-family: sans-serif;
	font-size: 0.9em;
}
.embed-box-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.4em 0.8em;
	border-bottom: 1px solid #ccc;
	font-weight: bold;
}
.embed-tabs button {
	font: inherit;
	color: #888;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	padding: 0.2em 0;
	margin-right: 1.2em;
	cursor: pointer;
}
.embed-tabs button[aria-selected="true"] {
	color: #000;
	border-bottom-color: #333;
}
.embed-actions {
	display: flex;
	align-items: center;
	gap: 0.8em;
}
.embed-actions label {
	display: flex;
	align-items: center;
	gap: 0.3em;
	font-size: 0.85em;
	font-weight: normal;
	cursor: pointer;
}
.embed-copy {
	font-size: 0.85em;
	padding: 0.2em 0.6em;
	cursor: pointer;
}
.embed-box pre {
	margin: 0;
	padding: 0.8em;
	overflow-x: auto;
	white-space: pre;
	font-family: monospace;
}
.embed-box pre.minimal {
	white-space: pre-wrap;
	word-break: break-all;
}

.embed-links {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.4em 1.2em;
	padding: 0.6em 0.8em;
	border-top: 1px solid #ccc;
}
.embed-links[hidden] {
	display: none;
}
.embed-links span {
	color: #666;
	font-size: 0.85em;
}

/* Chat next to the player, switched on per player in the admin.
   The frame is taken out of the flow so that the row follows the 16:9 video. */
.player-page.chat-side {
	display: grid;
	grid-template-columns: minmax(0, 7fr) minmax(280px, 3fr);
	gap: 1em;
	width: 94%;
	margin: 0 auto;
}
.player-page.chat-side #player-wrapper {
	width: 100% !important;
}
.player-page.chat-side ~ .embed-box,
.player-page.chat-side ~ .debug-panel {
	width: 94%;
}
.chat-panel {
	position: relative;
	min-height: 20rem;
}
.chat-panel iframe {
	position: absolute;
	inset: 0;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	border: 0;
}
/* Narrow screens and audio players have no height to share: chat below. */
.player-page.chat-side:has(audio#player-wrapper) {
	grid-template-columns: minmax(0, 1fr);
}
.player-page.chat-side:has(audio#player-wrapper) .chat-panel {
	height: 60vh;
}
@media (max-width: 800px), (orientation: portrait) {
	.player-page.chat-side {
		grid-template-columns: minmax(0, 1fr);
		width: 100%;
	}
	.player-page.chat-side ~ .embed-box,
	.player-page.chat-side ~ .debug-panel,
	.player-page.chat-side ~ .viewer-count {
		width: auto;
		box-sizing: border-box;
	}
	.chat-panel {
		height: 60vh;
	}
}

/* Upright screens (phones, tablets): the video runs edge to edge, the
   boxes below it keep a small margin. */
@media (orientation: portrait) {
	body {
		margin: 0;
	}
	.player-page #player-wrapper {
		width: 100% !important;
	}
	.player-page video#player-wrapper {
		border-radius: 0;
	}
	.player-page ~ .embed-box,
	.player-page ~ .debug-panel,
	.player-page ~ .viewer-count {
		box-sizing: border-box;
		width: auto;
		margin-left: 8px;
		margin-right: 8px;
	}
}

/* Iframe mode: only the player, filling the whole frame. */
html.iframe,
html.iframe body,
html.iframe .player-page,
html.iframe .player-page > div {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
}
html.iframe,
html.iframe body {
	background: #000;
}
html.iframe #player-wrapper {
	width: 100% !important;
	border-radius: 0;
	height: 100% !important;
	border: 0;
	outline: 0;
	object-fit: contain;
}
/* Audio has no picture: keep the controls' own height on a neutral background. */
html.iframe audio#player-wrapper {
	height: auto !important;
}
html.iframe:has(audio#player-wrapper),
html.iframe:has(audio#player-wrapper) body {
	background: transparent;
}
