/* ================================================================
   Cleffing — Design System & Layout
   Tema: Dark premium · Acento violeta + ciano
   ================================================================ */

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  /* Cores */
  --bg-base:    #080b14;
  --bg-surface: #0f1624;
  --bg-raised:  #162032;
  --bg-input:   #1b2540;
  --border:     rgba(255,255,255,0.07);
  --border-md:  rgba(255,255,255,0.12);

  --accent:       #7c3aed;
  --accent-light: #a78bfa;
  --accent-glow:  rgba(124,58,237,0.35);
  --cyan:         #06b6d4;
  --cyan-light:   #22d3ee;
  --cyan-glow:    rgba(6,182,212,0.35);

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-score:     #1e293b;

  --score-bg: #f8f9fb;

  /* Notas iluminadas — mão direita (violeta) / mão esquerda (ciano) */
  --key-right: #8b5cf6;
  --key-left:  #22d3ee;

  /* Piano */
  --piano-white: #f0ede8;
  --piano-black: #0f1624;

  /* Dimensões */
  --header-h:     52px;
  --panel-w:      300px;
  --piano-h:      150px;
  --panel-radius: 12px;

  /* Tipos */
  --font: 'Inter', system-ui, sans-serif;
  --font-size-sm: 0.75rem;
  --font-size-base: 0.875rem;
  --font-size-lg: 1rem;

  /* Transições */
  --transition: 0.18s ease;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: var(--font);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-base);
  height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--piano-h);
  grid-template-areas:
    "header"
    "main"
    "piano";
}

/* ── Scrollbars ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Header ────────────────────────────────────────────────────── */
#header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.logo-clef {
  font-size: 1.8rem;
  line-height: 1;
  color: var(--accent-light);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #c4b5fd, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title {
  flex: 1;
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.header-actions { flex-shrink: 0; }

/* ── Main Layout ───────────────────────────────────────────────── */
#main {
  grid-area: main;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  overflow: hidden;
}

/* ── Score Section ──────────────────────────────────────────────── */
#score-section {
  position: relative;
  overflow: hidden;
  background: var(--bg-base);
}

#score-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  padding: 0;
  margin: 0;
  background: var(--score-bg);
  color: var(--text-score);
}

/* Garante alinhamento e visibilidade perfeita do cursor sobre as pautas */
#score-container img[id^="cursorImg"] {
  position: absolute !important;
  z-index: 10 !important;
  pointer-events: none !important;
  mix-blend-mode: multiply !important;
  opacity: 0.65 !important;
}

/* ── Interatividade e Navegação na Partitura ────────────────────── */
#score-container.score-interactive {
  cursor: pointer;
}

#score-container.score-interactive .vf-measure {
  cursor: pointer;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

#score-container.score-interactive .vf-measure:hover {
  filter: drop-shadow(0 0 5px rgba(124, 58, 237, 0.45));
}

#score-container.score-interactive .vf-stavenote {
  cursor: pointer;
  transition: filter 0.15s ease;
}

#score-container.score-interactive .vf-stavenote:hover {
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.75));
}

#score-container .staffline {
  transition: opacity 0.25s ease, filter 0.25s ease;
}

#score-container .staffline.staffline-muted {
  opacity: 0.32;
  filter: grayscale(40%);
}

#score-container .staffline.staffline-active {
  opacity: 1;
}

/* ── Drop Zone ──────────────────────────────────────────────────── */
#drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  cursor: pointer;
  transition: background var(--transition);
}

#drop-zone:hover,
#drop-zone.dragover {
  background: rgba(124, 58, 237, 0.08);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-base));
}

#drop-zone:hover .drop-zone-inner {
  border-color: rgba(167, 139, 250, 0.35);
}

#drop-zone.dragover .drop-zone-inner {
  transform: scale(1.02);
  border-color: var(--accent-light);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 4rem;
  border: 2px dashed var(--border-md);
  border-radius: 20px;
  text-align: center;
  transition: transform var(--transition), border-color var(--transition);
  user-select: none;
}

.drop-icon { font-size: 4rem; filter: drop-shadow(0 0 20px rgba(167,139,250,0.4)); }

.drop-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-sub {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
}

.tag {
  display: inline-block;
  font-family: monospace;
  font-size: 0.7rem;
  background: var(--bg-raised);
  color: var(--accent-light);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-md);
}

/* ── Overlay ────────────────────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,11,20,0.85);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 3rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--panel-radius);
}

.overlay-title { font-weight: 600; font-size: 1rem; }
.overlay-sub   { color: var(--text-secondary); font-size: var(--font-size-sm); }

/* Spinner */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-md);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Barra de progresso da conversão */
.progress-track {
  width: 220px;
  height: 4px;
  background: var(--bg-raised);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ── Error Toast ────────────────────────────────────────────────── */
.error-toast {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: #2d0a0a;
  border: 1px solid #7f1d1d;
  border-radius: 10px;
  color: #fca5a5;
  font-size: var(--font-size-sm);
  z-index: 30;
  max-width: 90%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slide-up 0.2s ease;
}
@keyframes slide-up { from { opacity:0; transform: translateX(-50%) translateY(10px); } }

.error-icon { font-size: 1rem; flex-shrink: 0; }

/* ── Settings Panel ─────────────────────────────────────────────── */
#settings-panel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 0;
}

.panel-block {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.panel-separator {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* ── Transport ──────────────────────────────────────────────────── */
.transport-block { padding-bottom: 0.75rem; }

.transport-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.transport-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-md);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform 0.1s;
}

.transport-btn:hover:not(:disabled) {
  background: var(--bg-input);
  color: var(--text-primary);
}

.transport-btn:active:not(:disabled) { transform: scale(0.93); }
.transport-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.transport-btn--play {
  width: 56px; height: 56px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.transport-btn--play:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent-light);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Scrubber */
.scrubber-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.25rem;
}

.time-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 2.4rem;
}

.scrubber {
  flex: 1;
  position: relative;
  height: 4px;
  background: var(--bg-raised);
  border-radius: 2px;
  cursor: pointer;
}

.scrubber-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.scrubber-thumb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  width: 12px; height: 12px;
  background: var(--accent-light);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-glow);
  left: 0%;
  transition: left 0.1s linear;
  pointer-events: none;
}

.scrubber:hover .scrubber-thumb { width: 14px; height: 14px; }

/* ── Controls ───────────────────────────────────────────────────── */
.ctrl-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ctrl-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ctrl-value {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
}

/* ── Tom da Música ──────────────────────────────────────────────── */
.key-info-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-main-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.key-badge-circle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.key-main-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.key-primary-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.key-secondary-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.key-details-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.key-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.75rem;
  gap: 8px;
}

.key-detail-label {
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.key-detail-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.key-detail-value.highlight-accent {
  color: var(--accent-light);
}

/* ── Stepper Controls (BPM, Transposition, Measure Navigation) ────── */
.bpm-control-row,
.transpose-control-row,
.measure-control-row,
.stepper-control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.5rem 0;
}

.bpm-step-btn,
.transpose-step-btn,
.measure-step-btn,
.stepper-step-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 8px;
  flex-shrink: 0;
  line-height: 1;
}

.bpm-input-wrap,
.transpose-input-wrap,
.measure-input-wrap,
.stepper-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.bpm-number-input,
.transpose-number-input,
.measure-number-input,
.stepper-number-input {
  width: 100%;
  height: 34px;
  padding: 0 2.2rem 0 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  text-align: center;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.measure-number-input {
  padding-right: 3rem;
}

.bpm-number-input:focus,
.transpose-number-input:focus,
.measure-number-input:focus,
.stepper-number-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.bpm-number-input::-webkit-inner-spin-button,
.bpm-number-input::-webkit-outer-spin-button,
.transpose-number-input::-webkit-inner-spin-button,
.transpose-number-input::-webkit-outer-spin-button,
.measure-number-input::-webkit-inner-spin-button,
.measure-number-input::-webkit-outer-spin-button,
.stepper-number-input::-webkit-inner-spin-button,
.stepper-number-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bpm-number-input,
.transpose-number-input,
.measure-number-input,
.stepper-number-input {
  -moz-appearance: textfield;
}

.bpm-suffix,
.transpose-suffix,
.measure-suffix,
.stepper-suffix {
  position: absolute;
  right: 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  letter-spacing: 0.05em;
}

/* ── Slider ─────────────────────────────────────────────────────── */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-raised);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--accent-light);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: transform 0.1s, box-shadow 0.1s;
}

.slider:hover::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 0 14px var(--accent-glow);
}

.slider::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--accent-light);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 0 2px;
}

/* ── Select ─────────────────────────────────────────────────────── */
.select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  transition: border-color var(--transition);
}

.select:hover { border-color: var(--accent); }
.select:focus { border-color: var(--accent-light); box-shadow: 0 0 0 2px var(--accent-glow); }
.select option { background: var(--bg-input); }

/* ── SF2 ────────────────────────────────────────────────────────── */
.sf2-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sf2-filename {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf2-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.sf2-track {
  flex: 1;
  height: 3px;
  background: var(--bg-raised);
  border-radius: 2px;
  overflow: hidden;
}

.sf2-fill {
  height: 100%;
  background: var(--cyan);
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s;
}

.sf2-status { font-size: var(--font-size-sm); }
.sf2-ok { color: #4ade80; }

/* ── Info Block ─────────────────────────────────────────────────── */
.info-line { font-size: var(--font-size-sm); line-height: 1.5; }
.info-title { font-weight: 600; color: var(--text-primary); }
.info-sub   { color: var(--text-secondary); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-family: var(--font);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s, box-shadow var(--transition);
  text-decoration: none;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-light); box-shadow: 0 0 16px var(--accent-glow); }

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-md);
}
.btn-secondary:hover { background: var(--bg-input); border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-raised); color: var(--text-primary); }

.btn-sm { padding: 0.35rem 0.85rem; font-size: var(--font-size-sm); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.btn-icon:hover { color: var(--text-primary); }

/* ── Legenda das Mãos ────────────────────────────────────────────── */
.hands-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-input);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.hand-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
}

button.clef-btn {
  background: transparent;
  border: 1px solid transparent;
  width: 100%;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: inherit;
  color: inherit;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

button.clef-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

button.clef-btn.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.25);
}

button.clef-btn.muted {
  opacity: 0.55;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.28);
}

button.clef-btn.muted:hover {
  opacity: 0.8;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}

.clef-btn-badge {
  font-size: 0.6875rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 6px;
  letter-spacing: 0.02em;
}

.clef-btn-badge-muted {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.clef-btn-badge-solo {
  background: rgba(124, 58, 237, 0.25);
  color: #c4b5fd;
  border: 1px solid rgba(124, 58, 237, 0.45);
}

.dot-all {
  background: linear-gradient(135deg, #a855f7, #06b6d4);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.clef-hint {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.hand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-right {
  background: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.7);
}

.dot-left {
  background: #06b6d4;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.7);
}

.hand-name {
  font-weight: 500;
  color: var(--text-primary);
}

.hand-clef {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ── Piano Footer ───────────────────────────────────────────────── */
#piano-footer {
  grid-area: piano;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 100%;
  height: 100%;
}

.piano-topbar {
  display: none;
}

.piano-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.pill-right {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.pill-left {
  color: #22d3ee;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

#piano-wrap {
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

#piano-wrap::-webkit-scrollbar { display: none; }

#piano-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ── Switch Toggle & Normalização de Volume ─────────────────────── */
.toggle-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-bright);
  transition: 0.25s ease;
  border-radius: 24px;
  border: 1px solid var(--border);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

.switch input:checked + .switch-slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

.toggle-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ── Utility ────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Clef Context Menu (Botão Direito) ──────────────────────────── */
.clef-context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--bg-surface, #1e1e2e);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  min-width: 210px;
  max-width: 240px;
  padding: 4px 0;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary, #e2e8f0);
  overflow: hidden;
  user-select: none;
}

.clef-context-menu.hidden {
  display: none !important;
}

.clef-context-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  margin-bottom: 3px;
}

.clef-context-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #a855f7;
}

.clef-context-title {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-primary, #e2e8f0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clef-context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary, #e2e8f0);
  font-family: inherit;
  font-size: 0.8125rem;
  text-align: left;
  transition: background 0.1s ease;
}

.clef-context-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.clef-context-item.is-active {
  background: rgba(124, 58, 237, 0.12);
  color: #c4b5fd;
}

.clef-context-item.is-muted {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.clef-ctx-icon {
  font-size: 0.875rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.clef-ctx-label {
  flex: 1;
}

.clef-ctx-status {
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
}

.clef-ctx-status.is-active {
  color: #a78bfa;
}

.clef-ctx-status.is-muted {
  color: #f87171;
}

.clef-context-separator {
  height: 1px;
  background: var(--border, rgba(255,255,255,0.08));
  margin: 3px 0;
}

