/* Retrofus Ascension — Android seulement (server/local/android.js pose <html class="rv-android"> et --and, le facteur de taille de l'interface d'après la hauteur de l'écran ; rien ici n'agit sans cette classe,
   donc rien sur ordinateur, iPhone ou autre navigateur). Chargé après tous les autres styles. Réglé avec un téléphone en paysage de 340 à 430 px de haut ; une tablette (≥ 540 px de haut) garde la taille d'origine. */

/* ---- 1. la feuille « Tourne ton téléphone » : plus de portrait sur Android ---- */
#rv-rotate { display: none; }
html.rv-android.rv-and-port #rv-rotate { position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center; padding: 24px; box-sizing: border-box; text-align: center; color: #f4ead2; background: radial-gradient(circle at 50% 40%, #2a2116, #100c08 70%); font: 600 16px/1.4 var(--font-ui, system-ui, sans-serif); touch-action: none; }
#rv-rotate > div { display: grid; justify-items: center; gap: 12px; max-width: 320px; }
#rv-rotate svg { width: 88px; height: 88px; color: #ffd96a; animation: rvTurn 2.4s ease-in-out infinite; }
#rv-rotate b { font-size: 21px; color: #ffd96a; }
#rv-rotate span { opacity: .85; }
@keyframes rvTurn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { #rv-rotate svg { animation: none; } }

/* ---- 2. la taille de l'interface : tout ce qui est posé par-dessus la carte est réduit du facteur --and (même technique que le réglage « Taille de l'interface », ui-scale.css, et il se cumule avec lui) ---- */
html.rv-android[data-ui-size] :is(
  dialog[open], [popover]:popover-open, #spell-dock, #fight-hud, #mobile-topbar, #mobile-explorebar, #mobile-map-panel, #companions-hud, #rv-top-stack, #zone-banner, #rv-ally-bar, #rv-foe-bar,
  #mp-placement-bar, #rv-teamframe, #rv-switch, #rv-palier-banner, #rv-palier-detail, #trade-toasts, #mp-toasts, #update-notice, #rv-ping, #game-topbar, .combat-launch, .title.glass, .tools.glass,
  #feedback-fab, #leaderboard-fab, #multiplayer-toggle, .monster-toggle, #retroverse-chat, #rv-spell-tip, #rv-tip
) { zoom: calc(var(--ui-zoom, 1) * var(--and, 1)); max-width: calc(100vw / (var(--ui-zoom, 1) * var(--and, 1))) !important; max-height: calc(100dvh / (var(--ui-zoom, 1) * var(--and, 1))) !important; }
/* les barres pleine largeur du jeu gardent toute la largeur de l'écran une fois réduites */
html.rv-android[data-ui-size] :is(#mobile-topbar, #mobile-explorebar) { width: calc((100vw - 16px) / (var(--ui-zoom, 1) * var(--and, 1))) !important; }
/* la barre du combat se range sous les deux rangées de cartes : leur bas est mesuré en pixels d'écran, la barre est réduite (ses décalages sont comptés en pixels réduits) */
@media (min-width: 601px) { html.rv-android body.rv-rows-on #fight-hud:not(.is-moved) { top: calc(var(--rv-rows-bottom, 102px) / (var(--ui-zoom, 1) * var(--and, 1))) !important; } }
/* en combat, sur un téléphone en paysage : la barre Vie / Mana / Fuir se range en haut à gauche, sous la barre du haut, au lieu de se poser sous les deux rangées de cartes au milieu de l'arène */
@media (min-width: 601px) { html.rv-android.rv-and-land body.in-battle #fight-hud:not(.is-moved) { left: calc(8px / (var(--ui-zoom, 1) * var(--and, 1))) !important; right: auto !important; top: calc(46px / (var(--ui-zoom, 1) * var(--and, 1))) !important; transform: none !important; margin: 0 !important; } }
html.rv-android.rv-and-land body.in-battle #fight-enemies { display: none; }   /* le compteur d'ennemis : les cartes du haut les montrent déjà, et la barre doit tenir à gauche des deux rangées */

/* ---- 3. écrans « Choix du serveur », « Choix du personnage », création : déjà en mode paysage de téléphone (select-launcher.css), réduits comme le reste et sans carte plus haute que l'écran ---- */
html.rv-android #rv-chars .rv-lx:not(#rv-x) { zoom: calc(var(--ui-zoom, 1) * var(--and, 1)); width: calc(100vw / (var(--ui-zoom, 1) * var(--and, 1))); height: calc(100dvh / (var(--ui-zoom, 1) * var(--and, 1))); max-height: none; }
html.rv-android #rv-chars .rv-realms button.rv-lx-realm:not(#rv-x) { min-height: min(250px, calc(100dvh / (var(--ui-zoom, 1) * var(--and, 1)) - 140px)); }

/* ---- 4. le panneau de discussion / social (feuille plein écran de mobile-v3.css) : « 100vw × 100dvh » compté dans un parent réduit ne remplit plus l'écran -> compensé ---- */
html.rv-android:not(#m3)[data-ui-size] body:not(#m3) #retroverse-chat #chat-panel#chat-panel:not([hidden]) { width: calc(100vw / (var(--ui-zoom, 1) * var(--and, 1))) !important; height: calc(100dvh / (var(--ui-zoom, 1) * var(--and, 1))) !important; max-height: none !important; }
/* la fenêtre d'échange (section, pas un <dialog> : le script ne la repère pas) : même réduction, et son « 100vw × 100dvh » est compensé */
html.rv-android[data-ui-size] #trade-window { zoom: calc(var(--ui-zoom, 1) * var(--and, 1)); }
html.rv-android:not(#m3)[data-ui-size] body:not(#m3) #trade-window#trade-window:not([hidden]) { width: calc(100vw / (var(--ui-zoom, 1) * var(--and, 1))) !important; height: calc(100dvh / (var(--ui-zoom, 1) * var(--and, 1))) !important; max-height: none !important; }
