/* ═══════════════════════════════════════════════════════════════════════════
   NETAIX EDU : feuille unique.

   Trois partis pris.

   1. GRAND ET LISIBLE. La page parle a un enfant de six ans comme a un
      lyceen : 20 px de base, une police ronde (Nunito), des cibles tactiles
      d'au moins 56 px (48 px pour les petites pastilles des parents), des
      contrastes forts.

   2. UN THEME CHAUD. Orange et creme : ni le bleu de Netaix, ni le teal du
      Studio. Deux couleurs d'ecoute, et deux seulement : la couleur A quand
      l'enfant parle (ambre), la couleur B quand le compagnon parle (violet).

   3. LE MOUVEMENT EST OPTIONNEL. Le compagnon cligne, se balance, parle,
      ecoute, saute de joie ; sous `prefers-reduced-motion`, il ne fait plus
      que cligner des yeux et changer d'expression sans bouger.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --ground:   #FFF7ED;
  --surface:  #FFFFFF;
  --surface-2:#FFEDD5;
  --border:   #FED7AA;
  --border-strong: #FDBA74;

  --text-1: #1C1917;
  --text-2: #57534E;
  --text-3: #6B6560;   /* AA sur creme pour le pied de page */

  /* Action principale : l'orange du produit */
  --cta:       #EA580C;
  --cta-hover: #F97316;
  --cta-fg:    #FFFFFF;

  /* Couleur A : l'enfant parle. Couleur B : le compagnon parle. */
  --enfant:     #F59E0B;
  --enfant-rgb: 245,158,11;
  --tuteur:     #7C3AED;
  --tuteur-rgb: 124,58,237;
  --attente:    #A8A29E;
  --attente-rgb:168,162,158;

  --danger: #B91C1C;
  --danger-bg: #FEE2E2;
  --ok: #166534;
  --ok-bg: #DCFCE7;

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-pill: 999px;

  --taille: 20px;
  --cible: 56px;
  --cible-min: 48px;

  /* Les couleurs par defaut du compagnon (la palette « soleil ») ; chaque
     compagnon les redefinit sur son element. */
  --c1: #F97316;
  --c2: #FDE68A;
}

* { box-sizing: border-box; }
html { font-size: var(--taille); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text-1);
  background: var(--ground);
  min-height: 100vh;
}
[x-cloak] { display: none !important; }
button, input, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
:focus-visible { outline: 3px solid var(--cta); outline-offset: 3px; }

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── En-tete ─────────────────────────────────────────────────────────────── */
.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0 16px;
}
.entete__marque { display: flex; align-items: center; gap: 12px; }
.entete__titre { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.entete__sous { color: var(--text-2); font-size: 0.8rem; }
.entete__droite { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.avatar { border-radius: 50%; flex: none; }

/* La jauge de credits : une barre fine et un pourcentage */
.jauge { display: flex; align-items: center; gap: 10px; min-height: var(--cible); }
.jauge__barre {
  width: 96px; height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.jauge__niveau { height: 100%; background: var(--cta); border-radius: var(--r-pill); }
.jauge__texte { font-size: 0.8rem; color: var(--text-2); white-space: nowrap; }

/* ── Message ─────────────────────────────────────────────────────────────── */
.message {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--r-md);
  font-weight: 600;
}
.message svg { flex: none; }

/* ── Ecrans ──────────────────────────────────────────────────────────────── */
.ecran {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.ecran--centre { align-items: center; justify-content: center; text-align: center; }
.bonjour { font-size: 2rem; font-weight: 700; margin: 0; line-height: 1.15; }
.bonjour--parents { display: flex; align-items: center; gap: 12px; font-size: 1.6rem; }
.info { margin: 0; color: var(--text-2); }
.info--grand { font-size: 1.1rem; max-width: 30em; }
.bloc { display: flex; flex-direction: column; gap: 12px; }
.bloc__titre { font-size: 1.1rem; font-weight: 700; margin: 0; }
.encart {
  margin: 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-left: 8px solid var(--cta);
  border-radius: var(--r-md);
  color: var(--text-2);
}

/* Les pastilles : larges, une seule choisie (ou plusieurs, en groupe) */
.classes { display: flex; flex-wrap: wrap; gap: 10px; }
.classes--centre { justify-content: center; }
.pastille {
  min-height: var(--cible);
  min-width: 72px;
  padding: 0 20px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-1);
  border-radius: var(--r-pill);
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.pastille:hover { border-color: var(--cta); }
.pastille--choisie { background: var(--cta); border-color: var(--cta); color: var(--cta-fg); }
.pastille--icone { padding: 0 18px 0 14px; }
.pastille--icone svg { flex: none; }
.pastille--petite { min-height: var(--cible-min); min-width: 56px; padding: 0 14px; font-size: 0.9rem; }

/* Les besoins : des cases larges, tout le bloc est cliquable */
.besoins { display: flex; flex-direction: column; gap: 10px; }
.case {
  display: flex; align-items: center; gap: 14px;
  min-height: var(--cible);
  padding: 10px 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  cursor: pointer;
  position: relative;
}
.case--petite { min-height: var(--cible-min); padding: 6px 14px; font-size: 0.9rem; }
.case input {
  position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden;
}
.case__coche {
  width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: transparent;
}
.case--cochee { border-color: var(--cta); background: var(--surface-2); }
.case--cochee .case__coche { background: var(--cta); border-color: var(--cta); color: var(--cta-fg); }
.case:has(input:focus-visible) { outline: 3px solid var(--cta); outline-offset: 3px; }

/* Les champs : un prenom, un nom, en grand */
.champ {
  width: 100%;
  min-height: 64px;
  padding: 0 20px;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-1);
  font-size: 1.25rem;
  font-weight: 600;
}
.champ:focus { border-color: var(--cta); outline: none; box-shadow: 0 0 0 4px rgba(234,88,12,0.18); }
.champ--centre { text-align: center; }
.champ-groupe { display: flex; flex-direction: column; gap: 8px; }
.champ-groupe__titre { font-weight: 700; font-size: 0.9rem; color: var(--text-2); }

/* ── Boutons ─────────────────────────────────────────────────────────────── */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: var(--cible);
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--cta);
  color: var(--cta-fg);
  font-weight: 700;
  text-decoration: none;
}
.bouton:hover { background: var(--cta-hover); }
.bouton--grand {
  min-height: 76px;
  font-size: 1.25rem;
  padding: 0 32px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(234,88,12,0.25);
}
.bouton--auto { width: auto; }
.bouton--moyen { min-height: var(--cible); font-size: 1rem; padding: 0 24px; }
.bouton--stop {
  min-height: 76px;
  font-size: 1.25rem;
  padding: 0 40px;
  background: var(--danger);
}
.bouton--stop:hover { background: #DC2626; }
.bouton--discret {
  background: transparent;
  color: var(--text-2);
  border: 2px solid var(--border);
}
.bouton--discret:hover { background: var(--surface-2); color: var(--text-1); }
.bouton--danger { color: var(--danger); border-color: var(--danger-bg); }
.bouton--danger:hover { background: var(--danger-bg); color: var(--danger); }
/* Le bouton « Espace parents » : discret, en bas, mais toujours 48 px. */
.bouton--lien {
  background: transparent;
  color: var(--text-2);
  min-height: var(--cible-min);
  padding: 0 12px;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.bouton--lien:hover { background: var(--surface-2); color: var(--text-1); }
.rappel { margin: 0; text-align: center; color: var(--text-2); font-size: 0.9rem; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; width: 100%; }
.actions .bouton--grand { width: auto; }
.actions--onb { margin-top: auto; padding-top: 12px; justify-content: space-between; }
.actions--onb .bouton--grand { flex: 1; }
.actions--gauche { justify-content: flex-start; }

/* ── Le compagnon ────────────────────────────────────────────────────────── */
.compagnon { display: inline-block; line-height: 0; }
.compagnon__svg { width: 100%; height: auto; display: block; overflow: visible; }
.compagnon--mini { width: 88px; }
.compagnon--grand { width: 200px; }
.compagnon--halo { width: 150px; position: relative; }

/* Chaque partie qui bouge tourne autour de son propre centre. */
.compagnon .oeil, .compagnon .yeux, .compagnon .oreille, .compagnon .bouche, .compagnon .sourire {
  transform-box: fill-box;
  transform-origin: center;
}
.compagnon .oreille { transform-origin: center bottom; transition: transform 300ms ease; }
.compagnon .yeux { transition: transform 300ms ease; }
.compagnon .bouche { opacity: 0; transition: opacity 150ms ease; }
.compagnon .sourire { transition: opacity 150ms ease; }

/* Au repos : il cligne des yeux, il se balance un peu. */
.compagnon .oeil { animation: cligne 4.2s ease-in-out infinite; }
.compagnon--grand .compagnon__svg, .compagnon--halo .compagnon__svg {
  transform-origin: 50% 95%;
  animation: balance 3.2s ease-in-out infinite;
}
@keyframes cligne {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.08); }
}
@keyframes balance {
  0%, 100% { transform: rotate(-1.8deg); }
  50% { transform: rotate(1.8deg); }
}

/* Il parle : la bouche s'ouvre et se ferme, le sourire s'efface. */
.compagnon--parle .sourire { opacity: 0; }
.compagnon--parle .bouche { opacity: 1; animation: parle 0.32s ease-in-out infinite alternate; }
@keyframes parle {
  from { transform: scaleY(0.35); }
  to   { transform: scaleY(1.25); }
}

/* Il ecoute : les oreilles se dressent, les yeux s'ouvrent grand. */
.compagnon--ecoute .oreille { transform: translateY(-7px); }
.compagnon--ecoute .yeux { transform: scale(1.12); }

/* Il est content : un petit saut. */
.compagnon--content .compagnon__svg { animation: saute 0.55s ease-in-out 2; }
.compagnon--content .yeux { transform: scale(1.12); }
@keyframes saute {
  0%, 100% { transform: translateY(0) rotate(0); }
  40% { transform: translateY(-16px) rotate(-3deg); }
  70% { transform: translateY(0) rotate(2deg); }
}

/* ── Onboarding ──────────────────────────────────────────────────────────── */
.ecran--onb { min-height: calc(100vh - 160px); }
.etape-num { margin: 0; color: var(--text-2); font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; }
.etape { display: flex; flex-direction: column; gap: 16px; }
.etape--centre { align-items: center; text-align: center; }
.question { font-size: 1.8rem; font-weight: 700; margin: 0; line-height: 1.15; }
.question--2 { font-size: 1.2rem; margin-top: 12px; }

.galerie {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.carte-compagnon {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px 10px;
  border: 3px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-lg);
  color: var(--text-1);
  font-weight: 700;
}
.carte-compagnon:hover { border-color: var(--border-strong); }
.carte-compagnon--choisie { border-color: var(--cta); background: var(--surface-2); box-shadow: 0 0 0 4px rgba(234,88,12,0.18); }

.palettes { display: flex; flex-wrap: wrap; gap: 12px; }
.palette {
  width: 88px; height: var(--cible);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 10px;
  border: 3px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-pill);
}
.palette--choisie { border-color: var(--cta); box-shadow: 0 0 0 4px rgba(234,88,12,0.18); }
.palette__c1, .palette__c2 { width: 28px; height: 28px; border-radius: 50%; display: inline-block; }
.palette__c1 { background: var(--c1); }
.palette__c2 { background: var(--c2); border: 1px solid rgba(0,0,0,0.12); }

/* ── Mon espace ──────────────────────────────────────────────────────────── */
.espace { display: flex; flex-direction: column; gap: 24px; flex: 1; }
.espace__haut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.espace__haut .bonjour { flex: 1; min-width: 200px; font-size: 1.7rem; }
.espace__bas { margin-top: auto; display: flex; justify-content: center; padding-top: 8px; }

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.grille--actions { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.carte {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 130px;
  padding: 16px 12px;
  border: 3px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-lg);
  color: var(--text-1);
  text-align: center;
}
.carte:hover { border-color: var(--cta); background: var(--surface-2); }
.carte__icone { color: var(--cta); line-height: 0; }
.carte__titre { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.carte__sous { font-size: 0.85rem; color: var(--text-2); }
.carte--action { min-height: 160px; }
.carte--bientot { opacity: 0.6; }
.carte--bientot:hover { border-color: var(--border); background: var(--surface); }
.carte__badge {
  position: absolute; top: 10px; right: 10px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Ecran de la conversation ────────────────────────────────────────────── */
.ecran--tuteur { align-items: center; }

/* Le halo : le compagnon au centre, une onde derriere dont la taille suit le
   niveau sonore (`--niveau`, 0..1) et dont la couleur suit qui parle. */
.halo {
  --niveau: 0;
  --couleur-rgb: var(--attente-rgb);
  position: relative;
  width: 240px; height: 240px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 8px;
}
.halo__onde {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--couleur-rgb), 0.55) 0%, rgba(var(--couleur-rgb), 0.18) 55%, rgba(var(--couleur-rgb), 0) 72%);
  transform: scale(calc(0.85 + var(--niveau) * 0.45));
  transition: transform 90ms linear, background 300ms ease;
}
.halo--enfant { --couleur-rgb: var(--enfant-rgb); }
.halo--tuteur { --couleur-rgb: var(--tuteur-rgb); }
.halo--attente { --couleur-rgb: var(--attente-rgb); }
.halo--attente .halo__onde { animation: respire 1.6s ease-in-out infinite; }
@keyframes respire {
  0%, 100% { transform: scale(0.85); }
  50% { transform: scale(1); }
}

.etat {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  min-height: 1.6em;
  text-align: center;
}
.halo--enfant + .etat { color: #B45309; }
.halo--tuteur + .etat { color: #6D28D9; }

/* Ce qui se dit : un fil de bulles, qui defile */
.fil {
  width: 100%;
  flex: 1;
  min-height: 160px;
  max-height: 40vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
}
.bulle {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  max-width: 92%;
}
.bulle__qui { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.bulle--moi { align-self: flex-end; background: rgba(var(--enfant-rgb), 0.16); }
.bulle--moi .bulle__qui { color: #B45309; }
.bulle--tuteur { align-self: flex-start; background: rgba(var(--tuteur-rgb), 0.10); }
.bulle--tuteur .bulle__qui { color: #6D28D9; }

/* ── Espace parents ──────────────────────────────────────────────────────── */
.ecran--parents { font-size: 0.95rem; }
.fiche {
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
}
.fiche__tete { display: flex; align-items: center; gap: 14px; }
.fiche__nom { font-weight: 700; font-size: 1.25rem; }
.fiche__sous { color: var(--text-2); font-size: 0.9rem; }
.fiche__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fiche__ok { color: var(--ok); font-weight: 700; }
.confirmation {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 18px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--r-md);
  font-weight: 600;
}
.confirmation p { margin: 0; }

/* ── Bienvenue (sans session) ────────────────────────────────────────────── */
.bienvenue { gap: 20px; }
.bienvenue__compagnon { --c1: #F97316; --c2: #FDE68A; }

/* ── Pied ────────────────────────────────────────────────────────────────── */
.pied { margin-top: 24px; text-align: center; color: var(--text-3); font-size: 0.8rem; }

/* ── Petits ecrans ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .bonjour { font-size: 1.6rem; }
  .question { font-size: 1.5rem; }
  .espace__haut { justify-content: center; text-align: center; }
  .espace__haut .bonjour { font-size: 1.4rem; }
  .compagnon--grand { width: 150px; }
  .halo { width: 200px; height: 200px; }
  .compagnon--halo { width: 124px; }
  .galerie { grid-template-columns: repeat(2, 1fr); }
  .jauge__barre { width: 64px; }
}

/* ── Mouvement reduit : seul le clignement reste ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .halo__onde { transition: background 300ms ease; transform: scale(1) !important; animation: none !important; }
  .compagnon--grand .compagnon__svg, .compagnon--halo .compagnon__svg,
  .compagnon--content .compagnon__svg { animation: none !important; }
  .compagnon--parle .bouche { animation: none !important; transform: scaleY(1); }
  .compagnon .oreille, .compagnon .yeux { transition: none; }
  * { scroll-behavior: auto !important; }
}
