/* Petits Génies — style enfant : gros boutons, couleurs vives, lisible */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: #FFF8EC; color: #2B2A33; font-size: 20px;
  user-select: none; -webkit-user-select: none; overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: none; cursor: pointer; touch-action: manipulation; background: none; }
h1, h2 { margin: 0; }
.screen {
  max-width: 920px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.big-btn {
  background: var(--c, #FFC15E); border-radius: 22px; padding: 16px 28px; min-height: 64px;
  font-size: 1.3rem; font-weight: 800; box-shadow: 0 5px 0 rgba(0,0,0,.18); align-self: center;
}
.big-btn.alt { background: #fff; }
.big-btn:active, .tile:active, .choice:active, .keypad button:active, .profile-card:active, .challenge:active, .album-btn:active {
  transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.15);
}
.icon-btn { width: 56px; height: 56px; border-radius: 18px; background: #fff; font-size: 1.5rem; box-shadow: 0 3px 0 rgba(0,0,0,.12); flex: none; }
.link-btn { font-size: 1rem; color: #6B6880; text-decoration: underline; padding: 12px; align-self: center; }

/* Accueil */
.title { text-align: center; font-size: 2.2rem; margin-top: 8px; }
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; flex: 1; align-content: center; }
.profile-card {
  background: var(--c); border-radius: 30px; padding: 26px 16px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; box-shadow: 0 6px 0 rgba(0,0,0,.16);
}
.avatar {
  font-size: 4.2rem; line-height: 1; background: rgba(255,255,255,.6); border-radius: 50%;
  width: 1.45em; height: 1.45em; display: flex; align-items: center; justify-content: center; flex: none;
}
.avatar.sm { font-size: 2rem; }
.avatar.big { font-size: 5rem; align-self: center; background: var(--c); }
.pname { font-size: 1.7rem; font-weight: 900; }
.pmeta { font-size: 1rem; font-weight: 700; opacity: .85; }
.parent-btn { align-self: flex-end; background: #EDE6D6; border-radius: 16px; padding: 12px 18px; font-size: 1rem; min-height: 52px; }
.empty { text-align: center; }

/* Code parent */
.pin { align-items: center; justify-content: center; }
.pin h2 { text-align: center; font-size: 1.4rem; }
.pin-dots { display: flex; gap: 18px; }
.pin-dots span { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #2B2A33; }
.pin-dots span.on { background: #2B2A33; }
.pin-msg { color: #B5541B; min-height: 1.4em; margin: 0; font-size: 1rem; text-align: center; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Pavé numérique */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 380px; align-self: center; }
.keypad button { background: #fff; border-radius: 18px; min-height: 66px; font-size: 1.9rem; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.keypad button.ok { background: #7ED6A0; }

/* Carte enfant */
.kid-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--c); border-radius: 26px; padding: 12px; }
.kid-name { font-size: 1.6rem; font-weight: 900; flex: 1; min-width: 80px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: rgba(255,255,255,.75); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 1rem; white-space: nowrap; }
.challenge, .album-btn {
  display: flex; align-items: center; gap: 16px; text-align: left; background: #fff; border-radius: 24px;
  padding: 14px 18px; min-height: 76px; box-shadow: 0 5px 0 rgba(0,0,0,.1); border: 3px dashed #FFB13B;
}
.challenge.done { border-style: solid; border-color: #7ED6A0; opacity: .8; }
.ch-icon, .album-icon { font-size: 2.4rem; }
.challenge small, .album-btn small { color: #6B6880; font-size: .95rem; }
.album-btn { border: 3px solid #FFD1EC; }
.bar { display: block; width: 220px; max-width: 50vw; height: 12px; background: #F1ECE0; border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.bar span { display: block; height: 100%; background: #FFB13B; border-radius: 99px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tile {
  background: var(--t); border-radius: 28px; padding: 22px 16px; min-height: 170px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; box-shadow: 0 6px 0 rgba(0,0,0,.15);
}
.tile-icon { font-size: 3.4rem; line-height: 1; }
.tile-name { font-size: 1.5rem; font-weight: 900; }
.tile-level { font-weight: 800; font-size: 1rem; }
.lvl-dots { display: flex; gap: 6px; }
.lvl-dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.55); }
.lvl-dots i.on { background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.15) inset; }

/* Choix de l'avatar */
.avatar-pick h2 { text-align: center; font-size: 1.3rem; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 10px; }
.pick { font-size: 2.4rem; background: #fff; border-radius: 18px; min-height: 70px; border: 4px solid transparent; }
.pick.color { min-height: 60px; }
.pick.sel { border-color: #2B2A33; }
.pick-grid.small { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
.pick-grid.small .pick { font-size: 1.7rem; min-height: 52px; }

/* Exercice */
.session { gap: 14px; }
.sess-top { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 18px; background: #fff; border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 0 rgba(0,0,0,.06); }
.progress div { height: 100%; background: var(--c); border-radius: 99px; transition: width .4s; }
.challenge-tag { align-self: center; background: #FFE7B8; border-radius: 99px; padding: 6px 16px; font-weight: 800; font-size: 1rem; }
.prompt { background: #fff; border-radius: 28px; padding: 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: 0 5px 0 rgba(0,0,0,.07); }
.q-text { font-size: 1.45rem; font-weight: 800; margin: 0; }
.calc { font-size: clamp(2.4rem, 9vw, 3.6rem); font-weight: 900; margin: 6px 0; }
.word { font-size: clamp(2.2rem, 8vw, 3.2rem); font-weight: 900; letter-spacing: 2px; margin: 0; }
.conj { font-size: 2.2rem; font-weight: 800; margin: 0; }
.gap { display: inline-block; min-width: 1.6em; padding: 0 .2em; border-radius: 12px; background: #FFF1C9; border-bottom: 4px dashed #FFB13B; color: #C98A10; }
.big-emoji { font-size: 5rem; line-height: 1.1; }
.say-big { font-size: 2.6rem; background: var(--c); width: 84px; height: 84px; border-radius: 50%; box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.count-grid { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.count-row { display: flex; gap: 8px; font-size: clamp(2rem, 7vw, 2.8rem); line-height: 1.1; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.choices.n2, .choices.n4 { grid-template-columns: 1fr 1fr; }
.choices.n3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 700px) { .choices.n4 { grid-template-columns: repeat(4, 1fr); } .choices.txt.n4 { grid-template-columns: 1fr 1fr; } }
.choice {
  background: #fff; border-radius: 24px; min-height: 96px; font-size: 2.6rem; font-weight: 900;
  border: 5px solid transparent; box-shadow: 0 5px 0 rgba(0,0,0,.12); transition: opacity .2s;
}
.choices.txt .choice { font-size: 1.6rem; min-height: 80px; }
.choice.good, .answer-box.good { background: #C9F2D6; border-color: #3DB46D; animation: pop .35s; }
.choice.tried { opacity: .35; }
@keyframes pop { 50% { transform: scale(1.08); } }
.answer-box { align-self: center; min-width: 180px; background: #fff; border-radius: 20px; padding: 8px 24px; font-size: 2.6rem; font-weight: 900; text-align: center; border: 5px solid var(--c); }
.feedback { display: flex; flex-direction: column; gap: 12px; min-height: 60px; }
.fb { border-radius: 20px; padding: 14px 18px; font-size: 1.2rem; font-weight: 700; text-align: center; animation: pop .3s; }
.fb.ok { background: #C9F2D6; font-size: 1.6rem; }
.fb.hint { background: #FFF1C9; }
.fb.explain { background: #DDEBFF; }
.burst-star { position: fixed; left: 50%; top: 45%; font-size: 2rem; pointer-events: none; z-index: 50; animation: fly .9s ease-out forwards; }
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) scale(1.5) rotate(180deg); opacity: 0; } }

/* Nouveaux contenus */
.choices.shapes .choice { min-height: 110px; padding: 10px; }
.shape { width: 78px; height: 78px; }
.seq-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; font-size: clamp(2rem, 7vw, 2.8rem); }
.clock { width: min(230px, 60vw); height: auto; }
.legend { margin: 0; font-size: .9rem; color: #6B6880; }
.legend .hr { color: #C62828; font-weight: 800; }
.legend .mn { color: #1565C0; font-weight: 800; }
.money-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.bill { width: 108px; height: auto; }
.coin { width: 58px; height: 58px; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 .1em; }
.frac > span:last-child { border-top: 4px solid currentColor; padding-top: 2px; min-width: 1.2em; text-align: center; }
.choice .frac { font-size: 2rem; }
.fbar { width: min(320px, 80vw); height: auto; }
.word.en { color: #1565C0; }
.word.phrase { font-size: clamp(1.6rem, 6vw, 2.2rem); letter-spacing: 0; }
.probleme { font-size: 1.3rem; font-weight: 700; line-height: 1.5; margin: 0; text-align: left; }
.order-items { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: flex-end; }
.order-item { position: relative; background: #fff; border-radius: 22px; min-width: 96px; min-height: 120px; line-height: 1; padding: 10px; box-shadow: 0 5px 0 rgba(0,0,0,.12); border: 5px solid transparent; display: flex; align-items: center; justify-content: center; }
.order-item.picked { border-color: #3DB46D; background: #E9FAEF; }
.ord-n { position: absolute; top: -12px; left: -12px; width: 36px; height: 36px; border-radius: 50%; background: #3DB46D; color: #fff; font-weight: 900; font-size: 1.1rem; display: none; align-items: center; justify-content: center; }
.order-item.picked .ord-n { display: flex; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mcol { display: flex; flex-direction: column; gap: 10px; }
.mitem { background: #fff; border-radius: 18px; min-height: 70px; font-size: 1.4rem; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.12); border: 5px solid transparent; padding: 6px; }
.m-emo { font-size: 2.4rem; }
.mitem.sel { border-color: #FFB13B; background: #FFF4DC; }
.mitem.done { box-shadow: none; }
.mitem.pair-0 { background: #DDEBFF; border-color: #64B5F6; }
.mitem.pair-1 { background: #E9FAEF; border-color: #3DB46D; }
.mitem.pair-2 { background: #FFE6EF; border-color: #F06292; }
.mitem.pair-3 { background: #F1E6FF; border-color: #AB7BE8; }

/* Fin de session / temps écoulé */
.end, .timeup { align-items: center; justify-content: center; text-align: center; }
.end h1, .timeup h1 { font-size: 2rem; }
.trophy { font-size: 6rem; animation: bounce 1.2s infinite; }
@keyframes bounce { 50% { transform: translateY(-14px); } }
.end-stars { font-size: 2.4rem; font-weight: 900; margin: 0; }
.lvl-up { background: #DDEBFF; border-radius: 18px; padding: 10px 18px; font-weight: 800; }
.new-sticker p { font-weight: 900; font-size: 1.3rem; margin: 0 0 8px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Autocollants */
.album-title { flex: 1; text-align: center; font-size: 1.6rem; }
.album h2 { font-size: 1.3rem; }
.album h2 small { color: #6B6880; font-size: 1rem; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.sticker-btn { padding: 0; }
.sticker {
  background: var(--c); border-radius: 24px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center;
  gap: 4px; border: 4px solid #fff; box-shadow: 0 4px 0 rgba(0,0,0,.12); transform: rotate(var(--r, 0deg)); min-height: 130px; justify-content: center;
}
.sticker img { width: 84px; height: 84px; object-fit: cover; border-radius: 16px; }
.st-emo { font-size: 3.2rem; line-height: 1.1; }
.st-name { font-size: .85rem; font-weight: 800; text-align: center; }
.sticker.locked { background: #EEE8DC; border-style: dashed; border-color: #D5CDBB; box-shadow: none; }
.sticker.locked .st-emo { color: #B9B09C; font-weight: 900; }
.sticker.big { transform: scale(1.3) rotate(var(--r)); margin: 24px auto; width: 150px; animation: pop .6s; }

/* Espace parent : plus sobre */
.parent { font-size: 16px; gap: 14px; }
.par-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.par-top h1 { font-size: 1.5rem; }
.pcard { background: #fff; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; border-left: 8px solid var(--c, #ddd); }
.pcard h2 { font-size: 1.15rem; }
.pc-head { display: flex; align-items: center; gap: 12px; }
.pc-id { flex: 1; }
.pc-time { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stats { width: 100%; border-collapse: collapse; font-size: 15px; }
.stats th, .stats td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #EEE8DC; }
.stats th { color: #6B6880; font-weight: 700; }
.to-review, .pc-meta, .note { margin: 0; font-size: 14px; color: #55526A; }
.small-btn { background: #F3EEE3; border-radius: 12px; padding: 10px 14px; min-height: 44px; font-size: 15px; font-weight: 700; }
.small-btn.primary { background: #7ED6A0; }
.small-btn.danger { background: #FFD9D2; color: #9A2A16; }
.settings .small-btn { align-self: flex-start; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.form input, .form select { font: inherit; padding: 10px; border-radius: 10px; border: 1px solid #D9D2C3; background: #FFFDF8; user-select: text; -webkit-user-select: text; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }
.err { color: #B5541B; margin: 0; min-height: 1em; }
.st-prev { width: 120px; height: 120px; object-fit: cover; border-radius: 16px; }
.custom-item { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #2B2A33; color: #fff; padding: 12px 20px; border-radius: 14px; font-size: 16px; z-index: 100; animation: pop .3s; max-width: 90vw; text-align: center; }

@media (max-width: 480px) {
  body { font-size: 18px; }
  .tile { min-height: 140px; }
  .choice { min-height: 84px; font-size: 2.2rem; }
  .kid-name { font-size: 1.3rem; }
}
