/* MEEZ ROYALE - HUD de partie sur telephone (haut gauche : minicarte + vie ; haut centre : en vie / zone ; haut droite : emotes, menu ; bas centre : arme + cases), carte du tuto,
   cartes de mort / fin, salle d'attente, menu pause, avertissement « tourne ton telephone » : charge SEULEMENT sur telephone (device.js). */
body.touch { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }

/* ---------------------------------------------------------------- « tourne ton telephone » */
#rotateWarn h2 { font: 900 26px var(--ui); letter-spacing: 1px; margin: 6px 0 0; }

#rotateWarn p { margin: 0; font: 600 15px var(--ui); opacity: .75; }

.rw-phone { position: relative; width: 78px; height: 132px; border: 4px solid #fff; border-radius: 16px; animation: rwTurn 2.8s ease-in-out infinite; }

.rw-phone::before { content: ""; position: absolute; left: 50%; top: 7px; width: 22px; height: 4px; margin-left: -11px; border-radius: 3px; background: rgba(255,255,255,.7); }

.rw-phone i { position: absolute; inset: 20px 8px 14px; border-radius: 8px; background: linear-gradient(160deg, var(--brand), var(--brand2)); opacity: .9; }

@keyframes rwTurn { 0%, 18% { transform: rotate(0); } 50%, 82% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }

body.touch #touchUi { display: block; position: absolute; inset: 0; pointer-events: none; }

/* ---------------------------------------------------------------- HUD compact (telephone en paysage) */
body.touch #topbar { top: calc(6px + var(--sat)); gap: 8px; }

body.touch #perfHud { top: calc(104px + var(--sat)); left: calc(8px + var(--sal)); }

/* sous la minicarte reduite (92px, 6px/8px d'inset en telephone) */
body.touch #survbox { padding: 3px 12px; }

body.touch #survbox b { font-size: 17px; }

body.touch #survbox span { font-size: 8.5px; }

body.touch #stormbox { padding: 5px 12px; font-size: 11px; }

body.touch #feed { top: calc(6px + var(--sat)); right: calc(8px + var(--sar)); max-width: 32vw; font-size: 10.5px; line-height: 1.45; }

body.touch #feed div { padding: 1px 7px; margin-bottom: 2px; }

body.touch #tutoBox { top: calc(46px + var(--sat)); width: min(72vw, 330px); padding: 6px 12px 7px; border-radius: 14px; }

/* compacte : le bas de la carte reste au-dessus du personnage (centre de l'ecran) */
body.touch .tuto-head { position: absolute; top: 7px; left: 12px; margin: 0; }

/* « Etape 3/8 » flotte a gauche du titre : pas de ligne en plus */
body.touch .tuto-step { font-size: 8.5px; letter-spacing: .8px; }

body.touch .tuto-body h3 { font-size: 13px; margin-bottom: 1px; }

body.touch .tuto-body p { font-size: 11px; line-height: 1.3; }

body.touch .tuto-goal { margin-top: 4px; padding: 3px 8px; font-size: 10.5px; border-radius: 9px; }

body.touch .tuto-bar, body.touch .tuto-dots { display: none; }

/* petit ecran : l'etape et l'objectif suffisent */
body.touch .tuto-actions { margin-top: 5px; }

body.touch .tuto-actions .small-btn { padding: 4px 10px; font-size: 10.5px; }

body.touch #mini { position: absolute; left: calc(8px + var(--sal)); top: calc(6px + var(--sat)); width: 92px; height: 92px; border-radius: 10px; }

body.touch #vitals { left: calc(8px + var(--sal)); top: calc(104px + var(--sat)); bottom: auto; width: 92px; gap: 3px; }

body.touch .bar { height: 15px; }

body.touch .bar.shield { height: 10px; }

body.touch .bar span { right: 5px; font-size: 10px; }

body.touch #weaponbox { z-index: 5; left: 50%; right: auto; bottom: calc(6px + var(--sab)); width: clamp(210px, calc(100vw - 480px), 340px); transform: translateX(-50%); }

body.touch #held { min-width: 0; width: 100%; margin: 0 0 4px; padding: 3px 10px 3px 6px; gap: 8px; border-radius: 10px; border-left-width: 5px; box-shadow: none; }

body.touch #heldIcon { width: 52px; height: 28px; }

body.touch #heldIcon .slotIcon { width: 52px; height: 28px; }

body.touch #heldRar { font-size: 8px; min-height: 10px; letter-spacing: 1px; }

body.touch #wname { font-size: 11.5px; margin: 0; }

body.touch #ammo b { font-size: 20px; }

body.touch #ammo span { font-size: 11px; }

body.touch #ammobar, body.touch #slothint, body.touch #help, body.touch #prompt { display: none; }

body.touch #slots { gap: 3px; padding-top: 7px; justify-content: center; }

body.touch .slot { flex: 1 1 0; width: auto; min-width: 0; max-width: 50px; height: 46px; padding: 2px 2px 6px; border-radius: 9px; border-width: 2px; }

body.touch .slot .slotIcon { width: 100%; height: 24px; }

body.touch .slot .slotName, body.touch .slot .pips, body.touch .slot .tag { display: none; }

body.touch .slot .key { top: 1px; left: 3px; font-size: 8px; }

body.touch .slot .qty { font-size: 10px; line-height: 13px; padding: 0 4px; }

body.touch .slot.on { transform: translateY(-6px) scale(1.06); }

body.touch .slot.holding { animation: useGlow .5s ease-in-out infinite; }

body.touch .slot.melee { margin-left: 4px; }

body.touch #reloadtag { bottom: calc(86px + var(--sab)); font-size: 13px; padding: 4px 14px; }

body.touch #usebar { bottom: calc(92px + var(--sab)); width: 190px; }

body.touch #godtag { left: calc(8px + var(--sal)); bottom: calc(160px + var(--sab)); }

body.touch #adminToggle { left: calc(8px + var(--sal)); top: calc(150px + var(--sat)); bottom: auto; }

body.touch #dropctrl { top: calc(6px + var(--sat)); padding: 5px 16px 5px 8px; gap: 10px; }

body.touch .dc-ring { width: 34px; height: 34px; }

body.touch .dc-ring b { font-size: 13px; }

body.touch #dropbig { font-size: 13px; }

body.touch #dropsmall { font-size: 11px; }

body.touch #deadcard { left: 14px; right: calc(190px + var(--sar)); bottom: calc(12px + var(--sab)); transform: none; width: auto; padding: 8px 14px; gap: 10px; }

body.touch #endcard { bottom: calc(12px + var(--sab)); padding: 8px 14px; gap: 10px; width: min(560px, calc(100vw - 32px)); }

body.touch #deadcard h2, body.touch #endcard h2 { font-size: 15px; }

body.touch #deadcard p, body.touch #endcard p { font-size: 11.5px; margin-top: 1px; }

body.touch #deadcard [data-i18n-html="hud.spec_hint_html"], body.touch .res-kbd { display: none; }

body.touch #deadcard .btn, body.touch #endcard .btn { pointer-events: auto; padding: 7px 12px; font-size: 12px; }

body.touch #lobbywait { padding: 8px; }

body.touch .lw-card { padding: 12px 22px 10px; width: min(560px, 100%); }

body.touch .lw-title { font-size: 17px; margin: 3px 0 8px; }

body.touch .lw-kicker { font-size: 10px; }

body.touch .lw-pip { width: 24px; height: 24px; font-size: 11px; }

body.touch .lw-pips { gap: 6px; margin-bottom: 4px; }

body.touch .lw-count b { font-size: 20px; }

body.touch .lw-bar { margin: 8px 4px 5px; }

body.touch .lw-hint { margin: 6px 0 8px; font-size: 11.5px; }

@media (orientation: landscape) and (max-height: 520px) {
  #rotateWarn h2 { font-size: 20px; }
}

body.touch .only-touch { display: block; }

body.touch .only-pc { display: none; }

body.touch .controls-list.only-touch { display: grid; }

body.touch .hud-sound { width: 30px; height: 30px; font-size: 14px; }

body.touch #topbar { align-items: center; }

body.touch .set-row.only-touch { display: flex; }

/* ---------------------------------------------------------------- HUD v2 en partie (plan mobile, lot 1) : plus de monde a l'ecran, tout a portee des pouces
   haut gauche : minicarte + vie ; haut centre : en vie / zone ; haut droite : emotes, menu, puis le flux d'eliminations ; bas centre : arme en main (une ligne) + cases ; les pouces ont les coins. */
body.touch:not(.show-perf) #perfHud { display: none; }

body.touch #hudSound { display: none; }

body.touch #topbar { left: 0; right: 0; transform: none; justify-content: center; pointer-events: none; }

body.touch #hudEmote, body.touch #hudMenu { position: fixed; top: calc(6px + var(--sat)); width: 42px; height: 42px; font-size: 19px; z-index: 6; }

body.touch #hudMenu { right: calc(8px + var(--sar)); }

body.touch #hudEmote { right: calc(58px + var(--sar)); }

body.touch #feed { top: calc(54px + var(--sat)); max-width: 26vw; }

body.touch #feed div:nth-last-child(n+4) { display: none; }                      /* le flux d'eliminations ne garde que les 3 dernieres lignes (le coin reste lisible) */

body.touch #hud:has(#tutoBox:not(.hidden)) #feed { display: none; }                          /* tuto : la carte de l'etape tient la largeur, et les eliminations de bots d'entrainement n'apprennent rien */

body.touch #mini { width: 84px; height: 84px; }

body.touch #vitals { top: calc(96px + var(--sat)); width: 104px; }

body.touch #weaponbox { width: clamp(250px, calc(100vw - 440px), 330px); bottom: calc(5px + var(--sab)); }

body.touch #held { height: 26px; padding: 0 10px; margin: 0 0 3px; gap: 8px; border-radius: 8px; align-items: center; }

body.touch #heldIcon { display: none; }

body.touch #heldInfo { display: flex; align-items: baseline; gap: 6px; min-width: 0; }

body.touch #heldRar { min-height: 0; font-size: 8px; letter-spacing: 1px; }

body.touch #wname { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

body.touch #ammo { margin-left: auto; white-space: nowrap; }

body.touch #ammo b { font-size: 16px; }

body.touch #slots { gap: 4px; padding-top: 6px; }

body.touch .slot { height: 44px; min-width: 38px; max-width: 48px; }

body.touch .slot .key { display: none; }

body.touch .slot.on { transform: translateY(-5px) scale(1.08); }

body.touch #reloadtag { bottom: calc(82px + var(--sab)); }

body.touch #usebar { bottom: calc(86px + var(--sab)); }

/* ---------------------------------------------------------------- carte du TUTO sur telephone : texte a gauche, deux boutons empiles a droite (plus basse, plus transparente) */
body.touch #tutoBox { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; width: min(68vw, 400px); background: rgba(14,12,10,.8); }

body.touch .tuto-body { grid-column: 1; min-width: 0; }

body.touch .tuto-actions { grid-column: 2; grid-row: 1; flex-direction: column; margin: 0; gap: 5px; }

body.touch .tuto-actions .small-btn { min-height: 32px; padding: 5px 10px; font-size: 10.5px; white-space: nowrap; }

/* ---------------------------------------------------------------- menu pause sur telephone couche : « Reprendre » et « Quitter » a gauche (toujours visibles), les reglages a droite (ca defile) */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch .pz-card { display: grid; grid-template-columns: minmax(170px, 220px) minmax(0, 1fr); grid-template-areas: "head set" "resume set" "actions set"; align-content: start; gap: 8px 16px; width: min(800px, calc(100vw - 20px)); max-height: calc(100dvh - 12px); padding: 12px 16px; }
  body.touch .pz-head { grid-area: head; }
  body.touch #pzResume { grid-area: resume; }
  body.touch .pz-card > .pz-sec { display: none; }
  body.touch .pz-set { grid-area: set; max-height: calc(100dvh - 40px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; align-content: start; }
  body.touch .pz-actions { grid-area: actions; margin-top: 0; padding-top: 8px; }
}

@media (orientation: landscape) and (max-height: 520px) { body.touch #pzResume { align-self: start; min-height: 52px; height: 52px; } }

@media (max-height: 420px) {                                                    /* petits telephones couches (640 x 360...) : la carte du tuto ne doit pas manger le quart de l'ecran */
  body.touch #tutoBox { padding: 4px 10px 5px; }
  body.touch .tuto-body h3 { font-size: 12px; margin-bottom: 0; }
  body.touch .tuto-body p { font-size: 10.5px; line-height: 1.25; }
  body.touch .tuto-goal { margin-top: 3px; padding: 2px 8px; font-size: 10px; }
  body.touch .tuto-actions .small-btn { min-height: 28px; padding: 3px 8px; font-size: 10px; }
}

/* ---------------------------------------------------------------- plein ecran (mobile/display.js) */
/* le bouton ⛶ : discret, a cote des emotes / du menu, seulement si le navigateur sait faire le plein ecran et qu'on n'y est pas deja */
body.touch.fs-ok:not(.is-fs) #hudFs, body.touch.bar-ok #hudFs { display: grid; position: fixed; top: calc(8px + var(--sat)); right: calc(108px + var(--sar)); width: 38px; height: 38px; font-size: 16px; opacity: .6; z-index: 6; }

body.touch.fs-ok:not(.is-fs) #hudFs:active, body.touch.bar-ok #hudFs:active { opacity: 1; }

body.touch.fs-ok .set-row.only-fs { display: flex; }

body.touch .fs-on { display: none; }

body.touch.is-fs .fs-on { display: inline; }

body.touch.is-fs .fs-off { display: none; }

/* « Tourne ton telephone » : « Jouer quand meme » n'apparait qu'apres 3 s (on laisse le temps de tourner) mais ne bloque jamais */
#rotateContinue { opacity: 0; pointer-events: none; transition: opacity .6s; }

#rotateWarn.late #rotateContinue { opacity: .85; pointer-events: auto; }

/* avant la partie (JOUER en portrait) : « Retour » annule ; en partie il n'existe pas */
#rotateBack { display: none; margin-top: 4px; }

#rotateWarn.pre #rotateBack { display: block; }

/* ---------------------------------------------------------------- iPhone Safari : « glisse vers le haut » pour masquer la barre du navigateur (mobile/display.js) */
body.touch.is-ios-bars .set-row.only-ios { display: flex; }

/* le document defile (derriere les couches fixes du jeu) : seul moyen de faire replier la barre sans installer l'appli ; les zones du jeu gardent touch-action: none */
html.ios-scroll { overflow-y: auto; }

html.ios-scroll body { overflow: visible; }

html.ios-scroll body::after { content: ""; display: block; height: 130dvh; pointer-events: none; }

html.ios-hint, html.ios-hint body { touch-action: auto; }

/* la bulle (en haut, au centre) ne couvre rien : le geste se fait n'importe ou sur l'ecran, la page defile derriere les couches fixes ; seule la bulle (« OK ») capte les touches */
#iosBar { position: fixed; left: 0; right: 0; top: calc(8px + var(--sat)); z-index: 85; display: flex; justify-content: center; pointer-events: none; }

#iosBar.hidden { display: none; }

.ib-card { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "arrow title skip" "arrow sub skip"; align-items: center; column-gap: 12px; padding: 8px 12px 8px 14px; border-radius: 18px; pointer-events: auto; background: rgba(20,17,14,.9); border: 1px solid rgba(255,255,255,.2); color: #fff; box-shadow: 0 6px 22px rgba(0,0,0,.5); }

.ib-card b { grid-area: title; font: 800 15px var(--ui); letter-spacing: .3px; }

.ib-card small { grid-area: sub; font: 600 12px var(--ui); opacity: .75; }

.ib-card .ib-skip { grid-area: skip; }

.ib-arrow { grid-area: arrow; font-size: 28px; line-height: 1; animation: ibUp 1.1s ease-in-out infinite; color: var(--brand, #f0c869); }

@keyframes ibUp { 0% { transform: translateY(10px); opacity: .3; } 60% { transform: translateY(-8px); opacity: 1; } 100% { transform: translateY(-8px); opacity: 0; } }

/* ---------------------------------------------------------------- etape 4 : HUD v3 (mobile/hud.js) */
/* mode duo : le compas du coequipier sous la vie (a gauche, en bas il tombait sur le joystick au repos) */
body.touch #teamCompass { left: calc(8px + var(--sal)); top: calc(132px + var(--sat)); bottom: auto; padding: 4px 10px; }

/* boss : la barre de vie se range sous le bandeau du haut, plus etroite (le bandeau et la minicarte gardent leur place) */
body.touch #bossbar { top: calc(46px + var(--sat)); width: min(46vw, 340px); gap: 3px; }
body.touch .bb { grid-template-columns: auto 1fr auto; gap: 0 7px; padding: 2px 7px; border-radius: 5px; }
body.touch .bb-n { font-size: 9px; letter-spacing: .06em; }
body.touch .bb-t { font-size: 9px; }
body.touch .bb-bar { grid-column: auto; height: 6px; }

body.touch.lefty #teamCompass { left: calc(100px + var(--sal)); top: calc(10px + var(--sat)); }                       /* gaucher : la colonne de boutons monte a gauche, le compas passe a droite de la minicarte */

/* la minicarte se touche : elle passe au-dessus des zones tactiles ; agrandie (un tap), elle s'ouvre au centre, les pouces restent libres (le fond ne capte rien) */
body.touch #mini { pointer-events: auto; z-index: 6; cursor: pointer; touch-action: none; }

body.touch.mini-big { --mb: min(76vh, 340px); }

body.touch.mini-big #mini { position: fixed; left: 50%; top: 50%; width: var(--mb); height: var(--mb); transform: translate(-50%, -50%); z-index: 30; border-radius: 14px; border: 2px solid rgba(255,255,255,.55);
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.34), 0 12px 40px rgba(0,0,0,.6); animation: miniOpen .18s var(--ease, ease-out); }

@keyframes miniOpen { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }

body.touch #miniX { position: fixed; z-index: 31; left: calc(50% + var(--mb, 300px) / 2 - 20px); top: calc(50% - var(--mb, 300px) / 2 - 18px); width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  font: 800 17px var(--ui); color: #fff; background: rgba(20,17,14,.92); border: 2px solid rgba(255,255,255,.5); pointer-events: auto; touch-action: none; cursor: pointer; }

body.touch #miniX.hidden { display: none; }

/* ---------------------------------------------------------------- aide du nouveau joueur dans la vraie partie (mobile/coach.js) : un pouce fantome qui montre le geste + une bulle, une seule a la fois */
body.touch #coach { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

body.touch #coach.hidden { display: none; }

body.touch .co-thumb { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.5);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.95), rgba(255,255,255,.4)); animation: coMove 2s ease-in-out infinite; }

body.touch .co-thumb.hidden { display: none; }

body.touch .co-aim .co-thumb { background: radial-gradient(circle at 35% 30%, rgba(255,235,220,.98), rgba(255,100,70,.6)); border-color: #ffd0b0; animation-name: coAim; }

@keyframes coMove { 0% { transform: translate(0, 0) scale(1); opacity: 0; } 14% { opacity: 1; } 58%, 82% { transform: translate(46px, -16px) scale(1); opacity: 1; } 100% { transform: translate(46px, -16px) scale(.9); opacity: 0; } }

@keyframes coAim { 0% { transform: translate(0, 0) scale(1); opacity: 0; } 14% { opacity: 1; } 58% { transform: translate(-40px, -22px) scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(255,100,70,.7); } 82% { transform: translate(-40px, -22px) scale(1); opacity: 1; box-shadow: 0 0 0 22px rgba(255,100,70,0); } 100% { transform: translate(-40px, -22px) scale(.9); opacity: 0; } }

body.touch .co-label { position: absolute; padding: 7px 12px 8px; border-radius: 14px; text-align: center; color: #fff; background: rgba(20,17,14,.93); border: 2px solid var(--brand, #f0c869); box-shadow: 0 6px 20px rgba(0,0,0,.5); animation: coBob 1.4s ease-in-out infinite; }

body.touch .co-label::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -8px; width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg); background: rgba(20,17,14,.93); border-right: 2px solid var(--brand, #f0c869); border-bottom: 2px solid var(--brand, #f0c869); }

body.touch .co-label b { display: block; font: 800 12.5px/1.25 var(--ui); }

body.touch .co-label small { display: block; margin-top: 3px; font: 700 10.5px/1.25 var(--ui); color: var(--brand, #f0c869); }

body.touch .co-label small.hidden { display: none; }

@keyframes coBob { 50% { transform: translateY(-4px); } }

/* la bulle « ramasse » s'accroche au bouton d'action : un anneau qui pulse autour de lui */
body.touch .t-pick.co-ring::after { content: ""; position: absolute; inset: -7px; border-radius: 38px; border: 3px solid #fff; pointer-events: none; animation: coPulse 1s ease-out infinite; }

@keyframes coPulse { from { opacity: 1; transform: scale(.94); } to { opacity: 0; transform: scale(1.12); } }

body.no-fx .co-thumb, body.no-fx .co-label, body.no-fx .t-pick.co-ring::after { animation: none; }

