/* ===================== Monarch-X — version cellulaire =====================
   Toutes les règles sont préfixées par html.is-mobile (posée par js/mobile-detect.js) :
   la version ordinateur n'est pas affectée. */
html.is-mobile { --mx-tab: 58px; --mx-sb: env(safe-area-inset-bottom, 0px); --mx-st: env(safe-area-inset-top, 0px);
  --mx-sl: env(safe-area-inset-left, 0px); --mx-sr: env(safe-area-inset-right, 0px); --mx-ease: cubic-bezier(.2,.8,.2,1);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.is-mobile body { touch-action: manipulation; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; font-size: 15px; }
html.is-mobile #app { height: 100vh; height: 100dvh; padding-bottom: calc(var(--mx-tab) + var(--mx-sb)); }

/* ---------- Contrôles : cibles tactiles, pas de zoom iOS sur les champs (≥ 16px) ---------- */
html.is-mobile button, html.is-mobile .btn { font-size: 14px; border-radius: 10px; min-height: 38px; padding: 7px 12px; }
html.is-mobile button.small { font-size: 13px; padding: 6px 10px; min-height: 36px; }
html.is-mobile button.tiny, html.is-mobile .gtools button { min-height: 28px; padding: 2px 8px; font-size: 13px; }
html.is-mobile input, html.is-mobile select, html.is-mobile textarea { font-size: 16px; min-height: 42px; border-radius: 10px; padding: 8px 10px; }
html.is-mobile input[type=checkbox], html.is-mobile input[type=radio] { min-height: 0; width: 22px; height: 22px; padding: 0; accent-color: var(--gold); }
html.is-mobile input[type=color] { min-height: 36px; padding: 2px; }
html.is-mobile input[type=range] { min-height: 30px; }
html.is-mobile label { font-size: 13px; }
html.is-mobile .muted { font-size: 13px; }
html.is-mobile .badge { font-size: 11px; padding: 2px 7px; }

/* ---------- En-tête compact + tiroir ---------- */
html.is-mobile header.top { height: auto; min-height: 50px; gap: 8px; padding: var(--mx-st) calc(10px + var(--mx-sr)) 0 calc(12px + var(--mx-sl)); }
html.is-mobile .brand { font-size: 18px; } html.is-mobile .brand span { display: none; }
html.is-mobile #myChar, html.is-mobile .mx-burger { width: 42px; height: 42px; min-height: 42px; padding: 0; font-size: 20px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
html.is-mobile header.top > .world, html.is-mobile header.top > .calendar, html.is-mobile header.top > .me { display: none; }
html.is-mobile .mx-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .22s ease; z-index: 70; }
html.is-mobile body.mx-drawer-open .mx-scrim, html.is-mobile body.mx-dice-open .mx-scrim { opacity: 1; pointer-events: auto; }
html.is-mobile .mx-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, 340px); z-index: 80; background: linear-gradient(#2a2118, var(--panel) 30%);
  border-left: 1px solid var(--gold); transform: translateX(105%); transition: transform .26s var(--mx-ease); display: flex; flex-direction: column;
  padding: calc(10px + var(--mx-st)) calc(14px + var(--mx-sr)) calc(14px + var(--mx-sb)) 14px; box-shadow: -10px 0 40px rgba(0,0,0,.6); will-change: transform; }
html.is-mobile body.mx-drawer-open .mx-drawer { transform: none; }
html.is-mobile .mx-dr-head { display: flex; align-items: center; font-family: Georgia, serif; color: var(--gold2); font-size: 20px; margin-bottom: 10px; }
html.is-mobile .mx-dr-head .spacer { flex: 1; }
html.is-mobile .mx-dr-close, html.is-mobile .mx-x-inline { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; font-size: 17px; }
html.is-mobile .mx-dr-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
html.is-mobile .mx-dr-body .me { flex-wrap: wrap; font-size: 15px; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
html.is-mobile .mx-dr-body .me #logout { margin-left: auto; }
html.is-mobile .mx-dr-body .world { font-size: 15px; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
html.is-mobile .mx-dr-body .calendar { text-align: left; font-size: 14px; line-height: 1.5; border-radius: 14px; padding: 12px; }
html.is-mobile .mx-dr-foot button { width: 100%; min-height: 46px; font-size: 15px; }
html.is-mobile .mx-dr-foot .muted { margin: 8px 2px 0; }

/* ---------- Barre d'onglets en bas ---------- */
html.is-mobile nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(var(--mx-tab) + var(--mx-sb)); padding: 0 var(--mx-sr) var(--mx-sb) var(--mx-sl);
  background: rgba(26,21,15,.97); border-top: 1px solid var(--line); gap: 0; justify-content: space-around; box-shadow: 0 -6px 24px rgba(0,0,0,.45); }
html.is-mobile nav.tabs a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 0 2px;
  font-size: 10.5px; border-bottom: none; border-top: 2px solid transparent; color: var(--muted); white-space: nowrap; overflow: hidden; }
html.is-mobile nav.tabs a .mx-ic { font-size: 21px; line-height: 1; transition: transform .18s var(--mx-ease); }
html.is-mobile nav.tabs a.active { color: var(--gold2); border-top-color: var(--gold); background: radial-gradient(ellipse at 50% 0, rgba(216,180,90,.18), transparent 70%); }
html.is-mobile nav.tabs a.active .mx-ic { transform: translateY(-1px) scale(1.12); }
html.is-mobile nav.tabs a.hidden { display: none !important; }

/* ---------- Bouton flottant 🎲 + panneau de dés en bottom sheet ---------- */
html.is-mobile .mx-fab { position: fixed; z-index: 65; right: calc(14px + var(--mx-sr)); bottom: calc(var(--mx-tab) + var(--mx-sb) + 14px); width: 58px; height: 58px; min-height: 58px;
  border-radius: 50%; padding: 0; font-size: 28px; background: radial-gradient(circle at 35% 30%, #a5832f, #6b5320 70%); border: 1px solid var(--gold);
  box-shadow: 0 6px 18px rgba(0,0,0,.55), 0 0 0 3px rgba(216,180,90,.15); transition: transform .18s var(--mx-ease), opacity .18s; }
html.is-mobile .mx-fab:active { transform: scale(.92); }
html.is-mobile body.mx-dice-open .mx-fab { opacity: 0; pointer-events: none; transform: scale(.6); }
html.is-mobile .dice-panel, html.is-mobile .dice-panel.collapsed { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: min(80dvh, 680px); z-index: 75;
  border: 1px solid var(--gold); border-bottom: none; border-radius: 20px 20px 0 0; padding-bottom: var(--mx-sb); transform: translateY(105%); transition: transform .28s var(--mx-ease);
  box-shadow: 0 -10px 40px rgba(0,0,0,.6); will-change: transform; font-size: 15px; }
html.is-mobile body.mx-dice-open .dice-panel { transform: none; }
html.is-mobile .dice-panel.collapsed .dp-inner { display: flex; } html.is-mobile .dice-panel.collapsed .dp-head b { display: inline; }
html.is-mobile #diceCollapse { display: none; }
html.is-mobile .dice-panel .dp-head { padding: 0 12px 8px; font-size: 17px; }
html.is-mobile .dp-roller { padding: 10px 12px; gap: 8px; }
html.is-mobile .dp-dice { gap: 6px; }
html.is-mobile .dp-dice .die { min-height: 48px; font-size: 15px; border-radius: 12px; background: linear-gradient(#33291d, #241d14); }
html.is-mobile .dp-dice .die:active { background: #6b5320; }
html.is-mobile .dp-row { gap: 8px; } html.is-mobile #diceRoll { min-width: 92px; font-size: 16px; }
html.is-mobile .dp-target { font-size: 13px; }
html.is-mobile .dp-loghead { padding: 8px 12px; }
html.is-mobile .roll-log { padding: 8px 12px 12px; gap: 8px; }
html.is-mobile .rcard { border-radius: 14px; padding: 10px 12px; }
html.is-mobile .rc-total { font-size: 30px; }
html.is-mobile .dface { min-width: 26px; height: 26px; font-size: 14px; }
html.is-mobile .deg { font-size: 15px; margin-top: 4px; }
html.is-mobile .deg.crit-s, html.is-mobile .deg.crit-f { font-size: 16px; letter-spacing: .3px; text-transform: uppercase; }
html.is-mobile .rcard.nat20 { box-shadow: 0 0 14px rgba(63,191,90,.5); } html.is-mobile .rcard.nat1 { box-shadow: 0 0 14px rgba(208,64,64,.5); }
html.is-mobile .rc-actions button, html.is-mobile .rc-spell button { min-height: 40px; font-size: 13px; padding: 6px 10px; }
html.is-mobile .rc-label { font-size: 14px; }
/* Bulle de résultat quand le panneau est fermé */
html.is-mobile .mx-rollpop { position: fixed; z-index: 250; left: calc(12px + var(--mx-sl)); right: calc(84px + var(--mx-sr)); bottom: calc(var(--mx-tab) + var(--mx-sb) + 12px);
  opacity: 0; transform: translateY(16px) scale(.97); transition: opacity .2s ease, transform .24s var(--mx-ease); pointer-events: none; }
html.is-mobile .mx-rollpop.show { opacity: 1; transform: none; pointer-events: auto; }
html.is-mobile .mx-rollpop .rcard { box-shadow: 0 10px 30px rgba(0,0,0,.7); border-color: var(--gold); background: #2d2519; }
html.is-mobile .mx-rollpop .rc-more { display: none !important; }

/* ---------- Poignées / bottom sheets génériques ---------- */
html.is-mobile .mx-grab { height: 24px; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; flex-shrink: 0; }
html.is-mobile .mx-grab span { width: 46px; height: 5px; border-radius: 3px; background: #6b5a40; }
html.is-mobile .modal-bg { align-items: flex-end; background: rgba(0,0,0,.55); }
html.is-mobile .modal-bg > .modal { width: 100% !important; max-width: 100%; max-height: calc(100dvh - var(--mx-st) - 10px); border-radius: 20px 20px 0 0; border-bottom: none;
  padding: 0 calc(14px + var(--mx-sr)) calc(16px + var(--mx-sb)) calc(14px + var(--mx-sl)); position: relative; animation: mx-up .26s var(--mx-ease); overscroll-behavior: contain; }
html.is-mobile .modal-bg > .modal > h3:first-of-type { margin-top: 2px; padding-right: 44px; }
html.is-mobile .mx-x { position: absolute; top: 10px; right: calc(10px + var(--mx-sr)); width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; font-size: 17px; z-index: 3; }
html.is-mobile .modal [data-close] { min-width: 42px; min-height: 42px; font-size: 18px; border-radius: 50%; padding: 0; }
html.is-mobile .modal-foot { position: sticky; bottom: calc(-16px - var(--mx-sb)); background: var(--panel); padding: 10px 0 4px; flex-wrap: wrap; }
html.is-mobile .modal-foot button { min-height: 46px; flex: 1; font-size: 15px; }
@keyframes mx-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- Fiches (personnage / objet) ---------- */
html.is-mobile .modal-bg > .sheet-modal { height: calc(100dvh - var(--mx-st) - 8px); padding: 0; display: flex; flex-direction: column; }
html.is-mobile .sheet-head { padding: 0 12px 6px; gap: 10px; flex-wrap: wrap; }
html.is-mobile .portrait.big { width: 64px; height: 64px; border-radius: 14px; }
html.is-mobile .sheet-title h3 { font-size: 20px; }
html.is-mobile .sheet-actions { flex-wrap: wrap; gap: 6px; }
html.is-mobile .sheet-actions button { min-width: 42px; min-height: 42px; }
html.is-mobile .sheet-quick { padding: 4px 12px; gap: 6px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
html.is-mobile .sheet-quick .q { min-width: 76px; border-radius: 12px; padding: 6px 8px; flex-shrink: 0; }
html.is-mobile .sheet-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 6px 12px 0; scrollbar-width: none; gap: 4px; }
html.is-mobile .sheet-tabs::-webkit-scrollbar, html.is-mobile .sheet-quick::-webkit-scrollbar, html.is-mobile .mapbar::-webkit-scrollbar { display: none; }
html.is-mobile .sheet-tabs button { flex-shrink: 0; min-height: 42px; border-radius: 12px 12px 0 0; padding: 8px 14px; }
html.is-mobile .sheet-body { padding: 10px 12px 24px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
html.is-mobile .sheet-foot { padding: 8px 12px calc(8px + var(--mx-sb)); flex-wrap: wrap; }
html.is-mobile .sheet-foot button { min-height: 46px; flex: 1; }
html.is-mobile .sec .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px; }
html.is-mobile .sec h4 { font-size: 15px; padding-bottom: 3px; }
html.is-mobile .fld .val { font-size: 15px; }
html.is-mobile table.shlist { display: block; overflow-x: auto; font-size: 14px; }
html.is-mobile table.shlist td { padding: 6px 4px; }
html.is-mobile .rollbtn, html.is-mobile .sheet-rolls .rollbtn, html.is-mobile td.tools .rollbtn { min-height: 44px; min-width: 44px; font-size: 16px; padding: 6px 12px; border-radius: 12px; margin: 2px; }
html.is-mobile .sheet-rolls { gap: 6px; }
html.is-mobile .tk-rolls button, html.is-mobile .tk-atk button, html.is-mobile .ib-tools button { min-height: 40px; min-width: 40px; font-size: 14px; }
html.is-mobile .item-sheet .grid { grid-template-columns: 1fr 1fr; }

/* ---------- Carte & battlemaps ---------- */
html.is-mobile #view-map { flex-direction: column; }
html.is-mobile .toolbar { display: none; }
html.is-mobile body.mx-tools-open .toolbar { display: flex; position: absolute; left: calc(8px + var(--mx-sl)); right: calc(8px + var(--mx-sr)); bottom: 8px; z-index: 7; width: auto; height: auto;
  flex-direction: row; align-items: center; gap: 6px; padding: 8px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--gold); border-radius: 16px;
  background: rgba(32,27,21,.96); box-shadow: 0 8px 30px rgba(0,0,0,.6); scrollbar-width: none; animation: mx-up .2s var(--mx-ease); }
html.is-mobile .toolbar button.tool { width: 46px; height: 46px; min-height: 46px; flex-shrink: 0; font-size: 20px; border-radius: 12px; }
html.is-mobile .toolbar .sep { width: 0; height: 32px; border-top: none; border-left: 1px solid var(--line); margin: 0 2px; flex-shrink: 0; }
html.is-mobile .toolbar .swatches { grid-template-columns: repeat(4, 22px); flex-shrink: 0; }
html.is-mobile .toolbar .swatch { width: 22px; height: 22px; }
html.is-mobile .toolbar input[type=color] { width: 44px; height: 40px; flex-shrink: 0; }
html.is-mobile .toolbar input[type=range] { width: 96px; flex-shrink: 0; }
html.is-mobile .toolbar .lbl { font-size: 11px; flex-shrink: 0; }
html.is-mobile .layer-btn { width: auto; min-height: 40px; padding: 4px 12px !important; font-size: 13px !important; flex-shrink: 0; }
html.is-mobile .mx-tools-done { flex-shrink: 0; min-height: 46px; background: #6b5320; border-color: var(--gold); color: #fff; font-weight: bold; }
html.is-mobile .mapbar { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 6px calc(8px + var(--mx-sr)) 6px calc(10px + var(--mx-sl)); min-height: 50px; scrollbar-width: none; }
html.is-mobile .mapbar > *, html.is-mobile .mapbar .dm-only > * { flex-shrink: 0; }
html.is-mobile .mapbar .dm-only { display: inline-flex; gap: 6px; }
html.is-mobile .mapbar .dm-only.hidden { display: none !important; }
html.is-mobile .crumbs { white-space: nowrap; font-size: 14px; max-width: 70vw; overflow-x: auto; scrollbar-width: none; }
html.is-mobile .crumbs a { display: inline-block; padding: 6px 0; }
html.is-mobile .mapbar .scale, html.is-mobile .statusbar, html.is-mobile .tooltip { display: none !important; }
html.is-mobile .zoomctl { right: calc(12px + var(--mx-sr)); bottom: 86px; gap: 6px; }
html.is-mobile .zoomctl button { width: 46px; height: 46px; min-height: 46px; border-radius: 14px; font-size: 20px; background: rgba(42,35,27,.92); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
html.is-mobile .mx-mapfab { position: absolute; z-index: 6; left: calc(12px + var(--mx-sl)); bottom: 12px; display: flex; flex-direction: column; gap: 8px; transition: transform .22s var(--mx-ease); }
html.is-mobile .mx-mapfab button { width: 56px; height: 56px; min-height: 56px; padding: 0; border-radius: 16px; font-size: 21px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: rgba(42,35,27,.94); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
html.is-mobile .mx-mapfab button small { font-size: 10px; color: var(--muted); }
html.is-mobile .mx-mapfab button.active { background: #6b5320; border-color: var(--gold); }
html.is-mobile body.mx-tools-open .mx-mapfab { transform: translateY(-78px); }
html.is-mobile body.mx-tools-open .zoomctl { bottom: 150px; }
html.is-mobile .placing-hint { top: 10px; font-size: 14px; padding: 8px 14px; border-radius: 12px; max-width: 90%; text-align: center; }
html.is-mobile .init-box { left: 8px; right: 8px; width: auto; max-height: 46%; border-radius: 14px; font-size: 14px; }
html.is-mobile .ib-list li { padding: 8px 6px; }
/* Panneau de droite → bottom sheet */
html.is-mobile .side { position: fixed; left: 0; right: 0; bottom: calc(var(--mx-tab) + var(--mx-sb)); width: auto; max-height: 64dvh; z-index: 45; padding: 0 calc(12px + var(--mx-sr)) 16px calc(12px + var(--mx-sl));
  border: 1px solid var(--gold); border-bottom: none; border-radius: 20px 20px 0 0; font-size: 15px; transform: translateY(calc(100% + var(--mx-tab) + 60px)); transition: transform .28s var(--mx-ease);
  box-shadow: 0 -10px 34px rgba(0,0,0,.6); overscroll-behavior: contain; will-change: transform; }
html.is-mobile body.mx-side-open .side { transform: none; }
html.is-mobile .mx-side-head { position: sticky; top: 0; z-index: 2; background: var(--panel); margin: 0 -12px; padding: 0 12px 6px; border-bottom: 1px solid var(--line); }
html.is-mobile .mx-side-bar { display: flex; align-items: center; color: var(--gold2); font-size: 16px; }
html.is-mobile .mx-side-bar .spacer { flex: 1; }
html.is-mobile .side h3 { font-size: 16px; margin: 14px 0 6px; }
html.is-mobile .side li { padding: 10px 8px; min-height: 44px; border-radius: 10px; }
html.is-mobile .side .editor { border-radius: 14px; padding: 10px; }
html.is-mobile .side .editor button, html.is-mobile .pbtns button { min-height: 42px; }
html.is-mobile .pdesc { font-size: 15px; line-height: 1.5; }
html.is-mobile .contents li, html.is-mobile .bm-list li, html.is-mobile .inh li { min-height: 44px; padding: 6px; }

/* ---------- Pages (personnages, objets, empire, combat, notes, joueurs) ---------- */
html.is-mobile .view { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
html.is-mobile .page { padding: 12px calc(12px + var(--mx-sr)) 96px calc(12px + var(--mx-sl)); }
html.is-mobile .page-head { flex-wrap: wrap; gap: 8px; }
html.is-mobile .page-head h2 { margin: 6px 0; font-size: 22px; }
html.is-mobile .filters { gap: 8px; } html.is-mobile .filters > * { flex: 1 1 140px; }
html.is-mobile .grid2, html.is-mobile .groups-list { grid-template-columns: 1fr; }
html.is-mobile .card { border-radius: 16px; padding: 14px; overflow-x: auto; }
html.is-mobile .bank-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
html.is-mobile .bank-card { border-radius: 16px; transition: transform .15s ease; }
html.is-mobile .bank-card:active { transform: scale(.98); }
html.is-mobile .bank-card > img, html.is-mobile .bank-card .noimg { height: 140px; }
html.is-mobile .bk-name { font-size: 16px; }
html.is-mobile .bk-btns button { min-height: 38px; }
html.is-mobile .notes-layout { grid-template-columns: 1fr; height: auto; }
html.is-mobile .notes-list { max-height: 30dvh; }
html.is-mobile .notes-list .item { padding: 10px; min-height: 44px; }
html.is-mobile .note-edit .panes { grid-template-columns: 1fr; }
html.is-mobile .note-edit textarea { min-height: 40dvh; }
html.is-mobile table { font-size: 14px; } html.is-mobile th, html.is-mobile td { padding: 8px 6px; }
html.is-mobile .chip { padding: 4px 10px 4px 4px; font-size: 13px; }
html.is-mobile .chip img { width: 26px; height: 26px; }

/* ---------- Divers ---------- */
html.is-mobile .toast { bottom: calc(var(--mx-tab) + var(--mx-sb) + 84px); max-width: 88vw; border-radius: 12px; font-size: 14px; padding: 10px 16px; text-align: center; }
html.is-mobile .show-banner { font-size: 13px; flex-wrap: wrap; }
html.is-mobile .viewer button { min-width: 48px; min-height: 48px; border-radius: 50%; }
html.is-mobile .viewer .vclose { top: calc(10px + var(--mx-st)); }
html.is-mobile .mx-ctx { position: fixed; z-index: 120; min-width: 230px; max-width: 86vw; display: flex; flex-direction: column; padding: 6px; background: rgba(32,27,21,.98);
  border: 1px solid var(--gold); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.7); animation: mx-pop .16s var(--mx-ease); }
html.is-mobile .mx-ctx button { text-align: left; border: none; background: transparent; min-height: 46px; font-size: 15px; border-radius: 10px; }
html.is-mobile .mx-ctx button:active { background: #3a2d1c; }
html.is-mobile .mx-ctx .mx-ctx-cancel { color: var(--muted); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }
@keyframes mx-pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Paysage (téléphone couché) ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  html.is-mobile { --mx-tab: 46px; }
  html.is-mobile header.top { min-height: 42px; }
  html.is-mobile #myChar, html.is-mobile .mx-burger { width: 38px; height: 38px; min-height: 38px; }
  html.is-mobile nav.tabs a { flex-direction: row; gap: 6px; font-size: 12px; }
  html.is-mobile nav.tabs a .mx-ic { font-size: 18px; }
  html.is-mobile .dice-panel { height: calc(100dvh - 20px); left: auto; width: min(420px, 60vw); border-radius: 20px 0 0 0; }
  html.is-mobile .dice-panel.collapsed { left: auto; width: min(420px, 60vw); }
  html.is-mobile .side { left: auto; width: min(400px, 55vw); max-height: calc(100dvh - var(--mx-tab) - 60px); border-radius: 20px 0 0 0; }
  html.is-mobile .modal-bg > .modal { max-height: calc(100dvh - 6px); }
  html.is-mobile .mx-mapfab { flex-direction: row; }
  html.is-mobile .zoomctl { bottom: 12px; flex-direction: row; right: calc(84px + var(--mx-sr)); }
  html.is-mobile body.mx-tools-open .zoomctl { bottom: 84px; }
  html.is-mobile .mx-fab { width: 50px; height: 50px; min-height: 50px; font-size: 24px; bottom: calc(var(--mx-tab) + var(--mx-sb) + 10px); }
}

/* ---------- Écran de connexion ---------- */
html.is-mobile .login-page { padding: var(--mx-st) 12px var(--mx-sb); min-height: 100dvh; height: auto; }
html.is-mobile .login-card { width: min(380px, 94vw); padding: 22px 18px; border-radius: 18px; }
html.is-mobile .login-card .player-btn { min-height: 48px; font-size: 16px; border-radius: 12px; }
html.is-mobile .login-card button[type=submit] { min-height: 50px; font-size: 16px; border-radius: 12px; }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html.is-mobile *, html.is-mobile *::before, html.is-mobile *::after { transition: none !important; animation: none !important; }
}

/* ---------- Ajustements (empilement & fiches) ---------- */
html.is-mobile .modal-bg { z-index: 62; }            /* au-dessus de la barre d'onglets, sous le bouton 🎲 et le panneau de dés */
html.is-mobile .modal-bg > .sheet-modal { overflow: hidden; }
html.is-mobile .sheet-head { position: relative; padding-right: 60px; }
html.is-mobile .sheet-actions [data-close], html.is-mobile .sheet-actions #shClose { min-width: 42px; min-height: 42px; border-radius: 50%; padding: 0; font-size: 18px; position: absolute; top: 0; right: calc(10px + var(--mx-sr)); }
html.is-mobile .side { padding-bottom: 84px; }
html.is-mobile .sheet-rolls { padding: 4px calc(12px + var(--mx-sr)) 6px calc(12px + var(--mx-sl)); }

/* 🎵 musique + ⚔ actions (mobile) */
html.is-mobile .music-btn { width: 42px; height: 42px; min-height: 42px; padding: 0; font-size: 20px; border-radius: 12px; }
html.is-mobile .music-panel { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
html.is-mobile .music-panel input[type=range] { min-height: 32px; }
html.is-mobile .sound-unlock { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
html.is-mobile .music-box .mus-list li button { min-width: 36px; min-height: 36px; }
body:not(.is-dm) #mxActBtn { display: none !important; }
html.is-mobile .mx-world-quick { margin-left: auto; margin-right: 6px; border-radius: 999px; padding: 6px 10px; font-size: 16px; border: 1px solid #8a6d3b; background: linear-gradient(90deg, #1d2a1c, #2a1f3a); color: #f3e3bd; }
html.is-mobile .mx-world-quick.hidden { display: none; }
html.is-mobile .mx-dr-body .world { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
html.is-mobile .mx-dr-body .world-switch { font-size: 16px; padding: 10px 14px; }
html:not(.is-mobile) .mx-world-quick { display: none; }
html.is-mobile .mx-dr-body .calendar { flex-wrap: wrap; }
html.is-mobile .mx-dr-body .calendar .cal-row { font-size: 14px; line-height: 26px; white-space: normal; }
html.is-mobile .mx-dr-body .calendar .cal-btns button.small, html.is-mobile .mx-dr-body .calendar .cal-side button.small { padding: 4px 10px; font-size: 14px; line-height: 18px; }
html.is-mobile .mx-dr-body .calendar .cal-side { border-left: 0; padding-left: 0; width: 100%; justify-content: space-between; }
html.is-mobile .mx-dr-body .calendar .cal-side .cal-note { font-size: 12px; line-height: 15px; }
/* 👁 Visible / 🚫 Caché (MJ) : cibles tactiles */
html.is-mobile .vis-toggle button { min-height: 42px; padding: 0 12px; font-size: 15px; }
html.is-mobile .sheet-actions .vis-toggle { order: -1; }
html.is-mobile .bk-selbar { gap: 6px; }
html.is-mobile .bk-selbar button { min-height: 40px; }
html.is-mobile .bank-card .bk-sel { width: 26px; height: 26px; }
html.is-mobile .vis-toggle button[data-visset="players"] { max-width: 46vw; }
html.is-mobile .vis-pick label { min-height: 40px; align-items: center; }
html.is-mobile .vis-pick input { width: 24px; height: 24px; }
html.is-mobile .sh-labels .grid { grid-template-columns: 1fr 1fr; gap: 8px; }
html.is-mobile .sh-labels select, html.is-mobile .sh-labels input { min-height: 42px; font-size: 16px; width: 100%; }
