.ags-game {
	border-radius: 14px;
	padding: 1rem;
	margin: 1rem 0;
	background: #f8f9ff;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.ags-ui-controls {
	display: flex;
	gap: 0.4rem;
	flex-wrap: wrap;
	margin-bottom: 0.6rem;
}

.ags-ui-toggle {
	border: 1px solid #ccd4f8;
	background: #fff;
	border-radius: 999px;
	padding: 0.3rem 0.7rem;
	cursor: pointer;
}

.ags-mastermind {
	background: linear-gradient(180deg, #f4eeff, #eaf4ff);
}

.ags-tictactoe {
	background: #fff;
	border: 1px solid #d9d9d9;
}

.ags-memory {
	background: linear-gradient(180deg, #fff6fb, #effaf7);
}

.ags-connectfour {
	background: linear-gradient(180deg, #edf4ff, #d9e8ff);
}

.ags-game-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 0.75rem;
}

.ags-help {
	background: #ffffffcc;
	border: 1px solid #dfe5ff;
	border-radius: 10px;
	padding: 0.75rem 0.9rem 0.75rem 1.25rem;
	margin-bottom: 0.65rem;
}

.ags-help p,
.ags-help ol {
	margin: 0.35rem 0;
}

.ags-help ol {
	padding-left: 1.2rem;
}

.ags-memory-pairs-info {
	margin: 0.3rem 0 0.55rem;
	font-size: 0.95rem;
	opacity: 0.85;
}

.ags-button-primary {
	background: #2f74ff;
	color: #fff;
	border: 0;
	border-radius: 10px;
	padding: 0.65rem 1rem;
	cursor: pointer;
	transition: transform 0.15s ease;
}

.ags-button-primary:hover {
	transform: scale(1.05);
}

.ags-current-row,
.ags-palette {
	display: flex;
	gap: 0.5rem;
	margin: 0.5rem 0;
}

.ags-slot,
.ags-chip {
	border: 1px solid #d5d7ea;
	border-radius: 10px;
	min-width: 46px;
	min-height: 46px;
	font-size: 1.35rem;
	background: #fff;
}

.ags-mastermind .ags-current-row {
	gap: 0.75rem;
}

.ags-mm-playline {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.45rem;
	flex-wrap: wrap;
}

.ags-mastermind .ags-slot {
	min-width: 92px;
	min-height: 92px;
	font-size: 2.7rem;
}

.ags-mm-actions {
	margin-top: 0;
	display: flex;
	gap: 0.5rem;
}

.ags-draggable-slot {
	cursor: grab;
}

.ags-draggable-slot:active {
	cursor: grabbing;
}

.ags-draggable-slot.is-dragging {
	opacity: 0.6;
}

.ags-slot.is-active {
	outline: 2px solid #8a5cff;
}

.ags-slot.is-selected {
	outline: 2px solid #2f74ff;
	box-shadow: 0 0 0 2px rgba(47, 116, 255, 0.2);
}

.ags-history-row {
	display: flex;
	justify-content: space-between;
	padding: 0.35rem 0.5rem;
	background: #fff;
	border-radius: 8px;
	margin-top: 0.35rem;
}

.ags-grid.ttt {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	max-width: 520px;
	margin: 0.75rem auto;
}

.ags-ttt-cell {
	aspect-ratio: 1 / 1;
	font-size: 2.4rem;
	border: 1px solid #aaa;
	background: #fff;
}

.ags-grid.memory {
	display: grid;
	gap: 8px;
	max-width: 620px;
	margin: 0 auto;
}

.ags-cf-board-wrap {
	position: relative;
	overflow: visible;
	margin: 0.5rem auto;
}

.ags-cf-board {
	--cf-size: 52px;
	display: grid;
	grid-template-columns: repeat(7, var(--cf-size));
	gap: 8px;
	justify-content: center;
	padding: 12px;
	background: linear-gradient(180deg, #0f67db, #0a4cb8);
	border-radius: 14px;
	box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 10px 20px rgba(10, 40, 110, 0.35);
}

.ags-cf-cell {
	width: var(--cf-size);
	height: var(--cf-size);
	border-radius: 999px;
	border: 0;
	cursor: pointer;
	background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f5f8ff 58%, #d4ddf8 100%);
	box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.24);
}

.ags-cf-cell.is-X {
	background: radial-gradient(circle at 35% 35%, #ffd7d7 0%, #ff6d6d 62%, #c92929 100%);
}

.ags-cf-cell.is-O {
	background: radial-gradient(circle at 35% 35%, #fff8c6 0%, #ffd84b 62%, #c89b13 100%);
}

.ags-cf-falling {
	position: absolute;
	width: 52px;
	height: 52px;
	border-radius: 999px;
	transition: transform 0.35s ease-in;
	pointer-events: none;
}

.ags-cf-falling.is-x {
	background: radial-gradient(circle at 35% 35%, #ffd7d7 0%, #ff6d6d 62%, #c92929 100%);
}

.ags-cf-falling.is-o {
	background: radial-gradient(circle at 35% 35%, #fff8c6 0%, #ffd84b 62%, #c89b13 100%);
}

.ags-card {
	aspect-ratio: 1 / 1;
	border: 0;
	border-radius: 10px;
	background: #ffffff;
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
	font-size: 2.7rem;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	line-height: 1;
	transform-style: preserve-3d;
	transition: transform 0.35s ease;
}

.ags-card.is-open {
	transform: rotateY(180deg);
	background: #fff9de;
}

.ags-card img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 10px;
}

.ags-modal {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgba(0, 0, 0, 0.4);
}

.ags-modal.is-hidden {
	display: none;
}

.ags-modal-inner {
	background: #fff;
	padding: 1rem;
	border-radius: 12px;
}

.ags-shake {
	animation: ags-shake 0.35s linear;
}

.ags-dark .ags-game {
	background: #1f2230;
	color: #f5f6ff;
	border-color: #34384f;
}

.ags-dark .ags-slot,
.ags-dark .ags-chip,
.ags-dark .ags-ttt-cell,
.ags-dark .ags-ui-toggle,
.ags-dark .ags-history-row {
	background: #2b3045;
	color: #f5f6ff;
	border-color: #3f4869;
}

.ags-dark .ags-modal-inner {
	background: #252a3d;
	color: #f5f6ff;
}

.ags-dark .ags-help {
	background: #2a3047;
	border-color: #3e4a70;
}

.ags-no-anim *,
.ags-no-anim *::before,
.ags-no-anim *::after {
	animation: none !important;
	transition: none !important;
}

.ags-time-warning {
	color: #e03131;
	font-weight: 700;
	animation: ags-pulse 0.9s ease-in-out infinite;
}

@keyframes ags-shake {
	0%,
	100% { transform: translateX(0); }
	25% { transform: translateX(-6px); }
	75% { transform: translateX(6px); }
}

@keyframes ags-pulse {
	0%,
	100% { opacity: 1; }
	50% { opacity: 0.45; }
}

@media (max-width: 680px) {
	.ags-game-header {
		flex-direction: column;
		align-items: flex-start;
	}
	.ags-button-primary,
	.ags-slot,
	.ags-chip {
		min-height: 52px;
	}
	.ags-mastermind .ags-slot {
		min-width: 72px;
		min-height: 72px;
		font-size: 2.2rem;
	}
	.ags-mm-playline {
		flex-direction: column;
		align-items: flex-start;
	}
	.ags-cf-board {
		--cf-size: 40px;
		gap: 6px;
	}
	.ags-cf-falling {
		width: 40px;
		height: 40px;
	}
	.ags-grid.memory {
		max-width: 100%;
	}
	.ags-card {
		font-size: 2.2rem;
	}
}
