/* L'espace de la personne malade, sur la tablette du chevet (spec 3 et 4.6) : grand, calme, immobile.
   Rien ne bouge sous les yeux de quelqu'un de désorienté : aucun mouvement, d'aucune sorte. */
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/AtkinsonHyperlegible-Regular-111hpSb.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/AtkinsonHyperlegible-Bold-ZyZl0LS.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/AtkinsonHyperlegible-Italic-liPcbUL.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: italic; font-weight: 700; font-display: swap; src: url("../fonts/AtkinsonHyperlegible-BoldItalic-EgHAF9q.woff2") format("woff2"); }

:root {
    --couleur-fond: #f4f6f3;          /* papier */
    --couleur-texte: #15232b;         /* encre */
    --couleur-primaire: #1c6e8c;      /* canard */
    --couleur-primaire-fonce: #15566d;
    --couleur-secondaire: #e6ecea;
    --couleur-alerte: #b23a3a;
    --couleur-ok: #2f7d4a;
}
* { box-sizing: border-box; }
html { font-size: 137.5%; }
body {
    margin: 0;
    font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: var(--couleur-texte);
    background: var(--couleur-fond);
}
*:focus-visible { outline: 3px solid var(--couleur-primaire); outline-offset: 3px; }

main.espace { max-width: 900px; margin: 0 auto; padding: 24px 20px; }
.espace-bonjour { font-size: 2.2rem; text-align: center; margin: .2em 0; }
.espace-date { text-align: center; color: #4a575d; margin-bottom: 1em; }
.espace-bouton {
    display: flex; align-items: center; justify-content: center; gap: .5em;
    min-height: 33vh; margin: 16px 0; border-radius: 24px;
    font-size: 1.6rem; font-weight: 700; color: #fff; background: var(--couleur-primaire); text-decoration: none;
}
.espace-bouton-jeux { background: var(--couleur-ok); }
.espace-retour {
    display: inline-flex; align-items: center; min-height: 64px; padding: 0 20px;
    font-size: 1.1rem; font-weight: 700; color: var(--couleur-primaire-fonce); background: var(--couleur-secondaire);
    border-radius: 16px; text-decoration: none;
}
.espace-nouveau { text-align: center; color: #4a575d; }
/* La page hors ligne (spec PWA 3.4), servie par le service worker quand le réseau manque. Elle tient dans l'écran d'une
   tablette sans défiler, en paysage comme en portrait (1024 × 768, 768 × 1024) : la page remplit la fenêtre (100svh ;
   100vh pour les navigateurs anciens) et les deux gros boutons se partagent ce que le titre et le texte laissent, un
   tiers de la hauteur chacun au plus, 96 px au moins (la page défile alors, sur un écran vraiment bas). */
.hors-ligne-texte { text-align: center; font-size: 1.3rem; margin: .5em 0 1em; }
body[data-page="hors-ligne"] main.espace { display: flex; flex-direction: column; min-height: 100vh; }
@supports (height: 100svh) {
    body[data-page="hors-ligne"] main.espace { min-height: 100svh; }
}
body[data-page="hors-ligne"] .espace-bouton { flex: 1 1 0; min-height: 96px; max-height: 33vh; }

/* Échanger : une messagerie de téléphone, du plus ancien en haut au plus récent en bas (spec 4.3). La famille à
   gauche, ses propres bulles à droite sur fond vert pâle ; le prénom et l'heure au-dessus, à 20 px, le minimum. */
.conversation { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bulle {
    align-self: flex-start; max-width: 80%; padding: 12px 16px; border-radius: 20px;
    font-size: 22px; line-height: 1.35; background: #fff; border: 1px solid #d5dde0; overflow-wrap: anywhere;
}
.bulle-moi { align-self: flex-end; background: #dcefd9; border-color: #c3dcbf; }
.bulle .qui { display: block; font-size: 20px; color: #4a575d; margin-bottom: 2px; }
.bulle p { margin: 0; }
.bulle-photo { display: block; width: 100%; margin: 6px 0 0; padding: 0; border: 0; background: none; cursor: pointer; }
.bulle-photo img { display: block; width: 100%; border-radius: 12px; }
/* La photo en grand au toucher, sur tout l'écran, « ← Accueil » compris : « Fermer » de 64 px au doigt, à la place
   de « ← Accueil », dit comment en sortir ; un toucher n'importe où la referme aussi. */
.bulle-photo-agrandie { position: fixed; inset: 0; z-index: 10; margin: 0; background: #000; }
.bulle-photo-agrandie img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; }
.bulle-photo-fermer { display: none; }
.bulle-photo-agrandie .bulle-photo-fermer {
    position: absolute; top: 24px; left: 20px; display: inline-flex; align-items: center; min-height: 64px; padding: 0 24px;
    font: inherit; font-size: 24px; font-weight: 700; color: var(--couleur-texte); background: #fff; border-radius: 16px;
}
.espace-vide, .espace-ferme { text-align: center; color: #4a575d; margin: 24px 0; }
.espace-ferme { font-weight: 700; }
.espace-erreur { margin: 16px 0 0; color: var(--couleur-alerte); font-weight: 700; }

/* La saisie : deux lignes visibles de texte à 22 px, Photo et Envoyer de 64 px au doigt. */
.espace-saisie { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.espace-saisie textarea {
    width: 100%; padding: 12px 14px; font: inherit; font-size: 22px; line-height: 1.4; color: inherit;
    background: #fff; border: 2px solid #8a979d; border-radius: 16px; resize: vertical;
}
.espace-saisie-boutons { display: flex; gap: 10px; }
.espace-photo, .espace-envoyer {
    flex: 1; display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 0 16px;
    font: inherit; font-size: 24px; font-weight: 700; border: 0; border-radius: 16px; cursor: pointer;
}
.espace-photo { position: relative; color: var(--couleur-texte); background: var(--couleur-secondaire); }
/* Le vrai champ fichier, invisible mais atteignable au clavier : le libellé fait office de bouton. */
.espace-photo input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; overflow: hidden; }
.espace-photo:focus-within { outline: 3px solid var(--couleur-primaire); outline-offset: 3px; }
.espace-envoyer { color: #fff; background: var(--couleur-primaire); }
.espace-envoyer:disabled { background: var(--couleur-primaire-fonce); cursor: default; }

/* À l'ouverture du lien d'installation : un titre, un bouton de 64 px au doigt, rien d'autre. */
.installer-tablette { max-width: 32em; margin: 0 auto; padding: 48px 0; text-align: center; }
.installer-tablette h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 32px; }
.installer-tablette p { margin: 24px 0; }
.installer-tablette .bouton-tablette {
    min-height: 64px; padding: 0 32px; font: inherit; font-size: 1.4rem; font-weight: 700;
    color: #fff; background: var(--couleur-primaire); border: 0; border-radius: 16px; cursor: pointer;
}

/* L'aide à installer (spec PWA 3.5) : une bande discrète tout en bas de l'accueil, après les gros boutons, à 20 px au
   moins. Cachée dans le HTML (hidden), montrée par le script seulement s'il y a lieu. */
.installation { margin: 24px 0 0; padding: 12px 16px; font-size: 20px; line-height: 1.4; color: #4a575d; border-top: 1px solid #d5dde0; text-align: center; }
.installation[hidden], .installation [hidden] { display: none; }
.installation p { margin: 0 0 8px; }
.installation-bouton, .installation-masquer {
    min-height: 48px; margin: 4px 6px 0; padding: 0 20px; font: inherit; font-size: 20px; font-weight: 700;
    color: var(--couleur-texte); background: var(--couleur-secondaire); border: 0; border-radius: 12px; cursor: pointer;
}
.installation-bouton { color: #fff; background: var(--couleur-primaire); }

/* « Cette tablette n'est pas reconnue. » : une page calme, sans bouton de l'espace. */
.non-reconnue { text-align: center; margin: 12vh 0; }
.non-reconnue h1 { font-size: 2rem; }
.non-reconnue p { font-size: 1.2rem; }
.non-reconnue-fiche { color: #4a575d; font-size: 20px; }
