/* ============================================================
   SHUFFLE DRUMMER — Layout TÉLÉPHONE de la vraie machine
   ------------------------------------------------------------
   Chargée en dernier dans index.html. TOUTES les règles sont
   scopées `html.sd-mobile` (classe posée par le script de tête
   d'index.html sur tactile + écran ≤760px) → ZÉRO effet desktop.
   main.js::fitMachine() ne scale PAS la machine dans ce mode.

   PRINCIPE (demande utilisateur 2026-07-04) : **AUCUN scroll
   vertical de page**. La machine est une app plein écran
   (100dvh, overflow hidden) en colonne flex :
     edge → top (LCD | roue | knobs) → ctrl-row → mixer →
     bottom-comp (flex:1) → footer
   ET (demande utilisateur 2026-09-27, « faut que tout rentre,
   quitte à mettre moins de fonctionnalités ») **AUCUN défilement
   HORIZONTAL** : header, mixer (8 voies), onglets, footer, grille
   STEP (toutes résolutions), outils du sampler et SYNTH tiennent
   dans 360 px. Seul défilement restant : l'INTÉRIEUR des panneaux
   d'onglet (vertical interne). Vérifié à 360/375/390/412/430 px.
   Les `!important` ne servent QUE contre des styles inline
   (ADR-16 : les inline d'index.html sont préservés).
   ============================================================ */

/* ── App plein écran ────────────────────────────────────── */
html.sd-mobile,
html.sd-mobile body {
  height: 100dvh;
  overflow: hidden;
  /* pas de rubber-band iOS qui tire toute l'app */
  overscroll-behavior: none;
}
html.sd-mobile body {
  display: block;
  padding: 0;
  min-height: 0;
}

/* ── Confort tactile iOS ────────────────────────────────── */
/* pas de flash gris au tap, pas de loupe/callout d'appui long
   (l'appui long est un geste de l'app : menu roue, pads…) */
html.sd-mobile * {
  -webkit-tap-highlight-color: transparent;
}
html.sd-mobile *:not(input):not(textarea) {
  -webkit-touch-callout: none;
}
/* tue le zoom double-tap sur les boutons (les faders/knobs/steps ont
   déjà touch-action:none — plus spécifiques) */
html.sd-mobile button {
  touch-action: manipulation;
}
html.sd-mobile .machine {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 4px 6px calc(env(safe-area-inset-bottom, 0px) + 4px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* tout est fixe, seul le compartiment bas absorbe le reste */
html.sd-mobile .machine > * { flex-shrink: 0; }

/* ── Edge (header) : UNE seule ligne qui TIENT dans l'écran ──
   (2026-09-27) Plus aucun défilement horizontal : ◎ MIDI retiré en mode
   téléphone (pas de Web MIDI sur iPhone ; sur Android l'entrée MIDI se
   connecte toute seule, le bouton n'était qu'un témoin) ; thème, HELP et
   ⚙ ADMIN passent en icônes, le nom du compte est tronqué. */
html.sd-mobile .edge {
  flex-wrap: nowrap;
  gap: 4px;
  padding-bottom: 3px;
  margin-bottom: 4px;
}
html.sd-mobile .edge-title {
  font-size: 12px;
  letter-spacing: 0.05em;
  transform: none;
  white-space: nowrap;
  flex-shrink: 0;
}
html.sd-mobile .edge-cat-shadow { height: 18px; margin: 0 0 0 -3px; }
html.sd-mobile .edge > span:last-child {
  transform: none !important;   /* inline translateY(7px) */
  flex-wrap: nowrap;
  gap: 4px !important;
  min-width: 0;
}
html.sd-mobile .edge .pact-btn,
html.sd-mobile .edge .midi-edge-btn,
html.sd-mobile .edge .help-btn,
html.sd-mobile .edge .vol-btn {
  height: 24px;
  font-size: 8px;
  padding: 2px 5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
html.sd-mobile .edge > span:last-child > span { gap: 4px !important; min-width: 0; }
html.sd-mobile #midi-edge-btn { display: none; }
/* ▶ TUTO : pas de place dans l'en-tête à 360 px (398 px mesurés) */
html.sd-mobile #tuto-btn { display: none; }
/* libellés → icônes : font-size 0 sur le bouton, glyphe en ::after (les
   textContent posés par le JS et les title anglais restent intacts) */
html.sd-mobile #theme-btn,
html.sd-mobile .edge #help-btn,
html.sd-mobile .edge #admin-btn {
  font-size: 0 !important;      /* inline font-size:11px (thème) */
  letter-spacing: 0 !important;
  padding: 0 !important;
  width: 26px;
  height: 24px;
  flex-shrink: 0;
}
html.sd-mobile #theme-btn::after { content: '◐'; font-size: 14px; }
html.sd-mobile #help-btn::after { content: '?'; font-size: 13px; font-weight: 700; }
html.sd-mobile #admin-btn::after { content: '⚙'; font-size: 13px; }
html.sd-mobile #account-btn { max-width: 92px; overflow: visible; }
html.sd-mobile #account-btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Top : LCD | roue+transport | 4 knobs — UNE rangée ──── */
html.sd-mobile .top {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  padding: 6px;
  margin-bottom: 6px;
  align-items: center;
}
html.sd-mobile .screen-col { min-width: 0; align-self: stretch; }
html.sd-mobile .screen {
  max-width: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 7px 9px;
  overflow: hidden;
}
html.sd-mobile .screen-bpm { font-size: 19px; }
/* TIME CORRECT (élément inline créé par tabs.js) : compact pour tenir
   sur la ligne du BPM dans le LCD étroit ; filets anti-coupure :
   la ligne BPM/TC peut passer en 2 lignes (:has, iOS 15.4+) et le
   texte s'ellipse plutôt que d'être tranché par le bord du LCD. */
html.sd-mobile #scr-tc {
  font-size: 8px !important;
  letter-spacing: 0 !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.sd-mobile .screen div:has(> #scr-tc) { flex-wrap: wrap; }
/* LOCK BPM (témoin créé par tabs.js, font-size inline 14px) : il ne tenait
   pas à droite du BPM dans le LCD étroit → seul un « L » dépassait. Il passe
   sur sa propre ligne, en petit, sous le BPM. */
html.sd-mobile .screen div:has(> #scr-bpmlock) { flex-wrap: wrap; row-gap: 0; }
html.sd-mobile #scr-bpmlock { font-size: 9px !important; flex-basis: 100%; line-height: 1.2; }
html.sd-mobile .screen-status { font-size: 9px; margin-top: 2px; }
/* Témoin CLICK (métronome, transport.js) à droite de la ligne d'état */
html.sd-mobile #scr-click { font-size: 8px !important; margin-top: 2px !important; letter-spacing: 0 !important; }
html.sd-mobile .screen-meta { font-size: 8px; margin-top: 2px; }
/* état / méta : 2 lignes maxi (sinon « SYNTH · 53 MIDNIGHT FUNK » en prenait
   3 et poussait le bas du LCD hors du cadre) */
html.sd-mobile .screen-status,
html.sd-mobile .screen-meta {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 11px;   /* hauteur de ligne ENTIÈRE : sinon le haut de la ligne
                          suivante (rognée) dépassait d'un pixel */
}
html.sd-mobile #scr-sample { font-size: 9px !important; margin-top: 2px !important; min-height: 10px !important; }
html.sd-mobile #scr-bars-wrap { margin-top: 3px !important; }
/* Roue : plus de « spacer » symétrique du bouton ∞ (34 px + gap perdus) :
   roue, libellé et transport s'alignent à GAUCHE de leur colonne, ∞ à droite
   de la roue → ~45 px rendus au LCD (sur 360 px, « BPM:90 » était rogné en
   « BPM:9 »). --sd-wheel = diamètre, repris par le libellé et le transport. */
html.sd-mobile { --sd-wheel: 92px; }
html.sd-mobile .wheel-spacer { display: none; }
html.sd-mobile .wheel-jog-row { gap: 5px; }
html.sd-mobile .wheel-col { align-items: flex-start; }
html.sd-mobile .wheel-outer { width: var(--sd-wheel); height: var(--sd-wheel); }
html.sd-mobile .ptn-num { font-size: 19px; }
html.sd-mobile .ptn-name { font-size: 8px; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.sd-mobile .wheel-label { font-size: 8px; letter-spacing: 0.1em; margin-top: 2px; width: var(--sd-wheel); }
/* Cibles ADAPTATIVES : minimum compact (petits écrans, zéro-scroll
   garanti), et elles grandissent vers ~44pt sur les écrans hauts
   (iPhone plein écran / PWA) grâce au clamp en dvh. */
html.sd-mobile .transport-row { width: var(--sd-wheel); margin-top: 4px; gap: 2px; }
html.sd-mobile .trn-btn { height: clamp(30px, 5dvh, 42px); font-size: 10px; border-radius: 3px; }
/* wrapper inline (fx-col + gpitch) — 3e enfant du .top */
html.sd-mobile .top > div:last-child { justify-content: center !important; }
html.sd-mobile .fx-col { min-width: 0; gap: 5px; }
html.sd-mobile .knob-pair { gap: 6px; }
html.sd-mobile .knob-body { width: 38px; height: 38px; }
html.sd-mobile .knob-label { font-size: 8px; margin-top: 2px; letter-spacing: 0.1em; }
html.sd-mobile .knob-value { font-size: 8px; min-height: 9px; }
html.sd-mobile .knob-wrap { min-width: 40px; gap: 1px; }

/* ── Rangée DRUMS BANK / 12 BITS / … : 2 lignes compactes ── */
html.sd-mobile .ctrl-row {
  flex-wrap: wrap;
  gap: 4px !important;
  margin: 0 0 6px !important;   /* inline margin:8px 0 8px */
}
/* 18 % (et non plus 23 %) depuis l'ajout de EXPORT LOOP : 5 boutons par
   ligne, sinon REC LIVE partait seul sur une 3e ligne (page sans scroll). */
html.sd-mobile .ctrl-row .pitch-btn,
html.sd-mobile .ctrl-row #beat-card-btn {
  flex: 1 1 18%;
  height: clamp(30px, 4.8dvh, 40px);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 0 3px;
  border-radius: 3px;
}
html.sd-mobile .ctrl-row #beat-card-btn {
  margin-left: 0 !important;
  height: clamp(30px, 4.8dvh, 40px) !important;
}
/* Écrans BAS (iPhone SE, petits Android : ≤ 600 px utiles) : roue, knobs,
   transport et rangée de boutons un cran plus petits → ~25 px rendus aux
   panneaux du bas (STEP gagne une rangée de pas). */
@media (max-height: 600px) {
  html.sd-mobile { --sd-wheel: 80px; }
  html.sd-mobile .top { padding: 5px; margin-bottom: 5px; }
  html.sd-mobile .wheel-label { letter-spacing: 0.04em; }
  html.sd-mobile .ptn-num { font-size: 17px; }
  html.sd-mobile .ptn-name { max-width: 64px; }
  html.sd-mobile .trn-btn { height: 28px; }
  html.sd-mobile .knob-body { width: 34px; height: 34px; }
  html.sd-mobile .fx-col { gap: 3px; }
  html.sd-mobile .ctrl-row .pitch-btn,
  html.sd-mobile .ctrl-row #beat-card-btn { height: 28px !important; }
  /* le LCD ne dicte plus la hauteur du bloc (c'est la roue) : il la
     REMPLIT en absolu. Pour tenir, la ligne SW/FDR/SND (swing déjà lu sur
     son knob) disparaît et l'état passe sur 1 ligne. */
  html.sd-mobile .screen-col { position: relative; }
  html.sd-mobile .screen { position: absolute; inset: 0; width: auto; height: auto; padding: 5px 8px; }
  html.sd-mobile .screen-meta { display: none; }
  html.sd-mobile .screen-status { -webkit-line-clamp: 1; }
}
/* EXPORT LOOP : pas d'auto-marge sur téléphone ; libellé court (même
   astuce que .pat-export-btn) pour tenir sur les 2 lignes existantes. */
html.sd-mobile .ctrl-row .export-wav-btn { margin-left: 0; font-size: 0; letter-spacing: 0; }
html.sd-mobile .ctrl-row .export-wav-btn::after { content: 'EXPORT LOOP'; font-size: 9px; letter-spacing: 0.06em; }

/* ── Mixer : les 8 voies TIENNENT dans la largeur ──────────
   (2026-09-27) Voies FLUIDES (flex 1 / min-width 0) au lieu de 52 px fixes
   + défilement horizontal : ~43 px par voie sur un iPhone, ~39 px sur un
   Android de 360 px — K S H O C R + SAMPLE + PIANO visibles d'un coup. */
html.sd-mobile .mixer {
  overflow: hidden;
  justify-content: space-between;
  gap: 3px;
  padding: 8px 5px 6px;
  margin-bottom: 6px;
}
html.sd-mobile .channel { flex: 1 1 0; min-width: 0; gap: 4px; }
html.sd-mobile .fader-track { width: 100%; max-width: 44px; height: 64px; }
html.sd-mobile .fader-thumb { width: 36px; margin-left: -18px; }
html.sd-mobile .drum-btn,
html.sd-mobile .extra-load-btn { width: 100%; max-width: 46px; }
html.sd-mobile .drum-btn { height: 40px; font-size: 13px; }
html.sd-mobile .ms-row { gap: 2px; }
html.sd-mobile .ms-btn { width: 19px; }
/* Plus de 8 voies (SMP2..4 et/ou P2..P4 chargés) : décision user 2026-09-27 —
   DÉFILEMENT LATÉRAL du mixer (pas 2 rangées). Chaque voie garde la largeur
   qu'elle a avec 8 voies ; les chevrons ‹ › (main.js::initMobileScrollHints)
   s'allument seuls. ≤ 8 voies : rien ne change. Les boutons K/S/H… passent en
   pan-x pour que le glissé du doigt fasse défiler (faders : vertical, inchangé). */
html.sd-mobile .mixer:has(> .channel:nth-child(9)) {
  overflow-x: auto;
  overflow-y: hidden;
  justify-content: flex-start;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
html.sd-mobile .mixer:has(> .channel:nth-child(9))::-webkit-scrollbar { display: none; }
html.sd-mobile .mixer:has(> .channel:nth-child(9)) > .channel { flex: 0 0 calc((100% - 7 * 3px) / 8); }
html.sd-mobile .mixer:has(> .channel:nth-child(9)) :is(.drum-btn, .extra-load-btn) { touch-action: pan-x; }

/* ── Onglet BEAT (vue faders) — bascule mixer ⟷ panneaux ──
   Le bouton #btab-beat n'existe qu'en sd-mobile (créé par main.js).
   body.sd-beat-view = vue faders : les panneaux du bas se replient
   (seule la barre d'onglets reste) et le mixer prend toute la hauteur,
   glissières comprises. Sans la classe : le mixer s'efface et le
   panneau actif (sampler/pads/step…) devient géant. */
/* !important requis : sampler.css pose `#pane-sampler.active
   { display:flex !important; }` — face à un important, seule une règle
   important PLUS SPÉCIFIQUE l'emporte. */
html.sd-mobile body.sd-beat-view .bottom-pane.active,
html.sd-mobile body.sd-beat-view #pane-sampler.active { display: none !important; }
html.sd-mobile body.sd-beat-view .bottom-comp {
  flex: 0 0 auto;
  min-height: 0;
}
html.sd-mobile body.sd-beat-view .mixer {
  flex: 1 1 auto;
  min-height: 150px;
}
html.sd-mobile body.sd-beat-view .fader-track {
  height: auto;
  flex: 1 1 auto;
  min-height: 64px;
}
html.sd-mobile body:not(.sd-beat-view) .mixer { display: none; }
/* EXCEPTION : dans l'onglet SEQUENCER (PRINT capture le mix courant),
   les faders restent visibles au-dessus du panneau, en BANDE MINCE (sans
   pan ni EQ, glissières courtes) — et seulement si l'écran est assez haut :
   en dessous de 700 px le panneau n'avait plus que ~90 px (iPhone réel) voire
   plus rien (iPhone SE) ; les niveaux se dosent alors dans BEAT. (:has,
   iOS 15.4+ — ailleurs le mixer reste accessible via BEAT.) */
@media (min-height: 700px) {
  html.sd-mobile body:not(.sd-beat-view):has(#pane-pattern.active) .mixer {
    display: flex;
    padding: 5px 5px 4px;
  }
}
html.sd-mobile body:not(.sd-beat-view):has(#pane-pattern.active) .fader-track { height: 44px; }
html.sd-mobile body:not(.sd-beat-view):has(#pane-pattern.active) :is(.drum-btn, .extra-load-btn) {
  height: 26px;
  font-size: 11px;
}
html.sd-mobile body:not(.sd-beat-view):has(#pane-pattern.active) :is(.pan-knob, .smp-eq-btn) { display: none; }

/* ── Onglet SEQUENCER compact : PRINT · RESET · EXPORT sur une ligne ──
   Libellés raccourcis (RESET SEQUENCES → RESET, EXPORT SEQUENCES .WAV
   → EXPORT ; les title anglais restent) et TOTAL BARS retiré. */
html.sd-mobile .pat-header { flex-wrap: wrap; row-gap: 4px; }
html.sd-mobile #pat-total-bars { display: none; }
html.sd-mobile .pat-reset-btn,
html.sd-mobile .pat-export-btn {
  font-size: 0;
  letter-spacing: 0;
}
html.sd-mobile .pat-reset-btn::after {
  content: '⟲ RESET';
  font-size: 10px;
  letter-spacing: 0.1em;
}
html.sd-mobile .pat-export-btn::after {
  content: '↓ EXPORT';
  font-size: 10px;
  letter-spacing: 0.1em;
}
/* en vue BEAT, l'onglet de panneau resté .active ne doit pas le paraître */
html.sd-mobile body.sd-beat-view .btab.active:not(#btab-beat) {
  color: var(--text-knob);
  border-bottom-color: transparent;
  background: none;
  text-shadow: none;
}

/* ── Compartiment bas : absorbe TOUT le reste de l'écran ─── */
html.sd-mobile .bottom-comp {
  flex: 1 1 auto;
  min-height: 110px;
  height: auto;
  margin-bottom: 4px;
}
/* onglets : UNE ligne qui TIENT dans l'écran (2026-09-27, plus de
   défilement : SEQUENCER, MASTER et ⚙ étaient hors écran), TOUJOURS EN BAS
   du compartiment (sous le panneau, à portée de pouce — même position
   qu'en vue BEAT). Les 9 onglets se partagent la largeur (flex 1 1 auto) ;
   SEQUENCER s'affiche « SEQ ». */
html.sd-mobile .bottom-tabs {
  order: 2;
  flex-wrap: nowrap;
  overflow: hidden;
  border-bottom: none;
  border-top: 1px solid #141518;
}
html.sd-mobile .bottom-comp > .bottom-pane { order: 1; }
html.sd-mobile .btab {
  flex: 1 1 auto;
  min-width: 0;
  padding: clamp(9px, 1.5dvh, 14px) 1px;
  font-size: 10px;
  letter-spacing: 0.04em;
  /* barre en bas → l'indicateur d'onglet actif passe en HAUT du bouton */
  border-bottom: none;
  border-top: 2px solid transparent;
}
html.sd-mobile .btab-dot { margin-left: 2px; }
html.sd-mobile .btab.active { border-bottom: none; border-top-color: var(--accent); }
html.sd-mobile .btab-settings { flex: 0 0 28px; font-size: 14px; }
html.sd-mobile #btab-pattern { font-size: 0; letter-spacing: 0; }
html.sd-mobile #btab-pattern::before { content: 'SEQ'; font-size: 10px; letter-spacing: 0.04em; }
@media (max-width: 370px) {
  html.sd-mobile .btab:not(.btab-settings),
  html.sd-mobile #btab-pattern::before { font-size: 9px; letter-spacing: 0.02em; }
}

/* ── Chevrons de défilement (créés par main.js, mobile uniquement) ──
   Indiquent qu'une zone défile horizontalement (mixer, grille STEP,
   barre d'onglets) ; visibles seulement quand du contenu est caché de
   ce côté ; tap = fait défiler d'un écran. Esthétique LCD : capsule
   sombre translucide + chevron orange. Depuis 2026-09-27 ces 3 zones
   tiennent dans l'écran : les chevrons restent un simple filet de
   sécurité (ils ne s'affichent que si quelque chose déborde encore). */
html.sd-mobile .sd-scroll-hint {
  position: fixed;
  z-index: 800;
  width: 20px;
  height: 46px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--accent-dim);
  border-radius: 5px;
  background: rgba(21, 12, 2, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  color: var(--accent-bright);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
html.sd-mobile .sd-scroll-hint.visible { opacity: 0.9; pointer-events: auto; }
/* panneaux : scroll vertical INTERNE uniquement */
html.sd-mobile .bottom-pane {
  min-width: 0;
  min-height: 0;
  overscroll-behavior: contain;
}

/* ── STEP (séquenceur) : défilement horizontal ──────────── */
html.sd-mobile #step-seq {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
/* la nav (◀ pips M1 ▶ :2 4M x2) wrappe sur 2 lignes au lieu de forcer
   un débordement horizontal de toute la grille */
html.sd-mobile #step-seq .seq-nav {
  width: auto;
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 4px;
  margin-bottom: 4px;
}
/* Steps FLUIDES : la mesure TIENT dans la largeur à TOUTES les résolutions
   (2026-09-27 — avant, le 1/32 débordait et défilait latéralement) : ~21 px
   par case en 1/16, ~9 px en 1/32. Le mini-timeshift (drag de 44px, trop
   fin au doigt) est masqué — il reste sur desktop. */
html.sd-mobile #step-seq .seq-beat-nums,
html.sd-mobile #step-seq .seq-row {
  width: auto;
  min-width: 0;
}
html.sd-mobile .seq-steps-wrap { min-width: 0; }
html.sd-mobile .seq-step {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: clamp(30px, 4.8dvh, 40px);
}
html.sd-mobile .seq-beat-num { flex: 1 1 0; width: auto; min-width: 0; }
html.sd-mobile .seq-group,
html.sd-mobile .seq-beat-group { flex: 1 1 0; min-width: 0; gap: 1px; padding: 1px; }
/* 1/32 et 1/16T : 32 / 24 numéros ne tiennent pas → seuls ceux des temps
   restent (1 · 9 · 17 · 25 en 1/32) */
html.sd-mobile .seq-beat-group:has(> :nth-child(6)) > .seq-beat-num:not(.downbeat) { visibility: hidden; }
html.sd-mobile .seq-steps-wrap,
html.sd-mobile #step-seq .seq-beat-nums { gap: 3px; }
html.sd-mobile .seq-ts-mini { display: none; }
/* le bouton CLEAR (68px) des rangées SMP/PNO devient un ✕ compact,
   aligné sur le ⟳ des drums — sinon ces deux rangées débordent et
   forcent le scroll de TOUTE la grille */
html.sd-mobile .seq-clear-row-btn {
  width: 22px;
  height: 22px;
  font-size: 0;
  letter-spacing: 0;
}
html.sd-mobile .seq-clear-row-btn::before {
  content: '✕';
  font-size: 11px;
}
html.sd-mobile #step-seq .seq-beat-nums { padding-left: 16px; padding-right: 29px; }
html.sd-mobile .seq-label { width: 16px; font-size: 11px; }
html.sd-mobile .seq-nav-btn { width: 34px; height: 34px; }
html.sd-mobile .seq-bar-pip { width: 20px; height: 12px; }
html.sd-mobile .seq-len-btn { padding: 6px 8px; }
html.sd-mobile .seq-clear-btn { padding: 6px 6px; }
html.sd-mobile .seq-ts-mini { width: 44px; height: 22px; }
html.sd-mobile .seq-shuf-btn { width: 22px; height: 22px; font-size: 12px; }
/* (hint « Right click to double step » supprimé partout 2026-07-10) */

/* ── FX : une seule colonne (sliders, puis rack MFX) ────── */
/* le pane doit SCROLLER verticalement (desktop : overflow:hidden +
   grid flex:1 — ici le contenu en colonne dépasse la hauteur) */
html.sd-mobile #pane-fx.active { overflow-y: auto; }
html.sd-mobile #pane-fx .fx-pane-grid { flex: none; min-height: auto; }
html.sd-mobile .fx-pane-grid { flex-direction: column; gap: 10px; }
html.sd-mobile .fx-left-col { width: 100%; max-width: none; min-width: 0; }
html.sd-mobile .fx-right-col { width: 100%; }
/* pads MFX plus GROS (le pane scrolle en interne, la hauteur est libre) */
html.sd-mobile .mfx-pads-grid {
  flex: none;
  grid-template-rows: repeat(4, minmax(60px, auto));
  gap: 6px;
}
html.sd-mobile .mfx-pad-btn { font-size: 10px; letter-spacing: 0.08em; }

/* ── MASTER : titres compacts ; celui du BUS COMPRESSOR
   (2 boutons absolute à droite) poussé à gauche ──────────── */
html.sd-mobile #pane-comp .pane-section-title { font-size: 11px; letter-spacing: 0.12em; }
html.sd-mobile #pane-comp div[style*="cat.png"] .pane-section-title { margin-right: auto; }

/* ── SAMPLER : 16 slice-pads sur 2 rangées de 8 ─────────── */
html.sd-mobile #smp-pads { grid-template-columns: repeat(8, 1fr) !important; }
html.sd-mobile #smp-pads .smp-pad { min-height: 38px; }
/* Barres d'outils du sampler (sample chargé). Desktop : une rangée de 543 px
   calée en haut à DROITE de la waveform → sur téléphone son début
   (✂ SLICE, ⊘ DRUMS, ▶) sortait de l'écran par la GAUCHE, inatteignable.
   Ici : 📁 BROWSE à gauche, le reste sur toute la largeur restante, en 2
   lignes si besoin. Le curseur VOL est retiré : doublon exact du fader
   SAMPLE du mixer (même valeur SMP.vol). Le conteneur laisse passer les taps
   vers la waveform (pointer-events) ; seuls ses boutons les captent. */
html.sd-mobile #smp-toolbar {
  left: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 3px;
  padding-left: 74px;
  pointer-events: none;
}
html.sd-mobile #smp-toolbar > * { pointer-events: auto; }
html.sd-mobile #smp-toolbar > div[title="Sampler volume"] { display: none !important; }   /* inline display:flex */
html.sd-mobile #smp-toolbar .smp-zoom-btn { padding: 5px 8px; font-size: 12px; }
html.sd-mobile #smp-toolbar .smp-slice-btn { padding: 5px 7px; font-size: 11px; letter-spacing: 0.04em; }
html.sd-mobile #smp-toolbar .smp-tbtn { padding: 5px 8px; font-size: 11px; }
html.sd-mobile #smp-toolbar-left .smp-tbtn {
  padding: 6px 7px !important;     /* inline + !important de sampler.css */
  font-size: 10px !important;
  letter-spacing: 0.06em !important;
}

/* ── PADS : légende « RIGHT CLICK → move a pad » retirée (pas de clic
   droit au doigt ; l'appui long ouvre le menu du pad) ─────── */
html.sd-mobile .pads-legend { display: none; }

/* ── PIANO : en-tête sur 2 lignes rangées ───────────────────
   Desktop : 2 groupes en space-between (gauche PIANO|SYNTH · LIVE PLAY ·
   OCT ; droite BANK … ROLL). Sur téléphone le groupe de droite s'empilait
   en colonne. display:contents « aplatit » les 2 groupes : tous les
   contrôles deviennent des items de l'en-tête, rangés par `order` —
   ligne 1 = instrument · OCT · TR · ROLL ; ligne 2 = le son (BANK / LOOP /
   WAVE, ou le preset SYNTH) · CLEAR. Retirés : le libellé LIVE PLAY, le
   transpose FIN (1/10 de demi-ton) et l'afficheur de note. */
html.sd-mobile #pane-piano { padding: 4px 6px 4px !important; }   /* inline 6px 8px 8px */
html.sd-mobile #pane-piano > div:first-child {
  flex-wrap: wrap;
  justify-content: flex-start !important;
  gap: 0 5px !important;
  margin-bottom: 4px !important;
}
/* libellés OCT / TR : couleur inline #2e2922, invisible sur le thème sombre */
html.sd-mobile #pane-piano > div:first-child :is([title="Octave"], [title="Transpose (semitones)"]) > span:first-child {
  color: var(--text-knob) !important;
  font-size: 9px !important;
  margin-right: 1px;
}
html.sd-mobile #pane-piano > div:first-child > div { display: contents !important; }
/* saut de ligne forcé entre la ligne 1 (order 1-4) et la ligne 2 (6+) */
html.sd-mobile #pane-piano > div:first-child::after { content: ''; order: 5; flex-basis: 100%; height: 0; }
html.sd-mobile #piano-mode-seg { order: 1; }
html.sd-mobile #pno-track-seg { order: 1; }
html.sd-mobile #pno-track-seg .pm-seg-btn { padding: 4px 5px !important; }
html.sd-mobile #pane-piano [title="Octave"] { order: 2; }
html.sd-mobile #pane-piano [title="Transpose (semitones)"] { order: 3; }
html.sd-mobile #piano-roll-btn { order: 4; margin-left: auto; }
html.sd-mobile :is(#piano-mode-seg, #pno-track-seg, #pane-piano [title="Octave"], #pane-piano [title="Transpose (semitones)"], #piano-roll-btn) {
  margin-bottom: 5px;
}
html.sd-mobile #moog-preset-wrap,
html.sd-mobile #smp-bank-wrap { order: 6; }
html.sd-mobile #piano-loop-btn { order: 7; }
html.sd-mobile #piano-wave-btn { order: 8; }
html.sd-mobile #bass-rec-count { order: 9; align-self: center; }
html.sd-mobile #pane-piano button[onclick="bassClearRec()"] { order: 10; }
html.sd-mobile #piano-clear-sample-btn { order: 11; }
html.sd-mobile #pane-piano [title="Fine transpose (1/10 semitone)"],
html.sd-mobile #bass-note-display { display: none !important; }
html.sd-mobile #pane-piano > div:first-child button { padding: 4px 6px !important; font-size: 10px !important; letter-spacing: 0.08em !important; }
html.sd-mobile #pane-piano > div:first-child :is([title="Octave"], [title="Transpose (semitones)"]) button {
  width: 24px !important;       /* − / + : 18 px en desktop, trop fins au doigt */
  height: 24px !important;
  padding: 0 !important;
  font-size: 13px !important;
}
html.sd-mobile #smp-bank-trigger { max-width: 104px !important; height: 24px; }
@media (max-width: 370px) {
  html.sd-mobile #smp-bank-trigger { max-width: 84px !important; }
}
/* le preset SYNTH prend toute la ligne 2 disponible */
html.sd-mobile #moog-preset-wrap { flex: 1 1 auto; min-width: 0; }
html.sd-mobile .mg-pname { width: auto; flex: 1 1 auto; min-width: 0; height: 24px; }
/* liste des presets : plein écran façon popups uniformes (en absolu dans le
   pane, elle était rognée par son scroll interne) */
html.sd-mobile .mg-pmenu {
  position: fixed;
  top: 9dvh;
  left: 8px;
  right: 8px;
  width: auto;
  max-height: 62dvh;
  z-index: 1000;
}

/* ── SYNTH (mode SYNTH du pane PIANO) : UNE section à la fois ──
   Desktop : 5 sections côte à côte (16 colonnes de knobs) → illisible et
   débordant sur téléphone. Ici : onglets CTRL / OSC / MIX / FILTER / OUT en
   colonne à gauche (.mg-stabs, créés par ui/moog-pane.js), la section
   choisie (.mg-cur) en pleine largeur, mini clavier (2 octaves) dessous. */
html.sd-mobile .mg-synth { height: auto; gap: 4px; }
/* joues en bois du MINI M et du PRO M (styles/moog.css) amincies : 360 px ne laissent pas 2 × 16 px */
html.sd-mobile #moog-wrap:not(.mg-ep) .mg-synth { padding-left: 9px; padding-right: 9px; }
html.sd-mobile #moog-wrap:not(.mg-ep) .mg-synth::before,
html.sd-mobile #moog-wrap:not(.mg-ep) .mg-synth::after { width: 6px; }
/* hauteurs calées pour tenir SANS scroll dans le pane d'un iPhone 12-16
   (Safari : ~664 px utiles) ; les écrans plus petits défilent en interne */
html.sd-mobile .mg-panel { flex: none; height: 150px; gap: 6px; }
html.sd-mobile .mg-sec:not(.mg-cur) { display: none; }
html.sd-mobile .mg-sec,
html.sd-mobile .mg-sec.mg-mix,
html.sd-mobile .mg-sec:last-child { flex: 1 1 0; padding: 2px; }
html.sd-mobile .mg-sectitle { display: none; }   /* l'onglet porte le nom */
html.sd-mobile .mg-cell { padding-top: 2px; }
html.sd-mobile .mg-klabel { font-size: 8px; line-height: 1; }
html.sd-mobile .mg-kval.knob-value { font-size: 8.5px; min-height: 8px; }
html.sd-mobile .pitch-btn.mg-tbtn { margin-top: 4px; }
/* OSC 3 : nom + interrupteur KBD tenaient sur 20 px de marge → débordaient */
html.sd-mobile .mg-oscname .mg-oscn { margin-top: 8px; }
html.sd-mobile .mg-oscname .pitch-btn.mg-tbtn { margin-top: 3px; }
html.sd-mobile .mg-ref { margin-top: 10px; }
html.sd-mobile .mg-stabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 52px;
}
html.sd-mobile .mg-stab {
  flex: 1 1 0;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-knob);
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}
html.sd-mobile .mg-stab.on {
  color: #1a1612;
  background: #d8d4cc;
  border-color: #d8d4cc;
}
html.sd-mobile .knob-body.mg-kbody { width: 29px; height: 29px; }
html.sd-mobile .mg-kbd { height: 50px; }

/* ── Footer : UNE ligne qui TIENT dans l'écran ──────────────
   (2026-09-27, plus de défilement : CONTACT et DONATE étaient hors écran)
   « SHUFFLE DRUMMER » retiré (déjà en tête d'écran) → reste la version et
   Privacy ; CONTACT et DONATE passent en icônes ✉ / ☕ (title anglais
   inchangés) ; 🎛 DAW (testeurs, vue plein écran pensée souris) masqué. */
html.sd-mobile .footer {
  flex-wrap: nowrap;
  gap: 4px !important;
  margin-top: 0;
  font-size: 9px;
  letter-spacing: 0.1em;
  overflow: hidden;
}
html.sd-mobile .footer .pact-btn,
html.sd-mobile .footer button {
  min-height: 24px;
  font-size: 9px !important;
  padding: 2px 7px !important;
  white-space: nowrap;
}
html.sd-mobile .footer > span:first-child { white-space: nowrap; font-size: 0; letter-spacing: 0.06em; }
html.sd-mobile .footer > span:first-child > * { font-size: 9px; }
html.sd-mobile .footer > div { gap: 4px !important; }
html.sd-mobile .footer > div > span[aria-hidden] { display: none; }
html.sd-mobile #daw-btn { display: none !important; }   /* inline display posé par auth.js */
html.sd-mobile .footer #contact-btn,
html.sd-mobile .footer #support-btn {
  font-size: 0 !important;
  letter-spacing: 0 !important;
  padding: 2px 8px !important;
}
html.sd-mobile #contact-btn::before { content: '✉'; font-size: 13px; }
html.sd-mobile #support-btn::before { content: '☕'; font-size: 13px; }
/* Liens SEO du footer (Drum Machine / Beat Maker / MPC Online) : masqués en
   mode téléphone — ils allongeaient la ligne défilante et poussaient
   SAVE/LOAD hors écran. Le maillage crawl reste assuré par le sitemap et le
   rendu desktop. */
html.sd-mobile .footer .seo-footer-link { display: none; }

/* ── Bannière compte (CTA freemium) : compacte, UNE ligne
   (reserveCtaSpace pose un padding-bottom sur body → la
   machine 100% se rétrécit d'autant : rien n'est recouvert) ── */
html.sd-mobile body.locked-out #auth-cta { gap: 6px; padding: 4px 8px; flex-wrap: nowrap; }
html.sd-mobile #auth-cta span { font-size: 8px; letter-spacing: 0.02em; }
/* texte raccourci (le long tenait sur 3 lignes à 375 px et mangeait la
   hauteur de la machine) : on garde « Create a free account » + l'essentiel */
html.sd-mobile #auth-cta > span { font-size: 0; }
html.sd-mobile #auth-cta > span > b { font-size: 8px; }
html.sd-mobile #auth-cta > span::after { content: ' — export WAV, sync saves & unlock kits'; font-size: 8px; }
html.sd-mobile #auth-cta-fish { height: 16px; }
html.sd-mobile #auth-cta button { padding: 4px 9px; font-size: 9px; white-space: nowrap; }

/* ── Popups SAVE / LOAD (styles inline → !important requis) ──
   Position UNIFORME de tous les gros popups : calés en haut (9dvh),
   plafond 62dvh → le bas de l'écran reste libre et cliquable. */
html.sd-mobile #save-slot-popup,
html.sd-mobile #load-popup {
  left: 8px !important;
  right: 8px !important;
  top: 9dvh !important;
  bottom: auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  max-height: 62dvh;
  overflow-y: auto;
  padding: 16px 12px !important;
}

/* ── GROS POPUPS UNIFORMISÉS (note de màj, chat, contact,
   login) : même gabarit que SAVE — carte pleine largeur alignée à
   9dvh du haut, plafond 62dvh avec scroll interne. Le fond reste
   largement tapable en bas pour fermer d'un pouce.
   (!important : ces overlays/cartes sont stylés inline, ADR-16.) ── */
html.sd-mobile #update-popup-overlay,
html.sd-mobile #cat-popup-overlay,
html.sd-mobile #contact-overlay,
html.sd-mobile #auth-overlay {
  align-items: flex-start !important;
  padding: 9dvh 8px 0 !important;
}
html.sd-mobile #update-popup-overlay > div,
html.sd-mobile #cat-popup-overlay > div,
html.sd-mobile #contact-box,
html.sd-mobile #auth-modal {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 62dvh !important;
  overflow-y: auto !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  box-sizing: border-box;
}

/* popups de piste (long-press K/S/H/O/C/R et LOAD sample/piano) :
   positionnés sous leur bouton en desktop → sous le mixer ils sortaient
   de l'écran. Même gabarit uniforme, plein écran remonté. */
html.sd-mobile #sample-popup,
html.sd-mobile #single-file-popup {
  left: 8px !important;
  right: 8px !important;
  top: 9dvh !important;
  bottom: auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  max-height: 62dvh;
  overflow-y: auto;
}

/* ── Menu contextuel de la roue (long-press) : jamais hors écran ── */
html.sd-mobile #wheel-menu-popup {
  left: 8px !important;
  right: 8px !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: 78dvh;
  overflow-y: auto;
}

/* SEQUENCER : ✂ CUT en icône seule pour garder l'en-tête sur une ligne */
html.sd-mobile .pat-cut-btn { font-size: 0; letter-spacing: 0; padding: 4px 8px; }
html.sd-mobile .pat-cut-btn::after { content: '✂'; font-size: 12px; }
html.sd-mobile .pat-snap-btn::after { content: '🧲'; }
/* SEQUENCER : ligne des badges (SWING, LP…) masquée — la hauteur va aux pistes */
html.sd-mobile #pat-blocks .pat-badges { display: none; }
/* ✂ et 🧲 compacts + écarts resserrés : PRINT · ✂ · 🧲 · RESET · EXPORT sur une ligne */
html.sd-mobile .pat-header { gap: 4px; }
html.sd-mobile .pat-cut-btn { padding: 3px 6px; }
html.sd-mobile .pat-reset-btn,
html.sd-mobile .pat-export-btn { padding: 4px 6px; }
html.sd-mobile .pat-reset-btn::after,
html.sd-mobile .pat-export-btn::after { letter-spacing: 0.03em; }
html.sd-mobile .pat-print-btn { padding: 4px 7px; letter-spacing: 0.06em; }
html.sd-mobile .pat-btn { width: 24px; }
/* JUNE (2026-10-12, admin) : molettes plus courtes dans la section de 150 px */
html.sd-mobile #moog-wrap.mg-juno .mg-whtrack { height: 50px; }
html.sd-mobile #moog-wrap.mg-juno .pitch-btn.mg-tbtn.mg-jbtn { margin-top: 0; }
