/* ZAYNA - page v1 (31/10/2026) : feuille de style unique (index.html et parents.html).
   Theme rose, creme et or par defaut ; 4 autres themes (violet, turquoise, dore, menthe) par data-theme sur <html>.
   Tablette et telephone, portrait et paysage ; marges de 16 px ; aucun defilement horizontal ; police du systeme. */

:root {
  --creme: #fff7ef;
  --creme-2: #ffeedd;
  --carte: #fffdf9;
  --or: #f2b632;
  --or-clair: #ffd970;
  --or-fonce: #c98a12;
  --texte: #4a2b3a;
  --texte-doux: #7a5a68;
  --accent: #ff6fa8;
  --accent-2: #ffbfd9;
  --accent-fonce: #d23c7c;
  --accent-voile: rgba(255, 111, 168, .18);
  --ombre: 0 10px 28px rgba(140, 60, 90, .16);
  --marge: 16px;
  --dock-h: 108px;
  --police: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="violet"] { --accent: #9b6bff; --accent-2: #d8c8ff; --accent-fonce: #6f43d6; --accent-voile: rgba(155, 107, 255, .18); }
[data-theme="turquoise"] { --accent: #1fb8b8; --accent-2: #aeeceb; --accent-fonce: #0f8584; --accent-voile: rgba(31, 184, 184, .18); }
[data-theme="dore"] { --accent: #e9a91c; --accent-2: #ffe3a3; --accent-fonce: #a86f05; --accent-voile: rgba(233, 169, 28, .2); }
[data-theme="menthe"] { --accent: #3cc48f; --accent-2: #bdf0da; --accent-fonce: #1c8a5f; --accent-voile: rgba(60, 196, 143, .18); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--creme); }
body {
  background: var(--creme);
  color: var(--texte);
  font-family: var(--police);
  font-size: 17px;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
[hidden] { display: none !important; }
button { font-family: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid var(--or); outline-offset: 3px; }
.symboles { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Ciel du Royaume des Idees (decor) ---------- */
.ciel {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: radial-gradient(120% 75% at 50% 0%, #ffffff 0%, var(--creme) 55%, var(--creme-2) 100%);
}
.nuage { position: absolute; width: 150px; height: 46px; border-radius: 46px; background: #ffffff; opacity: .85; animation: derive 60s linear infinite; }
.nuage::before, .nuage::after { content: ""; position: absolute; border-radius: 50%; background: #ffffff; }
.nuage::before { width: 62px; height: 62px; left: 26px; top: -30px; }
.nuage::after { width: 46px; height: 46px; left: 76px; top: -20px; }
.n1 { top: 12%; left: -10%; }
.n2 { top: 44%; left: 60%; transform: scale(.7); animation-duration: 80s; animation-delay: -30s; }
.n3 { top: 76%; left: 10%; transform: scale(.55); animation-duration: 70s; animation-delay: -50s; opacity: .7; }
@keyframes derive { from { translate: -20vw 0; } to { translate: 120vw 0; } }
.ciel-etoile { position: absolute; width: 18px; height: 18px; fill: var(--or-clair); opacity: .7; animation: scintille-doux 4s ease-in-out infinite; }
.s1 { top: 9%; left: 8%; } .s2 { top: 18%; right: 9%; animation-delay: -1s; fill: var(--accent-2); }
.s3 { top: 58%; left: 4%; animation-delay: -2s; } .s4 { top: 70%; right: 6%; animation-delay: -3s; fill: var(--accent-2); }
.s5 { top: 36%; right: 22%; width: 12px; height: 12px; animation-delay: -1.5s; }
@keyframes scintille-doux { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: .85; transform: scale(1.1); } }

/* ---------- Ecran d'accueil ---------- */
.app {
  position: relative;
  height: 100vh; height: 100dvh;
  width: 100%;
  max-width: 100vw;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "bandeau" "scene" "commandes";
  row-gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(var(--marge), env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(var(--marge), env(safe-area-inset-left));
}
.bandeau { grid-area: bandeau; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; min-width: 0; }
.marque { display: flex; align-items: center; gap: 8px; min-width: 0; }
.marque-etoile { width: 36px; height: 36px; flex: 0 0 auto; fill: var(--or); stroke: var(--or-fonce); stroke-width: .6; filter: drop-shadow(0 2px 3px rgba(201, 138, 18, .35)); animation: balance 5s ease-in-out infinite; }
@keyframes balance { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.marque-nom { font-size: 30px; font-weight: 900; letter-spacing: .5px; color: var(--accent-fonce); }
.badge-demo { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: var(--or-clair); color: #5e4100; white-space: nowrap; }
.bandeau .badge-demo { margin-left: auto; margin-right: -4px; }
.badge-demo .court { display: none; }
@media (max-width: 480px) { .badge-demo .long { display: none; } .badge-demo .court { display: inline; } }
.etoiles { display: flex; gap: 3px; flex: 0 0 auto; padding: 6px 10px; border-radius: 99px; background: rgba(255, 253, 249, .8); box-shadow: 0 3px 10px rgba(140, 60, 90, .1); }
.etoile-slot { width: 26px; height: 26px; fill: rgba(255, 217, 112, .18); stroke: var(--or); stroke-width: 1.4; transition: fill .3s; }
.etoile-slot.gagnee { fill: var(--or); stroke: var(--or-fonce); }
.etoile-slot.nouvelle { animation: rebond .8s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes rebond { 0% { transform: scale(.2); } 60% { transform: scale(1.5); } 100% { transform: scale(1); } }

.scene { grid-area: scene; position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; min-width: 0; }
.scene-zayna { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.halo {
  position: absolute; left: 50%; top: 52%; width: min(92%, 62vh); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, var(--accent-voile) 0%, rgba(255, 217, 112, .22) 42%, rgba(255, 217, 112, 0) 70%);
}
.avatar { position: relative; height: 100%; max-width: 100%; aspect-ratio: 2 / 3; animation: flotte 6s ease-in-out infinite; }
@keyframes flotte { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.avatar-corps { position: absolute; inset: 0; transform-origin: 50% 92%; transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); }
.pose, .zayna-svg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%;
  opacity: 0; transition: opacity .25s ease; pointer-events: none; transform-origin: 50% 100%;
  animation: cligne 5.5s ease-in-out infinite;
}
/* v1.1 : Zayna vivante (js/animation.js). .avatar-vie porte la respiration, le balancement et le penche vers le doigt ;
   les calques bouche et yeux sont poses sur l'image (rectangle calcule par le script) et ne se montrent que sur « debout ».
   Bords des calques adoucis : le raccord avec la pose est invisible a toute taille. */
.avatar-vie { position: absolute; inset: 0; transform-origin: 50% 96%; }
.calques { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .25s ease; }
.avatar[data-image="debout"] .calques.pret { opacity: 1; }
.calque {
  --fx: 5%; --fy: 6%;
  position: absolute; background-repeat: no-repeat; background-position: 0% 0%;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fx), #000 calc(100% - var(--fx)), transparent 100%), linear-gradient(to bottom, transparent 0, #000 var(--fy), #000 calc(100% - var(--fy)), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fx), #000 calc(100% - var(--fx)), transparent 100%), linear-gradient(to bottom, transparent 0, #000 var(--fy), #000 calc(100% - var(--fy)), transparent 100%);
  mask-composite: intersect;
}
.calque-yeux { --fx: 2.4%; visibility: hidden; }
body.zayna-anime .avatar,
body.zayna-anime .pose,
body.zayna-anime[data-etat="parle"] .avatar-corps,
body.zayna-anime[data-etat="connexion"] .avatar-corps { animation: none; }
@keyframes cligne { 0%, 92%, 100% { transform: scale(1, 1); } 95% { transform: scale(1.012, .985); } }
.avatar[data-image="debout"] .pose[data-pose="debout"],
.avatar[data-image="salut"] .pose[data-pose="salut"],
.avatar[data-image="peint"] .pose[data-pose="peint"],
.avatar[data-image="fete"] .pose[data-pose="fete"],
.avatar[data-image="ecoute"] .pose[data-pose="ecoute"],
.avatar[data-image="svg"] .zayna-svg { opacity: 1; }
body[data-etat="ecoute"] .avatar-corps { transform: rotate(-2.5deg) translateX(-2%); }
body[data-etat="parle"] .avatar-corps { animation: parle .9s ease-in-out infinite; }
body[data-etat="connexion"] .avatar-corps { animation: parle 1.8s ease-in-out infinite; }
@keyframes parle { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
.avatar[data-pose="fete"] .avatar-corps { animation: hourra .7s ease-in-out 3; }
@keyframes hourra { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4%) scale(1.03); } }

/* Etincelles autour de Zayna quand elle parle ou fait la fete */
.etincelles { position: absolute; inset: 0; pointer-events: none; }
.etincelles svg { position: absolute; left: var(--x); top: var(--y); width: var(--t); height: var(--t); fill: var(--or); opacity: 0; transform: scale(.3); }
.etincelles svg:nth-child(2n) { fill: var(--accent); }
body[data-etat="parle"] .etincelles svg,
.avatar[data-pose="fete"] .etincelles svg { animation: scintille 1.5s ease-in-out infinite; animation-delay: var(--d); }
@keyframes scintille { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }

/* Zayna dessinee (repli SVG) : poses */
.zayna-svg .z-bras-g { transform-origin: 152px 300px; transition: transform .55s cubic-bezier(.3, 1.5, .5, 1); }
.zayna-svg .z-bras-d { transform-origin: 248px 300px; transition: transform .55s cubic-bezier(.3, 1.5, .5, 1); }
.zayna-svg .z-pinceau { transform-origin: 272px 386px; transition: transform .55s cubic-bezier(.3, 1.5, .5, 1); }
.zayna-svg .z-tete { transform-origin: 200px 282px; transition: transform .5s ease; }
.zayna-svg .z-corps-entier { transform-origin: 200px 560px; }
.zayna-svg .z-yeux { transform-origin: 200px 199px; animation: yeux 5s ease-in-out infinite; }
@keyframes yeux { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.zayna-svg .z-bouche, .zayna-svg .z-ondes, .zayna-svg .z-peinture { opacity: 0; transition: opacity .25s; }
body[data-etat="parle"] .zayna-svg .z-sourire { opacity: 0; }
body[data-etat="parle"] .zayna-svg .z-bouche { opacity: 1; transform-origin: 200px 236px; animation: bouche .28s ease-in-out infinite alternate; }
@keyframes bouche { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
.avatar[data-pose="salut"] .z-bras-d { animation: coucou .5s ease-in-out infinite alternate; }
.avatar[data-pose="salut"] .z-pinceau { transform: rotate(95deg); }
@keyframes coucou { from { transform: rotate(-92deg); } to { transform: rotate(-114deg); } }
.avatar[data-pose="peint"] .z-bras-d { transform: rotate(-60deg); }
.avatar[data-pose="peint"] .z-pinceau { transform: rotate(70deg); }
.avatar[data-pose="peint"] .z-peinture { opacity: 1; }
.avatar[data-pose="fete"] .z-bras-d { transform: rotate(-120deg); }
.avatar[data-pose="fete"] .z-pinceau { transform: rotate(105deg); }
.avatar[data-pose="fete"] .z-bras-g { transform: rotate(100deg); }
.avatar[data-pose="fete"] .z-corps-entier { animation: saute .45s ease-in-out infinite alternate; }
@keyframes saute { from { transform: translateY(0); } to { transform: translateY(-14px); } }
.avatar[data-pose="ecoute"] .z-tete { transform: rotate(-7deg); }
.avatar[data-pose="ecoute"] .z-ondes { opacity: .9; }

/* Panneau de jeu (au-dessus de Zayna, sans jamais couvrir son visage) */
.jeu {
  position: relative; flex: 0 0 auto; width: 100%; max-width: 560px; display: flex; align-items: center; gap: 12px;
  background: var(--carte); border: 3px solid var(--or-clair); border-radius: 20px; padding: 10px 10px 10px 14px; box-shadow: var(--ombre);
  animation: arrive .45s cubic-bezier(.3, 1.4, .5, 1);
}
@keyframes arrive { from { transform: translateY(-14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.jeu-icone { width: 42px; height: 42px; flex: 0 0 auto; fill: var(--accent); }
.jeu-textes { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jeu-type { font-size: 13px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-fonce); }
.jeu-titre { font-size: 20px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.jeu-etoiles { display: flex; gap: 2px; }
.jeu-etoiles .etoile-slot { width: 18px; height: 18px; }
.jeu-fermer { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--creme-2); color: var(--texte-doux); display: grid; place-items: center; cursor: pointer; }
.jeu-fermer svg { width: 22px; height: 22px; }

/* Sous-titres, bouton rond, raccourcis */
.commandes { grid-area: commandes; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.dock { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }
.bulle {
  --taille: clamp(19px, calc(1.6vh + 9px), 25px);
  width: 100%; max-width: 640px; min-width: 0;
  font-size: var(--taille); line-height: 1.3; font-weight: 700; text-align: center;
  padding: 11px 18px; display: flex; align-items: center;
  background: var(--carte); border: 2px solid var(--accent-2); border-radius: 22px; box-shadow: var(--ombre);
}
/* Fenetre de deux lignes exactement : on voit toujours les deux dernieres lignes de ce que dit Zayna */
.bulle-fenetre { width: 100%; height: 2.6em; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.bulle-fenetre.deborde { justify-content: flex-end; }
.bulle p { margin: 0; flex: 0 0 auto; overflow-wrap: anywhere; }
.bulle.indication { color: var(--texte-doux); font-weight: 650; }

.parole {
  --btn: clamp(112px, 16vh, 148px);
  position: relative; flex: 0 0 auto; width: var(--btn); height: var(--btn); min-height: 0; border-radius: 50%; border: 0; padding: 0; cursor: pointer; color: #ffffff;
  background: radial-gradient(circle at 35% 28%, var(--accent) 0%, var(--accent-fonce) 72%);
  box-shadow: 0 12px 26px var(--accent-voile), 0 6px 0 rgba(0, 0, 0, .06), inset 0 -6px 12px rgba(0, 0, 0, .12), inset 0 6px 10px rgba(255, 255, 255, .25);
  transition: transform .15s ease, filter .3s;
}
.parole:active { transform: scale(.95); }
.parole-coeur { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px; }
.parole-icone { width: calc(var(--btn) * .3); height: calc(var(--btn) * .3); fill: #ffffff; color: #ffffff; flex: 0 0 auto; }
.parole-libelle { font-size: clamp(14px, calc(.9vh + 9px), 18px); font-weight: 900; line-height: 1.12; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .28); }
.parole-anneau { position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--accent-2); pointer-events: none; }
body[data-etat="repos"] .parole-anneau, body[data-etat="pret"] .parole-anneau { animation: appel 2.4s ease-out infinite; }
@keyframes appel { 0% { transform: scale(.94); opacity: .9; } 70%, 100% { transform: scale(1.22); opacity: 0; } }
body[data-etat="ecoute"] .parole-anneau { border-color: var(--or); border-width: 6px; animation: ecoute 1s ease-out infinite; }
@keyframes ecoute { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
body[data-etat="ecoute"] .parole { box-shadow: 0 0 0 6px var(--or-clair), 0 12px 30px rgba(242, 182, 50, .45); }
body[data-etat="ecoute"] .parole-icone { animation: micro .6s ease-in-out infinite alternate; }
@keyframes micro { from { transform: scale(.92); } to { transform: scale(1.08); } }
body[data-etat="connexion"] .parole, body[data-etat="reflexion"] .parole, body[data-etat="dessine"] .parole { filter: saturate(.75) brightness(1.04); }
body[data-etat="connexion"] .parole-anneau, body[data-etat="reflexion"] .parole-anneau { border-style: dashed; animation: tourne 3s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
body[data-etat="fin"] .parole, body[data-etat="aurevoir"] .parole { filter: saturate(.35) brightness(1.08); }

.raccourcis { display: flex; gap: 12px; width: 100%; max-width: 560px; }
.raccourci {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; padding: 10px 12px;
  border-radius: 18px; border: 2px solid var(--accent-2); background: var(--carte); color: var(--accent-fonce);
  font-size: 18px; font-weight: 800; box-shadow: 0 4px 12px rgba(140, 60, 90, .1); cursor: pointer;
}
.raccourci:active { transform: scale(.97); }
.raccourci svg { width: 28px; height: 28px; flex: 0 0 auto; fill: currentColor; }
.raccourci span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lien-parents { font-size: 14px; font-weight: 600; color: var(--texte-doux); opacity: .7; text-decoration: none; padding: 4px 14px; }

/* Paysage (tablette couchee, telephone couche) : Zayna a gauche, commandes a droite */
@media (orientation: landscape) and (min-width: 640px) {
  .app {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 42%);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "bandeau bandeau" "scene commandes";
    column-gap: 24px;
  }
  .commandes { justify-content: center; }
}
/* Ecrans bas (telephone couche) */
@media (max-height: 520px) {
  :root { --dock-h: 88px; }
  .bandeau { min-height: 40px; }
  .marque-nom { font-size: 24px; }
  .marque-etoile { width: 28px; height: 28px; }
  .etoile-slot { width: 20px; height: 20px; }
  .bulle { --taille: 17px; padding: 8px 14px; }
  .parole { --btn: 92px; }
  .parole-libelle { font-size: 13px; }
  .raccourci { min-height: 46px; font-size: 16px; }
  .raccourci svg { width: 22px; height: 22px; }
  .dock { gap: 10px; }
  .commandes { gap: 6px; }
  .jeu-titre { font-size: 17px; }
}
/* Petits telephones en portrait */
@media (max-width: 360px) {
  .raccourci { font-size: 16px; gap: 6px; }
  .marque-nom { font-size: 26px; }
  .etoile-slot { width: 22px; height: 22px; }
}

/* ---------- Panneaux (dessin, atelier, musee) ---------- */
.panneau {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto;
  background: var(--creme);
  padding: max(10px, env(safe-area-inset-top)) max(var(--marge), env(safe-area-inset-right)) calc(var(--dock-h) + 12px) max(var(--marge), env(safe-area-inset-left));
  animation: panneau .3s ease;
  -webkit-overflow-scrolling: touch;
}
@keyframes panneau { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.panneau-barre { display: flex; align-items: center; gap: 12px; min-height: 58px; flex: 0 0 auto; min-width: 0; }
.panneau-barre h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 24px; font-weight: 900; color: var(--accent-fonce); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bouton-rond {
  width: 54px; height: 54px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--accent-2); background: var(--carte); color: var(--accent-fonce);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 10px rgba(140, 60, 90, .1);
}
.bouton-rond svg { width: 26px; height: 26px; }

/* Le dock (sous-titres + bouton rond) reste en bas pendant qu'un panneau est ouvert */
body.panneau-ouvert .dock {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; flex-direction: row; align-items: center; gap: 12px;
  padding: 10px max(var(--marge), env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(var(--marge), env(safe-area-inset-left));
  background: linear-gradient(to top, rgba(255, 247, 239, .97) 72%, rgba(255, 247, 239, 0));
}
body.panneau-ouvert .bulle { --taille: 17px; flex: 1 1 auto; padding: 8px 14px; box-shadow: 0 4px 12px rgba(140, 60, 90, .1); }
body.panneau-ouvert .parole { --btn: 84px; }
body.panneau-ouvert .parole-coeur { padding: 8px; gap: 2px; }
body.panneau-ouvert .parole-libelle { font-size: 12px; }
body.panneau-ouvert .parole-anneau { inset: -6px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 12px 22px; max-width: 100%;
  border-radius: 18px; border: 2px solid transparent; font-size: 18px; font-weight: 800; cursor: pointer; text-align: center;
}
.bouton:active { transform: scale(.97); }
.bouton svg { width: 24px; height: 24px; flex: 0 0 auto; fill: currentColor; }
.bouton-plein { background: var(--accent-fonce); color: #ffffff; box-shadow: 0 6px 16px var(--accent-voile); }
.bouton-doux { background: var(--carte); color: var(--accent-fonce); border-color: var(--accent-2); }
.bouton-doux.fait { background: #eefaf2; color: #1d7a45; border-color: #9fdcb6; }
.bouton-attention { background: #fff1f1; color: #a8231b; border-color: #f2b3b3; }
.bouton-grand { min-height: 64px; font-size: 20px; padding: 14px 28px; }

/* Dessin */
.panneau-dessin { background: radial-gradient(circle at 50% 30%, #ffffff 0%, var(--creme) 62%, var(--creme-2) 100%); }
.dessin-contenu { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-width: 0; }
.dessin-attente, .dessin-resultat, .dessin-echec { display: none; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.panneau-dessin[data-etape="attente"] .dessin-attente,
.panneau-dessin[data-etape="resultat"] .dessin-resultat,
.panneau-dessin[data-etape="echec"] .dessin-echec,
.panneau-dessin[data-etape="quota"] .dessin-echec { display: flex; }
.panneau-dessin[data-etape="echec"] #dessinVersAtelier { display: none; }
.dessin-message { margin: 0; max-width: 640px; font-size: clamp(22px, calc(2vh + 12px), 32px); font-weight: 900; line-height: 1.25; color: var(--accent-fonce); }
.chevalet-svg { width: min(64vw, 34vh, 300px); height: auto; display: block; }
.trait { stroke-dasharray: 420; stroke-dashoffset: 420; animation: trace 3.2s ease-in-out infinite; }
.t1 { stroke: var(--accent); }
.t2 { stroke: #4fc3f7; animation-delay: .8s; }
.t3 { stroke: var(--or); animation-delay: 1.6s; }
@keyframes trace { 0% { stroke-dashoffset: 420; } 60%, 80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -420; } }
.pinceau-anime { animation: pinceau 3.2s ease-in-out infinite; }
@keyframes pinceau {
  0%, 100% { transform: translate(60px, 210px) rotate(0deg); }
  25% { transform: translate(130px, 170px) rotate(-12deg); }
  50% { transform: translate(200px, 110px) rotate(6deg); }
  75% { transform: translate(236px, 190px) rotate(-8deg); }
}
.dessin-idee { margin: 0; max-width: 560px; font-size: 17px; color: var(--texte-doux); overflow-wrap: anywhere; }
.dessin-idee span:first-child { font-weight: 800; }
.cadre { position: relative; width: min(84vw, 48vh, 560px); aspect-ratio: 1; padding: 10px; border-radius: 28px; background: #ffffff; border: 6px solid var(--or-clair); box-shadow: var(--ombre); }
.cadre img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 18px; animation: revele 1.2s ease-out both; }
@keyframes revele { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(75% at 50% 50%); } }
.eclat { position: absolute; inset: 0; pointer-events: none; }
.eclat svg { position: absolute; left: var(--x); top: var(--y); width: 34px; height: 34px; margin: -17px; fill: var(--or); opacity: 0; animation: eclat 1.4s ease-out var(--d) 2 both; }
.eclat svg:nth-child(2n) { fill: var(--accent); }
@keyframes eclat { 0% { opacity: 0; transform: scale(.2); } 40% { opacity: 1; transform: scale(1.3) rotate(30deg); } 100% { opacity: 0; transform: scale(.6) rotate(90deg); } }
.dessin-titre { margin: 0; max-width: 560px; font-size: 19px; font-weight: 800; overflow-wrap: anywhere; }
.echec-icone { width: 80px; height: 80px; fill: var(--or); animation: scintille-doux 2s infinite; }
.dessin-echec h2 { margin: 0; font-size: 26px; color: var(--accent-fonce); max-width: 520px; }

/* Atelier 3D */
.panneau-atelier { padding: 0; overflow: hidden; }
.atelier-scene { position: absolute; inset: 0; }
.atelier-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.atelier-barre {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; pointer-events: none;
  padding: max(10px, env(safe-area-inset-top)) max(var(--marge), env(safe-area-inset-right)) 18px max(var(--marge), env(safe-area-inset-left));
  background: linear-gradient(rgba(255, 247, 239, .94) 55%, rgba(255, 247, 239, 0));
}
.atelier-barre > * { pointer-events: auto; }
.atelier-barre { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "retour titre photo"; }
.atelier-barre #atelierRetour { grid-area: retour; }
.atelier-barre .atelier-titre { grid-area: titre; text-align: center; }
.atelier-barre .bouton-photo { grid-area: photo; }
@media (max-width: 520px) {
  .atelier-barre { grid-template-areas: "retour . photo" "titre titre titre"; row-gap: 4px; }
  .atelier-barre .atelier-titre { white-space: normal; font-size: 22px; line-height: 1.2; }
  .atelier-aide, .atelier-attente { top: calc(max(10px, env(safe-area-inset-top)) + 108px); }
}
.bouton-photo { min-height: 54px; padding: 10px 18px; }
.atelier-aide, .atelier-attente {
  position: absolute; z-index: 2; left: var(--marge); right: var(--marge); top: calc(max(10px, env(safe-area-inset-top)) + 72px); margin: 0 auto; max-width: 480px;
  padding: 10px 14px; border-radius: 16px; background: rgba(255, 253, 249, .94); box-shadow: var(--ombre); text-align: center; font-size: 17px; font-weight: 700;
}
.atelier-flash { position: absolute; inset: 0; z-index: 3; background: #ffffff; opacity: 0; pointer-events: none; }
.atelier-flash.flash { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* Musee */
.musee-compte { flex: 0 0 auto; font-size: 16px; font-weight: 800; color: var(--texte-doux); padding: 6px 12px; border-radius: 99px; background: var(--carte); }
.musee-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 8px 0 16px; min-width: 0; }
.oeuvre {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--carte); color: inherit; box-shadow: 0 4px 14px rgba(140, 60, 90, .12); animation: arrive .35s ease;
}
.oeuvre img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #ffffff; display: block; }
.oeuvre-titre { font-size: 14px; font-weight: 700; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oeuvre-scene { border: 2px dashed var(--accent-2); }
.musee-vide { max-width: 480px; margin: 40px auto; text-align: center; font-size: 19px; color: var(--texte-doux); }
.musee-vue { position: fixed; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; padding: 16px 16px calc(var(--dock-h) + 8px); background: rgba(74, 43, 58, .45); }
.musee-vue-carte { width: min(100%, 560px); max-height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; border-radius: 24px; background: var(--carte); box-shadow: var(--ombre); }
.musee-vue-carte img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 16px; }
.musee-vue-titre { margin: 0; font-size: 20px; font-weight: 800; text-align: center; overflow-wrap: anywhere; }
.musee-vue-date { margin: 0; font-size: 15px; color: var(--texte-doux); }
.confirmer { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.confirmer p { margin: 0; font-size: 18px; font-weight: 700; }

/* ---------- Etoile gagnee ---------- */
.etoile-fete { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.etoile-fete::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(255, 250, 244, .96) 0%, rgba(255, 247, 239, .9) 55%, rgba(255, 247, 239, .78) 100%); opacity: 0; }
.etoile-fete.joue::before { animation: voile 2.2s ease both; }
@keyframes voile { 0% { opacity: 0; } 15%, 78% { opacity: 1; } 100% { opacity: 0; } }
.etoile-fete-coeur { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.etoile-grande { width: min(46vw, 32vh, 240px); height: min(46vw, 32vh, 240px); fill: var(--or); stroke: var(--or-fonce); stroke-width: .5; filter: drop-shadow(0 8px 20px rgba(242, 182, 50, .55)); }
.etoile-fete .mini { position: absolute; width: 34px; height: 34px; fill: var(--accent); opacity: 0; }
.m1 { left: -12%; top: 8%; } .m2 { right: -12%; top: 4%; fill: var(--or); } .m3 { left: -4%; top: 52%; fill: var(--or); } .m4 { right: -6%; top: 48%; }
.etoile-fete-texte { margin: 0; padding: 8px 18px; border-radius: 99px; background: var(--carte); box-shadow: var(--ombre); font-size: 22px; text-align: center; max-width: 90vw; overflow-wrap: anywhere; }
.etoile-fete-texte span { color: var(--accent-fonce); font-weight: 900; }
.etoile-fete.joue .etoile-grande { animation: etoile-pop 2.2s cubic-bezier(.2, 1.3, .4, 1) both; }
.etoile-fete.joue .etoile-fete-texte { animation: texte-etoile 2.2s ease both; }
@keyframes texte-etoile { 0%, 10% { opacity: 0; transform: translateY(12px); } 22%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.etoile-fete.joue .mini { animation: scintille 1s ease-in-out .3s 2; }
@keyframes etoile-pop {
  0% { transform: scale(0) rotate(-120deg); opacity: 0; }
  25% { transform: scale(1.15) rotate(10deg); opacity: 1; }
  40%, 82% { transform: scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-36vh) scale(.15); opacity: 0; }
}

/* ---------- Ecrans plein ecran : pause, fin, premier lancement ---------- */
.ecran {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; overflow-x: hidden; overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) max(var(--marge), env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(var(--marge), env(safe-area-inset-left));
  background: rgba(255, 247, 239, .9); animation: panneau .35s ease;
}
.carte {
  width: min(100%, 520px); margin: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: 24px 20px; border-radius: 28px; background: var(--carte); box-shadow: var(--ombre); border: 3px solid var(--accent-2);
}
.ecran-titre { margin: 0; font-size: clamp(34px, calc(3vh + 18px), 52px); font-weight: 900; line-height: 1.1; color: var(--accent-fonce); }
.ecran-texte { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.3; }
.ecran-pause { background: linear-gradient(165deg, #e6f5ff 0%, var(--creme) 70%); }
.pause-dessins { display: flex; align-items: flex-end; justify-content: center; gap: 24px; height: 110px; }
.verre { width: 84px; height: 84px; animation: balance 3s ease-in-out infinite; }
.sauteuse { width: 64px; height: 64px; fill: var(--or); stroke: var(--or-fonce); stroke-width: .6; animation: saut 1.2s cubic-bezier(.3, .0, .5, 1) infinite; }
@keyframes saut { 0%, 100% { transform: translateY(0) scale(1.1, .9); } 40% { transform: translateY(-36px) scale(.95, 1.05); } 60% { transform: translateY(-36px) rotate(20deg); } }
.pause-consigne { margin: 0; font-size: 16px; color: var(--texte-doux); font-weight: 700; }
.sauts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.saut { width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--accent-2); background: #ffffff; color: var(--accent-fonce); font-size: 22px; font-weight: 900; cursor: pointer; transition: transform .2s, background .2s; }
.saut.fait { background: var(--accent-fonce); color: #ffffff; border-color: var(--accent-fonce); transform: scale(1.08); }
.pause-bravo { margin: 0; font-size: 20px; font-weight: 900; color: #1d7a45; }
.fin-etoile, .premier-etoile { width: 72px; height: 72px; fill: var(--or); stroke: var(--or-fonce); stroke-width: .6; animation: balance 4s ease-in-out infinite; }
.fin-etoiles { margin: 0; font-size: 18px; color: var(--texte-doux); font-weight: 700; }
.premier-question { margin: 6px 0 0; font-size: 22px; font-weight: 800; display: block; }
.premier-prenom {
  width: 100%; min-width: 0; padding: 12px 16px; border-radius: 18px; border: 3px solid var(--accent-2); background: #ffffff; color: var(--texte);
  font: inherit; font-size: 28px; font-weight: 800; text-align: center; -webkit-user-select: text; user-select: text;
}
.premier-prenom:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-voile); }
.premier-prenom::placeholder { color: #c4a9b5; font-weight: 700; }
.pastilles { width: 100%; display: flex; gap: 2px; justify-content: center; }
.pastille { flex: 1 1 0; min-width: 0; max-width: 84px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; border: 0; background: none; cursor: pointer; font-size: 12px; font-weight: 800; color: var(--texte-doux); }
.pastille .rond { width: 48px; height: 48px; border-radius: 50%; border: 4px solid #ffffff; box-shadow: 0 3px 8px rgba(0, 0, 0, .16); transition: transform .2s, box-shadow .2s; }
.pastille.choisie .rond { transform: scale(1.1); box-shadow: 0 0 0 4px var(--texte), 0 3px 8px rgba(0, 0, 0, .16); }
.pastille.choisie { color: var(--texte); }
.pastille[data-theme-choix="rose"] .rond { background: #ff6fa8; }
.pastille[data-theme-choix="violet"] .rond { background: #9b6bff; }
.pastille[data-theme-choix="turquoise"] .rond { background: #1fb8b8; }
.pastille[data-theme-choix="dore"] .rond { background: #e9a91c; }
.pastille[data-theme-choix="menthe"] .rond { background: #3cc48f; }

/* ---------- Petit message ---------- */
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(var(--dock-h) + 18px); max-width: calc(100vw - 32px); transform: translate(-50%, 16px);
  padding: 12px 20px; border-radius: 22px; background: var(--texte); color: #ffffff; font-size: 17px; font-weight: 800; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Espace parents ---------- */
body.page-parents { overflow-x: hidden; overflow-y: auto; -webkit-user-select: text; user-select: text; touch-action: auto; }
.parents { position: relative; z-index: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) max(var(--marge), env(safe-area-inset-right)) 40px max(var(--marge), env(safe-area-inset-left)); }
.parents-entete { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.parents-entete h1 { margin: 0; flex: 1 1 auto; font-size: 28px; font-weight: 900; color: var(--accent-fonce); }
.parents-entete .marque-etoile { animation: none; }
.parents .avertissement { margin: 0 0 16px; font-size: 16px; color: var(--texte-doux); }
.bloc { background: var(--carte); border-radius: 20px; box-shadow: 0 4px 14px rgba(140, 60, 90, .1); padding: 18px; margin: 0 0 16px; border: 2px solid var(--accent-2); min-width: 0; }
.bloc h2 { margin: 0 0 10px; font-size: 21px; font-weight: 900; color: var(--accent-fonce); }
.bloc p, .bloc li { font-size: 16px; line-height: 1.5; }
.bloc ul { margin: 0; padding-left: 20px; }
.bloc li { margin: 4px 0; }
.compteur { font-size: 30px; font-weight: 900; color: var(--texte); }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0; }
.champ { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; min-width: 0; }
.champ label { font-weight: 800; font-size: 16px; }
.champ small { color: var(--texte-doux); font-size: 14px; }
.champ select, .champ input {
  width: 100%; max-width: 360px; min-height: 50px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--accent-2); background: #ffffff;
  color: var(--texte); font: inherit; font-size: 18px;
}
.champ select:focus, .champ input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-voile); }
.champ .case { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 16px; cursor: pointer; }
.champ .case input { width: 28px; height: 28px; min-height: 0; max-width: none; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--accent-fonce); }
.etat-sauve { font-weight: 800; color: #1d7a45; }
.lien-retour { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }

/* ---------- Mouvement reduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .avatar, .avatar-corps, .nuage, .ciel-etoile, .marque-etoile, .pose, .zayna-svg, .zayna-svg *, .etincelles svg, .parole-anneau, .parole-icone, .verre, .sauteuse, .fin-etoile, .premier-etoile {
    animation: none !important;
  }
  .trait { animation-duration: 6s; }
}
