/* ==========================================================================
   PartituraMaster - Design System & Modern UI Stylesheet
   ========================================================================== */

:root {
  --bg-dark: #080a10;
  --bg-card: rgba(17, 23, 39, 0.72);
  --bg-card-hover: rgba(26, 34, 56, 0.82);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;

  /* Cores de Destaque */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);

  /* Feedback */
  --color-success: #10b981;
  --color-success-glow: rgba(16, 185, 129, 0.4);
  --color-error: #f43f5e;
  --color-error-glow: rgba(244, 63, 94, 0.4);
  --color-warning: #f59e0b;

  /* Tipografia */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transições e Sombras */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 8px 30px rgba(99, 102, 241, 0.2);
  --shadow-card: 0 16px 40px -10px rgba(0, 0, 0, 0.6);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Fundo com gradiente e malha atmosférica */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 10%;
  width: 80vw;
  height: 80vh;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(6, 182, 212, 0.05) 50%, transparent 70%);
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: 5%;
  width: 70vw;
  height: 70vh;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.08) 0%, rgba(99, 102, 241, 0.04) 50%, transparent 70%);
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
}

/* ==========================================================================
   Header & Barra de Navegação
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(10, 14, 26, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Botões utilitários de cabeçalho */
.icon-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}

.icon-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.icon-btn.active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

/* ==========================================================================
   Área de Trabalho Principal e Menu Lateral de Configurações
   ========================================================================== */
.app-workspace {
  flex: 1;
  display: flex;
  align-items: flex-start;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  gap: 1.5rem;
}

.settings-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  position: sticky;
  top: 84px;
  transition: var(--transition);
}

.settings-sidebar.collapsed {
  display: none;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.sidebar-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.sidebar-close-btn {
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
}

.sidebar-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.sidebar-pills-vertical {
  grid-template-columns: 1fr !important;
  gap: 0.45rem !important;
}

.sidebar-pills-2col {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.45rem !important;
}

.sidebar-pills-4col {
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.35rem !important;
}

.sidebar-pills-4col .pill-option {
  padding: 0.4rem 0.2rem;
  font-size: 0.75rem;
}

.speed-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.speed-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent-primary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.speed-badge.cyan {
  background: var(--accent-cyan);
  box-shadow: 0 2px 8px var(--accent-cyan-glow);
}

.speed-range-slider {
  width: 100%;
  accent-color: var(--accent-primary);
  cursor: pointer;
  margin-top: 0.25rem;
}

.speed-range-slider.cyan {
  accent-color: var(--accent-cyan);
}

.auto-pace-controls {
  border-top: 1px solid var(--border-glass);
  margin-top: 0.5rem;
  padding-top: 0.35rem;
}

.sidebar-toggle-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.8rem !important;
}

.main-layout {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ==========================================================================
   Barra Superior de Status e Modos (Game Bar)
   ========================================================================== */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.25rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 1rem;
}

.mode-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-glass);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.stats-badges {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.streak-highlight {
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.lives-container {
  display: flex;
  gap: 4px;
  font-size: 1.2rem;
}

.heart {
  color: #f43f5e;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.heart.lost {
  color: var(--text-dim);
  opacity: 0.4;
  transform: scale(0.85);
}

/* ==========================================================================
   Card Central da Pauta Musical
   ========================================================================== */
.staff-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.staff-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), var(--accent-cyan), transparent);
}

.timer-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-primary));
  width: 100%;
  transition: width 0.1s linear;
}

.note-pace-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981, var(--accent-cyan));
  width: 100%;
  transition: width 0.08s linear;
}

.staff-viewport-container {
  width: 100%;
  max-width: 820px;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#staff-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Notificação flutuante de feedback didático */
.feedback-toast {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.feedback-toast.correct {
  color: var(--color-success);
  font-weight: 600;
  text-shadow: 0 0 12px var(--color-success-glow);
}

.feedback-toast.wrong {
  color: var(--color-error);
  font-weight: 600;
  text-shadow: 0 0 12px var(--color-error-glow);
}

/* ==========================================================================
   Controles de Entrada e Digitação
   ========================================================================== */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Caixa de digitação expressa */
.typing-box-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.typing-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.typing-input {
  width: 100%;
  background: rgba(12, 17, 30, 0.85);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  font-size: 1.15rem;
  font-family: var(--font-mono);
  color: #ffffff;
  text-align: center;
  outline: none;
  transition: var(--transition);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.typing-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.typing-input::placeholder {
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.typing-shortcut-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  pointer-events: none;
}

/* Grade de Botões de Notas */
.note-buttons-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.6rem;
  width: 100%;
}

.note-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.note-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.note-btn:active {
  transform: translateY(1px);
}

.note-btn .note-name {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #ffffff;
}

.note-btn .note-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.note-btn .key-hint {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 1px 4px;
  color: var(--text-dim);
}

/* Feedback de clique correto/errado no botão */
.note-btn.btn-correct {
  background: var(--color-success) !important;
  border-color: var(--color-success) !important;
  color: #ffffff !important;
  box-shadow: 0 0 20px var(--color-success-glow) !important;
  transform: scale(1.05);
}

.note-btn.btn-wrong {
  background: var(--color-error) !important;
  border-color: var(--color-error) !important;
  color: #ffffff !important;
  box-shadow: 0 0 20px var(--color-error-glow) !important;
  animation: shake 0.3s ease-in-out;
}

/* ==========================================================================
   Visualizador e Entrada por Instrumento (Piano, Guitarra, Baixo)
   ========================================================================== */
.instrument-section {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.instrument-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.instrument-selector {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 4px;
}

.instrument-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  user-select: none;
}

.instrument-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.instrument-tab.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.instrument-info-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}

.instrument-display {
  width: 100%;
  display: none;
}

.instrument-display.active {
  display: block;
  animation: fadeInDisplay 0.25s ease-out;
}

@keyframes fadeInDisplay {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Teclado de Piano */
.piano-container {
  position: relative;
  display: flex;
  height: 120px;
  padding: 6px;
  background: #0f121d;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.7);
  overflow-x: auto;
  user-select: none;
  justify-content: center;
}

.piano-key {
  position: relative;
  cursor: pointer;
  border-radius: 0 0 5px 5px;
  transition: transform 0.1s ease, background 0.15s ease;
}

.piano-key.white {
  width: 36px;
  height: 100%;
  background: linear-gradient(to bottom, #eeeeee 0%, #ffffff 100%);
  border: 1px solid #cbd5e1;
  border-top: none;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 600;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.piano-key.white:active, .piano-key.white.active {
  background: #e2e8f0;
  transform: translateY(2px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.piano-key.black {
  width: 22px;
  height: 65%;
  background: linear-gradient(to bottom, #1e293b 0%, #090d16 100%);
  border: 1px solid #000000;
  border-top: none;
  margin-left: -11px;
  margin-right: -11px;
  z-index: 2;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}

.piano-key.black:active, .piano-key.black.active {
  background: #0f172a;
  transform: translateY(2px);
}

.piano-key.highlight-target {
  background: var(--accent-cyan) !important;
  box-shadow: 0 0 15px var(--accent-cyan-glow) !important;
}

.piano-key.highlight-correct {
  background: var(--color-success) !important;
  box-shadow: 0 0 15px var(--color-success-glow) !important;
}

/* ==========================================================================
   Braços de Instrumentos de Cordas (Guitarra e Contrabaixo)
   ========================================================================== */
.bass-controls-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.bass-controls-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.bass-strings-pills {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 4px;
}

.string-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.string-pill-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.string-pill-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45);
}

.fretboard-container {
  width: 100%;
  overflow-x: auto;
  padding: 4px 0 8px 0;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.fretboard-container::-webkit-scrollbar {
  height: 6px;
}

.fretboard-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.fretboard-svg {
  width: 100%;
  min-width: 820px;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

/* Textos da escala */
.fret-number-label {
  fill: #94a3b8;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  user-select: none;
}

.fret-number-label.nut-label {
  fill: #e2dacb;
}

.string-indicator-label {
  fill: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
  user-select: none;
}

/* Nós Interativos da Escala */
.fret-node {
  cursor: pointer;
}

.fret-click-target {
  fill: transparent;
}

.fret-note-marker {
  fill: #1e293b;
  stroke: #64748b;
  stroke-width: 1.5;
  opacity: 0;
  transform: scale(0.65);
  transform-box: fill-box;
  transform-origin: center;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.fret-note-text {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
  fill: #ffffff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* Clique ativo / Casa selecionada pelo usuário: revela a nota tocada */
.fret-node.active .fret-note-marker {
  opacity: 1 !important;
  transform: scale(1.18);
  fill: #6366f1 !important;
  stroke: #ffffff !important;
  stroke-width: 2.2 !important;
  filter: drop-shadow(0 0 14px rgba(99, 102, 241, 0.9)) !important;
}

.fret-node.active .fret-note-text {
  opacity: 1 !important;
  visibility: visible !important;
  fill: #ffffff !important;
}

/* Destaque de Nota Alvo / Dica (💡) */
.fret-node.highlight-target .fret-note-marker {
  opacity: 1 !important;
  transform: scale(1.12);
  fill: #0284c7 !important;
  stroke: #38bdf8 !important;
  stroke-width: 2 !important;
  filter: drop-shadow(0 0 14px rgba(56, 189, 248, 0.95)) !important;
  animation: pulseFretTarget 1.2s infinite alternate;
}

.fret-node.highlight-target .fret-note-text {
  opacity: 1 !important;
  visibility: visible !important;
  fill: #ffffff !important;
}

/* Destaque de Acerto */
.fret-node.highlight-correct .fret-note-marker {
  opacity: 1 !important;
  transform: scale(1.18);
  fill: #059669 !important;
  stroke: #10b981 !important;
  stroke-width: 2.4 !important;
  filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.95)) !important;
}

.fret-node.highlight-correct .fret-note-text {
  opacity: 1 !important;
  visibility: visible !important;
  fill: #ffffff !important;
}

/* Uníssonos Exatos (Mesma oitava/altura da nota da partitura) */
.fret-node.highlight-correct.is-unison .fret-note-marker {
  transform: scale(1.24) !important;
  fill: #047857 !important;
  stroke: #fde047 !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 18px rgba(253, 224, 71, 0.95)) drop-shadow(0 0 8px rgba(16, 185, 129, 0.9)) !important;
}

.fret-node.highlight-correct.is-unison .fret-note-text {
  fill: #ffffff !important;
  font-weight: 900 !important;
}

/* Destaque de Erro */
.fret-node.highlight-wrong .fret-note-marker {
  opacity: 1 !important;
  transform: scale(1.12);
  fill: #e11d48 !important;
  stroke: #f43f5e !important;
  stroke-width: 2.2 !important;
  filter: drop-shadow(0 0 16px rgba(244, 63, 94, 0.9)) !important;
}

.fret-node.highlight-wrong .fret-note-text {
  opacity: 1 !important;
  visibility: visible !important;
  fill: #ffffff !important;
}

@keyframes pulseFretTarget {
  0% { transform: scale(1.05); }
  100% { transform: scale(1.18); }
}

/* ==========================================================================
   Modais (Configurações e Estatísticas)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #0f1423;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.pill-option {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pill-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.pill-option.selected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.toggle-switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.switch-label {
  display: flex;
  flex-direction: column;
}

.switch-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.switch-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Tabela de Fraquezas por Nota */
.stats-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.stats-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.6rem 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
}

.stats-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.accuracy-bar-container {
  width: 100px;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.accuracy-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ==========================================================================
   Animações
   ========================================================================== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes popBadge {
  0% { transform: scale(0.6) translateY(10px); opacity: 0; }
  60% { transform: scale(1.15) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes noteSpawn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.sidebar-backdrop {
  display: none;
}

/* ==========================================================================
   Responsividade e Visualização Compacta no Celular (Zero Rolagem)
   ========================================================================== */
@media (max-width: 960px) {
  .app-workspace {
    padding: 0.5rem;
    gap: 0;
  }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 12, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1150;
  }

  .settings-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 86vw);
    max-height: 100dvh;
    overflow-y: auto;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    background: #0d1220;
    z-index: 1200;
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  /* Cabeçalho super compacto no celular */
  .app-header {
    padding: 0.4rem 0.65rem;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
    font-size: 1.15rem;
  }

  .logo-text h1 {
    font-size: 1rem;
  }

  .logo-text span,
  #midi-status-badge {
    display: none !important;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
  }

  /* Layout principal enxuto para caber partitura + braço + notas sem rolar */
  .app-workspace {
    padding: 0.35rem 0.45rem;
  }

  .main-layout {
    gap: 0.45rem;
  }

  /* Barra de modos e pontos compacta */
  .status-bar {
    padding: 0.35rem 0.55rem;
    border-radius: var(--radius-md);
    gap: 0.35rem;
    justify-content: space-between;
  }

  .mode-selector {
    padding: 2px;
  }

  .mode-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
  }

  .stats-badges {
    gap: 0.65rem;
  }

  .stat-label {
    font-size: 0.58rem;
  }

  .stat-value {
    font-size: 0.88rem;
  }

  /* Card da Partitura otimizado para leitura imediata no celular */
  .staff-card {
    padding: 0.4rem 0.35rem 0.35rem;
    border-radius: var(--radius-md);
  }

  .staff-viewport-container {
    height: 120px;
  }

  .feedback-toast {
    min-height: 22px;
    margin-top: 0.15rem;
    font-size: 0.76rem;
    line-height: 1.2;
  }

  /* Seção do Braço do Baixo / Instrumento logo abaixo da partitura */
  .instrument-section {
    padding: 0.45rem 0.5rem;
    border-radius: var(--radius-md);
  }

  .instrument-header {
    margin-bottom: 0.35rem;
    gap: 0.35rem;
    justify-content: center;
  }

  .instrument-info-badge,
  .bass-controls-label {
    display: none;
  }

  .instrument-tab {
    padding: 0.28rem 0.55rem;
    font-size: 0.73rem;
  }

  .bass-controls-bar {
    margin-bottom: 0.35rem;
    justify-content: center;
    gap: 0.35rem;
  }

  .string-pill-btn {
    padding: 0.22rem 0.5rem;
    font-size: 0.7rem;
  }

  .fretboard-container {
    padding: 2px 0 4px 0;
  }

  .fretboard-svg {
    min-width: 580px;
  }

  .piano-container {
    height: 92px;
  }

  /* Linha de 7 Notas em fila única abaixo do braço (sem caixa de digitação para não abrir teclado virtual) */
  .input-section {
    gap: 0.35rem;
  }

  .typing-box-container {
    display: none;
  }

  .note-buttons-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 0.28rem;
  }

  .note-buttons-grid .note-btn:last-child {
    grid-column: span 1;
  }

  .note-btn {
    padding: 0.45rem 0.15rem;
    border-radius: var(--radius-sm);
    gap: 0.1rem;
  }

  .note-btn .key-hint {
    display: none;
  }

  .note-btn .note-name {
    font-size: 0.95rem;
  }

  .note-btn .note-sub {
    font-size: 0.62rem;
  }
}
