/* Thème Modulaire — panneaux eurorack, vis, câbles de patch (via modulaire.js) */
@import url('https://fonts.googleapis.com/css2?family=Martian+Mono:wght,wdth@700,75&display=swap');
body {
  background:
    repeating-linear-gradient(0deg, #1c1d21 0px, #1c1d21 118px, #0b0b0d 118px, #0b0b0d 126px) !important;
}
.sc-el.sc-bloc {
  background-color: #d8d5cc;
  border: 1px solid #55565c;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 2px 6px rgba(0,0,0,.5);
  font-family: 'Martian Mono', 'Courier New', monospace;
  letter-spacing: .02em;
  color: #1a1a1e;
  white-space: pre-wrap;   /* les retours à la ligne doivent rester visibles même
                               avant que le bloc soit reconnu comme "codé" */
}

.sc-el.sc-image, .sc-el.sc-iframe {
  border: 1px solid #55565c;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}

/* Câbles : masqués sur mobile et en preview mobile */
@media (max-width:768px) { #sc-patch-cables, .sc-jack { display:none !important; } }
body.sc-mobile-view #sc-patch-cables { display:none !important; }

/* Barrettes de connexion sous les blocs (visiteurs) */
.sc-jackbar {
  position: absolute;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 9px 5px;
  background: linear-gradient(#4a4b52, #33343a);
  border: 1px solid #1c1d21;
  border-top: none;
  box-shadow: 0 3px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
}
.sc-hole {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #000 38%, #777 45%, #aaa 58%, #3a3a40 72%);
  border: 1px solid #17181c;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
}
.sc-hole:hover {
  transform: scale(1.35);
  box-shadow: 0 0 9px rgba(240,192,48,.85);
}
.sc-hole-mod { box-shadow: inset 0 0 0 2px rgba(240,192,48,.5); }
.sc-hole-mod:hover { box-shadow: inset 0 0 0 2px rgba(240,192,48,.8), 0 0 9px rgba(240,192,48,.85); }
/* Trou dédié carrefour : liseré orange */
.sc-hole-car { box-shadow: inset 0 0 0 2px rgba(255,140,40,.7); }
.sc-hole-car:hover { box-shadow: inset 0 0 0 2px rgba(255,140,40,1), 0 0 9px rgba(255,140,40,.9); }

/* Sélecteur d'onde du bloc */
.sc-wave-btn {
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1;
  color: #7dd8a8;
  background: #17181c;
  border: 1px solid #0c0d10;
  border-radius: 3px;
  cursor: pointer;
  padding: 0 2px;
  text-shadow: 0 0 5px rgba(125,216,168,.7);
  transition: transform .1s ease;
}
.sc-wave-btn:hover { transform: scale(1.2); }

/* Mini-potard de transposition */
.sc-pitch {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #6a6b72, #2e2f34 70%);
  border: 1.5px solid #17181c;
  cursor: ns-resize;
  position: relative;
  touch-action: none;
  flex-shrink: 0;
}
.sc-pitch-mark {
  position: absolute;
  top: 1px; left: 50%;
  width: 2px; height: 5px;
  margin-left: -1px;
  background: #f0c030;
  border-radius: 1px;
  pointer-events: none;
}
.sc-pitch:hover { box-shadow: 0 0 7px rgba(240,192,48,.6); }

/* Potard VOL (niveau de sortie du bloc) — marque verte pour le distinguer du pitch */
.sc-level {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #6a6b72, #2e2f34 70%);
  border: 1.5px solid #17181c;
  cursor: ns-resize;
  position: relative;
  touch-action: none;
  flex-shrink: 0;
}
.sc-level-mark {
  position: absolute;
  top: 1px; left: 50%;
  width: 2px; height: 5px;
  margin-left: -1px;
  background: #4ad07a;
  border-radius: 1px;
  pointer-events: none;
}
.sc-level:hover { box-shadow: 0 0 7px rgba(74,208,122,.6); }

/* Potard PUNCH (drive/saturation intégrée des percussions du bloc) —
   marque orange, même couleur que les câbles CRUSH-03, pour le lien visuel */
.sc-punch {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #6a6b72, #2e2f34 70%);
  border: 1.5px solid #17181c;
  cursor: ns-resize;
  position: relative;
  touch-action: none;
  flex-shrink: 0;
}
.sc-punch-mark {
  position: absolute;
  top: 1px; left: 50%;
  width: 2px; height: 5px;
  margin-left: -1px;
  background: #e06030;
  border-radius: 1px;
  pointer-events: none;
}
.sc-punch:hover { box-shadow: 0 0 7px rgba(224,96,48,.6); }

body.sc-edit-mode .sc-jackbar { display: none; }

/* ── Mute / play par bloc ── */
.sc-block-mute {
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  line-height: 16px; text-align: center;
  font-size: 10px;
  color: #30b060;
  background: rgba(255,255,255,.6);
  border-radius: 50%;
  cursor: pointer;
  z-index: 20;
  touch-action: none;
  transition: color .15s, background .15s, box-shadow .15s;
}
.sc-block-mute:hover { background: rgba(255,255,255,.9); }
.sc-block-mute.sc-muted { color: #c0392b; }
/* En attente de bascule (au prochain début de mesure) : clignote */
.sc-block-mute.sc-mute-pending {
  box-shadow: 0 0 0 2px #e0a030;
  animation: sc-mute-blink .5s steps(2) infinite;
}
@keyframes sc-mute-blink { 0%{opacity:1} 50%{opacity:.4} }
/* Bloc muté : légèrement estompé */
.sc-el.sc-block-muted { opacity: .5; }

/* ── Tiroir des modules ── */
.sc-module {
  transition: transform .34s cubic-bezier(.4,0,.2,1), opacity .28s ease;
}
body.sc-rack-hidden .sc-module {
  transform: translateY(140vh) !important;
  opacity: 0;
  pointer-events: none;
}
#sc-rack-toggle {
  position: fixed;
  bottom: 16px; left: 150px;
  z-index: 10003;
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  background: #2b2d34; border: 1px solid #15161a; border-radius: 7px;
  color: #cfd0d4; cursor: pointer;
  font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 11px;
  letter-spacing: .04em;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  transition: background .12s, color .12s;
}
#sc-rack-toggle:hover { background: #3a3d46; color: #7dd8a8; }
#sc-rack-toggle .sc-rack-icon { font-size: 13px; line-height: 1; }
#sc-rack-toggle.closed { background: #35414a; color: #7dd8a8; }
#sc-rack-toggle.closed .sc-rack-icon { opacity: .7; }

/* ── Contrôles de zoom ── */
.sc-zoom-ctrl {
  position: fixed;
  bottom: 16px; left: 16px;
  display: flex; gap: 0;
  z-index: 10002;
  background: #2b2d34;
  border: 1px solid #15161a;
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.sc-zoom-ctrl button {
  background: #2b2d34; border: none; color: #cfd0d4;
  font-family: 'Martian Mono', 'Courier New', monospace; font-size: 15px; font-weight: 700;
  width: 34px; height: 30px; cursor: pointer;
  transition: background .12s;
}
.sc-zoom-ctrl button:hover { background: #3a3d46; color: #7dd8a8; }
.sc-zoom-ctrl button:active { background: #23252b; }
#sc-zoom-label-btn { width: auto; padding: 0 10px; border-left: 1px solid #15161a; border-right: 1px solid #15161a; }
#sc-zoom-label { font-size: 11px; color: #a8a8a8; }
#sc-zoom-label-btn:hover #sc-zoom-label { color: #7dd8a8; }

/* Le canvas se transforme (zoom/pan) : scotch.css met overflow-x:hidden sur
   <main> pour le rendu normal, mais ici le clip se figerait dans l'espace
   local du canvas et resterait borné à la largeur d'origine même après un
   dézoom — il faut laisser le débordement libre pour que le pan/zoom donne
   bien accès à tout le contenu placé hors du cadre initial. */
#sc-canvas { will-change: transform; position: relative; z-index: 1; overflow: visible; }

/* Bloc verrouillé (sélectionné) : cadenas visible, animation figée */
.sc-el.sc-locked::after {
  content: '\1F512';   /* 🔒 */
  position: absolute;
  top: 3px; right: 22px;
  font-size: 11px;
  opacity: .8;
  pointer-events: none;
  z-index: 21;
}

/* Panneau d'animation — apparaît quand le bloc est sélectionné */
.sc-anim-panel {
  position: absolute;
  top: 100%; left: 0; margin-top: 32px;   /* sous la barrette de jacks (26px), pas dessus */
  width: max-content; max-width: 170px;
  background: linear-gradient(#4a4b52, #33343a);
  border: 1px solid #1c1d21;
  border-radius: 6px;
  padding: 6px 8px;
  z-index: 40;
  display: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  font-family: 'Martian Mono', 'Courier New', monospace;
}
.sc-anim-panel.visible { display: block; }
.sc-anim-moves { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.sc-anim-move {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #17181c; border: 1px solid #0c0d10; color: #8a8f9c;
  font-size: 12px; line-height: 1; cursor: pointer;
}
.sc-anim-move:hover { color: #fff; box-shadow: 0 0 7px rgba(240,192,48,.5); }
.sc-anim-move.on {
  color: #f0c030; text-shadow: 0 0 6px rgba(240,192,48,.8);
  box-shadow: inset 0 0 0 1px rgba(240,192,48,.6);
}
.sc-anim-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.sc-anim-ico { font-size: 11px; color: #8a8f9c; width: 13px; text-align: center; flex-shrink: 0; }
.sc-anim-row input[type=range] {
  flex: 1; max-width: 110px; height: 4px; cursor: pointer;
  accent-color: #f0c030;
}

/* ── Module GÉNÉRATEUR ── */
#sc-gen-melo, #sc-gen-ryth {
  display: block; width: 100%; margin: 0 0 5px; padding: 5px;
  background: #3a3f4a; border: 1px solid #22262e; color: #cfd8e0;
  font-family: 'Martian Mono', 'Courier New', monospace; font-size: 10px; font-weight: 700;
  letter-spacing: .08em; cursor: pointer;
}
#sc-gen-melo:hover { background: #46506a; color: #b0d0ff; }
#sc-gen-ryth:hover { background: #4a4636; color: #ffd8a0; }
#sc-gen-melo:active, #sc-gen-ryth:active { transform: translateY(1px); }
.sc-gen-hint {
  font-size: 7.5px; letter-spacing: .06em; text-transform: uppercase;
  color: #8a8478; text-align: center; margin-top: 2px;
}

/* ── Module IMAGE ── */
#sc-img-load {
  display: block; width: 100%; margin: 0 0 5px; padding: 5px;
  background: #3a3f4a; border: 1px solid #22262e; color: #cfd8e0;
  font-family: 'Martian Mono', 'Courier New', monospace; font-size: 10px; font-weight: 700;
  letter-spacing: .08em; cursor: pointer;
}
#sc-img-load:hover { background: #46506a; color: #b0d0ff; }
#sc-img-load:active { transform: translateY(1px); }

/* ── Module CARREFOUR ── */
.sc-turn-ins {
  display: flex; gap: 5px; justify-content: center;
  margin-bottom: 6px;
}
.sc-turn-in {
  font-size: 0;   /* masque le numéro : on garde le jack rond */
  flex: 0 0 auto;
}
.sc-turn-jackrow { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; justify-content: center; }
#sc-turn-count { font-size: 9px; color: #8a8478; letter-spacing: .05em; }
.sc-turn-ctrl { margin-bottom: 6px; }
.sc-turn-lbl {
  font-size: 8px; letter-spacing: .12em; text-transform: uppercase;
  color: #8a8478; text-align: center; margin-bottom: 3px;
}
.sc-turn-dens, .sc-turn-div { display: flex; gap: 4px; justify-content: center; }
.sc-turn-dbtn, .sc-turn-vbtn {
  flex: 1; padding: 3px; background: #45464c; border: 1px solid #2a2b30;
  color: #cfd0d4; font-family: 'Martian Mono', 'Courier New', monospace; font-size: 10px;
  font-weight: 700; cursor: pointer;
}
.sc-turn-dbtn:hover, .sc-turn-vbtn:hover { background: #55565c; color: #fff; }
.sc-turn-dbtn.on, .sc-turn-vbtn.on { background: #e0a030; border-color: #a87418; color: #1a1a1e; }
#sc-turn-members { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.sc-turn-chip {
  min-width: 18px; height: 18px; line-height: 17px; text-align: center;
  font-size: 10px; font-weight: 700; padding: 0 3px;
  background: #d8d5cc; color: #45464c; border: 1px solid #b5b2a8;
  border-radius: 3px; cursor: pointer;
}
.sc-turn-chip:hover { background: #c0392b; color: #fff; }
.sc-turn-chip.on { background: #e0a030; color: #1a1a1e; border-color: #a87418; }
/* Blocs pilotés par le carrefour */
.sc-el.sc-turn-on  { outline: 2px solid #e0a030; outline-offset: 1px; }
.sc-el.sc-turn-off { opacity: .45; }

/* ── Module MESURE ── */
.sc-bar-pick { display: flex; gap: 4px; justify-content: center; margin-bottom: 5px; }
.sc-bar-btn {
  width: 26px; height: 24px;
  background: #45464c; border: 1px solid #2a2b30; color: #cfd0d4;
  font-family: 'Martian Mono', 'Courier New', monospace; font-size: 12px; font-weight: 700;
  cursor: pointer;
}
.sc-bar-btn:hover { background: #55565c; color: #fff; }
.sc-bar-btn.on { background: #30b060; border-color: #1f7a3d; color: #fff; }
/* Points de mesure : où on en est dans la mesure courante, et quand un
   mute/démute en attente va tomber (1er point, en orange) */
.sc-bar-dots { display: flex; gap: 5px; justify-content: center; margin-top: 7px; }
.sc-bar-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #45464c;
  border: 1px solid #2a2b30;
  transition: background .08s ease, box-shadow .08s ease;
}
.sc-bar-dot.on { background: #f0c030; box-shadow: 0 0 6px rgba(240,192,48,.8); }
.sc-bar-dot.sc-bar-dot-hit { background: #e06030; box-shadow: 0 0 10px rgba(224,96,48,.95); }

.sc-el.sc-coding {
  font-family: 'Martian Mono', 'Courier New', monospace; /* défaut mono — le choix Style du bloc gagne */
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Poignée de redimensionnement des blocs codés (visiteur) */
.sc-live-resize {
  position: absolute;
  width: 16px; height: 16px;
  z-index: 700;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 6px, #f0c030 6px 8px, transparent 8px 10px, #f0c030 10px 12px, transparent 12px);
  touch-action: none;
}
@media (max-width:768px) { .sc-live-resize { display: none !important; } }
.sc-el.sc-live-edit {
  outline: 2px dashed #f0c030 !important;
  cursor: text !important;
  user-select: text !important;
}
.sc-live-led {
  position: absolute;
  top: 3px; right: 14px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #30d060;
  box-shadow: 0 0 8px rgba(48,208,96,.9);
  animation: sc-live-pulse 1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sc-live-pulse { 0%,100%{opacity:1} 50%{opacity:.25} }

/* Pulsation du bloc à chaque note jouée */
.sc-el.sc-note-on {
  filter: brightness(1.4) saturate(1.2);
}
.sc-el.sc-bloc { transition: filter .06s ease, box-shadow .12s ease; }

/* ── Modules (SCOTCH-01 + minis) ── */
.sc-module {
  position: fixed;
  bottom: 14px; right: 14px;
  z-index: 9997;
  background: #d8d5cc;
  border: 1px solid #55565c;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 4px 14px rgba(0,0,0,.55);
  padding: 10px 14px 12px;
  width: 168px;
  font-family: 'Martian Mono', 'Courier New', monospace;
  user-select: none;
}
.sc-mini {
  width: 86px;
  padding: 8px 10px 9px;
}
.sc-mod-tiny {
  width: 58px;
  padding: 6px 8px 7px;
}
.sc-mod-tiny .sc-module-title { margin-bottom: 4px; font-size: 9px; }
.sc-mini .sc-knob-wrap { margin: 0 auto; }
.sc-module::before, .sc-module::after {
  content: '';
  position: absolute;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0f0f0, #7a7a80 60%, #3a3a40);
  box-shadow: inset 0 0 2px rgba(0,0,0,.6);
}
.sc-module::before { top: 4px; left: 4px; }
.sc-module::after  { bottom: 4px; right: 4px; }

.sc-module-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  color: #33343a;
  text-align: center;
  margin-bottom: 8px;
  border-bottom: 1px solid #b5b2a8;
  padding-bottom: 5px;
  cursor: move;
  touch-action: none;
}

/* Sections du module — chacune séparée par un liseré */
.sc-sec {
  padding: 8px 0;
  border-bottom: 1px solid #c2bfb5;
}
.sc-sec:last-child { border-bottom: none; padding-bottom: 2px; }
.sc-sec:first-of-type { padding-top: 2px; }
.sc-sec-lbl {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #8a8478;
  text-align: center;
  margin-bottom: 6px;
}
/* Section transport : bouton power + potard VOL alignés */
.sc-sec:first-of-type {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.sc-pwr-col { display: flex; flex-direction: column; align-items: center; }
.sc-sec:first-of-type #sc-synth-pwr { margin: 0; }
.sc-sec:first-of-type .sc-pwr-label { width: 52px; margin: 4px 0 0; }
.sc-sec:first-of-type .sc-synth-knobs { flex: 0 0 auto; }

/* Sorties de modulation */
.sc-synth-outs {
  display: flex;
  justify-content: space-between;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.sc-modjack-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.sc-modjack-wrap span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #45464c;
}
.sc-modjack {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #111 35%, #666 40%, #999 55%, #444 70%);
  border: 2.5px solid;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.sc-modjack:hover { transform: scale(1.25); box-shadow: 0 0 10px rgba(240,192,48,.7); }
.sc-modjack.on    { box-shadow: 0 0 10px currentColor; }

#sc-synth-pwr {
  display: block;
  margin: 0 auto 3px;
  width: 52px; height: 34px;
  background: #b23d34;
  border: 1px solid #7a2a24;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.2), 0 2px 4px rgba(0,0,0,.4);
  animation: sc-pwr-invite 1.6s ease-in-out infinite;
}
#sc-synth-pwr:hover { background: #c9463b; }
.sc-pwr-glyph {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 18px;
  color: #ffe8e5;
  text-shadow: 0 0 4px rgba(0,0,0,.4);
  pointer-events: none;
}
#sc-synth-led {
  position: absolute;
  top: 4px; right: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ffd0cc;
  opacity: .5;
  transition: opacity .1s linear;
}
.sc-pwr-label {
  text-align: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #b23d34;
  margin-bottom: 8px;
}
/* État allumé : le bouton passe au vert, l'invite s'arrête */
#sc-synth.on #sc-synth-pwr {
  background: #2fa855;
  border-color: #1f7a3d;
  animation: none;
}
#sc-synth.on #sc-synth-pwr:hover { background: #35bf60; }
#sc-synth.on .sc-pwr-glyph { color: #eafff0; }
#sc-synth.on #sc-synth-led { background: #eafff0; }
#sc-synth.on .sc-pwr-label { color: #2fa855; }

@keyframes sc-pwr-invite {
  0%,100% { box-shadow: inset 0 1px 2px rgba(255,255,255,.2), 0 2px 4px rgba(0,0,0,.4), 0 0 0 0 rgba(178,61,52,.5); }
  50%     { box-shadow: inset 0 1px 2px rgba(255,255,255,.2), 0 2px 4px rgba(0,0,0,.4), 0 0 0 7px rgba(178,61,52,0); }
}

/* Bouton PARTAGER */
.sc-synth-io {
  display: flex;
  gap: 4px;
  margin: 0 0 10px;
}
#sc-synth-share, #sc-synth-load {
  flex: 1;
  padding: 5px 2px;
  background: #45464c;
  border: 1px solid #2a2b30;
  color: #cfd0d4;
  font-family: 'Martian Mono', 'Courier New', monospace;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
#sc-synth-share:hover, #sc-synth-load:hover { background: #4f505a; color: #fff; }
#sc-synth-share:active, #sc-synth-load:active { background: #35363c; }

#sc-synth-help {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 4px;
  background: #3a3b41;
  border: 1px solid #2a2b30;
  color: #b0b1b6;
  font-family: 'Martian Mono', 'Courier New', monospace;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
}
#sc-synth-help:hover { background: #45464c; color: #f0c030; }

/* Bouton débrancher tout */
#sc-synth-resync {
  display: block;
  width: 100%;
  margin: 0 0 6px;
  padding: 4px;
  background: #2f4a3a;
  border: 1px solid #1c2a22;
  color: #a0d8bc;
  font-family: 'Martian Mono', 'Courier New', monospace;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
}
#sc-synth-resync:hover { background: #385c48; color: #c0ffd8; }
#sc-synth-resync:active { background: #243a2c; }

#sc-synth-clean {
  display: block; width: 100%; margin: 0 0 6px; padding: 4px;
  background: #33384a; border: 1px solid #1c202a; color: #a8b4d8;
  font-family: 'Martian Mono', 'Courier New', monospace; font-size: 8.5px; font-weight: 700;
  letter-spacing: .08em; cursor: pointer;
}
#sc-synth-clean:hover { background: #3e4560; color: #c8d4ff; }
#sc-synth-clean:active { background: #282c3a; }

#sc-synth-anim-reset {
  display: block; width: 100%; margin: 0 0 6px; padding: 4px;
  background: #3a2f4a; border: 1px solid #201c2a; color: #c0a8d8;
  font-family: 'Martian Mono', 'Courier New', monospace; font-size: 8.5px; font-weight: 700;
  letter-spacing: .08em; cursor: pointer;
}
#sc-synth-anim-reset:hover { background: #46385c; color: #dcc8ff; }
#sc-synth-anim-reset:active { background: #2a2038; }

#sc-synth-clear {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 4px;
  background: #4a2f2f;
  border: 1px solid #2a1c1c;
  color: #d8a0a0;
  font-family: 'Martian Mono', 'Courier New', monospace;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
}
#sc-synth-clear:hover { background: #5c3838; color: #ffc0c0; }
#sc-synth-clear:active { background: #3a2424; }

/* Module CARREFOUR : coupe uniquement les câbles d'effet, garde la nappe */
#sc-turn-fxcut {
  background: #4a2f2f; border: 1px solid #2a1c1c; color: #d8a0a0;
  font-family: 'Martian Mono', 'Courier New', monospace; font-size: 10px; font-weight: 700;
  letter-spacing: .08em; padding: 4px; cursor: pointer;
}
#sc-turn-fxcut:hover { background: #5c3838; color: #ffc0c0; }
#sc-turn-fxcut:active { background: #3a2424; }

/* Croix de suppression d'un bloc (visiteur) */
.sc-block-del {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  line-height: 15px;
  text-align: center;
  font-size: 11px;
  color: #b23d34;
  background: rgba(255,255,255,.55);
  border-radius: 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
  z-index: 20;
  touch-action: none;
}
.sc-el:hover .sc-block-del { opacity: 1; }
.sc-block-del:hover { background: #b23d34; color: #fff; }

/* Panneau d'aide */
#sc-help {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, 90vw);
  max-height: 82vh;
  overflow-y: auto;
  background: #1a1a2e;
  border: 1px solid #55565c;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  color: #d8d5cc;
  font-family: 'Martian Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 22px 24px;
  z-index: 10001;
}
#sc-help h4 {
  margin: 0 0 12px; font-size: 14px; color: #7dd8a8;
  letter-spacing: .06em;
}
#sc-help p { margin: 0 0 10px; }
#sc-help b { color: #f0c030; }
#sc-help i { color: #8ab8ff; font-style: normal; }
#sc-help pre {
  background: #0d0d18; border: 1px solid #33343a;
  padding: 8px 10px; margin: 0 0 10px;
  font-size: 11px; color: #a8d8b8; white-space: pre-wrap;
}
#sc-help-x {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: #999;
  font-size: 16px; cursor: pointer; line-height: 1;
}
#sc-help-x:hover { color: #fff; }

/* Bloc sélectionné pour le clavier live */
.sc-el.sc-kb-sel {
  outline: 2px solid #7dd8a8 !important;
  box-shadow: 0 0 14px rgba(125,216,168,.5) !important;
}

/* Notification "lien copié" */
#sc-share-note {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a2e;
  color: #7dd8a8;
  font-family: 'Martian Mono', 'Courier New', monospace;
  font-size: 12px;
  padding: 9px 18px;
  border: 1px solid #7dd8a8;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 10000;
}
#sc-share-note.sc-share-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sc-synth-knobs {
  display: flex;
  justify-content: center;
  gap: 16px;
}
.sc-knob-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.sc-knob-wrap span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #45464c;
}
.sc-knob {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #6a6b72, #2e2f34 70%);
  border: 2px solid #1c1d21;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
  cursor: ns-resize;
  position: relative;
  touch-action: none;
}
.sc-knob-mark {
  position: absolute;
  top: 3px; left: 50%;
  width: 3px; height: 11px;
  margin-left: -1.5px;
  background: #f0c030;
  border-radius: 2px;
  pointer-events: none;
}

/* Module TEMPO : lecture/écriture du BPM au chiffre */
.sc-bpm-row {
  display: flex; align-items: baseline; justify-content: center;
  gap: 4px; margin-top: 8px;
}
.sc-bpm-row input {
  width: 42px;
  background: #2e2f34;
  border: 1px solid #1c1d21;
  color: #f0c030;
  font-family: 'Martian Mono', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
}
.sc-bpm-row input:focus { outline: 1px solid #f0c030; }
.sc-bpm-row span {
  font-size: 8px; font-weight: 700; letter-spacing: .08em; color: #45464c;
}

/* Masquer le synthé sur mobile (le jouet est desktop) */
@media (max-width:768px) { .sc-module, .sc-jackbar { display: none !important; } }
