/* Shared game shell: picture games and Theme Challenge (v1.32). Base390x844 CSS pixels.
   Existing controllers, images, feedback classes and recording/storage stay intact. */
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]){height:100dvh;overflow:clip;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-stage{
 width:min(100%,440px);height:100%;aspect-ratio:auto;container-type:size;
 --g-x:7.78cqw;--g-width:84.43cqw;--g-top:22.48cqh;
 --g-height:min(84.43cqw,calc(71.9cqh - 22.48cqh - 8px));
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-logo{
 left:18.86cqw;top:8.53cqh;width:62.27cqw;height:21.56cqw;object-fit:contain;
}
body #screen-game .game-back.app-header-control{left:12px;top:12px;}
body #screen-game #btn-pause.app-header-control{right:12px!important;left:auto;top:12px;}
body #screen-game :is(.game-back,#btn-pause).app-header-control{background:transparent!important;border:0!important;box-shadow:none!important;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-board{
 left:var(--g-x);top:var(--g-top);width:var(--g-width);height:var(--g-height);object-fit:fill;
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-word-bar{display:none;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .word-card{
 left:calc(var(--g-x) + 8.38cqw);top:calc(var(--g-top) + 5.99cqw);
 width:calc(var(--g-width) - 16.76cqw);height:13.47cqw;aspect-ratio:auto;
 border:1px solid #eddb8b;border-radius:30px;background:linear-gradient(155deg,#fff8cb,#ffeb92);box-shadow:inset 0 1.5px #fff9df;
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .word-text-slot{
 left:12px;top:0;width:calc(100% - 62px);height:100%;
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .word-en{font-family:Andika,sans-serif!important;font-weight:400!important;font-size:clamp(25px,8.38cqw,37px);line-height:1.2;color:#65522e;white-space:nowrap;text-shadow:none;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) #btn-speak{
 left:auto!important;right:0;top:50%;transform:translateY(-50%);aspect-ratio:auto;
 border:0!important;background:transparent!important;box-shadow:none!important;
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) #btn-speak::before{border-radius:50%!important;}
/* Keep the centered button still when the original idle cue pulses. */
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) #btn-speak.pulse-hint{animation:none;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) #btn-speak.pulse-hint::before{animation:gameSpeakerPlatePulse 1.2s ease-in-out infinite;}
@keyframes gameSpeakerPlatePulse{50%{transform:scale(1.08);}}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) #sticker-zone{
 inset:auto;left:calc(var(--g-x) + 3cqw);top:calc(var(--g-top) + 24cqw);
 width:calc(var(--g-width) - 6cqw);height:calc(var(--g-height) - 24cqw - max(16cqw,56px));
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:1.5cqw 7.78cqw;
}
body #screen-game[data-learning-mode=listen4] #sticker-zone{grid-template-rows:repeat(2,minmax(0,1fr));}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .answer-choice-slot{
 position:relative;inset:auto!important;width:100%;height:100%;max-width:none;max-height:none;aspect-ratio:auto;min-height:0;border-radius:20px;
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .answer-choice-slot img.sticker-img{
 position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);max-width:none;max-height:none;
 filter:drop-shadow(0 2px 3px #396d8826);
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4]) .answer-choice-slot.correct{background:transparent;box-shadow:none;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4]) .answer-choice-slot.wrong{background:transparent;box-shadow:none;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) #progress-dots{
 --round-star-size:clamp(16px,5.1cqw,22px);--round-star-gap:clamp(3px,1.2cqw,5px);
 left:50%;top:calc(var(--g-top) + var(--g-height) - 8.4cqw);
 width:calc(6 * var(--round-star-size) + 5 * var(--round-star-gap));height:var(--round-star-size);transform:translateX(-50%);
}
/* Next is reserved for exceptional save-retry recovery in picture games. */
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4]) #learning-next{
 left:calc(var(--g-x) + var(--g-width) - 30cqw);top:calc(var(--g-top) + var(--g-height) - 52px);
 width:26cqw;height:44px;min-height:44px;padding:4px 8px;font:800 15px/1.2 Nunito,sans-serif;
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-decorations{
 position:absolute;left:0;top:71.9cqh;width:100%;height:53.9cqw;transform:scale(.86);transform-origin:top center;
}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-buddy-group{left:23%;top:0;width:48.5%;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-ground-card-left{left:9.6%;top:29.34cqw;width:25.7%;z-index:2;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-ground-cards-right{left:64.8%;top:22.46cqw;width:31.3%;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-bubble-group{left:66.47%;top:-3.59cqw;width:32.85%;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-hint{font:600 4.49cqw/1.12 Fredoka,sans-serif;}
body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4],[data-learning-mode=spelling]) .game-buddy-word-text{font:400 4.19cqw/1 Andika,sans-serif;white-space:nowrap;}

/* Theme content keeps the original five-question, two-word task and manual Next.
   Its shell above is shared verbatim; only the answer content differs. */
body #screen-game[data-learning-mode=spelling] #sticker-zone{
 grid-template-rows:minmax(0,1fr) max(44px,12cqw);gap:3cqw 4cqw;
}
body #screen-game[data-learning-mode=spelling] .learning-question-image{
 position:relative;inset:auto;grid-column:1 / -1;justify-self:center;align-self:center;
 width:100%;height:100%;min-height:0;max-height:29cqw;object-fit:contain;
}
body #screen-game[data-learning-mode=spelling] .answer-choice-slot{
 min-width:0;padding:4px 6px;font:400 clamp(14px,4.6cqw,21px)/1.15 Andika,sans-serif;
 overflow-wrap:anywhere;
}
body #screen-game[data-learning-mode=spelling] #progress-dots{
 width:calc(5 * var(--round-star-size) + 4 * var(--round-star-gap));
}
body #screen-game[data-learning-mode=spelling] #game-progress-stars{grid-template-columns:repeat(5,minmax(0,1fr));}
body #screen-game[data-learning-mode=spelling] #learning-next{
 left:calc(var(--g-x) + var(--g-width) - 28cqw);top:calc(var(--g-top) + var(--g-height) + 8px);
 width:28cqw;height:44px;min-height:44px;padding:4px 8px;font:800 16px/1.2 Nunito,sans-serif;
}
/* On short screens the decorations meet the board: keep manual Next beside
   the cat rather than over the speech bubble. Picture-mode geometry is intact. */
@container (max-height:600px){
 body #screen-game[data-learning-mode=spelling] #learning-next{left:8px;width:76px;}
}

/* v1.34 Theme-only prompt/image/audio layout. All picture-game rules stay intact. */
body #screen-game[data-learning-mode=spelling] .word-card{
 left:var(--g-x);top:var(--g-top);width:var(--g-width);height:var(--g-height);
 border:0;background:transparent;box-shadow:none;border-radius:0;pointer-events:none;z-index:7;
}
body #screen-game[data-learning-mode=spelling] .word-text-slot{
 left:8px;top:10px;width:calc(100% - 16px);height:32px;
}
body #screen-game[data-learning-mode=spelling] .word-en{
 font-size:clamp(14px,4.2cqw,18px);color:#315b7c;text-shadow:0 1px #fff,1px 0 #fff,-1px 0 #fff,0 -1px #fff;
}
body #screen-game[data-learning-mode=spelling] #sticker-zone{
 top:calc(var(--g-top) + 16cqw);height:calc(var(--g-height) - 16cqw - max(16cqw,56px));
}
body #screen-game[data-learning-mode=spelling] .learning-question-image{
 justify-self:start;width:calc(100% - 54px);max-height:37cqw;
}
body #screen-game[data-learning-mode=spelling] #btn-speak{
 right:4cqw;top:calc((var(--g-height) + 16cqw - max(16cqw,56px) - max(44px,12cqw) - 3cqw) / 2);pointer-events:auto;
}
body #screen-game[data-learning-mode=spelling] .answer-choice-slot{
 border:1px solid #a9dcf2;border-radius:20px;background:var(--fui-sky,linear-gradient(150deg,#fff,#eaf9ff 44%,#bceaff));
 box-shadow:var(--fui-button-shadow,inset 0 2px white,0 2px 0 #b3e7fa);color:#326b8d;
}
/* Retain the existing Theme answer feedback, independent from picture games. */
body #screen-game[data-learning-mode=spelling] .answer-choice-slot.correct{background:#edf7e9;border-color:#86ae6a;}
body #screen-game[data-learning-mode=spelling] .answer-choice-slot.wrong{background:#fff0eb;border-color:#e5a597;}
body #screen-game[data-learning-mode=spelling] .game-hint{
 left:16%;top:24%;width:72%;height:50%;font-size:3.65cqw;line-height:1.15;
}

/* Word Play speaker: move inward by half its own hit size, matching the
   requested red-circle position. Keep its size, y position and audio handler. */
html body #screen-game:is([data-learning-mode=listen2],[data-learning-mode=listen4]) #btn-speak{right:calc(var(--header-hit,44px) / 2)!important;}

/* SVG word spans are flex items; whitespace-only text nodes do not make a gap. */
body #screen-game[data-learning-mode=spelling] .game-hint{column-gap:.22em;}
