/* Kalkil — Soustraction posée (posee/posee.js). Light: no images, no web fonts. Big digits, big keys (cheap Android, portrait). */
.m-posee{background:linear-gradient(135deg,#3cc7d6,#1489a8);--edge:#0d6580}
.m-posee .sym svg{width:100%;height:100%}
/* the Soustraction posée tile is one more row in Calcul: still no scroll at 360×640 (measured) */
@media (max-width:600px) and (max-height:700px){#calcul .modes.modes.modes{gap:7px}#calcul .modes.modes .mode.mode:not(.wide){min-height:76px}#calcul .modes.modes .mode.mode.wide{min-height:49px;padding:5px 16px}}
#posee{background:linear-gradient(180deg,#fff4e6 0%,#e3f4ff 65%,#f3fbff 100%);position:relative;overflow-x:hidden}
body:has(#posee.active){background:linear-gradient(180deg,#fff4e6 0%,#e3f4ff 65%,#f3fbff 100%)}
#posee,#posee button{touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none}
#posee .gtop h2{margin:0;font-size:18px;font-weight:900;text-align:center;flex:1;color:#8a3a12}
.ps-start,.ps-game,.ps-end{display:flex;flex-direction:column;flex:1}
.ps-start{align-items:center;justify-content:center;gap:12px;text-align:center}
.ps-end{align-items:center;justify-content:center;gap:12px;text-align:center}
.ps-lead{font-weight:900;font-size:19px;color:#8a3a12;margin:0 12px;line-height:1.3}
.ps-lvls{display:flex;gap:10px;justify-content:center}
.ps-lvl{border:0;border-radius:999px;padding:12px 18px;font:inherit;font-weight:800;font-size:17px;background:#fff;color:#8a3a12;box-shadow:0 3px 0 #f1cfb4}
.ps-lvl.on{background:#e8613a;color:#fff;box-shadow:0 3px 0 #b5441f}
.ps-start .big,.ps-end .big{min-width:230px}
/* the little worked example on the start screen */
.ps-mini{display:grid;grid-template-columns:26px repeat(var(--n),44px);gap:2px 0;font-weight:900;font-size:28px;color:#1d2b3a;background:#fff;border-radius:16px;padding:8px 16px 6px;box-shadow:0 4px 0 #f1cfb4}
.ps-mini i{font-style:normal;text-align:center;position:relative;line-height:1.15}
.ps-mini i.ps-mans{border-top:3px solid #1d2b3a;color:#1f9e74}
.ps-mini .ps-sg{color:#1d2b3a}
.ps-mini .ps-ten{font-size:15px;margin:0 1px 0 0;vertical-align:top}.ps-mini .ps-ret{font-size:15px;left:0;bottom:2px}
/* the game */
.ps-prog{margin:2px 0 6px}
.ps-card{position:relative;background:#fff;border-radius:22px;padding:8px 8px 10px;box-shadow:0 4px 0 #f1cfb4;display:flex;justify-content:center}
.ps-say .ps-listen{position:static;flex:none;width:44px;height:44px;margin-top:4px}
.ps-grid{display:grid;grid-template-columns:36px repeat(var(--n),minmax(54px,68px));grid-auto-rows:auto;gap:0;margin:0 auto}
.ps-cell{position:relative;display:flex;align-items:center;justify-content:center;height:64px;font:inherit;font-weight:900;font-size:46px;line-height:1;color:#1d2b3a;background:transparent;border:0;padding:0;margin:0}
button.ps-cell{cursor:pointer;border-radius:14px}
.ps-cell b{font-weight:900}
.ps-cell.cur{background:#fff3c4}
.ps-top.cur{border-radius:14px 14px 0 0}.ps-ans.cur{border-radius:0 0 14px 14px}.ps-bot.cur{border-radius:0}
.ps-cell.past{color:#6b7c8f}
.ps-sgc{font-size:42px;color:#1d2b3a}
.ps-line{border-top:4px solid #1d2b3a;height:68px}
.ps-ans{color:#1f9e74}
.ps-ans.ask::after{content:'';position:absolute;left:22%;right:22%;bottom:10px;height:4px;border-radius:2px;background:#2f8fdd;animation:psBlink 1s infinite}
.ps-ans.bad{color:#ff5a4e;animation:psShake .4s}
.ps-ans.lead{color:#b9c4cf;transition:color .8s}.ps-ans.lead.gone{color:transparent}
/* the small 1s: on top the 1 before the digit (2 → 12), at the bottom the retenue next to the digit, like on paper */
.ps-ten{font-size:24px;font-weight:900;color:#e0453a;margin-right:1px;align-self:flex-start;margin-top:8px}
.ps-ret{position:absolute;left:3px;bottom:4px;font-size:22px;font-weight:900;color:#2f6fdd}
.ps-bot.ps-nob .ps-ret{position:static;font-size:26px}
.ps-ret.ghost{opacity:.5;border:2px dashed #2f6fdd;border-radius:6px;padding:0 3px;line-height:1.05}
.ps-bot.want{background:#e3f0ff;box-shadow:inset 0 0 0 3px #2f8fdd}
.ps-bot.ps-nob{min-width:54px}
.ps-ten.pop,.ps-ret.pop{animation:psPop .5s}
.ps-cell.pulse{animation:psPulse .9s ease-in-out 3}
.ps-say{display:flex;align-items:flex-start;gap:8px;margin:10px 2px 6px;min-height:64px}
.ps-fb{flex:1;margin:0;background:#fff;border-radius:16px;padding:9px 12px;font-weight:800;font-size:17px;line-height:1.35;color:#1d2b3a;box-shadow:0 3px 0 #dde8f0;animation:psIn .25s}
.ps-fb.hint{background:#fff6d6;box-shadow:0 3px 0 #f0d77a}
.ps-fb.good{background:#e4f8ec;box-shadow:0 3px 0 #9fdcb8}
.ps-fb.demo{background:#e8f1ff;box-shadow:0 3px 0 #b7cff2}
.ps-pad{margin-top:auto;padding-bottom:6px}
.ps-keys{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}
.ps-key{height:62px;border:0;border-radius:16px;font:inherit;font-weight:900;font-size:30px;background:#fff;color:#1d2b3a;box-shadow:0 4px 0 #c9d6e2}
.ps-key:active,.ps-key.hit{transform:translateY(3px);box-shadow:0 1px 0 #c9d6e2;background:#e3f0ff}
.ps-tools{display:flex;justify-content:center;margin-top:10px}
.ps-show{border:0;border-radius:999px;padding:11px 20px;font:inherit;font-weight:900;font-size:17px;background:#ffe9a8;color:#7a4b00;box-shadow:0 3px 0 #e6c25a;min-height:48px}
.ps-after{margin-top:auto;display:flex;flex-direction:column;align-items:center;gap:10px;padding-bottom:8px}
.ps-proof{margin:0;font-weight:800;font-size:17px;color:#1f6f53}
.ps-after .big{min-width:230px}
.ps-demobar{margin-top:auto;display:flex;justify-content:center;padding-bottom:8px}
.ps-game.demo .ps-pad .ps-keys{opacity:.55;pointer-events:none}.ps-game.demo .ps-tools{display:none}
.ps-game.demo .ps-board{pointer-events:none}
.ps-game.demo .ps-pad{margin-top:8px}
@keyframes psPop{0%{transform:scale(.2);opacity:0}60%{transform:scale(1.5)}100%{transform:scale(1);opacity:1}}
@keyframes psPulse{0%,100%{box-shadow:inset 0 0 0 0 rgba(47,143,221,0)}50%{box-shadow:inset 0 0 0 4px #ff9a4d;background:#ffe2c9}}
@keyframes psShake{0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}
@keyframes psBlink{50%{opacity:0}}
@keyframes psIn{from{transform:translateY(4px);opacity:.4}to{transform:none;opacity:1}}

/* Koko's moods on the posée screen (Nov 13): the same dance / hmm accents as the Problèmes screen, plus a gentle bob while he speaks (the mood wins the beat, then the bob resumes) */
#posee .ps-say .pb-koko.talk{animation:psTalk .45s ease-in-out infinite}
#posee .ps-say .pb-koko.dance{animation:pbDance .9s ease-in-out}
#posee .ps-say .pb-koko.hmm{animation:pbHmm .9s ease-in-out}
@keyframes psTalk{0%,100%{transform:translateY(0) rotate(-3deg)}50%{transform:translateY(-3px) rotate(3deg)}}
@media (prefers-reduced-motion:reduce){#posee .ps-say .pb-koko.talk,#posee .ps-say .pb-koko.dance,#posee .ps-say .pb-koko.hmm{animation:none}}
@media (min-height:760px){.ps-cell{height:76px;font-size:56px}.ps-line{height:80px}.ps-grid{grid-template-columns:40px repeat(var(--n),minmax(60px,76px))}.ps-ten{font-size:28px}.ps-ret{font-size:25px}.ps-key{height:66px}}
@media (max-height:700px){.ps-cell{height:56px;font-size:40px}.ps-line{height:60px}.ps-key{height:54px;font-size:26px}.ps-fb{font-size:16px}.ps-say{min-height:56px;margin:6px 2px 4px}}
@media (max-width:360px){.ps-grid{grid-template-columns:30px repeat(var(--n),minmax(50px,62px))}}
@media (prefers-reduced-motion:reduce){.ps-cell.pulse,.ps-ten.pop,.ps-ret.pop,.ps-ans.ask::after{animation:none}}

/* 4 and 5 chiffres (her homework size): 5 columns must fit a 360 px phone; the digits shrink a little, the cells stay big to tap */
.ps-lvls{flex-wrap:wrap}
.ps-lvls .ps-lvl{flex:0 0 calc(50% - 5px);max-width:170px;padding:12px 8px}
.ps-grid[style*="--n:5"]{grid-template-columns:26px repeat(5,minmax(0,64px));width:100%;max-width:346px}
.ps-grid[style*="--n:5"] .ps-cell{font-size:42px;height:62px}
.ps-grid[style*="--n:5"] .ps-ten{font-size:21px;margin-top:9px}
.ps-grid[style*="--n:5"] .ps-ret{font-size:19px;left:2px}
.ps-grid[style*="--n:5"] .ps-bot.ps-nob .ps-ret{font-size:24px}
.ps-grid[style*="--n:4"]{grid-template-columns:30px repeat(4,minmax(0,70px));width:100%;max-width:340px}
@media (min-height:760px){.ps-grid[style*="--n:5"] .ps-cell{height:72px;font-size:46px}}
@media (max-height:700px){.ps-grid[style*="--n:5"] .ps-cell{height:54px;font-size:38px}}

/* ===== Addition posée (posee/add-engine.js): same screen, data-op="add" ===== */
/* the two posée tiles share one row in Calcul (no extra height: still no scroll at 360×640) */
.ps-pair{grid-column:span 2;display:grid;grid-template-columns:1fr 1fr;gap:inherit;min-width:0}
.ps-pair:has(> .kf-off){grid-template-columns:1fr}
.ps-pair .mode.wide{grid-column:auto;min-width:0;gap:7px;padding:6px 8px 6px 10px}
.ps-pair .mode.wide .sym{width:38px;height:38px;flex:none}
.ps-pair .wtxt{min-width:0}
.ps-pair .mode .mname{font-size:16px;line-height:1.08;margin-top:0;overflow-wrap:normal}
.ps-pair .mode .mlvl{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media (max-width:420px){.ps-pair .mode.wide{gap:5px}.ps-pair .mode.wide .sym{width:30px;height:30px}.ps-pair .mode .mname{font-size:15px}.ps-pair .mode .mlvl{display:none}}
@media (max-width:380px){.ps-pair .mode.wide .sym{width:26px;height:26px}.ps-pair .mode .mname{font-size:14px}}
#calcul .modes.modes .ps-pair .mode.mode.wide{padding:5px 6px 5px 8px}
.m-poseeadd{background:linear-gradient(135deg,#ffb347,#e8613a);--edge:#a8431f}
/* the retenue row on top: the small 1 written above the next column, tapped to place it (big enough to tap) */
.ps-addg .ps-car{height:44px;font-size:26px;border-radius:12px}
.ps-addg .ps-carrow{height:44px}
.ps-ret.ps-up{position:static;font-size:26px;color:#2f6fdd;line-height:1}
.ps-car.want{background:#e3f0ff;box-shadow:inset 0 0 0 3px #2f8fdd}
.ps-addg .ps-num{cursor:default}
.ps-addg .ps-cell.cur.ps-car{border-radius:14px 14px 0 0}.ps-addg .ps-cell.cur.ps-num{border-radius:0}
.ps-mini .ps-ret.ps-up{font-size:15px;color:#2f6fdd}
/* 3 numbers stacked: a little shorter so the keys still fit */
.ps-addg.ps-n3 .ps-cell:not(.ps-car):not(.ps-carrow){height:50px;font-size:38px}
@media (max-height:700px){.ps-grid.ps-addg.ps-n3 .ps-cell:not(.ps-car):not(.ps-carrow){height:44px;font-size:32px}.ps-grid.ps-addg.ps-n3 .ps-line{height:48px}}
/* 6 places (5 chiffres + a last retenue) must fit a 360 px phone */
.ps-grid.ps-addg[style*="--n:6"]{grid-template-columns:20px repeat(6,minmax(0,56px));width:100%;max-width:350px}
.ps-grid.ps-addg[style*="--n:6"] .ps-cell{font-size:38px}
.ps-grid.ps-addg[style*="--n:6"] .ps-cell.ps-car{font-size:22px}
@media (max-height:700px){.ps-addg .ps-car,.ps-addg .ps-carrow{height:40px}.ps-grid.ps-addg .ps-cell:not(.ps-car):not(.ps-carrow){height:50px;font-size:36px}.ps-grid.ps-addg .ps-line{height:54px}}

/* ===== Multiplication posée (posee/mul-engine.js): same screen, data-op="mul" ===== */
.m-poseemul{background:linear-gradient(135deg,#b07cf0,#6a46c9);--edge:#4b2f99}
/* the retenue row on top (the small retenue above the next digit of the top number), the top number, × the bottom number */
.ps-mulg .ps-car{height:44px;font-size:26px;border-radius:12px}
.ps-mulg .ps-carrow{height:44px}
.ps-mulg .ps-num{cursor:pointer}
.ps-mulg .ps-cell.cur.ps-num{border-radius:14px}
.ps-mulg .ps-mline.cur{border-radius:0 0 14px 14px}
.ps-mulg .ps-part{color:#2d6fb0}
/* the addition of the two lines: its small retenue written above the column, on line 1 */
.ps-ret.ps-sret{left:3px;top:2px;bottom:auto;font-size:20px;color:#2f6fdd}
.ps-mulg .ps-mline.want{background:#e3f0ff;box-shadow:inset 0 0 0 3px #2f8fdd}
button.ps-mline{cursor:pointer;border-radius:0}
/* × 2 chiffres: 6 rows (retenues, top, bottom, line 1, + line 2, the sum): shorter cells, the keys still fit at 360×640 */
.ps-mul2 .ps-car,.ps-mul2 .ps-carrow{height:36px}
.ps-grid.ps-mul2 .ps-cell:not(.ps-car):not(.ps-carrow){height:46px;font-size:34px}
.ps-grid.ps-mul2 .ps-line{height:50px}
@media (min-height:760px){.ps-grid.ps-mul2 .ps-cell:not(.ps-car):not(.ps-carrow){height:58px;font-size:42px}.ps-grid.ps-mul2 .ps-line{height:62px}.ps-mul2 .ps-car,.ps-mul2 .ps-carrow{height:42px}}
@media (max-height:700px){.ps-mulg .ps-car,.ps-mulg .ps-carrow{height:36px}.ps-grid.ps-mulg:not(.ps-mul2) .ps-cell:not(.ps-car):not(.ps-carrow){height:50px;font-size:36px}.ps-grid.ps-mulg:not(.ps-mul2) .ps-line{height:54px}
  .ps-mul2 .ps-car,.ps-mul2 .ps-carrow{height:30px}.ps-grid.ps-mul2 .ps-cell:not(.ps-car):not(.ps-carrow){height:40px;font-size:30px}.ps-grid.ps-mul2 .ps-line{height:43px}.ps-mul2 .ps-ret.ps-up{font-size:22px}.ps-mul2 .ps-ret.ps-sret{font-size:17px}}
/* 6 places (5 chiffres × 1 with a last retenue) must fit a 360 px phone */
.ps-grid.ps-mulg[style*="--n:6"]{grid-template-columns:20px repeat(6,minmax(0,56px));width:100%;max-width:350px}
.ps-grid.ps-mulg[style*="--n:6"] .ps-cell{font-size:38px}
.ps-grid.ps-mulg[style*="--n:6"] .ps-cell.ps-car{font-size:22px}
/* five levels: the last one on its own row */
.ps-lvls.ps-lvl5 .ps-lvl:last-child{flex-basis:calc(100% - 5px);max-width:350px}
@media (max-width:380px){#calcul .modes.modes .ps-pair .m-poseemul .mname{font-size:13px;letter-spacing:-.3px}}
@media (max-width:350px){#calcul .modes.modes .ps-pair .m-poseemul .mname{font-size:12px}}
/* five levels on a short phone: no big Koko on the start screen, smaller pills, so « Jouer » and « Montre-moi » still fit at 360×640 */
@media (max-height:760px){#posee[data-op="mul"] .ps-start > .pb-koko{display:none}#posee[data-op="mul"] .ps-lvls.ps-lvl5 .ps-lvl{padding:9px 6px}#posee[data-op="mul"] .ps-start{gap:10px}}

/* ===== Division posée (posee/div-engine.js): same screen, data-op="div" — the potence ===== */
.m-poseediv{background:linear-gradient(135deg,#ff8fb8,#d6336c);--edge:#9c1f4c}
#posee:not([data-op="div"]) #psDown{display:none}
.ps-show.ps-down{background:#d6ecff;color:#0d4f8c;box-shadow:0 3px 0 #9cc6ee;margin-right:10px;min-width:140px}
#posee[data-op="div"] .ps-card{max-height:calc(100dvh - 318px);overflow:auto;padding:6px 6px 8px}
#posee[data-op="div"] .ps-board{display:flex;flex-direction:column;align-items:center}
.ps-divg{display:grid;grid-template-columns:repeat(var(--c),var(--cw));grid-template-rows:var(--rh0,var(--rh));grid-auto-rows:var(--rh);margin:0 auto}
.ps-divg .ps-cell.ps-dd,.ps-divg .ps-cell.dtop{height:var(--rh0,var(--rh))}
.ps-divg .ps-cell{height:var(--rh);font-size:var(--fs);border-radius:0}
.ps-divg .dr{color:#2d6fb0}
.ps-divg .dbar{border-left:4px solid #1d2b3a}
.ps-divg .dtop{border-bottom:4px solid #1d2b3a}
.ps-divg .ps-q{color:#1f9e74}
.ps-divg .ps-dl{border-bottom:3px solid #1d2b3a}
.ps-divg .ps-dsg{color:#1d2b3a;font-size:calc(var(--fs) * .8)}
.ps-divg .ps-dd{cursor:pointer;border-radius:10px 10px 0 0}
.ps-divg .ps-dd.pick{background:#eef6ff;box-shadow:inset 0 0 0 2px #b7d6f7}
.ps-divg .ps-dd.took{box-shadow:inset 0 -5px 0 #ff5a4e}
.ps-divg .ps-dd.used{color:#8a99a8}
.ps-divg .ps-dd.used::after{content:'\2193';position:absolute;right:0;bottom:-2px;font-size:calc(var(--fs) * .45);color:#2f8fdd}
.ps-divg .ps-dn{color:#2f6fdd}
.ps-divg .cur{background:#fff3c4}
.ps-divg .ask{background:#fff3c4}
.ps-divg .ask::after{content:'';position:absolute;left:20%;right:20%;bottom:4px;height:4px;border-radius:2px;background:#2f8fdd;animation:psBlink 1s infinite}
.ps-divg .bad{color:#ff5a4e;animation:psShake .4s}
.ps-divg .drest{color:#1f9e74;background:#e4f8ec}
.ps-drestl{margin:4px 0 0;text-align:center;font-weight:900;color:#1f9e74;font-size:18px}
.ps-mini.ps-minid{font-size:22px;gap:0}
.ps-mini.ps-minid i.dbar{border-left:3px solid #1d2b3a}
.ps-mini.ps-minid i.dtop{border-bottom:3px solid #1d2b3a}
.ps-mini.ps-minid i.dr{color:#2d6fb0}.ps-mini.ps-minid .ps-q{color:#1f9e74}
@media (max-height:760px){#posee[data-op="div"] .ps-start > .pb-koko{display:none}#posee[data-op="div"] .ps-lvls.ps-lvl5 .ps-lvl{padding:9px 6px}#posee[data-op="div"] .ps-start{gap:10px}}
@media (max-height:700px){#posee[data-op="div"] .ps-card{max-height:calc(100dvh - 354px)}#posee[data-op="div"] .ps-tools{margin-top:6px}#posee[data-op="div"] .ps-show{min-height:44px;padding:8px 16px}}
@media (prefers-reduced-motion:reduce){.ps-divg .ask::after{animation:none}}
/* the chooser (#poseeMenu): 4 big buttons, 2 × 2 */
.psm-modes{margin-top:8px}
.psm-modes .mode{min-height:132px}
.psm-modes .mode .sym{font-size:34px}
.psm-modes .mode .mlvl{font-size:13px}
#poseeMenu .mode.kf-off{display:none}
.m-poseeops{background:linear-gradient(135deg,#3cc7d6,#6a46c9);--edge:#3b2f99}
