/* ---------- Conexões de Cinema ----------
 * Mesma estratégia da cruzadinha: tudo sob ".cf-game.cf-cx" e !important nos
 * pontos que os temas costumam sobrescrever (button, :hover, :focus, pre).
 */

.cf-game.cf-cx {
	--cx-tile: #ece3d6;
	--cx-tile-ink: #1b1409;
	--cx-selected: #5a4a3a;
	--cx-l1: #f2c94c;
	--cx-l2: #7cc47f;
	--cx-l3: #6aa6dc;
	--cx-l4: #b58bd6;
	--cx-ink: #1b1409;
	max-width: 620px;
}

.cf-game.cf-cx .cf-cx-board { display: grid; gap: 8px; }

/* Grupos resolvidos */
.cf-game.cf-cx .cf-cx-solved { display: grid; gap: 8px; }
.cf-game.cf-cx .cf-cx-solved:empty { display: none; }

.cf-game.cf-cx .cf-cx-group {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .15rem;
	min-height: 72px;
	padding: .6rem .8rem;
	border-radius: 10px;
	color: var(--cx-ink);
	text-align: center;
	animation: cf-cx-in .35s ease;
}

.cf-game.cf-cx .cf-cx-group strong {
	font-size: .95rem;
	font-weight: 800;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--cx-ink);
}

.cf-game.cf-cx .cf-cx-group span { font-size: .9rem; line-height: 1.3; color: var(--cx-ink); }
.cf-game.cf-cx .cf-cx-group.is-l1 { background: var(--cx-l1); }
.cf-game.cf-cx .cf-cx-group.is-l2 { background: var(--cx-l2); }
.cf-game.cf-cx .cf-cx-group.is-l3 { background: var(--cx-l3); }
.cf-game.cf-cx .cf-cx-group.is-l4 { background: var(--cx-l4); }
.cf-game.cf-cx .cf-cx-group.is-revealed { opacity: .82; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18); }

@keyframes cf-cx-in {
	from { transform: scale(.94); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

/* Cartas */
.cf-game.cf-cx .cf-cx-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}

.cf-game.cf-cx .cf-cx-grid[hidden] { display: none; }

.cf-game.cf-cx .cf-cx-tile,
.cf-game.cf-cx .cf-cx-tile:hover,
.cf-game.cf-cx .cf-cx-tile:focus,
.cf-game.cf-cx .cf-cx-tile:active {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-width: 0 !important;
	min-height: 72px !important;
	height: auto !important;
	margin: 0 !important;
	padding: .4rem .3rem !important;
	border: 0 !important;
	border-radius: 10px !important;
	outline: none;
	box-shadow: none !important;
	background: var(--cx-tile) !important;
	background-image: none !important;
	color: var(--cx-tile-ink) !important;
	font: 800 clamp(.72rem, 2.6vw, .95rem) / 1.15 system-ui, -apple-system, "Segoe UI", sans-serif !important;
	letter-spacing: .02em !important;
	text-transform: uppercase !important;
	text-align: center !important;
	text-decoration: none !important;
	text-shadow: none !important;
	white-space: normal !important;
	overflow-wrap: anywhere;
	hyphens: auto;
	opacity: 1 !important;
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: transform .1s, background-color .12s, color .12s !important;
}

.cf-game.cf-cx .cf-cx-tile:hover { filter: brightness(.96); }
.cf-game.cf-cx .cf-cx-tile:active { transform: scale(.97); }
.cf-game.cf-cx .cf-cx-tile:focus-visible { outline: 3px solid var(--cf-accent) !important; outline-offset: 2px; }

.cf-game.cf-cx .cf-cx-tile.is-long { font-size: clamp(.64rem, 2.2vw, .82rem) !important; }
.cf-game.cf-cx .cf-cx-tile.is-xlong { font-size: clamp(.58rem, 1.9vw, .72rem) !important; }

.cf-game.cf-cx .cf-cx-tile.is-selected,
.cf-game.cf-cx .cf-cx-tile.is-selected:hover,
.cf-game.cf-cx .cf-cx-tile.is-selected:focus {
	background: var(--cx-selected) !important;
	color: #f4ede4 !important;
	box-shadow: inset 0 0 0 2px var(--cf-accent) !important;
}

.cf-game.cf-cx .cf-cx-tile.is-pop { animation: cf-cx-pop .4s ease; }
.cf-game.cf-cx .cf-cx-tile.is-shake { animation: cf-cx-shake .4s ease; }

@keyframes cf-cx-pop {
	40% { transform: translateY(-8px); }
	100% { transform: translateY(0); }
}

@keyframes cf-cx-shake {
	20%, 60% { transform: translateX(-6px); }
	40%, 80% { transform: translateX(6px); }
}

/* Erros e ações */
.cf-game.cf-cx .cf-cx-message { text-align: center; }

.cf-game.cf-cx .cf-cx-play[hidden] { display: none; }

.cf-game.cf-cx .cf-cx-mistakes {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .6rem;
	margin: 0 0 .9rem;
	color: var(--cf-muted);
	font-size: .9rem;
}

.cf-game.cf-cx .cf-cx-dots { display: inline-flex; gap: 6px; }

.cf-game.cf-cx .cf-cx-dots i {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--cf-surface-2);
	transition: background-color .2s, transform .2s;
}

.cf-game.cf-cx .cf-cx-dots i.is-on { background: var(--cf-accent); }

.cf-game.cf-cx .cf-cx-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .5rem;
}

.cf-game.cf-cx .cf-cx-actions .cf-btn { padding: .7rem 1.1rem !important; font-size: .95rem !important; }

.cf-game.cf-cx .cf-cx-giveup {
	display: block !important;
	margin: .6rem auto 0 !important;
	padding: .4rem .8rem !important;
	font-size: .85rem !important;
}

/* Resultado */
.cf-game.cf-cx .cf-cx-emoji {
	display: block !important;
	width: max-content;
	max-width: 100%;
	margin: .4rem auto 1rem !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	color: inherit !important;
	font: 1.35rem/1.25 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif !important;
	letter-spacing: .1em;
	white-space: pre !important;
	overflow: visible !important;
}

.cf-game.cf-cx .cf-rules ul,
.cf-game.cf-cx .cf-rules li { color: var(--cf-muted); }

@media (max-width: 420px) {
	.cf-game.cf-cx .cf-cx-grid,
	.cf-game.cf-cx .cf-cx-board,
	.cf-game.cf-cx .cf-cx-solved { gap: 6px; }
	.cf-game.cf-cx .cf-cx-tile,
	.cf-game.cf-cx .cf-cx-tile:hover,
	.cf-game.cf-cx .cf-cx-tile:focus { min-height: 64px !important; border-radius: 8px !important; }
	.cf-game.cf-cx .cf-cx-group { min-height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
	.cf-game.cf-cx .cf-cx-tile.is-pop,
	.cf-game.cf-cx .cf-cx-tile.is-shake,
	.cf-game.cf-cx .cf-cx-group { animation: none; }
}
