/* La grande brigade de Noël (inc/brigade_noel.php, BRIGADE-NOEL.md) — préfixe .vn-
   Village (village_noel_svg() de inc/dessins.php), page publique (brigade_noel.php), carte de l'accueil élève,
   Tour de garde et bilan de fin de défi (defi.php), sections de l'espace enseignant. Versionné par ELEVES_CSS_VERSION. */

/* --- Le village --- */
.vn-village { display: block; width: 100%; height: auto; border-radius: 18px; }
.vn-maison-corps { transform: scale(var(--s, 1)); }
.vn-maison[data-etat="en_cours"] .vn-maison-corps { transform: scale(calc(var(--s, 1) * 1.2)); }
.vn-fen { fill: #FFD166; }
.vn-maison[data-etat="a_venir"] .vn-fen { fill: #545887; }
.vn-maison[data-etat="en_cours"] .vn-fen { fill: #FFE7A0; }
.vn-nuit { fill: #1E2452; opacity: .4; display: none; }
.vn-maison[data-etat="a_venir"] .vn-nuit { display: inline; }
.vn-halo { fill: #FFD166; opacity: 0; transition: opacity .8s; }
.vn-maison[data-etat="sauvee"] .vn-halo { opacity: .28; }
.vn-maison[data-etat="en_cours"] .vn-halo { opacity: .22; animation: vn-respire 1.6s ease-in-out infinite alternate; }
@keyframes vn-respire { to { opacity: .4; } }
/* guirlande : cachée dans le noir, allumée ampoule par ampoule pendant la décoration, qui scintille une fois la maison illuminée */
.vn-guirlande { display: none; }
.vn-maison[data-etat="sauvee"] .vn-guirlande, .vn-maison[data-etat="en_cours"] .vn-guirlande { display: inline; }
.vn-ampoule { transition: fill .4s; }
.vn-ampoule.eteinte { fill: #5B5F86; }
.vn-maison[data-etat="sauvee"] .vn-ampoule { animation: vn-brille 1.6s ease-in-out infinite alternate; }
.vn-maison[data-etat="sauvee"] .vn-ampoule:nth-child(odd) { animation-delay: .8s; }
@keyframes vn-brille { from { opacity: 1; } to { opacity: .45; } }
.vn-num { font: 700 15px "Fredoka", "Nunito", sans-serif; fill: #2B2340; display: none; }
.vn-maison[data-etat="en_cours"] .vn-num { display: inline; }
/* la grande échelle de la brigade, posée contre la maison en cours */
.vn-etincelle { transform-box: fill-box; transform-origin: center; animation: vn-scintille 1.2s ease-in-out infinite alternate; }
@keyframes vn-scintille { from { transform: scale(.7) rotate(-10deg); } to { transform: scale(1.15) rotate(10deg); } }
.vn-lumieres { opacity: 0; transition: opacity 1s; }
.illumine .vn-lumieres { opacity: 1; }
.illumine .vn-lumieres circle { animation: vn-brille 1.2s ease-in-out infinite alternate; }
.illumine .vn-lumieres circle:nth-child(3n) { animation-delay: .6s; }
.vn-etoile-sapin { opacity: .45; transition: opacity 1s; }
.illumine .vn-etoile-sapin { opacity: 1; }
.vn-neige circle { animation: vn-tombe 9s linear infinite; }
.vn-neige circle:nth-child(2n) { animation-duration: 12s; animation-delay: -4s; }
@keyframes vn-tombe { from { transform: translateY(-40px); } to { transform: translateY(420px); } }
.vn-maison.vn-sauvee-pop .vn-maison-corps { animation: vn-pop .8s ease-out; }
@keyframes vn-pop { 40% { transform: scale(calc(var(--s, 1) * 1.35)); } }
@media (prefers-reduced-motion: reduce) {
  .vn-neige circle, .vn-ampoule, .vn-etincelle, .illumine .vn-lumieres circle, .vn-halo { animation: none !important; }
}
.vn-jauge { height: 22px; border: 3px solid var(--encre, #2B2340); border-radius: 999px; background: #fff; overflow: hidden; }
.vn-jauge i { display: block; height: 100%; width: var(--niveau, 0%); background: var(--bleu, #6FB3F2); border-right: 3px solid var(--encre, #2B2340); transition: width .8s; }

/* --- Page publique --- */
.page-noel .vn-page { max-width: 1160px; margin: 0 auto; padding: 4px 0 30px; }
.vn-titre { text-align: center; margin: 4px 0 14px; }
.vn-titre h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0; line-height: 1.1; }
.vn-titre p { margin: 8px auto 0; max-width: 700px; font-size: 1.1rem; }
.vn-compteur { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.vn-chiffre { text-align: center; padding: 10px 8px; background: var(--papier); border: var(--trait) solid var(--encre); border-radius: 18px; box-shadow: 4px 4px 0 var(--encre); }
.vn-chiffre b { display: block; font: 700 clamp(1.6rem, 4.5vw, 2.6rem) var(--police-titre); line-height: 1.05; font-variant-numeric: tabular-nums; }
.vn-chiffre > span { font-weight: 800; font-size: .95rem; }
.vn-chiffre.seaux { background: #E6F4FD; }
.vn-chiffre.maisons { background: #FFF1B8; }
.vn-maison-en-cours { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; margin: 14px 0; padding: 12px 16px; background: #FFF0E8; border: var(--trait) solid var(--encre); border-radius: 18px; box-shadow: 4px 4px 0 var(--encre); }
.vn-maison-en-cours p { margin: 4px 0 0; font-weight: 800; }
.vn-maison-en-cours strong { font-family: var(--police-titre); font-size: 1.25rem; }
.vn-etapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 26px 0; }
.vn-etape { padding: 14px 16px; background: var(--papier); border: var(--trait) solid var(--encre); border-radius: 18px; box-shadow: 4px 4px 0 var(--encre); }
.vn-etape b { display: grid; place-items: center; width: 38px; height: 38px; border: 3px solid var(--encre); border-radius: 50%; background: var(--jaune); font: 700 1.3rem var(--police-titre); margin-bottom: 6px; }
.vn-etape h2 { margin: 0 0 4px; font-size: 1.15rem; }
.vn-etape p { margin: 0; }
.vn-promesse { display: flex; gap: 10px; align-items: flex-start; max-width: 760px; margin: 0 auto; font-size: .98rem; }
.vn-promesse .ico { flex: none; width: 26px; height: 26px; color: var(--vert); }
.vn-boutons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.vn-decompte { display: flex; justify-content: center; gap: 10px; margin: 12px 0; }
.vn-decompte div { min-width: 86px; text-align: center; padding: 8px; background: var(--jaune); border: var(--trait) solid var(--encre); border-radius: 16px; box-shadow: 4px 4px 0 var(--encre); font-weight: 800; }
.vn-decompte b { display: block; font: 700 2.4rem var(--police-titre); line-height: 1; font-variant-numeric: tabular-nums; }
.vn-copie { font-weight: 800; min-height: 1.4em; text-align: center; margin: 6px 0 0; }
.vn-hors { text-align: center; max-width: 680px; margin: 20px auto; }
/* projeté en classe : ?projeter=1 */
.vn-projeter .entete, .vn-projeter .pied, .vn-projeter .vn-etapes, .vn-projeter .vn-promesse, .vn-projeter .vn-boutons, .vn-projeter .vn-cacher-projeter { display: none !important; }
.vn-projeter .vn-page { max-width: none; padding: 10px 20px; }
.vn-projeter .vn-titre h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.vn-projeter .vn-titre p { display: none; }
.vn-projeter .vn-chiffre b { font-size: clamp(2rem, 4vw, 3.4rem); }
.vn-projeter .vn-scene { max-height: 66vh; display: flex; justify-content: center; }
.vn-projeter .vn-scene .vn-village { width: auto; max-width: 100%; max-height: 66vh; }

/* --- Carte de l'accueil élève --- */
.vn-carte { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: center; padding: 14px 16px; margin-bottom: 20px; background: #EEF0FF; border: var(--trait) solid var(--encre); border-radius: var(--rayon); box-shadow: var(--ombre); color: var(--encre); }
.vn-carte h2 { margin: 0; font-size: 1.45rem; }
.vn-carte p { margin: 4px 0; }
.vn-carte .vn-jauge { margin: 8px 0 4px; }
.vn-parts { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 10px; }
.vn-part { padding: 2px 12px; border: 2px solid var(--encre); border-radius: 999px; background: #fff; font-weight: 800; font-size: .95rem; }
.vn-part b { font-family: var(--police-titre); font-size: 1.1rem; }
.vn-part-ok { background: #E3F7E8; }
.vn-gardes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.vn-gardes > span { font-weight: 800; }
.vn-garde-btn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; font-size: .95rem; border: 2px solid var(--encre); border-radius: 999px; background: #fff; color: var(--encre); font-weight: 800; text-decoration: none; box-shadow: 2px 2px 0 var(--encre); }
.vn-garde-btn:hover, .vn-garde-btn:focus-visible { background: var(--jaune); }
.vn-garde-btn .pastille { width: 30px; height: 30px; }
.vn-carte-liens { margin-top: 10px; font-size: .95rem; }

/* --- Tour de garde (defi.php?garde=) et bilan de fin de défi --- */
.vn-mini { grid-template-columns: 260px minmax(0, 1fr) auto; background: #EEF0FF; }
.vn-mini .vn-village { border-radius: 10px; }
.df-noel { margin: 14px 0 6px; padding: 12px 16px; background: #EEF0FF; border: var(--trait) solid var(--encre); border-radius: 18px; box-shadow: 4px 4px 0 var(--encre); text-align: left; }
.df-noel .vn-plus { font: 700 1.5rem var(--police-titre); color: #2E62B8; line-height: 1.2; }
.df-noel p { margin: 4px 0; }
.df-noel .vn-sauvee { font-weight: 800; background: #FFF1B8; display: inline-block; padding: 2px 10px; border-radius: 10px; }
.df-noel a { font-weight: 800; }

/* --- Espace enseignant --- */
.vn-prof-grille { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: center; }
.vn-prof-chiffres { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.vn-prof-chiffres span { padding: 4px 12px; border: 2px solid var(--encre, #2B2340); border-radius: 12px; background: #fff; }
.vn-bandeau { display: flex; gap: 14px; align-items: center; padding: 12px 16px; margin-bottom: 18px; background: #EEF0FF; border: 3px solid var(--encre, #2B2340); border-radius: 16px; box-shadow: 4px 4px 0 var(--encre, #2B2340); }
.vn-bandeau .vn-village { width: 170px; flex: none; border-radius: 10px; }
.vn-bandeau p { margin: 2px 0; }
.vn-bandeau form { display: inline; }
.vn-barres { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 8px 4px 0; border-bottom: 3px solid var(--encre, #2B2340); margin-bottom: 30px; }
.vn-barres div { flex: 1; min-width: 6px; max-width: 64px; background: var(--bleu, #6FB3F2); border: 2px solid var(--encre, #2B2340); border-bottom: 0; border-radius: 6px 6px 0 0; position: relative; }
.vn-barres div span { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: .72rem; white-space: nowrap; }

@media (max-width: 760px) {
  .vn-compteur { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vn-etapes { grid-template-columns: 1fr; }
  .vn-carte { grid-template-columns: 1fr; }
  .vn-carte .vn-village { order: -1; }
  .vn-maison-en-cours { grid-template-columns: auto minmax(0, 1fr); }
  .vn-maison-en-cours .btn { grid-column: 1 / -1; }
  .vn-decompte div { min-width: 70px; }
  .vn-mini { grid-template-columns: minmax(0, 1fr) auto; }
  .vn-mini .vn-village { grid-column: 1 / -1; }
  .vn-prof-grille { grid-template-columns: 1fr; }
  .vn-bandeau { flex-direction: column; align-items: flex-start; }
}

/* --- Design Studio (clair ou sombre) : traits fins, ombres douces, fonds tirés de --papier --- */
html[data-theme^="studio"] .vn-carte, html[data-theme^="studio"] .df-noel, html[data-theme^="studio"] .vn-chiffre,
html[data-theme^="studio"] .vn-maison-en-cours, html[data-theme^="studio"] .vn-etape, html[data-theme^="studio"] .vn-decompte div {
  border: 1px solid var(--ligne); box-shadow: var(--ombre); color: var(--encre);
}
html[data-theme^="studio"] .vn-carte, html[data-theme^="studio"] .df-noel, html[data-theme^="studio"] .vn-mini { background: color-mix(in srgb, var(--violet) 14%, var(--papier)); }
html[data-theme^="studio"] .vn-chiffre, html[data-theme^="studio"] .vn-etape { background: var(--papier); }
html[data-theme^="studio"] .vn-chiffre.seaux { background: color-mix(in srgb, var(--bleu) 16%, var(--papier)); }
html[data-theme^="studio"] .vn-chiffre.maisons, html[data-theme^="studio"] .vn-decompte div { background: color-mix(in srgb, var(--jaune) 22%, var(--papier)); }
html[data-theme^="studio"] .vn-maison-en-cours { background: color-mix(in srgb, var(--corail) 14%, var(--papier)); }
html[data-theme^="studio"] .vn-part, html[data-theme^="studio"] .vn-garde-btn { border: 1px solid var(--ligne); background: var(--papier); color: var(--encre); box-shadow: none; }
html[data-theme^="studio"] .vn-part-ok { background: color-mix(in srgb, var(--vert) 20%, var(--papier)); }
html[data-theme^="studio"] .vn-jauge { border-width: 1px; border-color: var(--ligne); background: var(--papier); }
html[data-theme^="studio"] .vn-jauge i { border-right: 0; }
html[data-theme^="studio"] .vn-etape b { border-width: 1px; }
html[data-theme^="studio"] .df-noel .vn-plus { color: var(--bleu); }
html[data-theme^="studio"] .df-noel .vn-sauvee { background: color-mix(in srgb, var(--jaune) 30%, var(--papier)); }
.vn-bandeau[hidden] { display: none; }

/* --- Le collectif (21 oct. au soir) : lumières des autres, grand allumage, maisons illuminées ensemble, affiche --- */
.vn-direct { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px auto 0; min-height: 1.6em; font-weight: 800; text-align: center; }
.vn-direct .ico { flex: none; width: 22px; height: 22px; color: #E0A100; }
.vn-direct-pop { animation: vn-apparait .5s ease-out; }
@keyframes vn-apparait { from { opacity: 0; transform: translateY(6px); } }
.vn-allumage { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px auto 0; max-width: 820px; padding: 8px 16px; border: 3px solid var(--encre, #2B2340); border-radius: 999px; background: #FFF1B8; font-weight: 800; text-align: center; box-shadow: 3px 3px 0 var(--encre, #2B2340); }
.vn-allumage[hidden] { display: none; }
.vn-allumage .pastille { flex: none; }
.vn-allumage-en_cours { background: var(--jaune, #FFD166); animation: vn-respire-boite 1.2s ease-in-out infinite alternate; }
@keyframes vn-respire-boite { to { box-shadow: 0 0 0 6px rgba(255, 209, 102, .55), 3px 3px 0 var(--encre, #2B2340); } }
.vn-pays { text-align: center; font-weight: 800; margin: -4px 0 12px; }
.vn-derniere { font-weight: 700 !important; opacity: .85; }
.vn-maisons-illuminees { margin: 22px 0 0; }
.vn-maisons-illuminees h2 { font-size: 1.25rem; margin: 0 0 8px; }
.vn-maisons-illuminees ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.vn-maisons-illuminees li { display: flex; flex-direction: column; padding: 6px 12px; background: #FFF8DA; border: 2px solid var(--encre, #2B2340); border-radius: 12px; font-size: .92rem; }
.vn-maisons-illuminees li b { font-family: var(--police-titre); }
.vn-carte .vn-allumage-mini { margin: 6px 0; padding: 4px 12px; border: 2px dashed var(--encre, #2B2340); border-radius: 12px; background: #FFF1B8; font-weight: 800; }
.vn-carte .vn-autres { font-size: .95rem; opacity: .85; }
.vn-projeter .vn-direct { font-size: 1.5rem; }
.vn-projeter .vn-allumage { font-size: 1.4rem; }
@media (prefers-reduced-motion: reduce) { .vn-allumage-en_cours, .vn-direct-pop { animation: none !important; } }
html[data-theme^="studio"] .vn-allumage, html[data-theme^="studio"] .vn-maisons-illuminees li { border: 1px solid var(--ligne); box-shadow: var(--ombre); background: color-mix(in srgb, var(--jaune) 18%, var(--papier)); color: var(--encre); }
html[data-theme^="studio"] .vn-carte .vn-allumage-mini { border: 1px dashed var(--ligne); background: color-mix(in srgb, var(--jaune) 18%, var(--papier)); }
