/* Feuille de styles de TBScreen : socle, barres, fenêtres et widgets */

/* Couleurs et réglages communs à toute l'application */
:root {
  --barre-fond: #1f2a37;
  --barre-texte: #f1f5f9;
  --barre-survol: #334155;
  --accent: #2a9d8f;
  --zone-fond: #111827;
  --fenetre-fond: #ffffff;
  --fenetre-entete: #264653;
  --fenetre-entete-texte: #ffffff;
  --texte: #1f2937;
  --ombre: 0 8px 24px rgba(0, 0, 0, .25);
  --rayon: 10px;
  font-family: system-ui, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
}

/* Mise en page générale : barre en haut, scène au centre, écrans en bas */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--zone-fond); color: var(--texte); }
body { display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* Barre d'outils supérieure */
.barre { display: flex; align-items: center; gap: .4rem; padding: .35rem .6rem; background: var(--barre-fond); color: var(--barre-texte); flex-wrap: wrap; position: relative; z-index: 10; }
.marque { font-weight: 800; letter-spacing: .03em; margin-right: .6rem; font-size: 1.1rem; }
.marque span { color: var(--accent); }
/* Numéro de version, discret, à côté du titre */
.version { font-size: .72rem; opacity: .55; margin: .35rem .8rem 0 -.5rem; align-self: flex-start; font-variant-numeric: tabular-nums; }
.barre button { background: transparent; color: inherit; border: 1px solid transparent; border-radius: 6px; padding: .35rem .6rem; }
.barre button:hover { background: var(--barre-survol); }
.barre button[aria-pressed="true"] { background: var(--accent); }
.groupe { position: relative; display: flex; align-items: center; gap: .2rem; }
.espace { flex: 1; }
.etat-sauvegarde { font-size: .8rem; opacity: .7; }
.separateur { width: 1px; align-self: stretch; background: #475569; margin: 0 .3rem; }

/* Menus déroulants de la barre */
.menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px; background: #fff; color: var(--texte); border-radius: 8px; box-shadow: var(--ombre); padding: .4rem; display: flex; flex-direction: column; gap: .15rem; z-index: 20; }
.menu.droite { left: auto; right: 0; }
.barre .menu button { color: var(--texte); text-align: left; display: flex; gap: .6rem; align-items: center; }
.barre .menu button:hover { background: #eef2f7; }
.barre .menu button[aria-pressed="true"] { background: #d1fae5; }
.titre-menu { font-size: .75rem; text-transform: uppercase; opacity: .6; padding: .4rem .5rem 0; }

/* Pastilles de couleur (fond et dessin) */
.nuancier { display: flex; flex-wrap: wrap; gap: .3rem; padding: .2rem .4rem; }
.barre .pastille { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #cbd5e1; padding: 0; }
.barre .pastille[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 1px; background-clip: padding-box; }

/* Outils de dessin */
.outils-dessin { display: flex; align-items: center; gap: .25rem; }
.outils-dessin select { font: inherit; border-radius: 6px; padding: .2rem; }

/* Zone centrale et scène 1920×1080 mise à l'échelle */
.zone { flex: 1; position: relative; overflow: hidden; }
.scene { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; background-color: #fff; box-shadow: 0 0 40px rgba(0, 0, 0, .5); overflow: hidden; }
.fenetres { position: absolute; inset: 0; z-index: 0; isolation: isolate; }
.calque { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; z-index: 1; pointer-events: none; touch-action: none; }
.calque.actif { pointer-events: auto; cursor: crosshair; }

/* Barre des écrans en bas */
.ecrans { display: flex; align-items: center; gap: .3rem; padding: .3rem .6rem; background: var(--barre-fond); color: var(--barre-texte); overflow-x: auto; }
.ecrans button { background: transparent; color: inherit; border: 1px solid #475569; border-radius: 6px; padding: .25rem .7rem; white-space: nowrap; }
.ecrans button:hover { background: var(--barre-survol); }
.ecrans button.actif { background: var(--accent); border-color: var(--accent); }

/* Fenêtres de widgets */
.fenetre { position: absolute; display: flex; flex-direction: column; background: var(--fenetre-fond); border-radius: var(--rayon); box-shadow: var(--ombre); overflow: hidden; }
.fenetre.reduite { height: auto !important; }
.fenetre.reduite .fenetre-corps { display: none; }
/* Fenêtre réduite : seule la largeur reste réglable */
.fenetre.reduite .bord-n, .fenetre.reduite .bord-s, .fenetre.reduite .bord-ne, .fenetre.reduite .bord-no, .fenetre.reduite .bord-se, .fenetre.reduite .bord-so { display: none; }
.fenetre-entete { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem .4rem .8rem; background: var(--fenetre-entete); color: var(--fenetre-entete-texte); cursor: grab; user-select: none; touch-action: none; font-size: 1.2rem; }
.fenetre-entete:active { cursor: grabbing; }
.fenetre-titre { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fenetre-entete button { background: rgba(255, 255, 255, .15); border: none; color: inherit; border-radius: 6px; width: 36px; height: 32px; font-size: 1.1rem; }
.fenetre-entete button:hover { background: rgba(255, 255, 255, .3); }
.fenetre-corps { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
/* Zones de redimensionnement invisibles sur les bords (12 px) et les coins (24 px) */
.fenetre-bord { position: absolute; z-index: 5; touch-action: none; }
.bord-n { top: 0; left: 24px; right: 24px; height: 10px; cursor: ns-resize; }
.bord-s { bottom: 0; left: 24px; right: 24px; height: 12px; cursor: ns-resize; }
.bord-e { right: 0; top: 24px; bottom: 24px; width: 12px; cursor: ew-resize; }
.bord-o { left: 0; top: 24px; bottom: 24px; width: 12px; cursor: ew-resize; }
.bord-ne { top: 0; right: 0; width: 24px; height: 10px; cursor: nesw-resize; }
.bord-no { top: 0; left: 0; width: 24px; height: 10px; cursor: nwse-resize; }
.bord-se { bottom: 0; right: 0; width: 24px; height: 24px; cursor: nwse-resize; }
.bord-so { bottom: 0; left: 0; width: 24px; height: 24px; cursor: nesw-resize; }
.fenetre.reduite .bord-e, .fenetre.reduite .bord-o { top: 0; bottom: 0; }
.widget-message { margin: auto; padding: 1rem; text-align: center; opacity: .75; font-size: 1.2rem; }

/* Éléments communs aux widgets */
.w-barre { display: flex; gap: .3rem; padding: .4rem; flex-wrap: wrap; align-items: center; background: #f1f5f9; border-bottom: 1px solid #e2e8f0; font-size: 1rem; }
.w-bouton { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; padding: .3rem .7rem; font-size: 1.1rem; color: var(--texte); }
.w-bouton:hover { background: #e2e8f0; }
.w-bouton[aria-pressed="true"] { background: #d1fae5; border-color: var(--accent); }
.w-bouton.principal { background: var(--accent); color: #fff; border-color: var(--accent); font-size: 1.5rem; padding: .5rem 1.4rem; }
.w-bouton.principal:hover { filter: brightness(1.1); }
.w-pastille { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #cbd5e1; padding: 0; }
.w-vide { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; text-align: center; padding: 1rem; border: 3px dashed #cbd5e1; margin: .6rem; border-radius: 8px; font-size: 1.2rem; color: #64748b; }
.fenetre-corps.survol .w-vide, .fenetre-corps.survol { border-color: var(--accent); background: #ecfdf5; }
.w-ligne { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; }
.w-espace { flex: 1; }

/* Widget Texte */
.w-texte { flex: 1; width: 100%; border: none; resize: none; padding: .8rem 1rem; background: transparent; font-family: inherit; line-height: 1.3; color: #1f2937; outline: none; }

/* Widget Minuteur */
.w-minuteur { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; padding: .6rem; }
.w-affichage { font-size: 5.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.w-progression { width: 90%; height: 20px; background: #e2e8f0; border-radius: 10px; overflow: hidden; }
.w-progression > div { height: 100%; width: 100%; background: #2a9d8f; transition: width .25s linear, background-color .3s; }
.w-minuteur.fini .w-affichage { color: #e63946; animation: tb-clignote 1s steps(2) infinite; }
@keyframes tb-clignote { 50% { opacity: .2; } }

/* Widget Tirage au sort */
.w-tirage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; padding: .6rem; text-align: center; }
.w-nom { font-size: 3.8rem; font-weight: 800; min-height: 1.2em; color: #264653; overflow-wrap: anywhere; }
.w-nom.roule { color: #94a3b8; }
.w-info { color: #64748b; font-size: 1.1rem; }
.w-editeur { flex: 1; display: flex; flex-direction: column; gap: .4rem; padding: .6rem; min-height: 0; }
.w-editeur textarea { flex: 1; font: inherit; font-size: 1.15rem; padding: .5rem; border: 1px solid #cbd5e1; border-radius: 6px; resize: none; }
.w-editeur label { display: flex; gap: .4rem; align-items: center; font-size: 1.05rem; }

/* Widgets Image et PDF */
.w-image { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #f8fafc; display: block; }
.w-pdf { flex: 1; border: none; width: 100%; min-height: 0; background: #525659; display: block; }
.w-nom-fichier { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #475569; }

/* Widget Horloge */
.w-horloge { flex: 1; display: flex; align-items: center; justify-content: center; gap: 1.2rem; padding: .6rem; min-height: 0; }
.w-horloge svg { height: 100%; max-height: 100%; max-width: 50%; aspect-ratio: 1 / 1; }
.w-horloge.analogique svg { max-width: 100%; }
.w-numerique { display: flex; flex-direction: column; align-items: center; }
.w-heure { font-size: 4.2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.w-date { font-size: 1.5rem; color: #475569; }
.w-date::first-letter { text-transform: uppercase; }

/* Widget Sonomètre */
.w-sono { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; padding: .6rem; }
.w-visage { font-size: 5rem; line-height: 1; }
.w-jauge { position: relative; width: 90%; height: 36px; background: #e2e8f0; border-radius: 18px; overflow: hidden; }
.w-jauge-niveau { height: 100%; width: 0; background: #2a9d8f; transition: width .1s linear, background-color .2s; }
.w-jauge-seuil { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #1f2937; }
.w-reglage { display: flex; align-items: center; gap: .5rem; width: 90%; font-size: 1.05rem; }
.w-reglage input { flex: 1; }
.w-sono.alerte { animation: tb-alerte .6s steps(2) infinite; }
@keyframes tb-alerte { 50% { background: #fde2e4; } }

/* Notification temporaire en bas de l'écran */
.notification { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); background: #1f2937; color: #fff; padding: .7rem 1.2rem; border-radius: 8px; box-shadow: var(--ombre); z-index: 50; max-width: 90vw; }
.notification.erreur { background: #b91c1c; }
.notification.succes { background: #15803d; }

/* Champ de saisie commun et liens présentés comme des boutons */
.w-champ { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: .4rem .6rem; border: 1px solid #cbd5e1; border-radius: 6px; }
.w-large { width: 100%; flex-wrap: nowrap; }
a.w-bouton { text-decoration: none; display: inline-block; }
select.w-bouton { padding: .3rem .4rem; }

/* Widget Vidéo */
.w-video { flex: 1; min-height: 0; width: 100%; background: #000; display: block; }

/* Widget Feu tricolore */
.w-feu { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: .8rem; min-height: 0; }
.w-boitier { display: flex; flex-direction: column; align-items: center; justify-content: space-around; gap: 4%; flex: 1; min-height: 0; aspect-ratio: 1 / 2.6; max-width: 100%; padding: 6% 0; background: #1f2937; border-radius: 28px; box-shadow: inset 0 0 0 4px #374151, 0 6px 16px rgba(0, 0, 0, .3); }
.w-lampe { width: 72%; aspect-ratio: 1; border-radius: 50%; border: 4px solid #111827; padding: 0; transition: background-color .2s, box-shadow .2s; }
.w-lampe.allumee { box-shadow: 0 0 28px 6px currentColor; }
.w-lampe[data-feu="rouge"] { color: #ef233c; }
.w-lampe[data-feu="orange"] { color: #fb8500; }
.w-lampe[data-feu="vert"] { color: #2dc653; }
.w-feu-texte { font-size: 2.8rem; font-weight: 800; text-align: center; min-height: 1.2em; overflow-wrap: anywhere; }
.w-feu-pastille { width: 24px; height: 24px; border-radius: 50%; flex: none; }

/* Nuancier commun : palette de couleurs et sélecteur libre */
.tb-nuancier { display: grid; grid-template-columns: repeat(7, 30px); gap: 6px; padding: .3rem .5rem; align-items: center; }
.tb-pastille { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #cbd5e1; padding: 0; cursor: pointer; }
.tb-pastille[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }
.tb-couleur-libre { width: 30px; height: 30px; padding: 0; border: 2px dashed #94a3b8; border-radius: 50%; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); cursor: pointer; }
.tb-couleur-libre::-webkit-color-swatch-wrapper { padding: 0; }
.tb-couleur-libre::-webkit-color-swatch { border: none; border-radius: 50%; opacity: 0; }
.tb-couleur-libre::-moz-color-swatch { border: none; border-radius: 50%; opacity: 0; }
.w-barre .tb-nuancier { grid-template-columns: repeat(14, 26px); gap: 4px; padding: 0; }
.w-barre .tb-pastille, .w-barre .tb-couleur-libre { width: 26px; height: 26px; }

/* Palette flottante d'un widget (bouton 🎨) */
.tb-palette-flottante { position: absolute; z-index: 999999; width: 360px; background: #fff; border-radius: 10px; box-shadow: var(--ombre); padding: .5rem; display: flex; flex-direction: column; gap: .4rem; font-size: 1.1rem; }

/* Barre de titre de hauteur fixe (sert de repère au mode épuré) */
.fenetre-entete { height: 46px; flex: none; }
.btn-epure[aria-pressed="true"] { background: var(--accent) !important; }

/* Mode épuré : ni barre de titre, ni menus ; le contenu prend toute la place */
.fenetre.epuree .fenetre-entete, .fenetre.epuree .fenetre-corps > .w-barre, .fenetre.epuree .w-commande { display: none !important; }
/* Mini-barre en haut à droite : visible quand la souris est dans le widget (ou après un appui au doigt) */
.fenetre-mini { display: none; position: absolute; top: 6px; right: 6px; z-index: 6; gap: 4px; padding: 3px; background: rgba(31, 41, 55, .78); border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.fenetre.epuree:hover .fenetre-mini, .fenetre.epuree.touche .fenetre-mini { display: flex; }
.fenetre-mini-poignee, .fenetre-mini-epingle { width: 40px; height: 36px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 7px; background: rgba(255, 255, 255, .15); color: #fff; font-size: 1.2rem; touch-action: none; user-select: none; }
.fenetre-mini-poignee { cursor: grab; font-size: 1.5rem; }
.fenetre-mini-poignee:active { cursor: grabbing; }
.fenetre-mini-poignee:hover, .fenetre-mini-epingle:hover { background: rgba(255, 255, 255, .3); }
/* Un widget épuré ET réduit garde sa barre de titre, sinon il deviendrait invisible */
.fenetre.epuree.reduite .fenetre-entete { display: flex !important; }
/* Palette dépliée dans la barre d'un widget : elle passe sur sa propre ligne */
.w-barre .tb-nuancier { flex-basis: 100%; }

/* Widget Cahier Seyès : la zone de saisie porte le lignage, qui défile avec le texte */
.w-seyes { flex: 1; width: 100%; min-height: 0; border: none; resize: none; outline: none; background-color: transparent; overflow-y: auto; white-space: pre-wrap; }

/* Bloc centré commun (dés, compteur) */
.w-centre { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; padding: .6rem; min-height: 0; }
.w-nombre { flex: none; width: 5em; }

/* Widget Dés */
.w-des { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; cursor: pointer; }
.w-de { width: 110px; height: 110px; border-radius: 18px; background: #fff; border: 3px solid #264653; box-shadow: 0 4px 0 #264653; display: flex; align-items: center; justify-content: center; font-size: 3.4rem; font-weight: 800; color: #264653; }
.w-de.points { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 14px; gap: 4px; }
.w-de.points span { border-radius: 50%; }
.w-de.points span.point { background: #264653; }

/* Widget Groupes */
.w-groupes-vue { flex: 1; overflow: auto; padding: .6rem; min-height: 0; }
.w-groupes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; }
.w-groupe { background: #f1f5f9; border-radius: 10px; padding: .5rem .8rem; border-top: 6px solid var(--accent); }
.w-groupe:nth-child(4n+2) { border-top-color: #f4a261; }
.w-groupe:nth-child(4n+3) { border-top-color: #e76f51; }
.w-groupe:nth-child(4n+4) { border-top-color: #7b2cbf; }
.w-groupe-titre { font-weight: 800; font-size: 1.2rem; margin-bottom: .2rem; }
.w-groupe ul { margin: 0; padding-left: 1.2rem; font-size: 1.35rem; }

/* Widget Chronomètre : temps intermédiaires */
.w-tours { margin: 0; max-height: 30%; overflow: auto; font-size: 1.2rem; font-variant-numeric: tabular-nums; color: #475569; }
.w-affichage[title] { cursor: pointer; }

/* Widget Date du jour */
.w-date-bloc { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: .4rem; padding: .6rem 1.2rem; min-height: 0; overflow: hidden; }
.w-date-jour { color: #1f2937; line-height: 1.5; }
.w-date-autre { color: #64748b; line-height: 1.5; }

/* Widget Compteur */
.w-compteur-libelle { font-size: 2rem; font-weight: 700; color: #475569; text-align: center; }
.w-compteur { align-items: center; flex-wrap: nowrap; gap: 1rem; }
.w-compteur-valeur { font-size: 6rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 1.5em; text-align: center; line-height: 1; }
.w-compteur .principal { font-size: 2.4rem; width: 70px; height: 70px; padding: 0; border-radius: 50%; }

/* Widget Liste */
.w-liste-bloc { flex: 1; display: flex; flex-direction: column; gap: .5rem; padding: .6rem 1rem; min-height: 0; overflow: auto; }
.w-liste-titre { font-size: 2rem; font-weight: 800; color: #264653; }
.w-liste { list-style: none; margin: 0; padding: 0; }
.w-liste li { display: flex; align-items: center; gap: .6rem; padding: .25rem 0; border-bottom: 1px dashed #e2e8f0; cursor: pointer; }
.w-liste li.fait .w-liste-texte { text-decoration: line-through; color: #94a3b8; }
.w-liste-texte { flex: 1; }
.w-case { color: var(--accent); }
.w-liste-outils { display: flex; gap: .2rem; }
.w-liste-outils .w-bouton { font-size: .9rem; padding: .1rem .45rem; }

/* Zones de texte enrichi (Texte et Cahier Seyès) */
.tb-riche { white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; outline: none; min-height: 0; cursor: text; }
.w-texte.tb-riche { display: block; }
.tb-riche:empty::before { content: attr(data-placeholder); color: #94a3b8; pointer-events: none; }
/* Outils de mise en forme de la sélection */
.tb-outils-texte { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.tb-outil { min-width: 2.1em; font-family: Georgia, serif; }
.tb-separateur { width: 1px; align-self: stretch; background: #cbd5e1; margin: 0 .15rem; }
.tb-pastille-texte, .w-barre .tb-pastille-texte { width: 24px; height: 24px; }
.w-site { background: #fff; }
.w-groupes-nombre { font-size: 1.4rem; font-weight: 800; min-width: 1.6em; text-align: center; }

/* Bouton « A » de couleur du texte et sa palette dépliante */
.tb-a-boite { position: relative; display: inline-flex; }
.tb-a-couleur { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; padding-top: .25rem; padding-bottom: .2rem; font-weight: 800; }
.tb-a-trait { display: block; width: 1.3em; height: 5px; border-radius: 2px; margin-top: 2px; }
.tb-palette-texte { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; background: #fff; border-radius: 10px; box-shadow: var(--ombre); padding: .4rem; }
.tb-palette-texte .tb-nuancier { grid-template-columns: repeat(7, 30px); gap: 6px; flex-basis: auto; }
.tb-palette-texte .tb-pastille, .tb-palette-texte .tb-couleur-libre { width: 30px; height: 30px; }

/* Glisser-déposer des onglets d'écran */
.ecrans .onglet { touch-action: none; cursor: grab; }
.ecrans .onglet.glisse { cursor: grabbing; opacity: .85; position: relative; z-index: 2; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.ecrans .onglet.cible-avant { box-shadow: -4px 0 0 0 #fde047; }
.ecrans .onglet.cible-apres { box-shadow: 4px 0 0 0 #fde047; }

/* Plein écran d'un widget : barres de TBScreen et autres widgets cachés, widget zoomé sur toute la scène */
body.widget-plein .barre, body.widget-plein .ecrans { display: none; }
body.widget-plein .calque { display: none; }
body.widget-plein .fenetre:not(.plein) { display: none; }
.fenetre.plein { transform-origin: 0 0; box-shadow: none; }
.fenetre.plein .fenetre-bord { display: none; }
.fenetre.plein .btn-plein { background: var(--accent) !important; }
/* En plein écran, seuls les boutons ⛶ restent dans la barre de titre et la mini-barre */
.fenetre.plein .fenetre-entete button:not(.btn-plein), .fenetre.plein .btn-couleur { display: none; }
.fenetre.plein .fenetre-entete { cursor: default; }
.fenetre.plein .fenetre-mini-poignee, .fenetre.plein .fenetre-mini-epingle:not(.btn-plein) { display: none; }

/* Menu « ＋ Widget » rangé par catégories, en colonnes */
.menu.menu-widgets { flex-direction: row; align-items: stretch; gap: 0; padding: 0; max-height: calc(100vh - 120px); }
/* Colonne des thèmes */
.menu-themes { display: flex; flex-direction: column; gap: .1rem; padding: .4rem; min-width: 210px; }
.barre .menu .menu-theme { display: flex; align-items: center; gap: .6rem; }
.menu-theme-nom { flex: 1; font-weight: 600; white-space: nowrap; }
.menu-theme-nombre { font-size: .75rem; background: #e2e8f0; border-radius: 999px; padding: 0 .45rem; color: #475569; }
.menu-theme-fleche { color: #94a3b8; }
.barre .menu .menu-theme[aria-pressed="true"] { background: #d1fae5; }
.barre .menu .menu-theme[aria-pressed="true"] .menu-theme-fleche { color: var(--accent); }
/* Colonne des widgets du thème choisi */
.menu-sous { display: flex; flex-direction: column; gap: .1rem; padding: .4rem; min-width: 230px; border-left: 1px solid #e2e8f0; background: #f8fafc; border-radius: 0 8px 8px 0; overflow-y: auto; }

/* ===== Widgets de la v0.7.0 ===== */

/* Éléments communs */
.w-petit { font-size: .9rem; padding: .15rem .45rem; }
.w-puces { display: flex; flex-wrap: wrap; gap: .3rem; padding: .3rem 0; }
.w-puce { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 999px; padding: .25rem .8rem; font-size: 1.05rem; color: var(--texte); }
.w-puce:hover { background: #e0f2f1; border-color: var(--accent); }
.w-deux-colonnes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; min-height: 0; }
.w-colonne-edition { display: flex; flex-direction: column; gap: .3rem; font-weight: 700; min-height: 0; }
.w-colonne-edition textarea { flex: 1; font: inherit; font-weight: 400; font-size: 1.1rem; padding: .5rem; border: 1px solid #cbd5e1; border-radius: 6px; resize: none; }

/* Droite numérique */
.w-droite { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: .3rem; }
.w-droite-svg { flex: 1; width: 100%; min-height: 0; }
.w-droite-zone { cursor: pointer; }
.w-droite-zone:hover { fill: rgba(42, 157, 143, .1); }
.w-droite .w-info { text-align: right; }

/* Tableau de numération */
.w-numeration-bloc { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: .5rem; gap: .5rem; }
.w-numeration { flex: 1; display: flex; gap: .4rem; min-height: 0; }
.w-colonne { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; background: #f8fafc; border-radius: 8px; border-top: 8px solid #94a3b8; padding: .3rem; min-width: 0; }
.w-colonne.decimale { background: #f0f9ff; }
.w-colonne.trop { background: #fee2e2; }
.w-colonne-titre { font-size: 1.6rem; font-weight: 800; }
.w-jetons { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 6px; min-height: 0; overflow: hidden; }
.w-jeton { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.w-colonne-chiffre { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.w-colonne.trop .w-colonne-chiffre { color: #dc2626; font-size: 1.4rem; }
.w-numeration-nombre { text-align: center; font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer; }

/* Horloge à manipuler */
.w-horloge-bloc { flex: 1; display: flex; align-items: center; justify-content: center; gap: 1.2rem; padding: .6rem; min-height: 0; flex-wrap: wrap; }
.w-horloge-manip { height: 100%; max-height: 100%; max-width: 60%; aspect-ratio: 1; touch-action: none; cursor: grab; }
.w-heure-lettres { font-size: 1.8rem; color: #264653; font-weight: 700; text-align: center; max-width: 16em; }

/* Monnaie */
.w-reserve { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem; border-bottom: 2px dashed #cbd5e1; background: #f8fafc; }
.w-plateau { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.w-espece { display: flex; align-items: center; justify-content: center; font-weight: 800; color: #1f2937; cursor: grab; user-select: none; touch-action: none; box-shadow: 0 3px 6px rgba(0, 0, 0, .3); font-size: 1rem; }
.w-espece.piece { border-radius: 50%; border: 2px solid rgba(0, 0, 0, .25); }
.w-espece.billet { width: 120px; height: 62px; border-radius: 6px; border: 2px solid rgba(0, 0, 0, .25); font-size: 1.4rem; }
.w-plateau .w-espece { position: absolute; }
.w-espece.saisie { cursor: grabbing; z-index: 10; box-shadow: 0 8px 18px rgba(0, 0, 0, .35); }
.w-monnaie-total { text-align: center; font-size: 2.4rem; font-weight: 800; padding: .3rem; border-top: 1px solid #e2e8f0; cursor: pointer; }

/* Fractions */
.w-fractions-bloc { flex: 1; display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding: .6rem; min-height: 0; }
.w-fractions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; flex: 1; min-height: 0; height: 100%; }
.w-fraction-figure.disque { height: 90%; max-height: 260px; aspect-ratio: 1; }
.w-fraction-figure.barre { width: 100%; max-width: 520px; }
.w-fraction-part { cursor: pointer; }
.w-fraction-part:hover { opacity: .85; }
.w-fraction { display: flex; flex-direction: column; align-items: center; font-size: 4rem; font-weight: 800; line-height: 1.1; }
.w-fraction .num { border-bottom: 6px solid #1f2937; padding: 0 .2em; }

/* Calcul flash */
.w-calcul-op { font-size: 5rem; font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer; text-align: center; }
.w-calcul-op.cachee { color: #cbd5e1; }

/* Table de Pythagore */
.w-pythagore-bloc { flex: 1; display: flex; align-items: center; justify-content: center; padding: .4rem; min-height: 0; }
.w-pythagore { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; width: 100%; height: 100%; max-width: 100%; aspect-ratio: 1; }
.w-pythagore > * { display: flex; align-items: center; justify-content: center; border: none; border-radius: 4px; font-size: 1.4rem; font-weight: 700; padding: 0; }
.w-py-coin { background: #264653; color: #fff; }
.w-py-tete { background: #264653; color: #fff; cursor: pointer; }
.w-py-tete.choisie { background: #e76f51; }
.w-py-case { background: #f1f5f9; color: #1f2937; cursor: pointer; }
.w-py-case.carre { background: #e2e8f0; }
.w-py-case.surlignee { background: #fde68a; }
.w-py-case.cachee { background: #cbd5e1; }

/* Étiquettes-mots */
.w-etiquettes-bloc { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: .6rem; padding: .8rem; min-height: 0; }
.w-etiquettes { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; }
.w-etiquette { background: #fff8c4; border: 2px solid #e9c46a; border-radius: 10px; padding: .2em .5em; cursor: grab; user-select: none; touch-action: none; box-shadow: 0 3px 6px rgba(0, 0, 0, .15); line-height: 1.4; }
.w-etiquette.saisie { cursor: grabbing; position: relative; z-index: 5; box-shadow: 0 10px 20px rgba(0, 0, 0, .25); }
.w-etiquettes.resolu .w-etiquette { background: #d1fae5; border-color: #2a9d8f; }
.w-etiquettes-bravo { text-align: center; font-size: 2rem; font-weight: 800; color: #2a9d8f; min-height: 1.3em; }

/* Mot éclair */
.w-eclair { min-height: 1.4em; text-align: center; cursor: pointer; color: #1f2937; line-height: 1.3; }
.w-eclair.vide { color: #cbd5e1; }

/* Lecture à voix haute */
.w-lecture-texte { flex: 1; width: 100%; min-height: 0; border: none; resize: none; padding: .8rem 1rem; font-family: inherit; line-height: 1.5; outline: none; overflow-y: auto; white-space: pre-wrap; }
.w-lecture-suivi mark { background: #fde047; border-radius: 4px; padding: 0 .1em; }
.w-lecture-boutons { padding: .4rem; border-top: 1px solid #e2e8f0; }

/* Conseil de coopérative */
.w-conseil { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: .5rem; min-height: 0; }
.w-conseil-colonne { display: flex; flex-direction: column; gap: .3rem; background: #f8fafc; border-radius: 8px; border-top: 8px solid #94a3b8; padding: .4rem; min-height: 0; }
.w-conseil-titre { font-weight: 800; font-size: 1.15em; }
.w-conseil-liste { flex: 1; margin: 0; padding-left: 1.4em; overflow: auto; }
.w-conseil-liste li, .w-qdn-file li, .w-aide-file li { display: flex; align-items: center; gap: .3rem; cursor: pointer; padding: .1em 0; }
.w-conseil-liste li { display: list-item; }
.w-conseil-liste li .w-bouton { float: right; }
.w-conseil-liste li.fait .w-liste-texte, .w-qdn-file li.fait .w-liste-texte { text-decoration: line-through; color: #94a3b8; }

/* Quoi de neuf ? */
.w-qdn { flex: 1; display: grid; grid-template-columns: 3fr 2fr; gap: .6rem; padding: .6rem; min-height: 0; }
.w-qdn-scene { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; }
.w-qdn-nom { font-size: 3rem; font-weight: 800; color: #264653; text-align: center; }
.w-qdn-temps { font-size: 3.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.w-qdn-cote { display: flex; flex-direction: column; gap: .3rem; min-height: 0; overflow: auto; }
.w-qdn-file { margin: 0; padding-left: 1.4em; font-size: 1.3rem; }
.w-qdn-file li { display: list-item; }
.w-qdn-file li.courant { font-weight: 800; color: #e76f51; }

/* File d'aide */
.w-aide { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .6rem; min-height: 0; overflow: auto; }
.w-aide-premier { font-size: 2.8rem; font-weight: 800; color: #264653; text-align: center; }
.w-aide-premier.vide { color: #94a3b8; font-size: 2rem; }
.w-aide-file { margin: 0; font-size: 1.5rem; align-self: stretch; padding-left: 2em; counter-reset: aide 1; }
.w-aide-inscription { align-self: stretch; }

/* Vote */
.w-vote-bloc { flex: 1; display: flex; flex-direction: column; gap: .5rem; padding: .6rem; min-height: 0; overflow: auto; }
.w-vote-question { font-size: 2rem; font-weight: 800; text-align: center; color: #264653; }
.w-vote { display: flex; flex-direction: column; gap: .5rem; }
.w-vote-ligne { display: flex; align-items: center; gap: .4rem; font-size: 1.4rem; }
.w-vote-libelle { width: 9em; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-vote-barre { flex: 1; height: 34px; background: #f1f5f9; border-radius: 8px; overflow: hidden; }
.w-vote-barre > div { height: 100%; transition: width .3s; }
.w-vote-voix { width: 2.2em; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Compte à rebours de dates */
.w-dates { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: .5rem; padding: .6rem 1rem; min-height: 0; overflow: auto; }
.w-date-ligne { display: flex; align-items: baseline; gap: .5em; flex-wrap: wrap; }
.w-date-nombre { font-size: 2em; font-weight: 800; color: #e76f51; font-variant-numeric: tabular-nums; }
.w-date-texte { font-weight: 700; }
.w-date-champ { flex: none; width: auto; }

/* Emploi du temps */
.w-onglets { display: flex; gap: .2rem; padding: .3rem .4rem 0; border-bottom: 2px solid #e2e8f0; }
.w-onglet { border: 1px solid #cbd5e1; border-bottom: none; background: #f8fafc; border-radius: 8px 8px 0 0; padding: .3rem .7rem; font-size: 1rem; }
.w-onglet.aujourdhui { font-weight: 800; }
.w-onglet.actif { background: var(--accent); color: #fff; border-color: var(--accent); }
.w-emploi { flex: 1; display: flex; flex-direction: column; gap: .3rem; padding: .5rem; min-height: 0; overflow: auto; }
.w-creneau { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2em .8em; padding: .3em .5em; border-radius: 8px; background: #f8fafc; border-left: 6px solid #cbd5e1; }
.w-creneau-heure { font-variant-numeric: tabular-nums; color: #64748b; font-size: .8em; min-width: 7.5em; }
.w-creneau-libelle { font-weight: 700; flex: 1; }
.w-creneau.passe { opacity: .45; }
.w-creneau.encours { background: #ecfdf5; border-left-color: var(--accent); }
.w-creneau-reste { font-size: .75em; color: var(--accent); font-weight: 700; }
.w-creneau-jauge { flex-basis: 100%; height: 6px; background: #d1fae5; border-radius: 3px; overflow: hidden; }
.w-creneau-jauge > div { height: 100%; background: var(--accent); }
.w-creneau-edition { display: flex; gap: .3rem; align-items: center; font-size: 1rem; }
.w-heure-champ { flex: none; width: 7.5em; }

/* Métiers de la classe */
.w-metiers-bloc { flex: 1; padding: .5rem; min-height: 0; overflow: auto; }
.w-metiers { display: flex; flex-direction: column; gap: .3rem; }
.w-metier { display: flex; justify-content: space-between; gap: 1em; padding: .25em .6em; border-radius: 8px; background: #f8fafc; }
.w-metier:nth-child(odd) { background: #eef2f7; }
.w-metier-nom { color: #475569; }
.w-metier-eleve { font-weight: 800; color: #264653; }

/* Minuteur visuel */
.w-disque-bloc { gap: .5rem; }
.w-disque-cadre { position: relative; height: 70%; max-height: 100%; aspect-ratio: 1; flex: none; }
.w-disque { position: absolute; inset: 9%; border-radius: 50%; border: 6px solid #1f2937; cursor: pointer; box-shadow: inset 0 0 0 4px #fff; }
.w-disque-graduations span { position: absolute; transform: translate(-50%, -50%); font-weight: 800; font-size: 1.3rem; color: #1f2937; }
.w-disque-centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(255, 255, 255, .9); border-radius: 10px; padding: .1em .4em; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer; }
.w-disque-cadre.fini .w-disque { animation: tb-clignote 1s steps(2) infinite; }
