/* ——— Onglet Tablature (Atelier) ——— */

.workshopPanel--tab.is-open {
  display: block;
  overflow: visible;
  position: relative;
}

.workshopPanel--tab.is-open .workshopPanel__inner--tab {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1.25rem;
  gap: 0.85rem;
  overflow: visible;
}

.workshopPanel--tab.is-open .workshopPanel__inner.workshopPanel__inner--tab {
  overflow: visible;
}

.workshopTabTool__head {
  flex-shrink: 0;
}

.workshopTabTool__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--da-ink-muted, #5c6578);
}

.workshopTabTool__title {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--da-ink, #1a1f2e);
}

.workshopTabTool__hint {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--da-ink-muted, #5c6578);
  max-width: 52ch;
}

.workshopTabTool__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  flex-shrink: 0;
}

.workshopTabTool__labelInput {
  min-width: 12rem;
  max-width: 18rem;
  height: 2.15rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.875rem;
}

.workshopTabTool__toolbar .followingGhostBtn.is-active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
}

.tabToolConfirmModal__danger {
  border-color: rgba(185, 28, 28, 0.45);
  color: #991b1b;
  background: rgba(254, 226, 226, 0.85);
}

.tabToolConfirmModal__danger:hover {
  background: rgba(254, 202, 202, 0.95);
  border-color: rgba(185, 28, 28, 0.65);
}

.workshopTabTool__neckWrap {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  overflow: visible;
  padding: 0.45rem 0 0.65rem;
}

.workshopTabTool__rotateHost {
  position: relative;
  display: block;
  width: min(100%, 920px);
  /* Hauteur visuelle du manche pivoté (6 cordes) + marge haut/bas */
  height: calc((var(--strings) - 1) * var(--string-gap) + 7.25rem);
  max-width: 100%;
  margin-inline: 0;
  overflow: hidden;
}

.workshopTabTool__rotateHost > .workshopTabTool__neckMount {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%) rotate(-90deg) scale(0.94);
  transform-origin: center center;
  width: auto;
  max-width: none;
}

.workshopTabTool__neckMount {
  width: fit-content;
}

.workshopTabTool {
  --strings: 6;
  --string-gap: 26px;
}

.tabToolDiagram {
  --frets: 24;
  --string-gap: 26px;
  --fret-gap: 17px;
  --dot-size: 17px;
  --tab-neck-slot-w: 340px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.5rem 0.4rem 0.65rem 0.55rem;
  border: 1px solid #c8d2e2;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

/* Cordes à vide au-dessus du sillet → à gauche du sillet une fois le manche pivoté */
.tabToolDiagram--horizontal .chordDiagram__stringRow {
  display: block;
  position: relative;
  height: 28px;
  margin-bottom: 0.2rem;
}

/* Sillet : style chordDiagram d’origine (barre noire, extensions cordes) */
.tabToolDiagram--horizontal .chordDiagram__nut {
  --nut-extend-left: 8px;
  --nut-extend-right: 8px;
  flex-shrink: 0;
  height: 9px;
  width: calc(100% + var(--nut-extend-left) + var(--nut-extend-right));
  margin-left: calc(-1 * var(--nut-extend-left));
  transform: none;
  align-self: stretch;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    #2a2a2a 0%,
    #0a0a0a 55%,
    #000 100%
  );
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Numéros de frettes lisibles après pivot -90° du manche */
.tabToolDiagram--horizontal .chordDiagram__fretLabels {
  place-items: center center;
  padding-inline-end: 0.2rem;
}

.tabToolDiagram--horizontal .chordDiagram__fretLabels span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(90deg);
  transform-origin: center center;
  width: auto;
  min-width: 1.1em;
  padding-left: 0;
}

.tabToolDiagram .chordDiagram__cell.is-last-pick {
  background: rgba(37, 99, 235, 0.14);
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
}

.tabToolDiagram .chordDiagram__dot--pick {
  background: #2563eb;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85) inset;
  z-index: 3;
  pointer-events: none;
}

.tabToolDiagram .chordDiagram__dot--stack {
  background: #2563eb;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9) inset;
  z-index: 3;
  pointer-events: none;
  opacity: 0.92;
}

.tabToolDiagram .chordDiagram__cell.is-stack-note {
  background: rgba(37, 99, 235, 0.2);
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 1px;
  z-index: 2;
}

/* ——— Techniques main gauche + liaisons tab ——— */

.workshopTabTool {
  --tab-string-label-w: 1.6rem;
  /* Hauteur du conteneur scroll (#tabToolStaffMount) */
  --tab-staff-mount-min-h: 13rem;
}

.workshopTabTool__techniqueBridge {
  flex-shrink: 0;
  margin: 0.1rem 0 0.55rem;
  padding: 0.7rem 0.9rem 0.75rem;
  border: 1px solid #cfd8e8;
  border-radius: 12px;
  background: linear-gradient(165deg, #f8fafc 0%, #eef2f8 48%, #f5f7fb 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 1px 3px rgba(26, 31, 46, 0.06);
}

.workshopTabTool__techniqueBridgeTitle {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--da-ink-muted, #5c6578);
}

.workshopTabTool__techniqueBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  margin-bottom: 0.4rem;
}

.workshopTabTool__techniqueBar .tabTechniqueBtn.is-active {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.5);
  color: #1d4ed8;
}

.tabTechniqueBtn__short {
  font-size: 0.85em;
  font-weight: 600;
  opacity: 0.75;
}

.workshopTabTool__techniqueHint {
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--da-ink-muted, #5c6578);
}

.tabToolDiagram .chordDiagram__neck {
  position: relative;
}

/* Pastille validée (point du manche) — reste visible pendant tout le geste */
.tabToolDiagram .chordDiagram__cell.is-gesture-validated {
  background: rgba(22, 163, 74, 0.5) !important;
  box-shadow:
    0 0 0 3px #16a34a,
    0 0 14px rgba(22, 163, 74, 0.55);
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 6;
}

/* Flash au moment où la pause 0,5 s valide la frette */
.tabToolDiagram .chordDiagram__cell.is-gesture-validated-flash {
  animation: tabNeckStopValidate 0.55s ease-out forwards;
}

@keyframes tabNeckStopValidate {
  0% {
    transform: translate(-50%, -50%) scale(1);
    background: rgba(37, 99, 235, 0.2);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
  }
  40% {
    transform: translate(-50%, -50%) scale(1.32);
    background: rgba(34, 197, 94, 0.75);
    box-shadow:
      0 0 0 6px rgba(22, 163, 74, 0.45),
      0 0 20px rgba(22, 163, 74, 0.65);
  }
  100% {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(22, 163, 74, 0.5);
    box-shadow:
      0 0 0 3px #16a34a,
      0 0 14px rgba(22, 163, 74, 0.55);
  }
}

/* Attente 0,5 s sur la pastille avant validation */
.tabToolDiagram .chordDiagram__cell.is-gesture-dwell-wait {
  z-index: 5;
  background: conic-gradient(
      #16a34a calc(var(--gesture-dwell, 0) * 360deg),
      rgba(37, 99, 235, 0.18) 0
    ) !important;
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.tabToolDiagram .chordDiagram__cell.is-gesture-hover {
  z-index: 4;
}

.tabToolDiagram.is-neck-dragging .chordDiagram__cell {
  cursor: grabbing;
}

.tabToolDiagram.is-neck-dragging .chordDiagram__cell:hover:not(.is-gesture-validated) {
  background: rgba(37, 99, 235, 0.12);
}

.tabToolDiagram.is-neck-dragging .chordDiagram__cell.is-gesture-validated:hover {
  background: rgba(22, 163, 74, 0.5) !important;
}

.tabStaff__cells {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  border-left: 2px solid #1a1f2e;
  padding: 0.22rem 0 0.1rem 0.35rem;
  position: relative;
}

.tabStaff__links {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.tabStaff__linkPath {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.tabStaff__linkPath--slide {
  stroke: #1d4ed8;
  stroke-width: 2;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6));
}

.tabStaff__linkPath--hammer {
  stroke: #047857;
  stroke-width: 1.85;
  stroke-dasharray: none;
}

.tabStaff__linkPath--pull {
  stroke: #c2410c;
  stroke-width: 1.85;
}

.tabStaff__linkPath--slur {
  stroke: #1d4ed8;
  stroke-width: 2.25;
  stroke-dasharray: 6 3;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6));
}

.tabStaff__linkLabelBg--slur {
  fill: rgba(239, 246, 255, 0.95);
}

.tabStaff__linkLabel--slur {
  fill: #1e3a8a;
}

.tabStaff__linkLabelBg {
  stroke: none;
}

.tabStaff__linkLabelBg--slide {
  fill: rgba(239, 246, 255, 0.95);
}

.tabStaff__linkLabelBg--hammer {
  fill: rgba(236, 253, 245, 0.95);
}

.tabStaff__linkLabelBg--pull {
  fill: rgba(255, 247, 237, 0.95);
}

.tabStaff__linkLabel {
  font-size: 8.5px;
  font-weight: 800;
  font-family: "DM Sans", system-ui, sans-serif;
  letter-spacing: 0.02em;
}

.tabStaff__linkLabel--slide {
  fill: #1e3a8a;
}

.tabStaff__linkLabel--hammer {
  fill: #065f46;
}

.tabStaff__linkLabel--pull {
  fill: #9a3412;
}

.tabStaff__label {
  flex: 0 0 var(--tab-string-label-w);
  width: var(--tab-string-label-w);
  font-weight: 700;
  color: #374151;
  user-select: none;
}

.workshopTabTool.workshopTabTool--neck-horizontal {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workshopTabTool__staffWrap {
  flex: 1 1 auto;
  min-height: 8rem;
  display: flex;
  flex-direction: column;
  border: 1px solid #c8d2e2;
  border-radius: 12px;
  background: #fffefb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.workshopTabTool__staffHead {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid #e8ecf4;
}

.workshopTabTool__staffHeading {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--da-ink-muted, #5c6578);
  border-bottom: none;
}

.workshopTabTool__exportBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.workshopTabTool__exportBar .diagramExportBar__btn.followingGhostBtn {
  min-height: 26px;
}

.workshopTabTool__staffMount {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: var(--tab-staff-mount-min-h);
  overflow: hidden;
  padding: 0.65rem 0.75rem;
  box-sizing: border-box;
}

.workshopTabTool__staffMount > .tabStaff,
.workshopTabTool__staffMount > .tabStaff.tabStaff--editable {
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* ——— Tab staff ——— */

.tabStaff__empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--da-ink-muted, #5c6578);
  font-style: italic;
}

.tabStaff__viewport {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tabStaff__viewport > .tabStaff__table {
  flex: 0 0 auto;
}

.tabStaff__table {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.95rem;
  line-height: 1.12;
  color: #1a1f2e;
}

.tabStaff__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: visible;
}


.tabStaff__cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35ch;
  padding: 0 0.2ch;
  color: #6b7280;
  box-sizing: content-box;
}

.tabStaff__cell--fret {
  font-weight: 700;
  color: #111827;
}

.tabStaff__cell.is-cursor {
  background: rgba(37, 99, 235, 0.1);
  border-radius: 3px;
}

.tabStaff__cell.is-stack-col {
  background: rgba(37, 99, 235, 0.05);
}

.tabStaff__cell.is-stack-note {
  background: rgba(37, 99, 235, 0.2);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.35);
  font-weight: 800;
}

.tabStaff__cell.is-stack-col:not(.is-stack-note) {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.tabStaff__cell.is-link-pick {
  background: rgba(124, 58, 237, 0.22);
  box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.55);
  border-radius: 4px;
  font-weight: 800;
}

.workshopTabTool__historyStatus {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--da-ink-muted, #5c6578);
}

.workshopTabTool__toolbar .followingGhostBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.workshopTabTool__toolbar .followingGhostBtn[hidden] {
  display: none;
}

.tabStaff--editable .tabStaff__cell {
  cursor: pointer;
  border: none;
  border-radius: 4px;
  font: inherit;
  background: transparent;
  transition: background 0.12s ease;
}

.tabStaff--editable .tabStaff__cell:hover {
  background: rgba(37, 99, 235, 0.08);
}

.tabStaff--editable .tabStaff__cell--fret:hover {
  background: rgba(37, 99, 235, 0.14);
}

.tabStaff--editable .tabStaff__cell:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.tabStaff__cellInput {
  width: 2ch;
  min-width: 1.5em;
  max-width: 2.5em;
  padding: 0.1em 0.15em;
  margin: 0;
  border: 2px solid #2563eb;
  border-radius: 4px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  color: #111827;
  background: #fff;
  box-sizing: content-box;
}

@media (max-width: 768px) {
  .workshopPanel--tab.is-open .workshopPanel__inner--tab {
    padding: 0.55rem 0.65rem 1rem;
  }

  .tabToolDiagram {
    --fret-gap: 22px;
    --string-gap: 24px;
    --tab-neck-slot-w: 280px;
  }

  .workshopTabTool__rotateHost {
    height: calc((var(--strings) - 1) * var(--string-gap) + 6.25rem);
  }

  .tabStaff__table {
    font-size: 0.92rem;
  }
}
