/* =========================================================================
   Little Helper House  —  game.css
   Kid-friendly (ages 2-6), bright & soft, big buttons, big text.
   Everything is scoped under .lhh-app so it won't fight with your theme.
   ========================================================================= */

.lhh-app {
	--lhh-bg:        #fff9ee;
	--lhh-card:      #ffffff;
	--lhh-ink:       #3a2f2a;   /* dark brown text, high contrast on cream */
	--lhh-pink:      #ff7eb6;
	--lhh-pink-dk:   #e85a98;
	--lhh-blue:      #5cc8ff;
	--lhh-blue-dk:   #2a9fe0;
	--lhh-green:     #7ad389;
	--lhh-green-dk:  #4caf63;
	--lhh-yellow:    #ffd23f;
	--lhh-purple:    #bca6ff;
	--lhh-shadow:    0 6px 0 rgba(0,0,0,.12);
	--lhh-radius:    22px;

	box-sizing: border-box;
	max-width: 860px;
	margin: 0 auto;
	padding: 14px;
	background: var(--lhh-bg);
	border-radius: var(--lhh-radius);
	font-family: "Baloo 2", "Comic Sans MS", "Segoe UI", system-ui, sans-serif;
	color: var(--lhh-ink);
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	-webkit-user-select: none;
}
.lhh-app *,
.lhh-app *::before,
.lhh-app *::after { box-sizing: border-box; }

.lhh-noscript {
	background: #fff3cd;
	border: 3px solid #ffd23f;
	border-radius: 16px;
	padding: 16px;
	font-size: 20px;
	text-align: center;
}

/* ---------- Header / HUD ---------- */
.lhh-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 10px;
}
.lhh-title {
	margin: 0;
	font-size: clamp(22px, 4.5vw, 34px);
	font-weight: 800;
	color: var(--lhh-pink-dk);
	text-shadow: 0 2px 0 #fff;
}
.lhh-hud {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1 1 220px;
	min-width: 200px;
	justify-content: flex-end;
}
.lhh-stars {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--lhh-card);
	border: 3px solid var(--lhh-yellow);
	border-radius: 999px;
	padding: 6px 16px;
	font-size: clamp(20px, 3.5vw, 28px);
	font-weight: 800;
	box-shadow: var(--lhh-shadow);
}
.lhh-star-icon { font-size: 1.1em; }
.lhh-progress {
	flex: 1 1 120px;
	height: 22px;
	background: #ffe8c2;
	border: 3px solid #f2c879;
	border-radius: 999px;
	overflow: hidden;
}
.lhh-progress-fill {
	width: 0%;
	height: 100%;
	background: linear-gradient(90deg, var(--lhh-green), var(--lhh-blue));
	border-radius: 999px;
	transition: width .4s ease;
}

/* ---------- Instruction banner ---------- */
.lhh-instruction {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--lhh-card);
	border: 4px solid var(--lhh-blue);
	border-radius: var(--lhh-radius);
	padding: 12px 16px;
	margin-bottom: 12px;
	box-shadow: var(--lhh-shadow);
	min-height: 72px;
}
.lhh-instruction-text {
	margin: 0;
	font-size: clamp(19px, 3.6vw, 26px);
	font-weight: 700;
	line-height: 1.25;
}
.lhh-speak-btn {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	border: none;
	border-radius: 50%;
	background: var(--lhh-blue);
	color: #fff;
	font-size: 26px;
	cursor: pointer;
	box-shadow: var(--lhh-shadow);
	transition: transform .08s ease;
}
.lhh-speak-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.lhh-speak-btn.is-speaking { background: var(--lhh-pink); }

/* ---------- Stage (the house) ---------- */
.lhh-stage-wrap {
	width: 100%;
	margin-bottom: 12px;
}
.lhh-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 1200 / 900;   /* matches house_layout viewBox */
	border-radius: var(--lhh-radius);
	overflow: hidden;
	background: #c8f0b7 center/cover no-repeat;   /* house SVG set as bg by JS */
	border: 5px solid #e7d3a6;
	box-shadow: var(--lhh-shadow);
	touch-action: none;
}
/* Fallback for older browsers without aspect-ratio support */
@supports not (aspect-ratio: 1 / 1) {
	.lhh-stage::before { content: ""; display: block; padding-top: 75%; }
}

/* Sprites (items + targets + mascot) are positioned by JS using % left/top. */
.lhh-sprite {
	position: absolute;
	transform: translate(-50%, -50%);
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
	pointer-events: none;          /* the child plays via buttons/keys */
	will-change: left, top;
}
.lhh-item        { z-index: 3; transition: left .12s linear, top .12s linear, opacity .3s ease, transform .3s ease; }
.lhh-target      { z-index: 2; }
.lhh-mascot      { z-index: 5; transition: left .08s linear, top .08s linear; }

/* Gentle bob so items look alive and inviting */
.lhh-item.is-active { animation: lhh-bob 1s ease-in-out infinite; }
@keyframes lhh-bob {
	0%,100% { transform: translate(-50%, -50%) scale(1); }
	50%     { transform: translate(-50%, -58%) scale(1.04); }
}
/* Highlight the thing the child should interact with next */
.lhh-target.is-hot::after,
.lhh-item.is-hot::after {
	content: "";
	position: absolute;
	inset: -10%;
	border: 5px dashed var(--lhh-pink);
	border-radius: 50%;
	animation: lhh-pulse 1s ease-in-out infinite;
}
@keyframes lhh-pulse {
	0%,100% { opacity: .4; transform: scale(1); }
	50%     { opacity: 1;  transform: scale(1.08); }
}
.lhh-item.is-done { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }

/* Celebration + confetti overlays */
.lhh-celebrate {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 6%;
	z-index: 20;
	background: rgba(255,255,255,.78);
	font-size: clamp(24px, 5vw, 46px);
	font-weight: 800;
	color: var(--lhh-pink-dk);
	text-shadow: 0 2px 0 #fff;
	animation: lhh-pop .4s ease;
}
.lhh-celebrate[hidden] { display: none; }
@keyframes lhh-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lhh-confetti {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 25;
	pointer-events: none;
}

/* ---------- Controls (D-pad + action) ---------- */
.lhh-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}
.lhh-dpad {
	display: grid;
	grid-template-columns: repeat(3, 64px);
	grid-template-rows: repeat(3, 64px);
	gap: 6px;
}
.lhh-arrow {
	border: none;
	border-radius: 18px;
	background: var(--lhh-purple);
	color: #fff;
	font-size: 30px;
	font-weight: 800;
	cursor: pointer;
	box-shadow: var(--lhh-shadow);
	transition: transform .06s ease, background .1s ease;
	touch-action: none;
}
.lhh-arrow:active,
.lhh-arrow.is-pressed { transform: translateY(3px); background: #9f86f0; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.lhh-up    { grid-column: 2; grid-row: 1; }
.lhh-left  { grid-column: 1; grid-row: 2; }
.lhh-right { grid-column: 3; grid-row: 2; }
.lhh-down  { grid-column: 2; grid-row: 3; }

.lhh-action {
	flex: 1 1 180px;
	min-height: 84px;
	max-width: 320px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: none;
	border-radius: var(--lhh-radius);
	background: var(--lhh-green);
	color: #1f5a2b;
	font-size: clamp(22px, 4.5vw, 30px);
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 6px 0 #4ea85f;
	transition: transform .06s ease;
}
.lhh-action:active { transform: translateY(4px); box-shadow: 0 2px 0 #4ea85f; }
.lhh-action.is-carrying { background: var(--lhh-yellow); color: #6b4e00; box-shadow: 0 6px 0 #d8a900; }
.lhh-action-emoji { font-size: 1.3em; }

/* ---------- Menu (pause / reset) ---------- */
.lhh-menu {
	display: flex;
	gap: 12px;
	justify-content: center;
	flex-wrap: wrap;
}
.lhh-menu-btn {
	border: 3px solid #e0cfae;
	background: var(--lhh-card);
	color: var(--lhh-ink);
	border-radius: 999px;
	padding: 10px 22px;
	font-size: clamp(16px, 3vw, 20px);
	font-weight: 700;
	cursor: pointer;
	box-shadow: var(--lhh-shadow);
	transition: transform .06s ease;
}
.lhh-menu-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.12); }

/* Paused dimmer */
.lhh-app.is-paused .lhh-stage { filter: grayscale(.4) brightness(.8); }
.lhh-app.is-paused .lhh-stage::after {
	content: "⏸️ Paused";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(28px, 6vw, 54px);
	font-weight: 800;
	color: #fff;
	text-shadow: 0 3px 6px rgba(0,0,0,.4);
	z-index: 15;
}

/* ---------- Focus visibility for keyboard / accessibility ---------- */
.lhh-app button:focus-visible {
	outline: 4px solid #2a2a2a;
	outline-offset: 2px;
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.lhh-app *,
	.lhh-app *::after { animation: none !important; transition: none !important; }
}

/* ---------- Phone layout ---------- */
@media (max-width: 560px) {
	.lhh-app { padding: 10px; }
	.lhh-dpad { grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(3, 54px); }
	.lhh-arrow { font-size: 24px; border-radius: 14px; }
	.lhh-action { min-height: 72px; }
	.lhh-hud { justify-content: space-between; }
}
