/* intrus.css — styles communs pour toutes les pages "Intrus"
   - gère portrait / paysage
   - bouton "Rejouer" à droite, centré verticalement
   - animations (avec fallback prefers-reduced-motion)
*/

/* ---------------- TITRE ---------------- */

.intrus-title {
  margin: 16px 0 8px 0;
  text-align: center;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
}

.intrus-title .art-title { color: #dc3545; }
.intrus-title .instruction { color: #000; font-weight: 500; }

.instruction-scroll {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  max-width: 100%;
}

.instruction-slide-in {
  display: inline-block;
  transform: translateX(-110%);
  opacity: 0;
  animation: slideInKeep 1.6s ease-out forwards;
}

@keyframes slideInKeep {
  0%   { transform: translateX(-110%); opacity: 0; }
  100% { transform: translateX(0%);    opacity: 1; }
}

/* ---------------- CONTENEUR JEU ---------------- */

.intrus-wrap {
  position: relative;
  max-width: 540px;
  margin: 8px auto 0 auto;
  user-select: none;
  -webkit-user-select: none;

  /* place à droite pour le bouton */
  padding-right: 86px;
}

/* ---------------- IMAGE ---------------- */

.intrus-img {
  display: block;
  margin: 0 auto;
  border-radius: 6px;
  -webkit-user-drag: none;
  touch-action: none;
  background: #fff;

  /* coordonnées unifiées */
  object-fit: contain;
  object-position: center;

  /* dimensions pilotées par variables */
  width: var(--intrus-img-width, 100%);
  height: var(--intrus-img-height, auto);

  /* empêche l'image portrait de descendre trop bas */
  max-height: calc(100vh - 220px);
}

/* ---------------- FORMATS ---------------- */

.intrus-wrap.landscape {
  --intrus-img-width: 100%;
  --intrus-img-height: auto;
}

.intrus-wrap.portrait {
  --intrus-img-width: 84%;
  /* hauteur adaptative, sans casser hotspots */
  --intrus-img-height: clamp(300px, 55vh, 450px);
}

/* ---------------- ZONES TEXTE ---------------- */

.msg-zone {
  max-width: 540px;
  margin: 2px auto 0 auto;
  text-align: center;
  font-weight: 600;
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
}

.note-zone {
  max-width: 540px;
  margin: 0 auto;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  min-height: 1.35em;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.25;
}

.note-black { color: #000; }
.note-red   { color: #dc3545; }

/* ---------------- INDICE ---------------- */

.hint-label {
  color: #dc3545;
  font-weight: 900;
  animation: blinkHint 1s infinite;
  margin-right: 4px;
}

@keyframes blinkHint {
  0%   { opacity: .2; }
  50%  { opacity: 1; }
  100% { opacity: .2; }
}

/* ---------------- SLIDE-IN ---------------- */

.slide-in {
  display: inline-block;
  transform: translateX(-110%);
  opacity: 0;
  animation: slideInKeep 1.6s ease-out forwards;
}

/* ---------------- SOLUTION ---------------- */

.intrus-solution {
  position: absolute;
  display: none;
  z-index: 12;
  pointer-events: none;
}

.intrus-solution--box {
  border: 4px solid #dc3545;
  border-radius: 10px;
  box-shadow: 0 0 0 6px rgba(220,53,69,.18);
  animation: blinkBox .8s infinite;
}

@keyframes blinkBox {
  0%   { opacity: .15; transform: scale(0.98); }
  50%  { opacity: 1;   transform: scale(1.02); }
  100% { opacity: .15; transform: scale(0.98); }
}

.intrus-solution--ring {
  border: 4px solid #ffd800;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(255,216,0,0.25);
  animation: blinkRing .8s infinite;
}

@keyframes blinkRing {
  0%   { opacity:.15; transform:scale(.92); }
  50%  { opacity:1;   transform:scale(1.08); }
  100% { opacity:.15; transform:scale(.92); }
}

/* ---------------- BRAVO ---------------- */

.bravo-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.15);
  pointer-events: none;
  z-index: 15;
  border-radius: 6px;
}

/* Desktop/tablette : beaucoup plus discret */
.bravo-overlay span {
  font-size: 28px;                 /* ⬅ fortement réduit */
  font-weight: 900;
  color: #dc3545;
  background: rgba(255,255,255,.70); /* ⬅ masque moins le tableau */
  padding: 4px 10px;               /* ⬅ compact */
  border-radius: 6px;
}

/* ---------------- BOUTON REJOUER ---------------- */

.replay-btn {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);

  background: rgba(255,255,255,.95);
  color: #dc3545;
  border: 2px solid #dc3545;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;

  display: none;
  z-index: 20;
  white-space: nowrap;
}

.replay-btn:hover {
  background: #dc3545;
  color: #fff;
}

/* ---------------- MOBILE ---------------- */

@media (max-width: 576px) {
  .intrus-wrap { padding-right: 0; }

  .intrus-wrap.portrait {
    --intrus-img-width: 92%;
    --intrus-img-height: clamp(260px, 50vh, 380px);
  }

  .intrus-img {
    max-height: calc(100vh - 240px);
  }

  /* Mobile : BRAVO ! au minimum confortable */
  .bravo-overlay span {
    font-size: 22px;                 /* ⬅ très petit */
    padding: 3px 8px;                /* ⬅ très compact */
    border-radius: 5px;
    background: rgba(255,255,255,.65);
  }

  .replay-btn {
    position: static;
    transform: none;
    margin: 8px auto 0 auto;
    display: none;
  }

  .intrus-wrap .replay-btn[style*="display: block"] {
    display: block !important;
    width: fit-content;
  }
}

/* Très petits écrans : encore plus discret */
@media (max-width: 360px) {
  .bravo-overlay span {
    font-size: 20px;
    padding: 2px 7px;
    background: rgba(255,255,255,.60);
  }
}

/* ---------------- ACCESSIBILITÉ ---------------- */

@media (prefers-reduced-motion: reduce) {
  .instruction-slide-in,
  .slide-in,
  .hint-label {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
