/* Tuto : schema des commandes en bas de l'ecran (src/game/tuto.js).
   Il ne prend jamais le clic : la souris sert a conduire. Les couleurs
   ont leur repli, la page de creation n'ayant pas la feuille du jeu. */

.tuto {
  --t-ink: var(--ink, #f4efe2);
  --t-dim: var(--dim, #8d97ad);
  --t-violet: var(--violet, #8b5cf6);
  --t-orange: var(--orange, #f07a25);
  position: absolute;
  left: 50%;
  bottom: clamp(8px, 1.6vw, 22px);
  transform: translateX(-50%);
  /* Le compteur tient le coin bas droit : on reste entre les deux. */
  max-width: calc(100% - 2 * (clamp(190px, 17vw, 300px) + clamp(12px, 2.4vw, 40px) + 12px));
  padding: 8px 14px 10px;
  border: 1px solid #ffffff1f;
  border-radius: 14px;
  background: linear-gradient(180deg, #0b1018e6, #05080ef2);
  box-shadow: 0 12px 30px #000a;
  color: var(--t-ink);
  font-family: var(--mono, 'Space Mono', ui-monospace, monospace);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 6;
  animation: tuto-entree .5s ease-out both;
}
.tuto[hidden] { display: none; }
.tuto.fixe {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  max-width: none;
  animation: none;
}
@keyframes tuto-entree {
  from { opacity: 0; transform: translate(-50%, 12px); }
}

.tuto-titre {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 0 0 7px;
  font-size: 11px;
  color: var(--t-dim);
  white-space: nowrap;
}
.tuto-titre b {
  font-family: var(--display, 'Archivo Black', 'Arial Black', sans-serif);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--t-orange);
}

.tuto-schema {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 22px);
}
.tuto-groupe {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.tuto-groupe > span {
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
  color: var(--t-dim);
  white-space: nowrap;
}
.tuto-touches {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
}

/* Touches du clavier. */
.tuto kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid #ffffff3a;
  border-bottom-width: 3px;
  border-radius: 6px;
  background: #161d2a;
  font: 700 11px/1 var(--mono, 'Space Mono', monospace);
  color: var(--t-ink);
  transition: background .08s, border-color .08s, transform .08s;
}
.tuto kbd.large { min-width: 64px; }
.tuto-croix {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  gap: 3px;
}
.tuto-croix kbd { min-width: 0; padding: 0; }

/* Souris : chaque bouton s'allume a part. */
.tuto-souris { width: 26px; height: 36px; }
.tuto-souris path { fill: #161d2a; stroke: #ffffff4d; stroke-width: 1.5; transition: fill .08s; }
.tuto-souris path.on { fill: var(--t-orange); stroke: #ffc08a; }

/* Manette : boutons ronds, aux couleurs Xbox pour A B X Y. */
.tuto-bouton {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 2px solid #ffffff3a;
  border-radius: 999px;
  background: #161d2a;
  font: 700 11px/1 var(--mono, 'Space Mono', monospace);
  color: var(--t-ink);
  transition: background .08s, border-color .08s, transform .08s;
}
.tuto-bouton.vert { border-color: #3fbf5a; color: #7fe08f; }
.tuto-bouton.rouge { border-color: #e2493f; color: #ff8a80; }
.tuto-bouton.bleu { border-color: #3c8ce7; color: #8cc0ff; }
.tuto-bouton.jaune { border-color: #e7c23c; color: #ffe27a; }

/* Tactile : les noms des boutons de l'ecran. */
.tuto-pastille {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid #ffffff3a;
  border-radius: 8px;
  background: #161d2a;
  font: 700 10px/1 var(--mono, 'Space Mono', monospace);
  letter-spacing: .06em;
  color: var(--t-ink);
  transition: background .08s, border-color .08s;
}

/* Stick : un rond et son point, qui suit le braquage. */
.tuto-stick {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid #ffffff3a;
  border-radius: 50%;
  background: radial-gradient(circle, #1d2636, #0d121b);
  transition: border-color .08s;
}
.tuto-stick i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8d97ad;
  transition: transform .06s linear, background .08s;
}

/* Ce que le joueur tient en ce moment. */
.tuto kbd.on,
.tuto-bouton.on,
.tuto-pastille.on {
  background: var(--t-orange);
  border-color: #ffc08a;
  color: #14100a;
  transform: translateY(1px);
}
.tuto-stick.on { border-color: var(--t-orange); }
.tuto-stick.on i { background: var(--t-orange); }

/* Ecran etroit (telephone en paysage) : le terrain prend presque toute la
   hauteur, le bandeau se fait petit et se pose tout en bas. */
@media (max-height: 500px), (max-width: 760px) {
  .tuto {
    bottom: 4px;
    padding: 5px 10px 6px;
    border-radius: 10px;
    max-width: calc(100% - 24px);
  }
  .tuto-titre { margin-bottom: 4px; font-size: 9px; }
  .tuto-titre b { font-size: 10px; }
  .tuto-schema { gap: 9px; }
  .tuto-groupe { gap: 3px; }
  .tuto-groupe > span { font-size: 8px; }
  .tuto-touches { min-height: 24px; }
  .tuto kbd { min-width: 20px; height: 20px; font-size: 9px; }
  .tuto kbd.large { min-width: 46px; }
  .tuto-croix { grid-template-columns: repeat(3, 20px); gap: 2px; }
  .tuto-souris { width: 20px; height: 28px; }
  .tuto-bouton { min-width: 24px; height: 24px; font-size: 9px; }
  .tuto-pastille { min-width: 34px; height: 20px; font-size: 8px; }
  .tuto-stick { width: 24px; height: 24px; }
  .tuto-stick i { width: 10px; height: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tuto { animation: none; }
}
