/* P'tit Clic — de grosses touches colorées sur un bureau clair ; chaque jeu a sa couleur et sa propre scène. */
:root {
  --bg: #EEF2FA;
  --panel: #FFFFFF;
  --ink: #2B3A55;
  --muted: #68758C;
  --line: #DCE3EF;
  --accent: #7C5CFF;
  --accent-2: #5D40D9;
  --jaune: #FFD23F;
  --jaune-2: #E0AE1F;
  --vert: #3CC46A;
  --rouge: #FF5C5C;
  --police: 'Baloo 2', ui-rounded, 'Arial Rounded MT Bold', 'Comic Sans MS', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--police);
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 4px solid var(--jaune); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- Accueil ---------- */
#accueil { max-width: 1180px; margin: 0 auto; padding: 22px 20px 48px; display: grid; gap: 26px; }
.tete { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { width: 84px; height: 84px; flex: none; }
.tete-texte { flex: 1; min-width: 220px; }
.tete h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; font-weight: 700; }
.tete h1 b { font-weight: 800; color: var(--accent); }
.tete p { margin: 6px 0 0; font-size: 1.15rem; font-weight: 500; color: var(--muted); }
.marques { display: flex; align-items: center; gap: 14px; padding: 6px 16px; border-radius: 20px; background: #fff; box-shadow: inset 0 -4px 0 var(--line); }
.marques img { display: block; height: 64px; width: auto; }
.marques img + img { height: 88px; }
.total {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 18px 8px 50px; border-radius: 18px;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFD23F' stroke='%23E0AE1F' stroke-linejoin='round' d='M12 2l3 6.5 7 .9-5.2 4.8 1.4 7L12 17.8 5.8 21.2l1.4-7L2 9.4l7-.9z'/%3E%3C/svg%3E") 12px 50% / 30px no-repeat;
  box-shadow: inset 0 -4px 0 var(--line); font-weight: 800; font-size: 1.7rem; font-variant-numeric: tabular-nums;
}
.total .sur { font-size: 1.05rem; font-weight: 700; color: var(--muted); }
.reglages { display: flex; gap: 8px; flex-wrap: wrap; }
.rond {
  border: 0; border-radius: 16px; padding: 9px 16px 12px; background: var(--panel); font-weight: 700;
  box-shadow: inset 0 -4px 0 var(--line);
}
.rond:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--line); }
.rond[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: inset 0 -4px 0 var(--accent-2); }
.rond[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; }

.rayon h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 1.7rem; font-weight: 800; }
.rayon h2 svg { width: 44px; height: 44px; flex: none; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tuile {
  display: grid; justify-items: center; gap: 2px; padding: 16px 12px 22px; border-radius: 26px;
  background: var(--c); color: #fff; text-decoration: none; text-align: center;
  box-shadow: inset 0 -10px 0 var(--c2); transition: transform .12s;
}
.tuile:hover { transform: translateY(-4px); }
.tuile:active { transform: translateY(4px); box-shadow: inset 0 -4px 0 var(--c2); }
.tuile .ico { width: 96px; height: 96px; }
.tuile .ico svg, .carte-ico svg { width: 100%; height: 100%; display: block; }
.tuile b { font-size: 1.4rem; font-weight: 800; line-height: 1.1; }
.tuile small { font-size: 1rem; font-weight: 500; opacity: .92; }
.etoiles { display: flex; gap: 4px; margin-top: 6px; }
.et { width: 26px; height: 26px; fill: rgba(0, 0, 0, .22); }
.et.on { fill: var(--jaune); stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }

.grands { background: var(--panel); border-radius: 20px; padding: 6px 20px; color: var(--muted); font-weight: 500; }
.grands summary { cursor: pointer; padding: 10px 0; font-weight: 700; color: var(--ink); }
.grands-corps { max-width: 62ch; padding-bottom: 10px; }
.grands select { border: 2px solid var(--line); border-radius: 10px; padding: 4px 8px; background: var(--panel); }
.grands .rond { background: var(--bg); }

/* ---------- Écran de jeu ---------- */
#jeu { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; background: var(--c, var(--accent)); }
.barre { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: #fff; }
.carre {
  width: 54px; height: 54px; flex: none; border: 0; border-radius: 16px; padding: 10px;
  background: rgba(255, 255, 255, .22); color: #fff; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18);
}
.carre:active { transform: translateY(2px); }
.carre svg { width: 100%; height: 100%; display: block; }
.barre-titre { display: grid; line-height: 1.1; min-width: 0; }
.barre-titre b { font-size: 1.5rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-titre small { font-size: 1rem; font-weight: 500; opacity: .9; }
.progres { flex: 1; min-width: 60px; height: 22px; border-radius: 11px; background: rgba(0, 0, 0, .22); overflow: hidden; }
.progres i { display: block; height: 100%; width: 0; border-radius: 11px; background: var(--jaune); box-shadow: inset 0 -5px 0 var(--jaune-2); transition: width .3s; }
.compte { font-weight: 800; font-size: 1.3rem; min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }

.zone { position: relative; margin: 0 12px 12px; min-height: 0; }
#scene { position: absolute; inset: 0; border-radius: 24px; overflow: hidden; background: var(--panel); touch-action: none; }
.voile { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 14px; border-radius: 24px; background: rgba(43, 58, 85, .5); overflow: auto; }
.carte { width: min(560px, 100%); background: var(--panel); border-radius: 30px; padding: 22px 24px 26px; text-align: center; box-shadow: 0 10px 0 rgba(0, 0, 0, .18); animation: arrive .3s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes arrive { from { transform: scale(.8); opacity: 0; } }
.carte-ico { width: 110px; height: 110px; margin: 0 auto 6px; border-radius: 28px; padding: 8px; background: var(--c); box-shadow: inset 0 -8px 0 var(--c2); }
.carte h2 { margin: 0; font-size: 2rem; font-weight: 800; }
.carte p { margin: 6px 0 0; font-size: 1.25rem; font-weight: 500; text-wrap: balance; }
.carte .astuce { font-size: 1rem; color: var(--muted); margin-top: 12px; }
.niveaux, .choix { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.niv {
  width: 132px; border: 0; border-radius: 22px; padding: 8px 8px 16px; display: grid; justify-items: center;
  background: var(--bg); box-shadow: inset 0 -8px 0 var(--line); font-weight: 700;
}
.niv b { font-size: 2.6rem; line-height: 1; font-weight: 800; }
.niv .et { fill: var(--line); }
.niv.conseil { background: var(--c); color: #fff; box-shadow: inset 0 -8px 0 var(--c2); }
.niv.conseil .et:not(.on) { fill: rgba(0, 0, 0, .22); }
.niv:active, .gros:active { transform: translateY(4px); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.gros { border: 0; border-radius: 20px; padding: 12px 22px 18px; font-size: 1.3rem; font-weight: 800; background: var(--vert); color: #fff; box-shadow: inset 0 -7px 0 #2A9B50; }
.gros.clair { background: var(--bg); color: var(--ink); box-shadow: inset 0 -7px 0 var(--line); }
.grosse-etoile { width: 110px; height: 110px; fill: var(--jaune); stroke: var(--jaune-2); stroke-width: 1; stroke-linejoin: round; animation: tourne .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tourne { from { transform: scale(0) rotate(-180deg); } }
#confettis { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; }

.secoue { animation: secoue .35s; }
@keyframes secoue { 25% { translate: -7px 0; } 50% { translate: 7px 0; } 75% { translate: -4px 0; } }
.saute { animation: saute .5s; }
@keyframes saute { 40% { scale: 1.35; } }
.emoji { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; line-height: 1; }

/* ---------- Clavier à l'écran ---------- */
.kb { position: absolute; left: 50%; bottom: 10px; translate: -50% 0; display: grid; gap: 5px; justify-items: center; padding: 10px 12px; border-radius: 18px; background: rgba(43, 58, 85, .16); z-index: 5; }
.kb-rang { display: flex; gap: 5px; }
.kb-t { width: clamp(22px, 4.6vw, 44px); height: clamp(22px, 4.6vw, 44px); display: grid; place-items: center; border-radius: 9px; background: #fff; color: var(--ink); font-weight: 800; font-size: clamp(.8rem, 2vw, 1.3rem); box-shadow: inset 0 -4px 0 var(--line); }
.kb-t.espace { width: clamp(120px, 26vw, 260px); font-size: .9rem; }
.kb-t.vise { background: var(--jaune); box-shadow: inset 0 -4px 0 var(--jaune-2); animation: pulse .8s infinite alternate; }
.kb-t.bon { background: var(--vert); color: #fff; box-shadow: none; }
.kb-t.faux { background: var(--rouge); color: #fff; box-shadow: none; }
@keyframes pulse { to { scale: 1.22; } }

/* ---------- 1. La lampe magique ---------- */
#scene.sc-lampe { background: linear-gradient(#1B2B6B, #2F4A8C 60%, #1F6A4B 60%, #154F38); cursor: crosshair; }
#scene.sc-lampe .bete { position: absolute; translate: -50% -50%; font-size: clamp(44px, 7vw, 72px); }
#scene.sc-lampe .bete.trouve { z-index: 3; animation: saute .5s; filter: drop-shadow(0 0 14px #FFE98A); }
.noir { position: absolute; inset: 0; z-index: 2; pointer-events: none; --x: -500px; --y: -500px; --r: 140px;
  background: radial-gradient(circle var(--r) at var(--x) var(--y), rgba(255, 240, 170, .12) 0, rgba(255, 240, 170, .06) 70%, rgba(7, 9, 30, .985) 100%); }

/* ---------- 2. Les bulles ---------- */
#scene.sc-bulles { background: linear-gradient(#5CD3F0, #1687C9 70%, #0E5FA3); }
.bulle { position: absolute; left: 0; top: 0; padding: 0; cursor: pointer; }
.bulle i { display: block; width: 100%; height: 100%; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .9);
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .95) 0 9%, rgba(255, 255, 255, .25) 10% 45%, rgba(255, 255, 255, .1) 70%); }
.bulle.pop i { animation: pop .22s forwards; }
@keyframes pop { to { scale: 1.6; opacity: 0; } }

/* ---------- 3. Le rangement ---------- */
#scene.sc-rangement { background: #FFF4E2; }
.objet { position: absolute; width: 84px; height: 84px; display: grid; place-items: center; font-size: 62px; cursor: grab; touch-action: none; z-index: 2; }
.objet.forme { box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .16); }
.objet.rond { border-radius: 50%; }
.objet.carre-f { border-radius: 16px; }
.objet.triangle { clip-path: polygon(50% 4%, 98% 96%, 2% 96%); box-shadow: none; }
.objet.prise { cursor: grabbing; scale: 1.15; z-index: 9; filter: drop-shadow(0 12px 8px rgba(0, 0, 0, .25)); }
.objet.retour { transition: left .3s, top .3s; }
.objet.range { position: static; width: 44px; height: 44px; font-size: 34px; cursor: default; box-shadow: none; }
.boites { position: absolute; left: 0; right: 0; bottom: 0; height: 36%; display: flex; gap: 14px; padding: 0 14px 14px; }
.boite { flex: 1; display: grid; grid-template-rows: auto 1fr; border-radius: 22px 22px 16px 16px; border: 5px solid var(--b); background: color-mix(in srgb, var(--b) 22%, #fff); overflow: hidden; }
.boite > b { background: var(--b); color: #fff; text-align: center; font-size: 1.3rem; font-weight: 800; padding: 2px 6px 4px; }
.boite > div { display: flex; flex-wrap: wrap; gap: 6px; align-content: center; justify-content: center; padding: 6px; }

/* ---------- 4. Les points ---------- */
#scene.sc-points { background: radial-gradient(circle at 20% 15%, #3B2E7E, #1B1747 70%); display: grid; place-items: center; }
.toile { position: relative; width: min(92cqw, 92cqh); aspect-ratio: 1; }
#scene.sc-points { container-type: size; }
.toile svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.toile polygon { fill: var(--jaune); opacity: 0; transition: opacity .6s; }
.toile.fini polygon { opacity: .9; }
.toile polyline { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pt { position: absolute; translate: -50% -50%; width: var(--d); height: var(--d); border-radius: 50%; border: 0; padding: 0; background: #fff; color: var(--ink); font-weight: 800; font-size: calc(var(--d) * .5); box-shadow: inset 0 -5px 0 var(--line); z-index: 2; }
.pt.fait { background: var(--jaune); box-shadow: inset 0 -5px 0 var(--jaune-2); }
.pt.suivant { animation: pulse .7s infinite alternate; }

/* ---------- 5. Les œufs ---------- */
#scene.sc-oeufs { background: linear-gradient(#BDE8FF 55%, #8FD46B 55%, #6DBB4C); display: flex; flex-wrap: wrap; gap: 4vw; align-items: center; align-content: center; justify-content: center; padding: 20px; }
.oeuf { width: clamp(90px, 14vw, 150px); aspect-ratio: 3 / 4; border: 0; padding: 0; background: #FFF8E6; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; box-shadow: inset -10px -14px 0 #F0DDB0; display: grid; place-items: center; font-size: clamp(60px, 10vw, 110px); }
.toc { animation: toc .3s; }
@keyframes toc { 30% { rotate: -9deg; } 70% { rotate: 9deg; } }
.oeuf.eclos { background: none; box-shadow: none; animation: saute .5s; cursor: default; }

/* ---------- 6. L'alphabet en fête ---------- */
#scene.sc-alphabet { background: linear-gradient(#141B4D, #2A2466); }
#scene.sc-alphabet canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.grande-lettre { position: absolute; left: 50%; top: 40%; translate: -50% -50%; font-size: clamp(90px, 22vh, 220px); font-weight: 800; color: #fff; line-height: 1; text-shadow: 0 6px 0 rgba(0, 0, 0, .25); }
.bande { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; padding: 0 10px; }
.bande span { width: clamp(24px, 3.2vw, 40px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .55); font-weight: 800; font-size: clamp(.9rem, 1.8vw, 1.3rem); }
.bande span.on { background: var(--jaune); color: var(--ink); animation: saute .4s; }

/* ---------- 7. La pluie de lettres ---------- */
#scene.sc-pluie { background: linear-gradient(#9AD8FF, #DDF3FF 72%, #7CCB5A 72%, #5FB043); }
.ballon { position: absolute; left: 0; top: 0; width: 110px; height: 130px; margin-left: -55px; border-radius: 50% 50% 50% 50% / 46% 46% 54% 54%; background: var(--rouge); box-shadow: inset -10px -12px 0 rgba(0, 0, 0, .14); display: grid; place-items: center; color: #fff; font-size: 72px; font-weight: 800; line-height: 1; }
.ballon::after { content: ""; position: absolute; top: 100%; left: 50%; width: 3px; height: 34px; background: rgba(43, 58, 85, .5); }
.ballon.pop { animation: pop .25s forwards; }

/* ---------- 8. Le petit robot ---------- */
#scene.sc-robot { background: #E9E4FF; display: grid; place-items: center; }
.grille { position: relative; display: grid; gap: 0; border-radius: 18px; overflow: hidden; box-shadow: 0 0 0 6px #fff; }
.case { background: #fff; display: grid; place-items: center; font-size: calc(var(--cell) * .55); }
.case.pair { background: #F3F0FF; }
.case.bloc::after { content: ""; width: 78%; height: 78%; border-radius: 22%; background: #6B5A9E; box-shadow: inset 0 -8px 0 #4E3F7A; }
.robot { position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell); padding: calc(var(--cell) * .08); transition: transform .16s; z-index: 2; }
.robot svg { width: 100%; height: 100%; display: block; }
.fleches { position: absolute; right: 14px; bottom: 14px; display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 54px); gap: 6px; z-index: 5; }
.fleches button { border: 0; border-radius: 14px; background: #fff; box-shadow: inset 0 -5px 0 var(--line); font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.fleches button.appui { background: var(--jaune); box-shadow: inset 0 -2px 0 var(--jaune-2); translate: 0 3px; }
.fleches .h { grid-column: 2; }
.fleches .g { grid-column: 1; grid-row: 2; }

/* ---------- 9. La grenouille ---------- */
#scene.sc-grenouille { background: linear-gradient(90deg, #7CCB5A 0 9%, #3FA9E0 9% 91%, #7CCB5A 91%); }
.nenu { position: absolute; translate: -50% -50%; width: clamp(54px, 8.4vw, 96px); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(from 20deg, #3CB55F 0 320deg, transparent 320deg); box-shadow: inset 0 -6px 0 #2A9148; display: grid; place-items: center; font-size: clamp(22px, 3.6vw, 40px); }
.frog { position: absolute; translate: -50% -62%; font-size: clamp(40px, 6.4vw, 74px); transition: left .28s, top .28s; z-index: 3; }
.frog.plouf { animation: plouf .7s; }
@keyframes plouf { 30% { translate: 20% 20%; scale: .5; opacity: .3; } 60% { translate: 20% 20%; scale: .5; opacity: .3; } }
.touches-aide { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; display: flex; gap: 12px; z-index: 5; }
.touches-aide span { display: grid; place-items: center; height: 54px; padding: 0 18px 5px; border-radius: 14px; background: #fff; box-shadow: inset 0 -6px 0 var(--line); font-weight: 800; font-size: 1.2rem; }
.touches-aide .t-espace { width: clamp(180px, 34vw, 380px); }
.touches-aide .appui { background: var(--jaune); box-shadow: inset 0 -2px 0 var(--jaune-2); translate: 0 4px; }
.touches-aide .vise { background: var(--jaune); box-shadow: inset 0 -6px 0 var(--jaune-2); animation: pulse .7s infinite alternate; }

/* ---------- 10. Les mots ---------- */
#scene.sc-mots { background: #fff repeating-linear-gradient(#fff 0 38px, #CFE0F7 38px 40px); display: grid; align-content: start; justify-items: center; gap: 14px; padding-top: 3vh; }
.mot-image { font-size: clamp(80px, 20vh, 170px); }
.mot-lettres { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 0 10px; }
.mot-lettres span { width: clamp(44px, 7.5vw, 78px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 16px; background: #fff; border: 3px solid var(--line); font-weight: 800; font-size: clamp(1.6rem, 4.6vw, 3rem); line-height: 1; color: var(--muted); }
.mot-lettres span.ici { border-color: var(--accent); color: var(--ink); scale: 1.1; }
.mot-lettres span.fait { background: var(--vert); border-color: #2A9B50; color: #fff; }

@media (max-width: 560px) {
  .barre-titre small, .compte { display: none; }
  .tuiles { grid-template-columns: repeat(2, 1fr); }
  .tuile .ico { width: 72px; height: 72px; }
  .tuile b { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .carte, .grosse-etoile, .kb-t.vise, .pt.suivant { animation: none; }
  .tuile { transition: none; }
}
