/* Baby Keyboard Game — front-end styles
   Lightweight, dependency-free CSS. Uses CSS variables for fast theme
   swaps without re-rendering markup. Kept in one file to minimize
   HTTP requests (performance requirement). */

.bkg-root {
	--bkg-primary: #ff6fb1;
	--bkg-secondary: #6fc3ff;
	text-align: center;
	margin: 24px auto;
}

.bkg-launch-btn {
	font-size: 20px;
	font-weight: 700;
	padding: 16px 32px;
	border: none;
	border-radius: 50px;
	background: linear-gradient(135deg, var(--bkg-primary), var(--bkg-secondary));
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(0,0,0,.18);
	transition: transform .15s ease, box-shadow .15s ease;
	display: inline-flex;
	align-items: center;
	gap: 10px;
}
.bkg-launch-btn:hover,
.bkg-launch-btn:focus-visible { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 22px rgba(0,0,0,.22); }
.bkg-launch-emoji { font-size: 26px; }
.bkg-launch-hint { margin-top: 10px; font-size: 13px; color: #666; }

/* ------------------------------------------------------------------ */
/* Full screen game overlay                                            */
/* ------------------------------------------------------------------ */
.bkg-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	transition: background 1.2s ease;
	touch-action: manipulation;
}

/* Theme backgrounds */
.bkg-overlay.bkg-theme-rainbow { background: linear-gradient(135deg,#ff9a9e,#fad0c4,#fbc2eb,#a1c4fd,#c2e9fb); background-size: 400% 400%; animation: bkgBgShift 18s ease infinite; }
.bkg-overlay.bkg-theme-space   { background: radial-gradient(circle at 20% 20%, #2a2a72, #009ffd 80%); background-size: 300% 300%; animation: bkgBgShift 22s ease infinite; }
.bkg-overlay.bkg-theme-ocean   { background: linear-gradient(135deg,#00c6fb,#005bea,#43e97b); background-size: 400% 400%; animation: bkgBgShift 20s ease infinite; }
.bkg-overlay.bkg-theme-jungle  { background: linear-gradient(135deg,#a8e063,#56ab2f,#f7d794); background-size: 400% 400%; animation: bkgBgShift 20s ease infinite; }
.bkg-overlay.bkg-theme-pastel  { background: linear-gradient(135deg,#fbc2eb,#a6c1ee,#fbc2eb); background-size: 400% 400%; animation: bkgBgShift 24s ease infinite; }

@keyframes bkgBgShift {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

.bkg-topbar {
	position: absolute;
	top: 0; left: 0; right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	color: #fff;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 700;
	text-shadow: 0 1px 3px rgba(0,0,0,.35);
	z-index: 3;
	pointer-events: none;
}
.bkg-topbar > * { pointer-events: auto; }
.bkg-stat-pill {
	background: rgba(255,255,255,.25);
	backdrop-filter: blur(6px);
	border-radius: 20px;
	padding: 6px 14px;
	font-size: 14px;
	margin-right: 8px;
}
.bkg-stats-group { display: flex; align-items: center; }
.bkg-icon-btn {
	background: rgba(255,255,255,.3);
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	font-size: 18px;
	cursor: pointer;
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 8px;
}
.bkg-icon-btn[aria-pressed="false"] { opacity: .5; }

.bkg-exit-btn {
	background: rgba(0,0,0,.35);
	border: none;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	cursor: pointer;
}

/* Twinkling starfield layer — sits between the background and the
   flying-emoji layer for a premium, "shiny" feel across every theme. */
.bkg-star-layer {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 1;
	overflow: hidden;
}
.bkg-star {
	position: absolute;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 72%);
	animation: bkgTwinkle 2.6s ease-in-out infinite;
}
@keyframes bkgTwinkle {
	0%, 100% { opacity: .15; transform: scale(.85); }
	50%      { opacity: 1;   transform: scale(1.15); }
}

/* Effect layer where flying emojis/shapes are appended */
.bkg-fx-layer {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 2;
	overflow: hidden;
}
.bkg-fx-item {
	position: absolute;
	font-size: 96px;
	will-change: transform, opacity;
	animation: bkgFly 1.4s ease-out forwards;
	filter: drop-shadow(0 3px 4px rgba(0,0,0,.2));
}
@keyframes bkgFly {
	0%   { transform: translate(0,0) scale(.4) rotate(0deg); opacity: 0; }
	15%  { opacity: 1; }
	100% { transform: translate(var(--bkg-dx,0px), var(--bkg-dy,-260px)) scale(1.15) rotate(var(--bkg-rot,25deg)); opacity: 0; }
}

/* Learning-mode prompt banner */
.bkg-prompt-banner {
	position: absolute;
	top: 70px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(255,255,255,.9);
	border-radius: 20px;
	padding: 10px 28px;
	font-size: 32px;
	font-weight: 800;
	color: #333;
	z-index: 3;
	box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.bkg-prompt-banner small { display:block; font-size: 13px; font-weight:600; color:#777; }

/* Virtual keyboard */
.bkg-keyboard-wrap {
	position: relative;
	z-index: 3;
	width: 100%;
	max-width: 1000px;
	padding: 10px 12px 22px;
	box-sizing: border-box;
}
.bkg-keyboard-row {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-bottom: 6px;
	flex-wrap: wrap;
}
.bkg-key {
	flex: 1 1 0;
	min-width: 32px;
	max-width: 64px;
	aspect-ratio: 1 / 1;
	border: none;
	border-radius: 12px;
	font-size: 18px;
	font-weight: 800;
	color: #fff;
	background: rgba(255,255,255,.28);
	backdrop-filter: blur(3px);
	box-shadow: 0 3px 0 rgba(0,0,0,.18), 0 4px 10px rgba(0,0,0,.15);
	cursor: pointer;
	user-select: none;
	transition: transform .08s ease, background .08s ease;
	touch-action: manipulation;
}
.bkg-key:active,
.bkg-key.bkg-key-pressed {
	transform: translateY(3px) scale(.92);
	background: rgba(255,255,255,.55);
}
.bkg-key-space { max-width: 320px; flex: 4 1 0; }

/* End of game summary modal — dark "smash report" style card */
.bkg-summary-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(5,8,14,.65);
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.bkg-summary-card {
	background: #10151f;
	border: 1px solid rgba(255,255,255,.08);
	border-radius: 22px;
	max-width: 420px;
	width: 100%;
	padding: 26px 26px 28px;
	text-align: left;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	box-shadow: 0 25px 60px rgba(0,0,0,.5);
	animation: bkgPopIn .35s cubic-bezier(.34,1.56,.64,1);
	color: #e8ebf1;
}
@keyframes bkgPopIn {
	0% { transform: scale(.6); opacity: 0; }
	100% { transform: scale(1); opacity: 1; }
}
.bkg-summary-topline { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.bkg-summary-brand { font-weight: 800; font-size: 15px; color: #f4f6fb; display:flex; align-items:center; gap:6px; }
.bkg-summary-exit-link {
	background: none; border: none; color: #9aa4b8; font-size: 13px; text-decoration: underline;
	cursor: pointer; padding: 0;
}
.bkg-summary-tagline { color: #7d8698; font-size: 13px; margin: 0 0 6px; }
.bkg-summary-card h2 { margin: 0 0 16px; font-size: 25px; color: #fff; font-weight: 800; }
.bkg-summary-emoji-inline { font-size: 20px; margin-left: 6px; }

.bkg-summary-statbox {
	background: #171e2b;
	border: 1px solid rgba(255,255,255,.06);
	border-radius: 16px;
	padding: 6px 18px;
	margin-bottom: 14px;
}
.bkg-summary-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 12px 0;
	border-bottom: 1px solid rgba(255,255,255,.06);
	font-size: 14px;
	color: #9aa4b8;
}
.bkg-summary-row:last-child { border-bottom: none; }
.bkg-summary-row strong { color: #fff; font-size: 20px; font-weight: 800; }
.bkg-summary-row .bkg-row-unit { font-size: 12px; font-weight: 600; color: #9aa4b8; margin-left: 4px; }

.bkg-summary-mood {
	font-size: 13px;
	color: #c7cede;
	margin: 4px 2px 16px;
}

.bkg-summary-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 16px;
}
.bkg-summary-chip {
	background: rgba(255,255,255,.08);
	color: #e8ebf1;
	font-size: 11px;
	font-weight: 700;
	padding: 5px 10px;
	border-radius: 20px;
}

.bkg-btn-primary, .bkg-btn-secondary {
	border: none;
	border-radius: 14px;
	padding: 15px 20px;
	font-weight: 800;
	cursor: pointer;
	font-size: 15px;
	width: 100%;
	box-sizing: border-box;
	display: block;
}
.bkg-btn-primary {
	background: linear-gradient(135deg, var(--bkg-primary,#ffb24d), var(--bkg-secondary,#ff8a4d));
	color: #1a1200;
	margin-bottom: 10px;
}
.bkg-btn-secondary {
	background: transparent;
	color: #cdd4e2;
	border: 1px solid rgba(255,255,255,.14);
}
.bkg-btn-secondary.bkg-copied { color: #7CFFA0; border-color: #7CFFA0; }

/* Mode / achievement toast */
.bkg-toast {
	position: absolute;
	bottom: 130px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0,0,0,.65);
	color: #fff;
	padding: 10px 20px;
	border-radius: 30px;
	font-size: 15px;
	font-weight: 700;
	z-index: 4;
	animation: bkgToastIn .4s ease, bkgToastOut .4s ease 2.2s forwards;
}
@keyframes bkgToastIn { from { opacity:0; transform: translate(-50%,10px);} to {opacity:1; transform: translate(-50%,0);} }
@keyframes bkgToastOut { to { opacity:0; } }

/* Respect users/parents who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
	.bkg-overlay, .bkg-fx-item, .bkg-summary-card, .bkg-toast { animation: none !important; }
}

/* Responsive: small phones */
@media (max-width: 480px) {
	.bkg-key { font-size: 14px; border-radius: 9px; }
	.bkg-prompt-banner { font-size: 24px; padding: 8px 18px; }
	.bkg-stat-pill { font-size: 12px; padding: 5px 10px; }
}
