/* ============================================================
   SHUFFLE DRUMMER — Onglet PATTERN
   Séquenceur de blocs PAT 1…N, scrollable horizontalement.
   ============================================================ */

#pane-pattern {
  display: none;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  flex: 1;
}
#pane-pattern.active {
  display: flex !important;
}

/* ── HEADER ── */
.pat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 4px;
  border-bottom: 1px solid #1e1e24;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.pat-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #4a4a52;
  margin-right: 2px;
}

/* Transport PLAY/STOP dédiés */
.pat-transport {
  display: flex;
  gap: 3px;
}

.pat-btn {
  background: linear-gradient(180deg, #3a3b40, #2a2b30);
  border: 1px solid #4a4a52;
  color: #8a8a92;
  font-family: inherit;
  font-size: 11px;
  width: 28px;
  height: 22px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 80ms, border-color 80ms;
  padding: 0;
}
.pat-btn:hover { color: #ccccdd; border-color: #6a6a72; }
.pat-play.on  { color: #6adf6a; border-color: #4a9f4a; }
.pat-stop.on  { color: #ff6a6a; border-color: #9f4a4a; }

/* Bouton PRINT */
.pat-print-btn {
  background: #c0392b;
  border: 1px solid #a93226;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 80ms, border-color 80ms;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pat-print-btn:hover {
  background: #e74c3c;
  border-color: #c0392b;
}
.pat-print-btn:active {
  background: #a93226;
}

/* Bouton RESET PATTERN — gris, encadré (supprime tous les blocs) */
.pat-reset-btn {
  background: #1a1a1c;
  border: 1px solid #7a7a80;
  color: #b0aeb2;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  margin-right: 0;
  transition: background 80ms, border-color 80ms, color 80ms;
}
.pat-reset-btn:hover { background: #2a2a2e; border-color: #c8c6cc; color: #e8e6ec; }
.pat-reset-btn:active { background: #333; }

/* Bouton PATTERN MASTER */
.pat-export-btn {
  background: #1a1410;
  border: 1px solid #ff7a1a88;
  color: #ff9440;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 80ms, border-color 80ms;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  font-weight: 700;
}
.pat-export-btn:hover {
  background: #2a1e0e;
  border-color: #ff9440;
}

/* ── ZONE SCROLLABLE ── */
.pat-scroll-zone {
  display: flex;
  flex-direction: row;
  gap: 4px;
  padding: 8px;
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  align-items: stretch;
  scrollbar-width: thin;
  scrollbar-color: #3a3a44 #0e0e12;
  min-height: 0;
}
/* Barre horizontale native masquée : remplacée par la barre défilement-zoom
   (.pat-zoombar) ; la verticale (rare) reste fine */
.pat-scroll-zone::-webkit-scrollbar { height: 0; width: 4px; }
@supports (-moz-appearance: none) { .pat-scroll-zone { scrollbar-width: none; } }
.pat-scroll-zone::-webkit-scrollbar-thumb { background: #3a3a44; border-radius: 2px; }

/* Message vide */
.pat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #000;
  text-align: center;
  padding: 0 20px;
}

/* ── BLOC PAT ── */
.pat-block {
  flex-shrink: 0;
  width: 178px;
  background: linear-gradient(180deg, #1e1e24, #18181e);
  border: 1px solid #2e2e36;
  border-radius: 4px;
  padding: 5px 5px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 80ms, box-shadow 80ms;
  position: relative;
  user-select: none;
}
/* La grille garde sa hauteur naturelle : rangées alignées sur la colonne de
   noms, boutons ⧉ / ✕ dans l'espace libre en dessous */
.pat-block .pat-block-mini { flex: 0 0 auto; }
.pat-block:hover {
  border-color: #4a4a56;
}
.pat-block.active {
  border-color: #fb8c00;
  box-shadow: 0 0 10px rgba(251,140,0,0.25);
  background: linear-gradient(180deg, #221e16, #1c1814);
}
/* Bloc en cours d'ÉDITION (roue rouge) — prioritaire visuellement sur .active */
.pat-block.editing {
  border-color: #e53935;
  box-shadow: 0 0 12px rgba(229,57,53,0.45);
  background: linear-gradient(180deg, #2a1414, #1f0e0e);
}
.pat-block.editing .pat-block-num  { color: #ff7a7a; }
.pat-block.editing .pat-block-name { color: #ffb0b0; }
.pat-block.dragging {
  opacity: 0.45;
  border-style: dashed;
}
.pat-block.drag-over {
  border-color: #aaaacc;
  box-shadow: 0 0 8px rgba(170,170,200,0.2);
}

/* Numéro du bloc */
.pat-block-num {
  font-size: 9px;
  color: #3a3a42;
  letter-spacing: 0.1em;
  line-height: 1;
}
.pat-block.active .pat-block-num {
  color: #fb8c00;
}

/* Ligne nom + bars — hauteur FIXE : la colonne de noms s'aligne dessus */
.pat-block-name-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  height: 18px;
  min-width: 0;
  overflow: hidden;
}

/* Badges des réglages du bloc (FILTER, SWING…) — une ligne, hauteur fixe */
.pat-badges {
  display: flex;
  gap: 3px;
  height: 13px;
  overflow: hidden;
  white-space: nowrap;
}
.pat-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 13px;
  padding: 0 4px;
  border-radius: 2px;
  background: #2a2a32;
  color: #9a9aa6;
  flex-shrink: 0;
}
.pat-badge.flt { background: #3a2a14; color: #fb8c00; }

/* Règle des mesures : numéros dans le morceau, clic = lecture depuis là */
.pat-ruler {
  display: flex;
  height: 18px;
  /* AU-DESSUS du bloc, même largeur : d'un bloc à l'autre, les règles se
     suivent comme une seule timeline. padding = bordure + padding du bloc
     → chaque numéro tombe pile au-dessus de sa mesure. */
  flex-shrink: 0;
  margin: 0 0 7px;
  padding: 0 6px;
  background: #121216;
  border: 1px solid #2a2a32;
  border-radius: 3px;
  box-sizing: border-box;
}
/* Colonne = règle des mesures + bloc */
.pat-col { display: flex; flex-direction: column; flex-shrink: 0; }
.pat-col > .pat-block { flex: 1; }
.pat-ruler-bar {
  flex: 1 1 0;
  min-width: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  padding-left: 3px;
  color: #8a8a96;
  border-left: 1px solid #3a3a46;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
}
.pat-ruler-bar:hover { color: #fff; background: #2e2e38; }
.pat-ruler-bar:hover::before { content: '▶ '; color: #fb8c00; }
.pat-col.active .pat-ruler { background: #1e1810; border-color: #6a4a1a; }
.pat-labels { padding-top: 0 !important; border-top-width: 0 !important; }
/* 18 px de règle + 7 px d'écart + 6 px (bordure + padding du bloc),
   moins l'écart de 3 px entre les lignes de la colonne */
.pat-labels .pat-ruler {
  margin: 0 0 10px;
  padding: 0;
  background: none;
  border-color: transparent;
  justify-content: flex-end;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.08em;
  color: #6a6a76;
}

/* Colonne des noms de pistes — même structure verticale qu'un bloc */
.pat-labels {
  position: sticky;
  left: -8px;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 6px 4px 0;
  margin-left: -8px;
  padding-left: 8px;
  border: 1px solid transparent;
  /* Fond opaque (les blocs défilent dessous) = couleur du panneau */
  background: var(--surface-mid2, #1c1c21);
  /* 1re ombre = débord PLEIN de 12 px à gauche, couleur du panneau : sous
     certains zooms (fitMachine × zoom navigateur), l'arrondi des sous-pixels
     laissait 1-3 px entre le bord de la zone et la colonne → les barres des
     blocs qui défilent dessous apparaissaient à gauche des noms. */
  box-shadow: -12px 0 0 0 var(--surface-mid2, #1c1c21), 6px 0 8px -4px rgba(0, 0, 0, 0.7);
}
.pat-label {
  height: 16px;
  line-height: 16px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: right;
  white-space: nowrap;
}

/* Boutons ⧉ / ✕ du bloc — en bas à droite, au survol (toujours au doigt) */
.pat-block-tools {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 80ms;
}
.pat-block:hover .pat-block-tools { opacity: 1; }
@media (hover: none) {
  /* Au doigt : pas de survol → visibles sur le bloc actif / en édition, et
     remontés dans la ligne des badges (sur téléphone la grille remplit le
     bloc jusqu'en bas : en bas ils cacheraient la dernière rangée). */
  /* dans la bande du titre, à droite : ne recouvrent plus les pistes */
  .pat-block-tools { top: 3px; bottom: auto; right: 4px; pointer-events: none; }
  /* … et le nom + ▾ leur laissent la place (bloc actif / en édition) */
  .pat-block.active > .pat-block-name-row,
  .pat-block.editing > .pat-block-name-row { padding-right: 46px; }
  .pat-block.active .pat-block-tools,
  .pat-block.editing .pat-block-tools { opacity: 1; pointer-events: auto; }
  .pat-block-tools .pat-tool-btn { height: 15px; min-width: 18px; font-size: 9px; line-height: 13px; }
}
.pat-tool-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid #3a3a46;
  background: #22222a;
  color: #9a9aa6;
  cursor: pointer;
}
.pat-tool-btn:hover { color: #fff; border-color: #6a6a78; }
.pat-tool-btn.del:hover,
.pat-tool-btn.del.armed { color: #fff; background: #c0180c; border-color: #ff4030; }
.pat-block-bars {
  font-size: 10px;
  font-weight: 700;
  color: #fb8c00;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* Nom du bloc */
.pat-block-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #8a8a92;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pat-block.active .pat-block-name {
  color: #ffcc88;
}

/* Champ de renommage inline */
.pat-block-name-input {
  font-family: inherit;
  font-size: 16px;          /* même taille que le nom affiché */
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 0;
  color: #ffcc88;
  background: #2a2a32;
  border: 1px solid #fb8c00;
  border-radius: 2px;
  padding: 0 4px;
  height: 18px;             /* tient dans la ligne du nom (18 px) */
  box-sizing: border-box;
  flex: 1;
  width: 100%;
  outline: none;
}

/* Méta BPM/mesures */
.pat-block-meta {
  font-size: 7px;
  color: #4a4a52;
  letter-spacing: 0.08em;
  line-height: 1;
}
.pat-block.active .pat-block-meta {
  color: #7a6a52;
}

/* Mini visualisation des steps */
.pat-mini-wrap {
  display: flex;
  flex-direction: row;
  gap: 4px;
  margin-top: 2px;
  margin-right: -5px;
}

/* Grille de dots */
.pat-block-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
/* Colonne boutons M */
.pat-mini-mbtns {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.pat-mini-mbtn {
  width: 20px;
  height: 14px;
  background: linear-gradient(180deg, #9a968e, #7a766e);
  border: 1px solid #5a5650;
  border-radius: 2px;
  color: #1a1814;
  font-size: 11px;
  font-weight: 900;
  line-height: 14px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background 60ms, border-color 60ms, color 60ms;
  flex-shrink: 0;
}
.pat-mini-mbtn:hover:not(.locked) {
  background: linear-gradient(180deg, #b0aca4, #908c84);
}
.pat-mini-mbtn.locked {
  cursor: default;
  opacity: 0.4;
}
.pat-mini-mbtn.muted {
  background: #c0180c;
  border-color: #ff4030;
  color: #fff;
  box-shadow: 0 0 5px rgba(255,60,40,0.5);
}
.pat-mini-mbtn.muted:hover {
  background: #e01a0c;
}

.pat-mini-row {
  display: flex;
  gap: 1px;
}
.pat-mini-row.muted {
  opacity: 0.3;
}
.pat-mini-dot {
  flex: 1 1 0;
  min-width: 0;
  height: 14px;
  border-radius: 0.5px;
  background: #252528;
}
/* Grille fine (1/24 et plus) : cases jointives, sinon elles disparaissent */
.pat-mini-row.dense { gap: 0; }
/* Début de mesure : trait clair à gauche de la case */
.pat-mini-dot.bar { box-shadow: inset 1px 0 0 rgba(255,255,255,0.28); }
.pat-mini-dot.on {
  opacity: 0.9;
}

/* ── MENU CONTEXTUEL BLOC ── */
.pat-ctx-menu {
  position: fixed;
  z-index: 9999;
  background: #18181e;
  border: 1px solid #3a3a46;
  border-radius: 4px;
  padding: 4px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.7);
  min-width: 160px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pat-ctx-item {
  background: none;
  border: none;
  color: #8a8a92;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 4px 8px;
  text-align: left;
  cursor: pointer;
  border-radius: 2px;
  transition: background 60ms, color 60ms;
}
.pat-ctx-item:hover {
  background: #2a2a32;
  color: #ccccdd;
}
.pat-ctx-item.danger { color: #e53935; }
.pat-ctx-item.danger:hover { background: #e5393520; color: #ff6a6a; }
.pat-ctx-item.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ── PLAYHEAD (barre blanche défilante dans le bloc actif) ── */
.pat-block-playhead {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: rgba(255,255,255,0.55);
  border-radius: 1px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 80ms;
  will-change: left;
}
.pat-block.active .pat-block-playhead {
  opacity: 1;
}

/* Total bars après le bouton PRINT */
.pat-total-bars {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #111113;
  white-space: nowrap;
}

/* ZOOM AUTO — bloc étroit : nom plus petit, « N BARS » masqué (la règle
   des mesures donne déjà le compte) */
.pat-block.narrow .pat-block-bars { display: none; }
.pat-block.narrow .pat-block-name,
.pat-block.narrow .pat-block-name-input { font-size: 12px; }

/* ── PARTIES : barres par piste (couleur de la piste, steps en noir) ── */
.pat-block .pat-block-mini { position: relative; }
.pat-lane { position: relative; height: 16px; flex-shrink: 0; }
.pat-seg {
  position: absolute;
  top: 1px;
  height: 14px;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}
.pat-seg canvas { display: block; pointer-events: none; }
.pat-seg.sel { outline: 2px solid #fff; outline-offset: 0; z-index: 2; }
/* Poignées de rognage (bords gauche / droit d'une barre) */
.pat-seg-h {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 1;
  touch-action: none;
}
.pat-seg-h.l { left: 0; }
.pat-seg-h.r { right: 0; }
.pat-seg-h:hover { background: rgba(255,255,255,0.45); }
/* Outil CISEAUX */
.cut-mode .pat-seg { cursor: crosshair; }
.cut-mode .pat-seg-h { display: none; }
/* Début de chaque tour de boucle d'une partie étirée */
.pat-rep-line {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed rgba(255,255,255,0.4);
  pointer-events: none;
  z-index: 3;
}
.pat-ruler-bar.loop { border-left-color: #8a8a98; color: #c8c6cc; }
.pat-block-name.custom { color: #c8c6cc; }
/* Bouton ✂ CUT — même famille que ⟲ RESET SEQUENCES */
.pat-cut-btn {
  background: #1a1a1c;
  border: 1px solid #7a7a80;
  color: #b0aeb2;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.pat-cut-btn:hover { background: #2a2a2e; border-color: #c8c6cc; color: #e8e6ec; }
.pat-cut-btn.on { border-color: #fb8c00; color: #ffb060; background: #2a1e0e; }

/* Champ de renommage : pas la croix d'effacement des champs « search » */
.pat-block-name-input::-webkit-search-cancel-button,
.pat-block-name-input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
/* Menu des catégories de noms (AUTO, INTRO, VERSE, HOOK…) — plus de saisie libre */
.pat-name-sug {
  position: fixed;          /* sur <body> (pattern.js::_renameBlock) : jamais rogné par la zone qui défile */
  width: max-content;
  min-width: 172px;
  max-width: 300px;
  outline: none;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px;
  background: #18181e;
  border: 1px solid #3a3a46;
  border-radius: 3px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.6);
}
.pat-name-sug button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid #3a3a46;
  background: #22222a;
  color: #b0aeb2;
  cursor: pointer;
}
.pat-name-sug button:hover,
.pat-name-sug button.on { color: #fff; border-color: #fb8c00; background: #2a1e0e; }
/* Pastille de la couleur de la catégorie (même teinte que la bande du bloc) */
.pat-name-sug button.cat { border-left: 4px solid hsl(var(--part-hue, 30), var(--part-sat, 70%), 50%); }
.pat-name-sug button.cur { color: #ffcc88; border-color: #fb8c00; }
html:not(.sd-skin-dark) .pat-name-sug { background: #f2efe8; border-color: #8a8680; box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
html:not(.sd-skin-dark) .pat-name-sug button { background: #e4e0d8; border-color: #b0aca4; color: #3a3630; }
html:not(.sd-skin-dark) .pat-name-sug button:hover,
html:not(.sd-skin-dark) .pat-name-sug button.on,
html:not(.sd-skin-dark) .pat-name-sug button.cur { color: #000; border-color: #fb8c00; background: #fff3e0; }
html:not(.sd-skin-dark) .pat-name-sug button.cat { border-left-color: hsl(var(--part-hue, 30), var(--part-sat, 70%), 45%); }

/* Teinte légère par nom de partie (--part-tint posé par _renderBlocks) :
   calque sous le contenu, au-dessus du fond — garde les états actif/édition */
.pat-block { isolation: isolate; }
.pat-block::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--part-tint, transparent);
  pointer-events: none;
  z-index: -1;
}
/* ▾ à côté du nom : renommer en un clic */
.pat-name-btn {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 11px;
  line-height: 14px;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 2px;
  border-radius: 2px;
  border: 1px solid #3a3a46;
  background: #1a1a20;
  color: #9a9aa6;
  cursor: pointer;
  align-self: center;
}
.pat-name-btn:hover { color: #fff; border-color: #fb8c00; }
/* Bande du TITRE teintée par nom (barre de titre du bloc) — même place
   occupée qu'avant (-5 px de marge + 5 px de padding) : rien ne bouge */
.pat-block > .pat-block-name-row {
  margin: -5px -5px 0;
  padding: 5px 5px 0;
  height: 23px;
  background: var(--part-head, transparent);
  border-radius: 3px 3px 0 0;
}

/* Nom de partie dans la teinte de son nom (thème sombre / clair) */
.pat-block .pat-block-name.tinted { color: hsl(var(--part-hue, 30), var(--part-sat, 70%), 82%) !important; }

/* ═════════════ THÈME CLAIR (par défaut, sans html.sd-skin-dark) ═════════════
   Même mise en page ; blocs en « carte » claire sur la carcasse claire. */
html:not(.sd-skin-dark) .pat-block {
  background: linear-gradient(180deg, #d4d0c8, #c8c4bc);
  border-color: #8e8a84;
}
html:not(.sd-skin-dark) .pat-block:hover { border-color: #6e6a64; }
html:not(.sd-skin-dark) .pat-block.active {
  border-color: #fb8c00;
  background: linear-gradient(180deg, #ddd2c0, #d2c6b2);
  box-shadow: 0 0 8px rgba(251,140,0,0.35);
}
html:not(.sd-skin-dark) .pat-block.editing {
  border-color: #e53935;
  background: linear-gradient(180deg, #e2cbc6, #d6bcb6);
  box-shadow: 0 0 10px rgba(229,57,53,0.35);
}
html:not(.sd-skin-dark) .pat-block .pat-block-name.tinted { color: hsl(var(--part-hue, 30), var(--part-sat, 70%), 18%) !important; }
html:not(.sd-skin-dark) .pat-block-bars { color: #b25e00; }
html:not(.sd-skin-dark) .pat-badge { background: #b4b0a8; color: #2a2620; }
html:not(.sd-skin-dark) .pat-badge.flt { background: #efd2aa; color: #9a5000; }
html:not(.sd-skin-dark) .pat-ruler { background: #d6d2ca; border-color: #9a968e; }
html:not(.sd-skin-dark) .pat-ruler-bar { color: #4a4640; border-left-color: #a8a49e; }
html:not(.sd-skin-dark) .pat-ruler-bar.loop { color: #1a1612; border-left-color: #6e6a64; }
html:not(.sd-skin-dark) .pat-ruler-bar:hover { background: #bab6ae; color: #000; }
html:not(.sd-skin-dark) .pat-col.active .pat-ruler { background: #ecd8ba; border-color: #c98a3a; }
html:not(.sd-skin-dark) .pat-labels .pat-ruler { background: none; border-color: transparent; color: #5a5650; }
html:not(.sd-skin-dark) .pat-labels { box-shadow: -12px 0 0 0 var(--surface-mid2, #1c1c21), 6px 0 8px -4px rgba(0,0,0,0.25); }
/* Couleurs LED assombries : le jaune du HAT restait illisible sur fond clair */
html:not(.sd-skin-dark) .pat-label { filter: brightness(0.62) saturate(1.4); }
html:not(.sd-skin-dark) .pat-seg.sel { outline-color: #111; }
html:not(.sd-skin-dark) .pat-rep-line { border-left-color: rgba(0,0,0,0.4); }
html:not(.sd-skin-dark) .pat-block-playhead { background: rgba(0,0,0,0.6); }
html:not(.sd-skin-dark) .pat-name-btn { background: #e4e0d8; border-color: #8a8680; color: #3a3630; }
html:not(.sd-skin-dark) .pat-tool-btn { background: #e4e0d8; border-color: #8a8680; color: #3a3630; }
html:not(.sd-skin-dark) .pat-tool-btn:hover { color: #000; border-color: #4a4640; }
/* Bloc serré : le nom d'abord */
.pat-block.tight .pat-block-bars { display: none; }
/* « N BARS » posé sur la bande colorée : clair en sombre, foncé en clair */
.pat-block > .pat-block-name-row .pat-block-bars { color: rgba(255,255,255,0.8); }
html:not(.sd-skin-dark) .pat-block > .pat-block-name-row .pat-block-bars { color: rgba(0,0,0,0.6); }

/* Hauteur des rangées ADAPTATIVE (--lane-h posé par _renderBlocks) : toutes
   les pistes tiennent dans la hauteur de l'onglet */
.pat-lane { height: var(--lane-h, 16px); }
.pat-seg { top: 1px; height: calc(var(--lane-h, 16px) - 2px); }
.pat-seg-h { min-width: 6px; }
.pat-block-mini { gap: var(--lane-gap, 2px); }
.pat-label {
  height: var(--lane-h, 16px);
  line-height: var(--lane-h, 16px);
  font-size: min(9px, calc(var(--lane-h, 16px) + 1px));
}

/* ── BARRE DÉFILEMENT-ZOOM (2026-10-02) ──
   Pouce = partie visible du morceau ; le tirer = défiler, tirer un BORD =
   zoomer ; double-clic / FIT = tout le morceau tient. */
.pat-zoombar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 5px;
  flex-shrink: 0;
}
.pat-zoombar.empty { visibility: hidden; }
.pat-zb-track {
  position: relative;
  flex: 1;
  height: 14px;
  background: #0e0e12;
  border: 1px solid #2a2a32;
  border-radius: 3px;
  cursor: pointer;
  touch-action: none;
  overflow: hidden;
  user-select: none;
}
.pat-zb-thumb {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  width: 100%;
  min-width: 30px;
  box-sizing: border-box;
  background: #3a3a44;
  border-radius: 2px;
  cursor: grab;
}
.pat-zb-track:hover .pat-zb-thumb { background: #4a4a56; }
.pat-zoombar.drag .pat-zb-thumb { background: #55555f; cursor: grabbing; }
/* Bords du pouce = poignées de zoom */
.pat-zb-h {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
}
.pat-zb-h.l { left: 0; }
.pat-zb-h.r { right: 0; }
.pat-zb-h::after {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 3px;
  width: 2px;
  border-left: 1px solid #fb8c00;
  border-right: 1px solid #fb8c00;
  opacity: 0.75;
}
.pat-zb-h:hover::after { opacity: 1; }
.pat-zb-fit {
  display: none;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid #fb8c00;
  background: #2a1e0e;
  color: #ffb060;
  cursor: pointer;
}
.pat-zoombar.zoomed .pat-zb-fit { display: block; }
.pat-zb-fit:hover { color: #fff; }
/* Au doigt : rail et poignées plus larges */
@media (hover: none) {
  .pat-zb-track { height: 20px; }
  .pat-zb-h { width: 16px; }
  .pat-zb-h::after { left: 6px; }
}
html:not(.sd-skin-dark) .pat-zb-track { background: #d8d4cc; border-color: #a8a49c; }
html:not(.sd-skin-dark) .pat-zb-thumb { background: #8a8680; }
html:not(.sd-skin-dark) .pat-zb-track:hover .pat-zb-thumb { background: #76726c; }
html:not(.sd-skin-dark) .pat-zoombar.drag .pat-zb-thumb { background: #66625c; }
html:not(.sd-skin-dark) .pat-zb-fit { background: #fff3e0; color: #b05a00; }
html:not(.sd-skin-dark) .pat-zb-h::after { border-color: #c45f00; opacity: 1; }
html:not(.sd-skin-dark) .pat-zb-thumb { background: #9a968f; }

/* Partie SANS NOM (plus de nom automatique, 2026-10-02) : « + NAME » discret,
   un clic ouvre le menu des catégories */
.pat-block .pat-block-name.unnamed.tinted { color: rgba(255,255,255,0.45) !important; font-size: 12px; letter-spacing: 0.1em; cursor: pointer; }
.pat-block .pat-block-name.unnamed.tinted:hover { color: #ffb060 !important; }
html:not(.sd-skin-dark) .pat-block .pat-block-name.unnamed.tinted { color: rgba(0,0,0,0.45) !important; }
html:not(.sd-skin-dark) .pat-block .pat-block-name.unnamed.tinted:hover { color: #b05a00 !important; }
