/* V22 · mise à l'échelle complète de l'interface
   - l'activité entière tient dans la fenêtre au chargement ;
   - les boutons + / - permettent d'agrandir sans modifier les mécaniques ;
   - en cas d'agrandissement, la zone devient déplaçable par défilement tactile. */

html.fit-root,
body.fit-body{
  width:100%;
  height:100%;
  min-height:0!important;
  overflow:hidden!important;
}
body.fit-body{margin:0!important}

.fit-viewport{
  position:fixed;
  inset:0;
  z-index:0;
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  background:radial-gradient(circle at 80% 10%,#cceffc 0,#eef7fc 42%,#f7fbfe 100%);
  scrollbar-width:thin;
  scrollbar-color:#8dbbd5 rgba(255,255,255,.45);
}
.fit-spacer{
  position:relative;
  flex:none;
}
.fit-stage{
  position:absolute!important;
  top:0;
  left:0;
  margin:0!important;
  transform-origin:0 0;
  overflow:hidden;
  contain:layout paint;
}

.fit-controls{
  position:fixed;
  right:max(10px,env(safe-area-inset-right));
  bottom:max(10px,env(safe-area-inset-bottom));
  z-index:20000;
  display:flex;
  align-items:center;
  gap:6px;
  padding:6px;
  border:1px solid rgba(10,103,173,.22);
  border-radius:999px;
  background:rgba(255,255,255,.94);
  box-shadow:0 10px 28px rgba(8,75,122,.22);
  backdrop-filter:blur(8px);
}
.fit-control{
  min-width:42px;
  height:42px;
  border:0;
  border-radius:999px;
  background:#eaf5fb;
  color:#0b4f8a;
  font:900 20px/1 Arial,Helvetica,sans-serif;
  cursor:pointer;
  touch-action:manipulation;
}
.fit-control:hover{background:#d6ebf7}
.fit-control:active{transform:translateY(1px)}
.fit-control.fit-reset{
  min-width:86px;
  padding:0 13px;
  background:#0a67ad;
  color:#fff;
  font-size:13px;
}
.fit-control.fit-fullscreen{font-size:18px}
.fit-zoom-label{
  min-width:50px;
  text-align:center;
  color:#0b4f8a;
  font:900 12px/1 Arial,Helvetica,sans-serif;
}
.fit-tip{
  position:fixed;
  left:50%;
  bottom:max(68px,calc(env(safe-area-inset-bottom) + 68px));
  z-index:19999;
  max-width:calc(100vw - 24px);
  transform:translateX(-50%);
  padding:8px 13px;
  border-radius:999px;
  background:rgba(11,79,138,.94);
  color:#fff;
  font:800 12px/1.25 Arial,Helvetica,sans-serif;
  text-align:center;
  box-shadow:0 8px 22px rgba(5,48,80,.22);
  pointer-events:none;
  opacity:0;
  transition:opacity .2s ease;
}
.fit-tip.show{opacity:1}

/* Les fenêtres de carte restent liées à l'écran réel et non au canevas réduit. */
body.fit-body > .modal,
body.fit-body > .toast,
body.fit-body > .exact-celebration{
  z-index:21000!important;
}

/* --------------------------
   Canevas des jeux 1440 × 810
   -------------------------- */
.fit-stage--game{
  width:1440px!important;
  height:810px!important;
}
.fit-stage--game .screen{
  min-height:0!important;
  height:100%!important;
  overflow:hidden!important;
}
.fit-stage--game .game-header{
  width:calc(100% - 32px)!important;
  height:112px!important;
  margin:0 auto!important;
  padding:12px 4px 8px!important;
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:18px!important;
}
.fit-stage--game .game-header > div:first-child{min-width:0;max-width:1030px}
.fit-stage--game .game-header h1{
  margin:4px 0 4px!important;
  font-size:38px!important;
  line-height:1.02!important;
}
.fit-stage--game .game-header p{
  margin:0!important;
  font-size:15px!important;
  line-height:1.32!important;
}
.fit-stage--game .game-header .eyebrow{font-size:12px!important}
.fit-stage--game .header-actions{
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  gap:12px!important;
  flex:none!important;
}
.fit-stage--game .game-header .brand-logo{
  width:180px!important;
  max-width:none!important;
  margin:0!important;
}
.fit-stage--game .quiet,
.fit-stage--game .secondary{
  padding:10px 16px!important;
  border-radius:12px!important;
  font-size:14px!important;
  white-space:nowrap;
}
.fit-stage--game .game-layout{
  width:calc(100% - 32px)!important;
  height:682px!important;
  margin:0 auto!important;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 350px!important;
  gap:14px!important;
  align-items:stretch!important;
}
.fit-stage--game .board-wrap{
  width:auto!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  aspect-ratio:1.43/1!important;
  justify-self:center!important;
  align-self:center!important;
  border-radius:20px!important;
}
.fit-stage--game .side-panel{
  position:relative!important;
  top:auto!important;
  width:350px!important;
  height:100%!important;
  max-height:100%!important;
  min-height:0!important;
  padding:16px!important;
  border-radius:20px!important;
  overflow:auto!important;
  overscroll-behavior:contain;
}
.fit-stage--game .side-head h2{font-size:23px!important}
.fit-stage--game .side-head p{
  margin:4px 0 10px!important;
  font-size:12px!important;
  line-height:1.32!important;
}
.fit-stage--game .tray{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:8px!important;
  min-height:0!important;
  align-content:start!important;
}
.fit-stage--game .primary{
  min-height:44px!important;
  margin-top:10px!important;
  padding:11px 14px!important;
  border-radius:13px!important;
  font-size:14px!important;
}
.fit-stage--game .secondary{margin-top:8px!important;width:100%!important}
.fit-stage--game .ig-simple{
  margin-bottom:9px!important;
  padding:10px!important;
  font-size:11px!important;
  line-height:1.3!important;
}
.fit-stage--game .result-panel h2{font-size:23px!important}
.fit-stage--game .result-intro{font-size:12px!important;margin-bottom:10px!important}
.fit-stage--game .learning-wrap{margin-top:10px!important}
.fit-stage--game .learning-list{gap:6px!important}
.fit-stage--game .learning-item{padding:9px 10px!important}
.fit-stage--game .decision-box{margin-top:9px!important;padding:10px!important}
.fit-stage--game .level-hint{font-size:9px!important}

/* Écran des niveaux : une à quatre cartes tiennent sans roulette. */
.fit-stage--game .levels-shell{
  width:100%!important;
  height:100%!important;
  margin:0!important;
  padding:24px 34px 28px!important;
  display:flex!important;
  flex-direction:column!important;
  text-align:center!important;
  overflow:hidden!important;
}
.fit-stage--game .levels-shell .brand-logo{
  width:230px!important;
  max-width:none!important;
  margin:0 auto 8px!important;
}
.fit-stage--game .levels-shell h1{
  font-size:43px!important;
  margin:6px 0 9px!important;
}
.fit-stage--game .levels-intro{
  max-width:900px!important;
  margin:0 auto 12px!important;
  font-size:15px!important;
}
.fit-stage--game .levels-complete{
  margin:0 auto 10px!important;
  padding:8px 12px!important;
  font-size:13px!important;
}
.fit-stage--game .level-grid{
  flex:1!important;
  min-height:0!important;
  display:flex!important;
  align-items:stretch!important;
  justify-content:center!important;
  gap:14px!important;
}
.fit-stage--game .level-card{
  flex:1 1 0!important;
  width:auto!important;
  min-width:0!important;
  min-height:0!important;
  height:100%!important;
  padding:24px 24px 82px!important;
  border-radius:22px!important;
  gap:14px!important;
}
.fit-stage--game .level-card strong{font-size:25px!important}
.fit-stage--game .level-card span:not(.level-no):not(.level-status){font-size:14px!important;line-height:1.35!important}
.fit-stage--game .level-card .level-status{left:24px!important;bottom:31px!important}
.fit-stage--game .level-card.available:after{right:20px!important;bottom:20px!important;padding:9px 16px!important;font-size:12px!important}

/* --------------------------
   Choix des jeux 1200 × 760
   -------------------------- */
.fit-stage--choice{
  width:1200px!important;
  height:760px!important;
}
.fit-stage--choice.choice-main{
  min-height:0!important;
  height:760px!important;
  padding:22px!important;
  display:grid!important;
  place-items:center!important;
  overflow:hidden!important;
}
.fit-stage--choice .choice-shell{
  width:1120px!important;
  max-height:710px!important;
  padding:30px!important;
  border-radius:26px!important;
}
.fit-stage--choice .choice-logo{width:190px!important;margin:0 0 10px!important}
.fit-stage--choice .choice-shell h1{font-size:48px!important;margin:5px 0 8px!important}
.fit-stage--choice .choice-intro{font-size:16px!important;margin:0!important}
.fit-stage--choice .game-choice-grid{
  grid-template-columns:1fr 1fr!important;
  gap:18px!important;
  margin-top:20px!important;
}
.fit-stage--choice .game-choice-card{
  min-height:310px!important;
  padding:26px!important;
  gap:13px!important;
  border-radius:22px!important;
}
.fit-stage--choice .game-choice-card strong{font-size:30px!important}
.fit-stage--choice .game-choice-card p{font-size:15px!important;line-height:1.42!important}
.fit-stage--choice .choice-cta{padding:11px 18px!important;font-size:14px!important}

/* --------------------------
   Composer son repas
   -------------------------- */
.fit-stage--composer{
  width:1440px!important;
  height:810px!important;
}
.fit-stage--composer .page-head{
  width:calc(100% - 32px)!important;
  height:118px!important;
  margin:0 auto!important;
  padding:12px 4px 8px!important;
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  gap:18px!important;
}
.fit-stage--composer .page-head > div:first-child{min-width:0;max-width:1060px}
.fit-stage--composer .page-head h1{font-size:38px!important;margin:3px 0 5px!important}
.fit-stage--composer .page-head p{font-size:14px!important;line-height:1.3!important}
.fit-stage--composer .eyebrow{font-size:12px!important}
.fit-stage--composer .head-actions{
  display:flex!important;
  flex-direction:row!important;
  gap:9px!important;
  flex:none!important;
}
.fit-stage--composer .quiet{min-height:42px!important;padding:10px 14px!important;font-size:14px!important;white-space:nowrap}
.fit-stage--composer .layout{
  width:calc(100% - 32px)!important;
  height:676px!important;
  margin:0 auto!important;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 350px!important;
  gap:14px!important;
  align-items:stretch!important;
}
.fit-stage--composer .board-wrap{
  order:initial!important;
  width:auto!important;
  height:100%!important;
  max-width:100%!important;
  max-height:100%!important;
  margin:0!important;
  aspect-ratio:1450/1024!important;
  justify-self:center!important;
  align-self:center!important;
  border-radius:20px!important;
}
.fit-stage--composer .side-panel{
  order:initial!important;
  position:relative!important;
  top:auto!important;
  width:350px!important;
  height:100%!important;
  max-height:100%!important;
  min-height:0!important;
  margin:0!important;
  padding:15px!important;
  border-radius:20px!important;
  overflow:auto!important;
  overscroll-behavior:contain;
}
.fit-stage--composer .side-head h2,
.fit-stage--composer #result-panel h2{font-size:22px!important}
.fit-stage--composer .side-head p{font-size:11px!important;line-height:1.3!important;margin-bottom:9px!important}
.fit-stage--composer .category-tabs{grid-template-columns:repeat(2,1fr)!important;gap:6px!important}
.fit-stage--composer .category-tab{min-height:34px!important;padding:6px 7px!important;font-size:10px!important}
.fit-stage--composer .tray{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:7px!important;
  min-height:0!important;
}
.fit-stage--composer .portion-control{
  grid-template-columns:25px minmax(0,1fr) 25px!important;
  min-height:0!important;
  margin-top:4px!important;
  padding:3px!important;
}
.fit-stage--composer .portion-step{width:25px!important;height:25px!important;font-size:16px!important}
.fit-stage--composer .portion-control strong{font-size:8px!important}
.fit-stage--composer .mobile-place-action{
  min-height:32px!important;
  margin-top:4px!important;
  padding:5px!important;
  font-size:9px!important;
}
.fit-stage--composer .mobile-estimate{
  margin:8px 0 6px!important;
  padding:8px!important;
}
.fit-stage--composer .mobile-estimate input{min-height:38px!important;font-size:17px!important}
.fit-stage--composer .estimate-help{margin:8px 0!important;padding:8px!important}
.fit-stage--composer .primary{min-height:42px!important;padding:10px 12px!important;font-size:13px!important}
.fit-stage--composer .score-row{margin:9px 0!important}
.fit-stage--composer .score-row div{padding:8px!important}
.fit-stage--composer .learning-wrap{margin-top:10px!important}
.fit-stage--composer .breakdown{gap:5px!important;margin-top:6px!important}
.fit-stage--composer .breakdown-row{padding:7px 9px!important}
.fit-stage--composer .meal-insight{margin-top:8px!important;padding:9px!important}

/* La taille du canevas ne dépend plus des media queries du navigateur.
   Seuls les outils tactiles restent visibles sur un écran tactile. */
@media (max-width:1120px){
  .fit-stage--game .game-layout,
  .fit-stage--composer .layout{grid-template-columns:minmax(0,1fr) 350px!important}
  .fit-stage--game .game-header,
  .fit-stage--composer .page-head{flex-direction:row!important}
  .fit-stage--game .tray,
  .fit-stage--composer .tray{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media (max-width:760px){
  .fit-stage--game .game-header,
  .fit-stage--composer .page-head{flex-direction:row!important;align-items:center!important}
  .fit-stage--composer .head-actions{width:auto!important;display:flex!important}
  .fit-stage--composer .side-panel,
  .fit-stage--composer .board-wrap{width:auto!important;margin:0!important}
  .fit-stage--composer .category-tabs{grid-template-columns:repeat(2,1fr)!important}
}

@media (max-width:600px){
  .fit-controls{right:7px;bottom:7px;gap:4px;padding:5px}
  .fit-control{min-width:38px;height:38px;font-size:18px}
  .fit-control.fit-reset{min-width:76px;font-size:12px}
  .fit-zoom-label{min-width:43px;font-size:11px}
}
@media (prefers-reduced-motion:reduce){
  .fit-tip{transition:none}
}

/* Barre d'outils hors de la zone de jeu : elle ne masque plus les boutons du débrief. */
.fit-viewport{bottom:58px}

/* -------------------------------------------------
   Mise en page portrait : vrai reflow avant réduction
   ------------------------------------------------- */
.fit-stage.fit-portrait.fit-stage--game{
  width:820px!important;
  height:1280px!important;
}
.fit-stage.fit-portrait.fit-stage--game .game-header{
  width:790px!important;
  height:145px!important;
  padding:16px 4px 10px!important;
  align-items:center!important;
}
.fit-stage.fit-portrait.fit-stage--game .game-header > div:first-child{max-width:590px}
.fit-stage.fit-portrait.fit-stage--game .game-header h1{font-size:29px!important}
.fit-stage.fit-portrait.fit-stage--game .game-header p{font-size:13px!important}
.fit-stage.fit-portrait.fit-stage--game .game-header .brand-logo{width:142px!important}
.fit-stage.fit-portrait.fit-stage--game .game-layout{
  width:790px!important;
  height:1115px!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:545px 560px!important;
  gap:10px!important;
}
.fit-stage.fit-portrait.fit-stage--game .board-wrap{
  width:auto!important;
  height:545px!important;
  max-width:790px!important;
}
.fit-stage.fit-portrait.fit-stage--game .side-panel{
  width:790px!important;
  height:560px!important;
  max-height:560px!important;
  padding:16px!important;
}
.fit-stage.fit-portrait.fit-stage--game .tray{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:8px!important;
}
.fit-stage.fit-portrait.fit-stage--game .side-head h2{font-size:24px!important}
.fit-stage.fit-portrait.fit-stage--game .side-head p{font-size:13px!important}
.fit-stage.fit-portrait.fit-stage--game .levels-shell{padding:28px 26px 30px!important}
.fit-stage.fit-portrait.fit-stage--game .levels-shell .brand-logo{width:215px!important}
.fit-stage.fit-portrait.fit-stage--game .levels-shell h1{font-size:38px!important}
.fit-stage.fit-portrait.fit-stage--game .level-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(340px,1fr))!important;
  grid-auto-rows:minmax(0,1fr)!important;
  gap:13px!important;
}
.fit-stage.fit-portrait.fit-stage--game .level-card{
  width:auto!important;
  height:auto!important;
  min-height:0!important;
  padding:20px 20px 72px!important;
}
.fit-stage.fit-portrait.fit-stage--game .level-card strong{font-size:24px!important}
.fit-stage.fit-portrait.fit-stage--game .level-card span:not(.level-no):not(.level-status){font-size:13px!important}

.fit-stage.fit-portrait.fit-stage--choice{
  width:820px!important;
  height:1180px!important;
}
.fit-stage.fit-portrait.fit-stage--choice.choice-main{
  width:820px!important;
  height:1180px!important;
  padding:24px!important;
}
.fit-stage.fit-portrait.fit-stage--choice .choice-shell{
  width:770px!important;
  max-height:1130px!important;
  padding:28px!important;
}
.fit-stage.fit-portrait.fit-stage--choice .choice-logo{width:190px!important}
.fit-stage.fit-portrait.fit-stage--choice .choice-shell h1{font-size:44px!important}
.fit-stage.fit-portrait.fit-stage--choice .game-choice-grid{
  grid-template-columns:1fr!important;
  grid-template-rows:1fr 1fr!important;
  gap:16px!important;
}
.fit-stage.fit-portrait.fit-stage--choice .game-choice-card{
  min-height:0!important;
  padding:24px!important;
}

.fit-stage.fit-portrait.fit-stage--composer{
  width:820px!important;
  height:1320px!important;
}
.fit-stage.fit-portrait.fit-stage--composer .page-head{
  width:790px!important;
  height:155px!important;
  padding:14px 4px 10px!important;
}
.fit-stage.fit-portrait.fit-stage--composer .page-head > div:first-child{max-width:590px}
.fit-stage.fit-portrait.fit-stage--composer .page-head h1{font-size:29px!important}
.fit-stage.fit-portrait.fit-stage--composer .page-head p{font-size:12px!important}
.fit-stage.fit-portrait.fit-stage--composer .layout{
  width:790px!important;
  height:1145px!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:558px 577px!important;
  gap:10px!important;
}
.fit-stage.fit-portrait.fit-stage--composer .board-wrap{
  width:auto!important;
  height:558px!important;
  max-width:790px!important;
}
.fit-stage.fit-portrait.fit-stage--composer .side-panel{
  width:790px!important;
  height:577px!important;
  max-height:577px!important;
  padding:15px!important;
}
.fit-stage.fit-portrait.fit-stage--composer .tray{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:8px!important;
}
.fit-stage.fit-portrait.fit-stage--composer .category-tabs{
  grid-template-columns:repeat(4,1fr)!important;
}
.fit-stage.fit-portrait.fit-stage--composer .mobile-estimate{display:block!important}
.fit-stage.fit-portrait.fit-stage--composer .estimate-help{display:none!important}

/* V23 · commande simplifiée : seul le plein écran reste visible. */
.fit-viewport{bottom:0!important}
.fit-controls.fit-controls--fullscreen-only{
  gap:0;
  padding:4px;
}
.fit-controls.fit-controls--fullscreen-only .fit-fullscreen{
  min-width:46px;
  width:46px;
  height:46px;
  background:#0a67ad;
  color:#fff;
  font-size:22px;
  box-shadow:0 4px 12px rgba(8,75,122,.18);
}
.fit-controls.fit-controls--fullscreen-only .fit-fullscreen:hover{background:#095a97}
@media (max-width:600px){
  .fit-controls.fit-controls--fullscreen-only{right:7px;bottom:7px;padding:3px}
  .fit-controls.fit-controls--fullscreen-only .fit-fullscreen{min-width:42px;width:42px;height:42px;font-size:20px}
}
