/* ==========================================================================
   DICCIONARIO INTERACTIVO DE ACORDES DE GUITARRA Y UKELELE • FIJATE TOOLS
   Estándares canónicos de fijate.com (A11y, Temas claro/oscuro, Mobile First)
   ========================================================================== */

:root {
  /* Paleta cromática compartida */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-rgb: 59, 130, 246;
  --color-accent: #8b5cf6;
  --color-accent-hover: #7c3aed;
  --color-accent-rgb: 139, 92, 246;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Tema Oscuro (Por defecto)
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-app: #0c1017;
  --bg-card: #131924;
  --bg-card-hover: #1a2232;
  --bg-card-glass: rgba(19, 25, 36, 0.85);
  --bg-subtle: #1e2738;
  --bg-input: #151d2c;
  --bg-fretboard: #1c1511;
  --bg-fretboard-grad: linear-gradient(180deg, #241b16 0%, #17110e 100%);
  --fret-wire: #94a3b8;
  --fret-marker: #475569;
  --string-color: #cbd5e1;
  --string-shadow: rgba(0, 0, 0, 0.6);

  --border-color: #232f42;
  --border-subtle: #192333;
  --border-active: #3b82f6;

  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-highlight: #60a5fa;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.25);
}

/* --------------------------------------------------------------------------
   Tema Claro
   -------------------------------------------------------------------------- */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-glass: rgba(255, 255, 255, 0.92);
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --bg-fretboard: #d6b896;
  --bg-fretboard-grad: linear-gradient(180deg, #dfc5a6 0%, #caa983 100%);
  --fret-wire: #64748b;
  --fret-marker: #8a735a;
  --string-color: #475569;
  --string-shadow: rgba(0, 0, 0, 0.25);

  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-active: #2563eb;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-highlight: #1d4ed8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.18);
}

/* --------------------------------------------------------------------------
   Reset y configuración base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* --------------------------------------------------------------------------
   Contenedores principales y layout
   -------------------------------------------------------------------------- */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Tarjeta principal y componentes de superficie
   -------------------------------------------------------------------------- */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  position: relative;
}

@media (max-width: 768px) {
  .card-main {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }
}

.card-surface {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

/* --------------------------------------------------------------------------
   Barra superior de configuración (Instrumento, Orientación, Notación)
   -------------------------------------------------------------------------- */
.top-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 4px;
}

.toolbar-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  transition: all var(--transition-fast);
}

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

.toolbar-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.toolbar-btn svg {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Pestañas de modo (Diccionario vs Buscador inverso)
   -------------------------------------------------------------------------- */
.mode-nav-container {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
  gap: 0.5rem;
}

.mode-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}

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

.mode-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.mode-tab-btn .badge-mode {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.mode-tab-btn.active .badge-mode {
  background: rgba(var(--color-primary-rgb), 0.15);
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Panel de búsqueda y selección (Modo Diccionario)
   -------------------------------------------------------------------------- */
.chord-selector-box {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Selector cromático de tónicas */
.root-selector-area {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.selector-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.roots-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.4rem;
}

@media (max-width: 900px) {
  .roots-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .roots-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.root-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 0.6rem 0.25rem;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  transition: all var(--transition-fast);
}

.root-btn:hover {
  border-color: var(--color-primary);
  background: var(--bg-card-hover);
}

.root-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 0 12px rgba(var(--color-primary-rgb), 0.35);
}

.root-btn .root-alt {
  font-family: var(--font-main);
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.8;
  line-height: 1;
  margin-top: 2px;
}

/* Selector de cualidades/tipos de acordes */
.quality-categories-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quality-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quality-cat-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  min-height: 36px;
  transition: all var(--transition-fast);
}

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

.quality-cat-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

.qualities-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.quality-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  min-height: 40px;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quality-btn:hover {
  border-color: var(--color-accent);
  background: var(--bg-card-hover);
}

.quality-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(var(--color-accent-rgb), 0.35);
}

/* --------------------------------------------------------------------------
   Visor de información del acorde actual (Header & Telemetría)
   -------------------------------------------------------------------------- */
.chord-summary-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.chord-hero-info {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chord-hero-name {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.chord-hero-latin {
  font-family: var(--font-main);
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.chord-formula-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(var(--color-primary-rgb), 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.chord-notes-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.note-chip .chip-name {
  font-weight: 700;
  color: var(--text-main);
}

.note-chip .chip-interval {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
}

.note-chip.is-root {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.08);
}

.note-chip.is-root .chip-name {
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Controles de sonido y rasgueo (Strumming Bar)
   -------------------------------------------------------------------------- */
.strum-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.strum-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-strum {
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-strum:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-strum:active {
  transform: translateY(0);
}

.btn-strum.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-strum.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

.strum-params {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.param-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.param-slider {
  appearance: none;
  width: 90px;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Visor de variaciones / posturas (Paginador)
   -------------------------------------------------------------------------- */
.variation-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pager-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  transition: all var(--transition-fast);
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--bg-card-hover);
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-info {
  text-align: center;
}

.pager-count {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.pager-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Área de Diagramas y Diapasón (Fretboard Container)
   -------------------------------------------------------------------------- */
.fretboard-display-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

@media (max-width: 860px) {
  .fretboard-display-grid {
    grid-template-columns: 1fr;
  }
}

/* Tarjeta del diagrama vertical tradicional (Chord Box) */
.chord-box-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.chord-box-svg-wrapper {
  width: 100%;
  max-width: 200px;
  margin: 0.5rem auto;
}

.chord-box-svg-wrapper svg {
  width: 100%;
  height: auto;
  display: block;
}

.chord-box-legend {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Tarjeta del mástil horizontal interactivo */
.fretboard-horizontal-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

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

.fretboard-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.fretboard-badge-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.fretboard-scroll-area {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  padding: 0.5rem 0;
  background: var(--bg-fretboard);
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--bg-subtle);
}

.fretboard-scroll-area::-webkit-scrollbar {
  height: 8px;
}

.fretboard-scroll-area::-webkit-scrollbar-track {
  background: var(--bg-subtle);
}

.fretboard-scroll-area::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.fretboard-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

.fretboard-svg-element {
  display: block;
  min-width: 760px;
  width: 100%;
  height: auto;
  user-select: none;
}

/* Estilos garantizados para puntos y cejillas en diagramas SVG */
.chord-box-note-point circle:not([stroke]):not([fill="transparent"]),
.chord-box-dot,
.fret-active-marker circle {
  fill: #2563eb !important;
  stroke: #93c5fd !important;
  stroke-width: 2px !important;
  filter: drop-shadow(0 2px 5px rgba(37, 99, 235, 0.5));
}

.chord-box-barre-rect,
.fret-horizontal-barre {
  fill: #2563eb !important;
  stroke: #93c5fd !important;
  stroke-width: 1.5px !important;
  filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.45));
}

.fret-active-marker text,
.chord-box-note-point text {
  fill: #ffffff !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   Modo Buscador Inverso (Reverse Chord Finder)
   -------------------------------------------------------------------------- */
.reverse-finder-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.reverse-instructions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(var(--color-primary-rgb), 0.08);
  border: 1px solid rgba(var(--color-primary-rgb), 0.25);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  gap: 1rem;
}

.instruction-text {
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.instruction-text strong {
  color: var(--color-primary);
}

.reverse-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-clear-fretboard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  transition: all var(--transition-fast);
}

.btn-clear-fretboard:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* Panel de resultado del buscador inverso */
.reverse-result-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.reverse-hero-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.reverse-detected-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.reverse-detected-title.none-detected {
  font-size: 1.4rem;
  color: var(--text-muted);
  font-weight: 600;
}

.reverse-inversion-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: rgba(var(--color-accent-rgb), 0.12);
  color: var(--color-accent);
  border: 1px solid rgba(var(--color-accent-rgb), 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.reverse-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.reverse-metric-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

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

.reverse-alternatives-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.alt-chord-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.alt-chord-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Exportación y opciones auxiliares
   -------------------------------------------------------------------------- */
.bottom-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.btn-action-aux {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  transition: all var(--transition-fast);
}

.btn-action-aux:hover {
  color: var(--text-main);
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

/* --------------------------------------------------------------------------
   Modales canónicos accesibles
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.is-open {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(12px);
  transition: transform var(--transition-normal);
}

.modal-backdrop.is-open .modal-dialog {
  transform: translateY(0);
}

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

.modal-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

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

.modal-body {
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   Sección SEO pedagógica canónica (.seo-guide-section)
   -------------------------------------------------------------------------- */
.seo-guide-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.seo-guide-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 2.5rem;
}

.seo-authority-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

.seo-guide-title {
  font-family: var(--font-title);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.seo-guide-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.seo-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.seo-guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.guide-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.seo-guide-card h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.seo-guide-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.seo-guide-card p:last-child {
  margin-bottom: 0;
}

.guide-table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

.guide-table th, .guide-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.guide-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-title);
}

.guide-table tr:last-child td {
  border-bottom: none;
}

/* Acordeón FAQ nativo */
.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 900px;
  margin: 0 auto;
}

.seo-faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.seo-faq-item[open] {
  border-color: var(--color-primary);
}

.seo-faq-question {
  padding: 1rem 1.25rem;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.seo-faq-question::-webkit-details-marker {
  display: none;
}

.seo-faq-question::after {
  content: "+";
  font-size: 1.4rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.seo-faq-item[open] .seo-faq-question::after {
  content: "−";
  color: var(--color-primary);
}

.seo-faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Adaptaciones Mobile y ergonomía táctil
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .top-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-group {
    justify-content: center;
    width: 100%;
  }

  .toolbar-btn {
    flex: 1 1 0%;
    justify-content: center;
  }

  .mode-nav-container {
    overflow-x: auto;
  }

  .mode-tab-btn {
    flex: 1 1 0%;
    justify-content: center;
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
    white-space: nowrap;
  }

  .chord-hero-name {
    font-size: 1.8rem;
  }

  .btn-strum {
    width: 100%;
    justify-content: center;
  }

  .strum-btn-group {
    width: 100%;
  }

  .strum-params {
    width: 100%;
    justify-content: space-between;
  }
}

/* --------------------------------------------------------------------------
   VISTA 3: CANCIONES Y PROGRESIONES FAMOSAS
   -------------------------------------------------------------------------- */
.songs-view-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.songs-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.song-select-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.song-select-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.song-select-card.active {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.1);
  box-shadow: 0 0 14px rgba(var(--color-primary-rgb), 0.25);
}

.song-card-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.song-card-artist {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.song-card-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.badge-difficulty {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-diff-facil {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.badge-diff-media {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-diff-avanzada {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.badge-song-bpm {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Reproductor de la canción activa */
.song-player-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.song-player-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.song-active-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.song-active-artist {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.song-active-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Controles de reproducción de la canción */
.song-playback-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
}

.btn-song-play {
  background: var(--color-success);
  color: #ffffff;
  border: none;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-song-play:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-song-play.is-playing {
  background: var(--color-warning);
  color: #1a1a1a;
}

.song-step-btns {
  display: inline-flex;
  gap: 0.4rem;
}

.song-tempo-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.song-tempo-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
  min-width: 48px;
}

/* Tira cronológica de acordes (Timeline) */
.song-timeline-wrapper {
  overflow-x: auto;
  padding: 0.75rem 0;
  scrollbar-width: thin;
}

.song-timeline-track {
  display: flex;
  gap: 0.6rem;
  min-width: max-content;
}

.chord-step-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-width: 95px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.chord-step-card:hover {
  border-color: var(--color-primary);
  background: var(--bg-card-hover);
}

.chord-step-card.active {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.15);
  box-shadow: 0 0 12px rgba(var(--color-primary-rgb), 0.35);
  transform: scale(1.05);
}

.chord-step-card.is-sounding {
  border-color: var(--color-success);
  background: rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
}

.step-card-chord {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.step-card-latin {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.step-card-beats {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.step-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.05s linear;
}

.chord-step-card.active .step-progress-bar {
  width: 100%;
}

