/* ==========================================================================
   Portail classe — design glassmorphism orange/rouge
   ========================================================================== */

* { box-sizing: border-box; font-family: 'Poppins', sans-serif; }

/* Safari 26 (Liquid Glass) : un <button> dont le fond est un dégradé seul
   (background-color transparente) garde son habillage NATIF dessiné derrière le
   style du site → rectangle arrondi fantôme sous les pilules. On coupe le rendu
   natif de tous les boutons — le site les stylise intégralement lui-même. */
button { appearance: none; -webkit-appearance: none; }

:root {
  --bg-start: #FF6B35;
  --bg-end: #C0392B;
  --bg-gradient: linear-gradient(160deg, #FF6B35 0%, #FF6B35 20%, #E8143C 65%, #C0392B 100%);
  --color-on-light-accent: color-mix(in srgb, var(--bg-end) 62%, #111827 38%);
  --color-success: #86efac;
  --color-danger:  #fca5a5;
  --color-muted:   rgba(255,255,255,0.65);
  --color-border:  rgba(255,255,255,0.25);
  --tap: 48px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

html {
  margin: 0; padding: 0;
  font-size: 17px;
  /* DÉFILEMENT NATUREL (comme apple.com) : le document défile, donc le TABLEAU
     descend jusqu'au bord du bas, derrière la pilule Safari — pas de height fixe
     ni d'overflow:hidden qui l'enfermeraient. Le fond (halos) est sur une couche
     fixe statique ; la fine bande basse est bouchée par le canevas en couleur
     assortie au bas du fond → raccord invisible. */
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  background-color: var(--bg-start);
  background-image: var(--bg-gradient);
}

/* Fond fixe sur html::before */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bg-start);
  background-image: var(--bg-gradient);
}

body {
  margin: 0; padding: 0;
  /* Le document défile naturellement ; le body remplit AU MOINS l'écran (onglets
     courts sans vide). Le fond (halos) est sur la couche fixe html::before —
     statique — pendant que le contenu défile dessous jusqu'au bord du bas. */
  min-height: 100vh;
  min-height: 100dvh;
  background: transparent;
  overflow-x: hidden;
  overscroll-behavior: none;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.student-page, .teacher-page {
  min-height: 100vh;
  min-height: 100dvh;
  color: white;
  text-shadow: 0 1px 5px rgba(0,0,0,0.45);
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* Texte disponible aux lecteurs d'écran sans modifier la mise en page. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================================
   Bouton "glass" — page portail, lien "Découvrir brioo"
   ========================================================================= */
.btn--glass {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 18px 38px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1.5px solid rgba(255,255,255,0.40);
  color: white;
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem; font-weight: 700;
  border-radius: 50px;
  text-decoration: none;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
@media (hover: hover) and (pointer: fine) {
  .btn--glass:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.24);
    box-shadow: 0 14px 40px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.30);
  }
}

/* =========================================================================
   Accessibilité — respect du réglage système "réduire les animations"
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================================
   Accessibilité — focus clavier visible
   ========================================================================= */
:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  border-radius: 6px;
}
.btn:focus-visible,
button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(0,0,0,0.35);
}

.gradient-colors {
  display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px;
}
.gradient-colors label {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 0.85rem; color: var(--color-muted);
}
.gradient-colors input[type="color"] {
  width: 48px; height: 48px; padding: 0; border: none;
  border-radius: var(--radius-sm); cursor: pointer; background: none;
}

/* =========================================================================
   Boutons
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 10px 20px;
  border: none; border-radius: var(--radius-md);
  font-weight: 600; cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: white; color: var(--color-on-light-accent); font-weight: 700; }
.btn--primary:hover { opacity: 0.9; }
.btn--ghost {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
}
.btn--danger {
  background: rgba(252,165,165,0.15);
  border: 1px solid rgba(252,165,165,0.45);
  color: #fca5a5;
}
.btn--danger:hover { background: rgba(252,165,165,0.3); }
.settings-card--danger { border-color: rgba(252,165,165,0.35); }
.settings-card--danger h2 { color: #fca5a5; }
.btn--close {
  background: rgba(255,255,255,0.2); color: white;
  min-height: 44px; padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
}
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: 0.88rem; }

/* =========================================================================
   Inputs / formulaires
   ========================================================================= */
input[type=text], input[type=password], input[type=email], input[type=color],
select, textarea {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 12px;
  color: white;
  outline: none;
  transition: border-color 0.15s;
  min-height: var(--tap);
}
input[type=color] { padding: 4px; height: var(--tap); }
textarea {
  resize: vertical; min-height: 200px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.55); }
input:focus, select:focus, textarea:focus { border-color: rgba(255,255,255,0.7); }
select option { background: #C0392B; color: white; }
label {
  display: block; font-weight: 600; margin-bottom: 14px;
  color: rgba(255,255,255,0.85);
}
label > input, label > select, label > textarea { margin-top: 6px; font-weight: 400; }
.form-error  { color: #fca5a5; margin-top: 10px; min-height: 1.2em; font-weight: 500; }
.form-success { color: #86efac; margin-left: 12px; font-weight: 500; }

/* =========================================================================
   Page de connexion
   ========================================================================= */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  /* Réserve la hauteur du bandeau de crédits (position: fixed) pour qu'il ne
     recouvre jamais le contenu, même quand le formulaire est long (iPhone). */
  padding-bottom: calc(72px + max(20px, env(safe-area-inset-bottom)));
}
/* Centrage vertical via marges auto plutôt que justify-content : quand le
   formulaire dépasse la hauteur de l'écran (petits iPhone), le haut reste
   accessible au défilement au lieu d'être coupé. */
.login-page > div { margin-block: auto; }
.login-container { width: 100%; max-width: 900px; text-align: center; }
.login-title {
  color: white; font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 8px; font-weight: 700;
}
.login-subtitle { color: rgba(255,255,255,0.85); font-size: 1.1rem; margin: 0 0 30px; }

/* Flux multi-étapes (rôle → prénom → classe) */
.login-step {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
  color: white;
  position: relative;
}
.login-back {
  position: absolute; top: 14px; left: 14px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  border-radius: 12px; padding: 8px 14px;
  font-weight: 600; cursor: pointer;
  min-height: 40px;
}
.login-back:active { transform: scale(0.97); }
.login-form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; margin: 0 auto; }
.login-form label { text-align: left; }
.login-loading { color: rgba(255,255,255,0.75); padding: 30px; }
.login-hint {
  text-align: left; max-width: 420px; margin: -8px auto 0;
  color: rgba(255,255,255,0.75); font-size: 0.8rem; line-height: 1.35;
}
.login-link {
  display: inline-block;
  margin: 18px auto 0;
  background: none; border: none;
  color: white; font: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer; min-height: 40px;
}
.login-link:active { transform: scale(0.97); }

/* Séparateur « ou » entre le formulaire et le bouton Google */
.login-or {
  display: flex; align-items: center; gap: 12px;
  max-width: 420px; margin: 18px auto 0;
  color: rgba(255,255,255,0.65); font-size: 0.85rem;
}
.login-or::before, .login-or::after {
  content: ''; flex: 1; height: 1px;
  background: rgba(255,255,255,0.25);
}
/* Conteneur du bouton « Se connecter avec Google » (rendu par Google) */
.google-signin { display: flex; justify-content: center; margin: 14px auto 0; min-height: 44px; }

.login-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  max-width: 600px; margin: 10px auto 0;
}
.login-role-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius-lg);
  color: white; cursor: pointer;
  padding: 28px 18px;
  min-height: 160px;
  font-family: inherit;
  transition: transform 0.08s ease, background 0.15s;
}
.login-role-card:hover { background: rgba(255,255,255,0.22); }
.login-role-card:active { transform: scale(0.97); }
.login-role-card__emoji { font-size: 3rem; line-height: 1; }
.login-role-card__title { font-size: 1.1rem; font-weight: 700; }

.login-classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  max-width: 760px;
  margin: 10px auto 0;
}
.login-class-card {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius-lg);
  color: white;
  cursor: pointer;
  padding: 22px 16px;
  min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit;
  transition: transform 0.08s ease, background 0.15s;
}
.login-class-card:hover { background: rgba(255,255,255,0.25); }
.login-class-card:active { transform: scale(0.97); }
.login-class-card__name { font-size: 1.25rem; font-weight: 700; }

/* Saisie du code de classe (6 chiffres) : gros chiffres centrés, lisibles */
.login-code-input {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Code de classe affiché à l'enseignant (Réglages → Mes élèves) */
.classe-code-display {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 4px;
}

/* Bulle de message aux enseignants (modale affichée à la connexion) */
.annonce-modal__body { padding: 18px 24px 6px; }
.annonce-modal__corps {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: break-word;
  color: rgba(255,255,255,0.88);
  line-height: 1.5;
}
.annonce-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px 20px;
}

/* =========================================================================
   Page élève
   ========================================================================= */
.student-page { padding-bottom: max(30px, env(safe-area-inset-bottom)); }
.teacher-page { padding-bottom: 30px; }

.student-header {
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.25);
  padding: 16px 24px;
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  position: relative;
}
.student-header__left { display: flex; align-items: center; gap: 14px; }
.student-avatar-link { display: block; text-decoration: none; flex-shrink: 0; }
.student-avatar-mini {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  border: 3px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.student-avatar-mini:hover {
  transform: scale(1.1);
  border-color: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}
.student-avatar-mini svg { width: 100%; height: 100%; }
.student-hello { font-size: 22px; font-weight: 700; color: white; }
.student-class { font-size: 14px; color: rgba(255,255,255,0.75); }
.student-header .btn--ghost, .teacher-header .btn--ghost {
  background: white; color: var(--color-on-light-accent); border: none;
  border-radius: 14px; padding: 10px 20px; font-weight: 600;
}
.student-header__right {
  display: flex; align-items: center; gap: 12px;
}
.streak-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  align-self: stretch;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 14px;
  padding: 0 14px;
  cursor: default;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
/* Sans cette règle, le "display: flex" ci-dessus écrase l'attribut hidden et
   le chip resterait toujours visible (mode maison / streak). */
.streak-chip[hidden] { display: none; }
.streak-chip__flame {
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  line-height: 1.2;
}
.streak-chip__label {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Badges élève ---- */
.header-badges {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.header-badges:empty { display: none; }
.header-badges .badge-item { pointer-events: auto; }
.badge-more {
  display: none;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 0.82rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.badge-item img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255,220,80,0.7));
}
.badge-item__label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  text-align: center;
}

/* ---- Animation badge débloqué (pack opening) ---- */
#badge-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; overflow: hidden;
}
.bdg-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 42%, #1e0840 0%, #06001a 100%);
}
.bdg-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 15% 25%, rgba(255,255,255,.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 65%, rgba(255,255,255,.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 12%, rgba(255,255,255,.45) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 78%, rgba(255,255,255,.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 8% 58%, rgba(255,255,255,.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 92% 42%, rgba(255,255,255,.35) 0%, transparent 100%),
    radial-gradient(2px 2px at 50% 22%, rgba(255,255,255,.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 85%, rgba(255,255,255,.4) 0%, transparent 100%);
  background-size: 700px 700px;
  animation: bdgStars 25s linear infinite;
}
@keyframes bdgStars { to { background-position: 700px 700px; } }

#badge-pcanvas { position: absolute; inset: 0; pointer-events: none; z-index: 10; }

.bdg-flash { position: absolute; inset: 0; background: white; opacity: 0; pointer-events: none; z-index: 20; }
.bdg-flash.bdg-bang { animation: bdgFlash .5s ease-out forwards; }
@keyframes bdgFlash { 0%{opacity:1} 100%{opacity:0} }

.bdg-wave {
  position: absolute; top: 50%; left: 50%;
  width: 20px; height: 20px; border-radius: 50%;
  border: 4px solid rgba(255,220,60,.9);
  transform: translate(-50%,-50%) scale(0); opacity: 0;
  pointer-events: none; z-index: 15;
}
.bdg-wave.bdg-go { animation: bdgWave .9s ease-out forwards; }
#badge-w2.bdg-go { animation-delay:.12s; border-color: rgba(255,100,50,.8); }
#badge-w3.bdg-go { animation-delay:.24s; border-color: rgba(180,80,255,.7); }
@keyframes bdgWave {
  0%   { transform:translate(-50%,-50%) scale(0); opacity:1; border-width:4px; }
  100% { transform:translate(-50%,-50%) scale(38); opacity:0; border-width:1px; }
}

#badge-phase-mystery {
  position: relative; z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.bdg-mystery-label {
  color: rgba(255,255,255,.55); font-size: 13px; letter-spacing: 3px;
  text-transform: uppercase; animation: bdgBlink 2s ease-in-out infinite;
}
@keyframes bdgBlink { 0%,100%{opacity:.35} 50%{opacity:1} }

.bdg-mbox {
  width: 140px; height: 140px; border-radius: 26px; cursor: pointer;
  background: radial-gradient(circle at 36% 30%, #b060f0, #18002e);
  display: flex; align-items: center; justify-content: center; font-size: 66px;
  box-shadow: 0 0 0 2px rgba(180,100,255,.5), 0 0 40px rgba(160,80,240,.9),
              0 0 100px rgba(140,60,210,.5), inset 0 1px 0 rgba(255,255,255,.12);
  animation: bdgBoxFloat 3s ease-in-out infinite, bdgBoxGlow 2s ease-in-out infinite alternate;
  user-select: none; position: relative;
}
.bdg-mbox::before, .bdg-mbox::after {
  content: ''; position: absolute; width: 22px; height: 22px;
  border-color: rgba(255,220,60,.65); border-style: solid; border-radius: 3px;
}
.bdg-mbox::before { top: 9px; left: 9px;   border-width: 2.5px 0 0 2.5px; }
.bdg-mbox::after  { bottom: 9px; right: 9px; border-width: 0 2.5px 2.5px 0; }
@keyframes bdgBoxFloat {
  0%,100%{ transform:translateY(0) rotate(0); }
  35%    { transform:translateY(-15px) rotate(-2deg); }
  65%    { transform:translateY(-10px) rotate(2deg); }
}
@keyframes bdgBoxGlow {
  from { box-shadow:0 0 0 2px rgba(180,100,255,.5),0 0 45px rgba(160,80,240,.9),0 0 100px rgba(140,60,210,.4); }
  to   { box-shadow:0 0 0 2px rgba(220,140,255,.8),0 0 75px rgba(200,110,255,1),0 0 160px rgba(160,80,240,.6); }
}
.bdg-mbox.bdg-shake { animation: bdgShake .55s cubic-bezier(.36,.07,.19,.97) both !important; }
@keyframes bdgShake {
  0%,100%{ transform:translate(0,0) rotate(0); }
  10%{ transform:translate(-11px,0) rotate(-7deg); }
  20%{ transform:translate(13px,0) rotate(7deg); }
  30%{ transform:translate(-13px,-3px) rotate(-5deg); }
  40%{ transform:translate(13px,3px) rotate(5deg); }
  50%{ transform:translate(-9px,0) rotate(-3deg); }
  60%{ transform:translate(9px,0) rotate(3deg); }
  80%{ transform:translate(-4px,0) rotate(-1deg); }
}
.bdg-tap-label { color: rgba(255,255,255,.45); font-size: 13px; animation: bdgBlink 1.5s ease-in-out infinite; }

#badge-phase-reveal {
  position: relative; z-index: 30;
  display: flex; flex-direction: column; align-items: center;
}
.bdg-scene { perspective: 900px; position: relative; z-index: 5; }
.bdg-card {
  width: 170px; height: 170px; position: relative;
  animation: bdgReveal 1.15s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes bdgReveal {
  0%  { transform:scale(0) rotateY(-210deg) rotateX(30deg); opacity:0; filter:brightness(5); }
  50% { transform:scale(1.28) rotateY(22deg) rotateX(-5deg); opacity:1; filter:brightness(1.6); }
  72% { transform:scale(0.92) rotateY(-8deg); filter:brightness(1.1); }
  86% { transform:scale(1.07) rotateY(4deg); }
  100%{ transform:scale(1) rotateY(0) rotateX(0); filter:brightness(1); }
}
.bdg-card img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 0 20px var(--bdg-glow, rgba(255,210,60,.9)))
          drop-shadow(0 0 55px var(--bdg-glow2, rgba(255,160,0,.55)));
  animation: bdgFloat 3.2s ease-in-out 1.15s infinite;
}
@keyframes bdgFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-11px)} }
.bdg-gleam {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden; pointer-events: none;
}
.bdg-gleam::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 55%; height: 100%;
  background: linear-gradient(108deg, transparent 38%, rgba(255,255,255,.6) 50%, transparent 62%);
  animation: bdgGleam 2.6s ease-in-out 1.1s infinite;
}
@keyframes bdgGleam {
  0%,38%{left:-100%;opacity:0} 43%{opacity:1} 68%{left:150%;opacity:0} 100%{left:150%;opacity:0}
}
.bdg-orbit {
  position: absolute; top:50%; left:50%; width:0; height:0;
  animation: bdgOrbitSpin var(--spd) linear infinite var(--delay);
}
@keyframes bdgOrbitSpin { to { transform:rotate(360deg); } }
.bdg-orbit-gem {
  position: absolute;
  top: calc(var(--r) * -1); left: calc(var(--sz) * -.5);
  width: var(--sz); height: var(--sz);
  background: var(--col); border-radius: 2px; transform: rotate(45deg);
  box-shadow: 0 0 8px var(--col), 0 0 18px var(--col);
  animation: bdgGemPulse 1.1s ease-in-out infinite alternate;
}
@keyframes bdgGemPulse {
  from { transform:rotate(45deg) scale(.65); opacity:.55; }
  to   { transform:rotate(45deg) scale(1.35); opacity:1; }
}
.bdg-title {
  font-size: 32px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase;
  color: var(--bdg-text-color, #FFD700);
  text-shadow: 0 0 14px var(--bdg-glow, rgba(255,180,0,.95)),
               0 0 45px var(--bdg-glow2, rgba(255,140,0,.65)),
               0 3px 0 rgba(0,0,0,.45);
  margin-top: 22px; opacity: 0; transform: translateY(-44px) scale(.8);
  animation: bdgTitleSlam .55s cubic-bezier(0.175,0.885,0.32,1.4) .8s forwards;
}
@keyframes bdgTitleSlam { to { opacity:1; transform:translateY(0) scale(1); } }
.bdg-title.bdg-rainbow {
  background: linear-gradient(90deg,#FFD700,#FF6B35,#FF3CAC,#784BA0,#2B86C5,#00C9A7,#A8FF3E,#FFD700);
  background-size: 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  animation: bdgTitleSlam .55s cubic-bezier(0.175,0.885,0.32,1.4) .8s forwards,
             bdgRainbow 3s linear 1.35s infinite;
}
@keyframes bdgRainbow { to { background-position: 300% center; } }
.bdg-sub {
  font-size: 15px; color: rgba(255,255,255,.8); margin-top: 10px; text-align: center;
  opacity: 0; animation: bdgFadeIn .5s ease 1.25s forwards;
}
@keyframes bdgFadeIn { to { opacity:1; } }
.bdg-btn {
  margin-top: 28px;
  background: linear-gradient(135deg, #FFD700, #FF8C00);
  color: #180800; border: none; border-radius: 999px;
  padding: 15px 46px; font-family: 'Poppins', sans-serif;
  font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 24px rgba(255,180,0,.55);
  opacity: 0; transform: translateY(24px);
  animation: bdgBtnRise .45s ease 1.65s forwards, bdgBtnPulse 2s ease-in-out 2.3s infinite;
  transition: transform .15s;
}
@keyframes bdgBtnRise { to { opacity:1; transform:translateY(0); } }
@keyframes bdgBtnPulse {
  0%,100%{ box-shadow:0 4px 24px rgba(255,180,0,.55),0 0 0 0 rgba(255,200,0,.3); }
  50%    { box-shadow:0 4px 24px rgba(255,180,0,.55),0 0 0 16px rgba(255,200,0,0); }
}
@media (hover: hover) and (pointer: fine) {
  .bdg-btn:hover { transform: translateY(-3px) scale(1.04); }
}

.teacher-message {
  max-width: 1052px; margin: 16px auto 8px; padding: 16px 20px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.28);
  border-radius: 16px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.teacher-message[hidden] { display: none; }
.teacher-message__icon { font-size: 1.4rem; line-height: 1.4; flex-shrink: 0; }
.teacher-message__text {
  margin: 0; color: white; font-size: 1rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; text-align: center;
}
@media (max-width: 1100px) {
  .teacher-message { margin-left: 24px; margin-right: 24px; }
}
@media (max-width: 640px) {
  .teacher-message { margin-left: 14px; margin-right: 14px; }
}
.exercises-container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.subject-section { margin-bottom: 28px; }
.subject-title {
  display: flex; align-items: center; gap: 10px;
  margin: 32px 0 12px; font-size: 20px; font-weight: 700; color: white;
}
.subject-title__dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }

.subject-progress {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
}
.subject-progress__bar {
  flex: 1; min-width: 60px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px; overflow: hidden; height: 8px;
}
.subject-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, #86efac, white);
  border-radius: 999px;
  transition: width 0.5s ease; width: 0%;
}
.subject-progress__pct {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.9);
  white-space: nowrap; min-width: 36px; text-align: right;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.exercise-card {
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.exercise-card--mastered > *:not(.exercise-card__check) { opacity: 0.5; }
.exercise-card__check {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 1;
}
.exercise-card__check svg {
  width: 68px; height: 68px;
  filter: drop-shadow(0 2px 8px rgba(90,160,110,0.3));
}
.exercise-card:hover, .exercise-card:focus-visible {
  transform: translateY(-4px);
  background: rgba(255,255,255,0.25);
}
.exercise-card:active { transform: scale(0.98); }
.exercise-card--done { border-color: rgba(134,239,172,0.55); }
.exercise-card__top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px;
}
.exercise-card__emoji { font-size: 40px; margin-bottom: 4px; }
.exercise-card__score {
  background: rgba(255,255,255,0.9);
  padding: 4px 10px; border-radius: 999px;
  font-weight: 700; font-size: 0.88rem;
  display: inline-flex; align-items: center; gap: 4px;
}
.exercise-card__name  { margin: 0; font-size: 16px; font-weight: 600; color: white; }
.exercise-card__desc  { color: rgba(255,255,255,0.75); font-size: 13px; line-height: 1.4; margin: 0; }
.exercise-card__meta  { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.badge {
  display: inline-block; padding: 4px 10px;
  border-radius: 999px; color: white;
  font-size: 0.78rem; font-weight: 700;
}
.badge--niveau {
  background: rgba(0,0,0,0.15); color: rgba(255,255,255,0.85);
  border-radius: 20px; padding: 4px 10px;
}
.loading, .empty { text-align: center; color: rgba(255,255,255,0.7); padding: 40px; }

/* =========================================================================
   Modale exercice (élève) — plein écran
   ========================================================================= */
.exercise-modal {
  position: fixed; inset: 0; background: white;
  z-index: 100; display: flex; flex-direction: column;
}
.exercise-modal[hidden] { display: none; }
.exercise-modal__bar {
  background: var(--bar-bg, rgba(192,57,43,0.95));
  backdrop-filter: blur(10px);
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  padding: 12px 18px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.exercise-modal__bar .btn--close {
  color: white;
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.35);
}
.exercise-modal__title {
  font-weight: 700; font-size: 1.05rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exercise-modal__save-error {
  min-height: 44px;
  padding: 7px 14px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: #fff3cd; color: #633c00;
  font-weight: 700; text-align: center;
}
.exercise-modal__save-error[hidden] { display: none; }
.exercise-modal__save-error button {
  min-height: 44px; padding: 6px 14px;
  border: 0; border-radius: 999px;
  background: #633c00; color: white; font: inherit; font-weight: 800;
}
.exercise-modal__save-error button:disabled { opacity: 0.55; }
.exercise-modal__frame { flex: 1; border: none; width: 100%; background: white; }

/* =========================================================================
   Page enseignant
   ========================================================================= */
.teacher-header {
  /* Figé en haut : il reste collé pendant le scroll, le reste de la page passe
     dessous et se floute (comme index/aide). Le padding-top = safe-area fait que
     le verre remonte sous la barre d'état en app installée (standalone). */
  position: sticky; top: 0; z-index: 100;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.25);
  padding: 16px 24px;
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.teacher-header h1 { margin: 0; font-size: 1.3rem; font-weight: 700; color: white; }
.teacher-header .btn--icon-only {
  position: relative;
  padding: 0;
  width: 44px; height: 44px;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px;
}
.teacher-header .btn--icon-only svg { display: block; }
/* Bouton déconnexion : texte sur ordi (l'icône n'apparaît que sur mobile) */
#btn-logout svg { display: none; }
.msg-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #FF6B35;
  box-shadow: 0 0 0 2px white;
}

.tabs {
  display: flex; gap: 6px;
  padding: 6px;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  margin: 16px 24px;
  width: auto;
  overflow-x: auto;
}
.tab {
  flex: 1 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: none; border-radius: 12px;
  padding: 10px 20px; cursor: pointer;
  font-weight: 600; color: rgba(255,255,255,0.8);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tab--active { background: white; color: var(--color-on-light-accent); font-weight: 700; }
.tab[hidden] { display: none !important; }
.tab__icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.tab__icon svg { width: 20px; height: 20px; display: block; stroke: currentColor; }

.tab-content { display: none; padding: 0 24px 24px; }
.tab-content--active { display: block; }

.actions-bar { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.actions-bar > * { min-width: 0; }
.actions-bar__left { display: flex; align-items: stretch; gap: 14px; flex: 1; min-width: 0; flex-wrap: wrap; }

.actions-bar__left #btn-refresh-progress,
.actions-bar__left #btn-print { justify-content: center; }

/* Onglet « Ma classe » sur desktop (barre en flex) : Matière + Imprimer groupés à GAUCHE
   (même taille, avec leur texte), et SEUL le « i » poussé tout à droite. */
@media (min-width: 1025px) {
  #tab-students .actions-bar,
  #tab-compta .actions-bar { justify-content: flex-start; }
  #tab-students .actions-bar__left,
  #tab-compta .actions-bar__left { flex: 0 0 auto; }
  #tab-students .actions-bar .sort-control,
  #tab-students .actions-bar #btn-print-eval,
  #tab-compta .actions-bar .sort-control,
  #tab-compta .actions-bar #cmp-export { flex: 0 0 200px; }   /* même largeur pour les deux */
  /* « i » collé au bord droit du contenu, comme sur iPhone (dernière colonne de
     la grille, aligné à droite) — reste à droite quelle que soit la largeur d'écran. */
  #tab-students .actions-bar #btn-kbd-tip,
  #tab-compta .actions-bar #cmp-info { grid-column: 4; justify-self: end; margin-left: auto; }
}

.sort-control {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: var(--tap);
  background: white;
}
.sort-control::after {
  content: '›';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  pointer-events: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-on-light-accent);
  line-height: 1;
  text-shadow: none;
}
.sort-control__label {
  display: flex;
  align-items: center;
  padding: 10px 4px 10px 14px;
  color: var(--color-on-light-accent);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
}
.sort-control__select {
  flex: 1;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  margin: 0;
  outline: none;
  color: var(--color-on-light-accent);
  padding: 10px 28px 10px 2px;
  font-family: Poppins, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
  text-align-last: center;
}
.sort-control__select:hover { opacity: 0.9; }

.score-chip { text-shadow: none; }

/* ── Date range picker ─────────────────────────────────────────── */
.drp {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 900;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  padding: 20px;
  min-width: 580px;
  color: #222;
  font-family: Poppins, sans-serif;
  animation: drp-in 0.18s ease;
}
@keyframes drp-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.drp__header {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
.drp__nav {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--color-on-light-accent);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.12s;
  flex-shrink: 0;
  margin-top: 2px;
}
.drp__nav:hover { background: rgba(0,0,0,0.06); }
.drp__months {
  display: flex;
  gap: 20px;
  flex: 1;
}
.drp__month {
  flex: 1;
  min-width: 220px;
}
.drp__month-title {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-on-light-accent);
  margin-bottom: 10px;
  text-transform: capitalize;
}
.drp__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.drp__dow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #888;
  padding: 4px 0;
}
.drp__day {
  text-align: center;
  padding: 7px 2px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  user-select: none;
  line-height: 1.2;
}
.drp__day:empty { cursor: default; }
.drp__day--today { font-weight: 700; }
.drp__day:not(:empty):not(.drp__day--disabled):hover {
  background: rgba(var(--color-accent-rgb, 255,107,53), 0.15);
}
.drp__day--in-range {
  background: rgba(var(--color-accent-rgb, 255,107,53), 0.12);
  border-radius: 0;
}
.drp__day--start,
.drp__day--end {
  background: var(--color-on-light-accent, #FF6B35) !important;
  color: white !important;
  font-weight: 700;
  border-radius: 6px !important;
}
.drp__day--start { border-radius: 6px 0 0 6px !important; }
.drp__day--end   { border-radius: 0 6px 6px 0 !important; }
.drp__day--start.drp__day--end { border-radius: 6px !important; }
.drp__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eee;
  gap: 12px;
}
#drp-label {
  font-size: 0.85rem;
  color: #666;
  flex: 1;
}
#drp-apply {
  background: var(--color-on-light-accent, #FF6B35);
  color: white;
  border: none;
  white-space: nowrap;
}
#drp-apply:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 640px) {
  .drp {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: min(560px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: 85vh;
    overflow-y: auto;
    padding: 14px;
    z-index: 910;
  }
  .drp__months { flex-direction: column; gap: 16px; }
}

.exercise-search-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  min-width: 0;
}
.exercise-search-wrapper input { flex: 1; width: auto; min-width: 0; }

/* TABLEAU PROGRESSION */
.table-wrapper {
  overflow-x: auto;
  /* Transparent : sinon la colonne Élève (sticky) capte le wrapper flouté
     au lieu du vrai dégradé → effet halo terne au lieu du liquid glass. */
  background: transparent;
  border-radius: 20px;
}
.progress-table { border-collapse: collapse; width: 100%; min-width: 500px; }
.progress-table th, .progress-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center; white-space: nowrap;
}
.progress-table th {
  color: rgba(255,255,255,0.6);
  font-size: 13px; text-transform: uppercase; font-weight: 600;
  position: sticky; top: 0;
  background: rgba(255,255,255,0.05);
}
.progress-table td { color: white; }
.progress-table th:first-child, .progress-table td:first-child {
  text-align: left; position: sticky; left: 0;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: 600; z-index: 2;
  padding: 10px 15px 10px 20px;
  width: 0.1%;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.progress-table th:first-child { z-index: 3; background: rgba(0,0,0,0.15); }
.cell-empty { color: rgba(255,255,255,0.4); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; }


/* DEUX COLONNES */
.two-cols { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: 24px; }
@media (max-width: 800px) { .two-cols { grid-template-columns: 1fr; } }

.col {
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 16px;
}
.section-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.section-header h2 { margin: 0; font-size: 1.2rem; color: white; }

.subjects-list, .students-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.subject-item, .student-item {
  background: rgba(0,0,0,0.1);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
}
.subject-item__color { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.subject-item__name { flex: 1; min-width: 0; color: white; font-weight: 600; }
.item-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.presence-dot {
  display: inline-block; vertical-align: middle;
  width: 10px; height: 10px; border-radius: 50%;
  margin-right: 7px;
}
.presence-dot--online  { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.8); }
.presence-dot--offline { background: #ef4444; }
.streak-badge {
  display: inline-block; vertical-align: middle;
  margin-left: 6px;
  font-size: 0.72rem; font-weight: 700;
  background: rgba(251,146,60,0.18);
  color: #FFD000;
  border-radius: 20px;
  padding: 1px 7px;
  white-space: nowrap;
}
/* Prénoms des tableaux Progression et Ma classe : la place disponible augmente
   avec la largeur de la page, sans jamais laisser un prénom étirer la colonne. */
.progress-student-name,
.eval-name,
.eval-name-link {
  display: inline-block;
  max-width: 7ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
@media (min-width: 600px) {
  .progress-student-name,
  .eval-name,
  .eval-name-link { max-width: 11ch; }
}
@media (min-width: 1025px) {
  .progress-student-name,
  .eval-name,
  .eval-name-link { max-width: 16ch; }
}
.icon-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; color: white;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn--danger:hover { background: rgba(252,165,165,0.3); }

/* Liste d'élèves (réglages) — ligne compacte et responsive */
.student-item__prenom {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;   /* un prénom long ne déborde pas */
}
.student-item { flex-wrap: wrap; row-gap: 8px; }
.student-item .degre-select,
.student-item .group-select { flex: 0 0 auto; width: auto; }
/* les 4 boutons restent toujours sur une seule ligne (jamais en 2x2),
   et se décalent en bloc à droite si la place manque */
.student-item .item-actions { flex-wrap: nowrap; margin-left: auto; }

@media (max-width: 640px) {
  /* Header : tout sur une ligne. On ne garde que le prénom de l'enseignant
     (on cache « Espace enseignant·e », le « · » et le rôle), et le bouton
     « Se déconnecter » devient une simple icône. */
  .teacher-header h1 {
    flex: 1 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .teacher-header__title,
  .teacher-name-badge .tnb-sep,
  .teacher-name-badge .tnb-role { display: none; }
  .teacher-header .teacher-name-badge { font-size: 1.1rem; font-weight: 700; color: inherit; }
  #btn-logout {
    padding: 0; width: 44px; height: 44px; flex: 0 0 auto;
  }
  #btn-logout svg { display: block; }
  #btn-logout .btn-label { display: none; }
  /* Les boutons du header = des carrés IDENTIQUES (bulle message, Aide,
     déconnexion), icône à la même taille. Le préfixe `.teacher-page` élève la
     spécificité pour battre le `padding: 8px 14px` du bloc ≤1024px (sinon la
     bulle message se gonfle et casse l'alignement). */
  .teacher-page .teacher-header .btn--ghost {
    box-sizing: border-box;
    width: 44px; height: 44px; min-height: 44px;
    padding: 0; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 14px;
    /* Graisse allégée (500) pour que le mot « Aide » ait le même poids visuel
       que le trait fin des SVG voisins (stroke-width 1.9) — sinon il paraît gras. */
    font-size: 0.85rem; font-weight: 500; white-space: nowrap;
  }
  .teacher-page .teacher-header .btn--ghost svg { width: 22px; height: 22px; }

  /* marge intérieure de carte réduite sur téléphone — préfixe .teacher-page
     pour battre la règle de base (sinon padding:20px l'emportait par ordre de source) */
  .teacher-page .settings-card { padding: 16px; }

  /* prénom + degré + groupe sur la ligne, et les 4 boutons en carré 2x2 à droite */
  .student-item { flex-wrap: nowrap; gap: 4px; padding: 8px; }
  .student-item__prenom {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;  /* prénom tronqué si vraiment trop long */
    font-size: 0.92rem;
  }
  /* selects à largeur fixe serrée (un select auto se cale sur sa plus longue
     option « Degré ? » → trop large) pour rendre la place au prénom */
  .student-item .degre-select {
    flex: 0 0 auto; width: 52px; min-width: 0;
    padding: 6px 2px; font-size: 0.8rem;
  }
  .student-item .group-select {
    flex: 0 1 80px; width: 80px; min-width: 0; max-width: 80px;
  }
  /* carré 2x2 : ▲▼ en haut, ↺ 🗑️ en dessous (boutons un peu réduits) */
  .student-item .item-actions {
    flex-wrap: wrap; gap: 4px; width: 68px; flex: 0 0 68px; justify-content: flex-end;
  }
  .student-item .icon-btn { width: 32px; height: 32px; }

  /* Vue élève : on ne garde que « Vue élève » et on empile les 2 boutons à droite */
  .preview-header-rest { display: none; }
  .student-preview-section__header { gap: 8px; }
  .preview-header-actions {
    flex-direction: column;
    align-items: stretch !important;   /* bat le style inline align-items:center */
    gap: 6px;
    flex: 0 0 auto;
  }
  /* les deux boutons exactement à la même largeur → superposition propre */
  .preview-header-actions .btn { width: 100%; white-space: nowrap; justify-content: center; }
}

/* RÉGLAGES */
.settings-card {
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 20px; margin-bottom: 20px;
}
.settings-card h2 { margin: 0 0 12px; font-size: 1.2rem; color: white; }
.settings-card form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.settings-card form input { flex: 1; min-width: 200px; }
.settings-card form textarea {
  flex: 1 1 100%; width: 100%; min-height: 90px; resize: vertical;
  font: inherit; line-height: 1.5; padding: 10px 12px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12); color: white;
}
.settings-card form textarea::placeholder { color: rgba(255,255,255,0.5); }
.toggle-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle-row input[type="checkbox"] { width: 44px; height: 24px; appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,0.2); border-radius: 12px; position: relative; cursor: pointer;
  transition: background 0.2s; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.3); }
.toggle-row input[type="checkbox"]:checked { background: #4ade80; border-color: #4ade80; }
.toggle-row input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; background: white; border-radius: 50%; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.toggle-row input[type="checkbox"]:checked::after { transform: translateX(20px); }
.toggle-label-text { color: white; font-size: 1rem; font-weight: 500; }
.settings-hint { margin: 8px 0 0; font-size: 0.85rem; color: rgba(255,255,255,0.65); line-height: 1.5; }

/* ============================================================
   RÉGLAGES façon « Réglages » d'Apple — STRUCTURE
   (l'habillage liquid glass clair est dans theme-solaire.css)
   Ordi / iPad en paysage (≥1024px) : barre latérale (gauche) + détail (droite).
   iPhone + iPad en portrait (<1024px) : liste plein écran → on touche une rubrique.
   ============================================================ */
.set-shell { display: block; }

@media (min-width: 1024px) {
  .set-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
}

/* iPhone + iPad en portrait : on n'affiche qu'une « page » à la fois (liste OU détail). */
@media (max-width: 1023px) {
  .set-shell[data-view="list"]   .set-detail { display: none; }
  .set-shell[data-view="detail"] .set-nav    { display: none; }
}

/* ---- La liste / barre latérale ---- */
.set-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 20px;
  padding: 10px;
}
@media (min-width: 1024px) {
  .set-nav { position: sticky; top: 16px; }
}

.set-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 11px 12px;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.set-row[hidden] { display: none !important; }

.set-row__icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
}
.set-row__icon svg { width: 18px; height: 18px; }

.set-row__title {
  flex: 1;
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 600;
}
.set-row__chev {
  display: flex;
  flex-shrink: 0;
}
.set-row__chev svg { width: 18px; height: 18px; }
/* Le chevron « › » n'a de sens que sur iPhone (affordance « entrer »). */
@media (min-width: 1024px) {
  .set-row__chev { display: none; }
}

/* ---- Le détail (panneau de droite) ---- */
.set-pane { display: none; }
.set-pane--active { display: block; animation: setPaneIn 0.24s var(--so-ease, ease); }
@media (min-width: 1024px) {
  .set-pane { max-width: 680px; }
  .set-pane--active { animation: none; } /* changement instantané sur ordi */
}
@keyframes setPaneIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .set-pane--active { animation: none; }
}

.set-pane__title {
  margin: 2px 2px 24px;
  font-size: 1.55rem;
  font-weight: 700;
}

/* Bouton retour « Liquid Glass » (iPhone uniquement) : rond, et il RESTE
   collé en haut à gauche quand on fait défiler la rubrique (position: sticky). */
.set-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  position: sticky;
  /* Se cale JUSTE sous l'en-tête sticky (sa hauteur réelle est mesurée en JS et
     placée dans --teacher-header-h) au lieu de passer derrière. +8px d'écart.
     Repli sur la safe-area si la variable n'est pas encore définie. */
  top: calc(var(--teacher-header-h, max(8px, env(safe-area-inset-top))) + 8px);
  z-index: 30;
  margin-bottom: 6px;
  -webkit-tap-highlight-color: transparent;
}
.set-back svg { width: 24px; height: 24px; }
@media (min-width: 1024px) {
  .set-back { display: none !important; }
}

/* APERÇU ÉLÈVE DANS L'ONGLET EXERCICES */
.student-preview-section {
  margin: 24px 0 0;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden;
}

.student-preview-section__header {
  min-height: 54px;
  padding: 10px 14px 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  color: white;
  font-weight: 700;
}

.student-preview-frame {
  display: block;
  width: 100%;
  height: min(720px, 72vh);
  min-height: 420px;
  border: 0;
  background-color: var(--bg-start);
  background-image: var(--bg-gradient);
}

/* =========================================================================
   Modales (enseignant)
   ========================================================================= */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 200;
  animation: fadeIn 0.15s ease;
}
.modal[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal__content {
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%; max-width: 500px; max-height: 90vh;
  overflow-y: auto; display: flex; flex-direction: column;
}
.modal__content--large { max-width: 720px; }
.modal__header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: space-between;
}
.modal__header h3 { margin: 0; font-size: 20px; font-weight: 700; color: white; }
.modal__header .btn--close { background: rgba(255,255,255,0.15); color: white; }
.form { padding: 20px 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }
.form-help {
  background: rgba(255,255,255,0.1);
  border-left: 4px solid rgba(255,255,255,0.5);
  padding: 10px 14px; border-radius: 8px;
  font-size: 0.88rem; color: rgba(255,255,255,0.8);
  margin: 6px 0 14px;
}
.form-help code {
  background: rgba(0,0,0,0.2); padding: 1px 5px;
  border-radius: 4px; font-size: 0.82rem; color: white;
}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
/* Fenêtre « Message pour mes élèves » : boutons compacts sur iPhone */
@media (max-width: 640px) {
  #modal-message .form-actions { gap: 8px; }
  #modal-message .form-actions > div { gap: 6px; }
  #modal-message .form-actions .btn {
    padding: 8px 12px; font-size: 0.85rem; min-height: 40px;
  }
  #modal-message .form-success { font-size: 0.78rem; }
}
.checkbox-label {
  display: flex !important; align-items: center; gap: 10px;
  font-weight: 500; color: rgba(255,255,255,0.85);
}
.checkbox-label input { width: auto; min-height: auto; }

/* =========================================================================
   Responsive — iPhone + iPad portrait (≤ 1024 px)
   ========================================================================= */
@media (max-width: 1024px) {
  .two-cols { grid-template-columns: 1fr; }
  .two-cols .col:first-child { display: none; }

  /* Header enseignant : éviter les retours à la ligne */
  .teacher-header { padding: max(12px, env(safe-area-inset-top)) 14px 12px; gap: 8px; }
  .teacher-header h1 { font-size: 1rem; }
  .teacher-header .btn--ghost { padding: 8px 14px; font-size: 0.85rem; white-space: nowrap; flex-shrink: 0; }

  /* Exercices : empêche le débordement hors de la carte */
  #tab-exercises .col { overflow-x: hidden; }

  /* Même gouttière en haut pour TOUS les onglets (avec barre d'actions ou non),
     comme le fait la marge des onglets sur ordinateur : évite le « saut » de
     contenu au changement d'onglet quand la barre d'onglets est en bas. */
  .tab-content { padding-top: 16px; }

  /* Progression : barre d'actions en ligne unique de 4 */
  .actions-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-items: stretch; margin-top: 0; margin-bottom: 16px; }
  .actions-bar__left { display: contents; }
  /* Onglet « Ma classe » : sélecteur + Imprimer = deux petites cellules à gauche,
     le « i » poussé tout à droite (dernière colonne). */
  #tab-students #btn-kbd-tip,
  #tab-compta #cmp-info { grid-column: 4; justify-self: end; }
  /* Sort controls : emoji uniquement, select invisible mais tappable */
  .actions-bar .sort-control { justify-content: center; }
  .actions-bar .sort-control::after {
    content: '▾'; display: block;
    position: absolute; bottom: 4px; right: 50%; transform: translateX(50%);
    top: auto; font-size: 0.6rem; font-weight: 900;
    color: var(--color-on-light-accent);
  }
  .actions-bar .sort-control__label { padding: 0; font-size: 1.3rem; pointer-events: none; }
  .actions-bar .sort-control__select {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
    font-size: 16px; /* évite le zoom iOS au focus */
  }
  .actions-bar .btn, #btn-refresh-progress, #btn-print, #btn-print-eval { font-size: 1.3rem; min-height: var(--tap); }
  #btn-refresh-progress, #btn-print, #btn-print-eval, #cmp-export {
    background: white; color: var(--color-on-light-accent);
    border: none; border-radius: var(--radius-md);
  }
  /* Hauteur uniforme des cellules d'action */
  .actions-bar .sort-control,
  .score-wrapper,
  #btn-refresh-progress,
  #btn-print,
  #btn-print-eval,
  #cmp-export { height: var(--tap); }
  .score-wrapper { display: flex; flex-direction: column; }
  .score-wrapper > .sort-control { flex: 1; height: auto; }

  /* Colonne Actions masquée → lignes moins hautes.
     On cible UNIQUEMENT la colonne d'actions (.col-actions / .row-actions),
     sinon on masquerait par erreur le titre de la dernière vraie colonne
     (ex. « Français » en progression, « Moy année »/« Appréciation » en éval). */
  .progress-table th.col-actions,
  .progress-table td:last-child:has(.row-actions) { display: none; }

  /* Colonne élève : valeurs strictement identiques à la barre d'onglets (.tabs) */
  .progress-table td:first-child {
    background: rgba(0,0,0,0.15) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255,255,255,0.25);
  }

  /* Panneau détail exercice (1er clic sur score) : 2 cartes/ligne */
  .detail-td { padding: 8px !important; }
  .detail-td > div { gap: 6px; }
  .detail-td [data-ex-card] { min-width: 0 !important; flex: 1 1 calc(50% - 3px); }

  /* Panneau scores de la classe (2e clic) : chips compacts */
  .ex-students-row .ex-students-td { padding: 10px 12px; }
  .ex-students-grid { gap: 5px; }
  .exs-chip { padding: 5px 8px; }

  /* ── Tabs → barre flottante en bas (pastille). Le contenu passe DERRIÈRE et
     remplit l'écran jusqu'en bas (le padding du contenu est volontairement
     petit pour ça). ── */
  .tabs {
    position: fixed;
    /* ~10px au-dessus de la barre d'accueil : on se cale PRÈS de l'indicateur
       (dans la safe-area) au lieu de flotter au-dessus de toute la zone. */
    bottom: max(10px, calc(env(safe-area-inset-bottom) - 12px));
    left: 18px; right: 18px;
    width: auto; max-width: none;
    margin: 0;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 4px;
    justify-content: space-around;
    overflow: visible;
    gap: 0;
    z-index: 50;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  }
  .tab {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px 6px;
    white-space: nowrap;
    min-height: 44px;
    border-radius: 24px;
  }
  .tab__icon { font-size: 1.2rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .tab__icon svg { width: 22px; height: 22px; display: block; stroke: currentColor; }
  .tab--active .tab__icon svg { stroke-width: 2; }
  .tab__lbl  { font-size: 0.52rem; font-weight: 700; text-align: center; letter-spacing: 0.01em; line-height: 1.1; }
  /* Petit espace : le contenu remplit l'écran jusqu'en bas et passe DERRIÈRE la
     barre flottante (translucide), comme une app iOS. Pas de bande beige. */
  .teacher-page { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* Mobile + iPad portrait : masquer le label texte des boutons compacts (icône seule) */
@media (max-width: 1024px) {
  .actions-bar .btn-label { display: none; }
  .exercise-modal__bar .btn-label { display: none; }
}

/* Login : éviter la superposition bouton Retour / titre sur iPhone */
@media (max-width: 480px) {
  .login-step { padding-top: 70px; }
}

@media (max-width: 500px) {
  /* Tout sur une seule ligne */
  .student-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
  }

  /* Avatar + prénom : ne tronque jamais */
  .student-header__left {
    flex: 0 0 auto;
    gap: 8px;
  }
  .student-avatar-mini { width: 36px; height: 36px; font-size: 1.2rem; border-width: 2px; }
  .student-hello {
    font-size: 0;
    white-space: nowrap;
  }
  .student-hello #student-name {
    font-size: 16px;
    font-weight: 700;
  }
  .student-class { display: none; }

  /* Badges : remplissent l'espace restant, débordement caché */
  .header-badges {
    position: static;
    transform: none;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    gap: 0;
    align-items: center;
  }
  .header-badges .badge-item { margin-right: -14px; }
  .header-badges .badge-item:last-child { margin-right: 0; }
  .badge-item__label { display: none; }
  .badge-item img { width: 32px; height: 32px; }
  .header-badges .badge-item:nth-child(n+3) { display: flex; }
  .badge-more { display: none; }

  /* Streak + bouton : compacts à droite */
  .student-header__right {
    flex: 0 0 auto;
    gap: 6px;
    margin-left: auto;
  }
  .streak-chip {
    padding: 4px 8px;
    border-radius: 10px;
    flex-direction: row;
    gap: 0;
    align-self: stretch;
  }
  .streak-chip__flame { font-size: 0.85rem; line-height: 1; }
  .streak-chip__label { display: none; }

  /* Bouton : icône seule */
  .student-header .btn--ghost {
    padding: 6px;
    border-radius: 10px;
    line-height: 0;
    min-width: 0;
  }
  .student-header .btn--ghost .btn-label { display: none; }
  .student-header .btn--ghost svg { width: 18px; height: 18px; }
  /* Chip "mode maison" : emoji seul sur iPhone (le texte prend trop de place) */
  #home-mode-chip .home-mode-label { display: none; }

  .exercises-container { padding: 0 14px; }
  .tab-content    { padding: 16px 14px calc(24px + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   Onglet Enseignants (superadmin)
   ========================================================================== */
.teacher-name-badge {
  font-size: 0.85rem;
  font-weight: 400;
  color: rgba(255,255,255,0.85);
  margin-left: 8px;
}
.teachers-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.teacher-item {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 12px 14px;
}
.teacher-item__main { flex: 1; min-width: 0; }
.teacher-item__name {
  font-weight: 700;
  color: white;
  font-size: 1rem;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.teacher-item__badge {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.teacher-item__meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 4px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.78);
}

/* ── Crédits bas de page (login) ── */
.site-credits {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  text-align: center;
  padding: 4px 20px max(6px, env(safe-area-inset-bottom));
  color: rgba(255,255,255,0.45);
  font-size: 0.65rem;
  line-height: 1.25;
  pointer-events: none;
}
.credits-title {
  margin: 0 0 4px;
  font-size: 0.7rem;
  letter-spacing: 0.3px;
}
.credits-title strong {
  color: rgba(255,255,255,0.65);
  font-weight: 600;
}

/* ==========================================================================
   ONGLET EXERCICES — Sidebar navigation + Pills grid
   ========================================================================== */

/* La colonne exercices prend toute la hauteur disponible */
.ex-col { display: flex; flex-direction: column; }

/* Layout sidebar + zone principale */
.ex-layout {
  display: flex;
  gap: 14px;
  flex: 1;
  min-height: 0;
  margin-top: 4px;
}

/* ── Sidebar de navigation ── */
.ex-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  max-height: calc(100vh - 255px);
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.ex-nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  transition: background 0.14s, color 0.14s;
  user-select: none;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  text-shadow: none;
}
.ex-nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.ex-nav-item--active {
  background: white !important;
  color: var(--color-on-light-accent) !important;
  border-radius: 10px;
}
.ex-nav-item--active:hover { opacity: 0.93; }
.ex-nav-item--active .ex-nav-count { color: var(--color-on-light-accent); opacity: 0.45; }

/* Plein accent (dégradé vif) pour le niveau le plus profond sélectionné
   (.--current) et, pendant une recherche, pour le degré qui filtre
   (.--search-scope) : on voit d'un coup d'œil « tu es ici ». */
.ex-nav-item--active.ex-nav-item--search-scope,
.ex-nav-item--active.ex-nav-item--search-scope:hover,
.ex-nav-item--current,
.ex-nav-item--current:hover,
.ex-nav-item--subcat.ex-nav-item--active.ex-nav-item--current,
.ex-nav-item--subcat.ex-nav-item--active.ex-nav-item--current:hover {
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end)) !important;
  color: white !important;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}
.ex-nav-item--active.ex-nav-item--search-scope .ex-nav-count,
.ex-nav-item--current .ex-nav-count { color: white !important; opacity: 0.8; }

/* Conteneur enfants : trait vertical de l'arbre */
.ex-nav-children {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 2px solid rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 1px;
  margin-bottom: 2px;
}

.ex-nav-item--degree { font-size: 0.9rem; font-weight: 700; }
.ex-nav-item--subject { font-size: 0.83rem; font-weight: 600; }
.ex-nav-item--subcat {
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
}
.ex-nav-item--subcat:hover { color: white; }
.ex-nav-item--subcat.ex-nav-item--active { color: var(--color-on-light-accent) !important; }

.ex-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ex-nav-count {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 400;
  color: rgba(255,255,255,0.42);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Zone principale ── */
.ex-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  max-height: calc(100vh - 255px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* ── Breadcrumb (mobile uniquement) ── */
.ex-breadcrumb {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.ex-bc-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.ex-bc-row::-webkit-scrollbar { display: none; }

/* Ligne des degrés + ligne des choix (sous-catégories) : on enroule sur plusieurs
   lignes au lieu de déborder hors de l'écran — tout reste visible sans glisser
   (le degré sélectionné reste donc toujours en vue). */
.ex-bc-row--degrees,
.ex-bc-row--nav {
  flex-wrap: wrap;
  overflow-x: visible;
}

.ex-bc-item {
  padding: 5px 13px;
  border-radius: 20px;
  background: rgba(255,255,255,0.11);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.14s;
}
.ex-bc-item:hover { background: rgba(255,255,255,0.19); }
.ex-bc-item--active,
.ex-bc-item--active:hover {
  background: white;
  color: var(--color-on-light-accent);
  border-color: white;
}
.ex-bc-sep {
  color: rgba(255,255,255,0.32);
  font-size: 0.72rem;
  flex-shrink: 0;
}

/* Plein accent mobile : niveau courant (.--current) + degré qui filtre pendant
   une recherche (.--search-scope) */
.ex-bc-item--active.ex-bc-item--search-scope,
.ex-bc-item--active.ex-bc-item--search-scope:hover,
.ex-bc-item--active.ex-bc-item--current,
.ex-bc-item--active.ex-bc-item--current:hover {
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  border-color: transparent;
  color: white;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}
/* Nombre de résultats par degré, affiché pendant une recherche */
.ex-bc-count {
  margin-left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.7;
}

/* ── Bandeau de portée de recherche (au-dessus des résultats) ── */
.ex-search-scope {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 2px 0 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}
.ex-search-scope strong { font-weight: 800; }
.ex-search-scope__all {
  border: none;
  cursor: pointer;
  padding: 5px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  transition: background 0.14s;
}
.ex-search-scope__all:hover { background: rgba(255, 255, 255, 0.24); }

/* ── Section dans la zone pills ── */
.ex-section { margin-bottom: 18px; }

.ex-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  cursor: pointer;
}
.ex-section-label:hover { color: rgba(255,255,255,0.75); }
.ex-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.1);
}
.ex-section-label__count {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  opacity: 0.6;
}

/* ── Grille de pills ── */
.ex-pills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

/* ── Pill individuelle ── */
.ex-pill {
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.15);
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
  min-width: 0;
  /* Les cartes hors écran ne sont ni mises en page ni peintes : indispensable
     quand la liste contient des centaines d'exercices. */
  content-visibility: auto;
  contain-intrinsic-size: auto 150px;
}
.ex-pill:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}
.ex-pill--hidden { opacity: 0.42; }

.ex-pill__emoji {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 6px;
}
.ex-pill__name {
  font-size: 0.83rem;
  font-weight: 600;
  color: white;
  line-height: 1.3;
  margin-bottom: 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(255,255,255,0.25);
}
.ex-pill__name:hover { text-decoration-color: rgba(255,255,255,0.6); }

.ex-pill__desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.4;
  flex: 1;
  margin-bottom: 4px;
}

.ex-pill__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.ex-pill__level {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 700;
}
.ex-pill__level--facile    { background: rgba(134,239,172,0.2); color: #86efac; }
.ex-pill__level--moyen     { background: rgba(251,191,36,0.2);  color: #fbbf24; }
.ex-pill__level--difficile { background: rgba(252,165,165,0.2); color: #fca5a5; }

/* Badge "type" — Problème vs Exercice simple */
.ex-pill__type {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 700;
}
.ex-pill__type--probleme {
  background: rgba(167,139,250,0.22);
  color: #a78bfa;
}
/* Liseré violet sur les pills "problème" pour les repérer en un coup d'œil */
.ex-pill--probleme {
  box-shadow: inset 0 0 0 1px rgba(167,139,250,0.45);
}

/* Boutons d'action — toujours visibles */
.ex-pill__actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.ex-pill__action-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  min-width: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: white;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
/* Bouton école/maison : peut contenir deux emojis (🏫🏠) — on resserre pour rester carré */
.ex-pill__action-btn[data-mode-ex] { font-size: 0.7rem; letter-spacing: -0.12em; }
.ex-pill__action-btn:hover  { background: rgba(255,255,255,0.22); }
.ex-pill__action-btn:active { transform: scale(0.94); }
.ex-pill__action-btn--danger:hover { background: rgba(239,68,68,0.45); }

/* ── Responsive ── */
@media (max-width: 680px) {
  .ex-sidebar { display: none; }
  .ex-breadcrumb { display: flex; }
  .ex-pills-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .ex-main { max-height: none; }
}

@media (max-width: 900px) and (min-width: 681px) {
  .ex-sidebar { width: 200px; }
  .ex-pills-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
}

/* Grand écran : pills un peu plus larges */
@media (min-width: 1200px) {
  .ex-sidebar { width: 290px; }
  .ex-pills-grid { grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); }
}

/* ── Overlays plein écran mobile (progression) ──────────────── */
.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  background-color: var(--bg-start);
  background-image: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  padding-top: max(0px, env(safe-area-inset-top));
  animation: fadeIn 0.18s ease;
  color: white;
}
.mobile-overlay[hidden] { display: none; }
.mobile-overlay__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mobile-overlay__header h3 {
  margin: 0; flex: 1;
  font-size: 1rem; font-weight: 700; color: white;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mobile-overlay__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}
.mobile-ex-card {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.14s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-ex-card:active { background: rgba(255,255,255,0.22); transform: scale(0.97); }
.mobile-overlay__body .exs-chip { flex-wrap: nowrap; }
.mobile-overlay__body .exs-chip__name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Boîte de confirmation maison ───────────────────────────── */
.confirm-modal { z-index: 300; }
.confirm-modal__content { max-width: 420px; }
.confirm-modal__body { padding: 20px 24px 22px; }
.confirm-modal__msg {
  margin: 0 0 20px; color: white;
  font-size: 0.95rem; line-height: 1.5;
}
.confirm-modal__actions {
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Vue par exercice : scores de toute la classe ───────────── */
[data-ex-card] { cursor: pointer; transition: background 0.12s, border-color 0.12s; }
[data-ex-card]:hover { background: rgba(255,255,255,0.26) !important; }
[data-ex-card].ex-card--active {
  background: rgba(255,255,255,0.34) !important;
  border-color: rgba(255,255,255,0.6) !important;
}

.ex-students-row .ex-students-td {
  padding: 12px 16px;
  background: rgba(0,0,0,0.22);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ex-students-panel { display: flex; flex-direction: column; gap: 10px; }
.ex-students-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.ex-students-title { font-weight: 700; color: white; font-size: 0.95rem; }
.ex-students-avg { font-size: 0.8rem; color: var(--color-muted); }
.ex-students-avg b { color: white; }
.ex-students-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.exs-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 10px; padding: 6px 10px;
}
.exs-chip--weak {
  background: rgba(220,38,38,0.22);
  border-color: rgba(248,113,113,0.55);
}
.exs-chip--idle { opacity: 0.55; }
.exs-chip__name { font-size: 0.85rem; color: white; font-weight: 600; }
.exs-score {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.92); border-radius: 8px;
  padding: 2px 7px; font-size: 0.78rem;
}
.exs-score__good { color: #16a34a; font-weight: 700; }
.exs-score__bad  { color: #dc2626; font-weight: 700; }
.exs-score__tot  { color: #6b7280; }
.exs-score--none {
  color: rgba(255,255,255,0.55);
  font-size: 0.76rem; font-style: italic;
}

/* ==========================================================================
   Desktop large (≥ 1025px) — 4 cellules égales sur une seule ligne
   ========================================================================== */
@media (min-width: 1025px) {
  .actions-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    align-items: stretch;
  }
  .actions-bar__left { display: contents; }
  .actions-bar .sort-control,
  .score-wrapper,
  #btn-refresh-progress,
  #btn-print { min-height: var(--tap); }
  .score-wrapper { display: flex; flex-direction: column; }
  .score-wrapper > .sort-control { flex: 1; }
}

/* « Ma classe » plafonne ses boutons à 240 px ; on aligne Progression dessus
   pour que les deux barres se ressemblent (les 4 contrôles restent égaux mais
   PLAFONNÉS à 240 et groupés à gauche, au lieu de s'étirer sur toute la ligne). */
@media (min-width: 1025px) {
  #tab-progress .actions-bar {
    grid-template-columns: repeat(4, minmax(0, 240px));
    justify-content: start;
  }
}

/* ==========================================================================
   ONGLET MA CLASSE — Évaluations (maquette)
   ========================================================================== */
/* ===== Tableau Évaluations sur fond BLANC (texte foncé) ===== */
/* La carte blanche autour du tableau (uniquement onglet Ma classe) */
#tab-students .table-wrapper {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.eval-table { background: #ffffff; color: #1e293b; }
/* Pas d'ombre de texte sur le tableau blanc (héritée de .teacher-page) */
.eval-table th, .eval-table td,
.eval-table input, .eval-msg { text-shadow: none; }
.eval-table th, .eval-table td { border-bottom: 1px solid #e5e7eb; }
.eval-table th {
  font-size: 11px;
  padding: 8px 6px;
  background: #f1f5f9;
  color: #475569;
}
.eval-table td { padding: 9px 6px; color: #1e293b; }
/* Première colonne (Élève) en « liquid glass » : les notes qui défilent derrière
   sont floutées (backdrop-filter), comme dans le tableau de progression. */
.eval-table th:first-child,
.eval-table td:first-child {
  background: rgba(248,250,252,0.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #0f172a;
  border-right: 1px solid #e5e7eb;
}
.eval-table th:first-child { background: rgba(241,245,249,0.82); }

/* Vue « Toutes les matières » : colonnes à largeur égale.
   Sur mobile, min-width force le défilement horizontal (comme la progression).
   La largeur de la colonne Élève est posée en inline et suit la limite responsive du prénom. */
.eval-table--overview { table-layout: fixed; width: 100%; min-width: 720px; }
/* En-tête de la colonne Élève (« Élèves de 5P ») : peut passer à la ligne pour ne pas
   imposer une colonne large ; les prénoms restent sur une ligne. */
.eval-subtable th:first-child { white-space: normal; }
/* Nom : degré collé à gauche, jamais de retour à la ligne (hauteur de ligne constante)
   et prénom tronqué par « … » selon la largeur disponible. */
.eval-table--overview td:first-child { white-space: nowrap; }
.eval-table--overview td:first-child .eval-degre-badge { margin-left: 0; margin-right: 8px; }
/* En-têtes : on tente le nom complet ; le JS abrège ceux qui débordent */
.eval-table--overview th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.eval-degre-badge {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}
/* Sur le tableau blanc, le badge degré passe en gris foncé lisible */
.eval-table .eval-degre-badge { background: #e2e8f0; color: #334155; }

.eval-note { font-weight: 700; font-size: 1rem; color: #1e293b; }
.eval-note--low { color: #dc2626; }   /* ≤ 4     : rouge */
.eval-note--mid { color: #ea580c; }   /* 4.1–4.5 : orange */
/* Pilule colorée autour des notes basses — uniquement l'affichage, pas les champs de saisie */
.eval-note.eval-note--low,
.eval-note.eval-note--mid {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.eval-note.eval-note--low { background: #fee2e2; border-color: #fecaca; }  /* pilule rouge */
.eval-note.eval-note--mid { background: #ffedd5; border-color: #fed7aa; }  /* pilule orange */
.eval-mention {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;         /* même taille que les notes (.eval-note) */
  white-space: nowrap;
  color: #1e293b;          /* AA et A : noir simple, sans pilule */
}
/* Seuls PA et NA portent une pilule colorée ; AA et A restent en noir simple */
.eval-mention--PA,
.eval-mention--NA {
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.eval-mention--PA { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }  /* orange */
.eval-mention--NA { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }  /* rouge */
.eval-na { color: #cbd5e1; font-size: 1.1rem; }
/* Vue d'ensemble : cellules et en-têtes cliquables (ouvrent la matière) */
.eval-cell-link { cursor: pointer; }
.eval-cell-link:hover { background: rgba(var(--color-accent-rgb, 255,107,53), 0.10); }
/* Menu déroulant d'appréciation directe (Musique / Arts visuels / Éducation physique) */
.eval-direct-select {
  width: auto;
  min-width: 64px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  text-align-last: center;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
}
.eval-direct-select:focus { outline: none; border-color: var(--color-on-light-accent); }
.eval-direct-select option { color: #1e293b; }

/* Vue détaillée et vue d'ensemble : une CARTE distincte (tableau) par degré dans #eval-detail.
   Mêmes coins arrondis que le tableau de progression (carte + overflow qui découpe). */
.eval-subcard {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  overflow: auto hidden;
  margin: 0 0 18px;
}
.eval-subcard:last-child { margin-bottom: 0; }
/* NE PAS forcer min-width:100% ici : ça écraserait la largeur minimale des tableaux
   (.progress-table = 500px, .eval-table--overview = 720px) qui garantit des colonnes
   lisibles + défilement horizontal sur mobile. width:100% (hérité) suffit à remplir la carte. */
/* Coins du tableau réellement arrondis (cellules d'angle) pour matcher le reste du site */
.eval-subtable thead th:first-child { border-top-left-radius: 16px; }
.eval-subtable thead th:last-child  { border-top-right-radius: 16px; }
.eval-subtable tbody tr:last-child td:first-child { border-bottom-left-radius: 16px; }
.eval-subtable tbody tr:last-child td:last-child  { border-bottom-right-radius: 16px; }
/* Bouton d'aide « i » à côté d'Imprimer : aligné en hauteur avec les boutons, liquid glass. */
.eval-info-btn {
  flex: 0 0 auto;
  justify-self: center;               /* centré dans sa cellule sur mobile (grille) */
  width: var(--tap); height: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border-radius: 50%;
  background: rgba(255,255,255,0.45);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.55);
  color: var(--color-on-light-accent);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}
.eval-info-btn:hover { background: rgba(255,255,255,0.65); }
.eval-info-btn:active { transform: scale(0.95); }
/* En-tête de la colonne Élève = juste le degré, en gras et couleur du thème pour ressortir.
   Sélecteur avec #eval-detail (id) pour battre theme-solaire.css (.progress-table th:first-child). */
#eval-detail th.eval-degre-head {
  color: var(--color-on-light-accent);
  font-weight: 800;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
}
/* Prénom cliquable (revient à « Toutes les matières ») — couleur du thème */
.eval-name-link { cursor: pointer; border-bottom: 1px dotted transparent; }
.eval-name-link:hover {
  border-bottom-color: var(--color-on-light-accent);
  color: var(--color-on-light-accent);
}
/* Bannière « Astuce clavier » (dépliée par le bouton du même nom), aux couleurs du thème */
.eval-kbd-banner {
  position: relative;
  margin: 0 0 14px;
  padding: 12px 40px 12px 16px;
  background: rgba(var(--color-accent-rgb, 255,107,53), 0.10);
  border: 1px solid rgba(var(--color-accent-rgb, 255,107,53), 0.30);
  border-radius: var(--radius-md);
  color: var(--color-on-light-accent);
  font-size: 0.9rem;
}
.eval-kbd-banner p { margin: 0 0 6px; font-weight: 700; }
.eval-kbd-banner ul { margin: 0; padding-left: 20px; }
.eval-kbd-banner li { margin: 3px 0; }
.eval-kbd-banner__close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--color-on-light-accent); font-size: 1rem; line-height: 1;
  padding: 4px; width: auto; min-height: auto;
}
/* Lien « Ouvrir l'aide détaillée » au bas des bannières « i » (Compta + Ma classe) */
.eval-kbd-help {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 7px 13px; border-radius: 10px;
  background: var(--color-on-light-accent); color: #fff;
  font-size: 0.85rem; font-weight: 700; text-decoration: none;
  transition: opacity 0.15s ease, transform 0.08s ease;
}
.eval-kbd-help svg { width: 14px; height: 14px; }
.eval-kbd-help:hover { opacity: 0.9; }
.eval-kbd-help:active { transform: scale(0.97); }
/* Carte message (classe vide / matière non évaluée) dans la vue détaillée */
.eval-msg-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 8px;
}

/* Sélecteur de degré dans la liste élèves (réglages) */
.degre-select {
  font-size: 0.82rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: white;
  cursor: pointer;
  /* annule le width:100% global des <select> : le menu ne fait que ~8 car. */
  width: auto;
  flex: 0 0 auto;
  min-width: 78px;
}
.degre-select option { color: black; }
.degre-bulk {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px; padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.degre-bulk__label { color: rgba(255,255,255,0.8); font-size: 0.85rem; }

/* ----- Vue détaillée (Notes / Appréciations), champs sur fond blanc ----- */
/* En-tête éditable d'une colonne d'évaluation (TS1, TS2, …) */
.eval-head-input {
  width: 64px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  padding: 3px 4px;
}
.eval-head-input:focus { outline: none; border-color: var(--color-on-light-accent); }
/* Total de points d'une évaluation (système Appréciations), sous l'en-tête */
.eval-max-input {
  width: 64px;
  margin-top: 4px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  padding: 3px 4px;
}
.eval-max-input:focus { outline: none; border-color: var(--color-on-light-accent); }
/* Cellule de saisie d'une note ou d'un nombre de points */
.eval-note-input {
  width: 54px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  padding: 5px 2px;
}
.eval-note-input:focus { outline: none; border-color: var(--color-on-light-accent); }
.eval-note-input:disabled { background: #f1f5f9; opacity: 0.55; }
.eval-note-input.eval-note--low { color: #dc2626; border-color: #fca5a5; }
.eval-note-input.eval-note--mid { color: #ea580c; border-color: #fdba74; }
/* Bouton + pour ajouter une colonne d'évaluation */
.eval-add-col {
  width: 26px; height: 26px; border-radius: 50%;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #475569; font-size: 1rem; font-weight: 700;
  cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.eval-add-col:hover { background: #cbd5e1; }
/* En-tête d'une colonne d'évaluation : libellé éditable + bouton de suppression */
.eval-col-head { display: inline-flex; align-items: center; gap: 4px; }
.eval-del-col {
  width: 18px; height: 18px; border-radius: 50%;
  background: transparent; border: none; color: #cbd5e1;
  font-size: 0.78rem; line-height: 1; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.eval-del-col:hover { background: #fee2e2; color: #dc2626; }
/* Modale « Imprimer les évaluations » : listes à cocher (élèves / matières) */
.eval-print-section { margin-bottom: 16px; }
.eval-print-section__head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; color: rgba(255,255,255,0.92); font-size: 0.9rem; margin-bottom: 8px;
}
.eval-print-all {
  font-weight: 600; font-size: 0.8rem; color: rgba(255,255,255,0.8);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.eval-print-all input { width: auto; min-height: auto; }
.eval-print-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 14px; max-height: 230px; overflow-y: auto;
  padding: 10px 12px; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px; background: rgba(255,255,255,0.06);
}
.eval-print-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; color: rgba(255,255,255,0.92); cursor: pointer;
}
.eval-print-item input { width: auto; min-height: auto; flex: none; }
.eval-print-empty { color: rgba(255,255,255,0.6); font-style: italic; font-size: 0.85rem; }
/* Colonnes de résultat (moyennes / points-total / appréciation) mises en évidence */
.eval-table th.eval-moy, .eval-table td.eval-moy {
  background: #f1f5f9;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
}
.eval-table th.eval-moy--year, .eval-table td.eval-moy--year {
  background: #e2e8f0;
}
.eval-moy-val { font-weight: 800; font-size: 1.05rem; color: #0f172a; }
/* Message (matière non évaluée, ou classe vide) — affiché dans le tableau blanc */
.eval-msg {
  margin: 24px auto; max-width: 520px; text-align: center;
  padding: 22px 20px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #475569;
  font-size: 0.9rem; line-height: 1.5;
}
.eval-msg strong { color: #1e293b; }
.eval-msg__icon { font-size: 2rem; line-height: 1; margin-bottom: 10px; }
.eval-msg__title { font-size: 1.05rem; font-weight: 700; color: #1e293b; margin-bottom: 8px; }
.eval-msg__sub { display: block; margin-top: 6px; color: #64748b; font-size: 0.85rem; }
