/* MOBILE PUBLIC (≤ 720 px) : rang animé, lien « Comment jouer », drapeau de langue. */
@media (max-width: 720px) {
  #mlRank { display: flex; align-items: center; gap: 8px; margin: 6px 4px 2px; padding: 6px 10px; border-radius: 12px; border: 1px solid rgba(128,140,160,.35); background: rgba(128,140,160,.08); font-size: 12px; line-height: 1.25; transition: background .4s, border-color .4s; }
  #mlRank .ml-pos { font-size: 15px; font-weight: 800; }
  #mlRank .ml-pos small { font-size: 10px; font-weight: 600; opacity: .6; }
  #mlRank .ml-gap { flex: 1; min-width: 0; }
  #mlRank .ml-ar { font-style: normal; font-weight: 900; width: 16px; text-align: center; }
  #mlRank .ml-ar.idle { opacity: .35; }
  #mlRank .ml-ar.up { color: #1fa971; animation: mlUp .9s ease-in-out infinite; }
  #mlRank .ml-ar.dn { color: #d6453d; animation: mlDn .9s ease-in-out infinite; }
  #mlRank.gain { border-color: #1fa971; background: rgba(31,169,113,.12); }
  #mlRank.loss { border-color: #d6453d; background: rgba(214,69,61,.12); }
  @keyframes mlUp { 0%, 100% { transform: translateY(2px); opacity: .6; } 50% { transform: translateY(-3px); opacity: 1; } }
  @keyframes mlDn { 0%, 100% { transform: translateY(-2px); opacity: .6; } 50% { transform: translateY(3px); opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { #mlRank .ml-ar { animation: none !important; } }
  /* une seule ligne d'aide, discrète et cliquable */
  #ob-foot .ob-touch-note .ml-line { display: flex; justify-content: center; gap: 14px; padding: 6px 0; cursor: pointer; }
  #ob-foot .ob-touch-note .ml-how { color: var(--gold); font-weight: 700; }
  /* drapeau à la place du texte FR / EN */
  html:not(.mb) #btnLang.ml-fr, html:not(.mb) #btnLang.ml-en { font-size: 0 !important; }
  html:not(.mb) #btnLang.ml-fr::before, html:not(.mb) #btnLang.ml-en::before { content: ''; display: inline-block; width: 22px; height: 15px; border-radius: 2px; background-size: cover; background-position: center; box-shadow: 0 0 0 1px rgba(128,140,160,.35); }
  html:not(.mb) #btnLang.ml-fr::before { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'><rect width='1' height='2' fill='%230055A4'/><rect x='1' width='1' height='2' fill='%23fff'/><rect x='2' width='1' height='2' fill='%23EF4135'/></svg>"); }
  html:not(.mb) #btnLang.ml-en::before { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 40'><rect width='60' height='40' fill='%23012169'/><path d='M0 0L60 40M60 0L0 40' stroke='%23fff' stroke-width='8'/><path d='M0 0L60 40M60 0L0 40' stroke='%23C8102E' stroke-width='3'/><path d='M30 0V40M0 20H60' stroke='%23fff' stroke-width='12'/><path d='M30 0V40M0 20H60' stroke='%23C8102E' stroke-width='7'/></svg>"); }
}

/* ===== MOBILE PUBLIC : barre de trading propre, sans « Détacher » (réservé à la version web) ===== */
@media (max-width: 720px) {
  html:not(.mb) body #app #btnPopBook, html:not(.mb) body #app .pop-book-btn, html:not(.mb) body #app #btnBookSide { display: none !important; }          /* Détacher : web seulement */
  html:not(.mb) body #app #ob-foot { display: grid !important; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: center; padding: 8px 8px 10px; }
  html:not(.mb) body #app #ob-foot .ob-trade-ctl, html:not(.mb) body #app #ob-foot .ob-foot-right, html:not(.mb) body #app #ob-foot .ob-btns { display: contents !important; }
  html:not(.mb) body #app #ob-foot > .ob-legend-open:not(.ob-touch-note), html:not(.mb) body #app #ob-foot .vp-note { display: none !important; }
  /* ligne 1 : ACHAT | VENTE à égalité */
  html:not(.mb) body #app #ob-foot #btnMarketBuy  { grid-column: span 6; order: 1; }
  html:not(.mb) body #app #ob-foot #btnMarketSell { grid-column: span 6; order: 2; }
  html:not(.mb) body #app #ob-foot #btnMarketBuy, html:not(.mb) body #app #ob-foot #btnMarketSell { min-height: 46px; margin: 0; width: 100%; font-size: 13px; letter-spacing: .3px; border-radius: 10px; }
  /* ligne 2 : LOTS · FLAT · SUIVRE · AGRANDIR */
  html:not(.mb) body #app #ob-foot .ob-trade-ctl label { grid-column: span 2; order: 3; text-align: right; margin: 0; }
  html:not(.mb) body #app #ob-foot #lotInput { grid-column: span 2; order: 4; width: 100% !important; height: 38px; text-align: center; margin: 0; }
  html:not(.mb) body #app #ob-foot #btnFlat { grid-column: span 3; order: 5; min-height: 38px; margin: 0; width: 100%; }
  html:not(.mb) body #app #ob-foot #btnFollow { grid-column: span 3; order: 6; min-height: 38px; margin: 0; width: 100%; }
  html:not(.mb) body #app #ob-foot #btnMaxBook { grid-column: span 2; order: 7; min-height: 38px; margin: 0; width: 100%; padding: 0 4px; }
  /* ligne 3 : informations de trades (en attente / TP / SL / lots ouverts) */
  html:not(.mb) body #app #ob-foot #orders-display { grid-column: 1 / -1; order: 8; text-align: center; font-size: 11.5px; opacity: .85; min-height: 0; margin: 0; }
  /* ligne 4 : statistiques en 6 cases égales */
  html:not(.mb) body #app #ob-foot .ob-stats { grid-column: 1 / -1; order: 9; display: grid !important; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 6px 0; border-top: 1px solid rgba(128,140,160,.2); border-bottom: 1px solid rgba(128,140,160,.2); }
  html:not(.mb) body #app #ob-foot .ob-stats .st { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
  html:not(.mb) body #app #ob-foot .ob-stats .st b { font-size: 12.5px !important; white-space: nowrap; }
  html:not(.mb) body #app #ob-foot .ob-stats .st small { font-size: 7.5px !important; letter-spacing: .3px; white-space: nowrap; }
  /* ligne 5 : rang animé ; ligne 6 : aide */
  html:not(.mb) body #app #ob-foot #mlRank { grid-column: 1 / -1; order: 10; margin: 0; }
  html:not(.mb) body #app #ob-foot .ob-touch-note { grid-column: 1 / -1; order: 11; display: block; margin: 0; }
}

/* Quiz : bouton « Agrandir » non écrasé (mobile) */
@media (max-width: 720px) {
  html:not(.mb) body #app .quiz-head { display: flex; align-items: center; gap: 8px; }
  html:not(.mb) body #app .quiz-head .quiz-title { flex: 1 1 auto; min-width: 0; }
  html:not(.mb) body #app #btnMaxQuiz { flex: 0 0 auto; width: auto; min-width: 0; height: 34px; padding: 0 12px; white-space: nowrap; line-height: 1; }
}

/* ===== Flèche « descendre en bas » (mobile) ===== */
@media (max-width: 720px) {
  #mlDown { position: fixed; right: 12px; bottom: 150px; z-index: 40; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(128,140,160,.45); background: rgba(20,28,44,.92); color: #e8eef9; box-shadow: 0 2px 10px rgba(0,0,0,.18); padding: 0; display: flex; align-items: center; justify-content: center; opacity: .85; -webkit-tap-highlight-color: transparent; }
  #mlDown[hidden] { display: none; }
  #mlDown i { width: 10px; height: 10px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg); margin-top: -4px; transition: transform .25s; }
  #mlDown.up i { transform: rotate(-135deg); margin-top: 4px; }
  body.theme-light #mlDown { background: rgba(255,255,255,.95); color: #243044; }
}

/* ===== Compatibilité : anciens / petits téléphones ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }          /* pas d'agrandissement automatique des textes */
@media (max-width: 720px) {
  /* sans grille CSS (très vieux navigateurs) : mêmes lignes, en boîtes flex */
  html.ml-nogrid body #app #ob-foot { display: flex !important; flex-wrap: wrap; }
  html.ml-nogrid body #app #ob-foot #btnMarketBuy, html.ml-nogrid body #app #ob-foot #btnMarketSell { flex: 1 1 46%; margin: 2px; }
  html.ml-nogrid body #app #ob-foot #btnFlat, html.ml-nogrid body #app #ob-foot #btnFollow { flex: 1 1 28%; margin: 2px; }
  html.ml-nogrid body #app #ob-foot .ob-stats { display: flex !important; flex: 1 1 100%; }
  html.ml-nogrid body #app #ob-foot .ob-stats .st { flex: 1 1 0; }
  html.ml-nogrid body #app #ob-foot #mlRank, html.ml-nogrid body #app #ob-foot #orders-display, html.ml-nogrid body #app #ob-foot .ob-touch-note { flex: 1 1 100%; }
  /* sans « gap » dans les boîtes flex : marges de remplacement */
  html.ml-nogap #mlRank > * + * { margin-left: 8px; }
  html.ml-nogap #ob-foot .ob-touch-note .ml-line > * + * { margin-left: 14px; }
  html.ml-nogap .quiz-head > * + * { margin-left: 8px; }
  /* appareils modestes : pas d'animations en boucle décoratives */
  html.ml-lite #mlRank .ml-ar, html.ml-lite .hint-pulse { animation: none !important; }
}
/* petits écrans (≈ 360 px puis ≈ 320 px) : textes resserrés pour ne jamais casser ni déborder */
@media (max-width: 360px) {
  html:not(.mb) body #app #ob-foot #btnMarketBuy, html:not(.mb) body #app #ob-foot #btnMarketSell { font-size: 12px; min-height: 42px; }
  html:not(.mb) body #app #ob-foot .ob-stats .st b { font-size: 11px !important; }
  html:not(.mb) body #app #ob-foot .ob-stats .st small { font-size: 6.5px !important; letter-spacing: 0; }
  #mlRank { font-size: 11px; padding: 5px 8px; }
  html:not(.mb) body #app #ob-foot #btnFlat, html:not(.mb) body #app #ob-foot #btnFollow { font-size: 11px; }
}
@media (max-width: 330px) {
  html:not(.mb) body #app #ob-foot #btnMarketBuy, html:not(.mb) body #app #ob-foot #btnMarketSell { font-size: 11px; }
  #mlRank .ml-pos { font-size: 13px; }
  #mlRank { font-size: 10.5px; }
  html:not(.mb) body #app #ob-foot .ob-stats .st b { font-size: 10px !important; }
}
