/* Styles spécifiques à Malvoisin, sans toucher au body ni aux titres du site */
.mv-site {
  --douve: #0e1a1b;
  --douve2: #173032;
  --parch: #e6d5ad;
  --parch2: #c9b48a;
  --encre: #2a1a10;
  --chand: #f2b544;
  --vin: #7d1f2c;
  --fd: "Pirata One", "Old English Text MT", Georgia, serif;
  /* Taille des textes : un peu plus grands en plein écran */
  --k: 1;
  --fb: "IM Fell English", Garamond, "Times New Roman", Georgia, serif;
  /* Barre commune (css/games.css) aux couleurs du château */
  --mg-jeu-largeur: 1100px;
  --mgb-fond: linear-gradient(120deg, #05090a, #173032);
  --mgb-texte: var(--parch);
  --mgb-doux: var(--parch2);
  --mgb-accent: var(--chand);
  --mgb-titre: linear-gradient(100deg, var(--chand), var(--parch));
  --mgb-police-titre: var(--fd);
  --mgb-filet: rgba(230, 213, 173, 0.18);
  --mgb-ombre: none;
  --mg-fs-fond: var(--douve) radial-gradient(ellipse 90% 60% at 50% 0%, var(--douve2), var(--douve));
  --mg-bulle-fond: #05090a;
}
.mv-root {
  position: relative;
  width: 100%;
  margin: 0 auto 32px auto;
  padding: 12px 12px 16px 12px;
  background: var(--douve)
    radial-gradient(ellipse 90% 60% at 50% 0%, var(--douve2), var(--douve));
  border-radius: 20px;
  box-shadow: 0 10px 30px #0004;
  color: var(--parch);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Le site impose une police à tous les éléments : on reprend la main */
.mv-root,
.mv-root *,
.mv-site .mv-roomname {
  font-family: var(--fb);
  box-sizing: border-box;
}
.mv-root text {
  font-family: var(--fd);
}
.mv-root text.fb {
  font-family: var(--fb);
}

.mv-root [hidden] {
  display: none !important;
}
.mv-root b {
  color: inherit;
}
.mv-root kbd,
.mv-root kbd:hover {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: inherit;
}
.mv-root button {
  font-size: inherit;
  color: inherit;
}
.mv-root :focus-visible {
  outline: 2px solid var(--chand);
  outline-offset: 2px;
}

/* ---------- Plein écran ---------- */
.mv-site.mg-fs {
  --k: 1.2;
}
.mv-site.mg-fs .mv-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
}
.mv-site.mg-fs .mv-app {
  /* largeur maximale calculée par game.js (ajuster) pour tenir en hauteur */
  width: 100%;
  margin: auto;
}

/* Barre commune, au-dessus du cadre du jeu */
.mv-site > .mg-barre {
  border: 1px solid #35504f;
}
/* Écran titre : pas encore de salle, pas de filet après le titre */
.mv-site .mg-barre:has(.mv-roomname:empty) .mg-barre-titre {
  border-right: none;
}

/* ---------- Mise en page ---------- */
.mv-app {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mv-topbar {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}
.mv-roomname {
  font-style: italic;
  color: var(--parch2);
  font-size: calc(21px * var(--k));
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mv-root .tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mv-root .tb {
  font-family: var(--fd);
  font-size: calc(18px * var(--k));
  line-height: 1.2;
  background: transparent;
  border: 1px solid #35504f;
  color: var(--parch);
  padding: 3px 12px 4px;
  border-radius: 3px;
  cursor: pointer;
}
.mv-root .tb:hover {
  border-color: var(--chand);
  color: var(--chand);
}
.mv-root .tb kbd {
  font-family: var(--fb);
  font-size: calc(12px * var(--k));
  opacity: 0.55;
  margin-left: 5px;
}
.mv-root .tb[aria-pressed="true"]#mv-instinct {
  background: rgba(242, 181, 68, 0.15);
  border-color: var(--chand);
}

/* Écran large mais bas : panneau à droite de la scène (choisi par game.js) */
.mv-root.lateral .mv-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(250px * var(--k));
  column-gap: 12px;
  row-gap: 8px;
  align-items: start;
}
.mv-root.lateral .mv-topbar {
  grid-column: 1 / -1;
}
.mv-root.lateral .mv-stagewrap {
  grid-column: 1;
  grid-row: 2;
}
.mv-root.lateral #mv-sentence {
  grid-column: 1;
  grid-row: 3;
}
.mv-root.lateral .mv-panel {
  grid-column: 2;
  grid-row: 2 / 4;
  align-self: stretch;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
}
.mv-root.lateral #mv-inv {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ---------- Scène ---------- */
.mv-stagewrap {
  position: relative;
}
.mv-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
  box-shadow:
    0 0 0 2px #2c1c12,
    0 0 0 7px #120c08,
    0 24px 60px rgba(0, 0, 0, 0.65);
  cursor: crosshair;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
#mv-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#mv-scene [data-hs] {
  cursor: pointer;
}
#mv-scene [data-hs].hl {
  filter: brightness(1.32) drop-shadow(0 0 7px rgba(255, 214, 140, 0.55));
}
#mv-dark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
  background: radial-gradient(
    circle var(--r, 200px) at var(--x, 50%) var(--y, 50%),
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 38%,
    rgba(5, 3, 2, var(--a, 0.9)) 100%
  );
}
#mv-dark.struck {
  opacity: 0.08 !important;
  transition: none;
}
#mv-flash {
  position: absolute;
  inset: 0;
  background: #dfe8ff;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
#mv-flash.go {
  animation: mv-flash 0.55s ease-out;
}
@keyframes mv-flash {
  0% {
    opacity: 0.75;
  }
  12% {
    opacity: 0.1;
  }
  22% {
    opacity: 0.55;
  }
  100% {
    opacity: 0;
  }
}
#mv-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#mv-fade.on {
  opacity: 1;
}
/* Fin de partie : obscurcissement lent avant l'écran de fin */
#mv-fade.lent {
  transition: opacity 2.2s ease-in;
}
#mv-roomcard {
  position: absolute;
  bottom: 7%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--fd);
  font-size: calc(clamp(28px, 4.4vw, 56px) * var(--k));
  color: var(--parch);
  text-shadow:
    0 2px 14px #000,
    0 0 30px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s;
}
#mv-roomcard.on {
  opacity: 1;
}
#mv-tip {
  position: absolute;
  pointer-events: none;
  font-family: var(--fd);
  font-size: calc(clamp(14px, 1.6vw, 19px) * var(--k));
  color: var(--parch);
  text-shadow:
    0 1px 4px #000,
    0 0 10px #000;
  transform: translate(14px, -120%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s;
}
#mv-tip.on {
  opacity: 1;
}
#mv-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mv-root .mk {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  animation: mv-mkIn 0.25s ease-out;
}
.mv-root .mk span {
  width: calc(30px * var(--k));
  height: calc(30px * var(--k));
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--chand);
  color: var(--encre);
  border: 2px solid #fff3d0;
  box-shadow: 0 0 16px rgba(242, 181, 68, 0.85);
  font-size: calc(16px * var(--k));
}
.mv-root .mk em {
  font-style: normal;
  font-family: var(--fd);
  font-size: calc(15px * var(--k));
  color: var(--parch);
  text-shadow:
    0 1px 3px #000,
    0 0 8px #000;
  white-space: nowrap;
}
@keyframes mv-mkIn {
  from {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }
}

/* ---------- Bulle de dialogue ---------- */
#mv-speech {
  position: absolute;
  left: 50%;
  top: 3%;
  z-index: 2;
  transform: translateX(-50%);
  width: min(88%, 860px);
  padding: 10px 20px 13px;
  background: linear-gradient(rgba(12, 9, 7, 0.9), rgba(12, 9, 7, 0.8));
  border: 1px solid rgba(242, 181, 68, 0.3);
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
  font-size: calc(clamp(15px, 1.85vw, 22px) * var(--k));
  line-height: 1.42;
}
#mv-speech.on {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}
#mv-speech .who {
  font-family: var(--fd);
  font-size: 0.95em;
  line-height: 1.1;
  color: var(--chand);
}
#mv-speech .who:empty {
  display: none;
}
#mv-speech[data-who="barnabe"] .who {
  color: #c3cdd2;
}
#mv-speech[data-who="garde"] .who {
  color: #e48f6c;
}
#mv-speech[data-who="corbeau"] .who {
  color: #a9b6ff;
}
#mv-speech[data-who="voix"] .who {
  color: #b8c79a;
}
#mv-speech[data-who="narr"] .line {
  font-style: italic;
  text-align: center;
}

/* ---------- Phrase d'action ---------- */
#mv-sentence {
  min-height: 30px;
  /* une seule ligne : la hauteur du jeu ne varie pas */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  font-family: var(--fd);
  font-size: calc(23px * var(--k));
  color: var(--parch2);
  line-height: 1.2;
}
#mv-sentence b {
  font-family: var(--fd);
  font-weight: 400;
  color: var(--chand);
}
#mv-sentence .dim {
  font-style: italic;
  font-size: calc(17px * var(--k));
  opacity: 0.6;
}

/* ---------- Panneau : portrait, besace ---------- */
.mv-panel {
  display: grid;
  align-items: center;
  grid-template-columns: calc(110px * var(--k)) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(
      92deg,
      rgba(0, 0, 0, 0.08) 0 3px,
      transparent 3px 11px
    ),
    linear-gradient(180deg, #432a1a, #26170d);
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 160, 0.08),
    inset 0 -8px 14px rgba(0, 0, 0, 0.45),
    0 12px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Répliques d'un dialogue, en bas de la scène ---------- */
.mv-dlg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  max-height: 55%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 26px 4% 12px;
  background: linear-gradient(rgba(10, 7, 5, 0), rgba(10, 7, 5, 0.86) 26px, rgba(10, 7, 5, 0.94));
  cursor: default;
}
.mv-root .opt {
  font-size: calc(clamp(15px, 1.7vw, 20px) * var(--k));
  text-align: left;
  color: var(--parch);
  background: none;
  border: 0;
  padding: 4px 10px;
  cursor: pointer;
  line-height: 1.25;
  border-radius: 2px;
  text-shadow: 0 1px 3px #000;
}
.mv-root .opt::before {
  content: "❧ ";
  color: var(--chand);
}
.mv-root .opt:hover,
.mv-root .opt:focus-visible {
  color: var(--chand);
  background: rgba(242, 181, 68, 0.1);
}
#mv-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: radial-gradient(circle at 50% 38%, #5a3a24, #1a0f08 75%);
  border-radius: 60px 60px 6px 6px;
  border: 2px solid #6b4a2a;
  padding: 8px 4px;
}
#mv-portrait svg {
  width: calc(72px * var(--k));
  height: calc(72px * var(--k));
}
#mv-portrait .pn {
  font-family: var(--fd);
  font-size: calc(17px * var(--k));
  color: var(--parch);
  text-align: center;
  line-height: 1;
}
#mv-portrait .mouth {
  transform-box: fill-box;
  transform-origin: center;
}
#mv-portrait.talking .mouth {
  animation: mv-talk 0.14s infinite alternate;
}
@keyframes mv-talk {
  to {
    transform: scaleY(2.4);
  }
}
#mv-inv {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, calc(64px * var(--k))));
  justify-content: center;
  gap: 6px;
  align-content: center;
  background: #2a1a10;
  padding: 8px;
  border-radius: 5px;
  outline: 2px dashed #6b4a2a;
  outline-offset: -5px;
}
.mv-root .slot {
  aspect-ratio: 1;
  background: radial-gradient(circle, #4c321f, #2a180c);
  border: 1px solid #5c3d22;
  border-radius: 4px;
  display: grid;
  place-items: center;
  padding: 4px;
  min-width: 0;
}
.mv-root button.slot {
  cursor: pointer;
}
.mv-root button.slot:hover {
  border-color: var(--chand);
}
.mv-root .slot svg {
  width: 82%;
  height: 82%;
}
.mv-root .slot.pend {
  border-color: var(--chand);
  box-shadow:
    0 0 0 2px var(--chand),
    0 0 18px rgba(242, 181, 68, 0.5);
}
.mv-root .slot.new {
  animation: mv-pop 0.7s ease-out;
}
@keyframes mv-pop {
  0% {
    transform: scale(0.4);
    box-shadow: 0 0 30px var(--chand);
  }
  60% {
    transform: scale(1.15);
  }
}

/* ---------- Fenêtres (dans le cadre du jeu, pour le plein écran) ---------- */
.mv-root .overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(4, 8, 8, 0.8);
  padding: 16px;
  overflow: auto;
}
.mv-root .sheet {
  position: relative;
  max-width: 660px;
  width: 100%;
  max-height: 100%;
  overflow: auto;
  background: var(--parch);
  color: var(--encre);
  padding: 30px 34px 26px;
  border-radius: 2px;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.7),
    inset 0 0 70px rgba(120, 80, 30, 0.55);
}
.mv-root .sheet h2 {
  font-family: var(--fd);
  font-weight: 400;
  font-size: calc(34px * var(--k));
  margin: 0 0 12px;
  color: var(--vin);
  line-height: 1.05;
}
.mv-root .sheet p {
  font-size: calc(19px * var(--k));
  line-height: 1.55;
  margin: 0 0 12px;
  max-width: 62ch;
}
.mv-root .sheet .close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--fd);
  font-size: calc(18px * var(--k));
  background: none;
  border: 1px solid rgba(42, 26, 16, 0.35);
  color: var(--encre);
  padding: 2px 10px;
  border-radius: 2px;
  cursor: pointer;
}
.mv-root .sheet .close:hover {
  color: var(--vin);
  border-color: var(--vin);
}
.mv-root .sheet .sig {
  text-align: right;
  font-style: italic;
}
.mv-root .sheet .note {
  font-style: italic;
  opacity: 0.75;
}
.mv-root .sheet.stone {
  background: #4a443d;
  color: #d8cfbf;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.7),
    inset 0 0 80px rgba(0, 0, 0, 0.6);
}
.mv-root .sheet.stone h2 {
  color: #e9dcc0;
}
.mv-root .sheet.stone p {
  font-family: var(--fd);
  font-size: calc(24px * var(--k));
  letter-spacing: 0.02em;
  line-height: 1.35;
}
.mv-root .sheet.stone p.tally {
  font-family: var(--fb);
  font-size: calc(22px * var(--k));
  letter-spacing: 0.12em;
  opacity: 0.8;
}
.mv-root .sheet.stone p.tally s {
  font-family: var(--fb);
}

.mv-root .btn {
  font-family: var(--fd);
  font-size: calc(22px * var(--k));
  background: var(--vin);
  color: var(--parch);
  border: 0;
  padding: 8px 22px 10px;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 3px 0 #3e0d15;
}
.mv-root .btn:hover {
  background: #952636;
}
.mv-root .btn.ghost {
  background: transparent;
  color: var(--parch);
  box-shadow: inset 0 0 0 1px var(--parch2);
}
.mv-root .btn.ghost:hover {
  background: rgba(230, 213, 173, 0.1);
}
.mv-root .sheet .btn.ghost {
  color: var(--encre);
  box-shadow: inset 0 0 0 1px rgba(42, 26, 16, 0.5);
}
.mv-root .sheet .btn.ghost:hover {
  background: rgba(125, 31, 44, 0.1);
  color: var(--vin);
}

/* Confirmation */
.mv-root .mv-confirm {
  z-index: 60;
}
.mv-root .mv-confirm .sheet {
  max-width: 480px;
  text-align: center;
}
.mv-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

/* Crochetage */
.mv-root .lp-lock {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 18px auto 14px;
  padding: 22px 26px 18px;
  width: max-content;
  max-width: 100%;
  background: linear-gradient(#b8892e, #7a5718);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 3px #4a330c,
    inset 0 8px 18px rgba(255, 240, 190, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.35);
}
.mv-root .lp-lock.shake {
  animation: mv-shake 0.3s;
}
@keyframes mv-shake {
  25% {
    transform: translateX(-7px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-3px);
  }
}
.mv-root .lp-slot {
  position: relative;
  width: 34px;
  height: 150px;
  background: #1d1408;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 8px #000;
}
.mv-root .lp-pin {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 22px;
  height: 54px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(90deg, #8d8f95, #e3e5ea, #8d8f95);
}
.mv-root .lp-pin.act {
  background: linear-gradient(90deg, #c08a1a, #ffe28a, #c08a1a);
  box-shadow: 0 0 12px rgba(255, 210, 100, 0.7);
}
.mv-root .lp-pin.set {
  background: linear-gradient(90deg, #4f7a3c, #a8d88a, #4f7a3c);
}
.mv-root .lp-line {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 43px;
  height: 3px;
  background: #ffd25a;
  box-shadow: 0 0 8px #ffd25a;
  pointer-events: none;
}
.mv-root .lp-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Étagère */
.mv-root .shelf {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  /* marge en haut : un livre tiré monte de 30 px en penchant, sans faire déborder */
  padding: 44px 14px 0;
  margin: 14px 0 4px;
  min-height: 280px;
  background: linear-gradient(#2a1a10, #1a0f08);
  border-bottom: 16px solid #4a2e1a;
  border-radius: 3px;
  overflow-x: auto;
  overflow-y: hidden;
}
.mv-root .book {
  flex: 0 0 auto;
  width: 52px;
  height: var(--h);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  background:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.35),
      rgba(255, 255, 255, 0.12) 40%,
      rgba(0, 0, 0, 0.3)
    ),
    var(--c);
  color: #f0d68a;
  border: 0;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
  box-shadow:
    inset 0 10px 0 -6px rgba(240, 214, 138, 0.5),
    inset 0 -14px 0 -10px rgba(240, 214, 138, 0.5);
}
.mv-root .book:hover {
  transform: translateY(-6px);
}
.mv-root .book.pulled {
  transform: translateY(-30px) rotate(-4deg);
}
.mv-root .book .emb svg {
  width: 28px;
  height: 28px;
}
/* Titre sur la tranche : texte horizontal tourné d'un quart de tour (lu de bas
   en haut), sur deux lignes si besoin. writing-mode déformait les apostrophes. */
.mv-root .book .bt-zone {
  position: relative;
  flex: 1;
  align-self: stretch;
  min-height: 0;
}
.mv-root .book .bt {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--h) - 62px);
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: calc(13px * var(--k));
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: normal;
}
#mv-books-msg {
  min-height: 26px;
  font-style: italic;
}

/* Carte */
/* La fiche de la carte occupe la hauteur du jeu ; le plan prend la place restante */
.mv-root .sheet.carte {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 22px;
  padding-bottom: 16px;
}
.mv-root .sheet.carte #mv-mbody {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mv-root .map {
  flex: 1;
  min-height: 0;
}
.mv-root .map svg {
  width: 100%;
  height: 100%;
  display: block;
}
.mv-root .map .room {
  cursor: pointer;
}
.mv-root .map .room:hover rect {
  stroke: var(--vin);
  stroke-width: 3;
}

/* ---------- Écran titre et fin ---------- */
.mv-root .mv-title {
  background: #05090a;
  padding: 0;
  display: block;
}
.mv-root .title-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  /* le titre se dimensionne sur la place disponible (unités cqw / cqh) */
  container-type: size;
}
.mv-root .title-wrap > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mv-root .title-card {
  position: relative;
  text-align: center;
  padding: 16px 24px;
  max-width: 720px;
  margin-top: -4cqh;
}
.mv-root .title-card .mv-logo {
  font-family: var(--fd);
  font-weight: 400;
  font-size: clamp(44px, min(15cqw, 24cqh), 150px);
  line-height: 0.9;
  margin: 0;
  color: var(--parch);
  text-shadow:
    0 0 1px #fff3d0,
    0 0 30px rgba(242, 181, 68, 0.35),
    0 6px 0 #1b0c06,
    0 10px 30px #000;
  animation: mv-candle 3.4s ease-in-out infinite;
}
@keyframes mv-candle {
  50% {
    text-shadow:
      0 0 1px #fff3d0,
      0 0 46px rgba(242, 181, 68, 0.55),
      0 6px 0 #1b0c06,
      0 10px 30px #000;
  }
}
.mv-root .title-card .sub {
  font-style: italic;
  font-size: clamp(16px, min(2.6cqw, 4.4cqh), 24px);
  color: var(--parch2);
  margin: 1.5cqh 0 4cqh;
}
.mv-root .title-card .row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.mv-root .how {
  margin: 4cqh auto 0;
  font-size: calc(16px * var(--k));
  line-height: 1.6;
  color: var(--parch2);
  max-width: 46ch;
}
.mv-root .how kbd {
  font-family: var(--fd);
  color: var(--parch);
  font-size: calc(17px * var(--k));
}
/* Écran final : textes et marges proportionnels à la hauteur du jeu (cqh),
   sans dépasser leur taille normale, pour tout voir sans défilement */
.mv-root .mv-ending {
  background: rgba(4, 8, 8, 0.92);
  container-type: size;
}
.mv-root .end {
  max-width: 600px;
  text-align: center;
  padding: 1.5cqh 24px;
}
.mv-root .end h2 {
  font-family: var(--fd);
  font-weight: 400;
  font-size: clamp(34px, 13cqh, calc(110px * var(--k)));
  margin: 0;
  line-height: 1;
  color: var(--parch);
  text-shadow: 0 0 40px rgba(242, 181, 68, 0.4);
}
.mv-root .end .lede {
  font-size: clamp(13px, 3.3cqh, calc(21px * var(--k)));
  line-height: 1.4;
  color: var(--parch2);
  margin: 1cqh auto 2.5cqh;
  max-width: 44ch;
}
.mv-root .song {
  font-style: italic;
  font-size: clamp(13px, 3.1cqh, calc(20px * var(--k)));
  line-height: 1.45;
  margin: 0 auto 2.5cqh;
  padding: 1.5cqh 20px;
  border: 0;
  border-left: 3px solid var(--vin);
  text-align: left;
  max-width: 30em;
  background: rgba(230, 213, 173, 0.06);
}
.mv-root .stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 1.5cqh;
}
.mv-root .stats div {
  background: rgba(230, 213, 173, 0.07);
  padding: 1cqh 6px;
  border-radius: 2px;
}
.mv-root .stats dt {
  font-size: clamp(11px, 2.4cqh, calc(15px * var(--k)));
  color: var(--parch2);
}
.mv-root .stats dd {
  margin: 0;
  font-family: var(--fd);
  font-size: clamp(18px, 4.6cqh, calc(30px * var(--k)));
  color: var(--chand);
}
.mv-root .rank {
  font-family: var(--fd);
  font-size: clamp(16px, 4cqh, calc(26px * var(--k)));
  margin: 0.5cqh 0 2.5cqh;
}
.mv-root .mv-ending .btn {
  font-size: clamp(15px, 3.6cqh, calc(22px * var(--k)));
  padding: 1cqh 22px 1.3cqh;
}

/* ---------- Infobulle (attribut data-bulle) ---------- */

/* ---------- Animations des décors ---------- */
.mv-root .flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: mv-flick 0.16s infinite alternate;
}
@keyframes mv-flick {
  from {
    transform: scale(1, 1);
  }
  to {
    transform: scale(0.9, 1.1) skewX(3deg);
  }
}
.mv-root .dust circle {
  animation: mv-dust 9s linear infinite;
  opacity: 0;
}
@keyframes mv-dust {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  25% {
    opacity: 0.85;
  }
  100% {
    transform: translate(50px, 280px);
    opacity: 0;
  }
}
.mv-root .glint {
  transform-box: fill-box;
  transform-origin: center;
  animation: mv-twinkle 1.3s ease-in-out infinite;
}
@keyframes mv-twinkle {
  0%,
  100% {
    transform: scale(0.35) rotate(0);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2) rotate(45deg);
    opacity: 1;
  }
}
.mv-root .zzz text {
  animation: mv-zz 3.2s ease-in infinite;
  opacity: 0;
}
@keyframes mv-zz {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: translate(-34px, -70px);
    opacity: 0;
  }
}
.mv-root .breathe {
  animation: mv-br 2.6s ease-in-out infinite;
}
@keyframes mv-br {
  50% {
    transform: translateY(-3px);
  }
}
.mv-root .rain line {
  animation: mv-rain 0.45s linear infinite;
}
@keyframes mv-rain {
  to {
    transform: translate(-14px, 70px);
  }
}
/* Finale : le pont-levis touche l'autre rive */
.mv-root .mv-stage.secousse {
  animation: mv-secousse 0.55s ease-out;
}
@keyframes mv-secousse {
  15% { transform: translate(-6px, 5px); }
  30% { transform: translate(5px, -4px); }
  45% { transform: translate(-4px, 3px); }
  60% { transform: translate(3px, -2px); }
  80% { transform: translate(-1px, 1px); }
}
.mv-root .mv-poussiere circle {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: mv-poussiere 2.6s ease-out forwards;
}
@keyframes mv-poussiere {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: translate(var(--dx, 0), -18px) scale(2.6); opacity: 0; }
}
.mv-root .mv-fondu {
  animation: mv-fondu 2.5s ease-out;
}
@keyframes mv-fondu {
  from { opacity: 0; }
}
.mv-root .cloud {
  animation: mv-drift 60s linear infinite;
}
@keyframes mv-drift {
  from {
    transform: translateX(-300px);
  }
  to {
    transform: translateX(1500px);
  }
}
.mv-root .lit {
  animation: mv-litw 4s ease-in-out infinite;
}
@keyframes mv-litw {
  50% {
    opacity: 0.7;
  }
}

/* ---------- Petits écrans ---------- */
@media (max-width: 760px) {
  .mv-root {
    padding: 8px;
    border-radius: 12px;
  }
  .mv-panel {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
  }
  .mv-dlg {
    max-height: 70%;
    padding-top: 18px;
  }
  #mv-portrait {
    display: none;
  }
  #mv-speech {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    margin-top: 8px;
    min-height: 84px;
    font-size: calc(16px * var(--k));
  }
  #mv-speech:not(.on) {
    opacity: 0.25;
  }
  #mv-inv {
    grid-template-columns: repeat(8, 1fr);
  }
  .mv-root .tb kbd {
    display: none;
  }
  .mv-root .sheet {
    padding: 26px 18px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mv-root *,
  .mv-root *::before,
  .mv-root *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
