/*
 * Fakiha, la découpe des lettres : compléments à hourouf-express.css
 * (même structure de scène, de HUD et d'écrans que Kifkif).
 */

/* ---------- Ambiance cuisine : fond crème chaud au lieu du ciel ---------- */
.hero-fakiha {
  background: linear-gradient(160deg, #fdf1e2, #f8dcc0);
}
.fakiha-fond {
  background: #f4e7d6;
}
/* Sans rangée de touches, la colonne doit prendre toute la largeur (la scène se règle en %). */
.course.fakiha {
  grid-template-columns: minmax(0, 1fr);
}
.fakiha .course-scene {
  background: #3b2616;
  border-color: #fff8ee;
  box-shadow: 0 10px 0 rgb(120 70 30 / 0.2);
}
/* En jeu, la souris devient une épée (pointe en haut à gauche = point qui tranche). */
.fakiha[data-coupe] .course-scene {
  cursor:
    url("/assets/img/fakiha-epee.png") 3 3,
    crosshair;
}
.fakiha[data-coupe] .course-scene button {
  cursor: pointer;
}

/* Astuce du premier geste, en bas de la scène */
.fakiha-astuce {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 16px;
  inline-size: fit-content;
  max-inline-size: calc(100% - 120px);
  margin: 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgb(255 253 247 / 0.94);
  color: var(--bleu);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 4px 0 rgb(0 0 0 / 0.18);
  pointer-events: none;
  animation: fakiha-astuce 1.6s ease-in-out infinite alternate;
}
@keyframes fakiha-astuce {
  to {
    translate: 0 -6px;
  }
}
.course.fakiha.plein {
  grid-template-rows: minmax(0, 1fr);
  background: #2a1a0e;
}

/* Paysage sur téléphone : pas de colonne de touches, la scène prend toute la hauteur en paysage. */
@media (orientation: landscape) and (max-height: 520px) {
  .course.fakiha {
    --taille: min(100%, calc((100vh - 24px) * 1.6));
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }
  .course.fakiha .course-scene {
    grid-row: auto;
    aspect-ratio: 16 / 10;
  }
  .course.fakiha.plein .course-scene {
    aspect-ratio: auto;
  }
  /* Écran de fin compact : le score et le record suffisent */
  .fakiha #fin-texte {
    display: none;
  }
}
@supports (height: 100svh) {
  @media (orientation: landscape) and (max-height: 520px) {
    .course.fakiha {
      --taille: min(100%, calc((100svh - 24px) * 1.6));
    }
  }
}

/* ---------- Calques au-dessus du jeu ---------- */
.fakiha-lame,
.fakiha-vignette {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
}
.fakiha-vignette {
  background: radial-gradient(ellipse at 40% 35%, rgb(0 0 0 / 0) 55%, rgb(20 8 0 / 0.45) 100%);
  transition: box-shadow 0.4s;
}
/* Ralenti : halo bleuté sur les bords */
.course-scene[data-ralenti] .fakiha-vignette {
  box-shadow: inset 0 0 70px 10px rgb(120 190 255 / 0.55);
}

/* ---------- HUD : jauge du ralenti ---------- */
.hud-bonus[data-genre="ralenti"] .bonus-icone {
  stroke: #2a77b8;
}
.hud-bonus[data-genre="ralenti"] .hud-bonus-reste {
  background: #6fb6f0;
}

@media (prefers-reduced-motion: reduce) {
  .fakiha-vignette {
    transition: none;
  }
  .fakiha-astuce {
    animation: none;
  }
}

/* Très petit écran (320 px) : la grille des niveaux tient sans défiler.
   Media query pour Safari 15 (sans container queries), container query ailleurs. */
@media (max-width: 340px) {
  .fakiha #ecran-accueil .ecran-texte {
    display: none;
  }
  .fakiha .course-ecran {
    padding-block-start: 46px;
  }
  .fakiha .grille-niveaux {
    gap: 4px;
  }
  .fakiha .niveau-lettres {
    font-size: 19px;
    white-space: nowrap;
  }
}
@container (max-width: 300px) {
  .fakiha #ecran-accueil .ecran-texte {
    display: none;
  }
  .fakiha .course-ecran {
    padding-block-start: 46px;
  }
  .fakiha .grille-niveaux {
    gap: 4px;
  }
  .fakiha .niveau-lettres {
    font-size: 19px;
    white-space: nowrap;
  }
}

/* ---------- Score : pastille dans la barre du haut, score et record en fin de partie ---------- */
.hud-score {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 3px 14px;
  border-radius: 30px;
  background: rgb(255 255 255 / 0.9);
}
.hud-score-etoile {
  color: #d9a21b;
  font-size: 18px;
  line-height: 1;
}
.hud-score .hud-compte {
  font-size: 16px;
  line-height: 30px;
}
.fin-score {
  margin: 2px 0 0;
  color: var(--bleu);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 800;
  line-height: 1;
}
.fin-score-nombre {
  font-size: 56px;
}
.fin-score-mot {
  font-size: 22px;
}
.fin-record {
  margin: 4px 0 0;
  font-weight: 700;
  color: #7a5a12;
}
.fin-record[data-nouveau] {
  color: #3e7233;
}
