/* mobile.css — phones only. index.html loads it with media="(max-width:700px)", so nothing here reaches an iPad. */

/* ---------- «Карточки» ---------- */
/* the animal never goes under the arrows */
.phero{max-width:calc(100vw - 150px)}
.parr{width:54px;height:54px}.parr.left{left:10px}.parr.right{right:10px}
/* all animals at once: two rows, no scrolling */
.pstrip{display:grid;grid-template-columns:repeat(var(--cols,4),minmax(0,1fr));gap:8px;
  max-height:none;overflow:visible;width:calc(100vw - 24px);padding:8px;bottom:calc(env(safe-area-inset-bottom) + 10px)}
.pmini{width:100%;aspect-ratio:1/1;border-radius:16px}
.pmini img,.pmini .pmfb{border-radius:16px}
.pmini.on{transform:translateY(-3px)}
/* the name and the big picture move up to make room for the two rows */
.pname{bottom:calc(env(safe-area-inset-bottom) + 10px + 16px + 2 * ((100vw - 24px - 16px - (var(--cols,4) - 1) * 8px) / var(--cols,4)) + 8px + 14px);
  min-width:0;width:calc(100vw - 48px);max-width:440px}
.pname span{font-size:clamp(30px,9vw,44px)}
.pstage{bottom:calc(env(safe-area-inset-bottom) + 10px + 16px + 2 * ((100vw - 24px - 16px - (var(--cols,4) - 1) * 8px) / var(--cols,4)) + 8px + 14px + 86px)}

/* ---------- «Учим слова» (Звери) ---------- */
.wscreen:not(.wstaged){--car:186px;--soonw:90vw}
.wscreen:not(.wstaged) .wlogoc{width:88vw;top:calc((90px + 100% - env(safe-area-inset-bottom) - var(--car) - var(--soonw) * .175 - 20px) / 2)}

/* ---------- stars ---------- */
/* puzzle and pairs: there is no room next to «Назад», so the stars get their own line just under it */
.gscreen2 .g2stars{top:calc(max(14px,env(safe-area-inset-top)) + 54px)!important;transform:translateX(-50%)!important;font-size:20px;padding:5px 10px;gap:1px}
.g2stars img.em{width:20px;height:20px}
.qscreen .g2stars,.fnscreen .g2stars{font-size:20px;padding:5px 10px;margin-top:6px!important}
/* the puzzle board moves down under the stars */
@media (orientation:portrait){.pzboard{top:calc(max(14px,env(safe-area-inset-top)) + 104px)}}

/* ---------- question sign ---------- */
.qplate span{font-size:clamp(22px,7vw,30px)}

/* ---------- first screen: «Альбом» is only its picture, so the help «?» next to it never covers the word ---------- */
.halbum{font-size:0!important;gap:0!important;padding:0 6px!important;width:58px;justify-content:center}
.halbum img{width:46px;height:46px}

/* ---------- Игротека (and every page with more than four cards): two cards in a row, picture on top, name under it ---------- */
/* the phone rule for the first screen puts the picture left and the words right; in two narrow columns the words fell out of the card */
.hubsub.many .hcard{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:flex-start!important;
  width:auto!important;min-width:0;padding:10px 8px 14px!important;text-align:center!important;gap:0}
.hubsub.many .hart{width:78%!important;flex:0 0 auto!important;grid-row:auto!important}
.hubsub.many .hname{margin-top:6px!important;align-self:center!important;text-align:center!important;font-size:clamp(17px,4.8vw,22px)!important;line-height:1.1;overflow-wrap:normal}
.hubsub.many .hsub{display:none!important}

/* ---------- «Учим слова»: the kitchen («Еда») and the playroom («Игрушки») come closer ---------- */
/* their tall picture is a whole room with a lot of empty wall, so on a phone everything looked small and far away.
   The room is shown a quarter bigger, held at the bottom (the table, the rug and the tepee stay in view; the very top and the sides go off screen) */
.wstaged[data-cat="food"] .wstage,.wstaged[data-cat="toys"] .wstage{width:max(125vw,calc(125vh * var(--ar)));top:auto;bottom:0;transform:translateX(-50%)}
/* the paper plane looped right through the title sign: on a phone it stays at home */
.wstaged[data-cat="toys"] .wly:has(img[src*="plane-loop"]){display:none}

/* ---------- games with a top bar of stars («Сделай как я», «Повтори за мной», «Попугай учит»…) ---------- */
/* «Назад» and the sound button share the first line, the stars get their own line under them,
   and the question moves down so the dots of the level path sit between the stars and the words */
.bar:has(>.stars){display:grid;grid-template-columns:1fr auto;grid-template-areas:". snd" "st st";row-gap:10px;align-items:center}
.bar:has(>.stars)>.stars{grid-area:st;justify-self:center;margin:0;font-size:24px;padding:4px 14px}
.bar:has(>.stars)>.ctl{grid-area:snd;width:56px;height:56px;font-size:28px}
.bar:has(>.stars)+.q{margin-top:26px;font-size:clamp(28px,8vw,40px)}

/* ---------- the dots of the level path: a little smaller on a phone ---------- */
.lvpath{scale:.8;transform-origin:50% 0}

/* ---------- «Цветной коврик» ---------- */
/* the menu: the level picture keeps to its column (the squares stuck out of the card), the panel of settings fits the screen */
.jmenu .hart{width:104px!important}
.jmenu .jart{font-size:30px!important}
.jopts{margin-top:14px!important;padding:10px 12px!important}
/* the game: «Назад» and the sound on the first line, the stars under them, then the task on its banner — on two lines if it is long —
   and the mat under all of it */
.jscreen .g2stars{top:calc(max(14px,env(safe-area-inset-top)) + 62px)!important;left:50%!important;right:auto!important;transform:translateX(-50%) scale(.8)!important}
.jscreen .jlabel{top:calc(max(14px,env(safe-area-inset-top)) + 150px);white-space:normal;width:max-content;max-width:calc(100vw - 20px);
  display:flex;flex-wrap:wrap;justify-content:center;row-gap:4px;font-size:clamp(17px,4.8vw,22px);padding:.7em 1.3em .8em;text-align:center}
.jscreen .jstage{top:calc(max(14px,env(safe-area-inset-top)) + 250px)}

/* ---------- «Счёт»: ducklings, sheep, carrots ---------- */
/* the game's sign under «Назад» and bigger (it was squeezed between the corner buttons), the stars under it a little smaller */
.dutitle,.catitle.dutitle{top:calc(max(14px,env(safe-area-inset-top)) + 58px)!important;width:min(84vw,420px)!important;height:auto!important;max-width:none!important;max-height:16vh!important}
.duscreen .g2stars,.shscreen .g2stars,.cascreen .g2stars{top:calc(max(14px,env(safe-area-inset-top)) + 58px + min(16vh,calc(min(84vw,420px) * .3)) + 6px)!important;
  transform:translateX(-50%) scale(.7)!important}

/* ---------- «Цвета»: a smaller label between «Назад» and the sound button, the things closer to the paper edge ---------- */
.cglabel{font-size:clamp(22px,6.4vw,30px);max-width:calc(100vw - 150px)}
.cgstage{margin:6px max(20px,env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 22px) max(20px,env(safe-area-inset-left))}
.cgpicks{gap:18px}
.cgpick{font-size:clamp(22px,6.6vw,32px)}
