*{box-sizing:border-box}
html,body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  font-family:"Trebuchet MS",Arial,sans-serif;
  background:#0f4b28;
}
body{
  position:relative;
}

/* =========================================================
   SCENE 1648 x 954
   ========================================================= */
.game{
  position:absolute;
  left:50%;
  top:50%;
  width:min(100vw,calc(100vh * 1648 / 954));
  aspect-ratio:1648 / 954;
  transform:translate(-50%,-50%);
  overflow:hidden;
}
.bg{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:fill;
  user-select:none;
  pointer-events:none;
}

/* Pancartes déjà intégrées au fond */
.pancarte-hotspot{
  position:absolute;
  z-index:60;
  display:block;
  background:transparent;
  cursor:pointer;
}
.pancarte-retour{left:80.4%;top:5.2%;width:17.1%;height:11.7%}
.pancarte-fiche{left:80.1%;top:17.4%;width:17.7%;height:12.7%}
.pancarte-hotspot:focus-visible{
  outline:3px dashed #fff;
  outline-offset:-4px;
  border-radius:10px;
}

/* Son / consigne */
.hotspot{position:absolute;border:0;background:rgba(255,255,255,.01);color:transparent;cursor:pointer}
.lightbulb{
  position:absolute;left:29.2%;top:24.6%;width:3.5%;height:4.8%;z-index:8;
  color:#fff;font-size:clamp(13px,1.8vw,27px);
  background:none;border:0;cursor:pointer;filter:drop-shadow(0 1px 2px #000a)
}
.icon-badge{
  position:absolute;z-index:8;border-radius:50%;border:0;cursor:pointer;
  display:grid;place-items:center;background:rgba(20,30,10,.25);color:#fff
}
.sound{left:1.6%;top:1.6%;width:4.5%;height:6%;font-size:clamp(12px,1.6vw,23px)}

/* Score : en bas à droite, hors des pancartes */
.score-box{
  position:absolute;z-index:8;left:84.8%;top:82.0%;width:11.8%;
  text-align:center;font-weight:900;color:#5a3a12;
  font-size:clamp(8px,1vw,16px);background:#fff;border-radius:16px;
  padding:.55% .8%;box-shadow:0 3px 0 rgba(0,0,0,.15)
}
.score-box b{color:#d1470f}

/* Niveaux : marge gauche */
.level-buttons{
  position:absolute;left:.8%;top:48.4%;width:10.2%;height:21.8%;z-index:8;
  display:flex;flex-direction:column;justify-content:center;gap:14%
}
.level-buttons button{
  width:100%;aspect-ratio:2.5;border-radius:16px;border:3px solid #6b4310;
  background:linear-gradient(#3d8fd8,#1c5f9e);color:#fff;font-weight:900;
  font-size:clamp(8px,1vw,15px);box-shadow:0 4px 0 #123f6b;cursor:pointer
}
.level-buttons button.active{
  background:linear-gradient(#ffd85e,#e0a512);color:#5a3a12;box-shadow:0 4px 0 #a06e0d
}

/* =========================================================
   EXERCICES 1 à 10
   Chaque rond est positionné individuellement.
   Plus de flex = plus de dérive entre laptop et mobile.
   ========================================================= */
.steps{
  position:absolute;
  left:0;top:0;width:100%;height:100%;
  z-index:8;
  pointer-events:none;
}
.step{
  position:absolute;
  top:32.05%;
  width:3.05%;
  aspect-ratio:1;
  border-radius:50%;
  background:#fff;
  border:2px solid #8a5a24;
  display:grid;
  place-items:center;
  font-weight:900;
  font-size:clamp(7px,.8vw,13px);
  color:#5a3a12;
  transition:background .25s,transform .25s;
  pointer-events:auto;
  transform:translateX(-50%);
}
.step:nth-child(1){left:36.4%}
.step:nth-child(2){left:39.65%}
.step:nth-child(3){left:42.9%}
.step:nth-child(4){left:46.15%}
.step:nth-child(5){left:49.4%}
.step:nth-child(6){left:52.65%}
.step:nth-child(7){left:55.9%}
.step:nth-child(8){left:59.15%}
.step:nth-child(9){left:62.4%}
.step:nth-child(10){left:65.65%}
.step.current{background:#ffd85e;border-color:#c98a12;transform:translateX(-50%) scale(1.18)}
.step.done{background:#7fd85e;border-color:#3e8515;color:#fff}

/* Message */
.message{
  position:absolute;left:26%;top:37.8%;width:50%;text-align:center;
  font-weight:1000;font-size:clamp(9px,1.25vw,18px);color:#a4390f;
  text-shadow:0 1px 0 #fff;z-index:8
}

/* Objets : strictement à l'intérieur du parchemin */
.objects-zone{
  position:absolute;left:24.2%;top:41.2%;width:51.6%;height:30.8%;
  z-index:5;overflow:hidden
}
.count-obj{
  position:absolute;object-fit:contain;max-width:100%;max-height:100%;
  cursor:pointer;transition:opacity .2s,transform .15s;
  filter:drop-shadow(0 3px 4px rgba(0,0,0,.3))
}
.count-obj:hover{transform:scale(1.05)}
.count-obj.counted{opacity:.25;transform:scale(.9)}

/* Réponses 1 à 9 */
.choices{
  position:absolute;left:22.7%;top:75.6%;width:54.6%;height:9.2%;
  display:flex;justify-content:space-between;align-items:center;
  gap:.2%;z-index:8;overflow:hidden
}
.choices button{
  flex:1 1 0;min-width:0;height:100%;aspect-ratio:1;
  border:0;background:none;padding:0;cursor:pointer
}
.choices button img{display:block;width:100%;height:100%;object-fit:contain}
.choices button.correct img{filter:sepia(1) saturate(8) hue-rotate(50deg) brightness(1)}
.choices button.wrong img{filter:sepia(1) saturate(8) hue-rotate(-58deg) brightness(1)}

/* Intro / fin */
.intro-screen{position:absolute;z-index:80;inset:0;background:rgba(10,20,10,.72);display:grid;place-items:center}
.intro-card{position:relative;width:min(480px,62%);padding:4% 5% 3%;text-align:center;background:#fff;border-radius:22px;box-shadow:0 12px 0 rgba(0,0,0,.15)}
.intro-close{position:absolute;top:10px;right:12px;border:0;background:none;font-size:20px;cursor:pointer}
.intro-icon{font-size:36px}
.intro-card h2{margin:4px 0 12px;color:#5a3a12;font-size:clamp(17px,2.2vw,28px)}
.intro-card p{margin:0 0 16px;color:#5a3a12;font-size:clamp(11px,1.4vw,18px);line-height:1.4;font-weight:600}
.intro-ok{border:0;border-radius:14px;background:linear-gradient(#8bd93f,#5cb82a);box-shadow:0 5px 0 #3e8515;padding:10px 25px;font-weight:1000;font-size:clamp(11px,1.4vw,17px);color:#fff;cursor:pointer}

.end-screen{position:absolute;z-index:80;inset:0;background:rgba(30,50,10,.6);display:none;place-items:center}
.end-screen.show{display:grid}
.end-card{width:min(420px,58%);padding:22px;text-align:center;background:#fffaf0;border-radius:24px;border:5px solid #f5b400}
.trophy{font-size:50px}
.end-card h2{font-size:clamp(16px,2vw,27px);margin:6px;color:#a4390f}
.end-card p{font-size:clamp(11px,1.3vw,17px);font-weight:800;color:#5a3300}
.end-card button{display:block;width:100%;margin-top:10px;border:0;border-radius:14px;background:linear-gradient(#8bd93f,#5cb82a);box-shadow:0 5px 0 #3e8515;padding:10px 20px;font-weight:1000;color:#fff;cursor:pointer}

/* =========================================================
   MOBILE PORTRAIT
   On conserve le jeu horizontal mais on le tourne à 90°.
   Il utilise alors presque toute la hauteur du téléphone
   au lieu d'être miniaturisé en haut de la page.
   ========================================================= */
@media (orientation:portrait) and (max-width:900px){
  .game{
    width:min(100vh,calc(100vw * 1648 / 954));
    max-width:none;
    max-height:none;
    transform:translate(-50%,-50%) rotate(90deg);
  }
  .count-obj:hover{transform:none}
  .level-buttons button{border-width:1px;border-radius:8px;box-shadow:0 2px 0 #123f6b}
  .step{border-width:1px}
  .score-box{border-radius:7px}
}

/* Mobile paysage : plein écran autant que possible */
@media (orientation:landscape) and (max-height:600px){
  .game{
    width:min(100vw,calc(100vh * 1648 / 954));
  }
  .count-obj:hover{transform:none}
}


/* CORRECTION POSITION AMPOULE */
.lightbulb{
  left:29.2% !important;
  top:24.6% !important;
  width:3.5% !important;
  height:4.8% !important;
}

/* La position reste proportionnelle sur mobile/tablette */
@media (max-width:900px){
  .lightbulb{
    left:29.2% !important;
    top:24.6% !important;
    width:3.5% !important;
    height:4.8% !important;
  }
}
