:root {
  --atlox-blue:#0e4194;
  --atlox-orange:#f59c00;
  --bg:#f7f9fc;
  --text:#1a1f36;
  --muted:#6b7280;
  --card:#ffffff;
  --stroke:#e5e7eb;
  --radius:14px;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,Segoe UI,Roboto,Arial,sans-serif}
.container{max-width:900px;margin:32px auto;padding:0 16px}
.card{background:var(--card);border:1px solid var(--stroke);border-radius:var(--radius);box-shadow:0 8px 30px rgba(0,0,0,.06);padding:24px;margin-bottom:16px}
h1{font-size:28px;margin:0 0 16px}
h2{font-size:20px;margin:0 0 12px}
.progress{height:10px;background:#eaeef5;border-radius:999px;overflow:hidden;margin:12px 0 20px}
.progress>div{height:100%;width:0;background:linear-gradient(90deg,var(--atlox-blue),var(--atlox-orange));transition:width .4s ease}
.grid{display:grid;gap:12px}
.grid-2{grid-template-columns:repeat(2,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
.btn{display:inline-block;background:var(--atlox-blue);color:#fff;border:0;border-radius:10px;padding:12px 16px;font-weight:600;cursor:pointer}
.btn.secondary{background:#fff;color:var(--atlox-blue);border:1px solid var(--atlox-blue)}
.label{font-size:14px;color:var(--muted);margin-bottom:6px}
.option{border:1px solid var(--stroke);border-radius:12px;padding:12px;cursor:pointer;background:#fff}
.option.selected{outline:3px solid rgba(14,65,148,.25)}
.row{display:flex;gap:12px;flex-wrap:wrap}
.badge{display:inline-block;padding:6px 10px;border-radius:999px;border:1px solid var(--stroke);font-size:12px;color:var(--muted);background:#fff}
.hidden{display:none}
.result-card{border:1px solid var(--stroke);border-radius:12px;padding:14px;background:#fff}
.map{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}
.map .cell{padding:10px;border:1px dashed #dfe3ea;border-radius:8px;text-align:center;font-size:13px;color:#61708a;background:#fafcff}
.map .cell.active{background:#e8f0ff;border-color:#b7cde5;font-weight:600}
.timeline{display:flex;align-items:center;gap:8px;margin-top:8px}
.timeline .dot{width:12px;height:12px;border-radius:50%;background:var(--atlox-orange)}
.timeline .line{flex:1;height:2px;background:#ffd39a}
.small{font-size:13px;color:var(--muted)}

 /* === Module 3 Styles === */
.module3-container.single-column{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
}
.image-choice{
  text-align:center;
}
.image-choice img{
  width:100%;
  max-width:100%;
  height:auto;
  display:block;
  border-radius:var(--radius);
  border:1px solid var(--stroke);
}
.image-choice p{
  margin-top:8px;
  font-size:14px;
  color:var(--text);
}

/* === Module 4 Scènes === */
.module-4 .module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.module-4 .module-progress{font-size:14px;color:var(--muted)}
.module-4 .module-nav{display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:16px}
.module-4 .module-nav .btn.nav{background:#fff;color:var(--atlox-blue);border:1px solid var(--atlox-blue);padding:6px 10px;border-radius:6px;font-size:18px}
.module-4 .module-nav .btn.nav:disabled{opacity:0.5;cursor:not-allowed}
.module-4 .nav-dots{display:flex;gap:6px}
.module-4 .nav-dots .dot{width:24px;height:24px;border-radius:50%;border:1px solid var(--stroke);background:#fff;font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.module-4 .nav-dots .dot.is-active{background:var(--atlox-blue);color:#fff;border-color:var(--atlox-blue)}
.module-4 .screens .screen{display:none}
.module-4 .screens .screen.is-active{display:block}
.module-4 .screen-grid{display:grid;gap:12px;grid-template-columns:repeat(2,1fr)}
@media(max-width:600px){
  .module-4 .screen-grid{grid-template-columns:1fr}
}
.scene-card{background:#fff;border:1px solid var(--stroke);border-radius:var(--radius);overflow:hidden;box-shadow:0 4px 12px rgba(0,0,0,.04)}
.scene-card button.scene-select{background:none;border:0;padding:0;width:100%;cursor:pointer;text-align:left}
.scene-card .scene-img{width:100%;height:auto;display:block;border-bottom:1px solid var(--stroke)}
.scene-card .scene-meta{padding:12px}
.scene-card .scene-title{font-size:16px;margin:0 0 8px}
.rank-badges{display:flex;gap:6px}
.rank-badge{display:inline-block;width:20px;height:20px;border-radius:50%;background:#eee;color:#555;font-size:12px;line-height:20px;text-align:center}
.rank-badge.rank-1{background:#ffd39a}
.rank-badge.rank-2{background:#b7cde5}
.rank-badge.rank-3{background:#fadfb0}
.rank-badge.rank-4{background:#e5e7eb}
.scene-card.is-selected{outline:3px solid var(--atlox-orange)}
.module-4 .module-actions{text-align:center;margin-top:20px}
.module-4 .module-actions .btn.primary:disabled{opacity:0.5;cursor:not-allowed}
#m4-messages{font-size:13px;color:#a00000;margin-top:12px;min-height:18px}
.m4-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
@media (max-width:1024px){.m4-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:720px){.m4-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.m4-card{display:block;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden;background:#fff;cursor:pointer;text-align:left}
.m4-thumb{width:100%;aspect-ratio:1/1;object-fit:cover;display:block}
.m4-caption{padding:8px 10px;font-size:.95rem}

.module3-pair{
  display:flex;
  gap:24px;
  justify-content:center;
  align-items:flex-start;
  flex-wrap:wrap;
}
.image-choice{
  max-width:420px;
  text-align:center;
}
.image-choice img{
  width:100%;
  height:auto;
  border-radius:16px;
  display:block;
}
@media screen and (min-width: 900px) {
  .module3-pair {
    flex-wrap: nowrap;
    gap: 32px;
  }
  .image-choice {
    max-width: 45%;
  }
  .image-choice img {
    width: 100%;
    height: auto;
    object-fit: cover;
  }
}

/* Boutons navigation */
.nav-buttons {
  display:flex;
  justify-content:center;
  gap:12px;
}

/* Patch du module Réalité supprimé. Les styles spécifiques seront chargés dans un fichier dédié. */


/* ============================================================
   === DÉFIS COURTS — choix avec case à cocher ===
   ============================================================ */
.module-defis .defi-option{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:10px 12px;
  margin:8px 0;
  border:1px solid transparent;
  border-radius:10px;
  cursor:pointer;
  color:var(--text);
  transition:background .15s ease,border-color .15s ease;
}
.module-defis .defi-option::before{
  content:'';
  flex:0 0 20px;
  width:20px;
  height:20px;
  margin-top:1px;
  border:2px solid #4b5563;
  border-radius:3px;
  background:#fff;
  box-sizing:border-box;
}
.module-defis .defi-option:hover{
  background:#f3f4f6;
}
.module-defis .defi-option.selected{
  border-color:rgba(14,65,148,.25);
  background:#eef4ff;
}
.module-defis .defi-option.selected::before{
  content:'✓';
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--atlox-blue);
  border-color:var(--atlox-blue);
  color:#fff;
  font-size:15px;
  line-height:1;
  font-weight:800;
}

/* ============================================================
   === JEU DE COHÉRENCE — gris avant choix, bleu après clic ===
   ============================================================ */
#coherence .coherence-choice{
  background:#e5e7eb !important;
  color:#111827 !important;
  border:1px solid #d1d5db !important;
}
#coherence .coherence-choice:hover{
  background:#d1d5db !important;
}
#coherence .coherence-choice.selected{
  background:var(--atlox-blue) !important;
  color:#fff !important;
  border-color:var(--atlox-blue) !important;
}


/* ============================================================
   === MODULE SCÈNES — 24 lieux / 4 choix ===
   ============================================================ */
#module3-container{
  width:100%;
}
.module3-heading{
  margin-bottom:14px;
}
.module3-heading h2{
  margin-bottom:6px;
}
.module3-counter{
  margin-top:8px;
  font-weight:700;
  color:var(--atlox-blue);
}
.module3-grid{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:12px;
  width:100%;
}
.module3-card{
  position:relative;
  display:flex;
  flex-direction:column;
  min-width:0;
  padding:0;
  overflow:hidden;
  border:2px solid transparent;
  border-radius:14px;
  background:#fff;
  color:var(--text);
  cursor:pointer;
  text-align:left;
  box-shadow:0 1px 4px rgba(15,23,42,.08);
  transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease;
}
.module3-card:hover{
  transform:translateY(-1px);
  box-shadow:0 4px 14px rgba(15,23,42,.12);
}
.module3-card.selected{
  border-color:var(--atlox-blue);
  box-shadow:0 0 0 2px rgba(14,65,148,.14);
}
.module3-image-wrap{
  position:relative;
  display:block;
  width:100%;
  aspect-ratio:1/1;
  overflow:hidden;
  background:#eef2f7;
}
.module3-image-wrap img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  border:0;
  border-radius:0;
}
.module3-check{
  position:absolute;
  top:7px;
  right:7px;
  width:26px;
  height:26px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  background:rgba(255,255,255,.92);
  color:var(--atlox-blue);
  font-weight:900;
  box-shadow:0 1px 5px rgba(0,0,0,.18);
}
.module3-card.selected .module3-check{
  background:var(--atlox-blue);
  color:#fff;
}
.module3-caption{
  display:flex;
  align-items:center;
  min-height:50px;
  padding:8px 9px;
  font-size:13px;
  line-height:1.25;
  font-weight:700;
}
.module3-image-wrap.image-missing{
  display:flex;
  align-items:center;
  justify-content:center;
}
.module3-image-fallback{
  padding:12px;
  text-align:center;
  font-size:12px;
  line-height:1.3;
  color:var(--muted);
}
#module3-next{
  margin-top:16px;
}

@media screen and (max-width:1024px){
  .module3-grid{
    grid-template-columns:repeat(4,minmax(0,1fr));
  }
}

@media screen and (max-width:640px){
  .module3-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
  }
  .module3-card{
    border-radius:10px;
  }
  .module3-caption{
    min-height:48px;
    padding:6px 4px;
    font-size:9.5px;
    line-height:1.15;
    overflow-wrap:anywhere;
    hyphens:auto;
    text-transform:none !important;
  }
  .module3-check{
    top:5px;
    right:5px;
    width:22px;
    height:22px;
    font-size:13px;
  }
}

@media screen and (max-width:360px){
  .module3-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .module3-caption{
    font-size:9.5px;
    min-height:44px;
    text-transform:none !important;
  }
}

@media screen and (max-width:640px){
  #module3-next{
    position:sticky;
    bottom:10px;
    z-index:20;
    width:100%;
    box-shadow:0 4px 14px rgba(15,23,42,.18);
  }
}


/* ============================================================
   ATLOX REO2 v4 — lisibilité scènes + affinage sous-familles
   ============================================================ */
.module3-caption{
  text-transform:none !important;
  letter-spacing:0 !important;
  white-space:normal !important;
  overflow-wrap:anywhere;
  word-break:normal;
  hyphens:auto;
}

.subfamily-step{
  margin-bottom:6px;
  font-size:12px;
  font-weight:700;
  color:var(--muted);
}
.subfamily-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin:14px 0 10px;
}
.subfamily-option{
  min-height:48px;
  padding:10px 12px;
  border:1px solid #cbd5e1;
  border-radius:10px;
  background:#f1f5f9;
  color:var(--text);
  font:inherit;
  font-weight:700;
  cursor:pointer;
  text-align:left;
  text-transform:none !important;
  transition:border-color .15s ease,background .15s ease,color .15s ease;
}
.subfamily-option:hover{
  border-color:var(--atlox-blue);
}
.subfamily-option.selected{
  background:var(--atlox-blue);
  border-color:var(--atlox-blue);
  color:#fff;
}
.subfamily-counter{
  margin:8px 0 12px;
  font-size:13px;
  font-weight:700;
  color:var(--atlox-blue);
}
.coherence-progress{
  margin-bottom:8px;
}
.result-subfamilies{
  margin-top:10px;
}
.result-subfamilies p{
  margin:4px 0;
}

@media screen and (max-width:640px){
  .subfamily-grid{
    grid-template-columns:1fr;
    gap:8px;
  }
  .subfamily-option{
    min-height:44px;
    padding:9px 10px;
    font-size:13px;
  }
}
