/* EcoGames montado en la plantilla WP (sin iframe). */

/*
 * Aislamiento do tema Sogama (main.css): tipografía, listas, enlaces e botóns
 * xenéricos non deben pisar o motor. Os CSS do xogo cargan despois e refinan.
 */
.ecogames-inline {
	font-family: var(--egames-fuente, "Poppins", sans-serif);
	font-size: 16px;
	line-height: 1.5;
	color: var(--egames-texto, #1a2332);
}

.ecogames-inline :where(p) {
	margin-top: 0;
}

.ecogames-inline :where(h1, h2, h3, h4, h5, h6) {
	font-family: inherit;
	font-weight: inherit;
	line-height: inherit;
	letter-spacing: normal;
	color: inherit;
	clear: none;
	margin: 0;
}

.ecogames-inline :where(ul, ol) {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ecogames-inline :where(a:not(.egames-boton), a:not(.egames-boton):visited) {
	color: inherit;
	text-decoration: none;
}

.ecogames-inline :where(a:not(.egames-boton):hover, a:not(.egames-boton):focus, a:not(.egames-boton):active) {
	color: inherit;
	outline: none;
}

/*
 * main.css cambia color en a:hover; en .egames-boton--contorno el borde es currentColor
 * y parecía que el borde cambiaba de color. Fijamos el color en todos los estados.
 */
.ecogames-inline :where(a, button).egames-boton--contorno,
.ecogames-inline a.egames-boton--contorno:visited,
.ecogames-inline :where(a, button).egames-boton--contorno:hover,
.ecogames-inline :where(a, button).egames-boton--contorno:focus,
.ecogames-inline :where(a, button).egames-boton--contorno:active {
	color: var(--egames-verde-claro) !important;
	border-color: var(--egames-verde-claro) !important;
}

.ecogames-inline :where(a, button).egames-boton--contorno.egames-boton--ranking,
.ecogames-inline a.egames-boton--contorno.egames-boton--ranking:visited,
.ecogames-inline :where(a, button).egames-boton--contorno.egames-boton--ranking:hover,
.ecogames-inline :where(a, button).egames-boton--contorno.egames-boton--ranking:focus,
.ecogames-inline :where(a, button).egames-boton--contorno.egames-boton--ranking:active {
	color: var(--egames-ambar) !important;
	border-color: var(--egames-ambar) !important;
}

.ecogames-inline :where(a, button).egames-boton--principal:hover,
.ecogames-inline :where(a, button).egames-boton--principal:focus,
.ecogames-inline :where(a, button).egames-boton--principal:active {
	color: #fff;
	border-color: transparent;
}

.ecogames-inline :where(a, button).egames-boton--acento:hover,
.ecogames-inline :where(a, button).egames-boton--acento:focus,
.ecogames-inline :where(a, button).egames-boton--acento:active {
	color: #fff;
	border-color: transparent;
}

/* Solo botones xenéricos do tema; non pisar -btn-sec do motor nin .egames-boton */
.ecogames-inline :where(
	button:not([class*="-btn-"]):not(.egames-boton),
	input[type="button"]:not([class*="-btn-"]),
	input[type="submit"]:not([class*="-btn-"]),
	input[type="reset"]:not([class*="-btn-"])
) {
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	color: inherit;
	background: transparent;
	border: none;
	border-radius: 0;
	padding: 0;
	margin: 0;
	box-shadow: none;
	appearance: none;
	-webkit-appearance: none;
}

.ecogames-inline :where(
	button:not([class*="-btn-"]):not(.egames-boton):hover,
	button:not([class*="-btn-"]):not(.egames-boton):focus,
	button:not([class*="-btn-"]):not(.egames-boton):active,
	input[type="button"]:not([class*="-btn-"]):hover,
	input[type="submit"]:not([class*="-btn-"]):hover,
	input[type="reset"]:not([class*="-btn-"]):hover
) {
	background: transparent;
}

/* main.css L526-541: button:hover/focus border-color — ver tamén ecogames-wp-overrides.css */
.ecogames-inline :where(.sort-btn-ghost, .blitz-btn-how-alt, .sh-btn-ghost, .match-btn-ghost):hover,
.ecogames-inline :where(.sort-btn-ghost, .blitz-btn-how-alt, .sh-btn-ghost, .match-btn-ghost):focus,
.ecogames-inline :where(.sort-btn-ghost, .blitz-btn-how-alt, .sh-btn-ghost, .match-btn-ghost):active {
	border-color: var(--egames-borde) !important;
}

.ecogames-inline :where(.sort-btn-primary, .blitz-btn-primary, .sh-btn-primary, .match-btn-primary):hover,
.ecogames-inline :where(.sort-btn-primary, .blitz-btn-primary, .sh-btn-primary, .match-btn-primary):focus,
.ecogames-inline :where(.sort-btn-primary, .blitz-btn-primary, .sh-btn-primary, .match-btn-primary):active {
	border-color: #3a9e5f !important;
}

body.sogama-ecogames-inline #page > main.site-main--ecogames-inline {
	max-width: none;
	padding-left: 0;
	padding-right: 0;
	padding-bottom: calc(3rem + var(--sogama-grass-overlap, 40px) + var(--sogama-grass-height, 56px));
	background-color: var(--egames-fondo, #f0f4f8);
}

.site-main--ecogames-inline .ecogames-inline {
	width: 100%;
	background: var(--egames-fondo, #f0f4f8);
}

/* Los juegos usan 100vh pensando en documento propio; aquí el scroll es la página WP. */
.site-main--ecogames-inline .sort-root,
.site-main--ecogames-inline .blitz-root,
.site-main--ecogames-inline .sh-root,
.site-main--ecogames-inline .match-root {
	height: auto !important;
	min-height: 0 !important;
	overflow: visible !important;
}

.site-main--ecogames-inline #match-game {
	overflow: visible !important;
}

/* Altura útil para centrar pantallas curtas no scroll da páxina WP. */
body.sogama-ecogames-inline {
	--eg-wp-fill: max(320px, calc(100dvh - 11rem));
}


body.sogama-ecogames-inline {
	background: var(--egames-fondo, #f0f4f8);
	overflow-x: clip;
	overflow-y: visible !important;
	height: auto !important;
	min-height: 0 !important;
}

body.sogama-ecogames-inline .site-main--ecogames-inline {
	overflow-x: clip;
	overflow-y: visible !important;
	height: auto !important;
	background: var(--egames-fondo, #f0f4f8);
	min-height: var(--eg-wp-fill, 0) !important;
}

body.sogama-ecogames-inline .sort-root,
body.sogama-ecogames-inline .blitz-root,
body.sogama-ecogames-inline .sh-root,
body.sogama-ecogames-inline .match-root {
	height: auto !important;
	min-height: 0 !important;
	overflow: visible !important;
	position: relative;
	width: 100%;
}

/* Eco-Blitz / Eco-Sort / Eco-Shooter: fondo e centrado no viewport útil */
body.sogama-ecogames-inline .blitz-root::after {
	position: absolute !important;
	inset: 0 !important;
	height: auto !important;
	min-height: 100% !important;
	pointer-events: none;
}

body.sogama-ecogames-inline .blitz-root,
body.sogama-ecogames-inline .sort-root,
body.sogama-ecogames-inline .sh-root,
body.sogama-ecogames-inline .match-root {
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	min-height: var(--eg-wp-fill, 0) !important;
	touch-action: pan-y pinch-zoom !important;
}

body.sogama-ecogames-inline .blitz-root:has(#screen-how.blitz-active),
body.sogama-ecogames-inline .blitz-root:has(#screen-frac.blitz-active),
body.sogama-ecogames-inline .blitz-root:has(#screen-over.blitz-active),
body.sogama-ecogames-inline .sort-root:has(#screen-how.sort-active),
body.sogama-ecogames-inline .sort-root:has(#screen-frac.sort-active),
body.sogama-ecogames-inline .sort-root:has(#screen-over.sort-active),
body.sogama-ecogames-inline .sort-root:has(#screen-game.sort-active),
body.sogama-ecogames-inline .sh-root:has(#screen-how.sh-active),
body.sogama-ecogames-inline .sh-root:has(#screen-frac.sh-active),
body.sogama-ecogames-inline .sh-root:has(#screen-over.sh-active) {
	justify-content: flex-start !important;
	min-height: 0 !important;
}

body.sogama-ecogames-inline .blitz-screen:not(.blitz-active),
body.sogama-ecogames-inline .sort-screen:not(.sort-active),
body.sogama-ecogames-inline .sh-screen:not(.sh-active) {
	display: none !important;
}

body.sogama-ecogames-inline .sort-screen.sort-active,
body.sogama-ecogames-inline .blitz-screen.blitz-active,
body.sogama-ecogames-inline .sh-screen.sh-active {
	display: flex !important;
	flex-direction: column;
	align-items: center;
	width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	max-height: none !important;
}

/* Pantallas curtas (menú, fase, partida, récords): centrado vertical */
body.sogama-ecogames-inline #screen-title.blitz-active,
body.sogama-ecogames-inline #screen-title.sort-active,
body.sogama-ecogames-inline #screen-title.sh-active,
body.sogama-ecogames-inline #screen-phase.blitz-active,
body.sogama-ecogames-inline #screen-phase.sort-active,
body.sogama-ecogames-inline #screen-phase.sh-active,
body.sogama-ecogames-inline #screen-ranking.blitz-active,
body.sogama-ecogames-inline #screen-ranking.sort-active,
body.sogama-ecogames-inline #screen-ranking.sh-active {
	flex: 1 1 auto;
	width: 100% !important;
	min-height: var(--eg-wp-fill, 0) !important;
	justify-content: center !important;
}

/*
 * Partida: non estirar #screen-game (flex:1 na arena separa HUD e cubos).
 * O root centra o bloque compacto; dentro todo flex-start.
 */
body.sogama-ecogames-inline #screen-game.blitz-active,
body.sogama-ecogames-inline #screen-game.sort-active,
body.sogama-ecogames-inline #screen-game.sh-active {
	flex: 0 0 auto !important;
	min-height: 0 !important;
	height: auto !important;
	width: 100% !important;
	justify-content: flex-start !important;
	align-self: stretch;
	display: flex !important;
	flex-direction: column !important;
}

body.sogama-ecogames-inline #screen-game.blitz-active {
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch;
	padding-top: 24px !important;
}

body.sogama-ecogames-inline #screen-game .egames-play-volver-wrap {
	flex: 0 0 auto !important;
	display: flex !important;
}

body.sogama-ecogames-inline #canvas-wrap,
body.sogama-ecogames-inline #gc {
	touch-action: none !important;
}

body.sogama-ecogames-inline .sort-root:has(#screen-game.sort-active),
body.sogama-ecogames-inline .sh-root:has(#screen-game.sh-active),
body.sogama-ecogames-inline .blitz-root:has(#screen-game.blitz-active) {
	justify-content: flex-start !important;
	min-height: 0 !important;
}

body.sogama-ecogames-inline #screen-game.sort-active,
body.sogama-ecogames-inline #screen-game.sh-active {
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch;
	padding-top: 24px !important;
}

/* Eco-Blitz partida: #screen-game é #f8fafb, o root/body eran #f0f4f8 → bandas ao centrar */
body.sogama-ecogames-inline:has(#screen-game.blitz-active) {
	background: #f8fafb;
}

body.sogama-ecogames-inline:has(#screen-game.blitz-active) #page,
body.sogama-ecogames-inline:has(#screen-game.blitz-active) .site-main--ecogames-inline {
	background: #f8fafb !important;
}

body.sogama-ecogames-inline .blitz-root:has(#screen-game.blitz-active) {
	background: #f8fafb !important;
}

body.sogama-ecogames-inline .blitz-root:has(#screen-game.blitz-active)::after {
	display: none !important;
}

body.sogama-ecogames-inline #screen-how.blitz-active,
body.sogama-ecogames-inline #screen-how.sort-active,
body.sogama-ecogames-inline #screen-how.sh-active,
body.sogama-ecogames-inline #screen-frac.blitz-active,
body.sogama-ecogames-inline #screen-frac.sort-active,
body.sogama-ecogames-inline #screen-frac.sh-active,
body.sogama-ecogames-inline #screen-over.blitz-active,
body.sogama-ecogames-inline #screen-over.sort-active,
body.sogama-ecogames-inline #screen-over.sh-active {
	flex: none !important;
	align-self: stretch !important;
	min-height: 0 !important;
	justify-content: flex-start !important;
}

body.sogama-ecogames-inline .match-root::before {
	position: absolute !important;
	inset: 0 !important;
	height: auto !important;
	min-height: 100% !important;
}

body.sogama-ecogames-inline .sort-screen,
body.sogama-ecogames-inline .blitz-screen,
body.sogama-ecogames-inline .sh-screen {
	width: 100% !important;
	height: auto !important;
	min-height: 0 !important;
	max-height: none !important;
}

body.sogama-ecogames-inline #screen-how,
body.sogama-ecogames-inline #screen-frac,
body.sogama-ecogames-inline #screen-over,
body.sogama-ecogames-inline #screen-ranking {
	overflow-y: visible !important;
	-webkit-overflow-scrolling: auto;
}

body.sogama-ecogames-inline .match-mbox {
	max-height: none;
	overflow-y: visible;
}

/* Recicla-Match: pantallas fullscreen con position:fixed no fragmento (inline). */

body.sogama-ecogames-inline #m-how:not(.match-hidden):not(.match-hiding),
body.sogama-ecogames-inline #m-frac:not(.match-hidden):not(.match-hiding) {
	position: relative !important;
	inset: auto !important;
	top: auto !important;
	right: auto !important;
	bottom: auto !important;
	left: auto !important;
	width: 100% !important;
	min-height: 0 !important;
	height: auto !important;
	overflow-y: visible !important;
	-webkit-overflow-scrolling: auto;
	z-index: 1 !important;
}

body.sogama-ecogames-inline .match-root:has(#screen-title:not([style*="display: none"])),
body.sogama-ecogames-inline .match-root:has(#screen-ranking:not(.match-hidden):not(.match-hiding)) {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: var(--eg-wp-fill, 0) !important;
}

body.sogama-ecogames-inline .match-root #screen-ranking:not(.match-hidden):not(.match-hiding) {
	position: relative !important;
	inset: auto !important;
	width: 100% !important;
	flex: 1 0 auto;
	min-height: var(--eg-wp-fill, 0) !important;
	height: auto !important;
	display: flex !important;
	flex-direction: column;
	align-items: center;
	justify-content: center !important;
	overflow-y: visible !important;
	-webkit-overflow-scrolling: auto;
	z-index: 1 !important;
	background:
		radial-gradient(ellipse at 50% 22%, #d4edda, #f0f4f8 58%),
		var(--egames-fondo, #f0f4f8) !important;
}

body.sogama-ecogames-inline #screen-title:not([style*="display: none"]) {
	position: relative !important;
	inset: auto !important;
	width: 100% !important;
	flex: 1 0 auto;
	min-height: var(--eg-wp-fill, 0) !important;
	height: auto !important;
	overflow-y: visible !important;
	z-index: 1 !important;
	align-items: center;
	justify-content: center;
	background:
		radial-gradient(ellipse at 50% 22%, #d4edda, #f0f4f8 58%),
		var(--egames-fondo, #f0f4f8) !important;
}

body.sogama-ecogames-inline .match-root:has(#m-how:not(.match-hidden):not(.match-hiding)) #match-game,
body.sogama-ecogames-inline .match-root:has(#m-how:not(.match-hidden):not(.match-hiding)) #screen-title,
body.sogama-ecogames-inline .match-root:has(#m-how:not(.match-hidden):not(.match-hiding)) #m-frac,
body.sogama-ecogames-inline .match-root:has(#m-how:not(.match-hidden):not(.match-hiding)) #screen-ranking,
body.sogama-ecogames-inline .match-root:has(#m-frac:not(.match-hidden):not(.match-hiding)) #match-game,
body.sogama-ecogames-inline .match-root:has(#m-frac:not(.match-hidden):not(.match-hiding)) #screen-title,
body.sogama-ecogames-inline .match-root:has(#m-frac:not(.match-hidden):not(.match-hiding)) #m-how,
body.sogama-ecogames-inline .match-root:has(#m-frac:not(.match-hidden):not(.match-hiding)) #screen-ranking,
body.sogama-ecogames-inline .match-root:has(#screen-ranking:not(.match-hidden):not(.match-hiding)) #match-game,
body.sogama-ecogames-inline .match-root:has(#screen-ranking:not(.match-hidden):not(.match-hiding)) #screen-title,
body.sogama-ecogames-inline .match-root:has(#screen-ranking:not(.match-hidden):not(.match-hiding)) #m-how,
body.sogama-ecogames-inline .match-root:has(#screen-ranking:not(.match-hidden):not(.match-hiding)) #m-frac,
body.sogama-ecogames-inline .match-root:has(#screen-title:not([style*="display: none"])) #match-game {
	display: none !important;
}

body.sogama-ecogames-inline #match-game {
	padding-top: 40px !important;
	overflow: visible !important;
	height: auto !important;
	min-height: 0 !important;
	max-height: none !important;
}

body.sogama-ecogames-inline .match-root:has(#match-game:not([style*="display: none"])) {
	justify-content: flex-start !important;
	min-height: 0 !important;
}

body.sogama-ecogames-inline .match-root {
	min-height: 0 !important;
}

/* Récords globales: scroll na páxina WP */
body.sogama-ecogames-inline .site-main--ecogames-inline:has(#rankings-grid) {
	min-height: 0 !important;
	height: auto !important;
	overflow-y: visible !important;
}

body.sogama-ecogames-inline #rankings-grid {
	flex: none !important;
	overflow: visible !important;
}
