/*!
 * DinoLoop — dino-polish.css
 * Couche de finition visuelle. À charger APRÈS gamma001.css :
 *   <link rel="stylesheet" href="dino-polish.css">
 * N'ajoute aucune logique : on peut la retirer sans rien casser.
 *
 * Direction : une machine à rythmes de nuit. Fond bleu-noir profond, surfaces mates,
 * et une seule chose qui "s'allume" : les pas actifs (vert LED) et la mesure sélectionnée (jaune du logo).
 */

:root {
  color-scheme: dark;                       /* barres de défilement, select, inputs natifs en sombre */
  --dl-bg: #0c0e12;
  --dl-surface: #171a20;
  --dl-surface-2: #1d2129;
  --dl-inset: #12151a;
  --dl-line: rgba(255, 255, 255, .07);
  --dl-line-strong: rgba(255, 255, 255, .15);
  --dl-text: #e8eaee;
  --dl-muted: #8b93a1;
  --dl-green: #3ddc4f;
  --dl-green-deep: #25b236;
  --dl-yellow: #ffe14d;
  --dl-radius: 14px;
}

/* ---------- Page ---------- */
body {
  background: radial-gradient(900px 420px at 50% -90px, #1a2030 0%, transparent 72%) no-repeat fixed, #0c0e12 !important;
  color: var(--dl-text);
  font-family: Inter, "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
}
#bpm, #mode { font-variant-numeric: tabular-nums; }

/* ---------- Panneaux (réglages, transport, mesures, samples, footer) ---------- */
.controls-section,
.json-controls,
.samples-section,
#barNav {
  background: linear-gradient(180deg, #1b1f27 0%, #161920 100%) !important;
  border: 1px solid var(--dl-line) !important;
  border-radius: var(--dl-radius) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .05) !important;
}

/* Champs */
.controls select,
.controls-section select,
.controls input[type="number"],
.controls-section input[type="number"] {
  background: var(--dl-inset);
  border: 1px solid var(--dl-line-strong);
  border-radius: 10px;
  color: var(--dl-text);
}

/* Boutons : retour tactile sans changer leurs couleurs d'origine */
.json-controls button,
.controls-section button {
  transition: filter .12s ease, transform .12s ease, box-shadow .12s ease;
}
.json-controls button:hover,
.controls-section button:hover { filter: brightness(1.14); }
.json-controls button:active,
.controls-section button:active { transform: translateY(1px); }

/* Focus clavier visible partout */
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--dl-green);
  outline-offset: 2px;
}

/* ---------- Grille : les pas ---------- */
#grid .step {
  background: #1a1d24;
  border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
  transition: background-color .08s ease;
}
#grid .step.alt-step { background: #2b303a; }                         /* temps forts (1, 5, 9, 13) */
/* Mesures impaires (1, 3, 5…) : teinte bleutée bien lisible ; mesures paires : gris neutre */
#grid .step.bar-odd { background: #222d43; }
#grid .step.bar-odd.alt-step { background: #3a4867; }

/* Pas actif : LED verte avec léger halo */
#grid .step.active,
#grid .step.alt-step.active,
#grid .step.bar-odd.active,
#grid .step.bar-odd.alt-step.active {
  background: linear-gradient(180deg, #55e865 0%, var(--dl-green-deep) 100%);
  box-shadow: 0 0 10px rgba(61, 220, 79, .42), inset 0 1px 0 rgba(255, 255, 255, .38);
}
#grid .step.sel { box-shadow: inset 0 0 0 9px rgba(77, 163, 255, .30); }

/* Règle des mesures */
.grid-ruler .ruler-bar {
  border-left: 1px solid var(--dl-line-strong);
  color: var(--dl-muted);
  font-weight: 600;
  letter-spacing: .02em;
}

/* Noms de pistes : jaune d'origine, sans soulignement */
.sample-name {
  color: #ffff00;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .01em;
}
.sample-name:hover { color: #fff; }

/* ---------- Barre des mesures ---------- */
#barNav { padding: 10px 12px; gap: 10px; }
#barNav .bn-tabs .bn-tab {
  background: var(--dl-inset);
  border-radius: 8px;
  border-color: var(--dl-line-strong);
  transition: border-color .12s ease, background-color .12s ease, transform .12s ease;
}
#barNav .bn-tabs .bn-tab:hover { transform: translateY(-1px); }
#barNav .bn-tabs .bn-tab.inloop {
  border-top-color: var(--dl-green);
  box-shadow: 0 -2px 10px rgba(61, 220, 79, .16);
}
#barNav .bn-tabs .bn-tab.sel {                                         /* sélection = jaune du logo */
  border-color: var(--dl-yellow);
  border-top-color: var(--dl-yellow);
  background: #262a34;
  color: #fff;
}
#barNav .bn-tabs .bn-tab.sel.inloop { border-top-color: var(--dl-green); }
#barNav .bn-tabs .bn-tab.playing { background: #23402a; }
#barNav .bn-tools button,
#barNav .bn-add { border-radius: 9px; }

/* ---------- Défilement sombre (fini les barres blanches) ---------- */
#grid,
#category-nav,
#sampleListContainer,
#piano-roll-grid,
#piano-roll-modal > div,
#barNav .bn-tabs {
  scrollbar-width: thin;
  scrollbar-color: #3a4150 #12151a;
}
#grid::-webkit-scrollbar,
#category-nav::-webkit-scrollbar,
#sampleListContainer::-webkit-scrollbar,
#piano-roll-grid::-webkit-scrollbar,
#piano-roll-modal > div::-webkit-scrollbar,
#barNav .bn-tabs::-webkit-scrollbar { height: 10px; width: 10px; }
#grid::-webkit-scrollbar-track,
#category-nav::-webkit-scrollbar-track,
#sampleListContainer::-webkit-scrollbar-track,
#piano-roll-grid::-webkit-scrollbar-track,
#piano-roll-modal > div::-webkit-scrollbar-track,
#barNav .bn-tabs::-webkit-scrollbar-track { background: #12151a; border-radius: 8px; }
#grid::-webkit-scrollbar-thumb,
#category-nav::-webkit-scrollbar-thumb,
#sampleListContainer::-webkit-scrollbar-thumb,
#piano-roll-grid::-webkit-scrollbar-thumb,
#piano-roll-modal > div::-webkit-scrollbar-thumb,
#barNav .bn-tabs::-webkit-scrollbar-thumb { background: #3a4150; border-radius: 8px; border: 2px solid #12151a; }
#grid::-webkit-scrollbar-thumb:hover,
#category-nav::-webkit-scrollbar-thumb:hover,
#sampleListContainer::-webkit-scrollbar-thumb:hover { background: #505869; }

/* ---------- Choix de sample (modal) ---------- */
#sampleModal { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#sampleModal .modal-content {
  background: linear-gradient(180deg, #1d2129 0%, #151820 100%);
  border: 1px solid var(--dl-line-strong);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .05);
}
#category-nav { padding-bottom: 8px; }
#category-nav .nav-btn { transition: filter .12s ease, transform .12s ease; }
#category-nav .nav-btn:hover { filter: brightness(1.15); }
#sampleListContainer .sample-btn {
  background: var(--dl-inset);
  border: 1px solid var(--dl-line);
  border-radius: 10px;
  transition: border-color .12s ease, background-color .12s ease;
}
#sampleListContainer .sample-btn:hover {
  border-color: rgba(61, 220, 79, .55);
  background: #16221b;
}
#sampleListContainer .play-icon { border-radius: 8px; }
#sampleModal .l_desc {
  background: var(--dl-inset);
  border: 1px solid var(--dl-line);
  border-radius: 10px;
}

/* ---------- Piano roll ---------- */
#piano-roll-modal > div {
  background: linear-gradient(180deg, #1d2129 0%, #151820 100%) !important;
  border: 1px solid var(--dl-line-strong);
  border-radius: 16px !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* =====================================================================
   MOBILE / PETIT ÉCRAN (≤ 700px)
   ===================================================================== */

/* Menu "⋯" par piste : créé par dino-mobile.js. Caché sur grand écran,
   et .dl-actions est transparent (display:contents) donc rien ne change. */
.sample-label .dl-pattern { display: none; }
.sample-label .dl-actions { display: contents; }

@media (max-width: 700px) {

  /* 1. LOGIN : icône seule (le texte est masqué, quel que soit son contenu) */
  #openAuthModalBtn { font-size: 0 !important; padding: 6px 10px !important; min-width: 0 !important; }
  #openAuthModalBtn::before { content: "\1F464"; font-size: 1.1rem; line-height: 1; }

  /* 2. Barre des mesures : on retire copier / coller / annuler / raccourcis
        pour laisser la place aux mesures */
  #barNav #bn-copy,
  #barNav #bn-paste,
  #barNav #bn-undo,
  #barNav #shortcutsBtn { display: none !important; }

  /* 3. Pistes : label étroit = le nom seul. Un tap sur le nom (jaune) ouvre le menu des actions
        (créé par dino-mobile.js) : plus de bouton "⋯" séparé. */
  .sample-label { width: 64px !important; }
  .sample-name  { width: 60px !important; }
  .sample-row.dl-open .sample-name { color: #fff; }
  /* petit point vert = un piano roll contient des notes */
  .sample-row.piano-roll-active .sample-label::after {
    content: "";
    position: absolute;
    top: 2px; right: 2px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--dl-green);
    box-shadow: 0 0 6px rgba(61, 220, 79, .7);
    pointer-events: none;
  }

  /* Les 3 actions : cachées, puis déployées en bulle à droite du nom */
  .sample-label .dl-actions { display: none; }
  .sample-row.dl-open .sample-label { z-index: 40; }
  .sample-row.dl-open .dl-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    position: absolute;
    left: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    padding: 3px 6px 3px 0;
    background: #1b1f27;
    border: 1px solid var(--dl-line-strong);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .55);
    z-index: 50;
  }
  .sample-row.dl-open .dl-actions .btn-icon,
  .sample-row.dl-open .dl-actions .piano-roll-btn,
  .sample-row.dl-open .dl-actions .dl-pattern { margin-left: 4px; }
  /* bouton "Pattern" du menu : ouvre la fenêtre pattern (l'ancien clic sur le nom) */
  .sample-row.dl-open .dl-actions .dl-pattern {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0;
    background: transparent; color: var(--dl-muted);
    border: 1px solid var(--dl-line-strong); border-radius: 6px;
  }

  /* 4. Piano roll : plein écran visible + croix toujours atteignable */
  #piano-roll-modal {
    height: 100vh !important;
    height: 100dvh !important;          /* tient compte des barres du navigateur mobile */
    align-items: stretch !important;
  }
  #piano-roll-modal > div {
    width: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    height: 100%;
    box-sizing: border-box;
    border-radius: 0 !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
    padding-right: 56px;                /* ne passe pas sous la croix */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  #piano-roll-modal #title_piano_info { display: inline-block; max-width: calc(100vw - 90px); }

  /* La croix reste collée en haut à droite de l'écran, même en défilant */
  #piano-roll-modal #close_piano1 {
    position: fixed !important;
    top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    right: 8px !important;
    z-index: 1100;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    max-width: none !important;
    font-size: 18px !important;
    background: rgba(23, 26, 32, .92) !important;
    border: 1px solid var(--dl-line-strong) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .5) !important;
  }
}


/* =====================================================================
   RANGÉE "AJOUTER UN SAMPLE" + SAUVEGARDES LOCALES
   ===================================================================== */

/* Boutons raccourcis sur petit écran : "+ sample" et "Upload" */
@media (max-width: 700px) {
  #dlAddRow { gap: 6px; padding: 6px 8px; }
  #dlAddRow button { padding: 6px 10px; }
}

/* Sauvegardes : conteneur en display:flex (l'inline-flex posé par gamma001.js est surchargé),
   il prend la place restante de la rangée et ses puces défilent horizontalement */
#dlAddRow #localSavesContainer {
  display: flex !important;
  flex: 1 1 0 !important;
  min-width: 120px;
  align-items: center;
  margin-left: 0;
}
#dlAddRow #localSavesContainer .dl-chips {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;                     /* barre visible sur grand écran */
  scrollbar-color: #3a4150 transparent;
  padding-bottom: 4px;
}
#dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar { display: block; height: 8px; }
#dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar-track { background: transparent; }
#dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar-thumb { background: #3a4150; border-radius: 8px; }
@media (max-width: 700px) {
  /* au doigt : défilement sans barre */
  #dlAddRow #localSavesContainer .dl-chips { scrollbar-width: none; padding-bottom: 0; }
  #dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar { display: none; }
}


/* =====================================================================
   MOBILE : textes des boutons (CSS seul, indépendant de bar-nav.js)
   + mesures (bn-tabs) sur toute la largeur disponible
   ===================================================================== */
/* Samples : toutes résolutions */
/* Samples : "🔥 SAMPLES" + deux boutons icône seule (+ et upload), sans texte */
#dlAddRow .dl-addtxt { display: none !important; }
#dlAddRow::before {
  content: "\1F525  SAMPLES";
  flex: 0 0 auto;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #9aa0a8;
}
html #dlAddRow #addSampleBtn,
html #dlAddRow #uploadSampleBtn {
  padding: 4px 9px;
  gap: 0;
  background: #1a1c21;
  border: 1px solid #2a2c32;
  border-radius: 6px;
  color: #ddd;
}
html #dlAddRow #addSampleBtn:hover,
html #dlAddRow #uploadSampleBtn:hover { background: #1a1c21; border-color: #777; }
#dlAddRow #addSampleBtn svg,
#dlAddRow #uploadSampleBtn svg { width: 16px; height: 16px; }

@media (max-width: 700px) {
  /* Les mesures prennent tout l'espace restant ; − et + restent à droite */
  html #barNav.dl-bn-wrap > .bn-tabs {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
}


/* =====================================================================
   SAUVEGARDES LOCALES : message quand il n'y en a aucune
   (le <span> "💾 no saves" est créé par gamma001.js, sans classe ;
    on remplace son texte en CSS, sans toucher au JS)
   ===================================================================== */
#dlAddRow #localSavesContainer > span:not(.dl-chips) {
  font-size: 0 !important;                 /* masque l'ancien texte */
  padding: 0 4px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
} 
#dlAddRow #localSavesContainer > span:not(.dl-chips)::after {
  content: "No saves yet";                 /* mobile : court et petit */
  font-size: .6rem;
  color: #8b93a1;
}
@media (min-width: 701px) {
  #dlAddRow #localSavesContainer > span:not(.dl-chips)::after {
    content: "No local saves yet : click the disk to save this loop";   /* desktop : plus grand et plus explicite */
    font-size: .85rem;
  }
}
 

/* =====================================================================
   LOGIN : pas de cadre jaune (toutes résolutions)
   ===================================================================== */
#openAuthModalBtn,
#openAuthModalBtn.active,
#openAuthModalBtn:hover {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* =====================================================================
   SAUVEGARDES LOCALES : boutons de taille uniforme (puces, save, delete)
   ===================================================================== */
html #dlAddRow #localSavesContainer .dl-chips .dl-chip {
  flex: 0 0 76px;
  width: 76px; min-width: 76px; max-width: 76px;
  height: 32px;
  line-height: 30px;
  border-radius: 8px;
  font-size: .78rem;
}
html #dlAddRow #localSavesContainer > button {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
html #dlAddRow #localSavesContainer > button svg { width: 18px; height: 18px; }

/* =====================================================================
   COMMUNAUTÉ : All Loops / Top week / Top month / Comments / Users
   -> grille de boutons de même taille, sur plusieurs lignes
   ===================================================================== */
.community-nav-inline { display: block; }          /* le <nav> contient 2 blocs : puces + boutons */
.community-nav-inline .nav-separator {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 6px;
}
.community-nav-inline .nav-separator a {
  justify-content: center;
  height: 34px;
  padding: 0 10px;
  box-sizing: border-box;
  font-size: 13px;
  border-radius: 8px;
}

/* =====================================================================
   MOBILE : sauvegardes sur leur propre ligne + carrés d'éditeur plus petits
   ===================================================================== */
@media (max-width: 700px) {
  html #dlAddRow #localSavesContainer {
    flex: 1 1 100% !important;
    order: 5;
    min-width: 100%;
    border-left: 0 !important;
    padding-left: 0 !important;
    margin-top: 2px;
  }
  html #dlAddRow #localSavesContainer .dl-chips { max-width: none; }

  /* Taille de base des carrés : un cran en dessous (le zoom manuel reste prioritaire) */
  #grid.mode-16:not(.zoomed) .step,
  #grid.mode-32:not(.zoomed) .step,
  #grid.mode-16:not(.zoomed) .play-cursor,
  #grid.mode-32:not(.zoomed) .play-cursor { width: 20px; height: 20px; }
  #grid.mode-64:not(.zoomed) .step,
  #grid.mode-64:not(.zoomed) .play-cursor { width: 17px; height: 17px; }

}


/* =====================================================================
   COMMENTAIRES EN ATTENTE
   ===================================================================== */
.comment_c.cm-pending {
  background: #2a2a2a !important;
  border-left: 4px solid #ffc107;
  padding: .6em .8em !important;
  margin-bottom: .6em;
}
.comment_c.cm-pending.cm-own { background: #2d2a1c !important; }
.cm-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  background: rgba(255, 193, 7, .15);
  color: #ffc107;
  font-size: .75em;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.cm-hidden { color: #8b93a1; font-size: .9em; }
#comment-btn #comment-count-pending-wrap { color: #ffc107; }


/* ===== Video demo badge (next to "Do you like this new version?") ===== */
.dl-video-demo {
  display: none;               /* desktop only */
  align-items: center;
  gap: .35rem;
  margin-left: .5rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  box-shadow: 0 0 10px rgba(168,85,247,.55);
  vertical-align: middle;
  transition: transform .15s, box-shadow .15s;
}
.dl-video-demo:hover { transform: translateY(-1px); box-shadow: 0 0 16px rgba(236,72,153,.8); }
.dl-video-demo svg { flex: none; }
@media (min-width: 1100px) {
  .dl-video-demo { display: inline-flex; }
}


/* =====================================================================
   SAUVEGARDES LOCALES : plus d'air autour de la scrollbar + mode suppression
   ===================================================================== */
html #dlAddRow #localSavesContainer {
  gap: 10px;
  align-items: center;
}
html #dlAddRow #localSavesContainer .dl-chips {
  gap: 8px;
  padding: 4px 4px 4px 2px;              /* même espace haut/bas : les puces restent centrées dans la rangée */
  scrollbar-width: thin;
  scrollbar-color: #4a5266 rgba(255,255,255,.05);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
}
html #dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar { height: 6px; }
html #dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 6px; }
html #dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar-thumb { background: #4a5266; border-radius: 6px; }
html #dlAddRow #localSavesContainer .dl-chips::-webkit-scrollbar-thumb:hover { background: #6a7388; }
@media (max-width: 700px) {
  html #dlAddRow #localSavesContainer .dl-chips { padding-bottom: 4px; }
}
html #dlAddRow #localSavesContainer > button:hover { border-color: #888; }

/* --- mode suppression --- */
html #dlAddRow #localSavesContainer.dl-del-mode { flex-wrap: wrap; row-gap: 8px; }
html #dlAddRow #localSavesContainer > button.dl-del-on {
  background: #e5484d !important;
  border-color: #ff6b70 !important;
  opacity: 1 !important;
}
html #dlAddRow #localSavesContainer > button.dl-del-on svg { stroke: #fff; }
/* Save verrouillé pendant la suppression (évite l'enregistrement par erreur) */
html #dlAddRow #localSavesContainer.dl-del-mode > button[title^="Save"] {
  pointer-events: none;
  opacity: .25 !important;
}
#dlAddRow .dl-delbar {
  order: -1;
  flex: 0 0 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(229,72,77,.09);
  border: 1px solid rgba(229,72,77,.45);
  border-radius: 10px;
}
#dlAddRow .dl-delbar .dl-delmsg { flex: 1 1 130px; min-width: 0; font-size: .8rem; color: #f3b9bb; }
#dlAddRow .dl-delbar button {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}
#dlAddRow .dl-delbar .dl-delgo { background: #e5484d; border-color: #e5484d; color: #fff; }
#dlAddRow .dl-delbar .dl-delgo:hover:not(:disabled) { background: #f0585d; border-color: #f0585d; }
#dlAddRow .dl-delbar .dl-delgo:disabled { opacity: .35; cursor: default; }
html #dlAddRow #localSavesContainer.dl-del-mode .dl-chips .dl-chip {
  position: relative;
  border-color: rgba(229,72,77,.55);
  cursor: pointer;
}
html #dlAddRow #localSavesContainer.dl-del-mode .dl-chips .dl-chip.dl-sel {
  background: #4a2327;
  border-color: #ff5a5f;
  color: #fff;
}
html #dlAddRow #localSavesContainer.dl-del-mode .dl-chips .dl-chip.dl-sel::after {
  content: "\2715";
  position: absolute;
  top: 1px; right: 5px;
  font-size: .6rem;
  line-height: 1;
  color: #ff8a8e;
}

/* Save / Delete : calés sur la même ligne que les puces (4 px du haut), avec ou sans scrollbar sous les puces */
html #dlAddRow #localSavesContainer > button {
  align-self: flex-start;
  margin-top: 4px !important;
}


/* ---------- Bouton « Follow » (à côté du zoom) : l'éditeur suit la lecture ---------- */
.zoom-wrap { display: inline-flex; align-items: center; gap: 8px; }
#followBtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  background: var(--dl-surface-2); color: var(--dl-muted);
  border: 1px solid var(--dl-line-strong); border-radius: 9px;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
#followBtn:hover { color: var(--dl-text); }
#followBtn.on {
  color: var(--dl-green); border-color: var(--dl-green);
  background: rgba(61, 220, 79, .12);
}

/* Follow : masqué sur mobile (< 600px) : trop rapide à suivre sur un petit écran */
@media (max-width: 599px) { #followBtn { display: none !important; } }

/* =====================================================================
   MOBILE < 600px : plus de barre des mesures (- / +), la ligne ctl_bt1 disparaît.
   Un bouton ⚙ (avant Lecture) affiche le nombre de steps et déplie Kit + Steps + BPM.
   (les éléments sont déplacés par dino-mobile.js, les handlers sont conservés)
   ===================================================================== */
#dlCtlPanel, #dlCtlBtn { display: none; }

@media (max-width: 599px) {
  /* plus de barre des mesures, ni son bouton "Show bars" */
  #barNav, #dlBarsShow { display: none !important; }

  /* la ligne ctl_bt1 (kit / steps / bpm) disparaît : son contenu est déplacé par le JS */
  #ctl_bt1 { display: none !important; }

  /* bouton ⚙ + nombre de steps (ambre) */
  #ctl_bt3 #dlCtlBtn {
    display: flex; float: left; width: auto; min-width: 42px; height: 42px;
    padding: 0 .6em; gap: 6px; margin-right: 8px;
    align-items: center; justify-content: center;
  }
  #ctl_bt3 #dlCtlBtn.on { background: rgba(45, 115, 210, .9); border-color: #4aa3ff; }

  /* barre d'outils : Lecture & co tout à gauche, bouton ⚙ tout à droite */
  #ctl_bt3 {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }
  #ctl_bt3 button { float: none !important; margin: 0 !important; }
  #ctl_bt3 #dlCtlBtn { float: none !important; order: 10; margin: 0 0 0 auto !important; }
  /* éléments vides (clr, messages) : pas de gap parasite ; un message s'affiche sur sa propre ligne */
  #ctl_bt3 .clr, #ctl_bt3 .response:empty { display: none !important; }
  #ctl_bt3 .response { order: 20; flex: 0 0 100%; text-align: right; }
  #dlCtlBtn .dl-steps-badge {
    font-size: .8rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
    color: #ffc233;
  }

  /* panneau Kit + Steps + BPM, déplié sous la barre de lecture : compact */
  #dlCtlPanel {
    display: none; grid-template-columns: minmax(0, 150px) auto auto;
    justify-content: start;
    align-items: start; gap: .5rem;
    padding: .5rem .6rem; margin: 0 0 .5rem 0;
    background: linear-gradient(180deg, #1b1f27 0%, #161920 100%);
    border: 1px solid var(--dl-line, #2e3340); border-radius: 12px;
  }
  #dlCtlPanel.open { display: grid; }
  #dlCtlPanel label { color: #aeb4c0; font-size: .7rem; font-weight: 600; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  #dlCtlPanel select, #dlCtlPanel input[type="number"] {
    height: 34px; box-sizing: border-box; padding: 0 .5rem; font-size: .9rem; margin: 0;
    background: var(--dl-inset, #222); color: var(--dl-text, #eee);
    border: 1px solid var(--dl-line-strong, #444); border-radius: 8px;
  }
  #dlCtlPanel #sampleKit { width: 100%; min-width: 0; text-overflow: ellipsis; }
  #dlCtlPanel #mode { width: 68px; }
  #dlCtlPanel #bpm { width: 64px; }

  /* liste des derniers loops (menu-nav-loop.php) : hauteur max 210px, défilement interne */
  .latest-loops-container {
    max-height: 210px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}


/* =====================================================================
   Barre de transport #ctl_bt3 : rendu identique à toutes les largeurs.
   gamma001.css la passe en display:block + float + font-size:1em sous 800px
   (texte de Send / File plus gros, espacements différents) : on garde ici
   le rendu "grand écran" (flex, texte .8rem) partout.
   ===================================================================== */
#ctl_bt3 { display: flex; flex-wrap: wrap; align-items: center; }
#ctl_bt3 button { float: none; margin-left: 0; margin-right: 0; font-size: .8rem; }
#ctl_bt3 .clr, #ctl_bt3 .response:empty { display: none; }
#ctl_bt3 .response { flex: 0 0 100%; }


/* =====================================================================
   Fenêtre pattern : favoris en premier (4/4 Kick, Trap Hat, Two-Step, Funk Shuffle), ordonnés par dino-mobile.js.
   Seuls les favoris sont visibles ; le bouton "…" déplie les autres (petit et grand écran).
   ===================================================================== */
#patterns-grid .pattern-btn.dl-pat-more { display: none; }
#patterns-grid.dl-has-fav .pattern-btn.dl-pat-more {
  display: block; background: transparent; border: 1px dashed var(--dl-line-strong, #444); color: var(--dl-muted, #aeb4c0);
}
#patterns-grid.dl-has-fav:not(.dl-expanded) .pattern-btn:not(.dl-fav):not(.dl-pat-more) { display: none; }
#patterns-grid.dl-has-fav:not(.dl-expanded) { max-height: none; }
