:root{--W:1536px;--H:1024px}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#0d6fa6;font-family:Arial,Helvetica,sans-serif}
#stage{
  position:absolute; left:50%; top:50%;
  width:1536px; height:1024px;
  transform-origin:center center;
  background-image:url("../assets/interface-aires-architecture.png");background-size:1536px 1024px;background-position:0 0;background-repeat:no-repeat;
  overflow:hidden;
}
/* Zones réelles de l'image */
#board{
  position:absolute;
  left:305px; top:354px;
  width:891px; height:552px;
}
#topbar{
  position:absolute;
  left:307px; top:277px;
  width:888px; height:72px;
}
#backBtn{position:absolute;left:8px;top:15px;width:270px;height:112px;background:transparent;border:0;cursor:pointer}
#sheetsBtn{position:absolute;left:8px;top:154px;width:270px;height:105px;background:transparent;border:0;cursor:pointer}

/* moteur dans le fond */
.screen{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
.hidden{display:none!important}

#menu h2,#end h2{
  margin:0 0 10px;color:#1e4962;font-size:50px;line-height:1;
  text-shadow:0 2px 0 #fff;
}
#menu p,#end p{font-size:24px;color:#24495e;margin:8px 0 24px;font-weight:700;text-align:center}
.levels{display:flex;gap:28px}
.levelBtn,.replayBtn{
  border:4px solid #6f501c;border-radius:18px;
  padding:18px 30px;background:#ffc524;color:#2c1b00;
  font-size:27px;font-weight:900;cursor:pointer;
  box-shadow:0 6px 0 #a76c08;
}
.levelBtn small{display:block;font-size:17px;margin-top:5px}
.levelBtn:active,.replayBtn:active{transform:translateY(4px);box-shadow:0 2px 0 #a76c08}

/* Barre supérieure intégrée sur la bande beige */
#hud{
  position:absolute;inset:0;
  display:flex;align-items:center;justify-content:flex-start;
  padding-left:100px;gap:22px;
  color:#184b68;font-weight:900;font-size:24px;
}
.hudItem{white-space:nowrap}
#qBubble{
  position:absolute;top:7px;width:58px;height:58px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  color:#183f58;font-size:20px;font-weight:900;
}
#qBubble{right:78px}


/* Question */
#play{justify-content:flex-start;padding-top:16px}
#question{
  width:820px;text-align:center;
  color:#183f58;font-size:30px;font-weight:900;
  margin:0 0 6px;
}
#figure{
  width:800px;height:330px;
  display:flex;align-items:center;justify-content:center;
}
#figure svg{width:100%;height:100%}
#answerRow{
  display:flex;align-items:center;gap:10px;
  font-size:28px;font-weight:900;color:#183f58;
  margin-top:2px;
}
#answer{
  width:130px;height:56px;border:4px solid #3b6678;border-radius:12px;
  font-size:32px;font-weight:900;text-align:center;outline:none;background:#fff;
}
#feedback{
  height:34px;margin-top:10px;
  font-size:23px;font-weight:900;text-align:center
}
#controls{display:flex;gap:14px;margin-top:6px}
.ctrl{
  border:3px solid #24566f;border-radius:12px;padding:9px 18px;
  background:#1f9bd1;color:#fff;font-size:18px;font-weight:900;cursor:pointer;
  box-shadow:0 4px 0 #0b668f
}
.ctrl:active{transform:translateY(3px);box-shadow:0 1px 0 #0b668f}

/* aide visuelle */
.gridLine{stroke:#84afc1;stroke-width:1}
.shape{fill:rgba(83,178,220,.18);stroke:#17496a;stroke-width:5}
.dim{font-size:22px;font-weight:900;fill:#173f58}

#leftLevels{
  position:absolute;
  left:34px;
  top:338px;
  width:210px;
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:stretch;
  z-index:5;
}
.levelsTitle{
  height:42px;
  border:4px solid #573b17;
  border-radius:13px;
  background:linear-gradient(#187fc1,#0e5f9d);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:900;
  letter-spacing:.4px;
  text-shadow:0 2px 0 #15384d;
  box-shadow:0 4px 0 #4c3418;
}
.sideLevel{
  height:70px;
  border:5px solid #6b481a;
  border-radius:16px;
  background:linear-gradient(#8fd23c,#4d9f16);
  color:#fff;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:8px 10px;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 5px 0 #4b3218;
  text-align:center;
}
.sideLevel:nth-of-type(3){
  background:linear-gradient(#3097e8,#1164b6);
}
.sideLevel:nth-of-type(4){
  background:linear-gradient(#8fd23c,#4d9f16);
}

.sideLevel strong{
  font-size:20px;
  line-height:1.05;
  text-shadow:0 2px 0 #173f58;
}
.sideLevel small{
  margin-top:6px;
  font-size:14px;
  line-height:1.08;
  text-shadow:0 2px 0 #173f58;
}
.sideLevel.active{
  outline:4px solid #ffd43b;
  outline-offset:-7px;
  filter:brightness(1.07);
}
#bottomControls{
  position:absolute; left:305px; top:924px; width:891px;
  display:flex; justify-content:center; gap:24px; z-index:6;
}
#bottomControls .ctrl{
  min-width:175px; height:58px; font-size:22px;
}


#externalScore{
  position:absolute;
  right:34px;
  top:28px;
  width:245px;
  height:112px;
  display:grid;
  grid-template-columns:82px 1fr;
  align-items:center;
  z-index:7;
  background:#fff;
  border:4px solid #355260;
  border-radius:18px;
  box-shadow:0 5px 0 rgba(0,0,0,.20);
  color:#122f42;
  font-weight:900;
  overflow:hidden;
}
#externalScore .trophy{
  font-size:54px;
  line-height:1;
  text-align:center;
}
#externalScore .scoreText{
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
}
#externalScore .scoreLabel{
  position:static;
  font-size:20px;
  line-height:1;
  margin:0 0 8px 0;
  white-space:nowrap;
}
#externalScore .scoreValue{
  position:static !important;
  width:auto !important;
  height:auto !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  display:block !important;
  color:#000 !important;
  font-size:46px !important;
  line-height:.9 !important;
  font-weight:900 !important;
}

/* Niveau 3 — tracé interactif */
#figure.level3Grid{
  width:800px;
  height:330px;
  touch-action:none;
}
#answerRow.level3Hidden{display:none}
#figure .grid-bg{fill:#ffffff;stroke:#31596c;stroke-width:3}
#figure .grid-line{stroke:#c4d7df;stroke-width:1}
#figure .grid-line-major{stroke:#91aebc;stroke-width:1.6}
#figure .draw-rect{
  fill:rgba(31,155,209,.30);
  stroke:#17496a;
  stroke-width:4;
  pointer-events:none;
}
#figure .draw-dot{
  fill:#ffc524;
  stroke:#6b481a;
  stroke-width:2;
  pointer-events:none;
}
#figure .draw-label{
  fill:#173f58;
  font-size:20px;
  font-weight:900;
  pointer-events:none;
}
#figure .target-area{
  fill:#173f58;
  font-size:22px;
  font-weight:900;
}

.sideLevel[data-level="3"]{
  background:linear-gradient(#8fd23c,#4d9f16) !important;
}
