* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
}

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #121212;
  color: #e8e8e8;
  padding: 0;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* =====================
   MENÚ SUPERIOR
===================== */
#menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

#menu button {
  background: none;
  border: none;
  color: #e8e8e8;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

#menu button:hover {
  background: rgba(255,255,255,0.08);
}

#menu-tema {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  color: #999;
}

#menu-tema .breadcrumb-link {
  cursor: pointer;
  color: #00e5ff;
  transition: opacity 0.15s;
}

#menu-tema .breadcrumb-link:hover {
  opacity: 0.7;
}

#menu-tema .breadcrumb-actual {
  color: #e8e8e8;
  font-weight: 500;
}

/* =====================
   BUSCADOR
===================== */
#panel-buscador {
  padding: 16px 20px 0;
  flex-shrink: 0;
}

#buscador {
  width: 100%;
  max-width: 480px;
  display: block;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.95rem;
  background: #1e1e1e;
  color: #e8e8e8;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#buscador:focus {
  border-color: #00e5ff;
  box-shadow: 0 0 0 3px rgba(0,229,255,0.15);
}

#buscador::placeholder {
  color: #666;
}

#resultados {
  max-width: 700px;
  margin: 0 auto;
}

.resultado {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.9rem;
}

.resultado:hover {
  background: rgba(0,229,255,0.08);
}

.resultado-tema {
  font-size: 0.8rem;
  color: #888;
}

.resultado-preview {
  font-size: 0.8rem;
  color: #999;
  margin-top: 4px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#contador-resultados {
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  margin-top: 4px;
}

/* =====================
   VISTA TEMAS
===================== */
#vista-temas {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#temas-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 10px;
}

#temas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.tema {
  background: #1e1e1e;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 1px solid rgba(255,255,255,0.06);
}

.tema:hover {
  background: #252525;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-color: rgba(0,229,255,0.2);
}

.tema img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
}

.tema p {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ccc;
  letter-spacing: 0.3px;
}

/* =====================
   PAGINACIÓN
===================== */
#paginacion {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 12px;
  text-align: center;
  background: #121212;
}

#paginacion button {
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: #1e1e1e;
  color: #ccc;
  font-size: 0.85rem;
  transition: background 0.15s;
}

#paginacion button:hover {
  background: #2a2a2a;
}

#paginacion button.activa {
  font-weight: 700;
  border-color: #00e5ff;
  color: #00e5ff;
  cursor: default;
}

#paginacion button:disabled {
  opacity: 0.3;
  cursor: default;
}

/* =====================
   VISTA CANCIONES
===================== */
#vista-canciones {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#nombre-tema {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #e8e8e8;
}

#canciones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.cancion-card {
  background: #1e1e1e;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.3;
  color: #ddd;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cancion-card:hover {
  background: #252525;
  transform: translateY(-2px);
  border-color: rgba(0,229,255,0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.cancion-card:active {
  transform: scale(0.97);
}

/* =====================
   VISTA CANCIÓN
===================== */
#vista-cancion {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  padding: 20px;
}

#nombre-cancion {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #e8e8e8;
}

/* =====================
   TRANSPOSICIÓN
===================== */
#transponer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}

.controles-tono {
  display: flex;
  gap: 8px;
  align-items: center;
}

.controles-tono button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: #1e1e1e;
  color: #e8e8e8;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.controles-tono button:hover {
  background: #2a2a2a;
  border-color: #00e5ff;
}

#tono-reset {
  padding: 0 14px !important;
  width: auto !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
}

#tono-valor {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: #00e5ff;
}

.info-tono {
  font-size: 0.8rem;
  color: #666;
  display: flex;
  gap: 16px;
}

.control-columnas {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.col-btn {
  width: 32px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: #888;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.col-btn:hover {
  border-color: #00e5ff;
  color: #00e5ff;
}

.col-btn.activo {
  background: #00e5ff;
  color: #121212;
  border-color: #00e5ff;
}

/* =====================
   LETRA
===================== */
#letra {
  flex: 1;
  min-height: 0;
  background: #181818;
  border-radius: 12px;
  padding: 10px 25px 5px;
  font-size: 0.9rem;
  column-gap: 32px;
  column-fill: auto;
  column-rule: 1px solid rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.04);
}

#letra.cols-3 { column-count: 3; }

.linea-musical {
  position: relative;
  display: block;
  height: 65px;
  break-inside: avoid;
  white-space: pre-wrap;
}

.salto-parrafo {
  height: 0.6em;
}

/* =====================
   ACORDES
===================== */
.acorde, .acorde-simple {
  position: absolute;
  bottom: 1.0em;
  left: 0;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.85em;
  color: #00e5ff;
  text-shadow: 0 0 8px rgba(0,229,255,0.3);
  z-index: 10;
  letter-spacing: 0.5px;
}

.contenedor-acorde-flotante {
  position: relative;
  display: inline-block;
  width: 0;
  vertical-align: baseline;
}

.contenedor-acorde-flotante:hover {
  z-index: 9999;
}

.acorde {
  position: relative;
  cursor: help;
  display: inline-block;
}

.acorde .tooltip-acorde {
  position: absolute;
  bottom: 150%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: none;
  line-height: 0;
}

.acorde:hover .tooltip-acorde {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tooltip-acorde svg {
  width: 80px;
  height: 100px;
  display: block;
  margin-left: -10px !important;
}

.separador-musical {
  display: inline-block;
  position: relative;
  width: 40px;
  color: transparent;
  vertical-align: middle;
}

/* =====================
   BLOQUES ESPECIALES
===================== */
.tab {
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.3;
  background: #0d0d0d;
  color: #4caf50;
  padding: 14px 16px;
  margin: 1em 0;
  border-radius: 8px;
  white-space: pre;
  overflow-x: auto;
  break-inside: avoid;
  border: 1px solid rgba(76,175,80,0.15);
}

.bloque-acordes {
  background: rgba(0,229,255,0.04);
  border-left: 3px solid #00e5ff;
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 2;
  break-inside: avoid;
  display: block;
}

.bloque-acordes .acorde,
.bloque-acordes .acorde-simple {
  position: relative !important;
  z-index: 20;
  bottom: 0 !important;
  display: inline-block !important;
  margin: 0 6px !important;
  vertical-align: baseline;
}

.bloque-acordes .acorde .tooltip-acorde {
  bottom: 130% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

.bloque-coro {
  border-left: 3px solid #4CAF50;
  padding: 4px 14px 10px;
  margin: 12px 0;
  background: rgba(76,175,80,0.06);
  border-radius: 8px;
  overflow: visible;
  position: relative;
}

.coro-linea {
  color: #66bb6a;
  font-weight: 500;
}

.coro-azul {
  border-color: #2196F3;
  color: #42a5f5;
}

.coro-rojo {
  border-color: #f44336;
  color: #ef5350;
}

.bloque-coro .linea-musical {
  display: block;
}

/* =====================
   FOOTER
===================== */
footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: #666;
  border-top: 1px solid rgba(255,255,255,0.06);
}

footer a {
  color: #00e5ff;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* =====================
   IMPRESIÓN
===================== */
@media print {
  body {
    background: white !important;
    color: #111 !important;
  }

  #menu, #panel-buscador, #paginacion, #transponer, .control-columnas {
    display: none !important;
  }

  #vista-cancion {
    overflow: visible !important;
    padding: 0 !important;
    display: block !important;
    flex: none !important;
  }

  #letra {
    background: white !important;
    column-count: 1 !important;
    height: auto !important;
    flex: none !important;
    min-height: auto !important;
    border: none !important;
    padding: 0 !important;
    color: #111 !important;
  }

  #letra.cols-3 {
    column-count: 1 !important;
  }

  .acorde, .acorde-simple {
    color: #555 !important;
    text-shadow: none !important;
  }

  .tab {
    background: #f5f5f5 !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
  }

  .bloque-acordes {
    background: #f9f9f9 !important;
    border-left-color: #888 !important;
  }

  .bloque-coro {
    background: #f0f7f0 !important;
  }

  .coro-linea {
    color: #2e7d32 !important;
  }

  .tema img {
    display: none !important;
  }
}
