/* outils.css — l'espace Outils. UNE GRAMMAIRE pour tous les outils
   (vues/outils/commun.js) :
   - L'ACCUEIL : les outils en tuiles, en deux familles ;
   - LA FEUILLE d'un outil (.o-outil) : une carte, sa LIGNE DE RÉGLAGES
     (.o-reglages : puces, segments, compteurs nommés, options, gestes, et ce
     qui se pousse à droite), puis sa SCÈNE ;
   - LA SCÈNE (.o-scene) : ce qu'on montre au tableau. En plein écran
     (:fullscreen) ou couvrant la page (.o-scene-couvre, sans l'API) : son
     titre paraît, le rond de sortie aussi, tout grandit, et ce qui se touche
     se fige (les menus ne s'ouvriraient pas par-dessus).
   Ce qui se reprend de la Classe : .c-deux-colonnes, .c-liste, .c-tableau,
   .c-case et les pastilles ([data-pastille], base.css). Le temps est à
   l'abricot (--maintenant), le jugement en vert, jaune, rouge (--ok,
   --avert, --danger), comme les pastilles. En pied : les feuilles imprimées. */

.o-page { flex: 1; width: 100%; padding: 0 var(--gouttiere) 32px; display: flex; flex-direction: column; gap: 12px; }

/* ————— l'accueil ————— */
.o-accueil { display: flex; flex-direction: column; gap: 22px; }
.o-famille { display: flex; flex-direction: column; gap: 10px; }
.o-famille > .section-titre { padding: 0 4px; }
.o-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.o-tuile {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px;
  border: 1px solid var(--trait); border-radius: var(--rayon-l); background: var(--feuille); box-shadow: var(--ombre-feuille);
  color: var(--encre); text-decoration: none;
}
.o-tuile:hover { border-color: var(--trait-fort); }
.o-tuile:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.o-tuile-nom { flex: 1; min-width: 0; font-weight: 700; }
.o-tuile-meta { flex: none; padding: 1px 9px; border-radius: 999px; background: var(--creux); color: var(--encre-2); font-size: 12.5px; font-weight: 700; }

/* ————— la feuille d'un outil et sa ligne de réglages ————— */
.o-outil { display: flex; flex-direction: column; gap: 14px; padding: 12px 14px 16px; min-width: 0; }
.o-outil.o-etroit, .c-contenu.o-etroit { width: 100%; max-width: 760px; margin: 0 auto; }
/* la ligne de réglages : la tête de la feuille, comme toute tête de section
   (base.css .tete-section) — la craie, des contrôles de 32 px ; les présents
   (index.js) à droite */
.o-reglages {
  --h-ctrl: 32px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-height: 52px;
  margin: -12px -14px 0; padding: 8px 14px;
  background: var(--creux); border-bottom: 1px solid var(--trait); border-radius: var(--rayon-l) var(--rayon-l) 0 0;
}
.o-reglages:empty { display: none; }
.o-reglages .puce-reglage { height: 32px; max-width: 280px; font-size: 13px; }
.o-reglages .segments button { height: 26px; padding: 0 10px; font-size: 13px; }
.o-reglages .compteur .rond { width: 26px; height: 26px; }
.o-reglages .bouton { height: 32px; font-size: 13px; }
.o-reglages-tete { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.o-reglage { display: inline-flex; align-items: center; gap: 8px; }
.o-lib { font-size: 13px; font-weight: 700; color: var(--encre-3); }
.o-option { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-weight: 600; cursor: pointer; }
.o-droite { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--encre-3); white-space: nowrap; }
.o-droite:empty { display: none; }

/* ————— la scène ————— */
.o-scene { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.o-scene-tete { display: none; align-items: center; gap: 12px; }
.o-scene-titre { flex: 1; min-width: 0; font-family: var(--police-titre); font-size: 30px; font-weight: 700; font-synthesis: none; }
.o-scene:fullscreen, .o-scene.o-scene-couvre {
  position: relative; background: var(--feuille); padding: 24px 36px 32px; overflow: auto; gap: 24px; font-size: 1.25em;
}
.o-scene.o-scene-couvre { position: fixed; inset: 0; z-index: 60; padding-top: calc(20px + env(safe-area-inset-top)); }
.o-scene:fullscreen .o-scene-tete, .o-scene-couvre .o-scene-tete { display: flex; }
.o-scene:fullscreen :is(.o-eleve, .o-table, .o-allee, .o-resp-eleve, .o-carte-nom),
.o-scene-couvre :is(.o-eleve, .o-table, .o-allee, .o-resp-eleve, .o-carte-nom) { pointer-events: none; }
.o-scene:fullscreen :is(.o-resp-plus, .o-carte-tete .rond, .o-durees), .o-scene-couvre :is(.o-resp-plus, .o-carte-tete .rond, .o-durees) { display: none; }

/* des élèves en puces, qu'on touche pour les déplacer */
.o-eleves { display: flex; flex-wrap: wrap; gap: 5px; }
.o-eleve {
  display: inline-flex; align-items: center; min-height: 32px; padding: 3px 12px; border-radius: 999px;
  border: 1px solid var(--trait-fort); background: var(--feuille); color: var(--encre); font-weight: 650; font-size: 14px;
}
.o-eleve:hover { border-color: var(--encre-3); }
.o-eleve[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }

/* ————— des cartes : les groupes, les équipes ————— */
.o-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; align-items: start; }
.o-carte { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 12px; border-radius: var(--rayon-l); background: var(--creux); min-width: 0; }
.o-carte-tete { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.o-carte-nom {
  flex: 1; min-width: 0; height: 32px; padding: 0 6px; margin-left: -4px; border: 1px solid transparent; border-radius: var(--rayon-s);
  background: transparent; font-family: var(--police-titre); font-size: 16px; font-weight: 700; color: var(--encre); font-synthesis: none;
  display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
input.o-carte-nom:hover { border-color: var(--trait-fort); }
input.o-carte-nom:focus { outline: 2px solid var(--accent); background: var(--feuille); }
.o-carte-compte { flex: none; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--feuille); font-size: 12.5px; font-weight: 700; color: var(--encre-2); display: inline-flex; align-items: center; justify-content: center; }
.o-carte-a-part { background: none; border: 1px dashed var(--trait-fort); }
.o-scene:fullscreen .o-cartes, .o-scene-couvre .o-cartes { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.o-scene:fullscreen .o-carte-nom, .o-scene-couvre .o-carte-nom { font-size: 24px; height: 40px; }
.o-scene:fullscreen .o-eleve, .o-scene-couvre .o-eleve { font-size: 20px; min-height: 42px; padding: 4px 16px; }

/* les équipes et leurs points */
.o-equipe { align-items: stretch; }
.o-equipe[data-tete] { background: var(--accent-doux); }
.o-tete { flex: none; display: inline-flex; color: var(--accent-texte); }
.o-score { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.o-score .rond { width: 48px; height: 48px; background: var(--feuille); border: 1px solid var(--trait-fort); }
.o-score .rond:disabled { opacity: 0.4; }
.o-score-plus { color: var(--accent-texte); }
.o-score-valeur { flex: 1; text-align: center; font-family: var(--police-titre); font-weight: 700; font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--encre); }
.o-equipe-eleves { font-size: 13px; color: var(--encre-2); line-height: 1.4; }
.o-scene:fullscreen .o-score-valeur, .o-scene-couvre .o-score-valeur { font-size: 88px; }
.o-scene:fullscreen .o-score .rond, .o-scene-couvre .o-score .rond { width: 64px; height: 64px; }
.o-scene:fullscreen .o-equipe-eleves, .o-scene-couvre .o-equipe-eleves { font-size: 18px; }

/* ————— le plan de classe ————— */
.o-tableau-noir {
  align-self: center; width: min(60%, 420px); padding: 6px 0; border-radius: var(--rayon-m);
  background: var(--creux-2); color: var(--encre-2); font-family: var(--police-titre); font-weight: 700; text-align: center;
}
.o-salle-boite { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.o-salle { display: grid; grid-template-columns: repeat(var(--colonnes), minmax(64px, 1fr)); gap: 8px; }
.o-table, .o-allee { min-height: 52px; padding: 4px; border-radius: var(--rayon-m); display: flex; align-items: center; justify-content: center; text-align: center; }
.o-table { border: 1px solid var(--trait-fort); background: var(--feuille); color: var(--encre); font-weight: 700; font-size: 14px; }
.o-table:hover { border-color: var(--encre-3); }
.o-table[data-libre] { border-style: dashed; background: var(--creux); }
.o-table[data-main] { border-color: var(--accent); background: var(--accent-doux); }
.o-allee { border: 1px dashed transparent; background: none; }
.o-allee:hover { border-color: var(--trait-fort); }
.o-table-nom { overflow: hidden; overflow-wrap: anywhere; line-height: 1.2; }
.o-scene-plan[data-main] .o-table:not([data-main]):hover { border-color: var(--accent); background: var(--accent-doux); }
.o-debout { padding-top: 12px; border-top: 1px solid var(--trait); }
.o-scene:fullscreen .o-table, .o-scene-couvre .o-table { min-height: 80px; font-size: 20px; }

/* ————— les responsabilités ————— */
.o-resps { display: flex; flex-direction: column; }
.o-resp { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 0; border-bottom: 1px solid var(--trait); }
.o-resp:last-child { border-bottom: none; }
.o-resp-nom { flex: 1 1 40%; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.o-resp-eleve { flex: 1 1 45%; margin-left: 0; justify-content: space-between; min-width: 0; }
.o-resp-eleve.vide { color: var(--encre-3); font-weight: 600; }
.o-resp-eleve:hover { background: var(--creux); }
.o-scene:fullscreen .o-resp, .o-scene-couvre .o-resp { min-height: 64px; font-size: 24px; }
.o-scene:fullscreen .o-resp-eleve, .o-scene-couvre .o-resp-eleve { font-size: 24px; height: 48px; }
.o-scene:fullscreen .o-resp-eleve svg, .o-scene-couvre .o-resp-eleve svg { display: none; }

/* ————— ce qui se lit au centre : tirage, minuteur, sonomètre, date ————— */
.o-scene-tirage, .o-scene-minuteur, .o-scene-son, .o-scene-date { align-items: center; text-align: center; }
.o-scene-tirage .o-scene-tete, .o-scene-minuteur .o-scene-tete, .o-scene-son .o-scene-tete, .o-scene-date .o-scene-tete { align-self: stretch; text-align: left; }
.o-scene:fullscreen:is(.o-scene-tirage, .o-scene-minuteur, .o-scene-son, .o-scene-date), .o-scene-couvre:is(.o-scene-tirage, .o-scene-minuteur, .o-scene-son, .o-scene-date) { justify-content: center; }
.o-scene:fullscreen:is(.o-scene-tirage, .o-scene-minuteur, .o-scene-son, .o-scene-date) .o-scene-tete,
.o-scene-couvre:is(.o-scene-tirage, .o-scene-minuteur, .o-scene-son, .o-scene-date) .o-scene-tete { position: absolute; top: 20px; left: 36px; right: 24px; }

/* le tirage au sort */
.o-tirage-centre { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 0 6px; }
.o-tire {
  font-family: var(--police-titre); font-weight: 700; font-synthesis: none; line-height: 1.05;
  font-size: clamp(48px, 9vw, 112px); color: var(--encre); min-height: 1.1em; overflow-wrap: anywhere;
}
.o-tire[data-vide]::before { content: '?'; color: var(--trait-fort); }
.o-tire.o-defile { color: var(--encre-3); }
.o-tire-sous { min-height: 1.3em; font-size: 17px; color: var(--encre-2); }
.o-tirer { margin-top: 10px; min-width: 200px; }
.o-sortis { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 720px; }
.o-sortis:empty { display: none; }
.o-sorti { padding: 2px 10px; border-radius: 999px; background: var(--creux); color: var(--encre-2); font-size: 13px; font-weight: 600; }
.o-scene:fullscreen .o-tire, .o-scene-couvre .o-tire { font-size: clamp(72px, 14vw, 220px); }
.o-scene:fullscreen .bouton.grand, .o-scene-couvre .bouton.grand { height: 60px; padding: 0 32px; font-size: 20px; }
.o-scene:focus { outline: none; }

/* le minuteur */
.o-horloge { position: relative; width: min(320px, 72vw); aspect-ratio: 1; margin: 4px auto 0; }
.o-cadran { width: 100%; height: 100%; transform: rotate(-90deg); }
.o-cadran-fond { fill: var(--maintenant-doux); stroke: var(--creux-2); stroke-width: 14; }
.o-cadran-arc { fill: none; stroke: var(--maintenant); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 0.2s linear; }
.o-temps {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--police-titre); font-weight: 700; font-synthesis: none; font-variant-numeric: tabular-nums;
  font-size: clamp(44px, 12vw, 80px); color: var(--encre);
}
.o-scene-minuteur[data-fini] .o-horloge { animation: o-clignote 0.9s ease-in-out 4; }
.o-scene-minuteur[data-fini] .o-temps { color: var(--maintenant-texte); }
@keyframes o-clignote { 50% { opacity: 0.35; } }
.o-durees { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; max-width: 560px; }
.o-durees[hidden] { display: none; }
.o-minuteur-gestes { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.o-minuteur-gestes .bouton { min-width: 150px; }
.o-scene:fullscreen .o-horloge, .o-scene-couvre .o-horloge { width: min(62vh, 86vw); }
.o-scene:fullscreen .o-temps, .o-scene-couvre .o-temps { font-size: min(16vh, 20vw); }

/* le sonomètre : la jauge et son mot, aux couleurs du jugement */
.o-son { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 620px; padding: 18px 0 4px; }
.o-son-mot:empty { display: none; }
.o-son-mot { font-family: var(--police-titre); font-weight: 700; font-synthesis: none; font-size: clamp(36px, 7vw, 64px); line-height: 1.1; color: var(--encre-3); }
.o-jauge { position: relative; width: 100%; height: 34px; border-radius: 999px; background: var(--creux-2); overflow: hidden; }
.o-jauge-niveau { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: var(--encre-3); transition: width 0.08s linear; }
.o-jauge-seuil { position: absolute; top: 4px; bottom: 4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--encre); opacity: 0.55; }
.o-scene-son[data-son='calme'] .o-jauge-niveau { background: var(--ok); }
.o-scene-son[data-son='calme'] .o-son-mot { color: var(--ok); }
.o-scene-son[data-son='attention'] .o-jauge-niveau { background: var(--avert); }
.o-scene-son[data-son='attention'] .o-son-mot { color: var(--avert); }
.o-scene-son[data-son='fort'] .o-jauge-niveau { background: var(--danger); }
.o-scene-son[data-son='fort'] .o-son-mot { color: var(--danger); }
.o-scene:fullscreen.o-scene-son[data-son='fort'], .o-scene-couvre.o-scene-son[data-son='fort'] { background: var(--danger-doux); }
.o-scene:fullscreen .o-son, .o-scene-couvre .o-son { max-width: 1000px; }
.o-scene:fullscreen .o-jauge, .o-scene-couvre .o-jauge { height: 64px; }
.o-scene:fullscreen .o-son-mot, .o-scene-couvre .o-son-mot { font-size: clamp(64px, 12vw, 150px); }

/* la date du jour */
.o-date { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 0 4px; }
.o-date-jour { font-family: var(--police-titre); font-weight: 700; font-synthesis: none; font-size: clamp(48px, 10vw, 104px); line-height: 1; color: var(--encre); }
.o-date-date { font-family: var(--police-titre); font-weight: 600; font-synthesis: none; font-size: clamp(24px, 4.5vw, 44px); color: var(--encre-2); }
.o-scene-date:not([data-capitales]) .o-date-jour::first-letter { text-transform: uppercase; }
.o-scene-date[data-capitales] :is(.o-date-jour, .o-date-date, .o-date-voisins span:last-child) { text-transform: uppercase; }
.o-date-voisins { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 28px; font-size: 16px; color: var(--encre-2); }
.o-date-voisins p { display: inline-flex; align-items: baseline; gap: 8px; }
.o-date-reperes { padding: 3px 14px; border-radius: 999px; background: var(--maintenant-doux); color: var(--maintenant-texte); font-size: 14px; font-weight: 700; }
.o-scene:fullscreen .o-date-jour, .o-scene-couvre .o-date-jour { font-size: clamp(80px, 16vw, 200px); }
.o-scene:fullscreen .o-date-date, .o-scene-couvre .o-date-date { font-size: clamp(36px, 7vw, 84px); }
.o-scene:fullscreen .o-date-voisins, .o-scene-couvre .o-date-voisins { font-size: 26px; }

/* la journée au tableau : un agenda, le moment en cours à l'abricot */
.o-jours { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.o-jour { padding: 0 6px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-moments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.o-moment { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 12px; border-radius: var(--rayon-m); }
.o-moment-heure { font-family: var(--police-titre); font-weight: 600; font-size: 17px; color: var(--encre-2); font-variant-numeric: tabular-nums; padding-top: 1px; }
.o-moment-blocs { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.o-moment-bloc { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.o-moment-titre { font-family: var(--police-titre); font-weight: 700; font-size: 20px; line-height: 1.2; color: var(--encre); overflow-wrap: anywhere; }
.o-moment-domaine { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--encre-3); }
.o-pause { background: var(--creux); }
.o-pause .o-moment-titre { font-size: 16px; color: var(--encre-2); }
.o-moment[data-etat='en-cours'] { background: var(--maintenant-doux); }
.o-moment[data-etat='en-cours'] .o-moment-heure { color: var(--maintenant-texte); }
.o-moment[data-etat='passe'] { opacity: 0.45; }
.o-scene-journee[data-sans-heures] .o-moment { grid-template-columns: minmax(0, 1fr); }
.o-scene-journee[data-sans-heures] .o-moment-heure { display: none; }
.o-scene:fullscreen .o-moment, .o-scene-couvre .o-moment { grid-template-columns: 120px minmax(0, 1fr); padding: 14px 18px; }
.o-scene:fullscreen .o-moment-heure, .o-scene-couvre .o-moment-heure { font-size: 28px; }
.o-scene:fullscreen .o-moment-titre, .o-scene-couvre .o-moment-titre { font-size: 34px; }
.o-scene:fullscreen .o-moment-domaine, .o-scene-couvre .o-moment-domaine { font-size: 20px; }

@media (prefers-reduced-motion: reduce) {
  .o-cadran-arc, .o-jauge-niveau { transition: none; }
  .o-scene-minuteur[data-fini] .o-horloge { animation: none; }
}

/* ————— écrans étroits ————— */
@media (max-width: 899px) {
  .o-page { padding: 10px 8px 96px; }
}
@media (max-width: 599px) {
  .o-page { padding: 12px 12px 110px; gap: 10px; }
  .o-tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .o-tuile { position: relative; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 92px; padding: 12px; }
  .o-tuile-meta { position: absolute; top: 10px; right: 10px; }
  .o-outil { padding: 10px 10px 14px; gap: 12px; }
  .o-reglages { gap: 8px; }
  .o-reglages > .bouton { flex: 1 1 auto; }
  .o-droite { margin-left: 0; flex-basis: 100%; }
  .o-cartes { grid-template-columns: minmax(0, 1fr); }
  .o-salle { gap: 4px; grid-template-columns: repeat(var(--colonnes), minmax(48px, 1fr)); }
  .o-table, .o-allee { min-height: 46px; padding: 3px; font-size: 11.5px; }
  .o-table-nom { white-space: nowrap; text-overflow: ellipsis; overflow-wrap: normal; max-width: 100%; }
  .o-durees .puce { min-height: 40px; }
  .o-moment { grid-template-columns: 56px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .o-moment-titre { font-size: 17px; }
  .o-minuteur-gestes .bouton { flex: 1 1 140px; min-width: 0; }
  .o-equipes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .o-score { gap: 2px; }
  .o-score .rond { width: 44px; height: 44px; }
  .o-score-valeur { font-size: 36px; }
}

/* ————— les feuilles imprimées des outils ————— */
.ic-page .ic-groupes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; }
.ic-page .ic-groupe-carte { border: 0.8pt solid currentColor; border-radius: 3mm; padding: 3mm 4mm; break-inside: avoid; }
.ic-page .ic-groupe-carte h2 { font-family: var(--police-titre); font-size: 13pt; font-weight: 600; margin: 0 0 2mm; }
.ic-page .ic-groupe-carte ol { margin: 0; padding-left: 5mm; font-size: 11pt; line-height: 1.5; }
.ic-page .ic-tableau-noir { width: 50%; margin: 0 auto 6mm; padding: 2mm 0; border: 1pt solid currentColor; text-align: center; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; font-size: 9pt; }
.ic-page .ic-plan { border-collapse: separate; border-spacing: 3mm; table-layout: fixed; }
.ic-page .ic-plan td { height: 18mm; text-align: center; vertical-align: middle; border-radius: 2mm; }
.ic-page .ic-plan td.ic-allee { border: none; }
.ic-page .ic-place b { display: block; font-size: 12pt; }
.ic-page .ic-place span { display: block; font-size: 8.5pt; }
.ic-page .ic-resp th { width: 45%; font-size: 13pt; }
.ic-page .ic-resp td { font-size: 13pt; }
.ic-page .ic-suivi thead .ic-col { font-size: 8.5pt; vertical-align: bottom; }
.ic-page .ic-suivi td.ic-col small { text-align: center; font-size: 7pt; }
