/* Menus d'Ultimate Patator : le style « étal en bois » du magasin (planches Codex planche-magasin, icones-menus,
   titres, illustration-accueil). Hors partie, le jeu n'apparaît pas : l'illustration de l'accueil derrière tout. */
#ecrans { position: fixed; inset: 0; z-index: 20; }
#ecrans .fond-ecrans { position: absolute; inset: 0; background: #1b1512 url(img/menus/illustration.webp) center / cover no-repeat; }
#ecrans .fond-ecrans::after { content: ""; position: absolute; inset: 0; background: rgba(20, 14, 10, 0.25); transition: background 0.3s; }
#ecrans.sombre .fond-ecrans::after { background: rgba(20, 14, 10, 0.62); }
.ecran { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 12px 16px; }
.titre-jeu { width: min(62vw, 560px); max-height: 46vh; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); pointer-events: none; }
.titre-jeu.petit { width: min(40vw, 360px); max-height: 26vh; }
.bouton-bois { border-style: solid; border-width: 8px 16px; border-image: url(img/magasin/bouton-bois.webp) 20 35 fill / 14px 24px / 0 stretch; background: none; color: #4a2e18; font-weight: 800; font-size: 15px; padding: 0 10px; min-height: 42px; }
.bouton-bois.vert { border-image-source: url(img/magasin/bouton.webp); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.bouton-bois.grand { min-width: 220px; min-height: 58px; font-size: 22px; }
.bouton-bois:active, .carte-menu:active { transform: translateY(2px); filter: brightness(0.95); }
.bouton-bois.inactif { filter: grayscale(0.7); opacity: 0.6; }
.liens-plateforme { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; align-items: center; }
.liens-plateforme a { color: #fff; font-size: 12px; opacity: 0.8; }
.choix-menu { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.carte-menu { width: clamp(132px, 19vw, 190px); border-style: solid; border-width: 9px; border-image: url(img/magasin/case.webp) 21 fill / 13px / 0 stretch; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; color: #2a1d10; }
.carte-menu img { width: 62%; aspect-ratio: 1; object-fit: contain; }
.carte-menu b { font-size: 17px; }
.carte-menu span { font-size: 12px; opacity: 0.75; display: flex; align-items: center; gap: 4px; }
.carte-menu span img { width: 16px; }
.icone-coin { position: absolute; top: 12px; right: 12px; width: 48px; height: 48px; border-style: solid; border-width: 6px; border-image: url(img/magasin/emplacement.webp) 20 fill / 8px / 0 stretch; background: none; padding: 0; display: grid; place-items: center; }
.icone-coin img { width: 30px; height: 30px; }
.icone-coin.jeu { position: fixed; top: 10px; left: 12px; right: auto; z-index: 5; width: 42px; height: 42px; opacity: 0.85; }
#ecrans .icone-coin { z-index: 2; }

/* fenêtres en bois (campagne, partie rapide, survie, réglages, pause) */
.fenetre-bois { width: min(96vw, 960px); height: min(94vh, 520px); display: flex; flex-direction: column; gap: 6px; border-style: solid; border-width: 24px 28px; border-image: url(img/magasin/fenetre.webp) 58 68 / 32px 38px / 0 stretch; background: rgba(38, 26, 18, 0.9); background-clip: padding-box; padding: 4px 8px 6px; color: #fff; }
.fenetre-bois.petite { width: min(92vw, 420px); height: auto; gap: 10px; padding: 8px 12px 12px; }
.fenetre-bois .entete { display: flex; align-items: center; gap: 10px; }
.fenetre-bois h2 { flex: 1; margin: 0; text-align: center; font-size: 19px; letter-spacing: 0.03em; }
.fenetre-bois .entete > span { min-width: 44px; }
.retour { width: 44px; height: 40px; border: 0; background: none; padding: 0; display: grid; place-items: center; }
.retour img { width: 30px; height: 30px; }
.compteur { display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.compteur img { width: 22px; height: 22px; }
.fenetre-bois .onglets { display: flex; gap: 4px; }
.fenetre-bois .onglet { flex: 1; height: 32px; border-style: solid; border-width: 6px 10px; border-image: url(img/magasin/onglet.webp) 15 22 fill / 10px 14px / 0 stretch; background: none; color: #4a2e18; font-weight: 800; font-size: 12px; padding: 0; display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.fenetre-bois .onglet.actif { border-image-source: url(img/magasin/onglet-actif.webp); color: #2a1d10; }
.fenetre-bois .onglet.ferme { filter: grayscale(0.8); opacity: 0.65; }
.fenetre-bois .onglet img { width: 14px; height: 14px; }
.fenetre-bois .corps { flex: 1; min-height: 0; display: flex; gap: 8px; }
.fenetre-bois .cote { width: 36%; min-width: 210px; display: flex; flex-direction: column; gap: 6px; }
.fenetre-bois .fiche { flex: 1; min-height: 0; border-style: solid; border-width: 8px; border-image: url(img/magasin/case.webp) 21 fill / 12px / 0 stretch; color: #2a1d10; padding: 2px 8px; display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.fiche h3 { margin: 0; font-size: 15px; }
.fiche .sous-titre { font-size: 12px; opacity: 0.75; }
.fiche img.vignette { width: 100%; height: clamp(36px, 14vh, 80px); flex: none; object-fit: cover; border-radius: 3px; }
.fiche .sous-titre { line-height: 1.25; }
.fiche .objectifs { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.fiche .objectifs span { display: flex; align-items: center; gap: 5px; }
.fiche .objectifs i, .grille-niveaux .etoiles i { display: inline-block; width: 13px; height: 13px; background: rgba(42, 29, 16, 0.25); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.fiche .objectifs i.ok, .grille-niveaux .etoiles i.ok { background: #e8a31c; }
.grille-niveaux { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: minmax(52px, 1fr); gap: 5px; overflow-y: auto; align-content: start; }
.case-niveau { border-style: solid; border-width: 7px; border-image: url(img/magasin/case.webp) 21 fill / 10px / 0 stretch; background: none; padding: 0; color: #2a1d10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.case-niveau b { font-size: 16px; line-height: 1; }
.case-niveau.choisi { border-image-source: url(img/magasin/case-choisie.webp); }
.case-niveau.ferme { border-image-source: url(img/magasin/case-grisee.webp); }
.case-niveau.ferme b { opacity: 0.4; }
.case-niveau img.cadenas { width: 18px; height: 18px; }
.case-niveau .etoiles { display: flex; gap: 1px; }
.case-niveau.champion b::after { content: " ◆"; font-size: 10px; color: #b5651d; }
.grille-cartes { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; overflow-y: auto; align-content: start; }
.grille-cartes.large { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.case-carte { border-style: solid; border-width: 6px; border-image: url(img/magasin/case.webp) 21 fill / 9px / 0 stretch; background: none; padding: 0 0 2px; color: #2a1d10; display: flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 700; }
.case-carte img { width: 100%; aspect-ratio: 2.2; object-fit: cover; border-radius: 2px; }
.case-carte.choisi { border-image-source: url(img/magasin/case-choisie.webp); }
.case-carte small { font-weight: 600; opacity: 0.7; }
.reglages-partie { gap: 5px !important; width: 44% !important; min-width: 250px !important; }
.reglages-partie #rapide-jouer { margin-top: auto; flex: none; }
.ligne-choix { display: flex; align-items: center; gap: 6px; }
.ligne-choix > span { font-size: 11px; font-weight: 700; opacity: 0.8; width: 48px; flex: none; }
.ligne-choix .choix { flex: 1; }
.choix { display: flex; gap: 3px; }
.choix button { flex: 1; min-width: 0; height: 28px; border-style: solid; border-width: 5px 4px; border-image: url(img/magasin/onglet.webp) 15 22 fill / 8px 11px / 0 stretch; background: none; color: #4a2e18; font-weight: 800; font-size: 11.5px; padding: 0; letter-spacing: 0; white-space: nowrap; }
.choix button.actif { border-image-source: url(img/magasin/onglet-actif.webp); color: #2a1d10; }
.choix button.ferme { opacity: 0.4; }
.phrase-mode { margin: 0; font-size: 11px; line-height: 1.25; opacity: 0.85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: none; }
.phrase-ecran { margin: 0 0 4px; font-size: 13px; opacity: 0.85; text-align: center; }
.interrupteur { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 15px; padding: 4px 2px; }
.interrupteur span { display: flex; align-items: center; gap: 8px; }
.interrupteur span img { width: 26px; height: 26px; }
.interrupteur input { display: none; }
.interrupteur i { width: 50px; height: 26px; border-radius: 13px; background: rgba(255, 255, 255, 0.2); position: relative; transition: background 0.15s; }
.interrupteur i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.interrupteur input:checked + i { background: #3cbf55; }
.interrupteur input:checked + i::after { transform: translateX(24px); }
#pause { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(20, 14, 10, 0.55); }
#tuto { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(20, 14, 10, 0.88); border: 2px solid #f2b84b; border-radius: 6px; max-width: min(90vw, 560px); pointer-events: auto; }
#tuto p { margin: 0; font-size: 16px; font-weight: 700; }
#tuto button { flex: none; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 4px; background: none; color: #fff; font-size: 12px; }
#tuto.reussi { border-color: #5be37a; }
img { -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }

/* le salon en ligne */
.places { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 6px; }
.place { position: relative; border-style: solid; border-width: 7px; border-image: url(img/magasin/case.webp) 21 fill / 10px / 0 stretch; color: #2a1d10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: inset 0 -5px 0 var(--couleur, transparent); }
.place b { font-size: 15px; }
.place span { font-size: 11px; opacity: 0.75; }
.place.vide { border-image-source: url(img/magasin/case-grisee.webp); }
.place .retirer { position: absolute; top: 2px; right: 4px; border: 0; background: none; font-size: 16px; color: #7a3a1a; padding: 0 4px; }
#salon-reglages select { flex: 1; height: 30px; border-radius: 3px; border: 0; background: #f3e2bd; color: #2a1d10; font-weight: 700; padding: 0 6px; }
#ecran-salon .entete .bouton-bois { min-height: 34px; font-size: 13px; }
#ecran-multi .fenetre-bois { justify-content: center; align-items: center; gap: 16px; }

/* L'écran titre (24 oct. 2026 : « plus plaisant ») : l'illustration avance très lentement, le titre tombe et rebondit,
   le bouton arrive ensuite, des patates traversent le ciel en cloche, de temps en temps. */
#ecrans[data-vue="titre"] .fond-ecrans { animation: avancee 26s ease-in-out infinite alternate; }
@keyframes avancee { from { transform: scale(1.02) translateX(0); } to { transform: scale(1.1) translateX(-2.5%); } }
#ecrans[data-vue="titre"] .fond-ecrans::after { background: linear-gradient(rgba(20, 14, 10, 0) 55%, rgba(20, 14, 10, 0.45)); }
#ecran-titre.joue .titre-jeu.entree { animation: chute 0.9s cubic-bezier(0.3, 1.4, 0.5, 1) both, flotte 4.5s ease-in-out 1s infinite; transform-origin: 50% 0; }
@keyframes chute { from { transform: translateY(-70vh) rotate(-6deg); } 70% { transform: translateY(3%) rotate(1.5deg); } to { transform: translateY(0) rotate(0); } }
@keyframes flotte { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-0.6deg); } }
#ecran-titre.joue .bouton-bois.entree { animation: monte 0.5s ease-out 0.75s both; }
@keyframes monte { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.patates-volantes { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.patates-volantes img { position: absolute; left: 52%; top: 54%; width: clamp(26px, 4.2vw, 46px); opacity: 0; animation: cloche 4.6s linear infinite; }
.patates-volantes img:nth-child(1) { animation-delay: 1.2s; }
.patates-volantes img:nth-child(2) { animation-delay: 3.1s; top: 56%; width: clamp(20px, 3vw, 34px); animation-duration: 5.4s; }
.patates-volantes img:nth-child(3) { animation-delay: 5.6s; top: 52%; animation-duration: 4.2s; }
.patates-volantes img:nth-child(4) { animation-delay: 7.9s; top: 55%; width: clamp(18px, 2.6vw, 30px); animation-duration: 6s; }
.patates-volantes img:nth-child(5) { animation-delay: 9.8s; top: 53%; animation-duration: 4.8s; }
/* une cloche : de la bouche du canon de l'illustration vers la droite, en tournant */
@keyframes cloche {
	0% { opacity: 0; transform: translate(0, 0) rotate(0); }
	6% { opacity: 1; }
	25% { transform: translate(13vw, -24vh) rotate(160deg); }
	50% { transform: translate(27vw, -33vh) rotate(330deg); }
	75% { transform: translate(41vw, -25vh) rotate(500deg); }
	92% { opacity: 1; }
	100% { opacity: 0; transform: translate(55vw, -2vh) rotate(640deg); }
}
@media (prefers-reduced-motion: reduce) { #ecrans .fond-ecrans, .patates-volantes img, #ecran-titre .entree { animation: none !important; opacity: 1; } .patates-volantes { display: none; } }

/* le titre dans le ciel, à droite : le canon de l'illustration (à gauche) reste visible */
#ecran-titre { justify-content: flex-start; align-items: flex-end; padding: 5vh 5vw; gap: 2vh; }
#ecran-titre .titre-jeu { width: min(42vw, 450px); max-height: 50vh; }
#ecran-titre .bouton-bois.grand { align-self: flex-end; margin-right: calc(min(42vw, 450px) / 2 - 110px); }
#ecran-titre:not(.joue) .entree { opacity: 0; }

/* le premier écran tenu en portrait (avant le geste qui passe en paysage) : titre et bouton centrés */
@media (orientation: portrait) {
	#ecran-titre { align-items: center; justify-content: flex-start; padding: 13vh 6vw 0; gap: 4vh; }
	#ecran-titre .titre-jeu { width: min(84vw, 520px); max-height: 40vh; }
	#ecran-titre .bouton-bois.grand { align-self: center; margin-right: 0; }
}

/* l'entraînement : la bulle (étape, consigne, raté), le bouton à toucher éclairé, la main qui fait le geste */
#tuto p { display: flex; flex-direction: column; gap: 3px; }
#tuto p small { font-size: 11px; font-weight: 600; color: #f2b84b; text-transform: uppercase; letter-spacing: 0.06em; }
#tuto p em { font-style: normal; font-size: 14px; color: #ff9a7a; }
#tuto { top: 12% !important; }
#projecteur { position: fixed; z-index: 6; border: 3px solid #ffd34d; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10, 6, 4, 0.45), 0 0 18px 4px rgba(255, 211, 77, 0.8); pointer-events: none; animation: projecteur 1s ease-in-out infinite alternate; }
@keyframes projecteur { from { border-color: #ffd34d; } to { border-color: #fff4c2; } }
#main-guide { position: fixed; z-index: 8; width: 54px; margin: -6px 0 0 -14px; pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.5)); }
#main-guide.geste-gauche-droite { animation: g-droite 1.4s ease-in-out infinite; }
#main-guide.geste-gauche-haut { animation: g-haut 1.4s ease-in-out infinite; }
#main-guide.geste-gauche-diagonale { animation: g-diag 1.4s ease-in-out infinite; }
#main-guide.geste-gauche-bas { animation: g-bas 1.6s ease-in-out infinite; }
#main-guide.geste-droite-viser { animation: g-viser 2s ease-in-out infinite; }
#main-guide.geste-toucher { animation: g-toucher 1s ease-in-out infinite; }
@keyframes g-droite { 0%, 15% { transform: translate(0, 0); opacity: 0.4; } 50%, 80% { transform: translate(48px, 0); opacity: 1; } 100% { transform: translate(0, 0); opacity: 0.4; } }
@keyframes g-haut { 0%, 15% { transform: translate(0, 0); opacity: 0.4; } 45%, 70% { transform: translate(0, -52px); opacity: 1; } 100% { transform: translate(0, 0); opacity: 0.4; } }
@keyframes g-diag { 0%, 15% { transform: translate(0, 0); opacity: 0.4; } 45%, 70% { transform: translate(36px, -40px); opacity: 1; } 100% { transform: translate(0, 0); opacity: 0.4; } }
@keyframes g-bas { 0%, 15% { transform: translate(0, 0); opacity: 0.4; } 40%, 85% { transform: translate(0, 50px); opacity: 1; } 100% { transform: translate(0, 0); opacity: 0.4; } }
@keyframes g-viser { 0% { transform: translate(0, 0) scale(1); opacity: 0.4; } 15% { transform: translate(0, 0) scale(0.9); opacity: 1; } 60% { transform: translate(-60px, -34px) scale(0.9); opacity: 1; } 75% { transform: translate(-60px, -34px) scale(1.15); opacity: 1; } 100% { transform: translate(-60px, -34px) scale(1.15); opacity: 0; } }
@keyframes g-toucher { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(0, 8px) scale(0.88); } }

/* Usrati : liens détachés du menu, volet des amis du salon */
.liens-plateforme a[hidden] { display: none; }
#amis-volet { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(10, 7, 5, 0.55); }
#amis-volet[hidden] { display: none; }
#amis-liste { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.ami { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; text-align: left; padding: 6px 10px; border-style: solid; border-width: 7px; border-image: url(img/magasin/case.webp) 21 fill / 10px / 0 stretch; background: none; color: #2a1d10; }
.ami b { font-size: 16px; }
.ami small { grid-row: 2; font-size: 12px; opacity: 0.75; }
.ami span { grid-row: 1 / 3; grid-column: 2; font-size: 14px; color: #1d6b2a; }
.ami:disabled { opacity: 0.55; }
