/* La salle des professeurs. Tout est préfixé .sp pour ne pas toucher au thème. */
@font-face { font-family: "SP Titre"; src: url("../fonts/KGBlankSpaceSolid.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "SP Texte"; src: url("../fonts/Lato-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "SP Texte"; src: url("../fonts/Lato-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "SP Texte"; src: url("../fonts/Lato-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

#vcrpe-avent { height: min(88vh, 900px); min-height: 560px; }
.sp {
  --ardoise: #2c4b3d; --ardoise-fonce: #223b30; --craie: #f6f2e4; --jaune: #ffd966;
  --bois: #bd8a55; --bois-fonce: #845634; --creme: #f6e8cd; --rouge: #a53f36;
  --poste: 320px; --marge: 0px;
  position: relative; display: flex; flex-direction: column; width: 100%; overflow: hidden;
  background: var(--ardoise-fonce); color: var(--craie); line-height: 1.45;
  font-family: "SP Texte", "Lato", system-ui, sans-serif; -webkit-tap-highlight-color: transparent;
}
.sp *, .sp *::before, .sp *::after { box-sizing: border-box; }
.sp [hidden] { display: none !important; }
.sp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sp h2, .sp h3 { margin: 0; font-family: "SP Titre", "Lato", sans-serif; font-weight: 400; letter-spacing: 0; line-height: 1.15; text-transform: none; color: var(--craie); }
.sp p { margin: 0; }
.sp button {
  font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: 0; text-transform: none;
  margin: 0; min-height: 44px; cursor: pointer; color: var(--craie); background: transparent;
  border: 2px dashed rgba(246, 242, 228, .55); border-radius: 12px; padding: 10px 16px; box-shadow: none;
}
.sp button:hover { background: rgba(246, 242, 228, .1); color: var(--craie); }
.sp button:disabled { opacity: .45; cursor: default; }
.sp button:focus-visible, .sp input:focus-visible, .sp a:focus-visible, .sp-piste:focus-visible { outline: 3px solid var(--jaune); outline-offset: 2px; }

/* ------------------------------------------------ La pièce */
.sp-scene { position: relative; flex: 1; min-height: 0; z-index: 1; isolation: isolate; } /* les profondeurs restent sous les tableaux */
.sp-piste {
  position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; touch-action: pan-x pan-y; cursor: grab;
}
.sp-piste::-webkit-scrollbar { display: none; }
.sp-piste.sp-glisse { cursor: grabbing; scroll-snap-type: none; }
.sp-piste { user-select: none; -webkit-user-select: none; }
.sp-grand .sp-piste { cursor: default; }
.sp-fond { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.sp-monde { position: relative; display: flex; width: max-content; min-width: 100%; height: 100%; padding: 0 var(--marge); overflow: hidden; }
.sp-poste { position: relative; flex: 0 0 var(--poste); height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
/* Un « coin » : plaque, professeur et mobilier, posés sur le sol à leur profondeur. */
.sp-groupe { position: absolute; left: 50%; transform: translateX(-50%); }
.sp .sp-prof, .sp .sp-prof:hover { position: relative; display: block; width: 100%; padding: 0; min-height: 0; border: 0; border-radius: 40px; background: none; }
.sp-prof img { display: block; width: 100%; height: auto; max-width: none; user-select: none; pointer-events: none; }
.sp-prof::before { /* ombre au sol */
  content: ""; position: absolute; left: 4%; right: 4%; bottom: -8px; height: 12%; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgba(45, 18, 4, .55), transparent);
}
.sp-signal {
  position: absolute; right: 2%; top: -12px; width: 48px; height: 48px; border-radius: 50% 50% 50% 8px; display: grid; place-items: center;
  background: #fffaf0; color: var(--teinte); border: 3px solid var(--teinte); box-shadow: 0 6px 14px rgba(40, 20, 5, .3);
  animation: sp-rebond 1.7s ease-in-out infinite;
}
.sp-signal .sp-picto { width: 28px; height: 28px; }
@keyframes sp-rebond { 50% { translate: 0 -7px; } }
.sp-picto { display: inline-block; width: 28px; height: 28px; flex: none; }
.sp-picto svg { display: block; width: 100%; height: 100%; }

.sp-plaque {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 14px); width: max-content; max-width: 105%; text-align: center;
  padding: 6px 14px 5px; font-family: "SP Titre", sans-serif; font-size: 17px; white-space: nowrap;
  background: var(--ardoise); color: var(--craie); border: 4px solid var(--bois); border-radius: 10px; box-shadow: 0 5px 12px rgba(40, 20, 5, .32);
}
/* « Lui parler » n'apparaît qu'au survol (ou au clavier). Au doigt, on touche le professeur. */
.sp .sp-parler {
  position: absolute; left: 50%; transform: translate(-50%, 6px); bottom: 6%; z-index: 3; white-space: nowrap; min-height: 40px;
  background: var(--ardoise); border: 4px solid var(--bois); border-radius: 999px; padding: 4px 20px; box-shadow: 0 4px 0 rgba(60, 30, 10, .35);
  opacity: 0; visibility: hidden; transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.sp .sp-parler:hover { background: var(--ardoise-fonce); }
@media (hover: hover) and (pointer: fine) {
  .sp-groupe:hover .sp-parler, .sp-groupe:focus-within .sp-parler { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
}

.sp-aide {
  position: absolute; left: 50%; transform: translateX(-50%); top: 16%; z-index: 3; width: max-content; max-width: 92%;
  padding: 5px 14px; border-radius: 99px; font-size: 13px; background: rgba(34, 59, 48, .86); pointer-events: none; transition: opacity .4s ease;
}
.sp-aide.sp-vue, .sp-grand .sp-aide { opacity: 0; }

/* ------------------------------------------------ Le calendrier, seul bouton */
.sp-menu {
  position: relative; z-index: 11; flex: none; display: flex; justify-content: center;
  height: calc(52px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  background: var(--ardoise); border-top: 7px solid var(--bois); box-shadow: inset 0 3px 0 var(--bois-fonce);
}
.sp .sp-calendrier {
  position: relative; align-self: flex-start; margin-top: -40px; width: 78px; height: 78px; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: var(--jaune); color: var(--ardoise-fonce); border: 6px solid var(--bois); box-shadow: 0 6px 14px rgba(20, 10, 0, .4);
}
.sp .sp-calendrier:hover { background: #ffe48f; color: var(--ardoise-fonce); }
.sp-calendrier .sp-picto { width: 42px; height: 42px; }
.sp-calendrier b { position: absolute; right: -8px; top: -8px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 99px; background: var(--rouge); color: #fff; font-size: 14px; display: grid; place-items: center; border: 2px solid #fff; }
/* Grand écran : pas de barre, le calendrier flotte dans le coin. */
.sp-grand .sp-menu { position: absolute; right: 18px; bottom: 18px; height: auto; padding: 0; background: none; border: 0; box-shadow: none; }
.sp-grand .sp-calendrier { margin: 0; }

/* ------------------------------------------------ Tableaux d'école */
/* Le voile laisse le menu libre : le calendrier reste accessible en permanence. */
.sp-voile { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: calc(88px + env(safe-area-inset-bottom)) 14px; background: rgba(30, 18, 8, .62); }
.sp-grand .sp-voile { inset: 0; padding: 14px; }
.sp-voile.sp-voile-leger { background: rgba(30, 18, 8, .28); }
.sp-tableau {
  display: flex; flex-direction: column; width: min(540px, 100%); max-height: 100%; position: relative;
  border: 12px solid var(--bois); border-radius: 18px; box-shadow: inset 0 0 0 3px var(--bois-fonce), 0 24px 60px rgba(20, 10, 0, .55);
  background:
    radial-gradient(60% 40% at 22% 18%, rgba(255, 255, 255, .07), transparent),
    radial-gradient(50% 35% at 80% 72%, rgba(255, 255, 255, .05), transparent),
    var(--ardoise);
  animation: sp-monte .26s ease both;
}
.sp-large { width: min(680px, 100%); }
@keyframes sp-monte { from { opacity: 0; translate: 0 24px; } }
.sp-tableau header { display: flex; align-items: center; gap: 12px; padding: 14px 14px 10px 18px; border-bottom: 2px dashed rgba(246, 242, 228, .28); }
.sp-tableau h3 { font-size: 23px; }
.sp-tableau header p { font-size: 13px; opacity: .82; }
.sp-vignette { width: 60px; height: 60px; flex: none; border-radius: 50%; background: #fffaf0 center top / 175% no-repeat; border: 4px solid var(--bois); }
.sp .sp-fermer { margin-left: auto; align-self: flex-start; flex: none; width: 44px; height: 44px; padding: 0 0 4px; border-radius: 50%; font-size: 27px; line-height: 1; font-weight: 400; }
.sp-corps { padding: 14px 18px 16px; overflow: auto; overscroll-behavior: contain; font-size: 16px; }
.sp-rebord { flex: none; display: flex; justify-content: flex-end; gap: 8px; height: 12px; padding: 0 22px; background: var(--bois-fonce); border-radius: 0 0 6px 6px; }
.sp-rebord i { display: block; width: 34px; height: 8px; margin-top: -3px; border-radius: 4px; background: #fff; }
.sp-rebord i:nth-child(2) { background: var(--jaune); }
.sp-rebord i:nth-child(3) { background: #ff9d8a; }
.sp-parole { margin: 0 0 12px !important; opacity: .94; }
.sp-question { margin: 0 0 12px !important; font-weight: 700; font-size: 17px; }
.sp-choix { display: grid; gap: 9px; margin: 0 0 13px; }
.sp .sp-choix button { text-align: left; font-weight: 400; }
.sp .sp-choix button[aria-pressed="true"] { border-style: solid; border-color: var(--jaune); background: rgba(255, 217, 102, .18); font-weight: 700; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.sp-modale-prof .sp-actions { padding-top: 32px; }
.sp .sp-craie-jaune, .sp .sp-craie-jaune:hover { background: var(--jaune); color: #22301f; border: 2px solid var(--jaune); }
.sp-indice { margin: 0 0 12px !important; padding: 10px 14px; border-left: 4px solid var(--jaune); font-style: italic; color: #ffeaa6; }
.sp-retour { margin: 10px 0 0 !important; font-weight: 700; color: #ffd3c9; min-height: 1.4em; }
.sp-note { margin: 10px 0 0 !important; font-size: 12px; opacity: .75; }
.sp .sp-champ { width: 100%; margin: 0 0 11px; padding: 12px 14px; font-family: inherit; font-size: 16px; color: #202024; background: #fffaf0; border: 3px solid var(--bois); border-radius: 10px; }
.sp .sp-accord { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 13px; font-size: 14px; color: var(--craie); }
.sp-accord input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--jaune); }
.sp-actions a { color: var(--craie); font-size: 14px; }
.sp .sp-jours { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 12px; }
.sp .sp-jours button { min-height: 36px; padding: 5px 12px; font-size: 13px; }
.sp .sp-jours button[aria-pressed="true"] { border-style: solid; border-color: var(--jaune); color: var(--jaune); }
.sp .sp-telecharger { display: inline-block; padding: 12px 22px; border-radius: 12px; background: var(--jaune); color: #22301f; font-weight: 700; text-decoration: none; }
.sp-grille { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.sp .sp-case { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 6px 2px; font-weight: 400; opacity: .6; }
.sp-case b { font-weight: 700; font-size: 21px; } /* chiffres en Lato : dans la police de titre, 1 et 9 se lisent mal */
.sp-case .sp-picto { width: 20px; height: 20px; }
.sp-case small { font-size: 10px; line-height: 1.15; }
.sp .sp-case.sp-a-prendre { opacity: 1; border-style: solid; border-color: var(--jaune); background: rgba(255, 217, 102, .2); }
.sp .sp-case.sp-prise { opacity: 1; border-style: solid; border-color: #a9e3a0; color: #c4f0bc; }
.sp .sp-case.sp-finale { opacity: 1; border-style: solid; border-color: var(--jaune); color: var(--jaune); }

@media (max-width: 759px) {
  .sp-voile { padding-left: 6px; padding-right: 6px; }
  .sp-tableau { border-width: 9px; max-height: 100%; }
  .sp-tableau h3 { font-size: 21px; }
}
@media (max-width: 420px) {
  .sp-grille { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-height: 640px) { .sp-aide { display: none; } .sp-plaque { font-size: 14px; } }
@media (prefers-reduced-motion: reduce) { .sp * { animation: none !important; transition: none !important; } }

/* ------------------------------------------------ Accueil, collecte, formulaire */
.sp h4 { margin: 0 0 8px; font-family: "SP Titre", "Lato", sans-serif; font-weight: 400; font-size: 21px; line-height: 1.2; color: var(--craie); text-transform: none; }
.sp-centre { justify-content: center; }
.sp-milieu { text-align: center; }
.sp-etape { text-align: center; min-height: 190px; }
.sp-etape .sp-picto { width: 68px; height: 68px; color: var(--jaune); margin-bottom: 10px; }
.sp-points { display: flex; justify-content: center; gap: 8px; margin: 6px 0 14px; }
.sp-points i { width: 10px; height: 10px; border-radius: 50%; background: rgba(246, 242, 228, .35); }
.sp-points i.sp-ici { background: var(--jaune); }
.sp-liste { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.sp-liste li { display: flex; gap: 12px; align-items: flex-start; margin: 0; }
.sp-liste .sp-picto { color: var(--jaune); }
.sp-mot .sp-question { font-size: 16px; }
.sp-mot .sp-parole { font-size: 14px; }
.sp-tampon { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 2px auto 10px; color: var(--jaune); }
.sp-tampon .sp-picto { width: 84px; height: 84px; }
.sp-tampon .sp-picto svg { fill: rgba(255, 217, 102, .22); }
.sp-tampon strong { font-family: "SP Titre", sans-serif; font-weight: 400; font-size: 22px; border: 3px dashed var(--jaune); border-radius: 10px; padding: 6px 14px; transform: rotate(-3deg); }
.sp-tampon.sp-neuf { animation: sp-tampon .55s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes sp-tampon { from { scale: 1.8; opacity: 0; } }
.sp-feuille { background: #fffaf0; color: #202024; border-radius: 6px; padding: 14px; margin: 0 0 10px; box-shadow: 0 6px 14px rgba(0, 0, 0, .3); position: relative; }
.sp-feuille::before { content: ""; position: absolute; left: 50%; top: -8px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--rouge); box-shadow: 0 2px 3px rgba(0, 0, 0, .4); }
.sp-tally { display: block; width: 100%; height: 340px; border: 0; background: transparent; }
.sp-simulation { margin: 4px 0 10px !important; font-size: 12px; color: #6a5a48; }
.sp .sp-feuille .sp-accord { color: #202024; }
.sp .sp-feuille .sp-accord input { accent-color: var(--ardoise); }
.sp .sp-envoyer, .sp .sp-envoyer:hover { width: 100%; background: var(--ardoise); color: #fff; border: 0; }
.sp .sp-jours button.sp-prise { color: #c4f0bc; border-color: #a9e3a0; }
@media (prefers-reduced-motion: reduce) { .sp-tampon.sp-neuf { animation: none; } }

/* ------------------------------------------------ Modale d'entrée : toute la page, floutée et assombrie */
.sp .sp-voile.sp-obligatoire {
  position: fixed; inset: 0; z-index: 99999; align-items: center; justify-content: center; padding: 14px;
  background: rgba(16, 10, 4, .68); -webkit-backdrop-filter: blur(9px) saturate(.85); backdrop-filter: blur(9px) saturate(.85);
}
.sp-porte-modale { width: min(480px, 100%); max-height: 100%; }
.sp-porte-modale .sp-corps { color: #202024; padding: 12px 16px 14px; }
.sp-porte-modale .sp-feuille { background: transparent; box-shadow: none; padding: 0; margin: 0; }
.sp-porte-modale .sp-feuille::before { content: none; }
.sp-porte-modale .sp-tally { height: min(420px, 58vh); }
.sp-porte-modale .sp-actions a { color: #2c4b3d; }
@media (max-height: 700px) { .sp-porte-modale .sp-vignette { display: none; } }
