/* Ehu kids games, shared look (v2). PRD §12: calm, big targets (≥96 px), rounded type.
   Layout concept: a painted storybook scene fills the screen; soft white "toy" cards and glassy
   controls sit on top; Ehu stands in the bottom-left corner and reacts in a short speech bubble;
   the question always lives in one card at the top, with a replay button. */
:root {
  --cream: #fff8ec;
  --paper: #ffffff;
  --glass: rgba(255, 255, 255, .78);
  --ink: #3a2717;
  --ink-soft: #7b644f;
  --line: rgba(58, 39, 23, .14);
  --sun: #ffcf3e;
  --mango: #ff9a1f;
  --mango-dark: #d4700a;
  --leaf: #4fb848;
  --leaf-dark: #2f8a2c;
  --berry: #ff5d73;
  --sea: #39a7dc;
  --sea-dark: #1f7fb0;
  --grape: #8e6cef;
  --sky: #d6f0fd;
  --shadow: 0 5px 0 rgba(58, 39, 23, .14);
  --shadow-soft: 0 4px 0 rgba(58, 39, 23, .10), 0 12px 28px rgba(58, 39, 23, .12);
  --radius: 28px;
  --tap: 96px;
  --display: 'Baloo 2', 'Nunito', 'Noto Sans Devanagari', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font: 'Nunito', 'Baloo 2', 'Noto Sans Devanagari', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--cream);
  color: var(--ink);
  font: 800 20px/1.3 var(--font);
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
:lang(hi), [lang="hi"] { font-family: var(--display); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible { outline: 4px solid var(--sea); outline-offset: 3px; }
img { -webkit-user-drag: none; user-select: none; }

/* Painted scene behind everything (Ehu.scene) */
body.ehu-scene { background: var(--scene) center bottom / cover no-repeat, var(--cream); }
body.ehu-scene::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 130px; background: linear-gradient(rgba(255, 255, 255, .6), rgba(255, 255, 255, 0)); pointer-events: none; z-index: 0; }

/* Stage */
.ehu-stage { position: fixed; inset: 0; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.ehu-top { display: flex; align-items: center; gap: 10px; min-height: 72px; position: relative; z-index: 20; }
.ehu-play { position: relative; flex: 1; min-height: 0; }

.ehu-round {
  width: 64px; height: 64px; flex: none; border-radius: 50%; background: var(--glass); box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: grid; place-items: center; transition: transform .12s ease;
}
.ehu-round:active { transform: translateY(3px) scale(.97); }
.ehu-round svg { width: 34px; height: 34px; }
.ehu-title { display: none; font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; white-space: nowrap; }
.ehu-title small { display: none; }
@media (min-width: 900px) { .ehu-title { display: block; } }

/* Progress trail of stars for the round */
.ehu-steps { flex: 1; min-width: 0; display: flex; justify-content: center; align-items: center; gap: clamp(3px, 1vw, 8px); }
.ehu-steps i { width: clamp(22px, 5vw, 32px); aspect-ratio: 1; display: block; transition: transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.ehu-steps i svg { width: 100%; height: 100%; display: block; }
.ehu-steps i .s { fill: rgba(255, 255, 255, .85); stroke: rgba(58, 39, 23, .25); }
.ehu-steps i.on .s { fill: var(--sun); stroke: #d99a00; }
.ehu-steps i.now { transform: scale(1.18); }
.ehu-steps i.now .s { stroke: var(--mango); stroke-width: 1.8; }

/* Language switch: English or Hindi voice and words (PRD: EN / HI) */
.ehu-lang { flex: none; display: flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--glass); box-shadow: var(--shadow-soft); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.ehu-lang button { min-width: 58px; height: 52px; padding: 0 12px; border-radius: 999px; font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1; color: var(--ink-soft); transition: background .15s ease, color .15s ease; }
.ehu-lang button[aria-pressed="true"] { background: var(--mango); color: #fff; box-shadow: 0 3px 0 var(--mango-dark); }
.ehu-grown {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .55);
  display: grid; place-items: center; color: var(--ink-soft);
}
.ehu-grown svg { width: 22px; height: 22px; }
.ehu-grown .ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--leaf) var(--p, 0%), transparent 0); mask: radial-gradient(circle, transparent 58%, #000 60%); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); }
@media (max-width: 380px) { .ehu-lang button { min-width: 50px; padding: 0 8px; font-size: 17px; } .ehu-round { width: 56px; height: 56px; } }

/* Big buttons */
.ehu-big {
  min-height: var(--tap); min-width: var(--tap); padding: 16px 32px; border-radius: 999px;
  background: var(--leaf); color: #fff; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 5vw, 36px); line-height: 1;
  box-shadow: 0 7px 0 var(--leaf-dark), 0 14px 26px rgba(47, 138, 44, .25);
  display: inline-flex; align-items: center; justify-content: center; gap: 14px; transition: transform .1s ease, box-shadow .1s ease;
}
.ehu-big:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--leaf-dark); }
.ehu-big.alt { background: var(--paper); color: var(--ink); box-shadow: 0 7px 0 rgba(58, 39, 23, .16), 0 14px 26px rgba(58, 39, 23, .1); }
.ehu-big.warm { background: var(--mango); box-shadow: 0 7px 0 var(--mango-dark), 0 14px 26px rgba(212, 112, 10, .25); }
.ehu-big svg { width: 40px; height: 40px; flex: none; }
.ehu-big > span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }

/* Question card (Ehu.ask): one place for every instruction, with a replay button */
.ehu-ask {
  position: absolute; z-index: 12; left: 50%; top: 2px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(96%, 680px);
  padding: 8px 20px 8px 8px; border-radius: 30px; background: var(--paper); box-shadow: var(--shadow-soft);
}
.ehu-ask.in { animation: ehu-ask-in .38s cubic-bezier(.3, 1.5, .5, 1); }
.ehu-ask .ehu-say { width: 72px; height: 72px; flex: none; border-radius: 50%; background: var(--sea); box-shadow: 0 4px 0 var(--sea-dark); display: grid; place-items: center; }
.ehu-ask .ehu-say svg { width: 38px; height: 38px; }
.ehu-ask.speaking .ehu-say { animation: ehu-speak 1s ease-in-out infinite; }
.ehu-ask .ehu-pic { flex: none; width: 72px; height: 72px; display: grid; place-items: center; }
.ehu-ask .ehu-pic:empty { display: none; }
.ehu-ask .ehu-pic img, .ehu-ask .ehu-pic svg { max-width: 100%; max-height: 100%; object-fit: contain; }
.ehu-ask .ehu-q { min-width: 0; font-family: var(--display); font-weight: 800; font-size: clamp(19px, 4vw, 28px); line-height: 1.12; text-wrap: pretty; }
@keyframes ehu-ask-in { from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.96); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes ehu-speak { 0%, 100% { box-shadow: 0 4px 0 var(--sea-dark), 0 0 0 0 rgba(57, 167, 220, .45); } 50% { box-shadow: 0 4px 0 var(--sea-dark), 0 0 0 12px rgba(57, 167, 220, 0); } }

/* Ehu in her corner */
.ehu-mascot { position: absolute; z-index: 15; pointer-events: none; width: clamp(104px, 18vmin, 190px); aspect-ratio: 1; }
.ehu-mascot::before { content: ""; position: absolute; left: 18%; right: 18%; bottom: 1%; height: 9%; border-radius: 50%; background: radial-gradient(rgba(58, 39, 23, .22), transparent 70%); }
.ehu-mascot img, .ehu-mascot svg.ehu-fallback { position: relative; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; display: block; transform-origin: 50% 92%; animation: ehu-breathe 3.2s ease-in-out infinite; }
.ehu-mascot.bounce img, .ehu-mascot.bounce svg.ehu-fallback { animation: ehu-bounce .6s ease; }
.ehu-mascot.wiggle img, .ehu-mascot.wiggle svg.ehu-fallback { animation: ehu-wiggle .5s ease; }
.ehu-bubble {
  position: absolute; left: 64%; bottom: 84%; width: max-content; min-width: 120px; max-width: min(62vw, 380px); padding: 12px 18px; border-radius: 24px 24px 24px 8px;
  background: var(--paper); box-shadow: var(--shadow-soft); font-family: var(--display); font-weight: 800; font-size: clamp(18px, 3.4vw, 25px); line-height: 1.18;
  opacity: 0; transform: translateY(8px) scale(.92); transform-origin: 0 100%; transition: opacity .2s ease, transform .25s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none;
}
.ehu-bubble::after { content: ""; position: absolute; left: 10px; bottom: -11px; border: 12px solid transparent; border-top-color: var(--paper); border-bottom: 0; border-left-width: 6px; }
.ehu-bubble.show { opacity: 1; transform: none; }
.ehu-bubble .hi { display: block; color: var(--ink-soft); font-size: .92em; }
@keyframes ehu-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.02, .985); } }
@keyframes ehu-bounce { 0% { transform: translateY(0); } 35% { transform: translateY(-14%) scale(1.04); } 70% { transform: translateY(0) scale(.98, 1.02); } 100% { transform: none; } }
@keyframes ehu-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

/* Gentle "try again" wiggle, and attention pulse */
.ehu-oops { animation: ehu-oops .45s ease; }
@keyframes ehu-oops { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-3deg); } 40% { transform: translateX(10px) rotate(3deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
.ehu-pulse { animation: ehu-pulse 1.4s ease-in-out infinite; }
@keyframes ehu-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.ehu-fly .s { fill: var(--sun); stroke: #d99a00; }
.ehu-fly { position: fixed; z-index: 45; width: 30px; height: 30px; pointer-events: none; transition: transform .7s cubic-bezier(.5, -0.3, .4, 1), opacity .7s ease; }

/* Overlays: start, goodbye, break, grown-ups */
.ehu-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: rgba(255, 248, 236, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); overflow-y: auto; overscroll-behavior: contain; }
.ehu-overlay[hidden] { display: none; }
.ehu-card { position: relative; width: min(540px, 100%); background: var(--paper); border-radius: 36px; padding: 22px 22px 26px; margin: auto 0; box-shadow: var(--shadow-soft); text-align: center; display: grid; gap: 14px; justify-items: center; }
.ehu-card .ehu-hero { width: min(220px, 40vmin, 26vh); aspect-ratio: 1; }
.ehu-card .ehu-hero img, .ehu-card .ehu-hero svg { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; animation: ehu-breathe 3.2s ease-in-out infinite; }
.ehu-card h1 { margin: 0; font-family: var(--display); font-size: clamp(30px, 6.4vw, 44px); line-height: 1.05; text-wrap: balance; }
.ehu-card h1 .hi, .ehu-card p .hi { display: block; font-size: .7em; color: var(--ink-soft); }
.ehu-card p { margin: 0; font-weight: 700; color: var(--ink-soft); }
.ehu-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.ehu-card .ehu-row { flex-wrap: nowrap; }
.ehu-card .ehu-big { padding: 12px 24px; min-height: 96px; }

/* Start screen: the game's painted cover, its name, one big Play */
.ehu-start .ehu-card { padding-top: 18px; }
.ehu-cover { width: min(320px, 70vw, 36vh); aspect-ratio: 1; border-radius: 30px; overflow: hidden; border: 7px solid #fff; box-shadow: 0 10px 30px rgba(58, 39, 23, .2); transform: rotate(-2deg); background: var(--sky); }
.ehu-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ehu-start .ehu-wave { position: absolute; left: -18px; bottom: -14px; width: clamp(96px, 26vw, 150px); aspect-ratio: 1; pointer-events: none; }
.ehu-start .ehu-wave img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; animation: ehu-breathe 3.2s ease-in-out infinite; }
.ehu-start .ehu-big { min-width: 200px; }

/* Goodbye: stars pop in, Again and Home, and a folded tip for grown-ups */
.ehu-bye .ehu-hero { margin-top: -90px; width: min(200px, 46vw, 26vh); }
.ehu-bye .ehu-card { margin-top: 80px; }
.ehu-bye .ehu-stars svg { width: clamp(40px, 10vw, 54px); height: auto; opacity: 0; transform: scale(.2) rotate(-30deg); }
.ehu-bye .ehu-stars svg.pop { animation: ehu-star-pop .5s cubic-bezier(.3, 1.8, .5, 1) forwards; }
@keyframes ehu-star-pop { to { opacity: 1; transform: none; } }
.ehu-roundbtn { display: grid; justify-items: center; gap: 6px; font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--ink-soft); }
.ehu-roundbtn .b { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--leaf); box-shadow: 0 6px 0 var(--leaf-dark); transition: transform .1s ease; }
.ehu-roundbtn.alt .b { background: var(--mango); box-shadow: 0 6px 0 var(--mango-dark); }
.ehu-roundbtn:active .b { transform: translateY(4px); }
.ehu-roundbtn svg { width: 46px; height: 46px; }
.ehu-tip { width: 100%; text-align: left; background: #fff4d6; border-radius: 22px; padding: 10px 16px; font-weight: 700; font-size: 15px; line-height: 1.4; color: var(--ink); }
.ehu-tip summary { cursor: pointer; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.ehu-tip summary::-webkit-details-marker { display: none; }
.ehu-tip summary::after { content: "+"; font-size: 22px; letter-spacing: 0; }
.ehu-tip[open] summary::after { content: "–"; }
.ehu-tip p { margin: 6px 0 4px; color: var(--ink); font-weight: 700; }
.ehu-tip b { display: block; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.ehu-tip .hi { display: block; margin-top: 6px; color: var(--ink-soft); }

.ehu-settings { text-align: left; justify-items: stretch; }
.ehu-settings h2 { margin: 0; font-family: var(--display); font-size: 28px; }
.ehu-settings fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.ehu-settings legend { font-size: 15px; color: var(--ink-soft); margin-bottom: 6px; }
.ehu-seg { display: flex; gap: 8px; flex-wrap: wrap; }
.ehu-seg button { flex: 1; min-height: 56px; padding: 8px 12px; border-radius: 16px; background: #f3ead9; font-size: 18px; }
.ehu-seg button[aria-pressed="true"] { background: var(--leaf); color: #fff; }
.ehu-settings .ehu-link { font-size: 16px; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 4px; justify-self: start; }

/* Stars / confetti */
.ehu-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.ehu-stars { display: flex; gap: 6px; align-items: center; font-size: 22px; }
.ehu-stars svg { width: 34px; height: 34px; }

/* Task change: old content slides out, new slides in (Ehu.swap) */
.ehu-out { animation: ehu-out .28s ease forwards; }
.ehu-in { animation: ehu-in .36s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes ehu-out { to { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes ehu-in { from { opacity: 0; transform: translateY(-14px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .ehu-bye .ehu-stars svg { opacity: 1; transform: none; }
}

/* Language labels: short on phones, full on wider screens */
.ehu-lang .long { display: none; }
@media (min-width: 640px) { .ehu-lang .long { display: inline; } .ehu-lang .short { display: none; } }
.ehu-start .ehu-lang button { height: 44px; min-width: 48px; font-size: 17px; }

/* Narrow phones: smaller controls so the star trail keeps readable stars */
@media (max-width: 430px) {
  .ehu-top { gap: 6px; }
  .ehu-round { width: 54px; height: 54px; }
  .ehu-round svg { width: 30px; height: 30px; }
  .ehu-lang { padding: 3px; }
  .ehu-lang button { min-width: 44px; height: 46px; padding: 0 9px; font-size: 17px; }
  .ehu-grown { width: 42px; height: 42px; }
  .ehu-steps i { width: clamp(18px, 5.4vw, 24px); }
  .ehu-steps { gap: 2px; }
}

/* Question card: flexible picture slot, wraps on narrow screens, text sized by width and height */
.ehu-ask .ehu-pic { width: auto; min-width: 56px; max-width: 132px; }
.ehu-ask .ehu-pic img { height: 72px; width: auto; }
.ehu-ask .ehu-q { font-size: clamp(18px, min(4vw, 4.4vh), 28px); }
@media (max-width: 430px) {
  .ehu-ask { gap: 8px; padding: 6px 14px 6px 6px; border-radius: 26px; }
  .ehu-ask .ehu-say { width: 60px; height: 60px; }
  .ehu-ask .ehu-say svg { width: 32px; height: 32px; }
  .ehu-ask .ehu-pic img { height: 58px; }
}

/* Short screens (phones held sideways): start and goodbye cards go side by side so nothing scrolls */
@media (max-height: 520px) and (orientation: landscape) {
  .ehu-overlay { padding-block: 10px; }
  .ehu-card { width: min(760px, 100%); grid-template-columns: auto minmax(0, 1fr); align-items: center; text-align: left; justify-items: start; gap: 8px 22px; padding: 14px 18px; }
  .ehu-card > .ehu-hero, .ehu-card > .ehu-cover { grid-row: 1 / span 4; }
  .ehu-card .ehu-hero { width: min(200px, 44vh); }
  .ehu-cover { width: min(300px, 64vh); }
  .ehu-card h1 { font-size: clamp(24px, 7vh, 36px); }
  .ehu-start .ehu-wave { display: none; }
  .ehu-bye .ehu-hero { margin-top: 0; width: min(180px, 42vh); }
  .ehu-bye .ehu-card { margin-top: 0; }
  .ehu-card .ehu-row { justify-content: flex-start; }
  .ehu-tip { padding: 6px 12px; }
}

/* The replay button keeps a 96px touch area even when it looks smaller */
.ehu-ask .ehu-say { position: relative; }
.ehu-ask .ehu-say::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; }
.ehu-ask .ehu-pic > svg, .ehu-ask .ehu-pic span > svg { height: 72px; width: auto; }

.ehu-scene-fade { position: fixed; inset: 0; z-index: 0; pointer-events: none; background-repeat: no-repeat; transition: opacity .55s ease; }
