/* Jeu : le martien qui s'habille de travers */

/* La zone à toucher : la bulle, le martien et son panier (essai du 22/10/2026) */
.martien__jeu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--espace-3);
  width: 100%;
}

.martien__vues {
  justify-content: center;
}

.martien__tete {
  display: flex;
  align-items: center;
  gap: var(--espace-3);
  width: 100%;
  max-width: 34rem;
}

.martien__bulle {
  flex: 1;
  min-width: 0;
  min-height: 3.4em;
  display: grid;
  place-items: center;
  padding: var(--espace-3) var(--espace-4);
  border-radius: var(--rayon-grand);
  background: var(--surface-2);
  font-weight: 700;
  font-size: var(--t-grand);
  line-height: 1.35;
  text-align: center;
}

/* ---------- Le martien et les places de son corps ---------- */

.martien__scene {
  position: relative;
  width: min(100%, 19rem, 38vh);
  aspect-ratio: 200 / 260;
  margin-top: var(--espace-4);
  user-select: none;
  -webkit-user-select: none;
}

.martien__corps-dessin {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 50% 50%;
  transition: transform 450ms ease-in-out;
}

.martien__corps-dessin svg,
.martien__glyphe svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* couleur fixe voulue : la peau lilas du martien, la même dans les deux thèmes */
.martien__tete,
.martien__corps,
.martien__pied,
.martien__main--droite circle,
.martien__bout {
  fill: #c4a8f5;
  stroke: var(--encre);
  stroke-width: 4;
}

.martien__antenne,
.martien__bras,
.martien__jambe {
  fill: none;
  stroke: var(--encre);
  stroke-width: 10;
  stroke-linecap: round;
}

.martien__bras,
.martien__jambe {
  stroke-width: 12;
}

/* la moufle verte : sa main gauche, toujours */
.martien__main--gauche circle {
  fill: var(--vert);
  stroke: var(--encre);
  stroke-width: 4;
}

.martien__queue {
  fill: none;
  stroke: var(--encre);
  stroke-width: 3;
  stroke-linecap: round;
}

.martien__nombril {
  fill: var(--encre);
}

/* couleur fixe voulue : les taches mauves du dos */
.martien__tache {
  fill: #9a77e0;
}

/* couleur fixe voulue : le blanc des yeux et la pupille, lisibles dans les deux thèmes */
.martien__oeil {
  fill: #ffffff;
  stroke: var(--encre);
  stroke-width: 3;
}

.martien__pupille {
  fill: #171a33;
  transition: transform 200ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.martien__bouche {
  fill: none;
  stroke: var(--encre);
  stroke-width: 4;
  stroke-linecap: round;
}

.martien__bouche-drole {
  fill: var(--encre);
  opacity: 0;
}

/* De dos, pas de visage… sauf quand il tourne la tête tout autour pour faire sa tête drôle */
.martien__visage--dos {
  opacity: 0;
}

/* La tête drôle : les yeux louchent, la bouche fait « oh », les antennes tremblent */
.martien__corps-dessin.est-drole .martien__visage--dos {
  opacity: 1;
}

.martien__corps-dessin.est-drole .martien__tache {
  opacity: 0;
}

.martien__corps-dessin.est-drole .martien__pupille--g {
  transform: translateX(7px);
}

.martien__corps-dessin.est-drole .martien__pupille--d {
  transform: translateX(-7px);
}

.martien__corps-dessin.est-drole .martien__bouche {
  opacity: 0;
}

.martien__corps-dessin.est-drole .martien__bouche-drole {
  opacity: 1;
}

.martien__corps-dessin.est-drole svg {
  animation: martien-tremble 500ms ease 2;
}

@keyframes martien-tremble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-4deg); }
  75% { transform: rotate(4deg); }
}

.martien__corps-dessin.est-content svg {
  animation: martien-saut 420ms ease-out;
}

@keyframes martien-saut {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5%); }
}

.martien__corps-dessin.est-en-fete svg {
  animation: martien-danse 700ms ease-in-out 4;
}

@keyframes martien-danse {
  0%, 100% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-6deg) translateY(-3%); }
  75% { transform: rotate(6deg) translateY(-3%); }
}

/* Il se retourne : il se tourne de côté (il s'amincit), puis réapparaît dans l'autre sens */
.martien__corps-dessin.est-en-train-de-tourner {
  transform: scaleX(0.05);
}

/* La moufle verte s'allume, pour retrouver sa gauche */
.martien__corps-dessin.est-repere .martien__main--gauche circle {
  stroke: var(--jaune);
  stroke-width: 7;
  animation: martien-clignote 600ms ease 4;
}

@keyframes martien-clignote {
  50% { stroke-width: 11; }
}

/* Les places où l'on pose : invisibles, puis en pointillés quand on tient un objet */
.martien__zones,
.martien__poses {
  position: absolute;
  inset: 0;
}

.martien__poses {
  pointer-events: none;
}

.martien__zone {
  position: absolute;
  width: 22%;
  aspect-ratio: 1;
  min-width: 48px;
  min-height: 48px;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 3px dashed transparent;
  border-radius: 50%;
  background: transparent;
  transition: border-color var(--duree), background var(--duree);
}

.martien__scene.a-un-objet .martien__zone {
  border-color: var(--trait);
}

.martien__zone:hover,
.martien__zone.est-survolee {
  border-color: var(--accent);
  border-style: solid;
}

.martien__zone.est-guidee {
  border-color: var(--jaune);
  border-style: solid;
  background: color-mix(in srgb, var(--jaune) 30%, transparent);
  animation: martien-guide 600ms ease 3;
}

@keyframes martien-guide {
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

.martien__pose {
  position: absolute;
  width: 16%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transition: left 600ms cubic-bezier(0.4, 0, 0.2, 1), top 600ms ease;
}

.martien__pose .icone,
.martien__fantome .icone {
  width: 100%;
  height: 100%;
}

/* Le dessin de la montre est tout petit dans son cadre : on le grossit */
.martien__objet--montre .icone svg {
  transform: scale(1.45);
}

/* ---------- Le panier ---------- */

.martien__panier {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--espace-3);
  min-height: 4.6rem;
  width: 100%;
  max-width: 34rem;
  padding: var(--espace-3);
  border-radius: var(--rayon-grand);
  background: var(--bois);
  box-shadow: inset 0 -6px 0 var(--bois-flanc);
}

.martien__objet {
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  padding: 0.55rem;
  border: 0;
  border-radius: var(--rayon);
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--trait), 0 2px 0 rgba(0, 0, 0, 0.12);
  touch-action: none;
  transition: transform var(--duree), box-shadow var(--duree);
}

.martien__objet .icone {
  width: 100%;
  height: 100%;
}

.martien__objet.est-choisi {
  /* le code des couleurs (22/10/2026) : ce qu'on vient de choisir porte le contour bleu */
  box-shadow: inset 0 0 0 2px var(--trait), 0 0 0 3px var(--fn-change);
  transform: translateY(-4px);
}

.martien__panier-vide {
  align-self: center;
  color: var(--bois-encre);
  font-weight: 700;
}

.martien__fantome {
  position: fixed;
  z-index: 60;
  width: 3.6rem;
  height: 3.6rem;
  transform: translate(-50%, -60%);
  pointer-events: none;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.25));
}

.martien__truc {
  display: grid;
  gap: var(--espace-4);
  width: 100%;
  max-width: 34rem;
}

/* ---------- L'affiche ---------- */

.martien__glyphe {
  display: block;
  width: 3.2rem;
  height: 4.2rem;
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .martien__zone.est-guidee {
    background: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .martien__corps-dessin {
    transition: none;
  }
  .martien__pose {
    transition: none;
  }
}

/* Au téléphone, le martien et le panier tiennent ensemble dans l'écran (essai du 22/10/2026) */
@media (max-width: 520px) {
  .martien__scene {
    width: min(100%, 15rem, 30vh);
    margin-top: var(--espace-2);
  }
  .martien__bulle {
    min-height: 2.8em;
    padding: var(--espace-2) var(--espace-3);
    font-size: 1.15rem;
  }
}
