:root{
  --bg:#fff8ec; --ink:#3b2f2a; --muted:#8a7a70; --card:#ffffff;
  --pink:#ff7aa8; --blue:#4aa3ff; --green:#3cc47c; --orange:#ffa53b; --violet:#9b7bff; --teal:#22c3b5; --grey:#a9a29c;
  --ok:#2fb36a; --ko:#ff6b5a;
  font-size:18px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--bg);color:var(--ink);
  font-family:"Andika","Comic Neue","Comic Sans MS","Chalkboard SE",system-ui,sans-serif}
body{min-height:100vh;user-select:none}
button{font:inherit;color:inherit;cursor:pointer}

header{display:flex;align-items:center;gap:12px;padding:10px 16px;background:#fff;box-shadow:0 2px 0 #f1e2cc;position:sticky;top:0;z-index:5}
header h1{flex:1;margin:0;font-size:1.4rem}
#stars{font-size:1.3rem;font-weight:bold;background:#fff3c4;border-radius:99px;padding:4px 14px}
#stars.pop{animation:pop .5s}
.icon-btn{border:none;background:#f6ecdf;border-radius:14px;font-size:1.5rem;width:52px;height:52px}
main{max-width:980px;margin:0 auto;padding:16px}
.screen{display:none}.screen.active{display:block}
.hello{font-size:1.4rem;text-align:center;margin:6px 0 16px}
h2{text-align:center}
.muted{color:var(--muted);text-align:center}

.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px}
.cards.small{margin-top:14px}
.card{border:none;border-radius:24px;padding:18px 10px;color:#fff;display:flex;flex-direction:column;align-items:center;gap:4px;
  box-shadow:0 6px 0 rgba(0,0,0,.15);transition:transform .1s}
.card:active{transform:translateY(4px);box-shadow:0 2px 0 rgba(0,0,0,.15)}
.card .emo{font-size:3rem}.card b{font-size:1.3rem}.card small{opacity:.95}
.c1{background:var(--orange)}.c2{background:var(--blue)}.c3{background:var(--pink)}.c4{background:var(--violet)}
.c5{background:var(--green)}.c6{background:var(--teal)}.c7{background:var(--grey)}

.game-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.levels{display:flex;gap:6px;flex-wrap:wrap}
.lvl{border:2px solid #e6d5bf;background:#fff;border-radius:99px;padding:6px 14px;font-weight:bold}
.lvl.on{background:var(--ink);color:#fff;border-color:var(--ink)}

.qcard{background:var(--card);border-radius:24px;padding:18px;box-shadow:0 4px 0 #f1e2cc;text-align:center;margin-bottom:14px}
.qtext{font-size:1.45rem;line-height:1.5;margin:0 0 10px}
.qtext b{color:#d4572a}
.big-emo{font-size:3.4rem;line-height:1.1}
.price-tag{display:inline-block;background:#fff3c4;border:3px dashed #e8b923;border-radius:14px;padding:4px 16px;font-size:1.6rem;font-weight:bold;margin:4px}

/* Argent */
.money-row{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:10px;min-height:70px}
.m{display:inline-flex;align-items:center;justify-content:center;font-weight:bold;position:relative;flex:none}
.coin{border-radius:50%;color:#4a3410;box-shadow:inset 0 0 0 3px rgba(0,0,0,.12),0 3px 0 rgba(0,0,0,.25);font-size:1rem}
.coin small{font-size:.65em;margin-left:1px}
.v1,.v2,.v5{background:radial-gradient(circle at 35% 30%,#f2b38a,#b8693c 70%);color:#4b2410}
.v1{width:38px;height:38px;font-size:.8rem}.v2{width:42px;height:42px;font-size:.85rem}.v5{width:46px;height:46px;font-size:.9rem}
.v10,.v20,.v50{background:radial-gradient(circle at 35% 30%,#fff1a8,#d4a72c 70%)}
.v10{width:46px;height:46px}.v20{width:50px;height:50px}.v50{width:54px;height:54px}
.v100{width:56px;height:56px;background:radial-gradient(circle,#e9ecef 0 48%,#d4a72c 50% 100%);font-size:1.15rem}
.v200{width:62px;height:62px;background:radial-gradient(circle,#f3cf55 0 48%,#d8dce0 50% 100%);font-size:1.25rem}
.bill{width:104px;height:56px;border-radius:8px;color:#fff;font-size:1.35rem;text-shadow:0 1px 2px rgba(0,0,0,.35);
  box-shadow:0 3px 0 rgba(0,0,0,.25);border:3px solid rgba(255,255,255,.55)}
.bill::before{content:"";position:absolute;left:8px;top:8px;width:20px;height:20px;border-radius:50%;background:rgba(255,255,255,.3)}
.v500{background:linear-gradient(135deg,#a7adb3,#7c838a)}
.v1000{background:linear-gradient(135deg,#e8726b,#c0413a);width:110px}
.v2000{background:linear-gradient(135deg,#6b9be8,#3c63c0);width:116px}
.v5000{background:linear-gradient(135deg,#ffaa5c,#e07a1f);width:122px;height:60px}
.v10000{background:linear-gradient(135deg,#66c97a,#2e9447);width:128px;height:62px}
.tap{cursor:pointer;transition:transform .08s}.tap:active{transform:scale(.9)}
.m .run{position:absolute;bottom:-24px;left:50%;transform:translateX(-50%);font-size:.85rem;color:#d4572a;text-shadow:none;white-space:nowrap}
.money-row.with-run{padding-bottom:26px}

.counter{background:#fbe9cf;border:3px dashed #e6c99c;border-radius:20px;min-height:110px;padding:14px;display:flex;flex-wrap:wrap;gap:10px;justify-content:center;align-items:center;margin-bottom:10px}
.counter .empty{color:var(--muted)}
.counter .m{cursor:pointer;animation:drop .2s}
.counter.cols{align-items:flex-start}
.col{display:flex;flex-direction:column;align-items:center;gap:6px;min-width:120px;background:rgba(255,255,255,.5);border-radius:14px;padding:8px}
.col h4{margin:0;font-size:.95rem}
.col .stack{display:flex;flex-wrap:wrap;gap:4px;justify-content:center;max-width:280px}
.tray{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;align-items:center;background:#fff;border-radius:20px;padding:12px;box-shadow:0 4px 0 #f1e2cc}
.status{text-align:center;font-size:1.25rem;margin:8px 0;min-height:1.6em}
.countup{font-size:1.25rem;text-align:center;margin:6px 0;color:#5a4b8a}
.countup .goal{color:var(--ok);font-weight:bold}

.actions{display:flex;gap:12px;justify-content:center;margin-top:14px;flex-wrap:wrap}
.btn{border:none;border-radius:18px;padding:14px 26px;font-size:1.3rem;font-weight:bold;color:#fff;background:var(--blue);box-shadow:0 5px 0 rgba(0,0,0,.18)}
.btn:active{transform:translateY(3px);box-shadow:0 2px 0 rgba(0,0,0,.18)}
.btn.ok{background:var(--ok)}.btn.alt{background:#c9b8a6}.btn.danger{background:var(--ko)}

/* Saisie */
.answer{display:flex;justify-content:center;align-items:center;gap:8px;font-size:1.8rem;margin:8px 0}
.field{min-width:110px;height:64px;border:3px solid #e6d5bf;border-radius:16px;background:#fff;display:flex;align-items:center;justify-content:center;font-size:2rem;font-weight:bold}
.field.small{min-width:80px}
.field.focus{border-color:var(--blue);box-shadow:0 0 0 4px rgba(74,163,255,.25)}
.keypad{display:grid;grid-template-columns:repeat(3,76px);gap:10px;justify-content:center;margin-top:10px}
.key{height:64px;border:none;border-radius:16px;background:#fff;font-size:1.7rem;font-weight:bold;box-shadow:0 4px 0 #e6d5bf}
.key:active{transform:translateY(3px);box-shadow:0 1px 0 #e6d5bf}
.key.go{background:var(--ok);color:#fff;box-shadow:0 4px 0 #1f8a4f}
.key.del{background:#ffe1dc}

/* Overlay */
.overlay{position:fixed;inset:0;background:rgba(59,47,42,.45);display:flex;align-items:center;justify-content:center;z-index:20;padding:16px}
.overlay.hidden{display:none}
.ov-card{background:#fff;border-radius:28px;padding:22px;max-width:520px;width:100%;text-align:center;animation:pop .3s}
.ov-card .big{font-size:4rem}
.ov-card p{font-size:1.3rem;margin:8px 0}
.ov-card .explain{background:#f6f0ff;border-radius:14px;padding:10px;font-size:1.15rem}

.album{display:grid;grid-template-columns:repeat(auto-fill,minmax(80px,1fr));gap:10px}
.sticker{aspect-ratio:1;border-radius:20px;background:#fff;display:flex;align-items:center;justify-content:center;font-size:2.8rem;box-shadow:0 4px 0 #f1e2cc}
.sticker.locked{background:#efe6da;color:#c4b5a3;font-size:2rem}

.row{display:flex;align-items:center;gap:10px;justify-content:center;margin:14px 0;font-size:1.2rem}
.row input[type=text],.row input:not([type]){font:inherit;padding:8px 12px;border-radius:12px;border:2px solid #e6d5bf}
.row input[type=checkbox]{width:26px;height:26px}

#confetti{position:fixed;inset:0;pointer-events:none;z-index:30;overflow:hidden}
.conf{position:absolute;top:-40px;font-size:2rem;animation:fall 1.6s ease-in forwards}
@keyframes fall{to{transform:translateY(110vh) rotate(540deg)}}
@keyframes pop{0%{transform:scale(.7)}60%{transform:scale(1.08)}100%{transform:scale(1)}}
@keyframes drop{from{transform:translateY(30px);opacity:0}}
@keyframes shake{25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}
.shake{animation:shake .3s 2}

@media (max-width:520px){
  :root{font-size:16px}
  .keypad{grid-template-columns:repeat(3,64px)}
  .bill{width:86px;height:48px;font-size:1.1rem}
}
