/* ================================
   Teconce Kids Learning – Public UI
   ================================ */

.tkl-game {
	max-width: 960px;
	margin: 20px auto;
	padding: 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background: #f9fbff;
	border-radius: 16px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* ----------------
   TOP BAR
---------------- */
.tkl-topbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.tkl-title {
	font-size: 20px;
	font-weight: 700;
	color: #2c3e50;
}

.tkl-controls {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.tkl-label {
	font-size: 13px;
	color: #555;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.tkl-label select {
	padding: 6px 10px;
	border-radius: 8px;
	border: 1px solid #dcdcdc;
	font-size: 14px;
	cursor: pointer;
}

/* ----------------
   STAGE
---------------- */
.tkl-stage {
	background: #ffffff;
	border-radius: 14px;
	padding: 16px;
}

/* Prompt */
.tkl-prompt {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.tkl-prompt-text {
	font-size: 18px;
	font-weight: 600;
	color: #34495e;
}

.tkl-audio-btn {
	border: none;
	background: #4f8cff;
	color: #fff;
	font-size: 18px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	cursor: pointer;
	box-shadow: 0 4px 10px rgba(79,140,255,0.4);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tkl-audio-btn:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 14px rgba(79,140,255,0.5);
}

/* ----------------
   GRID
---------------- */
.tkl-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 14px;
	margin-bottom: 16px;
}

/* Game Card */
.tkl-card {
	background: #f4f7ff;
	border-radius: 14px;
	padding: 10px;
	text-align: center;
	cursor: pointer;
	box-shadow: 0 4px 10px rgba(0,0,0,0.05);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tkl-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

.tkl-card img {
	max-width: 100%;
	height: 200px;
	object-fit: cover;
	border-radius: 10px;
	user-select: none;
	pointer-events: none;
	width:100%;
}

.tkl-card-title {
	margin-top: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #333;
}

/* Correct / Wrong states (JS adds these classes) */
.tkl-card.is-correct {
	background: #e6fff0;
	border: 2px solid #2ecc71;
}

.tkl-card.is-wrong {
	background: #ffecec;
	border: 2px solid #e74c3c;
}

/* ----------------
   FEEDBACK
---------------- */
.tkl-feedback {
	min-height: 24px;
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	margin-bottom: 12px;
}

.tkl-feedback.success {
	color: #27ae60;
}

.tkl-feedback.error {
	color: #e74c3c;
}

/* ----------------
   FOOTER
---------------- */
.tkl-footer {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 10px;
}

.tkl-footer .button {
	background: #ffb703;
	border: none;
	color: #333;
	font-weight: 700;
	padding: 10px 18px;
	border-radius: 12px;
	cursor: pointer;
	font-size: 15px;
	box-shadow: 0 4px 10px rgba(255,183,3,0.4);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tkl-footer .button:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 14px rgba(255,183,3,0.5);
}

.tkl-footer .tkl-next {
	background: #2ecc71;
	color: #fff;
	box-shadow: 0 4px 10px rgba(46,204,113,0.4);
}

/* ----------------
   NOTE
---------------- */
.tkl-note {
	font-size: 13px;
	color: #888;
	text-align: center;
	margin-top: 12px;
}

/* ----------------
   MOBILE TWEAKS
---------------- */
@media (max-width: 480px) {
	.tkl-title {
		font-size: 18px;
	}

	.tkl-prompt-text {
		font-size: 16px;
	}

	.tkl-card img {
		height: 70px;
	}
}

/* ==========================================================
   ADVANCED FX: Stars + Audio Pulse + Level Styles + Confetti
   + Child Themes
   ========================================================== */

.tkl-game {
	--tkl-accent: #4f8cff;
	--tkl-accent-2: #ffb703;
	--tkl-success: #2ecc71;
	--tkl-danger: #e74c3c;
	--tkl-ring: rgba(79, 140, 255, 0.25);
}

/* Child avatar / theme colors (JS sets data-theme="...") */
.tkl-game[data-theme="sky"] { --tkl-accent:#4f8cff; --tkl-accent-2:#ffb703; --tkl-ring: rgba(79,140,255,0.25); }
.tkl-game[data-theme="mint"] { --tkl-accent:#20c997; --tkl-accent-2:#ffd43b; --tkl-ring: rgba(32,201,151,0.25); }
.tkl-game[data-theme="grape"] { --tkl-accent:#845ef7; --tkl-accent-2:#ffa8a8; --tkl-ring: rgba(132,94,247,0.25); }
.tkl-game[data-theme="sunset"] { --tkl-accent:#ff6b6b; --tkl-accent-2:#ffd93d; --tkl-ring: rgba(255,107,107,0.25); }
.tkl-game[data-theme="ocean"] { --tkl-accent:#1098ad; --tkl-accent-2:#74c0fc; --tkl-ring: rgba(16,152,173,0.25); }

/* Make accent affect your existing elements */
.tkl-audio-btn { background: var(--tkl-accent) !important; box-shadow: 0 4px 10px var(--tkl-ring) !important; }
.tkl-footer .button { background: var(--tkl-accent-2) !important; }
.tkl-footer .tkl-next { background: var(--tkl-success) !important; }

/* --- Level difficulty styles (uses existing data-level attr) --- */
.tkl-game[data-level="1"] .tkl-card { border: 2px solid rgba(0,0,0,0.0); }
.tkl-game[data-level="2"] .tkl-card { border: 2px solid rgba(79,140,255,0.15); }
.tkl-game[data-level="3"] .tkl-card { border: 2px solid rgba(79,140,255,0.25); }
.tkl-game[data-level="4"] .tkl-card { border: 2px solid rgba(79,140,255,0.35); }
.tkl-game[data-level="5"] .tkl-card { border: 2px solid rgba(79,140,255,0.50); }

.tkl-game[data-level="4"] .tkl-grid,
.tkl-game[data-level="5"] .tkl-grid { gap: 10px; }

.tkl-game[data-level="4"] .tkl-card,
.tkl-game[data-level="5"] .tkl-card { border-radius: 12px; }

.tkl-game[data-level="5"] .tkl-card-title { font-size: 13px; }

/* --- Feedback classes used by your JS (is-ok/is-bad) --- */
.tkl-feedback.is-ok { color: var(--tkl-success); }
.tkl-feedback.is-bad { color: var(--tkl-danger); }

/* --- Audio button pulse while playing --- */
.tkl-audio-btn.is-playing {
	position: relative;
	animation: tklPulse 0.9s ease-in-out infinite;
}

.tkl-audio-btn.is-playing::after {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	border: 2px solid rgba(255,255,255,0.85);
	opacity: 0;
	animation: tklRipple 1.1s ease-out infinite;
}

@keyframes tklPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.08); }
	100% { transform: scale(1); }
}

@keyframes tklRipple {
	0% { transform: scale(0.85); opacity: 0.55; }
	100% { transform: scale(1.25); opacity: 0; }
}

/* --- Stars + Confetti layers (inserted by JS into .tkl-stage) --- */
.tkl-stage { position: relative; overflow: hidden; }

.tkl-stars,
.tkl-confetti {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
	z-index: 6;
}

.tkl-star {
	position: absolute;
	opacity: 0;
	transform: translateY(10px) scale(0.8) rotate(0deg);
	animation: tklStarPop 900ms ease-out forwards;
	filter: drop-shadow(0 6px 10px rgba(0,0,0,0.12));
}

@keyframes tklStarPop {
	0%   { opacity: 0; transform: translateY(14px) scale(0.6) rotate(-20deg); }
	25%  { opacity: 1; }
	100% { opacity: 0; transform: translateY(-80px) scale(1.2) rotate(25deg); }
}

.tkl-confetti-piece {
	position: absolute;
	top: -10px;
	width: 10px;
	height: 14px;
	border-radius: 3px;
	opacity: 0.95;
	animation: tklConfettiFall 1100ms ease-in forwards;
	transform: translateY(0) rotate(0deg);
}

@keyframes tklConfettiFall {
	0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
	100% { transform: translateY(520px) rotate(280deg); opacity: 0; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.tkl-audio-btn.is-playing { animation: none; }
	.tkl-audio-btn.is-playing::after { animation: none; }
	.tkl-star { animation: none; opacity: 0; }
	.tkl-confetti-piece { animation: none; opacity: 0; }
}
