    :root { 
        --bg: #0a0a0a; 
        --card-bg: linear-gradient(145deg, #2a2a2a, #1a1a1a);
        --accent: #ff4757; 
        --text-main: #ffffff;
        --text-dim: #b0b0b0;
        --glass-border: rgba(255, 255, 255, 0.25);
    }
    
    * { 
        box-sizing: border-box; 
        user-select: none; 
        -webkit-tap-highlight-color: transparent;
    }
    
        body {
        margin: 0; 
        background: var(--bg); 
        color: var(--text-main);
        font-family: 'Segoe UI', system-ui, sans-serif; 
        min-height: 100vh;
        /* Eliminamos cualquier overflow del body para que manden los contenedores */
    }

    #main-container { 
        display: flex; 
        flex-direction: column; 
        height: 100vh; /* Volvemos a fijarlo para que el menú interno sea el que haga scroll */
        overflow: hidden; 
    }

    #piano-section { 
        height: 30vh; position: relative; border-bottom: 2px solid var(--accent); background: #fff; 
    }

    #menu-section {
        flex: 1; 
        padding: 20px; 
        display: flex; 
        flex-direction: column; 
        gap: 15px;
        background: radial-gradient(circle at top, #1a1a1a 0%, #0a0a0a 100%);
        
        /* REFUERZO DE SCROLL PARA MÓVIL */
        overflow-y: scroll !important; /* Forzamos el scroll vertical */
        -webkit-overflow-scrolling: touch !important; /* Crucial para iOS/Android */
        touch-action: pan-y !important; /* Solo permite mover de arriba a abajo */
    }

    @media (orientation: landscape) and (max-height: 500px) {
        #piano-section { height: 100vh; border-bottom: none; }
        #menu-section { display: none; }
    }

    @media (min-width: 1024px) {
        #main-container { flex-direction: row; }
        #menu-section { width: 400px; flex: none; border-right: 1px solid var(--glass-border); }
        #piano-section { flex: 1; height: 100vh; border-bottom: none; }
    }

    .header-controls { display: flex; flex-direction: column; gap: 12px; padding: 10px 15px; width: 100%; }
    .brand { width: 100%; text-align: center; }
    .brand h1 { margin: 0; font-size: 28px; font-weight: 900; }
    .brand h1 span { color: var(--accent); }

    .ui-controls { display: flex; justify-content: space-between; align-items: center; width: 100%; }
    select { background: #333; color: white; border: 1px solid #555; padding: 6px; border-radius: 8px; font-size: 12px; }
    #lang-switcher { display: flex; background: #333; padding: 2px; border-radius: 10px; border: 1px solid #555; }
    
    .lang-btn { padding: 6px 14px; min-width: 40px; text-align: center; border-radius: 10px; font-size: 11px; cursor: pointer; color: #888; font-weight: bold; }
    .lang-btn.active { background: var(--accent); color: white; }

    #txt-slogan { text-align: center; margin-top: -5px; margin-bottom: 5px; display: block; color: var(--text-dim); font-size: 14px; }

    .btn-card {
        background: var(--card-bg); padding: 20px; border-radius: 20px;
        display: flex; align-items: center; gap: 15px; border: 1px solid var(--glass-border); cursor: pointer;
    }

    .btn-card .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: 
        drop-shadow(0 0 8px var(--accent)) 
        
        drop-shadow(0 0 30px rgba(255, 71, 87, 0.5));
    transition: all 0.3s ease;
    }

    /* Efecto extra cuando pasas el ratón o pulsas */
    .btn-card:active .icon, .btn-card:hover .icon {
        filter: drop-shadow(0 0 20px var(--accent)) brightness(1.3);
        transform: scale(1.05);
    }
    .info-text { display: flex; flex-direction: column; gap: 2px; }
    .btn-card strong { display: block; font-size: 17px; color: #ffffff; font-weight: 800; }
    .btn-card span { display: block; font-size: 13px; color: var(--text-dim); line-height: 1.2; }
    .btn-card:hover .icon {
    filter: drop-shadow(0 0 18px var(--accent)) brightness(1.2); /* Se ilumina más al pasar el ratón */
    }

    .btn-card .icon img {
        width: 50px;
        height: 50px;
        object-fit: contain;
        border-radius: 8px;
    }

    /* Brillos de iconos 
    .btn-card:nth-child(3) .icon, .btn-card:nth-child(4) .icon {
        filter: drop-shadow(0 0 12px var(--accent)) brightness(1.2);
    }*/

    .piano { display: flex; width: 100%; height: 100%; position: relative; background: #000; }
    .white-key { flex: 1; background: #fff; border: 1px solid #ccc; border-radius: 0 0 5px 5px; position: relative; }
    .black-key { position: absolute; background: #222; width: 4%; height: 60%; z-index: 2; border-radius: 0 0 3px 3px; transform: translateX(-50%); }

    /* Estilos para la nueva sección de repertorio */
#section-repertoire {
    background: radial-gradient(circle at top, #1a1a1a 0%, #0a0a0a 100%);
    min-height: 70vh;
}

.midi-card {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--glass-border);
}

.midi-card button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

/* Contenedor principal */
#contenedor-repertorio-dinamico {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 15px;
    font-family: sans-serif;
}

/* Estilo de la "Carpeta" (Categoría) */
.categoria-header {
    background: #333;
    color: white;
    padding: 15px;
    margin-top: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    transition: background 0.3s;
}

.categoria-header:hover { background: #444; }

/* El triangulito */
.flecha {
    transition: transform 0.3s;
    font-size: 0.8em;
}

/* Cuando la carpeta esté abierta, la flecha gira */
.abierta .flecha { transform: rotate(180deg); }

/* Contenedor de canciones (oculto por defecto) */
.lista-canciones {
    display: none; /* Se oculta */
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-bottom: 10px;
}

/* Fila de cada canción */
.fila-midi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #eee;
    background-color: #fff;
}

.info {
    flex: 1; /* Esto hace que la info ocupe todo el espacio sobrante */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.titulo-bonito { font-weight: bold; display: block; color: #333; }
/* El texto de la Tonalidad Original */
.autor-bonito {
    font-size: 0.85em;
    color: #666;
}

.btn-play-repertorio {
    background: #007bff;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
}

/* Centrar y estilizar el título principal */
.titulo-repertorio {
    margin: 40px 20px 20px 20px; /* Despega de arriba, izquierda y abajo */
    font-size: 2.2em;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5); /* Sombra para dar profundidad */
    border-left: 5px solid #007bff; /* Una línea azul elegante a la izquierda */
    padding-left: 15px;
}

/* Mejora sutil de las carpetas para que no sean tan sobrias */
.categoria-header {
    background: linear-gradient(135deg, #444 0%, #222 100%); /* Degradado elegante */
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 1px solid #555;
}

/* Efecto al pasar el ratón por la fila de la canción */
.fila-midi:hover {
    background-color: #f0f7ff; /* Un azul muy suave al señalar la canción */
    transition: background-color 0.2s;
}

.controles-fila {
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.btn-stop {
    background-color: #dc3545; /* Rojo para el Stop */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.btn-stop:hover {
    background-color: #a71d2a;
}

.controles-musica {
    margin-top: 8px;
    font-size: 0.9em;
    color: #222; /* Color oscuro para lectura clara */
    display: flex;
    align-items: center;
    gap: 8px;
}

.controles-musica b {
    color: #d4af37; /* Dorado para el número */
    font-size: 1.1em;
}

.btn-peque {
    background: #444;
    color: #d4af37; /* El dorado que usamos */
    border: 1px solid #d4af37;
    border-radius: 4px;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.btn-peque:hover {
    background: #d4af37;
    color: black;
}

.contenedor-cancion {
    border-bottom: 1px solid #eee;
    background: #fff;
}

.fila-titulo-cancion {
    padding: 15px;
    background-color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.titulo-lista {
    color: #1a1a1a; /* Casi negro */
    font-weight: bold;
    display: block;
}

.info-basica {
    display: flex;
    flex-direction: column;
}

.autor-lista {
    color: #555 !important; /* Gris oscuro para que se lea bien */
    font-size: 0.8em;
}

.flecha-sutil {
    font-size: 0.7em;
    color: #ccc;
    transition: transform 0.3s;
}

/* El Panel desplegable */
.panel-controles {
    display: none; /* ESTO ES VITAL */
    background-color: #f4f4f4; /* Fondo gris claro para diferenciarlo */
    padding: 20px;
    border-bottom: 2px solid #d4af37;
}

.panel-controles.activo {
    display: block !important;
}

.etiqueta-negra {
    color: #000;
    font-weight: bold;
    margin-right: 10px;
}

/* Esta clase la pondremos con JavaScript para abrirlo */
.panel-controles.abierto {
    display: block !important;
}

.numero-tono {
    color: #d4af37;
    font-size: 1.2em;
    min-width: 25px;
    display: inline-block;
    text-align: center;
}


.fila-titulo-cancion:active {
    background-color: #f0f0f0; /* Efecto de pulsación en móvil */
}

.ajustes-musicales {
    display: flex;
    justify-content: space-between; /* Separa Tono de Tempo */
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 10px;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1; /* Hace que ambos ocupen el mismo ancho */
}

.selector-numero {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.botones-reproduccion {
    display: flex;
    gap: 10px;
}

.botones-reproduccion button {
    flex: 1; /* Botones grandes y equilibrados */
    padding: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Botones de tempo desactivados */
.btn-tempo-desactivado {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none; /* Esto evita que hagan clic */
}

/* Estilos para el Modal */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.modal-contenido {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    color: #333;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
}

.cerrar-modal {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.campo { margin-bottom: 15px; display: flex; flex-direction: column; }
.campo label { font-weight: bold; margin-bottom: 5px; font-size: 0.9em; }
.campo input, .campo select { padding: 10px; border-radius: 8px; border: 1px solid #ccc; }

.campo-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-guardar {
    width: 100%;
    padding: 15px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-guardar:hover { background-color: #27ae60; }

/* Quitamos las flechas nativas definitivamente ya que tenemos botones */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] { -moz-appearance: textfield; }

#vocal-bpm {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffcc00; /* Color destacado para el tempo */
}

.voz-header {
    font-size: 0.9em;
    border-left: 3px solid #ffcc00;
    transition: all 0.3s ease;
}
.voz-header:hover {
    background: #333 !important;
}