/**
 * Games Hub — stiluri comune.
 *
 * Aici stă carcasa pe care o folosesc toate jocurile: bara de sus, terenul,
 * ecranul de final, butoanele. Un joc nou nu are nevoie de CSS propriu decât
 * pentru ce e specific lui.
 *
 * Totul este prefixat cu .gh- și declarat explicit, ca temele agresive
 * (care setează stiluri globale pe button, canvas, p) să nu strice jocurile.
 */

.gh-game {
	--gh-maxw: 440px;
	--gh-radius: 18px;
	--gh-bg: #12162a;
	--gh-panel: #1b2140;
	--gh-panel-2: #252c52;
	--gh-text: #f2f4ff;
	--gh-muted: #9aa3c9;
	--gh-accent: #ffb020;
	--gh-accent-text: #2a1a00;
	--gh-danger: #ff5d6c;
	--gh-shadow: 0 18px 40px rgba(0, 0, 0, .35);

	display: block;
	box-sizing: border-box;
	max-width: var(--gh-maxw);
	margin: 1.5em auto;
	padding: 0;
	color: var(--gh-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.35;
	text-align: left;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none;
	user-select: none;
}

.gh-game[data-gh-theme="light"] {
	--gh-bg: #eef1f8;
	--gh-panel: #ffffff;
	--gh-panel-2: #f1f3fa;
	--gh-text: #151932;
	--gh-muted: #666e91;
	--gh-accent: #f59200;
	--gh-accent-text: #2a1a00;
	--gh-shadow: 0 14px 34px rgba(24, 30, 60, .14);
}

@media (prefers-color-scheme: light) {
	.gh-game[data-gh-theme="auto"] {
		--gh-bg: #eef1f8;
		--gh-panel: #ffffff;
		--gh-panel-2: #f1f3fa;
		--gh-text: #151932;
		--gh-muted: #666e91;
		--gh-accent: #f59200;
		--gh-accent-text: #2a1a00;
		--gh-shadow: 0 14px 34px rgba(24, 30, 60, .14);
	}
}

.gh-game *,
.gh-game *::before,
.gh-game *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/**
 * Resetul de buton trebuie să învingă reguli de temă precum
 * `.entry-content button`, deci are specificitatea (0,1,1).
 *
 * ATENȚIE: din același motiv el bate orice regulă de o singură clasă. Un joc
 * care stilează un buton trebuie să scrie `.gh-game .clasa-mea` — două clase,
 * adică (0,2,0) — altfel fundalul și colțurile îi sunt suprascrise aici.
 */
.gh-game button {
	display: inline-block;
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	border-radius: 999px;
	text-transform: none;
	letter-spacing: normal;
	text-shadow: none;
	box-shadow: none;
	cursor: pointer;
	touch-action: manipulation;
}

.gh-game canvas {
	display: block;
	max-width: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.gh-stage {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 220px;
}

/* ------------------------------------------------------------------ */
/* Carcasa jocului                                                     */
/* ------------------------------------------------------------------ */

.gh-wrap {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	margin: 0 auto;
}

.gh-hud {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 12px;
	border-radius: 14px;
	background: var(--gh-panel);
}

.gh-stat {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 48px;
}

.gh-label {
	color: var(--gh-muted);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	white-space: nowrap;
}

.gh-value {
	font-size: 19px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.15;
}

/* Element liber în bara de sus: fructul următor, bara de timp etc. */
.gh-slot {
	display: flex;
	align-items: center;
	gap: 7px;
	margin-left: auto;
}

.gh-chip {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 5px 10px 5px 11px;
	border-radius: 999px;
	background: var(--gh-panel-2);
}

.gh-game .gh-sound {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--gh-panel-2);
	font-size: 15px;
	line-height: 1;
	transition: transform .12s ease;
}

.gh-game .gh-sound:active { transform: scale(.9); }
.gh-game .gh-sound.is-off { opacity: .5; }

.gh-field {
	position: relative;
	align-self: center;
	width: 100%;
}

.gh-field canvas {
	display: block;
	margin: 0 auto;
	border-radius: 16px;
	box-shadow: var(--gh-shadow);
	touch-action: none;
	cursor: pointer;
}

.gh-field canvas:focus-visible {
	outline: 3px solid var(--gh-accent);
	outline-offset: 3px;
}

/* Text care apare scurt peste teren (combo, „perfect”). */
.gh-flash {
	position: absolute;
	top: 16%;
	left: 50%;
	z-index: 5;
	transform: translate(-50%, 0) scale(.7);
	color: var(--gh-accent);
	font-size: 26px;
	font-weight: 800;
	text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}

.gh-flash.is-visible {
	opacity: 1;
	transform: translate(-50%, -14px) scale(1);
}

/* ------------------------------------------------------------------ */
/* Ecranul de final                                                    */
/* ------------------------------------------------------------------ */

.gh-over {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: grid;
	place-items: center;
	border-radius: 16px;
	background: rgba(8, 10, 24, .74);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.gh-over[hidden] { display: none; }

.gh-over-card {
	width: min(86%, 320px);
	padding: 22px 18px;
	text-align: center;
	color: #fff;
	animation: gh-pop .26s cubic-bezier(.2, 1.3, .5, 1) both;
}

@keyframes gh-pop {
	from { opacity: 0; transform: scale(.88) translateY(10px); }
	to   { opacity: 1; transform: none; }
}

.gh-over-title {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
	opacity: .75;
}

.gh-over-score {
	margin-top: 2px;
	font-size: 46px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	line-height: 1.05;
}

.gh-over-record {
	margin-top: 4px;
	font-size: 14px;
	opacity: .8;
}

.gh-over-record.is-new {
	color: var(--gh-accent);
	font-weight: 700;
	opacity: 1;
}

.gh-over-note {
	margin-top: 10px;
	font-size: 13px;
	opacity: .75;
}

.gh-over-note span {
	font-size: 20px;
	vertical-align: -3px;
}

.gh-over-actions {
	display: flex;
	flex-direction: column;
	gap: 9px;
	margin-top: 18px;
}

.gh-game .gh-btn {
	padding: 13px 20px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	transition: transform .12s ease;
}

.gh-game .gh-btn:active { transform: scale(.97); }

.gh-game .gh-btn--primary {
	background: var(--gh-accent);
	color: var(--gh-accent-text);
}

/* ------------------------------------------------------------------ */
/* Reclama de pe ecranul de final                                      */
/* ------------------------------------------------------------------ */

/*
 * Blocul stă pe `.gh-stage`, nu în cardul de final: `.gh-wrap` este strâns de
 * fitCanvas la lățimea canvasului, iar acolo lățimea ar coborî sub pragul la
 * care o unitate responsive mai are ce servi.
 */
.gh-ad {
	box-sizing: border-box;
	width: 100%;
	margin-top: 10px;
	padding: 6px 8px 8px;
	border-radius: 12px;
	background: var(--gh-panel);
}

.gh-ad[hidden] { display: none; }

/*
 * Varianta care acoperă jocul. `.gh-stage` este deja `position: relative`,
 * deci stratul se întinde exact peste caseta plugin-ului — nu peste pagină.
 */
.gh-ad--cover {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 0;
	padding: 14px;
	border-radius: var(--gh-radius);
	background: rgba(8, 10, 24, .93);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	/* Pe jocurile scunde anunțul plus butonul pot depăși caseta. Mai bine se
	   derulează decât să rămână închiderea în afara ecranului. */
	overflow-y: auto;
}

.gh-game[data-gh-theme="light"] .gh-ad--cover { background: rgba(232, 236, 246, .95); }

.gh-ad--cover .gh-ad-label { color: rgba(255, 255, 255, .62); }
.gh-game[data-gh-theme="light"] .gh-ad--cover .gh-ad-label { color: #5a628a; }

.gh-ad--cover .gh-ad-box {
	width: 100%;
	max-width: 336px;
}

/* Inert imediat după apariție: ecranul de final vine chiar pe atingerea
   jucătorului, iar un anunț activ în acea clipă atrage clicuri accidentale.
   Închiderea rămâne activă, ca blocul să poată fi scăpat oricând. */
.gh-ad.is-fresh { pointer-events: none; }
.gh-game .gh-ad.is-fresh .gh-ad-close { pointer-events: auto; }

.gh-ad-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 5px;
}

.gh-ad-label {
	color: var(--gh-muted);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .1em;
	text-transform: uppercase;
}

/* Ținta de închidere trebuie să fie confortabilă, dar clar mai mică decât
   anunțul, ca să nu pară ea butonul principal. */
.gh-game .gh-ad-close {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	margin: -4px -2px -4px 0;
	border-radius: 50%;
	background: var(--gh-panel-2);
	color: var(--gh-muted);
	font-size: 13px;
	line-height: 1;
}

.gh-game .gh-ad-close:active { transform: scale(.9); }

/* Doar min-height, fără overflow ascuns: un anunț tăiat este o încălcare de
   politică, deci dacă unitatea iese mai înaltă, cutia crește după ea. */
.gh-ad-box { min-height: 100px; }
.gh-ad--cover .gh-ad-box { min-height: 250px; }

/* Închiderea stratului: lată, înaltă și în culoarea de accent. Ea ascunde
   cardul de final, deci ieșirea trebuie să fie lucrul cel mai evident. */
.gh-game .gh-ad-close--big {
	width: 100%;
	max-width: 336px;
	min-height: 52px;
	margin: 0;
	padding: 14px 20px;
	border-radius: 999px;
	background: var(--gh-accent);
	color: var(--gh-accent-text);
	font-size: 16px;
	font-weight: 700;
}

.gh-game .gh-ad-close--big:active { transform: scale(.97); }

.gh-ad-box ins { display: block; }

.gh-hint {
	color: var(--gh-muted);
	font-size: 13px;
	text-align: center;
	transition: opacity .3s ease;
}

.gh-hint.is-hidden { opacity: 0; }

/* ------------------------------------------------------------------ */
/* Stări auxiliare                                                     */
/* ------------------------------------------------------------------ */

.gh-loading {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: center;
	min-height: 220px;
}

.gh-loading span {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--gh-muted);
	opacity: .35;
	animation: gh-pulse 1s ease-in-out infinite;
}

.gh-loading span:nth-child(2) { animation-delay: .15s; }
.gh-loading span:nth-child(3) { animation-delay: .3s; }

@keyframes gh-pulse {
	0%, 100% { opacity: .25; transform: scale(.8); }
	50%      { opacity: .9;  transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
	.gh-loading span,
	.gh-over-card { animation: none; }
}

.gh-toast {
	position: absolute;
	left: 50%;
	bottom: 18px;
	z-index: 30;
	transform: translateX(-50%) translateY(8px);
	padding: 9px 16px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .82);
	color: #fff;
	font-size: 14px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}

.gh-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.gh-noscript,
.gh-notice {
	padding: 14px 16px;
	border-radius: 12px;
	background: var(--gh-panel);
	color: var(--gh-muted);
	font-size: 15px;
}

.gh-notice {
	border: 1px dashed var(--gh-danger);
	color: var(--gh-danger);
}

/* Modul izolat. */
.gh-iframe-wrap {
	max-width: var(--gh-maxw, 440px);
	margin: 1.5em auto;
}

.gh-iframe {
	display: block;
	width: 100%;
	height: min(86svh, 780px);
	border: 0;
	background: transparent;
	color-scheme: normal;
}
