/* NOMVEX Kids v2 — game pieces (stage content). Same tokens as child.css. */
.kx-ans.wide{min-width:200px;flex-direction:row;font-size:26px}
.kx-ans.wide svg{width:64px;height:64px}
.kx-hear{width:88px;height:88px;flex:none;border-radius:50%;border:3px solid var(--ink);background:var(--orange);box-shadow:0 5px 0 var(--ink);display:flex;align-items:center;justify-content:center;padding:0}
.kx-hear svg{width:46px;height:46px}
.kx-q{display:inline-block;min-width:1.1em;padding:0 .15em;border-radius:16px;border:4px dashed var(--ink);background:#fff;text-align:center}
.kx-sum,.kx-slate{display:flex;flex-direction:column;align-items:center;gap:18px}
.kx-dotrow{display:flex;align-items:center;gap:16px;flex-wrap:wrap;justify-content:center}
.kx-dotrow b{font-size:44px}
.kx-dotset{display:grid;grid-template-columns:repeat(5,28px);gap:8px}
.kx-dotset i{width:28px;height:28px;border-radius:50%;border:3px solid var(--ink);background:var(--orange)}
.kx-dotset i.b{background:#f4c04e}.kx-dotset i.x{background:#fff;position:relative}.kx-dotset i.x:after{content:"";position:absolute;left:-4px;right:-4px;top:50%;height:3px;background:var(--ink);transform:rotate(-40deg)}
.kx-slate{background:#2f5a4d;color:#fff;border:3px solid var(--ink);border-radius:24px;padding:20px 40px;box-shadow:0 6px 0 var(--ink)}
.kx-slate .kx-q{background:#2f5a4d;border-color:#fff}
.kx-klass{font-size:22px;padding:2px 14px;border-radius:999px;background:#fff;color:var(--ink)}
.kx-row{display:flex;gap:clamp(6px,1.4vw,16px);align-items:center;flex-wrap:wrap;justify-content:center}
.kx-shape{width:clamp(56px,9vw,110px);height:clamp(56px,9vw,110px);display:flex;align-items:center;justify-content:center;background:#fff;border:3px solid var(--ink);border-radius:20px}
.kx-shape svg{width:80%;height:80%}
.kx-slot{border-style:dashed;font-size:clamp(36px,5vw,60px);font-weight:700}
.kx-word{display:flex;align-items:center;gap:24px;background:#fff;border:3px solid var(--ink);border-radius:28px;padding:18px 32px;box-shadow:0 6px 0 var(--ink)}
.kx-item{display:flex;flex-direction:column;align-items:center;gap:8px;height:100%;max-height:100%;justify-content:center;min-height:0}
.kx-item svg{height:min(34vh,260px);width:auto;background:#fff;border:3px solid var(--ink);border-radius:32px;padding:14px;box-shadow:0 6px 0 var(--ink)}
.kx-itname{font-size:32px;font-weight:700}
.kx-board:has(.kx-clock){container-type:size}
.kx-clock{width:min(100cqw,100cqh,420px);aspect-ratio:1}
.kx-clock svg{width:100%;height:100%}
.kx-tray{display:flex;flex-wrap:wrap;gap:14px;align-items:center;justify-content:center;max-width:760px;padding:22px;border:3px solid var(--ink);border-radius:28px;background:#f1e3c4;box-shadow:0 6px 0 var(--ink)}
.kx-coin svg{width:clamp(80px,11vw,132px);height:clamp(80px,11vw,132px)}
.kx-coin.note svg{width:clamp(110px,15vw,170px)}
.kx-memb{container-type:size;align-self:stretch}
.kx-mem{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));grid-template-rows:repeat(var(--rows),minmax(0,1fr));gap:12px;width:min(100cqw,calc((100cqh - (var(--rows) - 1) * 12px) * var(--cols) * 4 / (var(--rows) * 5) + (var(--cols) - 1) * 12px));aspect-ratio:calc(var(--cols) * 4)/calc(var(--rows) * 5);max-height:100cqh}
.kx-mcard{border:3px solid var(--ink);border-radius:20px;background:var(--ink);box-shadow:0 5px 0 #0c2526;display:flex;align-items:center;justify-content:center;padding:6px;min-width:64px;min-height:64px;transition:transform .2s}
.kx-mcard.up{background:#fff;box-shadow:0 5px 0 var(--ink)}
.kx-mcard.got{background:#e8f2dc}
.kx-mcard svg{width:78%;height:78%}
.kx-covers{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:20px;width:100%;max-width:980px}
.kx-storyc{min-height:220px}
.kx-storyc>svg{width:100%;height:150px}
.kx-cover{display:flex;gap:6px;justify-content:center;align-items:center;background:var(--w-soft);border-radius:18px;padding:8px;border:3px solid var(--ink)}
.kx-cover svg{width:clamp(80px,10vw,124px);height:clamp(80px,10vw,124px)}
.kx-story{align-items:center}
.kx-page2{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:20px;align-items:center;width:100%;max-width:1100px;background:#fff;border:3px solid var(--ink);border-radius:28px;padding:20px;box-shadow:0 6px 0 var(--ink)}
.kx-say{margin:0;font-size:clamp(22px,2.4vw,30px);line-height:1.4}
.kx-say p{margin:0 0 10px}.kx-say b svg{width:26px;height:26px;vertical-align:-5px}
.kx-studio{gap:clamp(12px,2vw,32px)}
.kx-grid8{display:grid;grid-template-columns:repeat(8,1fr);grid-template-rows:repeat(8,1fr);height:100%;max-height:100%;aspect-ratio:1;border:4px solid var(--ink);border-radius:12px;overflow:hidden;background:#fff;position:relative;max-width:100%}
.kx-grid8.mir:after{content:"";position:absolute;left:50%;top:0;bottom:0;border-left:4px dashed var(--orange);pointer-events:none}
.kx-px{border:1px solid #d9e2dc;padding:0;min-width:0;min-height:0;border-radius:0}
.kx-tools{display:flex;flex-direction:column;gap:16px;align-items:center}
.kx-pots{display:grid;grid-template-columns:repeat(2,72px);gap:12px}
.kx-pot{width:72px;height:72px;border-radius:50%;border:3px solid var(--ink);background:var(--c);box-shadow:0 4px 0 var(--ink);display:flex;align-items:center;justify-content:center;padding:0}
.kx-pot[aria-pressed=true]{outline:5px solid var(--ink);outline-offset:3px}
.kx-pot svg{width:40px;height:40px;color:var(--ink)}
.kx-trow{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.kx-trow .kx-ans{min-width:88px;min-height:88px}
.kx-trow .kx-ans[aria-pressed=true]{background:#e8f2dc}
.kx-mgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;width:100%;max-width:1000px}
.kx-mgrid .kx-choice svg{width:88px;height:88px}
.kx-sheet{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;background:#fff;border:3px solid var(--ink);border-radius:20px;padding:16px;box-shadow:0 6px 0 var(--ink);transform:rotate(-2deg);width:min(520px,100%)}
.kx-sheetp{position:relative;border:2px dashed var(--ink);border-radius:14px;overflow:hidden;background:var(--w)}
.kx-sheetp .pic svg{width:100%;height:auto;display:block}
.kx-sheetp b{position:absolute;left:6px;top:6px;width:34px;height:34px;border-radius:50%;background:#fff;border:2px solid var(--ink);display:flex;align-items:center;justify-content:center;font-size:20px}
.kx-xylo{display:flex;align-items:flex-end;gap:clamp(8px,1.6vw,20px);height:100%;max-height:420px;width:100%;max-width:900px;justify-content:center}
.kx-xbar{flex:1;height:var(--h);min-width:64px;border:3px solid var(--ink);border-radius:20px;background:var(--c);box-shadow:0 6px 0 var(--ink);display:flex;align-items:flex-end;justify-content:center;padding:10px 4px;transition:transform .12s}
.kx-xbar span{width:70%;max-width:70px;aspect-ratio:1;background:#fff;border-radius:50%;border:3px solid var(--ink);display:flex;align-items:center;justify-content:center}
.kx-xbar span svg{width:70%;height:70%}
.kx-xbar.on{transform:translateY(6px);box-shadow:0 0 0 var(--ink);filter:brightness(1.12)}
.kx-lockcard{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;align-items:center;max-width:900px;background:#fff;border:3px solid var(--ink);border-radius:28px;padding:20px;box-shadow:0 6px 0 var(--ink)}
.kx-lockcard .pic{position:relative;display:block;border-radius:20px;overflow:hidden;background:var(--w);border:3px solid var(--ink)}
.kx-lockcard .pic>svg{width:100%;height:auto;display:block}
.big-lock{position:absolute;right:10px;bottom:10px;width:76px;height:76px;border-radius:50%;background:#fff;border:3px solid var(--ink);display:flex;align-items:center;justify-content:center}
.big-lock svg{width:42px;height:42px}
.kx-lockcard h2{margin:0 0 8px;font-size:36px}.kx-lockcard p{font-size:24px;margin:0}
.kx-lesson{grid-template-rows:minmax(0,1fr) auto}
.kx-screen{position:relative;min-height:0;display:flex;align-items:center;justify-content:center}
.kx-screen>svg{height:100%;max-height:100%;width:auto;max-width:100%;aspect-ratio:600/340;border:4px solid var(--ink);border-radius:24px;background:#fff;box-shadow:0 6px 0 var(--ink)}
.kx-bigplay{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:132px;height:132px;border-radius:50%;border:4px solid var(--ink);background:var(--orange);box-shadow:0 6px 0 var(--ink);display:flex;align-items:center;justify-content:center;padding:0}
.kx-bigplay svg{width:64px;height:64px}
.kx-bigplay[hidden]{display:none}
.kx-subs{margin:0 auto 10px;max-width:1000px;min-height:2.8em;text-align:center;font-size:clamp(22px,2.6vw,32px);font-weight:700;line-height:1.3;background:#fff;border:3px solid var(--ink);border-radius:20px;padding:8px 16px}
.kx-lctrl{display:flex;align-items:center;justify-content:center;gap:16px}
.kx-lctrl .kx-ans{min-width:96px}
.kx-focus{animation:kx-bob 1.6s ease-in-out infinite}
@media (max-width:640px){
  .kx-ans.wide{min-width:0;flex:1;font-size:22px;gap:6px}.kx-ans.wide svg{width:44px;height:44px}
  .kx-word{padding:10px 16px;gap:12px}.kx-hear{width:72px;height:72px}
  .kx-dotset{grid-template-columns:repeat(5,20px);gap:5px}.kx-dotset i{width:20px;height:20px}
  .kx-slate{padding:14px 18px}
  .kx-page2{grid-template-columns:1fr;padding:12px;gap:10px}
  .kx-page2 .kx-cover{display:none}
  .kx-page2 .kx-hear{position:absolute;right:-6px;top:-18px;width:64px;height:64px}
  .kx-say{font-size:21px}
  .kx-studio{flex-direction:column}
  .kx-grid8{height:auto;width:100%}
  .kx-tools{flex-direction:column;gap:8px}.kx-pots{grid-template-columns:repeat(4,64px);gap:6px}.kx-pot{width:64px;height:64px}
  .kx-trow{grid-template-columns:repeat(4,64px);gap:6px}.kx-trow .kx-ans{min-width:64px;min-height:64px;padding:4px}.kx-trow .kx-ans svg{width:40px;height:40px}
  .kx-studio{justify-content:flex-start}
  .kx-screen>svg{height:auto;width:100%}
  .kx-mgrid{grid-template-columns:1fr 1fr;gap:10px}.kx-mgrid .kx-choice{min-height:0;padding:6px}.kx-mgrid .kx-choice svg{width:64px;height:64px}
  .kx-covers{grid-template-columns:1fr;gap:10px}.kx-storyc{min-height:0;flex-direction:row}.kx-storyc>svg{height:80px;width:120px}
  .kx-lockcard{grid-template-columns:1fr;gap:10px;padding:12px}.kx-lockcard h2{font-size:28px}.kx-lockcard p{font-size:21px}
  .kx-itname{font-size:26px}
  .kx-bigplay{width:96px;height:96px}
  .kx-lctrl .kx-ans{min-width:72px}
}

/* real photos inside the existing game frames */
.kx-ans.pic img{width:96px;height:84px;border-radius:14px;flex:none}
.kx-ans.wide img{width:72px;height:64px}
.kx-item img{height:min(36vh,280px);width:auto;aspect-ratio:4/3;border:3px solid var(--ink);border-radius:28px;box-shadow:0 6px 0 var(--ink)}
.kx-cover img{width:clamp(80px,10vw,124px);height:clamp(80px,10vw,124px);border-radius:14px}
.kx-mgrid .kx-choice img{width:100%;height:120px;border-radius:14px}
.kx-storyc>img,.kx-storyc>.ph2{width:100%;height:150px;border-radius:16px}
.kx-mcard.up{padding:6px}.kx-mcard img{border-radius:14px}
.kx-coinph{display:inline-block;width:calc(clamp(80px,11vw,132px) * var(--d));height:calc(clamp(80px,11vw,132px) * var(--d));border-radius:50%;overflow:hidden;box-shadow:0 4px 0 rgba(24,63,64,.6)}
.kx-note{display:inline-block;width:clamp(130px,17vw,190px);aspect-ratio:2/1;border-radius:8px;overflow:hidden;box-shadow:0 4px 0 rgba(24,63,64,.6)}
.kx-note img{object-fit:cover}
.kx-dial{position:relative;display:block;width:100%;height:100%;border-radius:50%;overflow:hidden;border:5px solid var(--ink);box-shadow:0 6px 0 var(--ink);background:#f4f4f2}
.kx-dial>svg{position:absolute;inset:0;width:100%;height:100%}
.kx-lockcard .pic>img,.kx-lockcard .pic>.ph2{width:100%;aspect-ratio:3/2;height:auto}
.kx-sheetp .pic{display:block;aspect-ratio:3/2}.kx-sheetp .pic>img,.kx-sheetp .pic>.ph2{height:100%}
.kx-screen>.kx-lz{position:relative;height:100%;max-height:100%;width:auto;max-width:100%;aspect-ratio:600/340;border:4px solid var(--ink);border-radius:24px;overflow:hidden;box-shadow:0 6px 0 var(--ink);background:#e9e4d8}
.lz-chip{position:absolute;left:14px;bottom:14px;max-width:calc(100% - 28px);background:#fffaf0;border:3px solid var(--ink);border-radius:16px;padding:4px 14px;font-size:clamp(20px,2.4vw,30px);font-weight:700;box-shadow:0 4px 0 var(--ink)}
.lz-chip.big{font-size:clamp(28px,4vw,52px)}
.lz-dots{position:absolute;right:14px;bottom:14px;display:flex;gap:10px}.lz-dots i{width:34px;height:34px;border-radius:50%;background:var(--orange);border:3px solid var(--ink)}
.lz-bubble{position:absolute;right:5%;top:10%;max-width:60%;background:#fff;border:3px solid var(--ink);border-radius:24px;padding:10px 22px;font-size:clamp(28px,4.4vw,56px);font-weight:700;box-shadow:0 5px 0 var(--ink)}
.lz-mix{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);display:flex;align-items:center;gap:12px;background:#fffaf0;border:3px solid var(--ink);border-radius:999px;padding:8px 16px;box-shadow:0 4px 0 var(--ink)}
.lz-mix i{width:clamp(40px,6vw,70px);height:clamp(40px,6vw,70px);border-radius:50%;border:3px solid var(--ink)}.lz-mix b{font-size:clamp(28px,4vw,44px)}
@media (max-width:640px){.kx-screen>.kx-lz{height:auto;width:100%}.kx-mgrid .kx-choice img{height:80px}.kx-storyc>img,.kx-storyc>.ph2{height:80px;width:120px}.kx-ans.pic img{width:64px;height:56px}.kx-ans.wide img{width:48px;height:44px}.kx-whead .guide .kx-badge{width:72px;height:72px}}

/* ---- Fit, else scroll: content is never clipped ----
   A full-screen activity fills the window when everything fits; when it does not (short or
   narrow screens), the screen grows and the page scrolls. Pictures are sized by the free width
   AND height, so they never spill out of the screen. */
.kx-game{height:auto;min-height:100dvh;overflow:visible}
.kx-play{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(min(240px,58vh),1fr) auto}
.kx-board{min-width:0}
.kx-lesson{grid-template-rows:minmax(min(240px,58vh),1fr) auto}
.kx-screen{container-type:size;min-width:0}
.kx-screen>.kx-lz,.kx-screen>svg{height:auto;width:min(100cqw,100cqh * 600 / 340);max-width:100%;max-height:100%}
/* Symmetry studio: the 8x8 grid takes the largest square that fits beside its tools. */
@media (min-width:641px){
  .kx-studio{container-type:size}
  .kx-studio .kx-grid8{height:auto;width:min(100cqh,calc(100cqw - 220px));flex:none}
}
@media (min-width:641px) and (max-height:820px){
  .kx-studio .kx-pots{grid-template-columns:repeat(4,56px);gap:8px}
  .kx-studio .kx-pot{width:56px;height:56px}
  .kx-studio .kx-pot svg{width:30px;height:30px}
  .kx-studio .kx-trow{grid-template-columns:repeat(4,56px);gap:8px}
  .kx-studio .kx-trow .kx-ans{min-width:56px;min-height:56px;padding:4px}
  .kx-studio .kx-trow .kx-ans svg{width:34px;height:34px}
  .kx-studio .kx-grid8{width:min(100cqh,calc(100cqw - 270px))}
}
/* Phones: the world header keeps its photo badge in its own column, so nothing overlaps. */
@media (max-width:640px){
  .kx-whead{grid-template-columns:auto auto minmax(0,1fr)}
  .kx-whead>span:empty{display:none}
  .kx-whead .count{flex-wrap:wrap;gap:2px 12px;font-size:18px;margin-top:4px}
  .kx-whead .count svg{width:24px;height:24px}
  .kx-whead .guide{width:auto;height:auto}
  .kx-whead .guide .kx-badge{width:56px;height:56px}
  .kx-whead h1{font-size:clamp(22px,7vw,28px);overflow-wrap:break-word}
}

/* The memory pair keeps card proportions instead of stretching with its box. */
.ph2{align-items:center;justify-items:center}
.ph2 img.ph{height:auto;width:100%;max-height:100%;aspect-ratio:3/4;object-fit:cover}
/* Home "start" pill stays inside the picture and wraps instead of covering the side buttons. */
.kx-setup{max-width:calc(55% - 20px)}
.kx-setup>span{white-space:normal;line-height:1.2}
/* Mid widths (iPad portrait): the "continue" tile stacks picture over words, labels shrink to fit. */
@media (min-width:641px) and (max-width:1000px){
  .kx-cont{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto}
  .kx-cont .lab{border-left:0;border-top:3px solid var(--ink);align-items:center;text-align:center;font-size:22px;padding:6px 10px}
  .kx-door .lab{font-size:clamp(18px,2.6vw,24px);gap:6px}
  .kx-worlds .lab{font-size:clamp(15px,2.1vw,20px);padding:4px}
  .kx-setup>span{font-size:17px}
}
/* Adult gate: the title never runs under the close button. */
.kx-gate .child{padding-right:70px}
@media (max-width:640px){
  .kx-gate .child{gap:10px}
  .kx-gate .child .kx-badge.lg{width:72px;height:72px}
  .kx-gate .child h2{font-size:24px;overflow-wrap:break-word}
}
/* Story game (#/jeu/histoire) at 320px: long words wrap, nothing scrolls sideways. */
.kx-story,.kx-story .kx-page2,.kx-story .kx-say,.kx-answers .kx-ans span,.kx-storyc,.kx-storyc>span{min-width:0;max-width:100%;overflow-wrap:anywhere}
.kx-covers{grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr))}
@media (max-width:360px){.kx-answers .kx-ans.wide{min-width:0;max-width:100%;flex-wrap:wrap}}
