/* EnfinLire · Bibliothèques des supports — référence Cartes à pince.
   Seules les vignettes de la bibliothèque sont affectées, jamais les cartes imprimées,
   les miniatures de navigation des blocs ni les ressources des jeux autonomes.
   Carte carrée identique 70 × 70 px à 100 % de zoom navigateur ; image entière conservée.
   Le volet de ressources est commun aux sept éditeurs de supports.
   Règle 7 : un seul défilement vertical pour tout le panneau gauche. */
:root {
  --ef-library-width:270px;
  --ef-parameters-width:clamp(320px,24vw,390px);
  --ef-activity-gap:12px;
  --ef-activity-radius:22px;
  --ef-rail-width:50px;
  --ef-rail-button:40px;
  --ef-library-tile:70px;
  --ef-library-gap:6px;
}
/* En largeur intermédiaire, même réduction que le Memory historique,
   appliquée à toutes les activités pour préserver l'aperçu central. */
@media (min-width:801px) and (max-width:1050px) {
  :root { --ef-library-width:230px; --ef-parameters-width:325px; }
}
.ef-resource-gallery {
  display:grid;
  grid-template-columns:repeat(auto-fill,var(--ef-library-tile));
  grid-auto-rows:var(--ef-library-tile);
  align-content:start;
  justify-content:start;
  gap:var(--ef-library-gap);
  min-width:0;
  min-height:0;
  max-width:100%;
  flex:none;
  overflow:visible;
  padding:3px 2px 7px;
  box-sizing:border-box;
}
.ef-resource-gallery > button {
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:minmax(0,1fr) 18px;
  align-items:center;
  justify-items:center;
  width:var(--ef-library-tile);
  height:var(--ef-library-tile);
  aspect-ratio:1 / 1;
  min-width:0;
  min-height:0;
  box-sizing:border-box;
  background:#fff;
  color:#415c70;
  border:1px solid #e7e0d5;
  border-radius:10px;
  padding:4px 3px 3px;
  gap:2px;
  cursor:pointer;
  overflow:hidden;
  font:inherit;
}
.ef-resource-gallery > button:hover {
  background:#fff9e7;
  border-color:#d3a620;
}
.ef-resource-gallery > button:focus-visible {
  outline:2px solid #2686bd;
  outline-offset:1px;
}
.ef-resource-gallery > button > img {
  display:block;
  min-width:0;
  min-height:0;
  width:100%;
  height:100%;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  object-position:center;
}
.ef-resource-gallery > button > :is(span,small) {
  display:block;
  align-self:center;
  width:100%;
  max-width:100%;
  height:auto;
  max-height:18px;
  overflow:hidden;
  text-align:center;
  font:400 9px/10px 'Lexend',sans-serif;
  color:#415c70;
  overflow-wrap:anywhere;
  white-space:normal;
  word-break:normal;
  text-overflow:clip;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
/* Les pastilles de sélection restent fournies par chaque outil. */
.ef-resource-gallery > button > :is(.tri-resource-check,.chg-check-mark,.den-tick,.sui-tick) {
  position:absolute;
  top:3px;
  right:3px;
  width:19px;
  height:19px;
  min-height:19px;
  max-height:19px;
  border-radius:50%;
  background:#218454;
  color:#fff;
  display:grid;
  place-items:center;
  font-size:13px;
  line-height:1;
  font-style:normal;
  font-weight:700;
  pointer-events:none;
}
.ef-resource-gallery > .gr-empty {
  grid-column:1/-1;
  padding:10px 3px;
  font-size:12px;
  color:#607689;
  text-align:center;
  margin:0;
}

/* Sélecteur commun des sources : 5 boutons compacts et accessibles.
   Le comportement des sources et de l'import reste celui de chaque outil. */
.ef-source-switcher {
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  justify-content:center;
  align-items:center;
  gap:4px;
  margin-bottom:10px;
  padding:2px 0;
  min-width:0;
  background:transparent;
}
.ef-source-switcher > button {
  appearance:none;
  box-sizing:border-box;
  display:grid;
  place-items:center;
  flex:none;
  width:100%;
  height:40px;
  min-width:0;
  min-height:40px;
  max-width:40px;
  justify-self:center;
  max-height:40px;
  padding:6px;
  border:1px solid #d5e1e7;
  border-radius:10px;
  background:#fff;
  color:#193a53;
  cursor:pointer;
  font:inherit;
}
.ef-source-switcher > button svg { display:block;width:22px;height:22px;pointer-events:none; }
.ef-source-switcher > button[aria-pressed="true"] {
  background:#ffca42;
  border-color:#d89c00;
  color:#15334b;
}
.ef-source-switcher > button:hover:not(:disabled) { border-color:#d89c00;background:#fff4cd; }
.ef-source-switcher > button[aria-pressed="true"]:hover {background:#ffca42;}
.ef-source-switcher > button:focus-visible {outline:2px solid #158dc6;outline-offset:2px;}
.ef-source-switcher > button:disabled {opacity:.35;cursor:not-allowed;}
/* La commande d'import migre dans le sixième bouton. L'input d'origine
   reste monté dans le DOM et conserve son traitement de fichier. */
.ef-source-switcher-ready .pin-library-import,
.ef-source-switcher-ready .mq-upload,
.ef-source-switcher-ready .chg-upload,
.ef-source-switcher-ready .den-upload,
.ef-source-switcher-ready .sui-upload,
.ef-source-switcher-ready .tri-upload,
.ef-source-switcher-ready #gr-upload-wrap {
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip-path:inset(50%)!important;
  white-space:nowrap!important;
  border:0!important;
}
.ef-source-switcher[hidden] { display:none!important; }

/* Règle 6 actualisée : palette de signes dans la même galerie, sans second scroll. */
.ef-resource-gallery > button.ef-sign-tile {
 display:grid;grid-template-rows:minmax(0,1fr) 18px;place-items:center;
 width:var(--ef-library-tile);height:var(--ef-library-tile);min-height:var(--ef-library-tile);padding:4px 2px 2px;
}
.ef-resource-gallery > button.ef-sign-tile > :is(svg,.ef-sign-glyph) {
 display:block;max-width:100%;max-height:100%;height:38px;width:42px;object-fit:contain;color:#193a53;
}
.ef-resource-gallery > button.ef-sign-tile > .ef-sign-glyph {display:grid;place-items:center;font:700 30px/1 Arial,sans-serif;}
.ef-source-switcher > button.ef-source-signs:disabled {opacity:.35;cursor:not-allowed;}
/* La palette des suites se trouve désormais dans la bibliothèque gauche ; les couleurs restent à droite. */
.ef-source-switcher-ready #view-suites #sui-sign-picker #sui-signs {display:none!important;}

/* Bibliothèque canonique : présentation de Cartes à pince réutilisée par les jeux.
   Une seule zone de défilement par volet ; aucun dimensionnement propre à Loto/Lab/Puzzle. */
.ef-library-heading {display:flex;align-items:center;justify-content:space-between;gap:5px;min-height:33px;flex:none;padding-right:36px}
.ef-library-heading h2 {font-size:clamp(13px,1.25vw,18px);font-weight:700;line-height:1.2;margin:0;letter-spacing:-.02em}
.ef-library-body {display:flex;flex:1 1 auto;min-height:0;flex-direction:column;gap:9px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-right:0}
.pin-library-body h3,.ef-library-body h3 {font-size:14px;letter-spacing:-.02em;line-height:1.3;margin:6px 0 2px}
:is(.pin-library-card,.ef-library-card) {border:1px solid #eee2d0;border-radius:17px;background:#fffdf9;padding:6px;display:grid;gap:9px;min-width:0;align-content:start}
:is(.pin-field,.ef-library-field) {display:grid;gap:5px;min-width:0;margin:4px 0 9px}
:is(.pin-field,.ef-library-field) > :is(label,span) {font-size:11px;font-weight:700;color:#667689}
:is(.pin-field,.ef-library-field) :is(input[type="text"],input[type="search"],select) {
  font:inherit;font-size:12px;color:#163149;border-radius:13px;border:1px solid #e8dfd0;
  background:#fff;padding:9px 11px;min-width:0;width:100%;height:40px;box-sizing:border-box;
}
:is(.pin-field,.ef-library-field) :is(input,select):focus-visible {outline:2px solid #b18a31;outline-offset:2px}
:is(.pin-library-card,.ef-library-card) > .ef-source-switcher {grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin-bottom:0}
.ef-library-card .ef-library-notice {font-size:11px;line-height:1.4;color:#627488;margin:0}
.ef-library-field[hidden],.ef-library-card[hidden],.ef-library-body[hidden] {display:none!important}

.pin-field input[type=file]{width:100%;max-width:100%;font-size:10px}
.pin-field select{cursor:pointer}

.ef-library-story-empty {font:500 12px/1.4 'Lexend',sans-serif;color:#173954;
 border:1px solid #e8dfd0;border-radius:12px;background:#fff;padding:10px 11px;margin:0}
.ef-library-story-empty[hidden] {display:none!important}
