/* La balade 3D : la scène plein écran, et par-dessus une interface de jeu (la police ronde M PLUS Rounded 1c,
   comme les jeux japonais de la 3DS, qui a les voyelles longues ū, ō… ; des cadres à double filet comme les
   boîtes des Pokémon, aux couleurs de la carte) */
:root {
  --papier: #fffaf0; --papier-2: #f6ecd6; --encre: #3a3236; --encre-2: #6a5e58; --rouge: #dd5638; --rouge-fonce: #b8422b;
  --police: 'M PLUS Rounded 1c', 'Noto Sans', system-ui, sans-serif;
  --bas: max(14px, env(safe-area-inset-bottom));
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe6ee; }
body { font: 500 16px/1.45 var(--police); color: var(--encre); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
#jeu { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
[hidden] { display: none !important; }

/* le cadre des boîtes : un trait d'encre, un filet blanc, un filet rouge, le papier */
.cadre {
  background: var(--papier); border: 3px solid var(--encre); border-radius: 10px;
  box-shadow: inset 0 0 0 3px var(--papier), inset 0 0 0 5px var(--rouge), 0 3px 0 rgba(58, 50, 54, 0.35);
}

/* ---- en haut : le lieu, le carnet, le menu */
.titre {
  position: fixed; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px; padding: 7px 16px 7px 8px;
}
.titre b { display: block; font-size: 18px; font-weight: 800; line-height: 1.2; }
.titre span { font-size: 13px; color: var(--encre-2); }
.retour {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--rouge); color: #fff;
  text-decoration: none; font-size: 18px; border: 2px solid var(--encre);
}
.boutons-haut { position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; gap: 8px; }
.boutons-haut button { display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 14px; font-size: 16px; }
.boutons-haut svg { width: 22px; height: 22px; color: var(--rouge); }
.btn-menu, .btn-tenue { width: 48px; justify-content: center; padding: 0 !important; }
.btn-menu svg { color: var(--encre) !important; }

/* ---- la bulle « A · Parler » au-dessus de ce qu'on peut faire */
.bulle-action {
  position: fixed; left: 0; top: 0; display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px;
  background: var(--papier); border: 3px solid var(--encre); border-radius: 999px; font-size: 15px; white-space: nowrap;
  margin-top: -10px; box-shadow: 0 2px 0 rgba(58, 50, 54, 0.3); pointer-events: auto; cursor: pointer;
  animation: flotte 1.4s ease-in-out infinite;
}
.bulle-action::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -6px; border: 6px solid transparent;
  border-top-color: var(--encre); border-bottom: 0;
}
.bulle-action kbd {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--rouge); color: #fff;
  font: 500 14px var(--police);
}
@keyframes flotte { 50% { margin-top: -14px; } }
/* l'écran qui se couvre d'une lumière pâle (jeu.fondu) */
.fondu { position: fixed; inset: 0; z-index: 20; background: #eaf6d8; opacity: 0; pointer-events: none; transition: opacity 0.5s ease; }
.fondu.vue { opacity: 1; }
/* le rappel du compagnon (balade.js, surveillerRappel) : en haut, sous les boutons ; il ne gêne ni la vue ni les doigts */
.rappel-compagnon {
  position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 69px); left: 50%; width: max-content; max-width: min(560px, calc(100vw - 24px));
  box-sizing: border-box; margin: 0; padding: 11px 18px; text-align: center; font-size: 17px; line-height: 1.4; word-break: keep-all; pointer-events: none;
  transform: translateX(-50%); animation: arrive-rappel 0.35s ease-out;
}
@keyframes arrive-rappel { from { opacity: 0; transform: translate(-50%, -14px); } }
body.occupe .rappel-compagnon, body.en-tenue .rappel-compagnon, body.en-boutique .rappel-compagnon, body.en-photo .rappel-compagnon, body.en-danse .rappel-compagnon { display: none; }
/* (un téléphone couché : plus large et plus petit, pour ne pas cacher la tête du personnage) */
@media (max-height: 430px) { .rappel-compagnon { max-width: min(680px, calc(100vw - 24px)); padding: 8px 14px; font-size: 15px; } }
@media (prefers-reduced-motion: reduce) { .rappel-compagnon { animation: none; } }

.aide {
  position: fixed; bottom: var(--bas); left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 16px; white-space: nowrap;
  background: rgba(255, 250, 240, 0.92); border: 2px solid var(--encre); border-radius: 999px; font-size: 14px;
  transition: opacity 0.8s;
}
.aide.vue { opacity: 0; pointer-events: none; }
/* ---- le bandeau d'un petit jeu, en haut de l'écran : le chrono, le record */
.chrono {
  z-index: 5; position: fixed; top: calc(env(safe-area-inset-top, 0px) + 58px); left: 50%; transform: translateX(-50%); padding: 6px 16px 7px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: rgba(255, 250, 240, 0.94); font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; pointer-events: none; line-height: 1.15;
}
.chrono[hidden] { display: none; }
.chrono b { font-size: 25px; letter-spacing: 0.02em; }
.chrono small { font-size: 12.5px; opacity: 0.86; }
.chrono .bon { color: #2a7a4a; font-weight: 700; }
.chrono .rate { color: #c0392b; font-weight: 700; }

/* ---- la boîte de dialogue, en bas */
.dialogue {
  position: fixed; left: 50%; bottom: var(--bas); transform: translateX(-50%); box-sizing: border-box;
  width: min(780px, calc(100vw - 20px)); min-height: 112px; padding: 18px 26px 20px; cursor: pointer;
}
.dialogue-texte { margin: 0; font-size: 20px; line-height: 1.6; white-space: pre-line; min-height: 3.2em; }
.dialogue-nom {
  position: absolute; left: 16px; bottom: 100%; padding: 3px 14px 2px; background: var(--rouge); color: #fff; font-size: 15px;
  border: 3px solid var(--encre); border-bottom: 0; border-radius: 8px 8px 0 0;
}
.dialogue-suite { position: absolute; right: 18px; bottom: 8px; color: var(--rouge); font-size: 16px; animation: clignote 0.8s steps(2) infinite; }
@keyframes clignote { 50% { transform: translateY(3px); } }
.dialogue-choix {
  position: fixed; right: max(10px, calc(50vw - 390px)); bottom: calc(var(--bas) + 124px); display: flex; flex-direction: column;
  padding: 10px 12px; min-width: 130px;
}
.dialogue-choix button { background: none; border: 0; text-align: left; padding: 6px 10px 6px 26px; font-size: 19px; position: relative; border-radius: 6px; }
.dialogue-choix button.actif::before { content: '▶'; position: absolute; left: 6px; color: var(--rouge); font-size: 14px; top: 9px; }
.dialogue-choix button:hover { background: rgba(221, 86, 56, 0.1); }

/* ---- téléphone : le joystick (en bas à gauche) et le bouton A (en bas à droite) */
.joystick {
  display: none; position: fixed; left: max(22px, env(safe-area-inset-left)); bottom: calc(var(--bas) + 12px);
  width: 116px; height: 116px; border-radius: 50%; background: rgba(255, 250, 240, 0.35);
  border: 3px solid rgba(58, 50, 54, 0.6); touch-action: none;
}
.joystick span {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: var(--papier); border: 3px solid var(--encre); box-sizing: border-box;
}
.bouton-a {
  display: none; position: fixed; right: max(22px, env(safe-area-inset-right)); bottom: calc(var(--bas) + 32px);
  width: 76px; height: 76px; border-radius: 50%; background: var(--rouge); color: #fff; font-size: 30px;
  border: 3px solid var(--encre); box-shadow: 0 4px 0 var(--rouge-fonce), 0 4px 0 3px var(--encre); touch-action: none;
}
.bouton-a:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rouge-fonce), 0 1px 0 3px var(--encre); }
.bouton-a.pret { animation: appel 1.2s ease-in-out infinite; }
@keyframes appel { 50% { filter: brightness(1.15); } }
body.tactile .joystick, body.tactile .bouton-a { display: block; }
body.tactile .aide { bottom: calc(var(--bas) + 150px); }
body.tactile.occupe .joystick { opacity: 0.35; }
/* pendant un dialogue, sur téléphone, la boîte passe au-dessus du bouton A */
body.tactile .dialogue { bottom: calc(var(--bas) + 124px); }
body.tactile .dialogue-choix { bottom: calc(var(--bas) + 248px); }
@media (orientation: portrait) {
  .dialogue-choix.nombreux {
    left: 50%; right: auto; transform: translateX(-50%); width: min(780px, calc(100vw - 20px)); box-sizing: border-box;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 4px; padding: 8px 10px;
  }
  .dialogue-choix.nombreux button { padding: 6px 6px 6px 24px; font-size: 18px; }
}

/* ---- un tampon obtenu : il s'imprime sur une fiche de papier */
.tampon-obtenu { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; padding-bottom: 120px; }
.tampon-papier {
  width: 250px; height: 250px; display: grid; place-items: center; background: var(--papier-2); border: 3px solid var(--encre);
  border-radius: 6px; box-shadow: 0 6px 0 rgba(58, 50, 54, 0.35); animation: fiche 0.3s ease-out both;
}
.tampon-presse { animation: presse 0.75s cubic-bezier(0.2, 0.7, 0.3, 1) 0.15s both; }
@keyframes fiche { from { transform: translateY(30px) rotate(-4deg); opacity: 0; } }
@keyframes presse {
  0% { transform: scale(1.9) rotate(-12deg); opacity: 0; }
  40% { transform: scale(0.94) rotate(-5deg); opacity: 1; }
  55% { transform: scale(1.02) rotate(-5deg); }
  100% { transform: scale(1) rotate(-5deg); }
}
.tampon-svg .vide { fill: var(--papier-2); stroke: var(--papier-2); }
/* une pièce de tenue gagnée : elle tourne en arrivant, sur des rayons dorés, sous un ruban */
.piece-gagnee { position: relative; background: #fff7e6; }
.piece-gagnee::before {
  content: ''; position: absolute; inset: 22px; border-radius: 50%; animation: rayons 7s linear infinite;
  background: repeating-conic-gradient(rgba(232, 185, 65, 0.4) 0deg 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(closest-side, #000 55%, transparent); mask: radial-gradient(closest-side, #000 55%, transparent);
}
.piece-gagnee .tampon-presse { position: relative; animation-name: cadeau; }
.piece-gagnee .ruban {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%) rotate(-2deg); z-index: 1; white-space: nowrap;
  background: var(--rouge); color: #fff; padding: 3px 16px; border: 3px solid var(--encre); border-radius: 6px; font-size: 16px; font-weight: 800;
}
@keyframes cadeau {
  0% { transform: scale(0.3) rotate(-30deg); opacity: 0; }
  55% { transform: scale(1.12) rotate(5deg); opacity: 1; }
  75% { transform: scale(0.96) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes rayons { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .piece-gagnee::before { animation: none; } }
.tampon-svg text { font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', sans-serif; }

/* ---- les voiles : le carnet, le menu, la vidéo */
.voile { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(30, 24, 28, 0.5); padding: 12px; }
.carnet {
  position: relative; box-sizing: border-box; width: min(660px, 100%); max-height: calc(100dvh - 24px); overflow: auto;
  padding: 18px 22px 22px; background: var(--papier-2);
}
.carnet .fermer, .cadre-video .fermer {
  position: sticky; float: right; top: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--rouge); color: #fff;
  border: 3px solid var(--encre); font-size: 20px; line-height: 1; z-index: 1;
}
.carnet-onglets { display: flex; gap: 8px; margin: 0 48px 14px 0; flex-wrap: wrap; }
.carnet-onglets button { background: var(--papier); border: 3px solid var(--encre); border-radius: 8px; padding: 6px 12px; font-size: 16px; }
.carnet-onglets button small { margin-left: 8px; color: var(--encre-2); }
.carnet-onglets button.actif { background: var(--rouge); color: #fff; }
.carnet-onglets button.actif small { color: rgba(255, 255, 255, 0.85); }
.carnet h2 { margin: 4px 0 0; font-size: 24px; font-weight: 800; }
.carnet h2 span { font-size: 18px; color: var(--encre-2); margin-left: 8px; }
.carnet-compte { margin: 2px 0 14px; color: var(--encre-2); }
.carnet-cases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.case {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 10px 6px 12px;
  background: var(--papier); border: 2px dashed rgba(58, 50, 54, 0.3); border-radius: 8px;
}
.case b { font-weight: 700; font-size: 15px; }
.case small { font-size: 12.5px; color: var(--encre-2); line-height: 1.3; }
.case .tampon { display: block; height: 104px; }
.case .trou {
  display: grid; place-items: center; width: 96px; height: 96px; margin: 4px; border-radius: 50%;
  border: 3px dashed rgba(58, 50, 54, 0.35); color: rgba(58, 50, 54, 0.4); font-size: 34px;
}
.case.vide b { color: var(--encre-2); }
.carnet-complet { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; font-size: 17px; color: var(--rouge-fonce); }
.sceau {
  display: grid; place-items: center; width: 46px; height: 46px; flex: none; background: var(--rouge); color: #fff; font-size: 26px;
  border-radius: 6px; transform: rotate(-6deg);
}

/* (2026-10-25 : sur un téléphone, le menu dépassait de l'écran, on ne pouvait ni le faire défiler ni le fermer : il défile
   dans sa boîte, et sa croix reste en haut) */
.menu {
  box-sizing: border-box; width: min(380px, 100%); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain;
  touch-action: pan-y; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px;
}
/* (sous les filets du cadre, à 5 px du bord : top compte depuis le haut du padding, 14 px) */
.menu-tete { position: sticky; top: -9px; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin: -9px -13px 0; padding: 5px 9px 6px 13px; background: var(--papier); border-radius: 6px 6px 0 0; }
.menu-tete b { font-size: 19px; font-weight: 800; }
.menu-tete .fermer {
  flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--rouge); color: #fff; border: 3px solid var(--encre);
  font-size: 20px; line-height: 1; padding: 0;
}
.menu > button, .menu-balades, .menu-carte {
  display: flex; justify-content: space-between; align-items: center; background: var(--papier-2); border: 3px solid var(--encre);
  border-radius: 8px; padding: 8px 12px; font-size: 17px; text-decoration: none; color: inherit;
}
.menu > button small { color: var(--encre-2); }
.carnet-recompense {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 0; padding: 8px 12px; background: var(--papier);
  border: 2px dashed rgba(58, 50, 54, 0.35); border-radius: 8px; font-size: 15.5px;
}
.carnet-recompense .piece-svg { flex: none; filter: grayscale(1); opacity: 0.5; }
.carnet-recompense.gagnee { border: 2px solid var(--rouge); color: var(--rouge-fonce); }
.carnet-recompense.gagnee .piece-svg { filter: none; opacity: 1; }

/* ---- la garde-robe : un panneau à droite (en bas sur un écran en hauteur) ; le voyageur, vu de face, reste à côté */
.garde-robe {
  position: fixed; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); box-sizing: border-box;
  width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 14px 18px 16px; background: var(--papier-2);
}
.garde-robe .fermer {
  position: sticky; float: right; top: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--rouge); color: #fff;
  border: 3px solid var(--encre); font-size: 20px; line-height: 1; z-index: 1;
}
.garde-robe h2 { margin: 2px 0 6px; font-size: 22px; font-weight: 800; }
.garde-robe h2 span { font-size: 16px; color: var(--encre-2); margin-left: 6px; }
.garde-robe h3 { margin: 10px 0 6px; font-size: 14px; font-weight: 700; color: var(--encre-2); }
.pieces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.piece {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 7px;
  background: var(--papier); border: 2px solid var(--encre); border-radius: 9px;
}
.piece small { font-size: 13px; line-height: 1.2; text-align: center; }
.piece.actif { background: #ffe9dc; box-shadow: inset 0 0 0 3px var(--rouge); }
.piece.verrou .piece-svg { filter: grayscale(1) brightness(1.1); opacity: 0.4; }
.piece.verrou small { color: var(--encre-2); }
.piece .cadenas { position: absolute; top: 5px; right: 5px; width: 19px; height: 19px; }
.piece-info { margin: 12px 0 0; padding: 8px 10px; background: var(--papier); border-radius: 8px; font-size: 15px; line-height: 1.4; min-height: 2.8em; }
.piece-info b { display: block; }
.tenue-aide { margin: 10px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--encre-2); }
.tenue-aide small { font-size: 12.5px; opacity: 0.85; }
body.en-tenue .joystick, body.en-tenue .bouton-a, body.en-tenue .aide, body.en-tenue .bulle-action, body.en-tenue .boutons-haut { display: none !important; }
@media (orientation: portrait) {
  .garde-robe {
    top: auto; bottom: var(--bas); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
    width: auto; max-height: 50dvh; padding: 10px 14px 12px;
  }
  .garde-robe h2 { font-size: 19px; }
  .piece-info { margin-top: 8px; font-size: 14px; }
  .tenue-aide { font-size: 12.5px; margin-top: 6px; }
}
@media (max-width: 360px) { .btn-tenue { display: none !important; } }
/* (2026-10-27, le propriétaire : la liste « Aller à » enlevée ; « Toutes les balades 3D » mène au panneau des balades de la
   carte, avec le cube de ses boutons « Visiter en 3D ») */
.menu-balades { justify-content: center; gap: 8px; }
.menu-balades svg { flex: none; width: 21px; height: 21px; color: var(--rouge); }
.menu-carte { background: var(--rouge); color: #fff; justify-content: center; }
.menu-ligne { display: flex; flex-direction: column; gap: 5px; }
.menu-ligne > span { font-size: 14px; color: var(--encre-2); }
.menu-ligne > div { display: flex; gap: 6px; flex-wrap: wrap; }
.menu-ligne button { flex: 1; background: var(--papier); border: 2px solid var(--encre); border-radius: 7px; padding: 6px 8px; font-size: 15px; }
.menu-ligne button.actif { background: var(--encre); color: var(--papier); }

.cadre-video { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 16px 16px; max-height: calc(100dvh - 24px); box-sizing: border-box; }
.video-titre { margin: 0; font-size: 18px; }
.video-lecteur { height: min(70dvh, 620px); aspect-ratio: 9 / 16; background: #000; border: 3px solid var(--encre); border-radius: 6px; overflow: hidden; }
.video-lecteur iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-fermer { background: var(--rouge); color: #fff; border: 3px solid var(--encre); border-radius: 8px; padding: 8px 18px; font-size: 17px; }
.video-lien { margin: -4px 0 -2px; font-size: 13.5px; color: var(--encre-2); }
/* le lecteur de TikTok n'a pas démarré : la couverture, et la vidéo sur TikTok */
.video-repli {
  position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 18px; box-sizing: border-box; color: #fff; text-align: center;
}
.video-repli img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.4; }
.video-repli > :not(img) { position: relative; }
.video-repli p { margin: 0; font-size: 16px; text-shadow: 0 1px 3px #000; }
.video-tiktok, .video-reessayer {
  background: var(--papier); color: var(--encre); border: 3px solid var(--encre); border-radius: 8px; padding: 8px 16px;
  font-size: 16px; text-decoration: none; font-family: inherit;
}
.video-tiktok { background: var(--rouge); color: #fff; }

/* ---- le chargement */
.chargement { position: fixed; inset: 0; display: grid; place-items: center; background: #cfe6ee; }
.chargement .cadre { display: flex; align-items: center; gap: 14px; padding: 16px 24px; }
.chargement p { margin: 0; font-size: 18px; }
.sablier { width: 18px; height: 18px; background: var(--rouge); animation: tourne 0.9s steps(4) infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
/* la balade ne peut pas démarrer (index.html, echecBalade) */
.chargement.echec .cadre { box-sizing: border-box; flex-direction: column; max-width: min(420px, calc(100vw - 32px)); text-align: center; }
.chargement.echec .sablier { display: none; }
.chargement.echec a {
  background: var(--rouge); color: #fff; border: 3px solid var(--encre); border-radius: 8px; padding: 8px 16px;
  font-size: 16px; text-decoration: none;
}

@media (max-width: 720px) {
  .titre { padding: 5px 12px 5px 6px; }
  .titre b { font-size: 16px; }
  .boutons-haut button { height: 44px; padding: 0 11px; }
  .btn-menu { width: 44px; }
  .dialogue { padding: 14px 18px 16px; min-height: 96px; }
  .dialogue-texte { font-size: 17px; }
  .carnet-cases { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .carnet h2 { font-size: 21px; }
}
@media (max-width: 440px) {
  .aide { white-space: normal; width: max-content; max-width: calc(100vw - 40px); text-align: center; font-size: 13px; border-radius: 14px; }
}
@media (max-width: 380px) {
  .titre span { display: none; }
  .titre { gap: 6px; padding-right: 7px; }
}

/* les captures : la scène seule */
body.photo > *:not(#jeu) { display: none !important; }

/* La vapeur du sauna d'Aogashima, sur tout l'écran : des voiles blancs qui montent lentement (transformées
   seulement : rien à repeindre) */
.vapeur-ecran { position: fixed; inset: 0; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity 2.4s ease; background: rgba(255, 250, 244, 0.28); }
.vapeur-ecran.visible { opacity: 1; }
.vapeur-ecran::before, .vapeur-ecran::after {
  content: ''; position: absolute; left: -20%; right: -20%; height: 140%; top: 0;
  background: radial-gradient(40% 22% at 30% 70%, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(35% 18% at 72% 55%, rgba(255, 255, 255, 0.6), transparent 70%),
    radial-gradient(45% 20% at 50% 95%, rgba(255, 255, 255, 0.7), transparent 70%);
  animation: vapeur-monte 9s linear infinite;
}
.vapeur-ecran::after { animation-duration: 13s; animation-delay: -6s; transform: scaleX(-1); }
@keyframes vapeur-monte { from { transform: translateY(35%); opacity: 0; } 25% { opacity: 1; } 80% { opacity: 1; } to { transform: translateY(-45%); opacity: 0; } }
.vapeur-ecran::after { animation-name: vapeur-monte-b; }
@keyframes vapeur-monte-b { from { transform: scaleX(-1) translateY(35%); opacity: 0; } 25% { opacity: 1; } 80% { opacity: 1; } to { transform: scaleX(-1) translateY(-45%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .vapeur-ecran::before, .vapeur-ecran::after { animation: none; opacity: 0.8; } }

/* ---- les trésors (2026-10-23) : le koban d'un secret, le carnet, le menu, la boutique de Bunbuku, la feuille de papier
   (la carte au trésor, la photo de classe, la lettre), l'appareil photo */
.koban-gagne .tampon-presse { animation-name: cadeau, koban-tourne; animation-duration: 0.75s, 2.4s; animation-delay: 0.15s, 0.9s; animation-iteration-count: 1, infinite; animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1), linear; }
@keyframes koban-tourne { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .koban-gagne .tampon-presse { animation: none; } }
.carnet-secret, .carnet-koban {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 0; padding: 8px 12px; background: var(--papier);
  border: 2px dashed rgba(58, 50, 54, 0.35); border-radius: 8px; font-size: 15.5px;
}
.carnet-secret .point { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #3a3236; color: #f2c84f; font-weight: 800; flex: none; }
.carnet-secret.trouve { border: 2px solid #c58d26; color: #8a5a16; background: #fff7e0; }
.carnet-koban { border-style: solid; border-color: #e8c76a; background: #fffaf0; font-weight: 700; }
.menu-koban { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 6px; font-size: 16px; }
.menu-koban b { margin-left: auto; font-size: 19px; color: #8a5a16; }
.menu > button.menu-action { justify-content: flex-start; gap: 10px; }

/* la boutique : comme la garde-robe, un panneau à droite (en bas sur un écran en hauteur) */
.boutique {
  position: fixed; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); box-sizing: border-box;
  width: min(390px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 14px 18px 16px; background: var(--papier-2);
}
.boutique .fermer {
  position: sticky; float: right; top: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--rouge); color: #fff;
  border: 3px solid var(--encre); font-size: 20px; line-height: 1; z-index: 1;
}
.boutique h2 { margin: 2px 0 2px; font-size: 21px; font-weight: 800; }
.boutique h2 span { display: inline-block; font-size: 15px; color: var(--encre-2); margin-left: 6px; white-space: nowrap; }
.bourse { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font-size: 20px; color: #8a5a16; }
.articles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 8px; }
.article {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 3px 6px;
  background: var(--papier); border: 2px solid var(--encre); border-radius: 9px;
}
.article small { font-size: 12.5px; line-height: 1.15; text-align: center; }
.article em { font-style: normal; font-size: 12px; font-weight: 800; color: #3f8a5a; }
.article.actif { background: #ffe9dc; box-shadow: inset 0 0 0 3px var(--rouge); }
.article.achete { background: #eef7e8; }
.article.cher:not(.actif) .article-svg, .article.cher:not(.actif) .piece-svg { opacity: 0.55; }
.piecettes { display: flex; gap: 1px; }
.article-info { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 0; padding: 9px 11px; background: var(--papier); border-radius: 8px; font-size: 15px; line-height: 1.4; }
.article-info b { font-size: 16px; }
.article-info em { font-style: normal; font-weight: 800; color: #3f8a5a; }
.acheter { align-self: flex-start; margin-top: 4px; background: var(--rouge); color: #fff; border: 3px solid var(--encre); border-radius: 8px; padding: 6px 14px; font-size: 16px; font-weight: 700; }
.acheter:disabled { background: #b8b0a8; cursor: default; }
.boutique-message { margin: 8px 0 0; padding: 8px 10px; background: #fff7e0; border-left: 4px solid #c58d26; border-radius: 6px; font-size: 14.5px; }
.boutique-message b { color: #8a5a16; margin-right: 4px; }
.boutique-dev { display: flex; gap: 6px; margin: 10px 0 0; }
.boutique-dev button { flex: 1; background: #fff; border: 2px dashed var(--rouge); color: var(--rouge-fonce); border-radius: 7px; padding: 4px; font-size: 13px; }
body.en-boutique .joystick, body.en-boutique .bouton-a, body.en-boutique .aide, body.en-boutique .bulle-action, body.en-boutique .boutons-haut { display: none !important; }
@media (orientation: portrait) {
  .boutique { top: auto; bottom: var(--bas); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); width: auto; max-height: 56dvh; padding: 10px 14px 12px; }
  .articles { grid-template-columns: repeat(4, 1fr); }
}

/* la carte de la traversée en bateau (jeu.partir, traversee.js : d'Udo à Yakushima, et retour) ; aussi grande que l'écran le
   permet (600 × 720) ; la fumée de Sakurajima, la mer qui bouge à peine, l'onde du port à l'arrivée et son nom */
.voyage { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 12px; background: #efe5cc; opacity: 0; transition: opacity 0.7s ease; font-family: inherit; }
.voyage.vue { opacity: 1; }
.voyage svg { display: block; width: min(96vw, 640px, calc((100vh - 24px) * 600 / 720)); height: auto; filter: drop-shadow(0 8px 18px rgba(42, 36, 32, 0.28)); }
.carte-mer .vagues { animation: mer-vagues 3.6s ease-in-out infinite alternate; }
@keyframes mer-vagues { to { transform: translate(3px, 1px); } }
.carte-mer .fumee circle { transform-box: fill-box; transform-origin: center; animation: mer-fumee 3.2s ease-in-out infinite; }
.carte-mer .fumee circle:nth-child(2) { animation-delay: -1.1s; }
.carte-mer .fumee circle:nth-child(3) { animation-delay: -2.2s; }
@keyframes mer-fumee { 0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.95; } 50% { transform: translate(2px, -3px) scale(1.18); opacity: 0.75; } }
.carte-mer .port { opacity: 0; transition: opacity 0.6s ease; }
.carte-mer.arrive .port { opacity: 1; }
.carte-mer .onde { transform-box: fill-box; transform-origin: center; opacity: 0; }
.carte-mer.arrive .onde { animation: mer-onde 1s ease-out 2; }
@keyframes mer-onde { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .carte-mer .vagues, .carte-mer .fumee circle { animation: none; } }
/* la feuille de papier (la carte au trésor, la photo, la lettre), au-dessus de la boîte de dialogue */
.feuille { position: fixed; inset: 0; display: grid; place-items: center; padding: 14px 14px calc(var(--bas) + 140px); pointer-events: none; }
body.tactile .feuille { padding-bottom: calc(var(--bas) + 250px); }
.feuille-papier {
  width: min(470px, 86vw, 52dvh); background: #fbf8ee; border: 3px solid var(--encre); border-radius: 6px; padding: 6px;
  box-shadow: 0 8px 0 rgba(58, 50, 54, 0.35); transform: rotate(-1.5deg); animation: fiche 0.35s ease-out both;
}
.feuille-papier svg { display: block; width: 100%; height: auto; }
.feuille-papier.photo-classe { background: #fdfcf6; transform: rotate(1.5deg); }
/* (sur un téléphone, quatre réponses au-dessus de la boîte de dialogue : la feuille plus petite, sinon elle les cachait : le tableau des yeux de Tsubosaka) */
body.tactile .feuille-papier.avec-choix { width: min(220px, 56vw, 26dvh); }

/* l'appareil photo : la barre des cadres et des poses, le déclencheur, le flash, la carte postale faite */
body.en-photo .joystick, body.en-photo .bouton-a, body.en-photo .aide, body.en-photo .bulle-action, body.en-photo .boutons-haut, body.en-photo .titre { display: none !important; }
.photo { position: fixed; inset: 0; pointer-events: none; }
.photo > * { pointer-events: auto; }
.photo-aide {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 14px; white-space: nowrap;
  background: rgba(255, 250, 240, 0.92); border: 2px solid var(--encre); border-radius: 999px; font-size: 13.5px; pointer-events: none;
}
.photo-fermer {
  position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); width: 44px; height: 44px;
  border-radius: 50%; background: var(--rouge); color: #fff; border: 3px solid var(--encre); font-size: 22px; line-height: 1;
}
.photo-barre {
  position: fixed; left: 50%; bottom: var(--bas); transform: translateX(-50%); box-sizing: border-box; width: min(760px, calc(100vw - 20px));
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 14px;
}
.photo-choix { display: flex; align-items: center; gap: 8px; grid-column: 1; min-width: 0; }
.photo-choix > span { font-size: 13px; color: var(--encre-2); width: 46px; flex: none; }
.photo-choix > div { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.photo-choix button { flex: none; background: var(--papier); border: 2px solid var(--encre); border-radius: 7px; padding: 4px 9px; font-size: 14px; white-space: nowrap; }
.photo-choix button.actif { background: var(--encre); color: var(--papier); }
.photo-declencheur { grid-column: 2; grid-row: 1 / 3; width: 70px; height: 70px; border-radius: 50%; background: #fff; border: 4px solid var(--encre); padding: 6px; }
.photo-declencheur span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--rouge); }
.photo-declencheur:active span { transform: scale(0.9); }
.photo-flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.photo-flash.eclair { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
.photo-resultat { z-index: 2; }
.photo-resultat .cadre { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; max-height: calc(100dvh - 24px); box-sizing: border-box; }
.photo-resultat img { max-width: min(86vw, 640px); max-height: calc(100dvh - 130px); border: 2px solid var(--encre); box-shadow: 0 4px 0 rgba(58, 50, 54, 0.3); }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.photo-actions button { background: var(--papier); border: 3px solid var(--encre); border-radius: 8px; padding: 7px 14px; font-size: 16px; }
.photo-actions .photo-partager { background: var(--rouge); color: #fff; }
@media (max-width: 560px) {
  .photo-barre { padding: 8px 10px; gap: 6px 8px; }
  .photo-declencheur { width: 60px; height: 60px; }
  .photo-aide { white-space: normal; width: max-content; max-width: calc(100vw - 80px); text-align: center; font-size: 12.5px; border-radius: 14px; }
}
body.en-danse .joystick, body.en-danse .bouton-a, body.en-danse .bulle-action { display: none !important; }
body.en-danse .aide { bottom: var(--bas); }

/* Les jumelles de la crête d'Aogashima : deux ronds ouverts sur le paysage, le reste noir (le masque SVG ; les ronds
   sont placés par balade.js, jeu.jumelles) */
.jumelles-ecran { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 0.35s ease; }
.jumelles-ecran.visible { opacity: 1; }

/* ---- le tableau d'Inkami qu'on regarde (inkami.js, 2026-11-19) : l'image en grand, ce que fait la boutique, le bouton qui y mène */
.fond-tableau { z-index: 30; }
.cadre-tableau {
  box-sizing: border-box; width: min(430px, 100%); max-height: calc(100dvh - 24px); overflow: auto; background: var(--papier-2);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 16px 16px; text-align: center;
}
.tableau-nom { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 10px; font-size: 17px; line-height: 1.25; }
.tableau-kana { font-size: 22px; letter-spacing: 0.06em; }
.tableau-image {
  display: block; height: min(50dvh, 560px); max-width: 100%; aspect-ratio: 800 / 1131; object-fit: contain; background: #e0d2b6;
  border: 3px solid var(--encre); border-radius: 4px; box-shadow: 0 4px 0 rgba(58, 50, 54, 0.25);
}
.tableau-sous { margin: -2px 0 0; font-size: 12.5px; color: var(--encre-2); }
.tableau-offre { margin: 2px 0 0; font-size: 14px; line-height: 1.45; text-align: left; }
.tableau-offre b { display: block; font-size: 16.5px; }
.tableau-boutique {
  display: flex; flex-direction: column; align-items: center; margin-top: 2px; padding: 9px 24px 7px; background: #b03526; color: #fff;
  border: 3px solid var(--encre); border-radius: 8px; box-shadow: 0 3px 0 rgba(58, 50, 54, 0.35); text-decoration: none; font-size: 17px; font-weight: 800; line-height: 1.25;
}
.tableau-boutique small { font-size: 12px; font-weight: 700; opacity: 0.88; }
.tableau-boutique:hover, .tableau-boutique:focus-visible { background: #c43f2e; outline: none; }
.tableau-fermer { background: var(--papier); border: 3px solid var(--encre); border-radius: 8px; padding: 5px 18px; font-size: 15px; }
/* (un écran large : l'image à gauche, le reste à droite) */
@media (min-width: 760px) and (min-height: 480px) {
  .cadre-tableau { width: min(780px, 100%); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr auto auto; column-gap: 22px; padding: 18px 22px; justify-items: center; align-items: center; }
  .tableau-image { grid-column: 1; grid-row: 1 / 6; height: min(calc(100dvh - 72px), 640px); }
  .tableau-nom { flex-direction: column; align-items: center; font-size: 19px; }
  .tableau-kana { font-size: 30px; }
  .tableau-offre { font-size: 15px; align-self: start; margin-top: 10px; }
  .tableau-offre b { font-size: 18px; margin-bottom: 4px; }
}
