/* Kalkil — "Écrire / Writing" (ecrire.js). Reuses the little ones' building blocks (petits.css: .ptop .pbtn .ptile .pwin …). */
#ecrire{background:linear-gradient(180deg,#eefbf3 0%,#fff9e6 55%,#eef6ff 100%);position:relative;overflow:hidden}
body:has(#ecrire.active){background-attachment:fixed;background:linear-gradient(180deg,#eefbf3 0%,#fff9e6 55%,#eef6ff 100%)}
#ecrire .ptitle{-webkit-text-stroke:2px #1e9152;text-shadow:0 4px 0 #5fe39a}
#ecrire .pbtn{color:#1e9152;box-shadow:0 5px 0 rgba(30,145,82,.22),0 8px 14px rgba(32,51,77,.12)}
#ecrire .pbtn.icon{border-radius:50%;font-size:0}
#ecrire .psay{background:#2bb35e;color:#fff;box-shadow:0 5px 0 #1e9152,0 8px 14px rgba(32,51,77,.15)}
#ecrire .pq{color:#175935;margin:4px 0 0;font-size:19px;min-height:24px}
.et-lines{background:#fff6e6;--edge:#ffd099}.et-letters{background:#eef5ff;--edge:#bcd6fb}.et-numbers{background:#effbf3;--edge:#b8e8c8}.et-words{background:#fff0f6;--edge:#ffc2dc}
.ecart{display:flex;align-items:center;justify-content:center;gap:6px;height:100%;font-family:ui-rounded,Nunito,"Arial Rounded MT Bold",Arial,sans-serif}
.ecart b{font-size:52px;line-height:1;font-weight:900;color:#2bb35e;-webkit-text-stroke:1px #fff}
.ecart b.ec-c1{color:#ff6f61}.ecart b.ec-c2{color:#2f80ed}.ecart b.ec-c3{color:#ff9419}.ecart b.sm{font-size:36px}
.ecart i{font-style:normal;font-size:42px;line-height:1}
#ecrire .ptile{min-height:164px}
@media (min-height:760px){#ecrire .ptile{min-height:196px}#ecrire .ptile .part{height:106px}}

/* Tile inside Les petits menu */
.pt-ecrire{grid-column:1/-1;background:#effbf3;--edge:#a8e6bf;flex-direction:row;justify-content:center;min-height:74px;padding:8px 12px;gap:14px}
.pt-ecrire .part{width:80px;height:56px;flex:none;display:grid;place-items:center;font-size:44px}
.pt-ecrire .pname{font-size:19px}

/* Play area */
.echead{display:flex;flex-direction:column;align-items:center;gap:6px}
.ecsteps{display:flex;gap:6px;flex-wrap:wrap;justify-content:center}
.ecst{font-size:12.5px;font-weight:900;padding:4px 10px;border-radius:999px;background:rgba(255,255,255,.7);color:#5b6b7d;box-shadow:0 2px 0 rgba(32,51,77,.08)}
.ecst.on{background:#2bb35e;color:#fff;box-shadow:0 3px 0 #1e9152}
.ecst.done{background:#c9f2d6;color:#175935}

.ecbar{display:flex;justify-content:center;align-items:center;min-height:0}
.ecbadge{display:inline-flex;align-items:center;gap:12px;background:#fff;border:0;border-radius:22px;padding:6px 16px;box-shadow:0 5px 0 #d5e8dc,0 8px 14px rgba(32,51,77,.1);cursor:pointer;font-family:ui-rounded,Nunito,"Arial Rounded MT Bold",Arial,sans-serif}
.ecbadge:active{transform:translateY(3px);box-shadow:0 2px 0 #d5e8dc}
.ecchar{font-size:42px;font-weight:900;line-height:1;color:#20334d}
.ecemo{font-style:normal;font-size:38px;line-height:1}
.ecqty{display:flex;flex-wrap:wrap;gap:4px;max-width:190px;justify-content:center}
.ecqty i{font-style:normal;font-size:24px;line-height:1}
.eczero{font-size:28px;color:#95a5b8;font-weight:900}

/* Word slots & scrambled letter tiles */
.ecwbadge{padding:8px 16px}
.ecwslots{display:flex;gap:6px}
.ecwslot{min-width:36px;height:44px;padding:0 6px;border-radius:12px;background:#f2f7fa;border:2.5px dashed #b8cce0;display:grid;place-items:center;font-size:28px;font-weight:900;color:#20334d;font-family:ui-rounded,Nunito,"Arial Rounded MT Bold",Arial,sans-serif}
.ecwslot.cur{border-color:#2bb35e;border-style:solid;background:#effbf3;box-shadow:0 0 0 3px rgba(43,179,94,.22)}
.ecwslot.done{border-color:#8fd6a8;border-style:solid;background:#c9f2d6;color:#126b35}

.ecstage{flex:1;display:flex;align-items:center;justify-content:center;min-height:0;width:100%;padding:4px 0}
.eccv{width:100%;max-width:360px;max-height:360px;aspect-ratio:1/1;background:#fff;border-radius:30px;box-shadow:0 8px 0 #d5e8dc,0 14px 24px rgba(32,51,77,.12);touch-action:none;user-select:none;-webkit-user-select:none}
.ecdot{animation:ecPulse 1.1s ease-in-out infinite;transform-origin:center}
@keyframes ecPulse{50%{transform:scale(1.18)}}
.ecadv{pointer-events:none;user-select:none}

.ectiles{display:flex;flex-wrap:wrap;justify-content:center;align-content:center;gap:14px;max-width:360px;padding:12px}
.ectile{width:78px;height:84px;border-radius:22px;border:0;background:#fff;font-family:ui-rounded,Nunito,"Arial Rounded MT Bold",Arial,sans-serif;font-size:44px;font-weight:900;color:#20334d;box-shadow:0 6px 0 #d5e8dc,0 10px 18px rgba(32,51,77,.12);cursor:pointer;transition:transform .12s,opacity .2s}
.ectile:active{transform:translateY(4px);box-shadow:0 2px 0 #d5e8dc}
.ectile.used{opacity:.25;pointer-events:none;transform:scale(.9)}
.ectile.wob{animation:pwob .5s ease}

/* Free-writing tools (Erase & Validate) */
.ectools{display:flex;justify-content:center;gap:14px;padding:4px 0 8px}
.ecbtn{display:inline-flex;align-items:center;gap:8px;padding:10px 20px;border-radius:999px;border:0;background:#fff;color:#20334d;font:inherit;font-weight:900;font-size:17px;box-shadow:0 5px 0 #d5e8dc,0 8px 14px rgba(32,51,77,.12);cursor:pointer}
.ecbtn svg{width:22px;height:22px}
.ecbtn:active{transform:translateY(3px);box-shadow:0 2px 0 #d5e8dc}
.ecbtn.go{background:#2bb35e;color:#fff;box-shadow:0 5px 0 #1e9152,0 8px 14px rgba(32,51,77,.15)}

@media (max-height:700px){
  .eccv{max-width:265px;max-height:265px;border-radius:24px}
  .ecchar{font-size:32px}.ecemo{font-size:30px}
  .ecbadge{padding:4px 12px;border-radius:18px}
  #ecrire .ptile{min-height:130px}
}
@media (prefers-reduced-motion:reduce){.ecdot{animation:none}}
#ecrire,#ecrire button{touch-action:manipulation;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}
