/* =========================================================
   MOJET.CSS — VERSION RESPONSIVE
   Téléphone / tablette / PC
   Les classes et noms utilisés par l'application sont conservés.
   ========================================================= */

/* ===================== GLOBAL ===================== */

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #0b4f63;
  font-family: Arial, Helvetica, sans-serif;
  color: white;
  overflow: hidden;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ===================== CONTENEUR ===================== */

.game {
  width: min(100%, 480px);
  max-width: 480px;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: 0 clamp(8px, 2vw, 16px);
  display: flex;
  flex-direction: column;
}

/* ===================== ZONE CENTRALE ===================== */

.center {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 3vh, 30px);
  width: 100%;
  overflow: hidden;
}

.center.actif {
  display: flex;
}

/* ===================== LOGO ===================== */

.logo {
  text-align: center;
  margin-top: clamp(8px, 4vh, 32px);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.logo-row {
  display: flex;
  justify-content: center;
  gap: clamp(3px, 1vw, 6px);
}

.logo-sub {
  line-height: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 2vw, 8px);
  margin-top: clamp(8px, 2vh, 20px);
  font-size: clamp(9px, 2.5vw, 12px);
  letter-spacing: clamp(1px, 0.5vw, 2px);
}

/* ===================== TEXTE LOGO ===================== */

.logo-text {
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 500;
}

.logo-retour {
  margin-right: clamp(10px, 6vw, 30px);
  font-size: clamp(18px, 5vw, 22px);
  cursor: pointer;
}

/* ===================== TILES DU LOGO ===================== */

.tile {
  margin: 0;
  width: clamp(25px, 7vw, 32px);
  height: clamp(25px, 7vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 900;
  border-radius: 4px;
  flex-shrink: 0;
}

.red {
  background: #e53935;
}

.blue {
  background: #124d5b;
}

.yellow {
  background: #fbc02d;
  color: #000;
}

.round {
  border-radius: 50%;
}

/* ===================== CHOIX ===================== */

.button {
  width: min(80%, 240px);
  min-width: 160px;
  height: clamp(46px, 8vh, 56px);
  min-height: 44px;
  padding: 0 clamp(12px, 4vw, 18px);
  margin: 0 auto;
  border-radius: 12px;
  background: #fff;
  color: #0e3c4c;
  font-size: clamp(13px, 3.5vw, 14px);
  font-weight: 700;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.button:hover {
  cursor: pointer;
}

/* ===================== MESSAGE ===================== */

.Aff-message {
  text-align: center;
  font-size: clamp(15px, 4vw, 18px);
  font-weight: bold;
  margin-bottom: clamp(6px, 2vh, 12px);
  display: none;
  max-width: 100%;
}

/* ===================== GRILLE ===================== */

/*
   --taille peut toujours être défini par le JavaScript.
   Si --taille n'est pas défini, une valeur responsive est utilisée.
*/

.grid {
  display: grid;
  gap: 0;
  margin-bottom: clamp(8px, 3vh, 20px);
  max-width: 100%;
  min-width: 0;
}

.row {
  display: grid;
  grid-template-columns:
    repeat(
      var(--letters),
      min(
        calc(var(--taille, 42) * 1px),
        calc((100vw - 32px) / max(var(--letters), 1))
      )
    );
  max-width: 100%;
  border: 1px solid white;
}

.cell {
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 5vw, 24px);
  font-weight: bold;
  border: 1px solid white;
  overflow: hidden;
}

.cell.saisie {
  background: #4FA0A1;
}

.cell.vierge {
  background: #0b4f63;
}

.cell.correct {
  background: #d32f2f;
}

.cell.present {
  background: #fbc02d;
}

/* ===================== CLAVIER ===================== */

.keyboard {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  padding: clamp(3px, 1.5vw, 8px);
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.row-keys {
  display: flex;
  justify-content: center;
  gap: clamp(2px, 1.2vw, 6px);
  margin-bottom: clamp(3px, 1.2vw, 6px);
  width: 100%;
}

.key {
  width: clamp(22px, 7vw, 28px);
  height: clamp(36px, 9vh, 42px);
  min-width: 0;
  min-height: 34px;
  padding: 0;
  border: 2px solid white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 5vw, 22px);
  font-weight: bold;
  flex: 0 1 auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.key.large {
  flex: 1 1 0;
  min-width: 0;
}

.key.present {
  background: #fbc02d;
  color: white;
}

.key:hover {
  background: #1F7B7A;
  cursor: pointer;
}

.key.correct {
  background: #d32f2f;
  color: white;
}

.key.absent {
  color: #7f8c8d;
  border-color: #7f8c8d;
}

/* ===================== MODALES ===================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  margin: 0;
  padding: clamp(10px, 4vw, 24px);
  display: none;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.modal > div {
  width: min(92vw, 420px);
  max-height: 90dvh;
  overflow-y: auto;
  background: #0b4f63;
  color: white;
  padding: clamp(18px, 5vw, 30px);
  border-radius: 12px;
  text-align: center;
  border: 2px solid white;
}

.modal.active {
  display: flex;
  pointer-events: auto;
}

#settingsModal .info,
#viewSuiteModal .info {
  margin: 2px 0;
  font-size: clamp(0.8rem, 2.8vw, 0.9rem);
}

.difficulty button {
  flex: 1 1 0;
  min-height: 42px;
  border-radius: 12px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  background: #124d5b;
  color: white;
}

.difficulty button.active {
  background: #fbc02d;
  color: black;
}

.close-btn,
.TV-btn {
  width: min(150px, 70%);
  min-height: 42px;
  margin: 15px auto 0;
  display: block;
}

/* ===================== ELEMENTS CACHÉS ===================== */

.dico {
  display: none;
}

canevas {
  display: none;
}

/* ===================== FEUX D'ARTIFICE ===================== */

#fireworks {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ===================== STYLES MEMO ===================== */

.Memo_titre {
  text-align: center;
  font-size: clamp(16px, 4vw, 18px);
  font-weight: bold;
  margin-bottom: clamp(8px, 3vw, 15px);
}

.Memo_logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 5px;
  gap: clamp(5px, 2vw, 10px);
}

/* =========================================================
   PETITS TÉLÉPHONES
   ========================================================= */

@media (max-width: 360px) {
  .game {
    padding-left: 4px;
    padding-right: 4px;
  }

  .center {
    gap: 8px;
  }

  .logo {
    margin-top: 5px;
  }

  .keyboard {
    padding: 2px;
  }

  .row-keys {
    gap: 2px;
    margin-bottom: 2px;
  }

  .key {
    height: 35px;
    min-height: 32px;
    border-width: 1px;
    border-radius: 4px;
    font-size: 17px;
  }

  .cell {
    font-size: 17px;
  }

  .button {
    min-width: 145px;
  }
}

/* =========================================================
   TÉLÉPHONES EN MODE PAYSAGE
   ========================================================= */

@media (max-height: 500px) and (orientation: landscape) {
  .game {
    width: min(100%, 700px);
    max-width: 700px;
  }

  .center {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: clamp(12px, 3vw, 30px);
  }

  .logo {
    margin-top: 3px;
  }

  .logo-sub {
    margin-top: 4px;
  }

  .keyboard {
    max-width: 55%;
  }

  .key {
    height: clamp(30px, 11vh, 38px);
  }

  .cell {
    font-size: clamp(15px, 4vw, 22px);
  }
}

/* =========================================================
   TABLETTES
   ========================================================= */

@media (min-width: 600px) {
  .game {
    max-width: 560px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .cell {
    font-size: 25px;
  }

  .key {
    width: 34px;
    height: 46px;
    font-size: 23px;
  }

  .keyboard {
    padding: 10px;
  }
}

/* =========================================================
   GRANDES TABLETTES / PETITS PC
   ========================================================= */

@media (min-width: 768px) {
  .game {
    max-width: 600px;
  }

  .center {
    gap: 24px;
  }

  .keyboard {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }

  .key {
    width: 38px;
    height: 48px;
    font-size: 24px;
  }
}

/* =========================================================
   PC
   ========================================================= */

@media (min-width: 1024px) {
  .game {
    max-width: 620px;
  }

  .key {
    width: 40px;
    height: 50px;
    font-size: 24px;
  }

  .cell {
    font-size: 25px;
  }
}

/* =========================================================
   ÉCRANS PC TRÈS HAUTS
   ========================================================= */

@media (min-width: 1024px) and (min-height: 800px) {
  .center {
    gap: 30px;
  }

  .logo {
    margin-top: 25px;
  }

  .key {
    height: 50px;
  }
}
