/* ===== POTATO VALLEY — feuille de style ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #0b1d3a; overflow: hidden;
  font-family: 'Courier New', Consolas, monospace; color: #3b2410; user-select: none; }
.hidden { display: none !important; }
#stage { position: fixed; inset: 0; }
#app { position: absolute; left: 0; top: 0; width: 960px; height: 640px;
  transform-origin: 0 0; overflow: hidden; background: #000; }
canvas { display: block; position: absolute; left: 0; top: 0; image-rendering: pixelated; }
button { font-family: inherit; cursor: pointer; }
.small { font-size: 11px; opacity: .85; }

/* ----- Panneaux façon parchemin ----- */
.panel { background: #f6dfaa; border: 4px solid #8a4a1c; border-radius: 6px;
  box-shadow: inset 0 0 0 2px #fff0c8, 0 3px 0 #4a2a10; padding: 6px 10px; }

/* ----- MENU ----- */
#menu { position: absolute; inset: 0; }
#logo { position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 470px; padding: 12px 10px 4px; text-align: center;
  background: repeating-linear-gradient(180deg, #ecbc72 0 30px, #c98f48 30px 32px);
  border: 6px solid #7a4318; border-radius: 12px;
  box-shadow: inset 0 0 0 3px #e0a050, 0 6px 0 #4a2a10, 0 14px 24px rgba(0,0,0,.35); }
.lt { font-family: Impact, 'Arial Black', sans-serif; font-size: 64px; line-height: 66px;
  letter-spacing: 5px; color: #e2682a;
  text-shadow: 3px 0 #7a2a0e, -3px 0 #7a2a0e, 0 3px #7a2a0e, 0 -3px #7a2a0e,
    3px 3px #7a2a0e, -3px -3px #7a2a0e, 3px -3px #7a2a0e, -3px 3px #7a2a0e, 0 6px 0 #4a1a08; }
.leaf { position: absolute; font-size: 30px; }
.l1 { left: -14px; top: -14px; transform: rotate(-30deg); }
.l2 { right: -10px; top: -16px; transform: rotate(40deg); }
.l3 { right: 70px; bottom: -6px; transform: rotate(120deg); }
#menuInfo { position: absolute; left: 50%; transform: translateX(-50%); bottom: 130px;
  color: #fff; font-weight: bold; text-shadow: 2px 2px 0 #1a3a6a; font-size: 15px; text-align: center; min-height: 20px; }
#menuButtons { position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; }
.mbtn { width: 98px; height: 76px; background: linear-gradient(#f6d79a, #d9a35a);
  border: 4px solid #8a4a1c; border-radius: 4px;
  box-shadow: inset 0 0 0 2px #f9e6b8, 0 4px 0 #4a2a10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; transition: transform .08s; }
.mbtn span { font-size: 15px; font-weight: bold; color: #e24a5a;
  text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; }
.mbtn i { font-style: normal; font-size: 20px; }
.mbtn:hover { transform: translateY(-4px); background: linear-gradient(#fff0c8, #f0c27a); }
.mbtn:active { transform: translateY(1px); }
#credit { position: absolute; bottom: 8px; width: 100%; text-align: center; font-size: 11px;
  color: #0b4a6a; opacity: .8; }

/* ----- HUD ----- */
/* panneaux du haut légèrement translucides pour laisser voir le décor */
#gameLayer .panel { background: rgba(246,223,170,.62); border-color: rgba(138,74,28,.5); box-shadow: inset 0 0 0 2px rgba(255,240,200,.4), 0 3px 0 rgba(74,42,16,.3); }   /* bords bruns translucides : on voit mieux le décor derrière */
#hudDate { position: absolute; left: 8px; top: 8px; min-width: 150px; line-height: 1.35; }
#dDay { font-weight: bold; font-size: 15px; }
#dClock { font-size: 20px; font-weight: bold; color: #7a2a0e; }
/* panneau argent : centré en haut de l'écran */
#hudGold { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 230px; text-align: center; }
/* panneau des statistiques : remonté en haut à droite */
#hudRight { position: absolute; right: 8px; top: 8px; width: 210px; display: flex; flex-direction: column; gap: 6px; }
.goldline { font-size: 20px; text-align: center; }
.bar { flex: 1; height: 12px; background: #5a3a1d; border: 2px solid #3b2410; border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0%; transition: width .2s; }
.barrow { display: flex; align-items: center; gap: 4px; margin: 3px 0; font-size: 12px; }
.barrow span { width: 18px; }
.barrow em { font-style: normal; width: 64px; text-align: right; font-size: 11px; }
#toasts { position: absolute; left: 8px; bottom: 36px; width: 290px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; pointer-events: none; }   /* en bas à gauche, au-dessus de l'aide : ne cache plus le jeu */
.toast { background: rgba(246,223,170,.62); color: #3b2410; padding: 2px 8px; border-radius: 4px; border: 2px solid rgba(138,74,28,.5); box-shadow: inset 0 0 0 1px rgba(255,240,200,.4);
  font-size: 11px; line-height: 1.3; animation: tin .2s; text-align: left; }      /* même look translucide que les panneaux de l'interface */
.toast b { color: #7a2a0e; }
.toast.good { border-color: rgba(72,150,44,.8); } .toast.bad { border-color: rgba(205,64,52,.85); } .toast.gold { border-color: rgba(214,160,20,.9); color: #5a3a00; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#selName { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%);
  color: #fff; font-weight: bold; font-size: 13px; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
/* la barre d'objets passe sur 2 lignes quand il y a beaucoup d'outils / armes */
#hotbar { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px;
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; max-width: min(900px, calc(100vw - 24px));
  padding: 4px; background: rgba(201,143,72,.55); border: 4px solid rgba(122,67,24,.85); border-radius: 6px; box-shadow: 0 3px 0 #4a2a10; }
.slot { position: relative; width: 44px; height: 44px; background: rgba(240,217,160,.6); border: 3px solid rgba(160,106,48,.9);
  border-radius: 3px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
/* barre de munitions / rechargement sous l'icône d'une arme */
.slot .wbar { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 5px; background: #3b2410; border-radius: 2px; overflow: hidden; }
.slot .wbar > i { display: block; height: 100%; width: 100%; background: #ffd84a; }
/* jauge d'eau de l'arrosoir : barre bleue + quantité restante */
.slot .wbar.water > i { background: #3a9be8; transition: width .15s; }
.slot .cnt.wcnt { bottom: 8px; color: #0e3f7a; }
/* bandeau de raid */
#raidBox { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); white-space: nowrap; font-size: 13px;
  background: rgba(120,20,20,.85) !important; border-color: #ff6b5a; color: #fff; text-shadow: 1px 1px 0 #000; animation: raidpulse 1s infinite alternate; }
@keyframes raidpulse { from { box-shadow: inset 0 0 0 2px #ffb0a8, 0 0 0 rgba(255,60,40,0); } to { box-shadow: inset 0 0 0 2px #ffb0a8, 0 0 14px rgba(255,60,40,.9); } }
.slot.sel { border-color: #e22; background: rgba(255,243,196,.8); box-shadow: 0 0 0 2px #fff inset; }
.slot .key { position: absolute; left: 2px; top: 0; font-size: 10px; font-weight: bold; color: #7a4318; }
.slot .pdot { position: absolute; left: 3px; bottom: 3px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #3b2410; box-shadow: 0 0 0 1px #fff3d0; }
.slot .cnt { position: absolute; right: 2px; bottom: 0; font-size: 12px; font-weight: bold; color: #222;
  text-shadow: 1px 1px 0 #fff; }
.ico { width: 32px; height: 32px; image-rendering: pixelated; position: static; flex: none; }
#hint { position: absolute; left: 8px; bottom: 4px; font-size: 10px; color: #fff; opacity: .75;
  text-shadow: 1px 1px 0 #000; max-width: 220px; line-height: 1.2; }

/* ----- Fenêtres ----- */
#modal { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
#modalBox { width: 740px; max-height: 600px; overflow-y: auto; padding: 14px 18px; font-size: 14px; }
#modalBox h2 { font-size: 22px; color: #7a2a0e; margin-bottom: 6px; }
#modalBox h3 { font-size: 15px; margin: 8px 0 4px; color: #7a4318; }
#modalBox p { margin: 4px 0; line-height: 1.4; }
.row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 2px dotted #c9a25a; }
.row .info { flex: 1; } .row .price { width: 80px; text-align: right; font-weight: bold; }
.btn { background: linear-gradient(#8ed06a, #4fa83d); border: 3px solid #2d6a22; color: #fff; font-weight: bold;
  padding: 4px 10px; border-radius: 4px; text-shadow: 1px 1px 0 #1d4a14; font-size: 13px; }
.btn:hover { filter: brightness(1.12); } .btn:disabled { filter: grayscale(1) brightness(.9); cursor: not-allowed; }
.btn.red { background: linear-gradient(#f08a7a, #c0392b); border-color: #7a1f14; text-shadow: 1px 1px 0 #5a140c; }
.btn.blue { background: linear-gradient(#7ab8f0, #2f7fc9); border-color: #1d4a7a; text-shadow: 1px 1px 0 #123a62; }
.btn.tab { background: #d9b070; border-color: #8a4a1c; color: #5a2a0c; text-shadow: none; }
.btn.tab.on { background: #fff0c8; }
.tabs { display: flex; gap: 6px; margin: 6px 0 8px; flex-wrap: wrap; }
.footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.goldhead { float: right; font-size: 18px; font-weight: bold; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cell { background: #fff0c8; border: 2px solid #a06a30; border-radius: 4px; padding: 6px; text-align: center; font-size: 12px; }
.cell .ico { margin: 0 auto 2px; display: block; }
.qrow { padding: 6px; border: 2px solid #c9a25a; border-radius: 4px; margin: 5px 0; background: #fff0c8; }
.qrow.done { opacity: .6; text-decoration: line-through; }
.qrow .bar { margin-top: 4px; }
.pmenu { display: flex; flex-direction: column; gap: 8px; width: 280px; margin: 10px auto; }
.pmenu .btn { padding: 8px; font-size: 15px; }
kbd { background: #fff0c8; border: 2px solid #a06a30; border-radius: 3px; padding: 0 4px; font-size: 12px; }
table.rec { width: 100%; border-collapse: collapse; } table.rec td { padding: 6px; border-bottom: 2px dotted #c9a25a; }
.up { color: #1d8a2a; } .down { color: #c0392b; }

/* ----- Fondu ----- */
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s; z-index: 80; }
#fade.on { opacity: 1; pointer-events: all; }

/* ----- v3 : garage, voitures, courses ----- */
.split { display: flex; gap: 14px; align-items: flex-start; margin: 6px 0; }
.splitL { width: 300px; flex: none; text-align: center; }
.splitR { flex: 1; min-width: 0; }
.carstage { background: radial-gradient(ellipse at center, #fff5d0 0%, #e8cf96 55%, #c9a25a 100%); border: 3px solid #8a4a1c; border-radius: 6px; padding: 6px; display: flex; justify-content: center; align-items: center; min-height: 130px; margin-bottom: 6px; }
.carstage canvas { display: block; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; margin: 3px 0 6px; align-items: center; }
.swatch { width: 26px; height: 26px; border: 3px solid #8a4a1c; border-radius: 4px; cursor: pointer; display: inline-block; }
.swatch:hover { transform: translateY(-2px); }
.swatch.on { border-color: #e22; box-shadow: 0 0 0 2px #fff inset; }
.swatch.none { background: repeating-linear-gradient(45deg, #888 0 4px, #555 4px 8px) !important; }
.opts { display: flex; flex-wrap: wrap; gap: 5px; margin: 3px 0 6px; }
.rates { margin: 4px 0; }
.rate { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 3px 0; }
.rate b { width: 112px; font-weight: normal; }
.rate .bar { height: 11px; }
.rate em { width: 34px; text-align: right; font-style: normal; font-size: 11px; font-weight: bold; }
.pips { display: flex; gap: 3px; }
.pips i { width: 12px; height: 12px; border: 2px solid #8a4a1c; background: #e8cf96; border-radius: 2px; display: block; }
.pips i.on { background: #e6a020; border-color: #7a4318; }
.big { font-size: 24px; width: 34px; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.trackrow { display: flex; gap: 8px; margin: 4px 0 8px; }
.trackcard { flex: 1; background: #fff0c8; border: 3px solid #a06a30; border-radius: 6px; padding: 5px; text-align: center; cursor: pointer; font-size: 11px; line-height: 1.25; }
.trackcard canvas { width: 100%; height: auto; image-rendering: auto; display: block; background: #6a9a4a; border-radius: 3px; margin-bottom: 3px; }
.trackcard.on { border-color: #e22; background: #fffbe8; box-shadow: 0 0 0 2px #fff inset; }
.trackcard:hover { filter: brightness(1.06); }
.podium { width: 100%; border-collapse: collapse; margin: 6px 0; }
.podium td { padding: 4px 6px; border-bottom: 2px dotted #c9a25a; font-size: 13px; }
.podium tr.me { background: #fff3b0; font-weight: bold; }
.podium canvas { display: block; }
input.num { font: inherit; font-size: 14px; width: 110px; padding: 3px 6px; border: 3px solid #8a4a1c; border-radius: 4px; background: #fff0c8; color: #3b2410; }
/* en course : seul le canvas et les notifications restent visibles */
#gameLayer.racing > :not(canvas):not(#toasts) { display: none !important; }
#gameLayer.racing #toasts { bottom: 90px; }

/* ======================================================================================
   VERSION TACTILE (touch.js) — rien de ce qui suit ne s'applique sans la classe « touch » sur <body>
   Le HUD et les fenêtres sortent de la scène 960×640 (réduite sur un petit écran) : ils sont affichés à leur taille réelle.
   ====================================================================================== */
:root { --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); }
html { overscroll-behavior: none; }
body.touch { touch-action: manipulation; overscroll-behavior: none; -webkit-touch-callout: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
body.touch * { -webkit-tap-highlight-color: transparent; }
body.touch #hint { display: none; }
body.touch #bQuit { display: none; }                                     /* « quitter » n'a pas de sens sur un téléphone */
body.touch #menuButtons { transform: translateX(-50%) scale(1.5); transform-origin: 50% 100%; bottom: 40px; }
body.touch #menuInfo { bottom: 176px; }

/* calques tactiles */
#tLayer { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#tPlay, #tHud, #tCtl { position: absolute; inset: 0; pointer-events: none; }
#tPlay { touch-action: none; }
body[data-mode="game"]:not(.t-modal):not(.t-busy) #tPlay, body[data-mode="convoy"]:not(.t-modal) #tPlay { pointer-events: auto; }
#tFade { position: fixed; inset: 0; z-index: 90; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s; }
#tFade.on { opacity: 1; pointer-events: all; }

/* HUD à taille réelle, compact : il occupe les bandes libres de chaque côté de la scène */
#tHud { display: none; }
body[data-mode="game"] #tHud, body[data-mode="race"] #tHud, body[data-mode="convoy"] #tHud { display: block; }
body[data-mode="race"] #tHud > :not(#toasts), body[data-mode="convoy"] #tHud > :not(#toasts) { display: none !important; }
#tHud .panel { background: rgba(246,223,170,.72); border: 3px solid rgba(138,74,28,.6); border-radius: 6px; padding: 3px 8px;
  box-shadow: inset 0 0 0 1px rgba(255,240,200,.45), 0 2px 0 rgba(74,42,16,.3); }
#tHud #hudDate { position: absolute; left: calc(6px + var(--sl)); top: calc(6px + var(--st)); min-width: 0; line-height: 1.2; }
#tHud #dDay { font-size: 12px; } #tHud #dYear { font-size: 10px; } #tHud #dClock { font-size: 15px; }
#tHud #hudGold { position: absolute; left: 50%; top: calc(6px + var(--st)); transform: translateX(-50%); width: 176px; padding: 2px 8px; }
#tHud .goldline { font-size: 16px; } #tHud .bar { height: 9px; border-width: 2px; } #tHud #gTxt { font-size: 10px; }
#tHud #hudRight { position: absolute; right: calc(6px + var(--sr)); top: calc(6px + var(--st)); width: 140px; gap: 4px; }
#tHud .barrow { margin: 1px 0; font-size: 11px; gap: 3px; } #tHud .barrow span { width: 16px; } #tHud .barrow em { width: 48px; font-size: 10px; }
#tHud #raidBox { position: absolute; left: 50%; top: calc(56px + var(--st)); transform: translateX(-50%); font-size: 11px; padding: 2px 8px; }
#tHud #toasts { position: absolute; left: calc(8px + var(--sl)); top: calc(70px + var(--st)); bottom: auto; width: min(300px, 38vw); }
#tHud .toast { font-size: 11px; }
#tHud #hotbar { position: absolute; bottom: calc(8px + var(--sb)); left: 50%; transform: translateX(-50%); pointer-events: auto;
  max-width: calc(var(--vw, 100vw) - 330px - var(--sl) - var(--sr)); gap: 3px; }
#tHud .slot { width: 42px; height: 42px; }
#tHud #selName { font-size: 13px; }

/* commandes : joystick à gauche, boutons à droite */
#tCtl .grp { position: absolute; inset: 0; display: none; pointer-events: none; }
body[data-mode="game"]:not(.t-modal):not(.t-busy) #tGame, body[data-mode="game"]:not(.t-modal):not(.t-busy) #tSys,
body[data-mode="race"]:not(.t-modal) #tRace, body[data-mode="convoy"]:not(.t-modal) #tConv { display: block; }
.tb { position: absolute; pointer-events: auto; touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 50%; color: #fff3d0; font: bold 16px/1 'Courier New', Consolas, monospace;
  text-shadow: 1px 1px 0 #3a1c08, -1px -1px 0 #3a1c08, 1px -1px 0 #3a1c08, -1px 1px 0 #3a1c08;
  background: rgba(150,92,38,.55); border: 3px solid rgba(255,230,170,.7); box-shadow: 0 3px 0 rgba(58,28,8,.55), inset 0 0 0 2px rgba(58,28,8,.3);
  user-select: none; -webkit-user-select: none; transition: transform .05s; }
.tb::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; }          /* zone de toucher plus large que le dessin */
.tb i { font-style: normal; font-size: 15px; line-height: 1; margin-top: 1px; }
.tb.big { width: 84px; height: 84px; font-size: 28px; } .tb.big i { font-size: 22px; }
.tb.sm { width: 42px; height: 42px; font-size: 19px; }
.tb.on { background: rgba(255,214,120,.85); transform: scale(.92); }
.tb.gas { background: rgba(80,160,60,.6); } .tb.nit { background: rgba(214,120,30,.62); }
.tb.gas.on, .tb.nit.on { background: rgba(255,214,120,.9); }
.wonly { display: none !important; } body.t-weapon .wonly { display: flex !important; }       /* recharger / changer d'arme : seulement si on a une arme */
#tSys .srow { position: absolute; top: calc(104px + var(--st)); right: calc(6px + var(--sr)); display: flex; gap: 8px; pointer-events: none; }
#tSys .tb { position: relative; }
#tStick { position: absolute; left: calc(8px + var(--sl)); bottom: calc(8px + var(--sb)); width: 150px; height: 150px; display: none; pointer-events: auto; touch-action: none; }
body[data-mode="game"]:not(.t-modal):not(.t-busy) #tStick, body[data-mode="convoy"]:not(.t-modal) #tStick { display: block; }
#tStick .sbase { position: absolute; left: 15px; top: 15px; width: 120px; height: 120px; border-radius: 50%; background: rgba(150,92,38,.36);
  border: 3px solid rgba(255,230,170,.55); box-shadow: inset 0 0 0 2px rgba(58,28,8,.3); }
#tStick .sbase.on { background: rgba(150,92,38,.5); }
#tStick .sknob { position: absolute; left: 31px; top: 31px; width: 52px; height: 52px; border-radius: 50%; border: 3px solid #8a4a1c;
  background: radial-gradient(circle at 35% 30%, #ffe9b0, #d9a35a 70%); box-shadow: 0 3px 0 rgba(58,28,8,.5); }
.tpad { left: calc(10px + var(--sl)); bottom: calc(14px + var(--sb)); width: 200px; height: 84px; border-radius: 42px; flex-direction: row; justify-content: space-between; padding: 0 26px; font-size: 32px; }
.tpad::after { inset: -4px; border-radius: 46px; }
.tpad span { transition: transform .05s, color .05s; }
.tpad[data-s="L"] span:first-child, .tpad[data-s="R"] span:last-child { color: #ffe28a; transform: scale(1.25); }
#tMenuFs { display: none; right: calc(10px + var(--sr)); top: calc(10px + var(--st)); }
body[data-mode="menu"] #tMenuFs { display: flex; }
#tIosHint { display: none; position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(6px + var(--sb)); max-width: 80%; text-align: center; pointer-events: auto;
  background: rgba(40,22,8,.85); color: #fff3d0; padding: 5px 12px; border-radius: 10px; font-size: 12px; line-height: 1.3; }
body[data-mode="menu"] #tIosHint { display: block; }
#tRotate { display: none; position: fixed; inset: 0; z-index: 200; background: #0b1d3a; color: #fff3d0; align-items: center; justify-content: center; text-align: center;
  font: bold 18px/1.4 'Courier New', Consolas, monospace; padding: 24px; }
#tRotate > div > b { display: block; font-size: 60px; margin-bottom: 8px; }

/* fenêtres : taille réelle, boutons faciles à toucher */
body.touch #modal { position: fixed; inset: 0; z-index: 60; padding: var(--st) var(--sr) var(--sb) var(--sl); }
body.touch #modalBox { width: min(740px, calc(var(--vw, 100vw) - 16px - var(--sl) - var(--sr))); max-height: calc(var(--vh, 100vh) - 12px - var(--st) - var(--sb));
  padding: 10px 12px; font-size: 14px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
body.touch #modalBox h2 { font-size: 19px; }
body.touch .btn { min-height: 38px; padding: 6px 12px; font-size: 14px; }
body.touch .row { gap: 8px; padding: 7px 2px; }
body.touch .swatch { width: 32px; height: 32px; }
body.touch .pmenu { width: min(300px, 100%); }

/* Mashed Bitch au doigt (paysage) : la scène à gauche, mise et boutons à droite — tout tient sans défiler */
body.touch #modalBox[data-k="tir"] { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; column-gap: 12px; align-content: start; overflow-y: auto; }
body.touch #modalBox[data-k="tir"] > canvas { grid-column: 1; grid-row: 1 / 6; margin: 0 !important; width: auto !important; max-width: none !important;
  height: min(330px, calc(var(--vh, 100vh) - 36px - var(--st) - var(--sb)), calc((var(--vw, 100vw) - 250px - var(--sl) - var(--sr)) * .696)) !important; }
body.touch #modalBox[data-k="tir"] > :not(canvas) { grid-column: 2; }
body.touch #modalBox[data-k="tir"] .goldhead { float: none; font-size: 17px; }
body.touch #modalBox[data-k="tir"] h2 { margin: 0 0 2px; }
body.touch #modalBox[data-k="tir"] p.small { font-size: 12px; line-height: 1.3; opacity: .95; }
body.touch #modalBox[data-k="tir"] .chips .btn { min-height: 34px; padding: 4px 8px; flex: 1 1 70px; }
body.touch #modalBox[data-k="tir"] .footer { flex-direction: column; align-items: stretch; margin-top: 6px; }
@media (max-width: 720px) {
  body.touch #modalBox[data-k="tir"] p.small { font-size: 11px; }
  body.touch #modalBox[data-k="tir"] .chips { gap: 4px; }
  body.touch #modalBox[data-k="tir"] .chips .btn { min-height: 28px; font-size: 12px; flex-basis: 52px; padding: 2px 4px; }
  body.touch #modalBox[data-k="tir"] .footer .btn { min-height: 32px; font-size: 12.5px; padding: 3px 6px; }
}
