:root {
	--rpf-accent: #661948;
	--rpf-bg: #16202e;
	--rpf-fg: #f4f6f8;
	--rpf-muted: #9fb0c3;
	--rpf-h: 64px;
	--rpf-total: calc(var(--rpf-h) + env(safe-area-inset-bottom, 0px));
}

/* Barra fixa */
.rpf-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99990;
	box-sizing: border-box;
	height: var(--rpf-total);
	padding: 0 16px env(safe-area-inset-bottom, 0px);
	display: flex;
	align-items: center;
	gap: 14px;
	background: var(--rpf-bg);
	color: var(--rpf-fg);
	border-top: 2px solid var(--rpf-accent);
	box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.28);
	font-size: 14px;
	line-height: 1.25;
}

.rpf-bar *,
.rpf-bar *::before,
.rpf-bar *::after {
	box-sizing: border-box;
}

/* Espaço para a barra não cobrir o rodapé do site */
body.rpf-has-bar {
	padding-bottom: var(--rpf-total);
}

/* Botão "voltar ao topo" do Newspaper acima da barra (ajustar se necessário) */
body.rpf-has-bar .td-scroll-up {
	bottom: calc(var(--rpf-total) + 8px) !important;
}

.rpf-logo {
	flex: none;
	display: block;
	height: 44px;
	width: auto;
	max-width: 150px;
	object-fit: contain;
}

/* Botão play/pause: bola na cor de destaque com o ícone branco */
.rpf-bar .rpf-toggle {
	flex: none;
	width: 44px;
	height: 44px;
	min-width: 44px;
	margin: 0;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: var(--rpf-accent);
	color: #fff;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
	line-height: 1;
	cursor: pointer;
	transition: transform 0.12s ease;
}

.rpf-bar .rpf-toggle:hover,
.rpf-bar .rpf-toggle:focus,
.rpf-bar .rpf-toggle:active {
	background: var(--rpf-accent);
	color: #fff;
}

.rpf-bar .rpf-toggle:hover {
	transform: scale(1.06);
}

.rpf-bar .rpf-toggle:focus-visible {
	outline: 3px solid var(--rpf-fg);
	outline-offset: 4px;
}

.rpf-ico {
	fill: currentColor;
}

.rpf-ico-pause,
.rpf-bar[data-state="playing"] .rpf-ico-play,
.rpf-bar[data-state="loading"] .rpf-ico-play {
	display: none;
}

.rpf-bar[data-state="playing"] .rpf-ico-pause,
.rpf-bar[data-state="loading"] .rpf-ico-pause {
	display: block;
}

.rpf-bar[data-state="loading"] .rpf-toggle {
	animation: rpf-breathe 1.1s ease-in-out infinite;
}

/* Textos */
.rpf-info {
	min-width: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
}

.rpf-top {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.rpf-live {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	font-size: 19px;
	font-weight: 700;
	letter-spacing: 0.01em;
	color: var(--rpf-fg);
}

.rpf-dot {
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--rpf-muted);
}

.rpf-bar[data-state="playing"] .rpf-dot {
	background: #ff4d4d;
	animation: rpf-pulse 1.6s ease-out infinite;
}

.rpf-bar[data-state="error"] .rpf-dot {
	background: #ff4d4d;
}

.rpf-status {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--rpf-muted);
	font-size: 12.5px;
}

/* Programa no ar */
.rpf-now {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.2;
}

.rpf-now[hidden] {
	display: none;
}

.rpf-now-label {
	color: var(--rpf-muted);
	font-size: 11.5px;
	white-space: nowrap;
}

.rpf-now-name {
	color: var(--rpf-fg);
	font-size: 14.5px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rpf-status:empty {
	display: none;
}

/* Volume */
.rpf-vol {
	flex: none;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	color: var(--rpf-muted);
}

.rpf-vol svg {
	fill: currentColor;
}

.rpf-vol input[type="range"] {
	width: 110px;
	margin: 0;
	accent-color: var(--rpf-fg);
}

@media (max-width: 600px) {
	.rpf-bar {
		padding-left: 12px;
		padding-right: 12px;
		gap: 12px;
	}
	.rpf-vol input[type="range"] {
		width: 72px;
	}
}

/* Barra de carregamento no topo durante a navegação AJAX */
html.rpf-loading::after {
	content: "";
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	background: var(--rpf-accent);
	transform-origin: left center;
	z-index: 100000;
	animation: rpf-load 1s ease-in-out infinite;
}

@keyframes rpf-load {
	0% { transform: scaleX(0); }
	70% { transform: scaleX(0.85); }
	100% { transform: scaleX(1); opacity: 0; }
}

@keyframes rpf-pulse {
	0% { box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.6); }
	100% { box-shadow: 0 0 0 8px rgba(255, 77, 77, 0); }
}

@keyframes rpf-breathe {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
	.rpf-bar *,
	html.rpf-loading::after {
		animation: none !important;
		transition: none !important;
	}
}

/* Mensagens do modo diagnóstico */
.rpf-debug {
	display: none;
	position: absolute;
	left: 0;
	bottom: 100%;
	max-width: 100%;
	padding: 5px 10px;
	background: #000;
	color: #fff;
	font: 12px/1.3 ui-monospace, Menlo, Consolas, monospace;
	word-break: break-word;
	max-height: 45vh;
	overflow: auto;
	white-space: pre-line;
}

@media (max-width: 600px) {
	/* No celular: só play, "Ao vivo" e volume */
	.rpf-logo {
		display: none;
	}
	.rpf-live {
		font-size: 17px;
	}
}

/* iPhone/iPad ignoram o volume do navegador (vale só o botão do aparelho) */
.rpf-bar.rpf-no-vol .rpf-vol {
	display: none;
}
