/* Compléments au design. styles.css (maquette) reste la référence et n'est pas modifié :
   ici, seulement des classes nouvelles et des ajustements téléphone/tablette, avec les mêmes variables. */

/* Connexion : choix de l'espace Parents / Enfants */
.espaces { display: flex; gap: 4px; padding: 4px; background: var(--survol); border-radius: var(--r-m); }
.espaces a { flex: 1 1 0; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-s); color: var(--texte-2); font-weight: 600; font-size: 15px; text-decoration: none; }
.espaces a:hover { color: var(--encre); }
.espaces a[aria-current="page"] { background: var(--surface); color: var(--encre); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.input--pin { font-size: 24px; letter-spacing: 0.4em; text-align: center; }
.connexion__form-zone { flex-direction: column; gap: 16px; }
.vignettes-enfants { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.vignette-enfant { min-height: 120px; padding: 16px 8px; border: 1px solid var(--bordure); border-radius: var(--r-l); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--encre); font-family: var(--f-titre); font-weight: 600; font-size: 18px; text-decoration: none; text-align: center; overflow-wrap: anywhere; }
.vignette-enfant:hover { border-color: var(--primaire); background: var(--primaire-pale); color: var(--encre); }
.vignette-enfant__lien { font-family: var(--f-texte); font-weight: 500; font-size: 13px; color: var(--texte-3); margin-top: -6px; }
.vignette-enfant .avatar--l { width: 56px; height: 56px; font-size: 22px; }
.profil-choisi { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.profil-choisi strong { font-family: var(--f-titre); font-size: 20px; }
.profil-choisi a { margin-left: auto; font-size: 14px; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.oublier-appareil .btn { font-size: 14px; }

/* Messages et formulaires (administration, demande de compte) */
.message-ok { background: var(--t-vert); color: var(--t-vert-txt); border-radius: var(--r-m); padding: 12px 14px; font-size: 14px; font-weight: 500; }
textarea.input { height: auto; min-height: 180px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.formulaire { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.formulaire__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.aide-champ { font-size: 13px; color: var(--texte-3); }
.case { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; font-size: 15px; color: var(--texte-2); cursor: pointer; }
.case input { width: 20px; height: 20px; accent-color: var(--primaire); }
.apercu-image { width: 160px; max-width: 100%; border-radius: var(--r-m); border: 1px solid var(--bordure); }
.actions-ligne { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.actions-ligne form { margin: 0; }
.btn--danger { background: var(--surface); color: var(--t-corail-txt); border-color: var(--t-corail); }
.btn--danger:hover { background: var(--t-corail); color: var(--t-corail-txt); }
.vide { padding: 28px 20px; text-align: center; color: var(--texte-3); }
.nuancier input[type="color"] { position: static; opacity: 1; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }

/* Les textes .sr-only (position absolue) d'un tableau qui défile restent dans sa zone */
.defilement-x { position: relative; }

/* Menu de l'admin : peut rétrécir (sinon sa ligne de liens défilante élargit la page) */
.admin__menu, .admin__nav { min-width: 0; }

/* Discussion : le fil défile à l'intérieur de sa carte ; bouton retour visible seulement sur téléphone */
.fil { height: min(78vh, 760px); }
.fil__retour { display: none; }
.composeur__fichier { margin: 0; padding: 0 16px 12px; font-size: 13px; }
.msg__photo { cursor: zoom-in; }

/* Tablette */
@media (min-width: 701px) and (max-width: 1024px) {
  .entete__inner, .page { padding-left: 24px; padding-right: 24px; }
  .admin { flex-wrap: nowrap; }
  .admin__menu { flex: 0 0 220px; }
  .admin__contenu { flex: 1 1 auto; padding: 28px 24px 48px; }
}

/* Téléphone */
@media (max-width: 700px) {
  .entete__inner { padding: 10px 16px; gap: 8px; }
  .entete__gauche { width: 100%; gap: 8px; }
  .nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex-shrink: 0; white-space: nowrap; }
  .utilisateur { width: 100%; justify-content: space-between; gap: 8px; }
  .utilisateur .btn__texte { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .utilisateur form .btn { width: 44px; padding: 0; }
  .page { padding: 28px 16px 48px; gap: 40px; }
  .admin__menu { padding: 14px 16px; gap: 12px; }
  .admin__nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .admin__nav a { flex-shrink: 0; white-space: nowrap; }
  .admin__retour { margin-top: 0; }
  .admin__tete h1 { font-size: 30px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat strong { font-size: 26px; }
  .formulaire { padding: 18px 16px; }
  /* Discussion : la liste OU le fil ouvert */
  .discussion__main--fil .conversations, .discussion__main--liste .fil { display: none; }
  .fil { height: calc(100dvh - 190px); min-height: 420px; }
  .fil__retour { display: inline-flex; }
  .fil__tete { padding: 12px 14px; }
  .fil__messages { padding: 16px 12px; }
  .composeur { padding: 10px; gap: 8px; }
  .composeur .btn--grand { min-height: 44px; width: 44px; padding: 0; }
  .composeur .btn__texte { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Éditeur Mémorizzo (admin) — repris tel quel de design/portail-famille/admin-memorizzo.html */
.bloc { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.bloc h2 { font-weight: 600; font-size: 22px; }
.ligne { display: flex; flex-wrap: wrap; gap: 20px; }
.ligne > .champ { flex: 1 1 220px; min-width: 0; }
.niveaux { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.niveau { border: 1px solid var(--bordure); border-radius: var(--r-l); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.niveau__ligne { display: flex; gap: 10px; }
.niveau__ligne .champ { flex: 1 1 0; min-width: 0; }
.aide { font-size: 14px; color: var(--texte-3); }
.alerte { font-size: 14px; font-weight: 600; color: var(--t-corail-txt); }

.cartes-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.carte-ed { border: 1px solid var(--bordure); border-radius: var(--r-l); padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.carte-ed__apercu { aspect-ratio: 4/3; border-radius: 14px; border: 2px solid var(--bordure); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.carte-ed__apercu svg { width: 55%; height: 55%; }
.carte-ed__apercu img { width: 100%; height: 100%; object-fit: cover; }
.carte-ed__ligne { display: flex; gap: 8px; align-items: flex-end; }
.carte-ed__ligne .champ { flex: 1 1 auto; min-width: 0; }
.carte-ed select.input { padding-right: 8px; }
.couleur { width: 48px; height: 48px; padding: 4px; border: 1px solid var(--bordure-forte); border-radius: var(--r-m); background: var(--surface); cursor: pointer; flex-shrink: 0; }
.onglets { display: flex; background: var(--survol); border-radius: var(--r-m); padding: 3px; gap: 3px; }
.onglets button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font: 600 14px var(--f-texte); color: var(--texte-2); cursor: pointer; }
.onglets button[aria-pressed="true"] { background: var(--surface); color: var(--encre); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.fichier { position: relative; }
.fichier input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.barre-actions { position: sticky; bottom: 0; background: var(--fond); padding: 16px 0; display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; align-items: center; border-top: 1px solid var(--bordure); }
.statut { margin-right: auto; font-size: 14px; font-weight: 600; }
.statut--ok { color: var(--t-vert-txt); }
.statut--erreur { color: var(--t-corail-txt); }

/* Mémorizzo : aperçu d'un thème dans une pastille (liste des thèmes de l'admin) */
.avatar svg { width: 72%; height: 72%; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Mon compte */
.infos-compte { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px 24px; margin: 0; }
.infos-compte dt { font-size: 13px; font-weight: 600; color: var(--texte-3); }
.infos-compte dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.utilisateur__nom[aria-current="page"] { color: var(--encre); font-weight: 600; }

/* Page Jeux : cartes plus petites, pour voir et choisir les jeux d'un coup d'œil */
.grille-jeux { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.grille-jeux .jeu__vignette { height: 96px; }
.grille-jeux .jeu__corps { padding: 12px 14px 14px; gap: 4px; }
.grille-jeux .jeu__corps h3 { font-size: 16px; }
.grille-jeux .jeu__corps p { font-size: 13px; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grille-jeux .jeu .btn { min-height: 44px; }

/* Bouton « menu » : seulement sur téléphone, quand menu.js l'a branché */
.menu-bouton { display: none; }
.admin__menu-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Personnalisation : le choix du logo et le nuancier passent à la ligne au lieu de déborder */
.perso__champs > .champ { min-width: 0; max-width: 100%; }
.perso__logo { flex-wrap: wrap; min-width: 0; }
.perso__logo input[type="file"] { min-width: 0; max-width: 100%; }
.nuancier__choix { flex-wrap: wrap; }

@media (max-width: 700px) {
  /* En-tête : logo + bouton menu ; liens et compte dans le menu déplié */
  .menu-replie .menu-bouton { display: inline-flex; margin-left: auto; }
  .menu-bouton__fermer, .menu-ouvert .menu-bouton__ouvrir { display: none; }
  .menu-ouvert .menu-bouton__fermer { display: block; }
  .entete__gauche { flex-wrap: wrap; }
  .menu-replie:not(.menu-ouvert) .nav,
  .menu-replie:not(.menu-ouvert) .utilisateur,
  .menu-replie:not(.menu-ouvert) .admin__nav,
  .menu-replie:not(.menu-ouvert) .admin__retour { display: none; }
  .menu-ouvert .nav, .menu-ouvert .admin__nav { flex-direction: column; flex-wrap: nowrap; overflow: visible; gap: 2px; }
  .menu-ouvert .nav a, .menu-ouvert .admin__nav a { width: 100%; }
  .menu-ouvert .utilisateur { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; border-top: 1px solid var(--bordure); }
  .menu-ouvert .utilisateur .btn { width: 100%; justify-content: center; }
  .menu-ouvert .utilisateur .btn__texte { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .menu-ouvert .utilisateur form .btn { width: 100%; padding: 0 20px; }
  .admin__menu.menu-replie { gap: 0; }
  .admin__menu.menu-ouvert { gap: 12px; }
  .utilisateur__nom { min-width: 0; }
  .utilisateur__prenom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Tableaux de l'administration : une carte par ligne au lieu de colonnes coupées */
  .tableau-empile { overflow: visible; }
  .tableau-empile table { min-width: 0; }
  .tableau-empile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tableau-empile tbody { display: block; }
  .tableau-empile tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--survol); }
  .tableau-empile tr:last-child { border-bottom: 0; }
  .tableau-empile td { display: block; grid-column: 1 / -1; padding: 0; border: 0; font-size: 14px; max-width: none !important; min-width: 0; overflow-wrap: anywhere; }
  .tableau-empile td:first-child { grid-column: 1; font-size: 15px; }
  .tableau-empile td.td-actions { grid-column: 2; grid-row: 1; text-align: right; }
  .tableau-empile td.td-actions--large { grid-column: 1 / -1; grid-row: auto; }
  .tableau-empile td.td-actions--large .actions-ligne { justify-content: flex-start; }
  .tableau-empile td[data-titre]::before { content: attr(data-titre) " : "; color: var(--texte-3); font-weight: 500; }

  /* Jeux : deux cartes par ligne */
  .grille-jeux { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grille-jeux .jeu__vignette { height: 76px; }
  .grille-jeux .jeu__vignette span { font-size: 34px !important; }
  .grille-jeux .jeu__corps { padding: 10px 12px 12px; }
  .grille-jeux .jeu__corps h3 { font-size: 15px; }
  .grille-jeux .jeu .btn { align-self: stretch; justify-content: center; padding: 0 12px; }
}
