/* =================================================================
   [MB_PATCH:JEUX_SMA_V1] — Jeux adaptés SMA / Tablette
   Cible : mots mêlés illisibles + modal trop petit sur écrans tactiles
   ================================================================= */

/* ── Modal jeux : plein écran sur SMA/TAB ── */
@media (max-width: 860px) {
  #gamesModal .mb-modal__panel {
    width:  100vw   !important;
    height: 100dvh  !important;
    max-width:  100vw !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  /* body scrollable, laisse de la place en bas pour la nav */
  #gamesModal .mb-modal__body {
    padding-bottom: 80px !important;
  }
}

/* ── Tabs : scroll horizontal fluide sur SMA ── */
@media (max-width: 600px) {
  #gamesModal .mb-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 12px;
    gap: 6px;
  }
  #gamesModal .mb-tabs::-webkit-scrollbar { display: none; }
  #gamesModal .mb-tab {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* ── Mots mêlés : grille seule en colonne, liste SOUS la grille ── */
@media (max-width: 860px) {
  /* Layout 1 colonne (la grille prend toute la largeur) */
  .mb-wordsearch {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Grille : 100% largeur, hauteur calculée par JS */
  .mb-wordsearch__grid {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Liste de mots : grille 3 colonnes compactes */
  .mb-wordsearch__side .mb-clues__list {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 5px !important;
    max-height: 150px !important;
  }

  /* Tags de mots : plus lisibles */
  .ws-word {
    font-size: 12px !important;
    padding: 6px 8px !important;
    text-align: center !important;
    border-radius: 10px !important;
  }
}

/* Portrait étroit : 2 colonnes */
@media (max-width: 420px) {
  .mb-wordsearch__side .mb-clues__list {
    grid-template-columns: repeat(2, 1fr) !important;
    max-height: 130px !important;
  }
}

/* ── Cellules : feedback tactile plus fort ── */
@media (pointer: coarse) {
  .ws-cell.is-sel {
    outline: 3px solid var(--accent, #e91e8c) !important;
    background: rgba(233,30,140,.18) !important;
  }
  .ws-cell.is-found {
    background: rgba(0,200,120,.25) !important;
    border-color: rgba(0,200,120,.55) !important;
  }

  /* Boutons d'action : zone de tap confortable */
  #wsNew, #wsReset, #wsReveal,
  #gamesModal .btn, #gamesModal .btn-pill {
    min-height: 44px !important;
    padding: 10px 16px !important;
  }
  #gamesMaxBtn, #gamesCloseBtn, #gamesAnotherBtn {
    min-height: 44px !important;
    padding: 10px 12px !important;
  }
}

/* ── 2048 : tuiles agrandies sur SMA ── */
@media (max-width: 480px) {
  .n2048-grid { gap: 6px !important; padding: 6px !important; }
  .n2048-tile { height: 62px !important; font-size: 20px !important; }
}

/* ── Memory : 3 colonnes sur SMA ── */
@media (max-width: 540px) {
  .mb-memory { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ── Quiz : boutons pleine largeur ── */
@media (max-width: 540px) {
  .mb-quiz__answers { grid-template-columns: 1fr !important; }
}

/* ── CrossMath : cellules plus hautes ── */
@media (max-width: 480px) {
  .cm-cell { height: 64px !important; }
  .cm-cell input { font-size: 26px !important; }
}

/* ── Toast jeux : centré au-dessus de la nav ── */
@media (max-width: 600px) {
  #gamesToast {
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: 80px !important;
    font-size: 14px !important;
    padding: 10px 18px !important;
  }
}
