/* ==========================================================================
   Solfa Grid Engine - Alinhamento Vertical Estrito para SATB + Letra
   ========================================================================== */

/* Container de Toda a Partitura */
.solfa-score-container {
  display: flex;
  flex-direction: column;
  gap: var(--system-spacing, 16px);
  width: 100%;
}

/* Um Sistema de Pauta (Linha da Partitura) */
.solfa-system {
  display: flex;
  align-items: stretch;
  background-color: transparent;
  border-radius: var(--radius-sm);
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  padding-bottom: 8px;
  box-sizing: border-box;
}

/* Coluna de Rótulos das Vozes (Lado Esquerdo) */
.voice-labels-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 60px;
  max-width: 70px;
  padding-right: 8px;
  border-right: 2px solid var(--bar-line-color);
  user-select: none;
  flex-shrink: 0;
  margin-top: 24px; /* Espaço alinhado com o topo do compasso (abaixo do número) */
}

.voice-label-cell {
  height: var(--solfa-row-height, 30px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--ink-color);
  border-bottom: none;
}

.voice-label-cell.label-soprano { color: var(--accent-soprano); }
.voice-label-cell.label-alto    { color: var(--accent-alto); }
.voice-label-cell.label-tenor   { color: var(--accent-tenor); }
.voice-label-cell.label-bass    { color: var(--accent-bass); }
.voice-label-cell.label-lyrics  {
  height: var(--lyrics-row-height, 22px);
  color: var(--accent-lyrics);
  font-style: var(--lyrics-font-style, italic);
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.75;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}
.voice-label-cell.label-lyrics-b {
  border-bottom: none;
}

.btn-add-system-lyrics {
  opacity: 0;
  margin-left: 4px;
  padding: 1px 4px;
  font-size: 0.65rem;
  font-family: var(--font-sans, sans-serif);
  font-weight: 700;
  background: var(--bg-surface-elevated, #f1f5f9);
  color: var(--text-muted, #64748b);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.voice-label-cell:hover .btn-add-system-lyrics {
  opacity: 1;
}

.btn-add-system-lyrics:hover {
  background: var(--primary, #4f46e5);
  color: #ffffff;
  border-color: var(--primary, #4f46e5);
}

.btn-hide-system-lyrics {
  opacity: 0;
  margin-left: auto;
  padding: 0 4px;
  font-size: 0.85rem;
  line-height: 1;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  border: none;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.voice-label-cell:hover .btn-hide-system-lyrics {
  opacity: 1;
}

.btn-hide-system-lyrics:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Container de Compassos do Sistema */
.solfa-measures-row {
  display: flex;
  align-items: flex-start;
  flex: 1 1 auto;
  width: calc(100% - 68px);
  min-width: 0;
  gap: 0;
  box-sizing: border-box;
}

/* Um Compasso Individual (Comprime suavemente para caber na largura da folha A4) */
.solfa-measure {
  display: flex;
  flex-direction: column;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  box-sizing: border-box;
  transition: background-color var(--transition-fast);
}

.solfa-measure:hover .measure-toolbar {
  opacity: 1;
}

/* Cabeçalho do Compasso (Número e Ações) */
.measure-header {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 0;
}

.measure-number {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-dimmed);
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

.measure-toolbar {
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.measure-btn-mini {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-radius: 3px;
}

.measure-btn-mini:hover {
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
}

.measure-btn-mini.btn-system-break.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 700;
}

/* Indicador visual de Quebra de Sistema Ativa no Compasso */
.system-break-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
  background-color: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 3px;
  padding: 1px 6px;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.system-break-indicator:hover {
  background-color: var(--primary);
  color: #ffffff;
}

/* Corpo Principal do Compasso (Vozes e Pulsos) */
.measure-grid {
  display: flex;
  align-items: stretch;
  background-color: rgba(255, 255, 255, 0.3);
  position: relative;
}

.solfa-measure:first-child .measure-grid {
  border-left: 2px solid var(--bar-line-color);
}

/* Barra de Compasso (Linhas e Repetições) */
.measure-barline {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  padding: 0 1px;
  gap: 3px;
  z-index: 5;
  transition: background-color 0.15s ease;
  min-width: 6px;
  flex-shrink: 0;
}

.measure-barline:hover {
  background-color: var(--primary-light);
  border-radius: 2px;
}

.measure-barline .bar-stroke {
  display: block;
  height: 100%;
  border-radius: 1px;
}

.measure-barline .stroke-thin {
  width: 2px;
  background-color: var(--bar-line-color);
}

.measure-barline .stroke-thick {
  width: 5px;
  background-color: var(--bar-line-color);
}

.measure-barline .stroke-dashed {
  width: 2px;
  border-right: 2px dashed var(--bar-line-color);
}

.measure-barline .stroke-hidden {
  width: 4px;
  background-color: transparent;
}

/* Pontos de Repetição (Ritornelo) */
.measure-barline .bar-dots {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  padding: 12px 1px;
}

.measure-barline .bar-dots .dot {
  width: 4.5px;
  height: 4.5px;
  background-color: var(--bar-line-color);
  border-radius: 50%;
}

/* Destaque quando o compasso possui quebra de sistema */
.solfa-measure.has-system-break .measure-barline .bar-stroke {
  background-color: var(--primary);
}
.solfa-measure.has-system-break .measure-barline .bar-dots .dot {
  background-color: var(--primary);
}

/* Camada SVG de Ligaduras (Slurs & Ties) */
.solfa-system {
  position: relative;
}

.system-slurs-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 12;
}

.solfa-slur-underline,
.solfa-slur-curve {
  stroke: var(--ink-color);
  stroke-width: 2.2px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: pointer;
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
}

.solfa-slur-underline:hover,
.solfa-slur-curve:hover {
  stroke: var(--primary);
  stroke-width: 3.6px;
  filter: drop-shadow(0 0 4px var(--primary-glow));
}

.solfa-slur-underline.tie,
.solfa-slur-curve.tie {
  stroke-dasharray: 4 2;
}

.solfa-slur-underline.partial-slur,
.solfa-slur-curve.partial-slur {
  stroke-dasharray: 6 2;
  opacity: 0.95;
}

/* Subdivisão Ativa Focada na Célula (Colcheia/Semicolcheia) - Cursor Limpo e Discreto */
.note-part.active-subnote {
  background: transparent !important;
  border-radius: 0;
  box-shadow: none !important;
  border: none !important;
  position: relative;
  padding: 0 1px;
}

.note-part.active-subnote::after {
  content: '';
  position: absolute;
  top: 10%;
  bottom: 10%;
  right: -2px;
  width: 2px;
  background-color: var(--primary, #4f46e5);
  animation: solfaCursorBlink 0.9s step-end infinite;
  pointer-events: none;
  border-radius: 1px;
}

.note-part.active-subnote:has(.cell-inline-input)::after {
  display: none !important;
}

/* Coluna de Pulso (Beat) - ALINHAMENTO VERTICAL SINCRONIZADO & LARGURA PROPORCIONAL DINÂMICA */
.solfa-beat-col {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  transition: flex var(--transition-fast), min-width var(--transition-fast), background-color 0.1s ease;
}

/* Densidade 0: Pulso Vazio (Encolhe quando não há notas para dar espaço aos pulsos ativos) */
.solfa-beat-col.density-0 {
  flex: 0.6 1 0;
  min-width: 12px;
}

/* Densidade 1: Pulso Simples (1 nota ou traço inteiro - semínima) */
.solfa-beat-col.density-1 {
  flex: 1.0 1 0;
  min-width: 18px;
}

/* Densidade 2: Pulso Subdividido em 2 partes (colcheias, ex: d.r, -.r, .d, .,d) */
.solfa-beat-col.density-2 {
  flex: 1.6 1 0;
  min-width: 26px;
}

/* Densidade 3: Pulso com 3 subdivisões (tercinas ou pontuadas, ex: d;r;m, d.r,m) */
.solfa-beat-col.density-3 {
  flex: 2.2 1 0;
  min-width: 36px;
}

/* Densidade 4: Pulso com 4 subdivisões (4 semicolcheias, ex: d,r.m,f) */
.solfa-beat-col.density-4 {
  flex: 2.9 1 0;
  min-width: 48px;
}

/* Destaque do Pulso durante Playback */
.solfa-beat-col.active-playback {
  background-color: rgba(99, 102, 241, 0.18) !important;
  border-radius: 4px;
}

/* Divisor de Tempo / Pulso (Dois Pontos ':') */
.pulse-divider-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 10px;
  user-select: none;
  align-items: center;
  flex-shrink: 0;
}

.pulse-divider-dot {
  height: var(--solfa-row-height, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--solfa-font-family, var(--font-music));
  font-size: calc(var(--solfa-font-size, 1.25rem) * 1.05);
  font-weight: 700;
  color: var(--bar-line-color);
  line-height: 1;
}

.pulse-divider-dot.dot-lyrics {
  height: var(--lyrics-row-height, 22px);
  visibility: hidden; /* Não exibe dois-pontos nem barra na linha de letra */
}

/* Meia Barra de Compasso (barra pequena na metade do compasso em 4/4, 6/8, etc.) */
.pulse-divider-col.is-half-bar {
  width: 10px;
}

.pulse-divider-dot.dot-half-bar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-divider-dot.dot-half-bar .half-bar-stroke {
  display: block;
  width: 1.5px;
  height: calc(var(--solfa-row-height, 30px) * 0.72);
  min-height: 18px;
  max-height: 24px;
  background-color: var(--bar-line-color, #1e293b);
  border-radius: 0.5px;
}

/* Célula de Nota ou Letra */
.solfa-cell {
  height: var(--solfa-row-height, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px 4px;
  font-family: var(--solfa-font-family, var(--font-music));
  font-size: var(--solfa-font-size, 1.25rem);
  font-weight: var(--solfa-font-weight, 600);
  color: var(--ink-color);
  text-align: center;
  cursor: pointer;
  position: relative;
  border-bottom: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.solfa-cell:hover {
  background-color: transparent;
}

/* Animação do Cursor Piscante Limpo (Padrão Sibelius / MuseScore) */
@keyframes solfaCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Célula Ativa / Selecionada: Totalmente Limpa (Sem Borda e Sem Fundo) */
.solfa-cell.selected {
  background-color: transparent !important;
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  z-index: 10;
}

/* Cursor Limpo e Discreto Quando a Célula Está Vazia ou Não Tem Subdivisão Ativa */
.solfa-cell.selected:not(.has-active-sub)::after {
  content: '';
  position: absolute;
  top: 18%;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background-color: var(--primary, #4f46e5);
  animation: solfaCursorBlink 0.9s step-end infinite;
  pointer-events: none;
  border-radius: 1px;
}

.solfa-cell.selected:has(.cell-inline-input)::after {
  display: none !important;
}

/* Célula de Letra (Lyrics) */
.solfa-cell.cell-lyrics {
  height: var(--lyrics-row-height, 22px);
  font-family: var(--lyrics-font-family, var(--font-music));
  font-size: var(--lyrics-font-size, 0.95rem);
  font-style: var(--lyrics-font-style, italic);
  font-weight: var(--lyrics-font-weight, 400);
  color: var(--ink-color);
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.solfa-cell.cell-lyrics-b {
  border-bottom: none;
}

/* Subcélula de Letra (Sílaba individual alinhada à respectiva nota) */
.lyric-subcell {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 0 1px;
  box-sizing: border-box;
  cursor: text;
  border-radius: 2px;
  white-space: nowrap;
  position: relative;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.lyric-subcell.single-syl {
  width: 100%;
}

.lyric-subcell.empty-subcell {
  min-height: 16px;
}

.lyric-subcell:hover {
  background-color: transparent;
}

/* Subcélula de Letra Ativa - Apenas Cursor Limpo, Sem Borda e Sem Fundo */
.lyric-subcell.active-sublyric {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  position: relative;
}

.lyric-subcell.active-sublyric::after {
  content: '';
  position: absolute;
  top: 15%;
  bottom: 15%;
  right: -1px;
  width: 1.5px;
  background-color: var(--primary, #4f46e5);
  animation: solfaCursorBlink 0.9s step-end infinite;
  pointer-events: none;
  border-radius: 1px;
}

.lyric-subcell.active-sublyric.empty-subcell::after {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.lyric-subcell.active-sublyric:has(.cell-inline-input)::after {
  display: none !important;
}

.lyric-subcell.lyric-rest,
.lyric-subcell.lyric-placeholder {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

/* Espaçador de Separador na Linha de Letra (espelha exatamente o note-sep da nota) */
.lyric-subcell-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  line-height: 1;
  flex: 0 0 auto;
  visibility: hidden;
  pointer-events: none;
}

.cell-inline-input.input-lyrics {
  font-family: var(--lyrics-font-family, var(--font-music));
  font-size: var(--lyrics-font-size, 0.95rem);
  font-style: var(--lyrics-font-style, italic);
  font-weight: 500;
  caret-color: var(--primary, #4f46e5);
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.lyric-subcell .cell-inline-input.input-lyrics {
  width: 100%;
  height: 100%;
  border: none !important;
  border-radius: 0;
  padding: 0 1px;
  box-sizing: border-box;
  background: transparent !important;
  box-shadow: none !important;
}

/* Renderização Musical Específica (Oitavas, Partes e Subdivisões) */
.note-part {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
}

.note-char {
  display: inline-block;
  position: relative;
  font-family: var(--font-music);
  font-weight: 700;
  color: var(--ink-color);
}

/* Oitava Superior (d') - Elevado nitidamente acima da altura da nota */
.oct-high {
  display: inline-block;
  font-size: 0.78em;
  position: relative;
  top: -0.44em;
  margin-left: 0.5px;
  color: var(--primary);
  font-weight: 800;
  line-height: 0.6;
}

/* Oitava Inferior (s|) - Pequena barrinha vertical grudada à nota (Padrão Sibelius) */
.oct-low {
  display: inline-block;
  position: relative;
  top: 3px;
  width: 1.8px;
  height: 0.26em;
  background-color: var(--primary);
  vertical-align: -0.15em;
  margin-left: 0.8px;
  border-radius: 0.3px;
  line-height: 1;
}

/* Separadores Rítmicos Dentro do Pulso */
.note-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-family: var(--font-music);
  line-height: 1;
}

/* Ponto de meio-tempo '.' */
.note-sep.note-dot {
  margin: 0 4px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink-dimmed);
}

/* Ponto e vírgula pontuado '.,' (3/4 + 1/4) */
.note-sep.note-dotcomma {
  margin: 0 4px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--ink-dimmed);
}

/* Vírgula e ponto scotch snap ',.' (1/4 + 3/4) */
.note-sep.note-commadot {
  margin: 0 4px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--ink-dimmed);
}

/* Vírgula de semicolcheia ',' (1/4 de pulso) */
.note-sep.note-comma {
  margin: 0 3px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink-dimmed);
}

/* Nota Prolongada / Traço de Sustentação (Dash) */
.note-dash {
  display: inline-block;
  font-weight: 700;
  color: var(--ink-color);
  user-select: none;
  line-height: 1;
}

/* Traço de tempo inteiro (ocupa o pulso todo de forma ampla) */
.note-dash.note-dash-full {
  min-width: 24px;
  letter-spacing: 3px;
  font-size: 1.15em;
  text-align: center;
}

/* Traço proporcional para tempo subdividido (mais curto para harmonia visual) */
.note-dash.note-dash-sub {
  width: 12px;
  max-width: 14px;
  letter-spacing: normal;
  text-align: center;
  font-size: 0.95em;
  vertical-align: middle;
}

/* Espaçador de Parte Muda / Pausa no Início ou Meio do Pulso (ex: .d, .,d, ,.d) */
.note-part.note-rest {
  display: inline-block;
  user-select: none;
  pointer-events: none;
  line-height: 1;
}

.note-part.note-rest-half {
  min-width: 14px;
  width: 14px;
}

.note-part.note-rest-dotted {
  min-width: 22px;
  width: 22px;
}

.note-part.note-rest-quarter {
  min-width: 10px;
  width: 10px;
}

.note-part.note-placeholder {
  min-width: 12px;
  width: 12px;
  display: inline-block;
}

/* Input de Edição Direta Inline (Duplo Clique) - Limpo, Sem Borda e Sem Fundo */
.cell-inline-input {
  width: 100%;
  height: 100%;
  border: none !important;
  outline: none !important;
  background-color: transparent !important;
  color: var(--ink-color, #0f172a);
  font-family: var(--font-music);
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  box-shadow: none !important;
  caret-color: var(--primary, #4f46e5);
  z-index: 25;
  padding: 0;
  margin: 0;
}

/* Botão Flutuante de Adicionar Compasso ao Final */
.add-measure-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  margin-top: 24px;
  background-color: transparent;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: 8px;
}

.add-measure-trigger:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Linha Divisória de Vozes para Melhor Leitura */
.voice-row-border {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* =========================================================================
   Linhas de Volta (1ª Volta, 2ª Volta / Prima & Seconda Volta)
   ========================================================================= */
.solfa-system.has-volta {
  margin-top: 18px;
}

.solfa-system.has-volta .voice-labels-col {
  margin-top: 38px;
}

.solfa-system.has-volta .measure-header {
  padding-top: 14px;
  height: 38px;
}

.measure-volta-bracket {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  border-top: 2.5px solid var(--volta-bracket-color, #0f172a);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 4px;
  z-index: 10;
  pointer-events: auto;
  box-sizing: border-box;
}

.measure-volta-bracket.volta-start {
  border-left: 2.5px solid var(--volta-bracket-color, #0f172a);
}

.measure-volta-bracket.volta-end {
  border-right: 2.5px solid var(--volta-bracket-color, #0f172a);
}

.measure-volta-bracket .volta-number {
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--volta-bracket-color, #0f172a);
  background: var(--paper-bg, #ffffff);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  padding: 1px 5px;
  margin-top: 2px;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.measure-volta-bracket .volta-del-btn {
  background: var(--paper-bg, #ffffff);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 2px;
  color: var(--danger, #ef4444);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  padding: 0 4px;
  margin-top: 2px;
}

.measure-volta-bracket:hover .volta-del-btn {
  opacity: 1;
}

.measure-volta-bracket .volta-del-btn:hover {
  background: var(--danger, #ef4444);
  color: #ffffff;
}

/* =========================================================================
   Sinais de Repetição no Cabeçalho do Compasso (Fine, D.C., D.S., Segno, Coda)
   Totalmente Arrastáveis com o Mouse / Touch
   ========================================================================= */
.measure-repeat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(79, 70, 229, 0.1);
  border: 1.5px solid rgba(79, 70, 229, 0.35);
  color: var(--ink-color, #0f172a);
  border-radius: 5px;
  padding: 2px 7px;
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1.1;
  cursor: grab;
  position: relative;
  z-index: 15;
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.measure-repeat-tag:hover {
  background: rgba(79, 70, 229, 0.18);
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.measure-repeat-tag.is-dragging {
  cursor: grabbing !important;
  z-index: 100 !important;
  background: var(--primary, #4f46e5) !important;
  border-color: var(--primary-dark, #3730a3) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4) !important;
  opacity: 0.95;
}

.measure-repeat-tag.is-dragging .marker-del-btn {
  color: #ffffff !important;
}

.measure-repeat-tag.tag-fine,
.measure-repeat-tag.tag-dc,
.measure-repeat-tag.tag-ds {
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
}

.measure-repeat-tag.tag-segno,
.measure-repeat-tag.tag-coda {
  font-size: 1.05rem;
  font-family: var(--font-music);
  line-height: 1;
}

.measure-repeat-tag .marker-del-btn {
  background: transparent;
  border: none;
  color: var(--danger, #ef4444);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.measure-repeat-tag:hover .marker-del-btn {
  opacity: 1;
}

.measure-repeat-tag .marker-del-btn:hover {
  color: #b91c1c;
}

/* =========================================================================
   Sinais de Articulação sobre a Nota (Fermata 𝄐, Acento >, Marcato ^, etc.)
   ========================================================================= */
.note-part {
  position: relative;
}

.note-articulation {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-music, 'Times New Roman', serif);
  font-size: 1.15rem;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  color: var(--ink-color, #0f172a);
  z-index: 4;
}

.note-articulation.art-staccato {
  top: -8px;
  font-size: 1.05rem;
}

.note-articulation.art-staccatissimo {
  top: -11px;
  font-size: 0.8rem;
}

.note-articulation.art-accent,
.note-articulation.art-marcato,
.note-articulation.art-tenuto {
  top: -11px;
  font-weight: 700;
  font-size: 0.95rem;
}

.note-articulation.art-breath {
  top: -12px;
  right: -5px;
  left: auto;
  transform: none;
  font-size: 1.15rem;
}

.note-articulation.art-caesura {
  top: -12px;
  right: -7px;
  left: auto;
  transform: none;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: -0.1em;
}

/* =========================================================================
   Tags de Dinâmica Musical e Textos Livres no Pulso (Arrastáveis)
   ========================================================================= */
.beat-dynamic-tag {
  position: absolute;
  top: -20px;
  left: 2px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--ink-color, #0f172a);
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1;
  cursor: grab;
  z-index: 14;
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.beat-dynamic-tag:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: #d97706;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.beat-dynamic-tag.is-dragging {
  cursor: grabbing !important;
  z-index: 100 !important;
  background: #f59e0b !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
}

.beat-dynamic-tag.is-dragging .dynamic-del-btn,
.beat-dynamic-tag.is-dragging .dynamic-symbol {
  color: #ffffff !important;
}

.beat-dynamic-tag .dynamic-symbol {
  font-family: 'Times New Roman', Georgia, serif;
  font-style: italic;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.beat-dynamic-tag .dynamic-del-btn {
  background: transparent;
  border: none;
  color: var(--danger, #ef4444);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 1px;
  line-height: 1;
  opacity: 0.6;
}

.beat-dynamic-tag:hover .dynamic-del-btn {
  opacity: 1;
}

.beat-text-tag {
  position: absolute;
  top: -38px;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--ink-color, #0f172a);
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.1;
  cursor: grab;
  z-index: 14;
  user-select: none;
  touch-action: none;
  white-space: nowrap;
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.beat-text-tag:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: #059669;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.beat-text-tag.is-dragging {
  cursor: grabbing !important;
  z-index: 100 !important;
  background: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.beat-text-tag.is-dragging .text-del-btn,
.beat-text-tag.is-dragging .text-content {
  color: #ffffff !important;
}

.beat-text-tag .text-content {
  font-family: 'Times New Roman', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.beat-text-tag .text-del-btn {
  background: transparent;
  border: none;
  color: var(--danger, #ef4444);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 1px;
  line-height: 1;
  opacity: 0.6;
}

.beat-text-tag:hover .text-del-btn {
  opacity: 1;
}
