/* Interface « verre » nuit + or (charte pixel art). Responsive uniquement : mobile d'abord,
   tailles en clamp(), marges de sécurité des téléphones, aucune largeur fixe. */
:root {
  --fond: #16121f;
  --verre: rgba(30, 24, 52, .72);
  --verre-fort: rgba(24, 19, 42, .9);
  --texte: #f5ecd6;
  --doux: #b9aecb;
  --or: #e8c26a;
  --or-vif: #ffdf8a;
  --bord: rgba(232, 194, 106, .55);
  --vie: #e5534b;
  --energie: #6cc24a;
  --f-titre: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --f-texte: "Nunito", "Segoe UI", system-ui, sans-serif;
  --pad: clamp(6px, 2vmin, 12px);
  --slot: clamp(40px, 11vmin, 56px);
  --stick: clamp(110px, 30vmin, 170px);
  --act: clamp(70px, 19vmin, 104px);
  --sa-t: env(safe-area-inset-top, 0px); --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px); --sa-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent }
html, body { height: 100%; overflow: hidden; background: var(--fond); color: var(--texte); font-family: var(--f-texte); user-select: none; -webkit-user-select: none }
canvas { image-rendering: pixelated; display: block }
#game { position: fixed; inset: 0; touch-action: none; image-rendering: pixelated }   /* 19/11 : résolution plafonnée, agrandie sans flou */

.box {
  background: var(--verre); border: 1px solid var(--bord); border-radius: 14px;
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 223, 138, .18);
}
button {
  font: 700 clamp(13px, 3.4vmin, 16px) var(--f-texte); color: var(--texte); cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 223, 138, .18), rgba(232, 194, 106, .06));
  border: 1px solid var(--bord); border-radius: 12px; padding: .5em .9em;
  transition: transform .12s, background .15s, box-shadow .15s;
}
button:hover { background: linear-gradient(180deg, rgba(255, 223, 138, .32), rgba(232, 194, 106, .12)); box-shadow: 0 0 12px rgba(232, 194, 106, .35) }
button:active { transform: translateY(2px) }
button:disabled { opacity: .4; box-shadow: none }
button:focus-visible, .slot:focus-visible, .chip:focus-visible { outline: 2px solid var(--or-vif); outline-offset: 2px }
button.on { background: linear-gradient(180deg, rgba(255, 223, 138, .45), rgba(232, 194, 106, .2)); color: #fff }
.primaire { background: linear-gradient(180deg, #f2cf73, #c99a3a); color: #2a1a08; border-color: #ffe7a6 }

/* HUD */
#hud {
  position: fixed; top: calc(var(--sa-t) + var(--pad)); left: calc(var(--sa-l) + var(--pad));
  padding: var(--pad) calc(var(--pad) * 1.4); font-size: clamp(11px, 3vmin, 14px); line-height: 1.35;
  width: clamp(150px, 42vmin, 240px); animation: monte .25s ease-out;
}
#hud .ligne { display: flex; justify-content: space-between; gap: 8px; align-items: baseline }
#hName { font: 600 1.15em var(--f-titre); color: var(--or-vif); text-shadow: 0 0 8px rgba(232, 194, 106, .5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
#hMoney { font-variant-numeric: tabular-nums; color: var(--or) }
#hTime { color: var(--doux); font-size: .92em; margin: 2px 0 4px }
.bar { height: clamp(6px, 1.6vmin, 9px); background: rgba(0, 0, 0, .45); border: 1px solid var(--bord); border-radius: 6px; overflow: hidden; margin: 2px 0 4px }
.bar > i { display: block; height: 100%; border-radius: 6px; transition: width .3s }
#hEn { background: linear-gradient(90deg, #3e9a32, var(--energie), #a6e36e) }
#hHp { background: linear-gradient(90deg, #a8302b, var(--vie), #ff8f7a) }
.lbl { font-size: .82em; color: var(--doux); letter-spacing: .04em }
#saveDot { font-size: .78em; color: var(--doux); opacity: .8 }

#topbtns { position: fixed; top: calc(var(--sa-t) + var(--pad)); right: calc(var(--sa-r) + var(--pad)); display: flex; flex-direction: column; gap: 8px }
#topbtns button { width: clamp(40px, 11vmin, 52px); height: clamp(40px, 11vmin, 52px); padding: 0; border-radius: 50%; font-size: clamp(17px, 4.6vmin, 22px); background: var(--verre); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px) }


#toast {
  position: fixed; top: calc(var(--sa-t) + var(--pad) * 2 + clamp(40px, 11vmin, 52px)); left: 50%; transform: translateX(-50%);
  padding: .55em 1.1em; z-index: 50; font-weight: 700; font-size: clamp(13px, 3.4vmin, 16px); max-width: 86vw; text-align: center; display: none;
  animation: monteC .2s ease-out;
}
#toast[hidden] { display: none }

/* Panneaux */
.overlay { position: fixed; inset: 0; background: rgba(10, 8, 20, .55); display: none; align-items: center; justify-content: center; z-index: 40;
  padding: calc(var(--sa-t) + 10px) calc(var(--sa-r) + 10px) calc(var(--sa-b) + 10px) calc(var(--sa-l) + 10px) }
.overlay.on { display: flex }
.panel { width: min(560px, 100%); max-height: 100%; overflow: auto; padding: clamp(12px, 3.5vmin, 20px); background: var(--verre-fort); animation: monte .22s ease-out }
.panel h2 { font: 600 clamp(18px, 5vmin, 24px) var(--f-titre); color: var(--or-vif); text-shadow: 0 0 10px rgba(232, 194, 106, .45) }
.titre-jeu {
  font: 700 clamp(30px, 10vmin, 52px) var(--f-titre); text-align: center; color: var(--or-vif);
  text-shadow: 0 0 18px rgba(255, 200, 90, .7), 0 3px 0 #6b4a12; animation: apparait .9s ease-out, flotte 3.2s ease-in-out .9s infinite;
  margin-bottom: 4px; letter-spacing: .02em;
}
.sous-titre { text-align: center; color: var(--doux); font-size: clamp(12px, 3.2vmin, 14px); margin-bottom: 10px }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 }
.perso { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start }
.perso > .apercu { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-inline: auto }
.perso > .options { flex: 1 1 220px; min-width: 0 }
.options b { font-size: .85em; color: var(--doux); letter-spacing: .05em; text-transform: uppercase }
.chip { width: clamp(28px, 8vmin, 36px); height: clamp(28px, 8vmin, 36px); border: 2px solid rgba(0, 0, 0, .4); border-radius: 50%; cursor: pointer; transition: transform .12s }
.chip:hover { transform: scale(1.1) }
.chip.sel { box-shadow: 0 0 0 2px var(--or-vif), 0 0 10px rgba(255, 223, 138, .6) }
.tabs { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 8px }
.card { background: rgba(0, 0, 0, .28); border: 1px solid rgba(232, 194, 106, .25); border-radius: 12px; padding: 8px; font-size: clamp(12px, 3.2vmin, 14px); display: flex; flex-direction: column; gap: 4px }
.card button { padding: .35em .6em; font-size: .9em; align-self: flex-start }
input[type=text] { font: 600 16px var(--f-texte); color: var(--texte); padding: 8px 10px; border: 1px solid var(--bord); border-radius: 10px; background: rgba(0, 0, 0, .35); width: 100% }
label { font-size: .85em; color: var(--doux) }
#preview { width: clamp(108px, 30vmin, 150px); aspect-ratio: 36 / 50; image-rendering: pixelated; height: auto; max-width: 100%; border: 1px solid var(--bord); border-radius: 12px; box-shadow: 0 0 20px rgba(232, 194, 106, .2) }
#netState { font-size: .78em; color: var(--doux); margin-top: 8px }

.reglage { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "b l p" "b r r"; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(232, 194, 106, .2) }
.reglage button { grid-area: b; width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 20px }
.reglage label { grid-area: l; font-weight: 700; color: var(--texte) }
.reglage .pct { grid-area: p; font-variant-numeric: tabular-nums; color: var(--or) }
.reglage input[type=range] { grid-area: r; width: 100%; accent-color: var(--or); height: 28px }
/* Commandes tactiles */
#controls { position: fixed; inset: auto 0 0 0; height: 0; z-index: 20; pointer-events: none }
#stick {
  pointer-events: auto; position: fixed; left: calc(var(--sa-l) + var(--pad) * 2); bottom: calc(var(--sa-b) + var(--pad) * 2);
  width: var(--stick); height: var(--stick); border-radius: 50%; touch-action: none;
  background: radial-gradient(circle, rgba(255,223,138,.10), rgba(30,24,52,.55)); border: 1px solid var(--bord);
  box-shadow: inset 0 0 18px rgba(0,0,0,.4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: .85;
}
#stick { opacity: .45; pointer-events: none }
#stick.actif { opacity: 1 }
/* 21/11 : zone du joystick flottant (moitié gauche, sous les boutons du haut et au-dessus de la barre d'outils) */
#joyZone { pointer-events: auto; position: fixed; left: 0; width: 50vw; top: 120px; bottom: calc(var(--sa-b) + 70px); touch-action: none; z-index: 0 }
@media (hover: hover) and (pointer: fine) { #joyZone { display: none } }
#knob { position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; margin: -21% 0 0 -21%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe7a6, #c99a3a); box-shadow: 0 3px 8px rgba(0,0,0,.5) }   /* 21/11 : plus de retard d'animation */
#droite { pointer-events: none; position: fixed; right: calc(var(--sa-r) + var(--pad) * 2); bottom: calc(var(--sa-b) + var(--pad) * 2);
  width: calc(var(--act) * 1.9); height: calc(var(--act) * 1.9) }
#droite button { pointer-events: auto; position: absolute; border-radius: 50%; padding: 0; touch-action: none;
  background: var(--verre); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 6px 16px rgba(0,0,0,.45) }
#bAct { right: 0; bottom: 0; width: var(--act); height: var(--act); font-size: calc(var(--act) * .42);
  border: 2px solid var(--or); background: radial-gradient(circle at 40% 30%, rgba(255,223,138,.35), rgba(30,24,52,.8)) !important }
.rond { width: calc(var(--act) * .62); height: calc(var(--act) * .62); font-size: calc(var(--act) * .28) }
#bItems { right: calc(var(--act) * .2); bottom: calc(var(--act) * 1.06) }
#bRecipes { right: calc(var(--act) * 1.08); bottom: calc(var(--act) * .12) }
#bQuests { right: calc(var(--act) * .98); bottom: calc(var(--act) * .92) }   /* 19/11 : quêtes, en diagonale au-dessus des recettes */   /* à gauche du bouton d'action (les outils sont dans la barre du bas) */
#droite button.presse, #bAct:active { transform: scale(.92); box-shadow: 0 0 18px rgba(255,223,138,.6) }
@media (hover: hover) and (pointer: fine) { #stick { display: none } }

/* Roues */
#ovWheel { background: radial-gradient(circle, rgba(20,14,36,.55), rgba(10,8,20,.8)) }
#wheelRing { position: absolute; left: 50%; top: 50%; width: 0; height: 0 }
#wheelCenter { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: clamp(96px, 26vmin, 140px); height: clamp(96px, 26vmin, 140px);
  border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px;
  background: var(--verre-fort); border: 1px solid var(--bord); color: var(--or-vif); font: 600 clamp(13px, 3.4vmin, 16px) var(--f-titre) }
#wheelCenter small { font: 600 .8em var(--f-texte); color: var(--doux); display: block; margin-top: 2px }
.wslot { position: absolute; width: var(--slot); height: var(--slot); transform: translate(-50%, -50%); border-radius: 50%; padding: 0;
  font-size: calc(var(--slot) * .46); display: flex; align-items: center; justify-content: center; background: var(--verre-fort);
  animation: pop .22s ease-out backwards }
.wslot.sel { border-color: var(--or-vif); box-shadow: 0 0 0 2px var(--or-vif), 0 0 16px rgba(255,223,138,.7) }
.wslot.vide { opacity: .35; border-style: dashed; animation-name: popVide }
.wslot b { position: absolute; right: 2px; bottom: 0; font: 800 calc(var(--slot) * .24) var(--f-texte); text-shadow: 0 1px 2px #000, 0 0 3px #000 }
.tier { position: absolute; left: 3px; top: 3px; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #0006 }
.t2 { --tc: #d9824a } .t3 { --tc: #c8ccd4 } .t4 { --tc: #ffd34a } .t5 { --tc: #b48cff }
.tier { background: var(--tc) }
.tierlbl { color: var(--tc, var(--doux)); font-weight: 800 }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.4) } to { opacity: 1; transform: translate(-50%, -50%) scale(1) } }
@keyframes popVide { from { opacity: 0; transform: translate(-50%, -50%) scale(.4) } to { opacity: .35; transform: translate(-50%, -50%) scale(1) } }

img.pix { width: 1.15em; height: 1.15em; image-rendering: pixelated; vertical-align: -0.2em; object-fit: contain }
.wslot img.pix, #bActIcon img.pix { width: 70%; height: 70% }
.wslot span, #bActIcon { display: flex; align-items: center; justify-content: center; width: 100%; height: 100% }
.wslot.apercu { transform: translate(-50%, -50%) scale(1.15); border-color: var(--or-vif); box-shadow: 0 0 14px rgba(255,223,138,.55) }
#wheelCenter strong { display: block; line-height: 1.15 }
#wheelCenter em { display: block; font: 600 .7em var(--f-texte); color: var(--or); margin-top: 4px; font-style: normal }
.affiche { background: #f4e6c4; color: #3b2414; border-color: #c9955a; box-shadow: 0 3px 0 #8a5a32; position: relative }
.affiche::before { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: #d8443a; box-shadow: 0 1px 2px #0006 }
.affiche small { color: #7a5a3a }
.affiche button { color: #3b2414; border-color: #a8774a; background: #e8d2a0 }
.affiche button.primaire { background: linear-gradient(180deg, #f2cf73, #c99a3a) }
.affiche.vide { background: rgba(0,0,0,.2); color: var(--doux); border-style: dashed; box-shadow: none }
.affiche.vide small { color: var(--doux) }
.delai { font: 600 1.3em var(--f-titre); color: var(--or) }

/* Carte */
.panel.carte { width: min(960px, 100%); display: flex; flex-direction: column; gap: 8px; height: min(92vh, 100%) }
#mapCv { flex: 1; width: 100%; min-height: 0; border-radius: 12px; border: 1px solid var(--bord); touch-action: none; image-rendering: pixelated; cursor: grab }
.zoom { justify-content: center; margin: 0 }
.zoom button { min-width: 48px }
#mapLvl { min-width: 3em; text-align: center; color: var(--or); font-variant-numeric: tabular-nums }

/* Menus */
.panel h3 { font: 600 clamp(15px, 4vmin, 18px) var(--f-titre); color: var(--or); margin: 14px 0 6px }
.panel h4 { font-size: .9em; color: var(--doux); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .05em }
.info { color: var(--doux); font-size: .88em; margin: 4px 0 8px }
.card .t { font-weight: 700 }
.card small { color: var(--doux) }
.xp { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; margin-bottom: 10px; align-items: center }
.xp .bar, .xp small { grid-column: 1 / -1 }
.vente { display: grid; grid-template-columns: 1fr 5em 5em; gap: 6px; margin-bottom: 6px }
.vente button { grid-column: 1 / -1 }
.vente select, .vente input { font: 600 16px var(--f-texte); color: var(--texte); padding: 8px; border: 1px solid var(--bord); border-radius: 10px; background: rgba(0,0,0,.35); min-width: 0; width: 100% }

/* Paysage sur téléphone : on libère la hauteur */
@media (max-height: 500px) and (orientation: landscape) {
  #hud { width: clamp(140px, 30vw, 220px) }
  #topbtns { flex-direction: row }
  :root { --stick: clamp(96px, 34vh, 150px); --act: clamp(62px, 22vh, 92px) }
}
@media (min-width: 900px) and (min-height: 600px) { #hud { font-size: 14px } }
@keyframes monte { from { opacity: 0; transform: translateY(8px) } to { opacity: 1 } }
@keyframes monteC { from { opacity: 0; transform: translate(-50%, 8px) } to { opacity: 1; transform: translate(-50%, 0) } }
@keyframes apparait { from { opacity: 0; filter: blur(8px) } to { opacity: 1; filter: none } }
@keyframes flotte { 50% { transform: translateY(-5px) } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important } }

/* ---------- Écran titre ---------- */
:root { --f-logo: "Rye", "Lilita One", serif }   /* Farmwest : lettres d’affiche western */
#ovTitle { background: #1d1a33; flex-direction: column; justify-content: space-between; padding-top: calc(var(--sa-t) + 6vh); padding-bottom: calc(var(--sa-b) + 5vh) }
#titleCv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: -1 }
#ovTitle::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(20,12,30,.55)) }
.titre-bloc { text-align: center; animation: apparait 1.4s ease-out both, flotte 3.4s ease-in-out 1.4s infinite }
.logo { margin: 0; font: 400 clamp(40px, 13vmin, 100px)/1 var(--f-logo); letter-spacing: .02em; white-space: nowrap }
.logo span { display: inline-block; color: #ffd35c;
  background: linear-gradient(180deg, #fff3b0 0%, #ffd35c 45%, #f2a02e 75%, #c8711c 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #6b3a12) drop-shadow(0 -2px 0 #6b3a12) drop-shadow(2px 0 0 #6b3a12) drop-shadow(-2px 0 0 #6b3a12) drop-shadow(0 6px 0 rgba(60,30,10,.6)) drop-shadow(0 0 14px rgba(255,200,90,.75));
  animation: rebond 2.6s ease-in-out calc(var(--i) * 90ms + 1.4s) infinite }
.logo-sous { margin-top: 8px; font: 600 clamp(13px, 3.6vmin, 20px) var(--f-titre); color: #fff6e0; text-shadow: 0 2px 0 #5a3418, 0 0 10px rgba(255,210,120,.8); letter-spacing: .12em }
#titleTap { font: 600 clamp(15px, 4.2vmin, 22px) var(--f-titre); color: #fff6e0; text-shadow: 0 2px 0 #3a2210, 0 0 12px rgba(255,210,120,.9); animation: clignote 1.6s ease-in-out infinite; cursor: pointer }
.titre-menu { display: flex; flex-direction: column; gap: 10px; width: min(320px, 82vw) }
.titre-menu button { font: 400 clamp(18px, 5vmin, 24px) var(--f-logo); letter-spacing: .03em; padding: .55em 1em; display: flex; align-items: center; gap: .6em; justify-content: center;
  background: linear-gradient(180deg, #a5703f, #7d4f29); color: #fff1d6; border: 2px solid #4a2b14; box-shadow: inset 0 2px 0 rgba(255,220,170,.35), 0 4px 0 #3a2210, 0 6px 14px rgba(0,0,0,.35);
  text-shadow: 0 2px 0 #3a2210; animation: monte .3s ease-out both; transition: transform .12s, filter .12s }
.titre-menu button.primaire { background: linear-gradient(180deg, #ffd96b, #e3a531); color: #4a2608; text-shadow: 0 1px 0 #fff0b8; border-color: #7a4a14 }
.titre-menu button:hover, .titre-menu button:focus-visible { transform: translateY(-2px) scale(1.03); filter: brightness(1.1) }
.titre-menu button:active { transform: translateY(2px) }
.howto { margin: 8px 0; padding-left: 1.1em; line-height: 1.55 }
.howto li { margin: 6px 0 }
#ovHowto, #ovSet { z-index: 45 }
.titre-jeu { font-family: var(--f-logo); font-weight: 400 }
@keyframes rebond { 0%, 70%, 100% { transform: none } 80% { transform: translateY(-6px) rotate(-3deg) } 90% { transform: translateY(1px) } }
@keyframes clignote { 50% { opacity: .35 } }
.tabs[hidden] { display: none }

/* ---------- Bulle de dialogue ---------- */
#dlg { position: fixed; left: 50%; bottom: calc(var(--sa-b) + var(--pad) * 2); transform: translateX(-50%); width: min(720px, calc(100vw - 24px)); z-index: 35;
  padding: 14px 18px 18px; background: rgba(18, 13, 32, .92); display: none; cursor: pointer }
#dlg.on { display: block; animation: monteC .2s ease-out }
#dlgName { font: 400 clamp(20px, 5.4vmin, 28px) var(--f-logo); letter-spacing: .03em; text-shadow: 0 0 10px currentColor, 0 2px 0 #1b1226; margin-bottom: 4px }
#dlgText { font: 600 clamp(16px, 4.2vmin, 20px)/1.4 var(--f-texte); color: #fdf6e8; text-shadow: 0 2px 2px rgba(0,0,0,.6); padding-right: 1.4em }
#dlgNext { position: absolute; right: 16px; bottom: 10px; color: var(--or-vif); font-size: 20px; animation: clignote 1s ease-in-out infinite }
#dlgChoices { display: flex; flex-direction: column; gap: 6px; margin-top: 8px }
#dlgChoices:empty { display: none }
#dlgChoices button { text-align: left; font-size: clamp(14px, 3.8vmin, 17px) }
#dlgChoices button::before { content: "▸ "; color: var(--or-vif) }
.pnj { display: grid; gap: 6px }
.pnj .nom { font: 400 1.35em var(--f-logo) }
.gouts { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: .92em }
.gouts b { color: var(--doux); font-weight: 700 }
.vie li { margin: 3px 0 3px 1.1em; color: var(--doux); font-size: .9em }
/* ---------- Demandes à code couleur (lot 7) ---------- */
.legende { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px }
.legende span { font-size: .82em; font-weight: 700; padding: .25em .6em; border-radius: 999px; background: color-mix(in srgb, var(--k) 25%, transparent); border: 1px solid var(--k); color: var(--texte) }
.jauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 8px; margin-bottom: 10px }
.jauge { border-left: 4px solid var(--k); background: rgba(0,0,0,.25); border-radius: 10px; padding: 6px 10px; font-size: .9em; display: grid; gap: 3px }
.jauge small { color: var(--doux) }
.affiche[style*="--k"] { border-left: 6px solid var(--k) }
.affiche .pastille { position: absolute; right: 6px; top: 4px; font-size: 1.1em }
.affiche[style*="--k"]::before { background: var(--k) }
#ovBoard .panel { width: min(760px, 100%) }
.etapes { margin: 6px 0 2px 1.2em; display: grid; gap: 4px }
.etapes .fait { color: #2e6a2a }   /* 19/11 : lisible sur le fond beige */
.etapes .encours { color: #7a2e08; font-weight: 700; background: rgba(232, 160, 60, .22); border-left: 3px solid #c0621a; padding: 1px 4px; border-radius: 4px }
.etapes .avenir { color: #6a5a4a }
.ecran { padding: 12px 0 4px; display: grid; gap: 4px }
.ecran small { color: var(--doux) }
/* Vie en cœurs, en haut au centre, seulement en combat */
#hearts { position: fixed; top: calc(var(--sa-t) + var(--pad)); left: 50%; transform: translateX(-50%); display: flex; gap: 4px; z-index: 30; padding: 6px 10px; border-radius: 12px; background: rgba(18,13,32,.7); border: 1px solid var(--bord) }
#hearts[hidden] { display: none }
#hearts i { width: clamp(18px, 5vmin, 26px); aspect-ratio: 1; clip-path: polygon(50% 92%, 6% 46%, 6% 22%, 24% 8%, 50% 26%, 76% 8%, 94% 22%, 94% 46%); background: #3a2a3e }
#hearts i.plein { background: linear-gradient(180deg, #ff8a8a, #e5534b 60%, #a8302b) }
#hearts i.demi { background: linear-gradient(90deg, #e5534b 50%, #3a2a3e 50%) }
@media (max-width: 600px) and (orientation: portrait) { #hearts { top: calc(var(--sa-t) + var(--pad) + 118px) } }

/* Réparation d'un bâtiment délabré (cabane, grange) */
#repairPanel { position: fixed; left: 50%; bottom: calc(var(--sa-b) + 130px); transform: translateX(-50%); z-index: 30; width: min(340px, 90vw);
  padding: 10px 14px; border-radius: 14px; background: var(--verre-fort); color: #fff6e0; font-size: clamp(12px, 3.3vmin, 15px); box-shadow: 0 6px 18px rgba(0,0,0,.35); pointer-events: none }
#repairPanel[hidden] { display: none }
#repairPanel b { display: block; margin-bottom: 6px; color: var(--or-vif) }
#repairPanel.done b { color: #7ee07a }
#repairPanel small { display: block; margin-top: 6px; opacity: .85 }
.rp-row { display: grid; grid-template-columns: 6.5em 1fr 3.6em 3.2em; gap: 8px; align-items: center; margin: 4px 0 }
.rp-bar { height: 10px; border-radius: 5px; background: rgba(255,255,255,.15); overflow: hidden }
.rp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #c9873a, #f2c832); transition: width .2s }
.rp-n { text-align: right; font-variant-numeric: tabular-nums }
.rp-n em { color: #3fd14a; font-style: normal; font-weight: 900; font-size: 1.2em }

/* Parties (solo / à plusieurs) */
.gp-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px }
.gp-list > button { text-align: left; padding: 12px 14px; font-size: clamp(14px, 3.8vmin, 17px) }
.gp-list button small { display: block; font-weight: 400; opacity: .8; font-size: .78em; margin-top: 2px }
.gp-join { display: flex; gap: 8px }
.gp-join input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.25); color: #fff6e0; font-size: 16px; text-transform: uppercase; letter-spacing: .06em }
.gp-off { opacity: .75 }

/* Sac en cases */
.inv-panel { width: min(560px, 94vw) }
.inv-main { display: flex; gap: 10px; margin-top: 8px }
.inv-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; touch-action: none; max-height: 52vh; overflow-y: auto }
.inv-cell { position: relative; aspect-ratio: 1; border-radius: 10px; border: 2px solid rgba(255,255,255,.14); background: rgba(0,0,0,.28); display: grid; place-items: center; padding: 0; font-size: 24px; cursor: grab; user-select: none }
.inv-cell.vide { border-style: dashed; opacity: .45; cursor: default }
.inv-cell b { position: absolute; right: 4px; bottom: 2px; font-size: 12px; color: #fff6e0; text-shadow: 0 1px 2px #000 }
.inv-cell.sel { border-color: #f2c832; box-shadow: 0 0 0 2px rgba(242,200,50,.35) }
.inv-cell.vu { border-color: #8fd0e8 }
.inv-cell img, .inv-cell span > * { max-width: 70%; image-rendering: pixelated }
.inv-side { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 74px }
.inv-side button { width: 100%; padding: 10px 4px; font-size: 13px; line-height: 1.3 }
.inv-side small { text-align: center; opacity: .8; font-size: 11px }
.inv-detail { margin-top: 10px; min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap }
.inv-detail small { display: block; opacity: .8 }
.inv-acts { display: flex; gap: 6px; flex-wrap: wrap }
.inv-ghost { position: fixed; z-index: 99; pointer-events: none; transform: translate(-50%, -50%) scale(1.3); font-size: 30px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)) }
@media (max-width: 420px) { .inv-main { flex-direction: column-reverse } .inv-side { width: 100%; flex-direction: row; justify-content: space-between } .inv-side button { width: auto; padding: 8px 14px } }
.gp-row { display: flex; gap: 8px; align-items: stretch }
.gp-row > button:first-child { flex: 1; text-align: left; padding: 12px 14px; font-size: clamp(14px, 3.8vmin, 17px) }
.gp-del { flex: 0 0 auto; min-width: 52px; padding: 0 10px; font-size: 18px }
.gp-del.arme { background: #a8302b; color: #fff; font-size: 13px; font-weight: 800 }

/* Jauges d'énergie et de vie : orange, rouge vif, tremblement près du rouge */
#hHp { background: linear-gradient(90deg, #b8202a, #e8404a, #ff8a8a) }
.bar.orange > i { background: linear-gradient(90deg, #c86a10, #f0a020, #ffd060) }
.bar.rouge > i { background: linear-gradient(90deg, #b00010, #ff2a2a, #ff7a6a); box-shadow: 0 0 8px #ff2a2a }
.bar.tremble { animation: tremble .35s ease-in-out infinite }
.bar.rouge.tremble { animation-duration: .2s }
@keyframes tremble { 0%, 100% { transform: translateX(0) } 25% { transform: translateX(-2px) rotate(-.6deg) } 75% { transform: translateX(2px) rotate(.6deg) } }
@media (prefers-reduced-motion: reduce) { .bar.tremble { animation: none } }

/* Bac de vente */
.sell-panel { width: min(560px, 94vw) }
.sell-tabs { display: flex; gap: 6px; margin: 8px 0 }
.sell-tabs button.on { background: var(--or-vif); color: #2a1a10 }
.sell-list { display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow-y: auto }
.sell-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.22); border: 2px solid transparent }
.sell-row.on { border-color: #f2c832 }
.sell-ic { font-size: 22px; width: 30px; text-align: center }
.sell-n { flex: 1; min-width: 0 } .sell-n small { display: block; opacity: .8 }
.sell-q { display: flex; align-items: center; gap: 6px } .sell-q b { min-width: 2ch; text-align: center }
.sell-q button { padding: 4px 10px } .sell-q .mini { font-size: 12px }
.sell-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap } .sell-foot span { flex: 1 }
.sell-log { max-height: 48vh; overflow-y: auto; padding-left: 18px; line-height: 1.6 }
.rec-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px }
.rec-tabs button { padding: 6px 12px; font-size: 14px }
.rec-tabs button.on { background: var(--or-vif); color: #2a1a10 }
.chest-panel { width: min(720px, 96vw) }
.chest-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
.chest-cols h3 { margin: 4px 0 6px; font-size: 15px } .chest-cols h3 small { opacity: .75; font-weight: 400 }
@media (max-width: 520px) { .chest-cols { grid-template-columns: 1fr } }

/* Énergie : 4 affichages possibles (réglage) */
#nrjArc, #nrjVert { display: none; pointer-events: none }
body[data-nrj="arc"] #nrjArc { display: block; position: absolute; right: calc(var(--act) * -.12); bottom: calc(var(--act) * -.12); width: calc(var(--act) * 1.24); height: calc(var(--act) * 1.24); transform: rotate(-90deg) }
#nrjArc circle { fill: none; stroke-width: 7 } #nrjArc .fond { stroke: rgba(0,0,0,.45) }
#nrjArc .val { stroke: #6fd04a; stroke-linecap: round; transition: stroke-dasharray .3s; filter: drop-shadow(0 0 3px rgba(111,208,74,.7)) }
#nrjArc.orange .val { stroke: #f0a020; filter: drop-shadow(0 0 3px #f0a020) } #nrjArc.rouge .val { stroke: #ff2a2a; filter: drop-shadow(0 0 5px #ff2a2a) }
body[data-nrj="vert"] #nrjVert { display: block; position: fixed; right: calc(var(--sa-r) + var(--pad) * 2 + var(--act) * 1.9 + 10px); bottom: calc(var(--sa-b) + var(--pad) * 2); width: 16px; height: calc(var(--act) * 1.6);
  border-radius: 9px; background: rgba(0,0,0,.45); border: 2px solid var(--or); overflow: hidden }
#nrjVert i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, #3e9a32, #a6e36e); transition: height .3s }
#nrjVert.orange i { background: linear-gradient(0deg, #c86a10, #ffd060) } #nrjVert.rouge i { background: linear-gradient(0deg, #b00010, #ff7a6a); box-shadow: 0 0 8px #ff2a2a }
#nrjVert b { position: absolute; top: -2px; left: 0; right: 0; text-align: center; font-size: 11px }
#nrjArc.tremble, #nrjVert.tremble { animation: tremble .35s ease-in-out infinite }
body[data-nrj="arc"] #nrjArc.tremble { animation: trembleArc .3s ease-in-out infinite }
@keyframes trembleArc { 0%, 100% { transform: rotate(-90deg) } 25% { transform: rotate(-93deg) translateX(1px) } 75% { transform: rotate(-87deg) translateX(-1px) } }
body:not([data-nrj="haut"]) #hEnBar, body:not([data-nrj="haut"]) #hud .lbl:first-of-type { display: none }

/* Combat de pêche */
#fishFight { position: fixed; z-index: 40; right: calc(var(--sa-r) + 20px); top: 50%; transform: translateY(-50%); display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-radius: 16px;
  background: var(--verre-fort); box-shadow: 0 6px 20px rgba(0,0,0,.4); touch-action: none; user-select: none; flex-wrap: wrap; width: 110px; justify-content: center }
#fishFight[hidden] { display: none }
.ff-track { position: relative; width: 44px; height: min(52vh, 320px); border-radius: 12px; background: linear-gradient(#2f7ab8, #1c4a74); border: 3px solid #8a5a32; overflow: hidden }
.ff-bar { position: absolute; left: 3px; right: 3px; border-radius: 8px; background: rgba(140,230,110,.55); border: 2px solid #8ce66e }
.ff-bar.dedans { background: rgba(160,255,120,.8); box-shadow: 0 0 10px #8ce66e }
.ff-fish { position: absolute; left: 50%; transform: translateX(-50%); font-size: 22px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)) }
.ff-prog { position: relative; width: 12px; height: min(52vh, 320px); border-radius: 6px; background: rgba(0,0,0,.4); overflow: hidden }
.ff-prog i { position: absolute; left: 0; right: 0; bottom: 0; transition: height .1s }
#fishFight small { width: 100%; text-align: center; color: #fff6e0; font-size: 11px }
.fish-list { display: flex; flex-direction: column; gap: 6px; max-height: 56vh; overflow-y: auto }
.fish-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.22) }
.fish-row .fi { font-size: 26px } .fish-row small { display: block; opacity: .85 } .fish-row.inconnu { opacity: .6 }

/* Stands du parc */
#parcGame { position: fixed; z-index: 40; left: 50%; bottom: calc(var(--sa-b) + 120px); transform: translateX(-50%); width: min(380px, 92vw); padding: 12px 14px; border-radius: 16px;
  background: var(--verre-fort); color: #fff6e0; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.4); touch-action: none }
#parcGame[hidden] { display: none } #parcGame b { color: var(--or-vif) } #parcGame small { opacity: .85 }
.pg-track { position: relative; height: 26px; border-radius: 13px; background: rgba(0,0,0,.4); overflow: hidden }
.pg-zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(#ffe28a, #c9a330) }
.pg-cur { position: absolute; top: -2px; bottom: -2px; width: 6px; border-radius: 3px; background: #fff; box-shadow: 0 0 6px #fff }
#pgScore { min-height: 1.2em; text-align: center; font-size: 18px }
body.admin #bSet::after { content: '🛠️'; position: absolute; font-size: 11px; transform: translate(10px, -12px); }

/* Quêtes : principales à gauche, secondaires à droite (une colonne sur téléphone en portrait) */
.quetes-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start }
.quetes-cols h3 { margin-top: 0 }
@media (max-width: 600px) { .quetes-cols { grid-template-columns: 1fr } }

/* Barre d'outils toujours visible, en bas au centre (entre le joystick et les boutons) */
#hotbar { pointer-events: auto; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sa-b) + var(--pad) * 2);
  display: flex; gap: 4px; padding: 5px; border-radius: 14px; background: var(--verre); border: 1px solid var(--bord);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 6px 16px rgba(0,0,0,.45);
  max-width: calc(100vw - var(--stick) - var(--act) * 2.2 - var(--pad) * 8) }
#hotbar:empty { display: none }
#hotbar button { position: relative; width: clamp(36px, 7vmin, 50px); aspect-ratio: 1; padding: 0; border-radius: 9px; flex: 0 1 auto; min-width: 30px;
  display: grid; place-items: center; font-size: clamp(16px, 3.6vmin, 24px); background: rgba(20,16,36,.55); border: 2px solid transparent; touch-action: none }
#hotbar button img.pix { width: 78%; height: 78%; image-rendering: pixelated; pointer-events: none }
#hotbar button small { position: absolute; left: 3px; top: 1px; font-size: 9px; opacity: .7; pointer-events: none }
#hotbar button.on { border-color: #ffdf8a; background: rgba(255,223,138,.22); box-shadow: 0 0 10px rgba(255,223,138,.5) }
/* Téléphone en portrait : pas de place entre les commandes → la barre passe juste au-dessus */
@media (max-aspect-ratio: 1/1) { #hotbar { bottom: calc(var(--sa-b) + var(--pad) * 3 + var(--act) * 1.95); max-width: calc(100vw - var(--pad) * 4) } }

/* ============ Farmwest 7f : interface en bois et affiche western ============ */
:root {
  --bois: #5b3a22; --bois-clair: #8a5a32; --bois-fonce: #2e1c10;
  --verre: rgba(46, 28, 16, .9); --verre-fort: rgba(40, 24, 13, .96);
  --bord: #c9955a; --doux: #d9c4a0;
  --planches: repeating-linear-gradient(180deg, rgba(255, 220, 160, .05) 0 7px, rgba(0, 0, 0, .18) 7px 8px);
}
.box {
  background: var(--planches), var(--verre); border: 3px solid var(--bois-fonce); border-radius: 6px;
  box-shadow: 0 0 0 2px var(--bord), 0 0 0 4px var(--bois-fonce), 0 8px 22px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 220, 160, .15);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.panel { background: var(--planches), var(--verre-fort) }
.panel h2, .panel h3 { font-family: "Rye", var(--f-titre); color: var(--or-vif); letter-spacing: .02em; text-shadow: 0 2px 0 var(--bois-fonce) }
button {
  background: linear-gradient(180deg, #a8774a, #7a4f2e); border: 2px solid var(--bois-fonce); border-radius: 5px;
  box-shadow: inset 0 2px 0 rgba(255, 220, 160, .35), inset 0 -2px 0 rgba(0, 0, 0, .3), 0 2px 0 var(--bois-fonce);
  color: #fff6e0; text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}
button:hover { background: linear-gradient(180deg, #c99560, #8a5a32); box-shadow: inset 0 2px 0 rgba(255, 220, 160, .45), 0 2px 0 var(--bois-fonce), 0 0 10px rgba(232, 194, 106, .35) }
button.on, button.primaire { background: linear-gradient(180deg, #e8c26a, #c9953a); color: #3a2410; text-shadow: 0 1px 0 rgba(255, 246, 220, .6) }
/* cartes en papier d'affiche (parchemin) */
.card { background: linear-gradient(180deg, #f4e6c4, #e8d4a6); color: #3a2410; border: 2px solid #a8774a; border-radius: 4px; box-shadow: 0 2px 0 rgba(0, 0, 0, .35) }
.card small { color: #6a4a2a }
.card .t b { color: #3a2410 }
.card .bar { background: rgba(90, 58, 34, .35); border-color: #a8774a }
img.pix { image-rendering: pixelated; width: 1.5em; height: 1.5em; vertical-align: middle }
#dlg { background: linear-gradient(180deg, #f4e6c4, #e4cc98); color: #3a2410; border-color: var(--bois-fonce) }
#dlg #dlgText { color: #3a2410 }
#dlg #dlgName { color: #fff6e0; background: var(--bois); border: 2px solid var(--bois-fonce); border-radius: 4px; padding: 0 .5em; display: inline-block }

/* Intro : rien d'autre que la bulle et les boutons « accélérer » / « passer » */
#introBar { position: fixed; top: calc(var(--sa-t) + var(--pad)); right: calc(var(--sa-r) + var(--pad)); z-index: 40; display: none; gap: 8px }
body.intro #introBar { display: flex }
body.intro #hud, body.intro #topbtns, body.intro #controls, body.intro #hearts { display: none !important }
#bIntroFast.on { background: linear-gradient(180deg, #e8c26a, #c9953a); color: #3a2410 }
#introBar button { font-size: clamp(12px, 3.2vmin, 15px); touch-action: none }

/* ============ Lot 8 : barre d'outils dans une bande SOUS la scène (elle ne cache plus le bas du jeu) ============ */
:root { --bande: calc(clamp(48px, 8.5vmin, 62px) + var(--sa-b)) }
#game { width: 100%; height: 100% }
body.bande #game { inset: 0 0 auto 0; height: calc(100% - var(--bande)) }
body.bande #hotbar { left: 0; right: 0; bottom: 0; transform: none; height: var(--bande); max-width: none; justify-content: center; align-items: center;
  padding: 4px var(--pad) calc(4px + var(--sa-b)); border-radius: 0; border: 0; border-top: 3px solid var(--bois-fonce, #2e1c10);
  background: var(--planches, #5b3a22), #5b3a22; box-shadow: 0 -4px 12px rgba(0,0,0,.4) }
body.bande #hotbar button { width: clamp(36px, 7vmin, 50px) }
body.bande #stick, body.bande #droite { bottom: calc(var(--bande) + var(--pad) * 2) }
body.bande[data-nrj="vert"] #nrjVert { bottom: calc(var(--bande) + var(--pad) * 2) }
@media (max-aspect-ratio: 1/1) { body.bande #hotbar { bottom: 0; max-width: none } }

/* ============ Lot 8 : transition de la nuit (énergie qui remonte, rêve, sauvegarde) ============ */
#ovNight { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; background: radial-gradient(ellipse at 50% 30%, #1c2346, #07081a 70%); color: #e8ecff; opacity: 0; transition: opacity .5s }
#ovNight.on { display: grid; opacity: 1; animation: nuitIn .6s ease }
@keyframes nuitIn { from { opacity: 0 } to { opacity: 1 } }
#ovNight .nuit-ciel { position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 12% 20%, #fff, transparent), radial-gradient(1px 1px at 70% 15%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 35%, #ffe9b0, transparent), radial-gradient(1px 1px at 85% 45%, #fff, transparent), radial-gradient(1px 1px at 25% 60%, #cfe0ff, transparent), radial-gradient(1px 1px at 60% 70%, #fff, transparent); opacity: .8 }
#ovNight .nuit-box { position: relative; width: min(520px, 88vw); text-align: center; padding: 18px }
#ovNight .nuit-lune { font-size: 46px; filter: drop-shadow(0 0 14px rgba(255,230,160,.6)) }
#ovNight .nuit-reve { min-height: 4.5em; font-style: italic; font-size: clamp(15px, 2.6vmin, 19px); line-height: 1.45; color: #dfe4ff; margin: 12px 0 18px }
#ovNight .nuit-nrj { display: flex; align-items: center; gap: 8px; justify-content: center }
#ovNight .nuit-barre { width: min(280px, 60vw); height: 12px; border-radius: 6px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,223,138,.4); overflow: hidden }
#ovNight .nuit-barre i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f2c25a, #7ad04a) }
#ovNight .nuit-nrj b { font-variant-numeric: tabular-nums; min-width: 72px; text-align: left; color: #ffdf8a }
#ovNight .nuit-save { display: block; margin-top: 14px; min-height: 1.2em; opacity: .85 }

/* Lot 8 : barre d'XP fine sous le nom, avec le niveau */
#hXpRow { display: flex; align-items: center; gap: 6px; margin: 2px 0 3px }
#hLvl { font-size: 11px; color: var(--or-vif, #ffdf8a); white-space: nowrap; min-width: 40px }
#hXpRow .bar.xp { flex: 1; height: 4px; margin: 0; background: rgba(255,255,255,.12) }
#hXpRow .bar.xp i { background: linear-gradient(90deg, #8ac8ff, #c8a8ff) }

/* Début de partie : la bulle de dialogue en haut, sous les boutons ⏩ ⏭ (la scène reste visible) */
@media (max-aspect-ratio: 1/1) { #dlg.haut { top: calc(var(--sa-t) + 52px); bottom: auto } }   /* téléphone en portrait : la place libre est en haut */
.pnj .tete { display: flex; align-items: center; gap: 12px }
.pnj .portrait { flex: none; image-rendering: pixelated; border-radius: 6px; background-color: #e8dcc0 !important; border: 2px solid #6a4a2a; }

/* 19/11 : journal de la cabane */
.journal { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px }
.journal li { padding: 3px 6px; border-bottom: 1px solid rgba(120, 80, 40, .2) }
.journal small { display: block; opacity: .75 }
/* 19/11 : étal de vente */
.st-pick { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 }
.st-it { display: flex; flex-direction: column; align-items: center; padding: 3px 5px; min-width: 40px }
.st-it.on { outline: 2px solid #ffe08a }
.st-form { display: grid; gap: 6px; margin: 6px 0; padding: 8px; background: rgba(0, 0, 0, .2); border-radius: 8px }
.st-prix { display: flex; gap: 4px; flex-wrap: wrap }
.st-prix button.on { background: #e8c26a; color: #3a2410 }

/* 19/11 : cadre météo / argent (20/11 : toujours affiché) */
#hud { transition: opacity .3s; width: auto; max-width: clamp(130px, 34vmin, 190px); padding: calc(var(--pad) * .6) var(--pad); font-size: clamp(10px, 2.6vmin, 12.5px); line-height: 1.25 }   /* 19/11 : plus petit, s'efface plus vite */
#hud.repos { opacity: 0; pointer-events: none }
#hXpRow[hidden], #hName[hidden] { display: none !important }
.profil { display: flex; gap: 10px; align-items: center; margin: 0 0 8px }
.profil .bar { flex: 1; max-width: 220px }

/* 19/11 : icônes d'objets plus grandes dans le sac et les listes */
.card .t img.pix, .sell-ic img.pix, .st-it img.pix { width: 2.4em; height: 2.4em; vertical-align: middle }
.rp-sac { min-width: 3.2em; text-align: right; opacity: .9; font-size: .9em }
/* 19/11 : petits écrans — la barre du titre (avec la croix ✕) reste toujours visible en haut des fenêtres,
   et le bouton « Commencer ▶ » reste visible en bas de la création du personnage. */
.panel { --pp: clamp(12px, 3.5vmin, 20px); max-height: 100dvh; -webkit-overflow-scrolling: touch; overscroll-behavior: contain }
.panel > .row:first-child, .sell-panel > .row:first-child { position: sticky; top: calc(-1 * var(--pp)); z-index: 6; margin: calc(-1 * var(--pp)) calc(-1 * var(--pp)) 6px !important; padding: var(--pp) var(--pp) 8px; background: var(--planches), #3b2616; box-shadow: 0 6px 8px -6px rgba(0, 0, 0, .6) }
#ovLook .panel > .start-row { position: sticky; bottom: calc(-1 * var(--pp)); z-index: 6; margin: 12px calc(-1 * var(--pp)) calc(-1 * var(--pp)) !important; padding: 10px var(--pp) var(--pp); background: var(--planches), #3b2616; box-shadow: 0 -6px 8px -6px rgba(0, 0, 0, .6) }
/* 19/11 : le grand panneau de la place */
.cal-meteo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.cal-day { background: rgba(255,255,255,.08); border-radius: 8px; padding: 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }

/* 20/11 : vie et énergie toujours visibles en haut à droite, à gauche de la colonne de boutons */
#vitals { position: fixed; top: calc(var(--sa-t) + var(--pad)); right: calc(var(--sa-r) + var(--pad) * 2 + clamp(40px, 11vmin, 52px)); z-index: 20; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; min-width: 110px; pointer-events: none }
#vitals .v-row { display: flex; align-items: center; gap: 5px; font-size: 12px }
#vitals .bar { flex: 1; height: 7px; margin: 0 }
#vitals #vHp { background: linear-gradient(90deg, #c83a3a, #f06a5a) }
@media (max-height: 500px) and (orientation: landscape) { #vitals { top: calc(var(--sa-t) + var(--pad) * 2 + clamp(40px, 11vmin, 52px)); right: calc(var(--sa-r) + var(--pad)) } }
@media (pointer: coarse) { #dlg.haut { top: calc(var(--sa-t) + 52px); bottom: auto } }   /* 20/11 : sur téléphone (même en paysage), les bulles du tuto restent en haut */
#vitals #vEn { background: linear-gradient(90deg, #3e9a32, var(--energie), #a6e36e) } #vitals .bar i { display: block; height: 100% }
.st-prix { display: flex; align-items: center; gap: 6px; margin: 6px 0 } .st-prix input[type=range] { flex: 1 }
.pot-slots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 } .pot-slot { width: 46px; height: 46px; padding: 0; border-radius: 50% }
.st-form .st-prix button { width: auto; flex: none; min-width: 40px } .st-prix span { min-width: 70px }

/* Lot 30a : écran de combat au tour par tour */
.battle { width: min(560px, 96vw); padding: 10px; display: flex; flex-direction: column; gap: 8px }
.battle canvas { width: 100%; aspect-ratio: 320 / 150; image-rendering: pixelated; border-radius: 8px; border: 2px solid var(--bord) }
.bt-foes { display: flex; gap: 6px; flex-wrap: wrap }
.bt-foe { flex: 1 1 120px; min-width: 0; font-size: 13px }
.bt-foe.ko { opacity: .4 }
.bt-log { min-height: 3.6em; font-size: 13px; color: var(--doux); line-height: 1.25 }
.bt-log div:last-child { color: var(--texte) }
.bt-hero { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; font-size: 13px }
.bt-hero b { grid-row: span 3 }
.bt-bar { position: relative; height: 12px; background: rgba(0, 0, 0, .45); border-radius: 6px; overflow: hidden }
.bt-bar i { position: absolute; inset: 0 auto 0 0; background: var(--vie); transition: width .15s }
.bt-bar.nrj i { background: var(--energie) }
.bt-bar.atb { height: 6px } .bt-bar.atb i { background: var(--or); transition: none }
.bt-bar.atb.pleine i { background: var(--or-vif); box-shadow: 0 0 6px var(--or-vif) }
.bt-bar span { position: absolute; left: 6px; top: -1px; font-size: 10px; line-height: 14px; color: #fff; text-shadow: 0 1px 1px #000 }
.bt-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px }
.bt-menu .info { grid-column: 1 / -1; margin: 0 }
.bt-allies { display: flex; gap: 6px; flex-wrap: wrap } .bt-allies:empty { display: none }
#bJoinFight { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); z-index: 30; animation: pulse 1.2s ease-in-out infinite alternate }
@keyframes pulse { to { filter: brightness(1.25) } }
@media (prefers-reduced-motion: reduce) { #bJoinFight { animation: none } }

/* 21/11 : cadres du haut translucides quand le héros passe dessous */
#hud, #vitals, #topbtns { transition: opacity .25s }
#hud.voile:not(.repos), #vitals.voile, #topbtns.voile { opacity: .3 }
/* 22/11 : récapitulatif des ventes de l'étal, la nuit */
#ovNight .nuit-ventes { margin: 4px auto 14px; padding: 10px 14px; max-width: 360px; text-align: left; background: rgba(255,223,138,.08); border: 1px solid rgba(255,223,138,.35); border-radius: 10px }
#ovNight .nuit-ventes h3 { margin: 0 0 4px; font-size: 15px; color: #ffdf8a }
#ovNight .nuit-ventes p { margin: 0 0 6px }
#ovNight .nuit-total { color: #9ae070; font-size: 17px }
#ovNight .nuit-ventes ul { list-style: none; margin: 0; padding: 0; max-height: 9.5em; overflow-y: auto; font-size: 13px }
#ovNight .nuit-ventes li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; border-top: 1px dashed rgba(255,255,255,.12) }
#ovNight .nuit-ventes li b { color: #9ae070; font-variant-numeric: tabular-nums }
/* 22/11 : l'étal façon Hay Day — le sac à gauche, les étalages (caisses) à droite, deux onglets */
.etal-panel { width: min(640px, 96vw) }
.etal-tabs { display: flex; gap: 6px; margin: 4px 0 8px } .etal-tabs button { flex: 1 } .etal-tabs button.on { background: #e8c26a; color: #3a2410 }
.etal-grille { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; align-items: start }
.etal-grille h3 { margin: 2px 0 6px; font-size: 14px } .etal-grille h3 small { opacity: .7; font-weight: 400 }
.etal-sac, .etal-etals { background: rgba(0,0,0,.18); border-radius: 10px; padding: 8px }
.etal-objets { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 4px; max-height: 42vh; overflow-y: auto }
.etal-it { display: flex; flex-direction: column; align-items: center; padding: 3px 2px; min-width: 0 } .etal-it.on { outline: 2px solid #ffe08a; background: rgba(255,224,138,.18) }
.etal-it img.pix, .caisse img.pix { width: 2.2em; height: 2.2em }
.etal-etals { background: linear-gradient(#7a4f2e, #5a3a22); border: 2px solid #3f2615 }
.etal-caisses { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px } .etal-caisses.eux { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) }
.caisse { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; min-height: 96px; border-radius: 6px; background: #c99560; color: #3a2410; border: 2px solid #8a5a32; box-shadow: inset 0 -6px 0 #a8774a; text-align: center; font-size: 12px }
.caisse b { font-size: 12px } .caisse small { opacity: .85 } .caisse .mini { margin-top: auto }
.caisse.vide { background: rgba(255,255,255,.08); color: #f4ead2; border-style: dashed; border-color: #c99560; box-shadow: none; justify-content: center; width: auto }
.caisse.vide span { font-size: 26px; line-height: 1 } .caisse.vide.prete { background: rgba(255,224,138,.22); border-color: #ffe08a }
.etal-tot { color: #9ae070 }
.tuto { animation: tutoPulse 1s ease-in-out infinite; outline: 3px solid #ffe08a !important }
@keyframes tutoPulse { 50% { box-shadow: 0 0 0 6px rgba(255,224,138,.35) } }
@media (max-width: 520px) { .etal-grille { grid-template-columns: 1fr 1.15fr; gap: 6px } .etal-caisses { grid-template-columns: 1fr } .etal-objets { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)) } }
#dlg.tuto { top: calc(var(--sa-t, 0px) + 52px); bottom: auto }   /* 22/11 : bulles du tuto en haut, aussi sur grand écran */
/* 24/11 : barre d'XP sous la vie, en haut à droite, avec le niveau dans une pastille */
#vitals #vXpRow .bar.xp i { background: linear-gradient(90deg, #8ac8ff, #c8a8ff) }
#vitals .v-lvl { min-width: 16px; height: 16px; border-radius: 8px; background: #6a4fb0; color: #fff; font-size: 10px; font-weight: bold; display: inline-flex; align-items: center; justify-content: center; line-height: 1 }
/* 24/11 : application installable — bouton d'installation (écran titre) et voile « paysage » sur téléphone tenu droit */
.install-btn { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5; padding: 8px 16px; border-radius: 10px; border: 2px solid #3f2615; background: #e8b860; color: #3b2414; font: bold 15px "Pixelify Sans", sans-serif; box-shadow: 0 3px 0 #3f2615 }
#tourne { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(30,18,10,.92); color: #f4ead2; text-align: center; flex-direction: column; align-items: center; justify-content: center; font: 16px "Pixelify Sans", sans-serif; pointer-events: none }
#tourne.on { display: flex }
#tourne div { font-size: 54px; margin-bottom: 12px; animation: tourne 1.6s ease-in-out infinite }
@keyframes tourne { 0%, 30% { transform: rotate(0) } 60%, 100% { transform: rotate(90deg) } }
/* 25/11 : barre rapide d'objets (mode outil automatique) */
#hotbar button.vide { opacity: .4 }
#hotbar button.ajout { font-size: 20px; opacity: .8 }
