.chad-games {
	--cg-red: #e21f26;
	--cg-blue: #2f57d8;
	--cg-black: #0a0a0a;
	--cg-green: #2fa84f;
	--cg-yellow: #f2b705;
	--cg-gray: #4a4a4a;
	--cg-font: Impact, "Haettenschweiler", "Arial Narrow Bold", "Arial Black", sans-serif;
	position: relative;
	left: 50%;
	transform: translateX(-50%);
	width: min(560px, calc(100vw - 24px));
	max-width: none !important;
	margin: 0 !important;
	padding: 8px 0 34px;
	box-sizing: border-box;
	text-align: center;
	color: #111;
	font-family: "Courier New", Courier, monospace;
}
.chad-games.cg-wide { width: min(1040px, calc(100vw - 32px)); }
.chad-games *, .chad-games *::before, .chad-games *::after { box-sizing: border-box; }

/* ---- Title (logo colors) ---- */
.cg-title {
	margin: 0 0 26px;
	padding: 0 6px 6px 0;
	font-family: var(--cg-font);
	font-weight: 900;
	font-style: italic;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: clamp(2.1rem, 10.5vw, 4.6rem);
	line-height: 1.02;
	color: #fff;
}
.cg-title .cg-l1, .cg-title .cg-l2 {
	display: block;
	-webkit-text-stroke: 7px var(--cg-blue);
	paint-order: stroke fill;
	stroke-linejoin: round;
}
.cg-title .cg-l1 {
	color: #fff;
	filter:
		drop-shadow(1px 1px 0 #e21f26) drop-shadow(1px 1px 0 #e21f26)
		drop-shadow(1px 1px 0 #c4161c) drop-shadow(1px 1px 0 #c4161c)
		drop-shadow(1px 1px 0 #9b1015) drop-shadow(1px 1px 0 #9b1015)
		drop-shadow(0 8px 6px rgba(0, 0, 0, 0.35));
}
.cg-title .cg-l2 {
	font-size: 1.28em;
	color: var(--cg-red);
	filter:
		drop-shadow(1px 1px 0 #1c2f8f) drop-shadow(1px 1px 0 #1c2f8f)
		drop-shadow(1px 1px 0 #142270) drop-shadow(1px 1px 0 #142270)
		drop-shadow(1px 1px 0 #0d1650) drop-shadow(1px 1px 0 #0d1650)
		drop-shadow(0 8px 6px rgba(0, 0, 0, 0.35));
}
/* one-line title (Chad-dle): use the red face */
.cg-title .cg-l1:only-child { color: var(--cg-red); font-size: 1.15em; filter: drop-shadow(1px 1px 0 #1c2f8f) drop-shadow(1px 1px 0 #1c2f8f) drop-shadow(1px 1px 0 #142270) drop-shadow(1px 1px 0 #142270) drop-shadow(1px 1px 0 #0d1650) drop-shadow(1px 1px 0 #0d1650) drop-shadow(0 8px 6px rgba(0,0,0,.35)); }

/* ---- Buttons ---- */
.cg-btn {
	display: inline-block;
	padding: 12px 20px 10px;
	border: 3px solid var(--cg-black);
	background: var(--cg-red);
	color: #fff;
	font-family: var(--cg-font);
	font-size: 1.05rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 4px 4px 0 var(--cg-blue);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cg-btn:hover, .cg-btn:focus-visible { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--cg-blue); }
.cg-ghost { background: #fff; color: var(--cg-black); }
.cg-toolbar { display: flex; gap: 12px; justify-content: center; margin: 0 0 14px; }
.cg-toolbar .cg-btn { padding: 8px 14px 6px; font-size: 0.9rem; box-shadow: 3px 3px 0 var(--cg-blue); }
.cg-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }

/* ---- Games hub ---- */
.cg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px 26px; padding: 0 8px 8px 0; }
.cg-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 22px 16px 22px;
	background: #fff;
	border: 4px solid var(--cg-black);
	box-shadow: 8px 8px 0 var(--cg-blue);
	color: var(--cg-black);
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cg-card:hover, .cg-card:focus-visible { transform: translate(-3px, -3px); box-shadow: 11px 11px 0 var(--cg-red); }
.cg-art { display: block; width: 110px; height: 110px; }
.cg-art svg { display: block; width: 100%; height: 100%; }
.cg-card-name { font-family: var(--cg-font); font-style: italic; font-size: 1.9rem; letter-spacing: 0.06em; text-transform: uppercase; }
.cg-card-desc { min-height: 3.2em; font-size: 0.88rem; line-height: 1.35; color: #333; }

/* ---- Chad-dle ---- */
.cg-toast {
	min-height: 28px;
	margin: 0 0 6px;
	font-family: var(--cg-font);
	font-size: 1.15rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cg-red);
}
.cg-board { display: grid; gap: 6px; width: min(330px, 84vw); margin: 0 auto 20px; padding-right: 4px; }
.cg-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cg-tile {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	border: 3px solid #b9b9b9;
	background: #fff;
	color: var(--cg-black);
	font-family: var(--cg-font);
	font-size: clamp(1.7rem, 8.4vw, 2.5rem);
	text-transform: uppercase;
	line-height: 1;
}
.cg-tile.filled { border-color: var(--cg-black); animation: cg-pop 0.1s ease-out; }
.cg-tile.correct { background: var(--cg-green); border-color: var(--cg-black); color: #fff; }
.cg-tile.present { background: var(--cg-yellow); border-color: var(--cg-black); color: #000; }
.cg-tile.absent { background: var(--cg-gray); border-color: var(--cg-black); color: #fff; }
.cg-tile.flip { animation: cg-flip 0.5s ease; }
.cg-row.shake { animation: cg-shake 0.4s; }
.cg-row.win .cg-tile { animation: cg-bounce 0.6s ease both; }
@keyframes cg-pop { from { transform: scale(0.85); } to { transform: scale(1); } }
@keyframes cg-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes cg-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes cg-bounce { 0%, 20% { transform: translateY(0); } 40% { transform: translateY(-14px); } 60% { transform: translateY(4px); } 100% { transform: translateY(0); } }

.cg-kb { display: grid; gap: 8px; width: min(500px, 100%); margin: 0 auto; padding-right: 4px; }
.cg-kb-row { display: flex; gap: 5px; justify-content: center; }
.cg-key {
	flex: 1 1 0;
	min-width: 0;
	height: 54px;
	padding: 0;
	border: 3px solid var(--cg-black);
	background: #e6e6e6;
	color: var(--cg-black);
	font-family: var(--cg-font);
	font-size: 1.1rem;
	text-transform: uppercase;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.cg-key.wide { flex: 1.7 1 0; font-size: 0.85rem; letter-spacing: 0.04em; }
.cg-key:active { transform: translateY(2px); }
.cg-key.correct { background: var(--cg-green); color: #fff; }
.cg-key.present { background: var(--cg-yellow); color: #000; }
.cg-key.absent { background: var(--cg-gray); color: #fff; }

/* ---- Modals ---- */
.cg-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 12px; text-align: left; }
.cg-modal[hidden] { display: none; }
.cg-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); }
.cg-dialog {
	position: relative;
	width: min(440px, 100%);
	max-height: 100%;
	overflow: auto;
	padding: 22px 18px 20px;
	background: #fff;
	border: 4px solid var(--cg-black);
	box-shadow: 8px 8px 0 var(--cg-blue);
	color: var(--cg-black);
}
.cg-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 3px solid var(--cg-black);
	border-radius: 50%;
	background: var(--cg-red);
	color: #fff;
	font-size: 24px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}
.cg-h2 { margin: 0 0 12px; font-family: var(--cg-font); font-style: italic; font-size: 1.8rem; letter-spacing: 0.06em; text-transform: uppercase; text-align: center; color: var(--cg-black); }
.cg-text { display: grid; gap: 10px; font-size: 0.92rem; line-height: 1.4; }
.cg-legend { display: flex; align-items: center; gap: 12px; }
.cg-legend .cg-tile { width: 38px; height: 38px; flex: 0 0 38px; font-size: 1.3rem; border-width: 3px; }
.cg-end-msg { margin: 0 0 14px; text-align: center; font-family: var(--cg-font); font-size: 1.3rem; letter-spacing: 0.05em; text-transform: uppercase; }
.cg-statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; text-align: center; }
.cg-stat b { display: block; font-family: var(--cg-font); font-size: 1.9rem; line-height: 1.1; }
.cg-stat span { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.cg-dist { display: grid; gap: 4px; }
.cg-bar { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.cg-bar i { display: block; min-width: 22px; padding: 1px 6px; background: var(--cg-gray); color: #fff; font-style: normal; font-weight: 700; text-align: right; }
.cg-bar i.me { background: var(--cg-green); }

/* ---- Catch the Cards ---- */
.cg-hud { display: flex; align-items: center; justify-content: space-between; width: min(420px, 100%); margin: 0 auto 10px; padding-right: 8px; font-family: var(--cg-font); font-size: 1.15rem; letter-spacing: 0.06em; text-transform: uppercase; }
.cg-hud b { font-size: 1.5rem; color: var(--cg-red); }
.cg-hud .cg-time { display: inline-block; min-width: 2.2em; text-transform: none; color: var(--cg-blue); transition: color 0.15s, transform 0.15s; }
.cg-hud .cg-time.low { color: var(--cg-red); animation: cg-lowtime 0.5s ease-in-out infinite alternate; }
.cg-hud .cg-time.gain { color: #1f9d55; transform: scale(1.35); }
.cg-hud .cg-time.lose { color: var(--cg-red); transform: scale(1.35); }
@keyframes cg-lowtime { from { transform: scale(1); } to { transform: scale(1.25); } }
.cg-stage {
	position: relative;
	width: min(420px, 100%);
	margin: 0 auto 12px;
	border: 4px solid var(--cg-black);
	box-shadow: 8px 8px 0 var(--cg-blue);
	background: #fff;
	line-height: 0;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
}
.cg-canvas { display: block; width: 100%; height: auto; touch-action: none; }
.cg-over {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 20px;
	background: rgba(10, 10, 10, 0.86);
	color: #fff;
	line-height: 1.35;
	text-align: center;
}
.cg-over[hidden] { display: none; }
.cg-over-title { font-family: var(--cg-font); font-style: italic; font-size: 2.3rem; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; text-shadow: 3px 3px 0 var(--cg-red); }
.cg-over-msg { max-width: 300px; font-size: 0.9rem; }
.cg-hint { font-size: 0.8rem; letter-spacing: 0.06em; color: #555; text-transform: uppercase; }

@media (max-width: 480px) {
	.cg-key { height: 50px; font-size: 1rem; }
	.cg-card-name { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
	.cg-tile, .cg-row, .cg-btn, .cg-card { animation: none !important; transition: none !important; }
}
