/* ═══════════════════════════════════════════════════════════════
   style.css — Kwestup · Version consolidée & dédupliquée
   Corrections :
     • .explanation-container : plus de display:none (le carousel gère)
     • .content padding-right : une seule règle cohérente (52px)
     • suppresssion de tous les blocs dupliqués (.kt-input-row, avatars, etc.)
     • accolade orpheline supprimée (bloc KT-INPUT-ROW invalide)
     • .favorite-container : position relative (plus d'absolu hors contexte)
   ═══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────
   1. RESET & BASE
────────────────────────────────────────────── */
html, body {
  overflow-x: hidden;
}

body {
  background-color: #6218bd;
  font-family: Arial, sans-serif;
  color: #333;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ──────────────────────────────────────────────
   2. NAVIGATION
────────────────────────────────────────────── */
.navbar {
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nav-link {
  color: white;
  transition: color 0.3s ease;
}
.nav-link:hover {
  color: #ffcc00;
  text-decoration: underline;
}
.nav-link.active {
  font-weight: bold;
  text-decoration: underline;
}

/* ──────────────────────────────────────────────
   3. BOUTONS BOOTSTRAP
────────────────────────────────────────────── */
.btn-primary {
  background-color: #007BFF;
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.btn-primary:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
  border: none;
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.btn-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
}

/* ──────────────────────────────────────────────
   4. CARTES GÉNÉRIQUES
────────────────────────────────────────────── */
.card {
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.card-header {
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 10px;
  text-align: center;
  background: linear-gradient(to right, #b004fa, #2575fc);
}

.card-title { font-size: 1.5rem; font-weight: bold; }

.card-footer {
  background-color: #f9f9f9;
  border-top: 1px solid #ddd;
}

.theme-card {
  transition: transform 0.3s ease-in-out;
  border-radius: 15px;
  background-color: white;
  color: black;
  border: 2px solid #007BFF;
}
.theme-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* ──────────────────────────────────────────────
   5. COULEURS UTILITAIRES
────────────────────────────────────────────── */
.bg-success  { background-color: #00c853 !important; }
.bg-warning  { background-color: #ffbb00 !important; }
.bg-secondary{ background-color: #9c27b0 !important; }

/* ──────────────────────────────────────────────
   6. LAYOUT PRINCIPAL (carousel + constellation)
────────────────────────────────────────────── */
.container-fluid, .row, .content { overflow: visible; }

/* Réserve l'espace de la constellation fixe (48px) à droite */
.content {
  box-sizing: border-box;
  padding-right: 52px;
}

@media (max-width: 576px) {
  .content { padding-right: 52px; }
}

/* ──────────────────────────────────────────────
   7. FOND PAGE EXERCICES
────────────────────────────────────────────── */
body.exercise-bg {
  background: #0a0118 !important;
  min-height: 100vh;
  overflow-y: hidden; /* le carousel gère le scroll interne */
}

body.exercise-bg::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(88,28,135,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(29,78,216,0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(139,92,246,0.06) 0%, transparent 70%);
  z-index: 0;
  animation: nebulaPulse 20s ease-in-out infinite alternate;
}
@keyframes nebulaPulse { 0%{opacity:.8;} 100%{opacity:1;} }

#star-canvas {
  position: fixed; inset: 0;
  width: 100vw !important; height: 100vh !important;
  pointer-events: none; z-index: 0;
}

/* ──────────────────────────────────────────────
   8. HEADER THÈME (sticky)
────────────────────────────────────────────── */
.theme-header {
  position: sticky; top: 0; z-index: 3000;
  background: rgba(15,3,30,0.95);
  padding: .55rem .75rem;
  border-bottom: 1px solid rgba(139,92,246,0.25);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: space-between;
}

.theme-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 800;
  font-size: clamp(.9rem, 2.2vw + .2rem, 1.5rem);
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  background: linear-gradient(135deg, #c4b5fd 0%, #e0d7ff 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 8px rgba(167,139,250,0.4));
}

.theme-icon { font-size: 1em; flex-shrink: 0; }

.screen-indicator {
  font-size: .8rem; font-weight: 700;
  color: rgba(196,181,253,0.7);
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap; flex-shrink: 0;
}

/* ──────────────────────────────────────────────
   9. CONSTELLATION (barre droite)
────────────────────────────────────────────── */
.constellation-wrapper {
  z-index: 999;
  background: linear-gradient(180deg, rgba(10,1,24,0.9) 0%, rgba(17,5,38,0.85) 50%, rgba(10,1,24,0.9) 100%);
  border-left: 1px solid rgba(139,92,246,0.2);
  backdrop-filter: blur(8px);
}
.constellation-svg { height: 100%; }

.progress-circle {
  vector-effect: non-scaling-stroke;
  transition: fill .25s ease, stroke .25s ease;
}
.progress-circle[data-answered="false"] { fill: transparent !important; }

.star-body { transition: fill 0.3s ease; }
.star-body[data-answered="true"] { filter: drop-shadow(0 0 4px currentColor); }

@keyframes starPulse {
  0%  { r: 6px; opacity: 1; }
  50% { r: 10px; opacity: .6; }
  100%{ r: 6px; opacity: 1; }
}
.star-pulse { animation: starPulse 0.6s ease-out; }

@keyframes glowBurst {
  0%  { r: 9px; opacity: .8; }
  60% { r: 16px; opacity: .3; }
  100%{ r: 9px; opacity: 0; }
}
.glow-burst { animation: glowBurst 0.7s ease-out forwards; }

/* ──────────────────────────────────────────────
   10. COMBO HUD
────────────────────────────────────────────── */
#combo-hud {
  position: fixed; top: 80px; right: 56px; z-index: 9999;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(17,5,38,0.9);
  border: 1.5px solid rgba(251,191,36,0.6);
  box-shadow: 0 0 16px rgba(251,191,36,0.3), inset 0 0 10px rgba(251,191,36,0.08);
  color: #fbbf24; font-weight: 800; font-size: 1rem;
  opacity: 0; transform: scale(0.7) translateY(-8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
#combo-hud.visible { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }
#combo-hud.combo-break { animation: comboBreakAnim 0.5s ease forwards; }

@keyframes comboBreakAnim {
  0%  { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.2) rotate(-5deg); border-color: rgba(239,68,68,0.8); color: #ef4444; }
  100%{ transform: scale(0.5) translateY(-20px); opacity: 0; }
}

#combo-flame { font-size: 1.1em; }
#combo-count { min-width: 28px; text-align: center; }

/* ──────────────────────────────────────────────
   11. NOTIFICATIONS SHYRKA
────────────────────────────────────────────── */
.shyrka-notif {
  position: fixed;
  bottom: 24px; left: 20px;
  z-index: 99999;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 18px;
  /* Pas de backdrop-filter ici : évite la création d'un stacking context
     qui rendrait z-index:99999 inopérant sous le header sticky */
  background: rgba(10,1,24,0.98);
  border: 1.5px solid rgba(139,92,246,0.5);
  box-shadow: 0 12px 40px rgba(0,0,0,0.75), 0 0 0 1px rgba(139,92,246,0.2);
  color: #e5e7eb; font-size: .9rem; font-weight: 600;
  max-width: min(360px, calc(100vw - 40px));
  opacity: 0; transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
.shyrka-notif.notif-show { opacity: 1; transform: translateY(0); }
.shyrka-notif.notif-hide { opacity: 0; transform: translateY(-10px); }

.shyrka-notif-combo {
  border-color: rgba(251,191,36,0.5);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 20px rgba(251,191,36,0.2);
}

.notif-avatar {
  width: 28px !important; height: 28px !important;
  min-width: 28px !important; max-width: 28px !important;
  border-radius: 50% !important; object-fit: cover !important;
  border: 1.5px solid rgba(139,92,246,0.4);
  flex-shrink: 0 !important;
  display: inline-block !important;
  margin: 0 !important;
}

/* ──────────────────────────────────────────────
   12. AVATARS SHYRKA (toutes occurrences)
   Neutralise la règle globale img { max-width:100%; display:block; margin:auto }
────────────────────────────────────────────── */
.shyrka-avatar,
.shyrka-intro-avatar,
.kt-debrief-avatar,
.shyrka-feedback img,
.shyrka-notif img,
#shyrka-intro img,
.kt-debrief-header img,
.kt-chat-log img {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  margin: 0 !important;
}

/* Exception : avatar débrief légèrement plus grand */
.kt-debrief-avatar {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  border: 2px solid rgba(139,92,246,0.5) !important;
  box-shadow: 0 0 16px rgba(167,139,250,0.3) !important;
}

/* ──────────────────────────────────────────────
   13. CAROUSEL — moteur principal
────────────────────────────────────────────── */
#screen-carousel {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 60px);
}

.screen {
  display: none;
  flex-direction: column;
  padding: 16px 12px 80px;
  min-height: calc(100vh - 60px);
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}
.screen.screen-active { display: flex; }

@keyframes slideInRight  { from{ transform:translateX(100%); opacity:0; } to{ transform:translateX(0); opacity:1; } }
@keyframes slideInLeft   { from{ transform:translateX(-100%); opacity:0; } to{ transform:translateX(0); opacity:1; } }
@keyframes slideOutLeft  { from{ transform:translateX(0); opacity:1; } to{ transform:translateX(-100%); opacity:0; } }
@keyframes slideOutRight { from{ transform:translateX(0); opacity:1; } to{ transform:translateX(100%); opacity:0; } }

.slide-in-right  { animation: slideInRight  0.28s cubic-bezier(0.22,1,0.36,1) forwards; }
.slide-in-left   { animation: slideInLeft   0.28s cubic-bezier(0.22,1,0.36,1) forwards; }
.slide-out-left  { animation: slideOutLeft  0.22s ease-in forwards; }
.slide-out-right { animation: slideOutRight 0.22s ease-in forwards; }

/* ──────────────────────────────────────────────
   14. BARRE TITRE EXERCICE
────────────────────────────────────────────── */
.exercise-title-bar {
  margin-bottom: 12px;
  text-align: center;
}
.exo-label {
  display: inline-block;
  background: linear-gradient(135deg, rgba(111,66,193,0.25), rgba(74,29,150,0.2));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 999px;
  color: #c4b5fd;
  font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 16px;
}

/* ──────────────────────────────────────────────
   15. CARTE QUESTION
────────────────────────────────────────────── */
.question-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(139,92,246,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 0 0 1px rgba(139,92,246,0.08);
  padding: 20px;
  flex: 1;
  display: flex; flex-direction: column; gap: 14px;
}

.question-header {
  display: flex; align-items: flex-start; gap: 10px;
}

.question-number {
  min-width: 32px; height: 32px; flex-shrink: 0;
  background: linear-gradient(135deg, #6f42c1, #4a1d96);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .85rem; font-weight: 800;
  box-shadow: 0 2px 8px rgba(111,66,193,0.4);
}

.question-text {
  flex: 1; font-size: 1.05rem; color: #1a1a2e; font-weight: 700;
  line-height: 1.4; margin: 0;
}

.btn-tts-q {
  background: none; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px;
  padding: 4px 8px; cursor: pointer; font-size: .9rem;
  flex-shrink: 0; transition: background .15s;
}
.btn-tts-q:hover { background: rgba(0,0,0,0.05); }

/* ──────────────────────────────────────────────
   16. IMAGES DES QUESTIONS
────────────────────────────────────────────── */
:root {
  --question-img-max: 360px;
  --question-img-max-h: 300px;
}

.img-shell {
  display: flex;
  align-items: center; justify-content: center;
  width: min(90vw, var(--question-img-max));
  max-width: var(--question-img-max);
  margin: 0.75rem auto;
  padding: 6px;
  background: #f8f9ff;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  overflow: hidden;
  text-align: center;
  box-sizing: border-box;
}

.img-shell .progressive-img,
.img-shell img.progressive-img {
  display: block;
  max-width: 100%; width: auto; height: auto;
  margin: 0 auto;
  max-height: var(--question-img-max-h);
  object-fit: contain;
  border-radius: 0 !important;
  filter: blur(12px);
  transform: scale(1.02);
  transition: filter .25s ease, transform .25s ease, opacity .25s ease;
  opacity: 0.98;
}
.img-shell .progressive-img.is-loaded {
  filter: blur(0);
  transform: none;
  opacity: 1;
}

@media (max-width: 576px) {
  :root {
    --question-img-max: 320px;
    --question-img-max-h: 220px;
  }
  .img-shell { width: min(95vw, var(--question-img-max)); }
}

/* ──────────────────────────────────────────────
   17. OPTIONS DE RÉPONSE
────────────────────────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.answer-btn {
  background: #f4f5ff;
  border: 2px solid rgba(139,92,246,0.15);
  border-radius: 12px;
  padding: 14px 10px;
  font-size: .92rem; font-weight: 700; color: #1a1a2e;
  cursor: pointer; text-align: center;
  transition: all 0.18s ease;
  line-height: 1.3;
  width: 100%;
}
.answer-btn:not(:disabled):hover {
  background: #ede9fe;
  border-color: rgba(111,66,193,0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(111,66,193,0.15);
}

/* Bonne réponse → vert */
.answer-btn.btn-correct,
.answer-btn.btn-success,
.answer-btn.btn-correct:disabled,
.answer-btn.btn-success:disabled {
  background: linear-gradient(135deg, #28a745, #1e7e34) !important;
  color: #fff !important;
  border-color: #28a745 !important;
  box-shadow: 0 4px 12px rgba(40,167,69,0.3) !important;
  opacity: 1 !important;
}

/* Mauvaise réponse → violet */
.answer-btn.btn-wrong,
.answer-btn.btn-danger,
.answer-btn.btn-wrong:disabled,
.answer-btn.btn-danger:disabled {
  background: linear-gradient(135deg, #6f42c1, #4a1d96) !important;
  color: #fff !important;
  border-color: #6f42c1 !important;
  box-shadow: 0 4px 14px rgba(111,66,193,0.4) !important;
  opacity: 1 !important;
}

.answer-btn:disabled { pointer-events: none; opacity: 1; }

@media (max-width: 576px) {
  .options-grid { grid-template-columns: 1fr; }
}

/* ──────────────────────────────────────────────
   18. FEEDBACK SHYRKA
────────────────────────────────────────────── */
.feedback-container { margin-top: 2px; }

.shyrka-feedback {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px;
  border-left: 4px solid;
}
.feedback-correct { background: #f0fdf4; border-color: #28a745; }
.feedback-wrong   { background: #faf5ff; border-color: #6f42c1; }

.feedback-appear { animation: feedSlide 0.35s cubic-bezier(0.34,1.4,0.64,1) forwards; }
@keyframes feedSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.shyrka-avatar {
  width: 34px !important; height: 34px !important;
  min-width: 34px !important; max-width: 34px !important;
  border-radius: 50% !important; object-fit: cover !important;
  border: 2px solid rgba(139,92,246,0.3) !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  margin: 0 !important;
}

.feedback-body { flex: 1; font-size: .88rem; color: #1a1a2e; }
.feedback-name { font-weight: 800; font-size: .82rem; color: #6f42c1; margin-bottom: 4px; }
.mt-1 { margin-top: 4px; }

.btn-tts-fb {
  margin-top: 6px; background: none;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px; padding: 3px 8px;
  cursor: pointer; font-size: .85rem; float: right;
}

/* ──────────────────────────────────────────────
   19. NAVIGATION ÉCRANS (prev / next / dots)
────────────────────────────────────────────── */
.screen-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 0; margin-top: auto; gap: 8px;
}

.nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 12px;
  font-size: .9rem; font-weight: 800; cursor: pointer;
  border: none; transition: all 0.18s ease;
}

.nav-prev {
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.25);
  color: #c4b5fd;
}
.nav-prev:hover { background: rgba(139,92,246,0.22); transform: translateX(-2px); }

.nav-next {
  background: linear-gradient(135deg, #6f42c1, #4a1d96);
  color: #fff;
  box-shadow: 0 4px 14px rgba(111,66,193,0.4);
}
.nav-next:hover { transform: translateX(2px); box-shadow: 0 6px 20px rgba(111,66,193,0.5); }

.nav-next-locked {
  background: rgba(139,92,246,0.15);
  color: rgba(196,181,253,0.5);
  box-shadow: none; cursor: not-allowed;
}
.nav-next-locked:hover { transform: none; box-shadow: none; }

.nav-dots {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; justify-content: center;
}
.nav-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(139,92,246,0.2);
  border: 1.5px solid rgba(139,92,246,0.35);
  cursor: pointer; transition: all .2s ease;
}
.nav-dot.dot-correct { background: #28a745; border-color: #5edd7a; }
.nav-dot.dot-wrong   { background: #6f42c1; border-color: #a78bfa; }
.nav-dot.dot-current { transform: scale(1.4); box-shadow: 0 0 6px rgba(139,92,246,0.6); }

@keyframes shake {
  0%  { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
  100%{ transform: translateX(0); }
}
.shake-once { animation: shake 0.3s ease; }

/* ──────────────────────────────────────────────
   20. ÉCRAN RESSOURCE
────────────────────────────────────────────── */
.resource-screen { gap: 16px; }

.resource-header { text-align: center; padding: 8px 0 4px; }

.resource-unlock-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(40,167,69,0.2), rgba(30,126,52,0.15));
  border: 1px solid rgba(40,167,69,0.35);
  border-radius: 999px;
  color: #5edd7a; font-size: .78rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 16px; margin-bottom: 8px;
  animation: unlockPop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes unlockPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.resource-title {
  font-size: 1.1rem; font-weight: 800; color: #c4b5fd; margin: 0;
}

/* ✅ FIX PRINCIPAL : plus de display:none
   La visibilité est gérée par .screen / .screen-active du carousel */
.explanation-container {
  background: rgba(255,255,255,0.97);
  border-radius: 14px;
  border: 1px solid rgba(139,92,246,0.15) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 16px;
  overflow: hidden;
  flex: 1;
  position: relative;
  color: #333;
}

.explanation-container img,
.explanation-container video,
.explanation-container embed {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: auto;
  border-radius: 10px;
}

.resource-locked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px; color: rgba(139,92,246,0.5); text-align: center;
}
.lock-icon { font-size: 2.5rem; margin-bottom: 10px; }
.explain-header { margin-bottom: 10px; }

/* Affiché par JS (fav.style.display='block') quand ressource débloquée */
.favorite-container {
  text-align: right; padding: 4px 0;
  display: none;
}

.favorite-icon {
  font-size: 1.8rem; color: gray;
  transition: transform 0.2s ease-in-out, color 0.3s ease-in-out;
}
.favorite-icon.favorite-active { color: gold !important; transform: scale(1.2); }
.favorite-icon:hover            { transform: scale(1.3); color: gold !important; }

/* ──────────────────────────────────────────────
   21. ÉCRAN DÉBRIEF
────────────────────────────────────────────── */
.debrief-screen { gap: 16px; }

.kt-debrief-card {
  border-radius: 20px;
  background: rgba(17,5,38,0.95);
  border: 1.5px solid rgba(139,92,246,0.35);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(139,92,246,0.15), inset 0 0 40px rgba(139,92,246,0.06);
  backdrop-filter: blur(20px);
  overflow: hidden;
  flex: 1;
}

.kt-debrief-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  min-height: 420px;
  max-height: 80vh;
  min-width: 0;
}

.kt-debrief-header {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(139,92,246,0.2);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.kt-debrief-title-block { flex: 1; min-width: 0; }
.kt-debrief-title {
  font-weight: 900; font-size: 1.05rem;
  background: linear-gradient(135deg, #c4b5fd, #60a5fa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.kt-debrief-sub { font-size: .72rem; color: rgba(196,181,253,0.6); margin-top: 2px; }

.kt-debrief-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto; flex-shrink: 0;
}

/* Anneau score */
.kt-ring { position: relative; width: 68px; height: 68px; flex-shrink: 0; }
.kt-ring-fill {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(#6f42c1 0%, rgba(139,92,246,0.15) 0);
  transition: background .8s ease;
}
.kt-ring-core {
  position: absolute; inset: 7px; border-radius: 50%;
  background: rgba(17,5,38,0.95);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid rgba(139,92,246,0.2);
}
#kt-score-main { font-size: .8rem; font-weight: 900; color: #e5e7eb; line-height: 1.1; }
#kt-score-sub  { font-size: .7rem; color: rgba(196,181,253,0.7); line-height: 1.1; }

/* Bouton carte */
.kt-map-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 12px; text-decoration: none;
  background: linear-gradient(135deg, rgba(111,66,193,0.3), rgba(74,29,150,0.25));
  border: 1.5px solid rgba(139,92,246,0.5);
  color: #e5e7eb; font-weight: 800; font-size: .88rem;
  box-shadow: 0 4px 16px rgba(111,66,193,0.25), inset 0 0 0 1px rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
  transition: all .18s ease;
  white-space: nowrap;
}
.kt-map-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(139,92,246,0.8);
  background: linear-gradient(135deg, rgba(111,66,193,0.45), rgba(74,29,150,0.38));
  box-shadow: 0 6px 22px rgba(111,66,193,0.4);
  color: #fff;
}
.kt-map-emoji { font-size: 1em; }

/* ──────────────────────────────────────────────
   22. CHAT LOG & INPUT (débrief)
────────────────────────────────────────────── */
.kt-chat-log {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: none; /* limité par le parent via max-height:80vh */
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
  min-width: 0;
  border: 1px solid rgba(139,92,246,0.25);
  background: rgba(255,255,255,0.07);
  border-radius: 14px; padding: 12px;
  scroll-behavior: smooth;
}
.kt-chat-log::-webkit-scrollbar { width: 4px; }
.kt-chat-log::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.3); border-radius: 4px; }

/* Empêche les bulles de pousser l'input */
.kt-chat-log * {
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

.kt-input-row {
  flex: 0 0 auto;
  margin-top: auto;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 16px;
  background: rgba(17,5,38,0.96);
  border: 1px solid rgba(139,92,246,0.28);
  border-top: 1px solid rgba(139,92,246,0.22);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
  min-width: 0;
  z-index: 2;
}

.kt-input {
  flex: 1;
  padding: 11px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(10,1,24,0.35); color: #e5e7eb; font-size: .92rem; outline: none;
  transition: border-color .2s ease, background .2s ease;
}
.kt-input::placeholder { color: rgba(196,181,253,0.5); }
.kt-input:focus {
  border-color: rgba(139,92,246,0.75);
  background: rgba(10,1,24,0.55);
}

.kt-send-btn {
  padding: 11px 16px; border-radius: 12px;
  border: 1px solid rgba(139,92,246,0.35);
  background: linear-gradient(135deg, rgba(111,66,193,0.95), rgba(74,29,150,0.95));
  color: #fff; font-weight: 900;
  box-shadow: 0 8px 20px rgba(111,66,193,0.35);
  transition: transform .12s ease, box-shadow .2s ease;
  cursor: pointer;
}
.kt-send-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(111,66,193,0.45); }
.kt-send-btn:disabled { opacity: .5; transform: none; cursor: default; box-shadow: none; }

.kt-tts-btn {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid rgba(139,92,246,0.25);
  background: rgba(255,255,255,0.06); color: rgba(196,181,253,0.9); cursor: pointer;
  transition: transform .12s ease, border-color .2s ease;
}
.kt-tts-btn:hover { transform: translateY(-1px); border-color: rgba(139,92,246,0.5); }
.kt-tts-btn:disabled { opacity: .35; transform: none; cursor: default; }

.kt-btn-primary {
  padding: 8px 18px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #6f42c1, #4a1d96);
  color: #fff; font-weight: 900; font-size: .88rem; cursor: pointer;
  transition: all .18s ease;
  box-shadow: 0 4px 14px rgba(111,66,193,0.35);
}
.kt-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(111,66,193,0.5); }

/* ──────────────────────────────────────────────
   23. ANIMATIONS GLOBALES
────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.8s ease-out forwards;
}
@keyframes fadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────
   24. ANCIENS COMPOSANTS (mode libre / legacy)
────────────────────────────────────────────── */
.question-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform 0.3s ease-in-out;
}
.question-container:hover { transform: scale(1.02); }

.exercise-title {
  background-color: #007bff !important;
  padding: 10px;
  font-size: 1.3rem; font-weight: bold;
  text-align: center; color: white;
  border-radius: 8px;
  text-transform: uppercase; letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.exercise-card {
  margin-bottom: 2px !important;
  margin-left: 0 !important; margin-right: 0 !important;
  padding: 0px !important;
}

.exercise-card > .p-4 {
  padding-left: 0 !important; padding-right: 0 !important;
  padding-top: 8px !important; padding-bottom: 10px !important;
}
.exercise-card .question {
  margin-left: 0 !important; margin-right: 0 !important;
  border-radius: 10px !important;
}
.exercise-card .question .p-3 {
  padding-left: 10px !important; padding-right: 10px !important;
  padding-top: 12px !important; padding-bottom: 12px !important;
}
.exercise-card .question .answer-form .container {
  padding-left: 0 !important; padding-right: 0 !important;
  max-width: 100% !important;
}
.exercise-card .question .answer-form .row { --bs-gutter-x: .5rem; }

.form-check-label { color: black !important; font-size: 1rem; font-weight: 500; }
.form-check-input:checked + .form-check-label { font-weight: bold; }
.form-check-input:checked + .form-check-label.text-success { color: #28a745 !important; }

.guided-nav { border-top: 1px dashed rgba(0,0,0,.08); padding-top: .5rem; }
.guided-nav .btn { min-width: 130px; }

/* ──────────────────────────────────────────────
   25. KT-DEBRIEF (anciens styles, conservés pour legacy)
────────────────────────────────────────────── */
#kt-debrief ul { padding-left: 1.1rem; }
#kt-debrief li + li { margin-top: .25rem; }
#kt-debrief .card {
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,249,250,0.96));
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
#kt-debrief .card-title { font-weight: 700; }
#kt-debrief h6 { font-weight: 700; margin-bottom: .5rem; }

.kt-score-badge {
  background-color: rgba(108,117,125,0.35);
  color: #fff;
  backdrop-filter: blur(2px);
  width: 10rem !important; height: 10rem !important;
  padding: 0 !important; font-size: 1.3rem; font-weight: 700;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  border-radius: 50% !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ──────────────────────────────────────────────
   26. RESPONSIVE MOBILE
────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-brand { font-size: 1.2rem; }
  .card-title   { font-size: 1.25rem; }
  .card         { margin-bottom: 20px; }
  .btn-primary  { font-size: 0.9rem; padding: 8px 12px; }
}

@media (max-width: 576px) {
  .constellation-wrapper { width: 44px !important; }
  #combo-hud { top: 70px; right: 48px; font-size: .82rem; padding: 5px 10px; }
  .kt-debrief-right { gap: 8px; }
  .kt-map-text  { display: none; }
  .kt-ring      { width: 56px; height: 56px; }
  .exercise-card > .p-4 { padding-left: 0 !important; padding-right: 0 !important; }
  .exercise-card .question { margin: 0 !important; }
  .exercise-card .question .answer-form .row { --bs-gutter-x: .25rem; }
}

/* ──────────────────────────────────────────────
   27. PAGE HOME — ambiance stellaire
────────────────────────────────────────────── */
.home-page .container.mt-4 { max-width: 100% !important; }

.stellar-wrap {
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 15% 0%, #020617 0%, #020617 45%, #000 100%);
}
.stellar-wrap::before {
  content: "";
  position: absolute; inset: -60px;
  pointer-events: none; opacity: .75;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.10) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 120px 120px, 180px 180px, 260px 260px;
  background-position: 0 0, 30px 60px, 80px 40px;
  animation: star-drift 28s linear infinite;
}
@keyframes star-drift {
  0%  { transform: translate3d(0,0,0); }
  100%{ transform: translate3d(120px,80px,0); }
}

.nebula {
  position: absolute; inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(124,58,237,.28), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(236,72,153,.22), transparent 55%),
    radial-gradient(circle at 60% 80%, rgba(34,197,94,.16), transparent 60%);
  filter: blur(18px); opacity: .9; transform: rotate(-6deg);
}

.hero {
  min-height: 88vh; display: flex; align-items: center; position: relative;
}
.hero-inner { position: relative; z-index: 2; padding: 64px 0; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px;
  color: #0f172a; font-weight: 900; font-size: .82rem; letter-spacing: .08em;
  background: rgba(2,6,23,.35); border: 1px solid rgba(148,163,184,.35);
  backdrop-filter: blur(10px);
}
.hero-title {
  margin: 18px 0 14px 0; font-weight: 950; color: #0f172a;
  line-height: 1.12; font-size: clamp(2rem,4.8vw,3.6rem);
  text-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.hero-title .shine {
  background: linear-gradient(135deg,#A78BFA,#F472B6,#34D399);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub {
  max-width: 760px; margin: 0 auto; color: #0f172a; font-size: 1.15rem;
  text-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.hero-icons {
  margin: 30px 0 34px 0; display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
}
.hero-icons .chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 999px;
  background: rgba(2,6,23,.35); border: 1px solid rgba(148,163,184,.30);
  color: #0f172a; font-weight: 900; backdrop-filter: blur(10px);
}

.btn-cosmic {
  padding: 16px 30px; border-radius: 999px;
  font-weight: 950; font-size: 1.03rem; border: none;
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  position: relative;
}
.btn-primary-cosmic {
  background: linear-gradient(135deg,#22c55e,#00e676);
  color: #06210f; box-shadow: 0 16px 45px rgba(34,197,94,.25);
}
.btn-primary-cosmic:hover {
  transform: translateY(-2px); filter: brightness(1.03);
  box-shadow: 0 22px 60px rgba(34,197,94,.35); color: #06210f;
}
.btn-secondary-cosmic {
  background: rgba(248,250,252,.92); color: #4c1d95; box-shadow: 0 12px 38px rgba(0,0,0,.22);
}
.btn-secondary-cosmic:hover { transform: translateY(-2px); background: #fff; color: #4c1d95; }

.section { position: relative; z-index: 2; padding: 64px 0; }
.section-title { color: #0f172a; font-weight: 950; font-size: 2rem; }
.section-sub   { color: rgba(226,232,240,.85); }

/* Mini quiz home */
.quiz-card {
  max-width: 760px; margin: 0 auto;
  background: #ffffff; border: 1px solid rgba(15,23,42,.10);
  border-radius: 22px; box-shadow: 0 25px 60px rgba(0,0,0,.55);
  backdrop-filter: blur(14px); overflow: hidden;
}
.quiz-top {
  padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid rgba(15,23,42,.08);
}
.quiz-top .pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(124,58,237,.10); border: 1px solid rgba(124,58,237,.22);
  color: #5b21b6; font-weight: 950; font-size: .86rem;
}
.quiz-top .counter { color: rgba(15,23,42,.70); font-weight: 900; }
.quiz-body { padding: 22px; }

.preview-question { display: none; }
.preview-question.active { display: block; animation: fadeUp .35s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.q-title { color: #0f172a; font-weight: 950; font-size: 1.35rem; line-height: 1.25; margin: 0 0 10px 0; }
.q-help  { margin: 0 0 16px 0; color: rgba(15,23,42,.70); font-weight: 700; }

.preview-answer {
  width: 100%; padding: 16px; border-radius: 16px;
  border: 1px solid rgba(15,23,42,.12); background: #ffffff; color: #0f172a;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, filter .18s ease;
  display: flex; align-items: flex-start; gap: 14px;
  text-align: left; position: relative; overflow: hidden;
}
.preview-answer:hover:not(.disabled):not(.correct):not(.wrong) {
  transform: translateX(6px);
  border-color: rgba(124,58,237,.55);
  box-shadow: 0 12px 30px rgba(124,58,237,.12);
}
.answer-letter {
  min-width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 950;
  background: linear-gradient(135deg,#7c3aed,#a78bfa);
  color: #fff; box-shadow: 0 12px 26px rgba(124,58,237,.18);
}
.answer-text { font-weight: 850; font-size: 1.02rem; line-height: 1.25; }

.preview-answer.correct {
  border-color: #00e676;
  background: linear-gradient(135deg, rgba(0,230,118,.16), #ffffff);
  box-shadow: 0 14px 30px rgba(0,230,118,.18);
}
.preview-answer.correct .answer-letter { background: linear-gradient(135deg,#00e676,#a7f3d0); }
.preview-answer.wrong {
  border-color: #a855f7;
  background: linear-gradient(135deg, rgba(168,85,247,.14), #ffffff);
  box-shadow: 0 14px 30px rgba(168,85,247,.16);
}
.preview-answer.disabled { opacity: .85; cursor: not-allowed; }
.preview-answer.correct-hint { border-color: rgba(0,230,118,.55); box-shadow: 0 10px 25px rgba(0,230,118,.12); }

.feedback-panel {
  display: none; margin-top: 14px; border-radius: 16px; padding: 14px;
  border: 1px solid rgba(148,163,184,.22); background: #f8fafc;
}
.feedback-panel.show { display: block; animation: fbIn .25s ease; }
@keyframes fbIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.feedback-panel.success {
  border-color: rgba(0,230,118,.55);
  background: linear-gradient(135deg, rgba(0,230,118,.14), rgba(255,255,255,1));
}
.feedback-panel.wrong {
  border-color: rgba(168,85,247,.55);
  background: linear-gradient(135deg, rgba(168,85,247,.12), rgba(255,255,255,1));
}
.fb-title { display: flex; align-items: center; gap: 10px; font-weight: 950; color: #0f172a; }

.progress-dots { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(148,163,184,.28);
  transition: transform .2s ease, background .2s ease;
}
.dot.active      { background: rgba(124,58,237,.9); transform: scale(1.35); }
.dot.completed   { background: rgba(0,230,118,.95); }
.dot.completed.wrongmark { background: rgba(168,85,247,.92); }
.dot.clickable:hover { transform: scale(1.45); }

.pq-complete { display: none; text-align: center; padding: 26px 8px 10px; }
.pq-complete .big { font-size: 3.4rem; }

.unlock {
  margin-top: 16px; padding: 16px; border-radius: 18px;
  border: 1px solid rgba(0,230,118,.35);
  background: linear-gradient(135deg, rgba(0,230,118,.16), rgba(2,6,23,.55));
  color: #0f172a;
}
.unlock strong { color: #F8FAFC; }
.unlock .mini  { color: rgba(15,23,42,.70); font-weight: 700; margin-top: 6px; }

@media (max-width: 768px) {
  .hero-inner { padding: 54px 0; }
  .quiz-body  { padding: 18px; }
  .btn-cosmic { width: 100%; justify-content: center; }
}
